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

Unified Diff: gm/fontscalerdistortable.cpp

Issue 1590223003: Expose API for gx font variation axes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix FontConfig and Android. Created 4 years, 11 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 | include/ports/SkFontMgr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/fontscalerdistortable.cpp
diff --git a/gm/fontscalerdistortable.cpp b/gm/fontscalerdistortable.cpp
index a207f967fd62c4bb5ede6dfd173edcd302ca3dbd..f83365bb3e59821dac80a97f0e896a2452dfdc95 100644
--- a/gm/fontscalerdistortable.cpp
+++ b/gm/fontscalerdistortable.cpp
@@ -41,6 +41,7 @@ protected:
SkPaint paint;
paint.setAntiAlias(true);
paint.setLCDRenderText(true);
+ SkAutoTUnref<SkFontMgr> fontMgr(SkFontMgr::RefDefault());
SkAutoTDelete<SkStreamAsset> distortable(GetResourceAsStream("/fonts/Distortable.ttf"));
if (!distortable) {
@@ -54,9 +55,11 @@ protected:
SkScalar x = SkIntToScalar(10);
SkScalar y = SkIntToScalar(20);
- SkFixed axis = SkDoubleToFixed(0.5 + (5*j + i) * ((2.0 - 0.5) / (2 * 5)));
- SkAutoTUnref<SkTypeface> typeface(SkTypeface::CreateFromFontData(
- new SkFontData(distortable->duplicate(), 0, &axis, 1)));
+ SkFourByteTag tag = SkSetFourByteTag('w','g','h','t');
+ SkScalar styleValue = SkDoubleToScalar(0.5 + (5*j + i) * ((2.0 - 0.5) / (2 * 5)));
+ SkFontMgr::FontParameters::Axis axes[] = { { tag, styleValue } };
+ SkAutoTUnref<SkTypeface> typeface(fontMgr->createFromStream(
+ distortable->duplicate(), SkFontMgr::FontParameters().setAxes(axes, 1)));
paint.setTypeface(typeface);
SkAutoCanvasRestore acr(canvas, true);
« no previous file with comments | « no previous file | include/ports/SkFontMgr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698