diff libass/ass_font.c @ 23134:1de2a46a0987

Add -ass-hinting option for setting font hinting method. It is possible to separately configure hinting for scaled and unscaled osd. The default is native hinter for unscaled osd (only vo_gl at this point), no hinting for vf_ass.
author eugeni
date Fri, 27 Apr 2007 14:25:36 +0000
parents 4a958bd08920
children c932f521344d
line wrap: on
line diff
--- a/libass/ass_font.c	Fri Apr 27 14:18:44 2007 +0000
+++ b/libass/ass_font.c	Fri Apr 27 14:25:36 2007 +0000
@@ -229,13 +229,14 @@
  * \brief Get a glyph
  * \param ch character code
  **/
-FT_Glyph ass_font_get_glyph(void* fontconfig_priv, ass_font_t* font, uint32_t ch)
+FT_Glyph ass_font_get_glyph(void* fontconfig_priv, ass_font_t* font, uint32_t ch, ass_hinting_t hinting)
 {
 	int error;
 	int index = 0;
 	int i;
 	FT_Glyph glyph;
 	FT_Face face = 0;
+	int flags = 0;
 
 	if (ch < 0x20)
 		return 0;
@@ -264,7 +265,14 @@
 	}
 #endif
 
-	error = FT_Load_Glyph(face, index, FT_LOAD_NO_BITMAP );
+	switch (hinting) {
+	case ASS_HINTING_NONE: flags = FT_LOAD_NO_HINTING; break;
+	case ASS_HINTING_LIGHT: flags = FT_LOAD_FORCE_AUTOHINT | FT_LOAD_TARGET_LIGHT; break;
+	case ASS_HINTING_NORMAL: flags = FT_LOAD_FORCE_AUTOHINT; break;
+	case ASS_HINTING_NATIVE: flags = 0; break;
+	}
+	
+	error = FT_Load_Glyph(face, index, FT_LOAD_NO_BITMAP | flags);
 	if (error) {
 		mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_ErrorLoadingGlyph);
 		return 0;