summaryrefslogtreecommitdiff
path: root/vcl/generic/glyphs/gcach_layout.cxx
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2013-10-30 09:34:38 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2013-10-30 09:39:42 +0200
commit71077148d442b3bbfeefd9a572942946c6a95823 (patch)
tree92d4c1db4421a43063d849772b847d5d02a3e27d /vcl/generic/glyphs/gcach_layout.cxx
parent8886336141dcbf21961d0c86a82f6224d7ac7a31 (diff)
fdo#70968: Incorrect rendering of Devanagari short 'i' vowel
It seems that some Indic fonts assign 'mark' glyph class to combining spacing marks (spacing not non spacing) so my reliance on the glyph class to set the IS_DIACRITIC flags broke those fonts. This is a bandaid to get around the issue, plus some long rant! (at this rate, I'll be writing "The VCL haters handbook" pretty soon). Change-Id: I3ff892acf746d50182573f94e7e8c3c6f9464ae0
Diffstat (limited to 'vcl/generic/glyphs/gcach_layout.cxx')
-rw-r--r--vcl/generic/glyphs/gcach_layout.cxx26
1 files changed, 21 insertions, 5 deletions
diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index 4673931ffaba..7a8bfc982952 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -456,20 +456,36 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
if (bInCluster)
nGlyphFlags |= GlyphItem::IS_IN_CLUSTER;
+ // The whole IS_DIACRITIC concept is a stupid hack that was
+ // introduced ages ago to work around the utter brokenness of the
+ // way justification adjustments are applied (the DXArray fiasco).
+ // Since it is such a stupid hack, there is no sane way to directly
+ // map to concepts of the "outside" world, so we do some rather
+ // ugly hacks:
+ // * If the font has a GDEF table, we check for glyphs with mark
+ // glyph class which is sensible, except that some fonts
+ // (fdo#70968) assign mark class to spacing marks (which is wrong
+ // but usually harmless), so we try to sniff what HarfBuzz thinks
+ // about this glyph by checking if it gives it a zero advance
+ // width.
+ // * If the font has no GDEF table, we just check if the glyph has
+ // zero advance width, but this is stupid and can be wrong. A
+ // better way would to check the character's Unicode combining
+ // class, but unfortunately glyph gives combining marks the
+ // cluster value of its base character, so nCharPos will be
+ // pointing to the wrong character (but HarfBuzz might change
+ // this in the future).
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)
+ bool bMark = hb_ot_layout_get_glyph_class(mpHbFace, nGlyphIndex) == HB_OT_LAYOUT_GLYPH_CLASS_MARK;
+ if (bMark && pHbPositions[i].x_advance == 0)
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;
}