#define FC_VERTICAL_LAYOUT "verticallayout" /* Bool (false) */
#define FC_AUTOHINT "autohint" /* Bool (false) */
#define FC_GLOBAL_ADVANCE "globaladvance" /* Bool (true) */
+#define FC_WIDTH "width" /* Int */
#define FC_FILE "file" /* String */
#define FC_INDEX "index" /* Int */
#define FC_FT_FACE "ftface" /* FT_Face */
#define FC_CHAR_HEIGHT "charheight"/* Int */
#define FC_MATRIX "matrix" /* FcMatrix */
-#define FC_WEIGHT_LIGHT 0
-#define FC_WEIGHT_MEDIUM 100
-#define FC_WEIGHT_DEMIBOLD 180
-#define FC_WEIGHT_BOLD 200
-#define FC_WEIGHT_BLACK 210
-
-#define FC_SLANT_ROMAN 0
-#define FC_SLANT_ITALIC 100
-#define FC_SLANT_OBLIQUE 110
-
-#define FC_PROPORTIONAL 0
-#define FC_MONO 100
-#define FC_CHARCELL 110
+#define FC_WEIGHT_THIN 0
+#define FC_WEIGHT_EXTRALIGHT 40
+#define FC_WEIGHT_ULTRALIGHT FC_WEIGHT_EXTRALIGHT
+#define FC_WEIGHT_LIGHT 50
+#define FC_WEIGHT_REGULAR 80
+#define FC_WEIGHT_NORMAL FC_WEIGHT_REGULAR
+#define FC_WEIGHT_MEDIUM 100
+#define FC_WEIGHT_DEMIBOLD 180
+#define FC_WEIGHT_SEMIBOLD FC_WEIGHT_DEMIBOLD
+#define FC_WEIGHT_BOLD 200
+#define FC_WEIGHT_EXTRABOLD 205
+#define FC_WEIGHT_BLACK 210
+
+#define FC_SLANT_ROMAN 0
+#define FC_SLANT_ITALIC 100
+#define FC_SLANT_OBLIQUE 110
+
+#define FC_WIDTH_ULTRACONDENSED 50
+#define FC_WIDTH_EXTRACONDENSED 63
+#define FC_WIDTH_CONDENSED 75
+#define FC_WIDTH_SEMICONDENSED 87
+#define FC_WIDTH_NORMAL 100
+#define FC_WIDTH_SEMIEXPANDED 113
+#define FC_WIDTH_EXPANDED 125
+#define FC_WIDTH_EXTRAEXPANDED 150
+#define FC_WIDTH_ULTRAEXPANDED 200
+
+#define FC_PROPORTIONAL 0
+#define FC_MONO 100
+#define FC_CHARCELL 110
/* sub-pixel order */
#define FC_RGBA_UNKNOWN 0
}
}
+ if (FcPatternGet (pattern, FC_WIDTH, 0, &v) == FcResultNoMatch)
+ FcPatternAddInteger (pattern, FC_WIDTH, FC_WIDTH_NORMAL);
+
for (i = 0; i < NUM_FC_BOOL_DEFAULTS; i++)
if (FcPatternGet (pattern, FcBoolDefaults[i].field, 0, &v) == FcResultNoMatch)
FcPatternAddBool (pattern, FcBoolDefaults[i].field, FcBoolDefaults[i].value);
FcPattern *pat;
int slant;
int weight;
+ int width = -1;
int i;
FcCharSet *cs;
FcLangSet *ls;
if (face->style_flags & FT_STYLE_FLAG_ITALIC)
slant = FC_SLANT_ITALIC;
- if (!FcPatternAddInteger (pat, FC_SLANT, slant))
- goto bail1;
weight = FC_WEIGHT_MEDIUM;
if (face->style_flags & FT_STYLE_FLAG_BOLD)
weight = FC_WEIGHT_BOLD;
- if (!FcPatternAddInteger (pat, FC_WEIGHT, weight))
- goto bail1;
-
/*
* Grub through the name table looking for family
* and style names. FreeType makes quite a hash
}
}
+ if (os2 && os2->version != 0xffff)
+ {
+ if (os2->usWeightClass == 0)
+ weight = -1;
+ else if (os2->usWeightClass < 150)
+ weight = FC_WEIGHT_THIN;
+ else if (os2->usWeightClass < 250)
+ weight = FC_WEIGHT_EXTRALIGHT;
+ else if (os2->usWeightClass < 350)
+ weight = FC_WEIGHT_LIGHT;
+ else if (os2->usWeightClass < 450)
+ weight = FC_WEIGHT_REGULAR;
+ else if (os2->usWeightClass < 550)
+ weight = FC_WEIGHT_MEDIUM;
+ else if (os2->usWeightClass < 650)
+ weight = FC_WEIGHT_SEMIBOLD;
+ else if (os2->usWeightClass < 750)
+ weight = FC_WEIGHT_BOLD;
+ else if (os2->usWeightClass < 850)
+ weight = FC_WEIGHT_EXTRABOLD;
+ else if (os2->usWeightClass < 950)
+ weight = FC_WEIGHT_BLACK;
+ else
+ weight = FC_WEIGHT_MEDIUM;
+
+ switch (os2->usWidthClass) {
+ case 1: width = FC_WIDTH_ULTRACONDENSED; break;
+ case 2: width = FC_WIDTH_EXTRACONDENSED; break;
+ case 3: width = FC_WIDTH_CONDENSED; break;
+ case 4: width = FC_WIDTH_SEMICONDENSED; break;
+ case 5: width = FC_WIDTH_NORMAL; break;
+ case 6: width = FC_WIDTH_SEMIEXPANDED; break;
+ case 7: width = FC_WIDTH_EXPANDED; break;
+ case 8: width = FC_WIDTH_EXTRAEXPANDED; break;
+ case 9: width = FC_WIDTH_ULTRAEXPANDED; break;
+ }
+ }
+
+ if (!FcPatternAddInteger (pat, FC_SLANT, slant))
+ goto bail1;
+
+ if (!FcPatternAddInteger (pat, FC_WEIGHT, weight))
+ goto bail1;
+
+ if (width != -1)
+ if (!FcPatternAddInteger (pat, FC_WIDTH, width))
+ goto bail1;
+
/*
* Compute the unicode coverage for the font
*/
{ FC_WEIGHT, FcCompareNumber, 9, 9 },
#define MATCH_WEIGHT 8
- { FC_ANTIALIAS, FcCompareBool, 10, 10 },
-#define MATCH_ANTIALIAS 9
+ { FC_WIDTH, FcCompareNumber, 10, 10 },
+#define MATCH_WIDTH 9
- { FC_RASTERIZER, FcCompareString, 11, 11 },
-#define MATCH_RASTERIZER 10
+ { FC_ANTIALIAS, FcCompareBool, 11, 11 },
+#define MATCH_ANTIALIAS 10
- { FC_OUTLINE, FcCompareBool, 12, 12 },
-#define MATCH_OUTLINE 11
+ { FC_RASTERIZER, FcCompareString, 12, 12 },
+#define MATCH_RASTERIZER 11
+
+ { FC_OUTLINE, FcCompareBool, 13, 13 },
+#define MATCH_OUTLINE 12
- { FC_FONTVERSION, FcCompareNumber, 13, 13 },
-#define MATCH_FONTVERSION 12
+ { FC_FONTVERSION, FcCompareNumber, 14, 14 },
+#define MATCH_FONTVERSION 13
};
-#define NUM_MATCH_VALUES 14
+#define NUM_MATCH_VALUES 15
static FcBool
FcCompareValueList (const char *object,
case 'p':
i = MATCH_PIXEL_SIZE; break;
case 'w':
- i = MATCH_WEIGHT; break;
+ switch (FcToLower (object[1])) {
+ case 'i':
+ i = MATCH_WIDTH; break;
+ case 'e':
+ i = MATCH_WEIGHT; break;
+ }
+ break;
case 'r':
i = MATCH_RASTERIZER; break;
case 'o':
{ FC_STYLE, FcTypeString, },
{ FC_SLANT, FcTypeInteger, },
{ FC_WEIGHT, FcTypeInteger, },
+ { FC_WIDTH, FcTypeInteger, },
{ FC_SIZE, FcTypeDouble, },
{ FC_ASPECT, FcTypeDouble, },
{ FC_PIXEL_SIZE, FcTypeDouble, },
}
static const FcConstant _FcBaseConstants[] = {
+ { (FcChar8 *) "thin", "weight", FC_WEIGHT_THIN, },
+ { (FcChar8 *) "extralight", "weight", FC_WEIGHT_EXTRALIGHT, },
+ { (FcChar8 *) "ultralight", "weight", FC_WEIGHT_EXTRALIGHT, },
{ (FcChar8 *) "light", "weight", FC_WEIGHT_LIGHT, },
+ { (FcChar8 *) "regular", "weight", FC_WEIGHT_REGULAR, },
{ (FcChar8 *) "medium", "weight", FC_WEIGHT_MEDIUM, },
{ (FcChar8 *) "demibold", "weight", FC_WEIGHT_DEMIBOLD, },
+ { (FcChar8 *) "semibold", "weight", FC_WEIGHT_DEMIBOLD, },
{ (FcChar8 *) "bold", "weight", FC_WEIGHT_BOLD, },
+ { (FcChar8 *) "extrabold", "weight", FC_WEIGHT_EXTRABOLD, },
+ { (FcChar8 *) "ultrabold", "weight", FC_WEIGHT_EXTRABOLD, },
{ (FcChar8 *) "black", "weight", FC_WEIGHT_BLACK, },
{ (FcChar8 *) "roman", "slant", FC_SLANT_ROMAN, },
{ (FcChar8 *) "italic", "slant", FC_SLANT_ITALIC, },
{ (FcChar8 *) "oblique", "slant", FC_SLANT_OBLIQUE, },
+ { (FcChar8 *) "ultracondensed", "width", FC_WIDTH_ULTRACONDENSED },
+ { (FcChar8 *) "extracondensed", "width", FC_WIDTH_EXTRACONDENSED },
+ { (FcChar8 *) "condensed", "width", FC_WIDTH_CONDENSED },
+ { (FcChar8 *) "semicondensed", "width", FC_WIDTH_SEMICONDENSED },
+ { (FcChar8 *) "normal", "width", FC_WIDTH_NORMAL },
+ { (FcChar8 *) "semiexpanded", "width", FC_WIDTH_SEMIEXPANDED },
+ { (FcChar8 *) "expanded", "width", FC_WIDTH_EXPANDED },
+ { (FcChar8 *) "extraexpanded", "width", FC_WIDTH_EXTRAEXPANDED },
+ { (FcChar8 *) "ultraexpanded", "width", FC_WIDTH_ULTRAEXPANDED },
+
{ (FcChar8 *) "proportional", "spacing", FC_PROPORTIONAL, },
{ (FcChar8 *) "mono", "spacing", FC_MONO, },
{ (FcChar8 *) "charcell", "spacing", FC_CHARCELL, },