--- fontconfig-cvs/src/fcfreetype.c 2003-03-15 23:29:45.000000000 -0500 +++ fontconfig/src/fcfreetype.c 2003-03-15 23:59:44.000000000 -0500 @@ -31,6 +31,7 @@ #include #include #include +#include /* * Keep Han languages separated by eliminating languages @@ -129,6 +130,7 @@ FcChar8 *family; FcChar8 *style; TT_OS2 *os2; + PS_FontInfoRec *psfontinfo; TT_Header *head; const FcChar8 *exclusiveLang = 0; FT_SfntName sname; @@ -563,6 +565,51 @@ case 9: width = FC_WIDTH_ULTRAEXPANDED; break; } } + + /* + * Type 1: Check for FontInfo dictionary information + */ + psfontinfo = malloc(sizeof(PS_FontInfoRec)); + if (FT_Get_PS_Font_Info(face, psfontinfo) == 0) + { + if (strcasecmp("thin", psfontinfo->weight) == 0) + weight = FC_WEIGHT_THIN; + else if (strcasecmp("extralight", psfontinfo->weight) == 0) + weight = FC_WEIGHT_EXTRALIGHT; + else if (strcasecmp("ultralight", psfontinfo->weight) == 0) + weight = FC_WEIGHT_ULTRALIGHT; + else if (strcasecmp("light", psfontinfo->weight) == 0) + weight = FC_WEIGHT_LIGHT; + else if (strcasecmp("regular", psfontinfo->weight) == 0) + weight = FC_WEIGHT_REGULAR; + else if (strcasecmp("normal", psfontinfo->weight) == 0) + weight = FC_WEIGHT_REGULAR; + else if (strcasecmp("medium", psfontinfo->weight) == 0) + weight = FC_WEIGHT_MEDIUM; + else if (strcasecmp("demibold", psfontinfo->weight) == 0) + weight = FC_WEIGHT_DEMIBOLD; + else if (strcasecmp("semibold", psfontinfo->weight) == 0) + weight = FC_WEIGHT_DEMIBOLD; + else if (strcasecmp("extrabold", psfontinfo->weight) == 0) + weight = FC_WEIGHT_EXTRABOLD; + else if (strcasecmp("ultrabold", psfontinfo->weight) == 0) + weight = FC_WEIGHT_EXTRABOLD; + else if (strcasecmp("bold", psfontinfo->weight) == 0) + weight = FC_WEIGHT_BOLD; + else if (strcasecmp("black", psfontinfo->weight) == 0) + weight = FC_WEIGHT_BLACK; + else if (strcasecmp("heavy", psfontinfo->weight) == 0) + weight = FC_WEIGHT_BLACK; + + if (psfontinfo->is_fixed_pitch) + if (!FcPatternAddInteger (pat, FC_SPACING, FC_MONO)) + goto bail1; + + if (psfontinfo->italic_angle < 0) + slant = FC_SLANT_ITALIC; + else if (psfontinfo->italic_angle >= 0) + slant = FC_SLANT_ROMAN; + } if (!FcPatternAddInteger (pat, FC_SLANT, slant)) goto bail1;