Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1060)

Unified Diff: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp

Issue 1955723004: Implement font-variant-numeric (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
index d13dd370db55c76c8bc431ec55280846e22229c7..fcd7bde807787bff6c25fb029807a2ec8eb5920f 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp
@@ -205,6 +205,38 @@ void HarfBuzzShaper::setFontFeatures()
break;
}
+ // font-variant-numeric:
+ static hb_feature_t lnum = createFeature('l', 'n', 'u', 'm', 1);
+ if (description.variantNumeric().numericFigureValue() == FontVariantNumeric::LiningNums)
+ m_features.append(lnum);
+
+ static hb_feature_t onum = createFeature('o', 'n', 'u', 'm', 1);
+ if (description.variantNumeric().numericFigureValue() == FontVariantNumeric::OldstyleNums)
+ m_features.append(onum);
+
+ static hb_feature_t pnum = createFeature('p', 'n', 'u', 'm', 1);
+ if (description.variantNumeric().numericSpacingValue() == FontVariantNumeric::ProportionalNums)
+ m_features.append(pnum);
+ static hb_feature_t tnum = createFeature('t', 'n', 'u', 'm', 1);
+ if (description.variantNumeric().numericSpacingValue() == FontVariantNumeric::TabularNums)
+ m_features.append(tnum);
+
+ static hb_feature_t afrc = createFeature('a', 'f', 'r', 'c', 1);
+ if (description.variantNumeric().numericFractionValue() == FontVariantNumeric::StackedFractions)
+ m_features.append(afrc);
+ static hb_feature_t frac = createFeature('f', 'r', 'a', 'c', 1);
+ if (description.variantNumeric().numericFractionValue() == FontVariantNumeric::DiagonalFractions)
+ m_features.append(frac);
+
+ static hb_feature_t ordn = createFeature('o', 'r', 'd', 'n', 1);
+ if (description.variantNumeric().ordinalValue() == FontVariantNumeric::OrdinalOn)
+ m_features.append(ordn);
+
+ static hb_feature_t zero = createFeature('z', 'e', 'r', 'o', 1);
+ if (description.variantNumeric().slashedZeroValue() == FontVariantNumeric::SlashedZeroOn)
+ m_features.append(zero);
+
+
FontFeatureSettings* settings = description.featureSettings();
if (!settings)
return;
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/FontVariantNumeric.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698