Summary: | Freetype (TTF) font string truncated | ||
---|---|---|---|
Product: | cairo | Reporter: | angelo <angelo70> |
Component: | freetype font backend | Assignee: | David Turner <david> |
Status: | RESOLVED NOTOURBUG | QA Contact: | cairo-bugs mailing list <cairo-bugs> |
Severity: | normal | ||
Priority: | medium | ||
Version: | 1.12.2 | ||
Hardware: | x86 (IA32) | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | all i have |
Tested also 1.12.2-2, issue still there. The font-metrics are incorrect; they specify that there is a maximum separation of 0 between adjacent characters (max-x-advance). I relented some what, you still need to fix that font, but commit 9fa047c0ea49d94f9f27947931fe21b70f6463d5 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Mon Jun 4 20:16:12 2012 +0100 composite-rectangles,scaled-font: Use accurate extents if the font is broken If the font metrics appear broken, i.e. key values are being reported as zero, skip approximating the bbox of the glyph string. References: https://bugs.freedesktop.org/show_bug.cgi?id=50688 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> (In reply to comment #3) > I relented some what, you still need to fix that font, but > > commit 9fa047c0ea49d94f9f27947931fe21b70f6463d5 > Author: Chris Wilson <chris@chris-wilson.co.uk> > Date: Mon Jun 4 20:16:12 2012 +0100 > > composite-rectangles,scaled-font: Use accurate extents if the font is > broken > > If the font metrics appear broken, i.e. key values are being reported as > zero, skip approximating the bbox of the glyph string. > > References: https://bugs.freedesktop.org/show_bug.cgi?id=50688 > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Hi chris, i tested your commit, unfortunately i have still exactly the same issue. This is what i did: - git pull - git log, checked for commit 9fa047c0ea49d94f9f27947931fe21b70f6463d5 to exist - make clean - make - make install (checked new libs are in /user/lib) launched my app, or gnome-font-viewer, issue still there. The fundamental bug is still that your font is reporting invalid metrics. Can you please do: diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c index 7ea3a21..42a2e9d 100644 --- a/src/cairo-scaled-font.c +++ b/src/cairo-scaled-font.c @@ -2261,6 +2261,12 @@ _cairo_scaled_font_glyph_approximate_extents (cairo_scale double x0, x1, y0, y1, pad; int i; + fprintf("%s: max_x_advance=%f, height=%f, max_scale=%f\n", + __FUNCTION, + scaled_font->fs_extents.max_x_advance, + scaled_font->fs_extents.height, + scaled_font->max_scale) + /* If any of the factors are suspect (i.e. the font is broken), bail */ if (scaled_font->fs_extents.max_x_advance == 0 || scaled_font->fs_extents.height == 0 || to convince yourself that you have compiled and installed the library correctly. Note that on many distributions now the canonical location is not /usr/lib/, so check with ldd `which gnome-font-viewer` to make sure it is picking up yours. Hi Chris, great, no need for fprintf at all, i see the right path is /usr/lib/i386-linux-gnu/ here in debian. And your change works great. I understand well the font is not correct, but previous version of cairo was working with it, and also windows is able to display correctly this font. So, even if cairo behave correct, cairo was performing a feature "less" then before, and "less" than what windows do. So your fix, even if not needed for your "clear conscience", is important and precious. Regards, and thanks angelo |
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 62524 [details] all i have Hi all, from when i apt-get update to libcairo 1.12.2.1 i started to see some pixels, about 5, of the displayed strings truncated. Same issue is visible with a particular TTF font (attached), also using gnome-font-viewer. When i move back to libcairo 1.10.2.7, issue disappear. What i do in my code (note issue is also with gnome-font-viewer) : FT_Library ftl; FT_Init_FreeType(&ftl); FT_Face ftf; string fontfile = Config::get().s.dir_skin + fontfilename; FT_New_Face( ftl, fontfile.c_str(), 0, &ftf ); .... _cf = cairo_ft_font_face_create_for_ft_face(ftf, 0); .... void MyClass::Draw () { cairo_save(cr); cairo_rectangle ( cr, x, y, w, h ); cairo_clip(cr); cairo_rectangle ( cr, x, y, w, h ); cairo_move_to (cr, x); cairo_show_text (cr,_text.c_str()); cairo_reset_clip(cr); cairo_restore(cr); } I add as more attachment i can about the issue. NOTE: on windows same font is still displayed correctly.