<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - Assertion Failure with certain TrueType fonts"
href="https://bugs.freedesktop.org/show_bug.cgi?id=82220#c2">Comment # 2</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - Assertion Failure with certain TrueType fonts"
href="https://bugs.freedesktop.org/show_bug.cgi?id=82220">bug 82220</a>
from <span class="vcard"><a class="email" href="mailto:freedesktop@behdad.org" title="Behdad Esfahbod <freedesktop@behdad.org>"> <span class="fn">Behdad Esfahbod</span></a>
</span></b>
<pre>commit 80edaccc3cbd77434718e8f4731a20b410f9d10a
Author: Behdad Esfahbod <<a href="mailto:behdad@behdad.org">behdad@behdad.org</a>>
Date: Wed Aug 6 12:29:35 2014 -0400
If OS/2 table says weight is 1 to 9, multiply by 100
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - OpenType weight between 0 and 100 could result in assertion in FcWeightFromOpenType"
href="show_bug.cgi?id=82228">https://bugs.freedesktop.org/show_bug.cgi?id=82228</a>
diff --git a/src/fcweight.c b/src/fcweight.c
index 313f3f2..77b78ad 100644
--- a/src/fcweight.c
+++ b/src/fcweight.c
@@ -53,7 +53,14 @@ 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;</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>