From 9eb8fd324e8ab3adfcea4db1e1f2f139ec2ec443 Mon Sep 17 00:00:00 2001 From: Marko Kenttala Date: Wed, 22 Feb 2012 14:18:52 +0200 Subject: Fix for Thai characters with a below mark Some Thai characters with a mark below got drawn under fonts descent causing them to be clipped in some situations. Added checking for this and use of lower offset if needed. Task-Number: ou1cimx1#979179 Change-Id: If9fb643d4dee24342215a637c805d52b78584333 Reviewed-by: Lars Knoll --- src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp | 5 +++++ src/3rdparty/harfbuzz/src/harfbuzz-shaper.h | 3 ++- src/gui/text/qfontengine.cpp | 12 +++++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp index af0ee52..48e9064 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp @@ -344,6 +344,11 @@ static inline void positionCluster(HB_ShaperItem *item, int gfrom, int glast) } + // Check drawing below fonts descent + if (cmb == HB_Combining_Below || cmb == HB_Combining_BelowRight) + if ((markMetrics.height + offset) > item->font->klass->getFontMetric(item->font, HB_FontDescent)) + offset = markMetrics.y; // Use offset from mark metrics so it won't get drawn below descent + // combining marks of different class don't interact. Reset the rectangle. if (cmb != lastCmb) { //qDebug("resetting rect"); diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h index 470e27b..b3f5226 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h @@ -231,7 +231,8 @@ typedef struct { } HB_GlyphMetrics; typedef enum { - HB_FontAscent + HB_FontAscent, + HB_FontDescent } HB_FontMetric; typedef struct { diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 0253657..05e4e9e 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -128,11 +128,17 @@ static void hb_getGlyphMetrics(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *me static HB_Fixed hb_getFontMetric(HB_Font font, HB_FontMetric metric) { - if (metric == HB_FontAscent) { - QFontEngine *fe = (QFontEngine *)font->userData; + QFontEngine *fe = (QFontEngine *)font->userData; + switch (metric) { + case HB_FontAscent: return fe->ascent().value(); + break; + case HB_FontDescent: + return fe->descent().value(); + break; + default: + return 0; } - return 0; } HB_Error QFontEngine::getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints) -- cgit v0.12