If OS/2 table says weight is 1 to 9, multiply by 100

https://bugs.freedesktop.org/show_bug.cgi?id=82228
This commit is contained in:
Behdad Esfahbod 2014-08-06 12:29:35 -04:00
parent 01bb6978b6
commit 80edaccc3c
1 changed files with 8 additions and 1 deletions

View File

@ -53,7 +53,14 @@ int
FcWeightFromOpenType (int ot_weight) FcWeightFromOpenType (int ot_weight)
{ {
int i; 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; return -1;
for (i = 1; ot_weight > map[i].ot; i++) for (i = 1; ot_weight > map[i].ot; i++)