| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |