#include <SkSVGTextPriv.h>
Definition at line 34 of file SkSVGTextPriv.h.
◆ ShapedTextCallback
◆ SkSVGTextContext()
Definition at line 274 of file SkSVGText.cpp.
277 : fRenderContext(ctx)
278 , fCallback(cb)
281
282
283 if (!fShaper) {
285 fForcePrimitiveShaping = true;
286 }
287 if (tpath) {
288 fPathData = std::make_unique<PathData>(ctx, *tpath);
289
290
293
294
295
298 }
299
300
301
302 return offset.value() * fPathData->length() / 100;
303 };
304
305
306 fChunkPos.
fX = resolve_offset(tpath->getStartOffset());
307 }
308}
SkScalar resolve(const SkSVGLength &, LengthType) const
const SkSVGPresentationContext & presentationContext() const
const SkSVGLengthContext & lengthContext() const
std::unique_ptr< SkShaper > makeShaper() const
SKSHAPER_API std::unique_ptr< SkShaper > PrimitiveText()
◆ ~SkSVGTextContext()
SkSVGTextContext::~SkSVGTextContext |
( |
| ) |
|
|
override |
Definition at line 310 of file SkSVGText.cpp.
310 {
312}
void flushChunk(const SkSVGRenderContext &ctx)
◆ flushChunk()
Definition at line 463 of file SkSVGText.cpp.
463 {
465
466 for (
const auto&
run : fRuns) {
469 for (
size_t i = 0;
i <
run.glyphCount; ++
i) {
470 buf.xforms()[
i] = this->computeGlyphXform(
run.glyphs[
i],
473 run.glyhPosAdjust[
i]);
474 }
475
476 fCallback(ctx, blobBuilder.
make(),
run.fillPaint.get(),
run.strokePaint.get());
477 }
478
479 fChunkPos += fChunkAdvance;
480 fChunkAdvance = {0,0};
482
483 fRuns.clear();
484}
static void copy(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
constexpr int SkToInt(S x)
const RunBuffer & allocRunRSXform(const SkFont &font, int count)
sk_sp< SkTextBlob > make()
◆ getCallback()
◆ shapeFragment()
Definition at line 314 of file SkSVGText.cpp.
315 {
316
317
319
320 if (ch == '\n') {
321 return -1;
322 }
323
324
325 if (ch == '\t') {
326 ch = ' ';
327 }
328
329
330
331 if (fPrevCharSpace && ch == ' ') {
332 return -1;
333 }
334
335
336
337
338 return ch;
339 };
341
342 if (ch == '\n' || ch == '\t') {
343 ch = ' ';
344 }
345 return ch;
346 };
347
348
351
352 const auto font = ResolveFont(ctx);
353 fShapeBuffer.reserve(
txt.size());
354
355 const char* ch_ptr =
txt.c_str();
356 const char* ch_end = ch_ptr +
txt.size();
357
358 while (ch_ptr < ch_end) {
361 ? filterWSDefault(ch)
362 : filterWSPreserve(ch);
363
364 if (ch < 0) {
365
366 continue;
367 }
368
370 const auto pos = fPosResolver->
resolve(fCurrentCharIndex++);
371
372
373
375 this->shapePendingBuffer(ctx,
font);
377
378
381 }
384 }
385 }
386
387 fShapeBuffer.append(ch, {
388 {
391 },
393 });
394
395 fPrevCharSpace = (ch == ' ');
396 }
397
398 this->shapePendingBuffer(ctx,
font);
399
400
401
402}
#define SkDegreesToRadians(degrees)
SkTLazy< SkPaint > fillPaint() const
SkTLazy< SkPaint > strokePaint() const
PosAttrs resolve(size_t charIndex) const
SK_SPI SkUnichar NextUTF8(const char **ptr, const char *end)
font
Font Metadata and Metrics.
The documentation for this class was generated from the following files: