aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPaint.cpp
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-01-08 14:07:42 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-01-08 14:07:42 +0000
commit9d3a985aa3c82605346ed1518375a8c384b925e5 (patch)
tree8f2cf27f3df58d70fe7f4aad8742632b70a996e6 /src/core/SkPaint.cpp
parentd0a529d0280dae3a1f0a700870cfb4c3b95745b2 (diff)
add glyph->unichar query (inverse of a cmap)
git-svn-id: http://skia.googlecode.com/svn/trunk@472 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkPaint.cpp')
-rw-r--r--src/core/SkPaint.cpp17
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)