aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-07-20 16:39:43 -0700
committerRomain Guy <romainguy@google.com>2010-07-20 16:40:47 -0700
commit90a1efbdde19ee56c33929592277871509c25893 (patch)
treecf11b2c019d51de48cd705fd29be0f8cbe2e9634
parent9f7eada12ef264d63583447ffd0426207a72d019 (diff)
downloadexternal_skia-90a1efbdde19ee56c33929592277871509c25893.zip
external_skia-90a1efbdde19ee56c33929592277871509c25893.tar.gz
external_skia-90a1efbdde19ee56c33929592277871509c25893.tar.bz2
Expose two APIs to be able to retrieve glyphs from font cache.
Change-Id: I4e033c009bef6f00b0cd2a8233f63351adc11df4
-rw-r--r--include/core/SkPaint.h3
-rw-r--r--src/core/SkPaint.cpp14
2 files changed, 17 insertions, 0 deletions
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index 5fef527..e835c53 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -806,6 +806,9 @@ public:
void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y,
SkPath* path) const;
+ const SkGlyph& getUnicharMetrics(SkUnichar);
+ const void* findImage(const SkGlyph&);
+
private:
SkTypeface* fTypeface;
SkScalar fTextSize;
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index da818c4..6df1346 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -322,6 +322,20 @@ SkDrawLooper* SkPaint::setLooper(SkDrawLooper* looper)
#include "SkGlyphCache.h"
#include "SkUtils.h"
+const SkGlyph& SkPaint::getUnicharMetrics(SkUnichar text) {
+ SkAutoGlyphCache autoCache(*this, NULL);
+ SkGlyphCache* cache = autoCache.getCache();
+
+ return cache->getUnicharMetrics(text);
+}
+
+const void* SkPaint::findImage(const SkGlyph& glyph) {
+ SkAutoGlyphCache autoCache(*this, NULL);
+ SkGlyphCache* cache = autoCache.getCache();
+
+ return cache->findImage(glyph);
+}
+
int SkPaint::textToGlyphs(const void* textData, size_t byteLength,
uint16_t glyphs[]) const {
if (byteLength == 0) {