Bug 1373852 - Map font-kerning:normal to the appropriate low-level feature depending on orientation. r=jrmuizel

This commit is contained in:
Jonathan Kew 2017-09-15 21:52:06 +01:00
Родитель 69e32ded2f
Коммит 30dd92d9f5
3 изменённых файлов: 7 добавлений и 4 удалений

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

@ -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 // add in font-variant features
gfxFontFeature setting; gfxFontFeature setting;
// -- kerning // -- 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) { switch (kerning) {
case NS_FONT_KERNING_NONE: case NS_FONT_KERNING_NONE:
setting.mValue = 0; setting.mValue = 0;

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

@ -140,7 +140,8 @@ struct nsFont {
void CopyAlternates(const nsFont& aOther); void CopyAlternates(const nsFont& aOther);
// Add featureSettings into style // Add featureSettings into style
void AddFontFeaturesToStyle(gfxFontStyle *aStyle) const; void AddFontFeaturesToStyle(gfxFontStyle *aStyle,
bool aVertical) const;
void AddFontVariationsToStyle(gfxFontStyle *aStyle) const; void AddFontVariationsToStyle(gfxFontStyle *aStyle) const;
}; };

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

@ -134,7 +134,7 @@ nsFontMetrics::nsFontMetrics(const nsFont& aFont, const Params& aParams,
aFont.synthesis & NS_FONT_SYNTHESIS_STYLE, aFont.synthesis & NS_FONT_SYNTHESIS_STYLE,
aFont.languageOverride); aFont.languageOverride);
aFont.AddFontFeaturesToStyle(&style); aFont.AddFontFeaturesToStyle(&style, mOrientation == gfxFont::eVertical);
aFont.AddFontVariationsToStyle(&style); aFont.AddFontVariationsToStyle(&style);
gfxFloat devToCssSize = gfxFloat(mP2A) / gfxFloat devToCssSize = gfxFloat(mP2A) /