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

Side by Side Diff: gm/strokefill.cpp

Issue 407183003: add portable and canonical font support for DM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add atexit; rename to create_... Created 6 years, 4 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 unified diff | Download patch
« no previous file with comments | « gm/srcmode.cpp ('k') | gm/stroketext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 30 matching lines...) Expand all
41 41
42 virtual void onDraw(SkCanvas* canvas) { 42 virtual void onDraw(SkCanvas* canvas) {
43 SkScalar x = SkIntToScalar(100); 43 SkScalar x = SkIntToScalar(100);
44 SkScalar y = SkIntToScalar(88); 44 SkScalar y = SkIntToScalar(88);
45 45
46 SkPaint paint; 46 SkPaint paint;
47 paint.setAntiAlias(true); 47 paint.setAntiAlias(true);
48 paint.setTextSize(SkIntToScalar(100)); 48 paint.setTextSize(SkIntToScalar(100));
49 paint.setStrokeWidth(SkIntToScalar(5)); 49 paint.setStrokeWidth(SkIntToScalar(5));
50 50
51 SkTypeface* face = SkTypeface::CreateFromName("Papyrus", SkTypeface::kNo rmal); 51 sk_tool_utils::set_portable_typeface(&paint, "Papyrus");
52 SkSafeUnref(paint.setTypeface(face));
53 show_bold(canvas, "Hello", 5, x, y, paint); 52 show_bold(canvas, "Hello", 5, x, y, paint);
54 53
55 face = SkTypeface::CreateFromName("Hiragino Maru Gothic Pro", SkTypeface ::kNormal); 54 sk_tool_utils::set_portable_typeface(&paint, "Hiragino Maru Gothic Pro") ;
56 SkSafeUnref(paint.setTypeface(face));
57 const unsigned char hyphen[] = { 0xE3, 0x83, 0xBC }; 55 const unsigned char hyphen[] = { 0xE3, 0x83, 0xBC };
58 show_bold(canvas, hyphen, SK_ARRAY_COUNT(hyphen), x + SkIntToScalar(300) , y, paint); 56 show_bold(canvas, hyphen, SK_ARRAY_COUNT(hyphen), x + SkIntToScalar(300) , y, paint);
59 57
60 paint.setStyle(SkPaint::kStrokeAndFill_Style); 58 paint.setStyle(SkPaint::kStrokeAndFill_Style);
61 59
62 SkPath path; 60 SkPath path;
63 path.setFillType(SkPath::kWinding_FillType); 61 path.setFillType(SkPath::kWinding_FillType);
64 path.addCircle(x, y + SkIntToScalar(200), SkIntToScalar(50), SkPath::kCW _Direction); 62 path.addCircle(x, y + SkIntToScalar(200), SkIntToScalar(50), SkPath::kCW _Direction);
65 path.addCircle(x, y + SkIntToScalar(200), SkIntToScalar(40), SkPath::kCC W_Direction); 63 path.addCircle(x, y + SkIntToScalar(200), SkIntToScalar(40), SkPath::kCC W_Direction);
66 canvas->drawPath(path, paint); 64 canvas->drawPath(path, paint);
(...skipping 19 matching lines...) Expand all
86 private: 84 private:
87 typedef GM INHERITED; 85 typedef GM INHERITED;
88 }; 86 };
89 87
90 ////////////////////////////////////////////////////////////////////////////// 88 //////////////////////////////////////////////////////////////////////////////
91 89
92 static GM* MyFactory(void*) { return new StrokeFillGM; } 90 static GM* MyFactory(void*) { return new StrokeFillGM; }
93 static GMRegistry reg(MyFactory); 91 static GMRegistry reg(MyFactory);
94 92
95 } 93 }
OLDNEW
« no previous file with comments | « gm/srcmode.cpp ('k') | gm/stroketext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698