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

Side by Side Diff: gm/textblobrandomfont.cpp

Issue 1818043002: SkTypeface::MakeFromName to take SkFontStyle. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Android fix + nit fix Created 4 years, 6 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/textblob.cpp ('k') | gm/texteffects.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 2015 Google Inc. 2 * Copyright 2015 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 9
10 #include "Resources.h" 10 #include "Resources.h"
(...skipping 21 matching lines...) Expand all
32 SkTextBlobBuilder builder; 32 SkTextBlobBuilder builder;
33 33
34 const char* text = "The quick brown fox jumps over the lazy dog."; 34 const char* text = "The quick brown fox jumps over the lazy dog.";
35 35
36 // make textbloben 36 // make textbloben
37 SkPaint paint; 37 SkPaint paint;
38 paint.setTextSize(32); 38 paint.setTextSize(32);
39 paint.setLCDRenderText(true); 39 paint.setLCDRenderText(true);
40 40
41 // Setup our random scaler context 41 // Setup our random scaler context
42 sk_sp<SkTypeface> orig(sk_tool_utils::create_portable_typeface("sans-ser if", 42 sk_sp<SkTypeface> orig(sk_tool_utils::create_portable_typeface(
43 SkTypefac e::kBold)); 43 "sans-serif", SkFontStyle::FromOldStyle(SkTyp eface::kBold)));
44 if (nullptr == orig) { 44 if (nullptr == orig) {
45 orig = SkTypeface::MakeDefault(); 45 orig = SkTypeface::MakeDefault();
46 } 46 }
47 paint.setTypeface(sk_make_sp<SkRandomTypeface>(orig, paint, false)); 47 paint.setTypeface(sk_make_sp<SkRandomTypeface>(orig, paint, false));
48 48
49 SkRect bounds; 49 SkRect bounds;
50 paint.measureText(text, strlen(text), &bounds); 50 paint.measureText(text, strlen(text), &bounds);
51 sk_tool_utils::add_to_text_blob(&builder, text, paint, 0, 0); 51 sk_tool_utils::add_to_text_blob(&builder, text, paint, 0, 0);
52 52
53 // A8 53 // A8
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 static const int kHeight = 1600; 145 static const int kHeight = 1600;
146 146
147 typedef GM INHERITED; 147 typedef GM INHERITED;
148 }; 148 };
149 149
150 ////////////////////////////////////////////////////////////////////////////// 150 //////////////////////////////////////////////////////////////////////////////
151 151
152 DEF_GM(return new TextBlobRandomFont;) 152 DEF_GM(return new TextBlobRandomFont;)
153 } 153 }
154 #endif 154 #endif
OLDNEW
« no previous file with comments | « gm/textblob.cpp ('k') | gm/texteffects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698