diff options
Diffstat (limited to 'src/core/SkPaint.cpp')
-rw-r--r-- | src/core/SkPaint.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index e4e4ea87f2..a0fc90d3e5 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -381,6 +381,23 @@ int SkPaint::textToGlyphs(const void* textData, size_t byteLength, return gptr - glyphs; } +void SkPaint::glyphsToUnichars(const uint16_t glyphs[], int count, + SkUnichar textData[]) const { + if (count <= 0) { + return; + } + + SkASSERT(glyphs != NULL); + SkASSERT(textData != NULL); + + SkAutoGlyphCache autoCache(*this, NULL); + SkGlyphCache* cache = autoCache.getCache(); + + for (int index = 0; index < count; index++) { + textData[index] = cache->glyphToUnichar(glyphs[index]); + } +} + /////////////////////////////////////////////////////////////////////////////// static const SkGlyph& sk_getMetrics_utf8_next(SkGlyphCache* cache, const char** text) |