| 1 |
// Copyright 2019 Google LLC. |
| 2 |
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. |
| 3 |
#include "tools/fiddle/examples.h" |
| 4 |
REG_FIDDLE(Canvas_drawTextBlob_2, 256, 120, false, 0) { |
| 5 |
void draw(SkCanvas* canvas) { |
| 6 |
SkTextBlobBuilder textBlobBuilder; |
| 7 |
SkFont font = SkFont(fontMgr->matchFamilyStyle(nullptr, {}), 50); |
| 8 |
const SkTextBlobBuilder::RunBuffer& run = |
| 9 |
textBlobBuilder.allocRun(font, 1, 20, 100); |
| 10 |
run.glyphs[0] = 20; |
| 11 |
sk_sp<const SkTextBlob> blob = textBlobBuilder.make(); |
| 12 |
SkPaint paint; |
| 13 |
paint.setColor(SK_ColorBLUE); |
| 14 |
canvas->drawTextBlob(blob.get(), 0, 0, paint); |
| 15 |
} |
| 16 |
} // END FIDDLE |