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;