705 {
708
711 for (;;) {
712 int glyphCount = reader.
read32();
713 if (glyphCount == 0) {
714
715 break;
716 }
717
718 PositioningAndExtended pe;
719 pe.intValue = reader.
read32();
720 const auto pos = SkTo<SkTextBlob::GlyphPositioning>(pe.positioning);
722 return nullptr;
723 }
724 int textSize = pe.extended ? reader.
read32() : 0;
725 if (textSize < 0) {
726 return nullptr;
727 }
728
733
734
735
736 const size_t glyphSize = safe.
mul(glyphCount,
sizeof(uint16_t)),
737 posSize =
739 SkTextBlob::ScalarsPerGlyph(
pos))),
740 clusterSize = pe.extended ? safe.
mul(glyphCount,
sizeof(uint32_t)) : 0;
741 const size_t totalSize =
742 safe.
add(safe.
add(glyphSize, posSize), safe.
add(clusterSize, textSize));
743
745 return nullptr;
746 }
747
753 break;
757 break;
760 break;
763 break;
764 }
765
769 return nullptr;
770 }
771
774 return nullptr;
775 }
776
777 if (pe.extended) {
780 return nullptr;
781 }
782 }
783 }
784
785 return blobBuilder.
make();
786}
@ kHorizontal_Positioning
static bool Unflatten(SkFont *, SkReadBuffer &buffer)
void readRect(SkRect *rect)
void readPoint(SkPoint *point)
bool readByteArray(void *value, size_t size)
size_t add(size_t x, size_t y)
size_t mul(size_t x, size_t y)
const RunBuffer & allocRunTextPosH(const SkFont &font, int count, SkScalar y, int textByteCount, const SkRect *bounds=nullptr)
const RunBuffer & allocRunText(const SkFont &font, int count, SkScalar x, SkScalar y, int textByteCount, const SkRect *bounds=nullptr)
const RunBuffer & allocRunTextRSXform(const SkFont &font, int count, int textByteCount, const SkRect *bounds=nullptr)
sk_sp< SkTextBlob > make()
const RunBuffer & allocRunTextPos(const SkFont &font, int count, int textByteCount, const SkRect *bounds=nullptr)
Optional< SkRect > bounds
font
Font Metadata and Metrics.
SkScalar * pos
storage for glyph positions in run
char * utf8text
storage for text UTF-8 code units in run
SkGlyphID * glyphs
storage for glyph indexes in run
uint32_t * clusters
storage for glyph clusters (index of UTF-8 code unit)