Summary: | cairo_scaled_font_glyph_extents breaks with invalid glyph id | ||
---|---|---|---|
Product: | cairo | Reporter: | Elmar Braun <elmar.braun> |
Component: | win32 backend | Assignee: | cairo-bugs mailing list <cairo-bugs> |
Status: | RESOLVED FIXED | QA Contact: | cairo-bugs mailing list <cairo-bugs> |
Severity: | normal | ||
Priority: | medium | ||
Version: | 1.8.6 | ||
Hardware: | All | ||
OS: | Windows (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: |
Testcase
Patch to remove broken error handling Alternate patch |
Description
Elmar Braun
2009-02-22 12:47:14 UTC
Created attachment 23180 [details]
Testcase
I think this should have been fixed by Adrian's commit: commit 2a34992cccfd77c2acf30fe851311f16137ba32f Author: Adrian Johnson <ajohnson@redneon.com> Date: Sun May 17 18:12:39 2009 +0930 Ensure win32 font index_to_ucs4() sets ucs4 to -1 if lookup fails Could you please try cairo from git (or apply that relatively simple patch) and see if it does indeed fix this problem? Thanks. Created attachment 26170 [details] [review] Patch to remove broken error handling Adrian's commit doesn't solve the problem. The problem is overzealous error checking introduced in commit 47824dee31acdaf5ad6488dd2714e9f28c936aa2. The problem can be fixed by removing it (see patch). GetGlyphOutlineW returns GDI_ERROR when called with a glyph id that doesn't exist in the font. In Cairo 1.6 _cairo_win32_scaled_font_init_glyph_metrics would memset the glyph metrics to 0 and then return CAIRO_STATUS_SUCCESS. In 1.8 it returns an error, which renders the scaled font permanently unusable. Created attachment 26171 [details] [review] Alternate patch An alternate solution that leaves some of the error checking in place is this: check GetLastError after GetGlyphOutlineW, because it returns a success if GDI_ERROR was caused by an invalid glyph id. Quick note about the patches: _cairo_win32_scaled_font_init_glyph_metrics has another call to GetGlyphOutlineW somewhat further down in the function body; the suggested changes should probably be applied there too. In comment #3 I gave a wrong commit number, I was talking about 6808174e72c923ebabe61846617496e25df92363 Thank you Elmar for your diagnosis of this bug, and your timely reminder on cairo@. commit 610da573e91810c53305b6bfe02eb7b714e3d08e Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Wed Jun 10 12:59:36 2009 +0100 [win32-font] Non-fatal error from GetGlyphOutlineW(GGO_METRICS) If GetGlyphOutlineW(GGO_METRICS) fails to retreive the metrics for the specified glyph it returns GDI_ERROR. Like ft, do not interpret this as a fatal error but just mark the glyph as empty. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=20255 Bug 20255 -- cairo_scaled_font_glyph_extents breaks with invalid glyph id And cherry-picked into 1.8. |
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.