diff options
author | Akira TAGOH <akira@tagoh.org> | 2012-03-07 17:32:14 +0900 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2012-03-07 17:32:14 +0900 |
commit | 1f01c4b60c4c5e16a92d60f76ce615005c7db6b8 (patch) | |
tree | 9d98e940a4f30d5b31c927e6f623e949899640fe /src | |
parent | a13d518fdd079aeb0bd07a0457393cca8def7f90 (diff) |
Bug 23336 - unable to display bitmap-only (SFNT) TrueType or OpenType
Force to find out a size for bitmap-only ttf to avoid the blank glyphs
in the font.
Patch from Bug Fly
Diffstat (limited to 'src')
-rw-r--r-- | src/fcfreetype.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/src/fcfreetype.c b/src/fcfreetype.c index e322e8c..ce7dc83 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -2513,31 +2513,27 @@ FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks, int *spacing) { FcCharSet *cs; - cs = FcFreeTypeCharSetAndSpacingForSize (face, blanks, spacing, -1); /* * Check for bitmap-only ttf fonts that are missing the glyf table. * In that case, pick a size and look for glyphs in that size instead */ - if (FcCharSetCount (cs) == 0) + if (!(face->face_flags & FT_FACE_FLAG_SCALABLE) && + face->num_fixed_sizes > 0 && + FT_Get_Sfnt_Table (face, ft_sfnt_head)) { - /* Check for non-scalable TT fonts */ - if (!(face->face_flags & FT_FACE_FLAG_SCALABLE) && - face->num_fixed_sizes > 0 && - FT_Get_Sfnt_Table (face, ft_sfnt_head)) - { - FT_Int strike_index = 0; - int i; - - /* Select the face closest to 16 pixels tall */ - for (i = 1; i < face->num_fixed_sizes; i++) { - if (abs (face->available_sizes[i].height - 16) < - abs (face->available_sizes[strike_index].height - 16)) - strike_index = i; - } - FcCharSetDestroy (cs); - cs = FcFreeTypeCharSetAndSpacingForSize (face, blanks, spacing, strike_index); + FT_Int strike_index = 0; + int i; + + /* Select the face closest to 16 pixels tall */ + for (i = 1; i < face->num_fixed_sizes; i++) { + if (abs (face->available_sizes[i].height - 16) < + abs (face->available_sizes[strike_index].height - 16)) + strike_index = i; } + cs = FcFreeTypeCharSetAndSpacingForSize (face, blanks, spacing, strike_index); } + else + cs = FcFreeTypeCharSetAndSpacingForSize (face, blanks, spacing, -1); return cs; } |