diff -ur fontconfig-2.8.0.orig/src/fcfreetype.c fontconfig-2.8.0/src/fcfreetype.c --- fontconfig-2.8.0.orig/src/fcfreetype.c 2010-01-13 17:43:53.000000000 +0800 +++ fontconfig-2.8.0/src/fcfreetype.c 2010-01-13 19:38:38.000000000 +0800 @@ -2494,9 +2494,10 @@ * which can be scaled; otherwise those fonts will * only be available at some sizes, and never when * transformed. Avoid this by simply reporting bitmap-only - * glyphs as missing + * glyphs as missing. Unless using_strike is specifically + * required. */ - if (face->face_flags & FT_FACE_FLAG_SCALABLE) + if ((face->face_flags & FT_FACE_FLAG_SCALABLE) && !using_strike) load_flags |= FT_LOAD_NO_BITMAP; if (FT_Load_Glyph (face, glyph, load_flags)) @@ -2555,6 +2556,7 @@ FT_Pos advance, advance_one = 0, advance_two = 0; FcBool has_advance = FcFalse, fixed_advance = FcTrue, dual_advance = FcFalse; FcBool using_strike = FcFalse; + FcBool has_glyf_data = FcFalse; /* Test empty font. */ fcs = FcCharSetCreate (); if (!fcs) @@ -2589,6 +2591,8 @@ if (glyph && FcFreeTypeCheckGlyph (face, ucs4, glyph, blanks, &advance, using_strike)) { + if (!has_glyf_data && !FcBlanksIsMember (blanks, ucs4)) + has_glyf_data = FcTrue; /* * ignore glyphs with zero advance. They’re * combining characters, and while their behaviour @@ -2637,6 +2641,8 @@ { if (FcFreeTypeCheckGlyph (face, ucs4, glyph, blanks, &advance, using_strike)) { + if (!has_glyf_data && !FcBlanksIsMember (blanks, ucs4)) + has_glyf_data = FcTrue; if (advance) { if (!has_advance) @@ -2704,6 +2710,8 @@ if (ucs4 != 0xffff && FcFreeTypeCheckGlyph (face, ucs4, glyph, blanks, &advance, using_strike)) { + if (!has_glyf_data && !FcBlanksIsMember (blanks, ucs4)) + has_glyf_data = FcTrue; if (advance) { if (!has_advance) @@ -2754,6 +2762,17 @@ printf ("Bitmap extra char 0x%x\n", ucs4); } #endif + /* If none of the glyphs has real glyf data, return an empty charset. */ + if (!has_glyf_data) { +#ifdef CHECK + printf("Empty Font: %s(%i)\n", face->family_name, strike_index); +#endif + FcCharSetDestroy (fcs); + fcs = FcCharSetCreate (); + if (!fcs) + goto bail0; + } + if (fixed_advance) *spacing = FC_MONO; else if (dual_advance && APPROXIMATELY_EQUAL (2 * FC_MIN (advance_one, advance_two), FC_MAX (advance_one, advance_two))) @@ -2780,8 +2799,7 @@ if (FcCharSetCount (cs) == 0) { /* Check for non-scalable TT fonts */ - if (!(face->face_flags & FT_FACE_FLAG_SCALABLE) && - face->num_fixed_sizes > 0 && + if (face->num_fixed_sizes > 0 && FT_Get_Sfnt_Table (face, ft_sfnt_head)) { FT_Int strike_index = 0; @@ -2793,7 +2811,8 @@ abs (face->available_sizes[strike_index].height - 16)) strike_index = i; } - FcCharSetDestroy (cs); + if (cs) + FcCharSetDestroy (cs); cs = FcFreeTypeCharSetAndSpacingForSize (face, blanks, spacing, strike_index); } }