summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2013-05-25 02:24:36 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2013-05-25 12:06:15 +0200
commit90c6531caa3ec530ef6e9bf1081d289b16fe53ba (patch)
treeb5b8a548ecf1808534184e0eba74311bf370ae6f /vcl
parent1b6678993c905df231147d55e4fc9a9b15406812 (diff)
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
Diffstat (limited to 'vcl')
-rw-r--r--vcl/generic/glyphs/gcach_layout.cxx20
1 files changed, 19 insertions, 1 deletions
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;