FT_Library ftLibrary;
FcChar8 *family;
FcChar8 *style;
+ int spacing;
TT_OS2 *os2;
TT_Header *head;
const FcChar8 *exclusiveLang = 0;
/*
* Compute the unicode coverage for the font
*/
- cs = FcFreeTypeCharSet (face, blanks);
+ cs = FcFreeTypeCharSetAndSpacing (face, blanks, &spacing);
if (!cs)
goto bail1;
if (!FcPatternAddLangSet (pat, FC_LANG, ls))
goto bail2;
+ if (spacing != FC_PROPORTIONAL)
+ if (!FcPatternAddInteger (pat, FC_SPACING, spacing))
+ goto bail2;
+
/*
* Drop our reference to the charset
*/
static FcBool
FcFreeTypeCheckGlyph (FT_Face face, FcChar32 ucs4,
- FT_UInt glyph, FcBlanks *blanks)
+ FT_UInt glyph, FcBlanks *blanks,
+ FT_Pos *advance)
{
FT_Int load_flags = FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
FT_GlyphSlot slot;
if (!glyph)
return FcFalse;
+ *advance = slot->metrics.horiAdvance;
+
switch (slot->format) {
case ft_glyph_format_bitmap:
/*
}
FcCharSet *
-FcFreeTypeCharSet (FT_Face face, FcBlanks *blanks)
+FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks, int *spacing)
{
FcChar32 page, off, max, ucs4;
#ifdef CHECK
int o;
int i;
FT_UInt glyph;
+ FT_Pos advance, all_advance = 0;
+ FcBool has_advance = FcFalse, fixed_advance = FcTrue;
fcs = FcCharSetCreate ();
if (!fcs)
{
ucs4 = map->ent[i].bmp;
glyph = FT_Get_Char_Index (face, map->ent[i].encode);
- if (glyph && FcFreeTypeCheckGlyph (face, ucs4, glyph, blanks))
+ if (glyph &&
+ FcFreeTypeCheckGlyph (face, ucs4, glyph, blanks, &advance))
{
+ if (!has_advance)
+ {
+ has_advance = FcTrue;
+ all_advance = advance;
+ }
+ else if (advance != all_advance)
+ fixed_advance = FcFalse;
leaf = FcCharSetFindLeafCreate (fcs, ucs4);
if (!leaf)
goto bail1;
{
glyph = FT_Get_Char_Index (face, ucs4);
if (glyph && FcFreeTypeCheckGlyph (face, ucs4,
- glyph, blanks))
+ glyph, blanks, &advance))
{
+ if (!has_advance)
+ {
+ has_advance = FcTrue;
+ all_advance = advance;
+ }
+ else if (advance != all_advance)
+ fixed_advance = FcFalse;
if (!leaf)
{
leaf = FcCharSetFindLeafCreate (fcs, ucs4);
printf ("Bitmap extra char 0x%x\n", ucs4);
}
#endif
+ if (fixed_advance)
+ *spacing = FC_MONO;
+ else
+ *spacing = FC_PROPORTIONAL;
return fcs;
bail1:
FcCharSetDestroy (fcs);
return 0;
}
+FcCharSet *
+FcFreeTypeCharSet (FT_Face face, FcBlanks *blanks)
+{
+ int spacing;
+
+ return FcFreeTypeCharSetAndSpacing (face, blanks, &spacing);
+}