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

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

Issue 2698043005: Wire up Skia axis parameters to HarfBuzz (Closed)
Patch Set: CrOS build fix 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 b0603181e0a4585076dc349d3246fd56716a3608..75436bf827530f4f2eaa52e67cd31f59f773d90b 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
@@ -387,11 +387,29 @@ hb_font_t* HarfBuzzFace::getScaledFont(
m_harfBuzzFontData->m_rangeSet = rangeSet;
m_harfBuzzFontData->updateSimpleFontData(m_platformData);
- // TODO crbug.com/674879 - Connect variation axis parameters to future
- // HarfBuzz API here.
ASSERT(m_harfBuzzFontData->m_simpleFontData);
int scale = SkiaScalarToHarfBuzzPosition(m_platformData->size());
hb_font_set_scale(m_unscaledFont, scale, scale);
+
+// TODO: crbug.com/696570 Remove this conditional
+// once HarfBuzz on CrOS is updated.
+#if HB_VERSION_ATLEAST(1, 4, 2)
+ SkTypeface* typeface = m_harfBuzzFontData->m_paint.getTypeface();
+ int axisCount = typeface->getVariationDesignPosition(nullptr, 0);
+ if (axisCount > 0) {
+ Vector<SkFontArguments::VariationPosition::Coordinate> axisValues;
+ axisValues.resize(axisCount);
+ typeface->getVariationDesignPosition(axisValues.data(), axisValues.size());
bungeman-skia 2017/03/01 15:33:10 Note that you should test that this comes back > 0
+ Vector<float> axisValuesFloat;
bungeman-skia 2017/03/01 15:33:10 Seems like this should be Vector<hb_variation_t> a
+ axisValuesFloat.resize(axisCount);
+ for (size_t i = 0; i < axisValues.size(); i++) {
+ axisValuesFloat[i] = axisValues[i].value;
+ }
+ hb_font_set_var_coords_design(m_unscaledFont, axisValuesFloat.data(),
+ axisValuesFloat.size());
+ }
+#endif
+
return m_unscaledFont;
}
« 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