summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2018-01-03 16:51:18 +0000
committerBehdad Esfahbod <behdad@behdad.org>2018-01-04 15:22:06 +0000
commit37fb4a989e6243bceebadb8120f458d8d5b82c45 (patch)
treed793e995ce348487438992e4a42edddd10f51b2c /src
parent1fa9cb78c1120e11e27e2a84f59b3fb239b165df (diff)
Support FC_WIDTH as double as well
Diffstat (limited to 'src')
-rw-r--r--src/fcfreetype.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/fcfreetype.c b/src/fcfreetype.c
index 158f272a..461fbf94 100644
--- a/src/fcfreetype.c
+++ b/src/fcfreetype.c
@@ -1172,7 +1172,7 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
FcPattern *pat;
int slant = -1;
double weight = -1;
- int width = -1;
+ double width = -1;
FcBool decorative = FcFalse;
FcBool variable = FcFalse;
FcBool variable_weight = FcFalse;
@@ -1695,10 +1695,7 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
printf ("\tos2 weight class %d multiplier %g maps to weight %g\n",
os2->usWeightClass, weight_mult, weight);
- /* TODO:
- * Add FcWidthFromOpenTypeDouble and FcWidthToOpenTypeDouble,
- * and apply width_mult post-conversion? */
- switch ((int) (os2->usWidthClass * width_mult + .5)) {
+ switch (os2->usWidthClass) {
case 1: width = FC_WIDTH_ULTRACONDENSED; break;
case 2: width = FC_WIDTH_EXTRACONDENSED; break;
case 3: width = FC_WIDTH_CONDENSED; break;
@@ -1709,8 +1706,9 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
case 8: width = FC_WIDTH_EXTRAEXPANDED; break;
case 9: width = FC_WIDTH_ULTRAEXPANDED; break;
}
+ width *= width_mult;
if ((FcDebug() & FC_DBG_SCANV) && width != -1)
- printf ("\tos2 width class %d multiplier %g maps to width %d\n",
+ printf ("\tos2 width class %d multiplier %g maps to width %g\n",
os2->usWidthClass, width_mult, width);
}
if (os2 && (complex_ = FcFontCapabilities(face)))
@@ -1825,7 +1823,7 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
{
width = FcIsWidth ((FcChar8 *) prop.u.atom);
if (FcDebug () & FC_DBG_SCANV)
- printf ("\tsetwidth %s maps to %d\n", prop.u.atom, width);
+ printf ("\tsetwidth %s maps to %g\n", prop.u.atom, width);
}
}
#endif
@@ -1845,7 +1843,7 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
{
width = FcContainsWidth (style);
if (FcDebug() & FC_DBG_SCANV)
- printf ("\tStyle %s maps to width %d\n", style, width);
+ printf ("\tStyle %s maps to width %g\n", style, width);
}
if (slant == -1)
{
@@ -1890,7 +1888,7 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
if (!variable_weight && !FcPatternAddDouble (pat, FC_WEIGHT, weight))
goto bail1;
- if (!variable_width && !FcPatternAddInteger (pat, FC_WIDTH, width))
+ if (!variable_width && !FcPatternAddDouble (pat, FC_WIDTH, width))
goto bail1;
if (!FcPatternAddString (pat, FC_FOUNDRY, foundry))