aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-01 12:52:26 +0000
committerGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-01 12:52:26 +0000
commit15eeca00684b4d5baad8e47c5b2f77404b978cb0 (patch)
tree37edef84a22e13ba74a697c87987ebc252f4eb03 /include/core
parent3b700f6929e093cb14cc0e4ef569e6f697c5a816 (diff)
Update the implementation of SkTypeface_android.h functions.
This CL removes the hardcoded mappings of FallbackScripts to a particular font file and replaces it with a dynamic mechanism that takes a style and representative character code for a given FallbackScript class and returns the most appropriate SkTypeface that contains that character code. Review URL: https://codereview.appspot.com/6197074 git-svn-id: http://skia.googlecode.com/svn/trunk@4111 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkScalerContext.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/core/SkScalerContext.h b/include/core/SkScalerContext.h
index 2cb171b119..0e33989cac 100644
--- a/include/core/SkScalerContext.h
+++ b/include/core/SkScalerContext.h
@@ -15,6 +15,7 @@
#include "SkPaint.h"
#include "SkPath.h"
#include "SkPoint.h"
+#include "SkTypeface.h"
//#define SK_USE_COLOR_LUMINANCE
@@ -300,6 +301,19 @@ public:
#ifdef SK_BUILD_FOR_ANDROID
unsigned getBaseGlyphCount(SkUnichar charCode);
+
+ // This function must be public for SkTypeface_android.h, but should not be
+ // called by other callers
+ SkFontID findTypefaceIdForChar(SkUnichar uni) {
+ SkScalerContext* ctx = this;
+ while (NULL != ctx) {
+ if (ctx->generateCharToGlyph(uni)) {
+ return ctx->fRec.fFontID;
+ }
+ ctx = ctx->getNextContext();
+ }
+ return 0;
+ }
#endif
static inline void MakeRec(const SkPaint&, const SkMatrix*, Rec* rec);