aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/src/fcweight.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-08-11 21:22:25 +0200
committermarha <marha@users.sourceforge.net>2014-08-11 21:22:25 +0200
commit8e27619ab489dece35cc4bec86950ee7729cd309 (patch)
treeab59dbc661e00c12ed4777cf9d0d37393c4163aa /fontconfig/src/fcweight.c
parentffc99ce2402fe5c9a6eb8fcf193e8e9472fd993b (diff)
parentfdbedba4d50e1b28b0249c83ba11c029f096e400 (diff)
downloadvcxsrv-8e27619ab489dece35cc4bec86950ee7729cd309.tar.gz
vcxsrv-8e27619ab489dece35cc4bec86950ee7729cd309.tar.bz2
vcxsrv-8e27619ab489dece35cc4bec86950ee7729cd309.zip
Merge remote-tracking branch 'origin/released'
Conflicts: libxcb/src/c_client.py mesalib/include/GL/glext.h mesalib/include/GL/glxext.h mesalib/src/glsl/.gitignore mesalib/src/mesa/drivers/dri/common/xmlconfig.h mesalib/src/mesa/main/.gitignore xorg-server/Xext/xvmain.c xorg-server/dix/dispatch.c xorg-server/hw/xfree86/common/compiler.h
Diffstat (limited to 'fontconfig/src/fcweight.c')
-rw-r--r--fontconfig/src/fcweight.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/fontconfig/src/fcweight.c b/fontconfig/src/fcweight.c
index 87bbe67ab..77b78ad54 100644
--- a/fontconfig/src/fcweight.c
+++ b/fontconfig/src/fcweight.c
@@ -45,15 +45,22 @@ static int lerp(int x, int x1, int x2, int y1, int y2)
{
int dx = x2 - x1;
int dy = y2 - y1;
- assert (dx > 0 && dy > 0 && x1 <= x && x <= x2);
+ assert (dx > 0 && dy >= 0 && x1 <= x && x <= x2);
return y1 + (dy*(x-x1) + dx/2) / dx;
}
-FcPublic int
+int
FcWeightFromOpenType (int ot_weight)
{
int i;
- if (ot_weight <= 0 || ot_weight > 1000)
+
+ /* Follow WPF Font Selection Model's advice. */
+ if (1 <= ot_weight && ot_weight <= 9)
+ ot_weight *= 100;
+
+ /* WPF Font Selection Model rejects 1000, we allow it
+ * because Pango uses that number. */
+ if (ot_weight < 1 || ot_weight > 1000)
return -1;
for (i = 1; ot_weight > map[i].ot; i++)
@@ -66,7 +73,7 @@ FcWeightFromOpenType (int ot_weight)
return lerp (ot_weight, map[i-1].ot, map[i].ot, map[i-1].fc, map[i].fc);
}
-FcPublic int
+int
FcWeightToOpenType (int fc_weight)
{
int i;