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

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

Issue 2730443002: Transfer variation axis coordinates including tags (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
index 75436bf827530f4f2eaa52e67cd31f59f773d90b..a3bb692c2a59b58df893d0ebd92b6b251f1391d1 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
@@ -380,6 +380,21 @@ PassRefPtr<HbFontCacheEntry> createHbFontCacheEntry(hb_face_t* face) {
return cacheEntry;
}
+// TODO: crbug.com/696570 Remove this conditional
+// once HarfBuzz on CrOS is updated.
+#if HB_VERSION_ATLEAST(1, 4, 2)
+static_assert(
+ std::is_same<decltype(SkFontArguments::VariationPosition::Coordinate::axis),
+ decltype(hb_variation_t::tag)>::value &&
+ std::is_same<
+ decltype(SkFontArguments::VariationPosition::Coordinate::value),
+ decltype(hb_variation_t::value)>::value &&
+ sizeof(SkFontArguments::VariationPosition::Coordinate) ==
+ sizeof(hb_variation_t),
+ "Skia and HarfBuzz Variation parameter types must match in structure and "
+ "size.");
+#endif
+
hb_font_t* HarfBuzzFace::getScaledFont(
PassRefPtr<UnicodeRangeSet> rangeSet) const {
m_platformData->setupPaint(&m_harfBuzzFontData->m_paint);
@@ -399,14 +414,12 @@ hb_font_t* HarfBuzzFace::getScaledFont(
if (axisCount > 0) {
Vector<SkFontArguments::VariationPosition::Coordinate> axisValues;
axisValues.resize(axisCount);
- typeface->getVariationDesignPosition(axisValues.data(), axisValues.size());
- Vector<float> axisValuesFloat;
- axisValuesFloat.resize(axisCount);
- for (size_t i = 0; i < axisValues.size(); i++) {
- axisValuesFloat[i] = axisValues[i].value;
+ if (typeface->getVariationDesignPosition(axisValues.data(),
+ axisValues.size()) > 0) {
+ hb_font_set_variations(
+ m_unscaledFont, reinterpret_cast<hb_variation_t*>(axisValues.data()),
+ axisValues.size());
}
- hb_font_set_var_coords_design(m_unscaledFont, axisValuesFloat.data(),
- axisValuesFloat.size());
}
#endif
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698