Summary: | Assertion Failure with certain TrueType fonts | ||
---|---|---|---|
Product: | fontconfig | Reporter: | Martin Herkt <lachs0r> |
Component: | library | Assignee: | fontconfig-bugs |
Status: | RESOLVED FIXED | QA Contact: | Behdad Esfahbod <freedesktop> |
Severity: | normal | ||
Priority: | medium | CC: | freedesktop |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | Font that causes an assertion failure. |
Thanks. commit 01bb6978b6389852c5259b135af45ecdfe9f42f8 Author: Behdad Esfahbod <behdad@behdad.org> Date: Wed Aug 6 12:23:24 2014 -0400 Fix assertion failure https://bugs.freedesktop.org/show_bug.cgi?id=82220 https://bugs.freedesktop.org/show_bug.cgi?id=82228 diff --git a/src/fcweight.c b/src/fcweight.c index c62f807..313f3f2 100644 --- a/src/fcweight.c +++ b/src/fcweight.c @@ -45,7 +45,7 @@ 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; } commit 80edaccc3cbd77434718e8f4731a20b410f9d10a Author: Behdad Esfahbod <behdad@behdad.org> Date: Wed Aug 6 12:29:35 2014 -0400 If OS/2 table says weight is 1 to 9, multiply by 100 https://bugs.freedesktop.org/show_bug.cgi?id=82228 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; |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.
Created attachment 104116 [details] Font that causes an assertion failure. Since ffda7c0e8130eb107ecbb3bdc48043093b12dff9, fontconfig triggers assertion failures with many TrueType fonts: fcweight, line 48: dx > 0 && dy > 0 && x1 <= x && x I have attached a sample font which causes the problem.