From 4f3d63efb5d87d93171eb542d28fa83a74cdfcd8 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sat, 25 May 2013 02:24:36 +0200 Subject: A hack to fix mark placement in old fonts We need a way to recognize non spacing marks in fonts lacking GDEF table (like old Arabic fonts), so I just check for zero advance width and hope nothing elsewhere will break... Change-Id: I6fa848e97ba24d71fc9a381ae439e0fb98e50419 --- vcl/generic/glyphs/gcach_layout.cxx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx index 6ac7fd43e4fa..4fd4cf40e088 100644 --- a/vcl/generic/glyphs/gcach_layout.cxx +++ b/vcl/generic/glyphs/gcach_layout.cxx @@ -428,7 +428,25 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs) if (bInCluster) nGlyphFlags |= GlyphItem::IS_IN_CLUSTER; - if (hb_ot_layout_get_glyph_class(mpHbFace, nGlyphIndex) == HB_OT_LAYOUT_GLYPH_CLASS_MARK) + bool bDiacritic = false; + if (hb_ot_layout_has_glyph_classes(mpHbFace)) + { + // the font has GDEF table + if (hb_ot_layout_get_glyph_class(mpHbFace, nGlyphIndex) == HB_OT_LAYOUT_GLYPH_CLASS_MARK) + bDiacritic = true; + } + else + { + // the font lacks GDEF table + // HACK: if the resolved glyph advance is zero assume it is a + // combining mark. The whole IS_DIACRITIC concept is a hack to + // fix the other hacks we use to second-guess glyph advances in + // ApplyDXArray and the likes and it needs to die + if (pHbPositions[i].x_advance == 0) + bDiacritic = true; + } + + if (bDiacritic) nGlyphFlags |= GlyphItem::IS_DIACRITIC; int32_t nXOffset = pHbPositions[i].x_offset >> 6; -- cgit