19static const char gText[] =
"Call me Ishmael. Some years ago—never mind how long precisely";
28 const size_t txtLen = strlen(
gText);
31 fGlyphs.
append(fGlyphCount);
34 fPositions.
append(fGlyphCount);
36 auto positions =
SkSpan(fPositions.
begin(), fGlyphCount);
38 fLength = positions.back().x() - positions.front().x();
40 fXforms.
append(fGlyphCount);
43 const SkScalar lengthToGlyph =
pos.
x() - positions.front().x();
45 const SkScalar cos = std::cos(angle);
46 const SkScalar sin = std::sin(angle);
63 for (
auto&
pos : fPositions) {
66 canvas->
drawGlyphs(fGlyphCount, fGlyphs.
begin(), fPositions.begin(), {50, 640}, fFont,
70 {50 + fLength / 2, 160 + fRadius}, fFont,
SkPaint{});
constexpr float SK_FloatPI
@ kUTF8
uses bytes to represent UTF-8 or ASCII
SkSpan(Container &&) -> SkSpan< std::remove_pointer_t< decltype(std::data(std::declval< Container >()))> >
constexpr auto SkMakeZip(Ts &&... ts)
SkISize getISize() override
SkString getName() const override
void onOnceBeforeDraw() override
void onDraw(SkCanvas *canvas) override
void drawGlyphs(int count, const SkGlyphID glyphs[], const SkPoint positions[], const uint32_t clusters[], int textByteCount, const char utf8text[], SkPoint origin, const SkFont &font, const SkPaint &paint)
void setSubpixel(bool subpixel)
void getPos(const SkGlyphID glyphs[], int count, SkPoint pos[], SkPoint origin={0, 0}) const
void setSize(SkScalar textSize)
int countText(const void *text, size_t byteLength, SkTextEncoding encoding) const
int textToGlyphs(const void *text, size_t byteLength, SkTextEncoding encoding, SkGlyphID glyphs[], int maxGlyphCount) const
static const char gText[]
static constexpr SkISize Make(int32_t w, int32_t h)
constexpr float x() const