From: Grigori Goronzy Date: Sat, 10 Apr 2010 02:02:36 +0000 (+0200) Subject: Ignore global advance width unconditionally X-Git-Tag: 0.9.10~48 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29167f37cf188f0b4dc6003ff6e733388112d183;p=libass Ignore global advance width unconditionally Some (arguably) broken CJK fonts claim to have a fixed advance width, but they actually use two different widths for half-width and full-width characters. Even worse, some use proportional width. This can cause problems under certain circumstances. A big project (Cairo) uses a FreeType load flag to ignore the global advance width for such fonts, so I assume it can be used safely. Let's do it just like them. --- diff --git a/libass/ass_font.c b/libass/ass_font.c index 7db1f07..bb2b96a 100644 --- a/libass/ass_font.c +++ b/libass/ass_font.c @@ -451,22 +451,22 @@ FT_Glyph ass_font_get_glyph(void *fontconfig_priv, ASS_Font *font, } #endif + flags = FT_LOAD_NO_BITMAP | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH; switch (hinting) { case ASS_HINTING_NONE: - flags = FT_LOAD_NO_HINTING; + flags |= FT_LOAD_NO_HINTING; break; case ASS_HINTING_LIGHT: - flags = FT_LOAD_FORCE_AUTOHINT | FT_LOAD_TARGET_LIGHT; + flags |= FT_LOAD_FORCE_AUTOHINT | FT_LOAD_TARGET_LIGHT; break; case ASS_HINTING_NORMAL: - flags = FT_LOAD_FORCE_AUTOHINT; + flags |= FT_LOAD_FORCE_AUTOHINT; break; case ASS_HINTING_NATIVE: - flags = 0; break; } - error = FT_Load_Glyph(face, index, FT_LOAD_NO_BITMAP | flags); + error = FT_Load_Glyph(face, index, flags); if (error) { ass_msg(font->library, MSGL_WARN, "Error loading glyph, index %d", index);