Bug 1611610 - Don't increase glyph advance for synthetic bold if the glyph is zero-width. r=lsalzman

Differential Revision: https://phabricator.services.mozilla.com/D61065

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jonathan Kew 2020-01-25 15:43:45 +00:00
Родитель be032141c2
Коммит 4a6c3ec3f6
1 изменённых файлов: 18 добавлений и 11 удалений

Просмотреть файл

@ -710,15 +710,18 @@ void gfxShapedText::AdjustAdvancesForSyntheticBold(float aSynBoldOffset,
CompressedGlyph* glyphData = charGlyphs + i;
if (glyphData->IsSimpleGlyph()) {
// simple glyphs ==> just add the advance
int32_t advance = glyphData->GetSimpleAdvance() + synAppUnitOffset;
if (CompressedGlyph::IsSimpleAdvance(advance)) {
glyphData->SetSimpleGlyph(advance, glyphData->GetSimpleGlyph());
} else {
// rare case, tested by making this the default
uint32_t glyphIndex = glyphData->GetSimpleGlyph();
glyphData->SetComplex(true, true, 1);
DetailedGlyph detail = {glyphIndex, advance, gfx::Point()};
SetGlyphs(i, *glyphData, &detail);
int32_t advance = glyphData->GetSimpleAdvance();
if (advance > 0) {
advance += synAppUnitOffset;
if (CompressedGlyph::IsSimpleAdvance(advance)) {
glyphData->SetSimpleGlyph(advance, glyphData->GetSimpleGlyph());
} else {
// rare case, tested by making this the default
uint32_t glyphIndex = glyphData->GetSimpleGlyph();
glyphData->SetComplex(true, true, 1);
DetailedGlyph detail = {glyphIndex, advance, gfx::Point()};
SetGlyphs(i, *glyphData, &detail);
}
}
} else {
// complex glyphs ==> add offset at cluster/ligature boundaries
@ -729,9 +732,13 @@ void gfxShapedText::AdjustAdvancesForSyntheticBold(float aSynBoldOffset,
continue;
}
if (IsRightToLeft()) {
details[0].mAdvance += synAppUnitOffset;
if (details[0].mAdvance > 0) {
details[0].mAdvance += synAppUnitOffset;
}
} else {
details[detailedLength - 1].mAdvance += synAppUnitOffset;
if (details[detailedLength - 1].mAdvance > 0) {
details[detailedLength - 1].mAdvance += synAppUnitOffset;
}
}
}
}