static void getGlyphPositions(const SkFont& font, const uint16_t glyphs[], int count, SkScalar x, SkScalar y, SkPoint pos[]) { SkAutoSTMalloc<128, SkScalar> widthStorage(count); SkScalar* widths = widthStorage.get(); font.getWidths(glyphs, count, widths); for (int i = 0; i < count; ++i) { pos[i].set(x, y); x += widths[i]; } }
static void getGlyphPositions(const SkPaint& paint, const uint16_t glyphs[], int count, SkScalar x, SkScalar y, SkPoint pos[]) { SkASSERT(SkPaint::kGlyphID_TextEncoding == paint.getTextEncoding()); SkAutoSTMalloc<128, SkScalar> widthStorage(count); SkScalar* widths = widthStorage.get(); paint.getTextWidths(glyphs, count * sizeof(uint16_t), widths); for (int i = 0; i < count; ++i) { pos[i].set(x, y); x += widths[i]; } }