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

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

Issue 2698043005: Wire up Skia axis parameters to HarfBuzz (Closed)
Patch Set: The actual rebased version 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 e83296a135a594df65d9825ab7e6d0f917c76fcb..d18dc472fdb80f223d7093ea20856ea15f427e3d 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
@@ -387,11 +387,25 @@ 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);
+
+ 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());
+ Vector<float> axisValuesFloat;
+ 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());
+ }
behdad 2017/02/17 19:13:49 Shouldn't you set_var_coords to zero in the else b
+
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