From 30dd92d9f542339df2190b0d813b9f9334452da7 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Fri, 15 Sep 2017 21:52:06 +0100 Subject: [PATCH] Bug 1373852 - Map font-kerning:normal to the appropriate low-level feature depending on orientation. r=jrmuizel --- gfx/src/nsFont.cpp | 6 ++++-- gfx/src/nsFont.h | 3 ++- gfx/src/nsFontMetrics.cpp | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/gfx/src/nsFont.cpp b/gfx/src/nsFont.cpp index 6d2c8c62ab58..b66a46e8e600 100644 --- a/gfx/src/nsFont.cpp +++ b/gfx/src/nsFont.cpp @@ -166,13 +166,15 @@ FontFeatureTagForVariantWidth(uint32_t aVariantWidth) } } -void nsFont::AddFontFeaturesToStyle(gfxFontStyle *aStyle) const +void nsFont::AddFontFeaturesToStyle(gfxFontStyle *aStyle, + bool aVertical) const { // add in font-variant features gfxFontFeature setting; // -- kerning - setting.mTag = TRUETYPE_TAG('k','e','r','n'); + setting.mTag = aVertical ? TRUETYPE_TAG('v','k','r','n') + : TRUETYPE_TAG('k','e','r','n'); switch (kerning) { case NS_FONT_KERNING_NONE: setting.mValue = 0; diff --git a/gfx/src/nsFont.h b/gfx/src/nsFont.h index 7654becf4e82..47c2471433a4 100644 --- a/gfx/src/nsFont.h +++ b/gfx/src/nsFont.h @@ -140,7 +140,8 @@ struct nsFont { void CopyAlternates(const nsFont& aOther); // Add featureSettings into style - void AddFontFeaturesToStyle(gfxFontStyle *aStyle) const; + void AddFontFeaturesToStyle(gfxFontStyle *aStyle, + bool aVertical) const; void AddFontVariationsToStyle(gfxFontStyle *aStyle) const; }; diff --git a/gfx/src/nsFontMetrics.cpp b/gfx/src/nsFontMetrics.cpp index d0deef87959a..375ca3497413 100644 --- a/gfx/src/nsFontMetrics.cpp +++ b/gfx/src/nsFontMetrics.cpp @@ -134,7 +134,7 @@ nsFontMetrics::nsFontMetrics(const nsFont& aFont, const Params& aParams, aFont.synthesis & NS_FONT_SYNTHESIS_STYLE, aFont.languageOverride); - aFont.AddFontFeaturesToStyle(&style); + aFont.AddFontFeaturesToStyle(&style, mOrientation == gfxFont::eVertical); aFont.AddFontVariationsToStyle(&style); gfxFloat devToCssSize = gfxFloat(mP2A) /