From 295ec32a74502e225f6ebb606536587786708676 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 2 Mar 2012 14:22:10 +0100 Subject: Avoid glyph rendering with FT when not needed If we only need to access the font metrics (like in scenegraph) for layout, we don't need to render glyphs with FreeType at all. Increase cached linearAdvance to 22 bits so that no overflow will happen: FreeType returns 16.16 fixed point linearHoriAdvance, but QFixed is 26.6, we store glyph->linearAdvance = linearHoriAdvance >> 10 Apparently 'short' is not enough since it's only 16 bits. Change-Id: Id14eafa19f01a687de11997526281f9e7e860482 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfontengine_ft_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui/text/qfontengine_ft_p.h') diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index 2add894c19..77939120f8 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -144,7 +144,7 @@ public: /* we don't cache glyphs that are too large anyway, so we can make this struct rather small */ struct Glyph { ~Glyph(); - short linearAdvance; + int linearAdvance : 22; // 16.6 unsigned char width; unsigned char height; signed char x; -- cgit v1.2.3