Bug 1553889 - Apply the AAT 'trak' table to macOS fonts regardless of whether we shaped using CoreText or HarfBuzz. r=jrmuizel

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jonathan Kew 2019-05-28 09:53:11 +00:00
Родитель 7e91588a47
Коммит 5432231319
2 изменённых файлов: 25 добавлений и 22 удалений

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

@ -195,6 +195,8 @@ bool gfxMacFont::ShapeText(DrawTarget* aDrawTarget, const char16_t* aText,
return false;
}
bool ok = false;
// Currently, we don't support vertical shaping via CoreText,
// so we ignore RequiresAATLayout if vertical is requested.
auto macFontEntry = static_cast<MacOSFontEntry*>(GetFontEntry());
@ -203,33 +205,34 @@ bool gfxMacFont::ShapeText(DrawTarget* aDrawTarget, const char16_t* aText,
if (!mCoreTextShaper) {
mCoreTextShaper = MakeUnique<gfxCoreTextShaper>(this);
}
if (mCoreTextShaper->ShapeText(aDrawTarget, aText, aOffset, aLength,
aScript, aVertical, aRounding,
aShapedText)) {
ok = mCoreTextShaper->ShapeText(aDrawTarget, aText, aOffset, aLength,
aScript, aVertical, aRounding, aShapedText);
if (ok) {
PostShapingFixup(aDrawTarget, aText, aOffset, aLength, aVertical,
aShapedText);
if (macFontEntry->HasTrackingTable()) {
// Convert font size from device pixels back to CSS px
// to use in selecting tracking value
float trackSize = GetAdjustedSize() *
aShapedText->GetAppUnitsPerDevUnit() /
AppUnitsPerCSSPixel();
float tracking =
macFontEntry->TrackingForCSSPx(trackSize) * mFUnitsConvFactor;
// Applying tracking is a lot like the adjustment we do for
// synthetic bold: we want to apply between clusters, not to
// non-spacing glyphs within a cluster. So we can reuse that
// helper here.
aShapedText->AdjustAdvancesForSyntheticBold(tracking, aOffset, aLength);
}
return true;
}
}
return gfxFont::ShapeText(aDrawTarget, aText, aOffset, aLength, aScript,
if (!ok) {
ok = gfxFont::ShapeText(aDrawTarget, aText, aOffset, aLength, aScript,
aVertical, aRounding, aShapedText);
}
if (ok && macFontEntry->HasTrackingTable()) {
// Convert font size from device pixels back to CSS px
// to use in selecting tracking value
float trackSize = GetAdjustedSize() * aShapedText->GetAppUnitsPerDevUnit() /
AppUnitsPerCSSPixel();
float tracking =
macFontEntry->TrackingForCSSPx(trackSize) * mFUnitsConvFactor;
// Applying tracking is a lot like the adjustment we do for
// synthetic bold: we want to apply between clusters, not to
// non-spacing glyphs within a cluster. So we can reuse that
// helper here.
aShapedText->AdjustAdvancesForSyntheticBold(tracking, aOffset, aLength);
}
return ok;
}
bool gfxMacFont::SetupCairoFont(DrawTarget* aDrawTarget) {

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

@ -1425,7 +1425,7 @@ fuzzy-if(Android,0-5,0-1656) fuzzy-if(skiaContent,0-1,0-1200) == 512410.html 512
== 512631-1.html 512631-1-ref.html
== 513153-1a.html 513153-1-ref.html
== 513153-1b.html 513153-1-ref.html
fuzzy-if(webrender&&winWidget,82-82,76-76) fuzzy-if(webrender&&OSX,34-34,138-138) == 513153-2a.html 513153-2-ref.html
fuzzy-if(webrender&&winWidget,82-82,76-76) == 513153-2a.html 513153-2-ref.html
fuzzy-if(webrender&&OSX,34-34,138-138) == 513153-2b.html 513153-2-ref.html
== 513318-1.xul 513318-1-ref.xul
fails-if(Android&&(!asyncPan)) != 513318-2.xul 513318-2-ref.xul