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
This commit is contained in:
@@ -428,7 +428,25 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
|
|||||||
if (bInCluster)
|
if (bInCluster)
|
||||||
nGlyphFlags |= GlyphItem::IS_IN_CLUSTER;
|
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;
|
nGlyphFlags |= GlyphItem::IS_DIACRITIC;
|
||||||
|
|
||||||
int32_t nXOffset = pHbPositions[i].x_offset >> 6;
|
int32_t nXOffset = pHbPositions[i].x_offset >> 6;
|
||||||
|
Reference in New Issue
Block a user