diff options
author | agl@chromium.org <agl@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2010-04-20 22:06:40 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2010-04-20 22:06:40 +0000 |
commit | 5f6a0762f14f73859e60f0e8339ca133d10e4d3c (patch) | |
tree | ea04605d6b956e3f1b591c754a74148ef1c68294 /include/core | |
parent | 756f6dd82da298375547cb36955be9ac8574d2dc (diff) |
Add a SkTypeface::CreateForChars() function.
This allows us to do font fallback for strange scripts.
Added empty stubs to the implementations on all platforms.
Patch-by: Evan Martin
Signed-off-by: Adam Langley
http://codereview.appspot.com/950041
git-svn-id: http://skia.googlecode.com/svn/trunk@557 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkFontHost.h | 14 | ||||
-rw-r--r-- | include/core/SkTypeface.h | 12 |
2 files changed, 20 insertions, 6 deletions
diff --git a/include/core/SkFontHost.h b/include/core/SkFontHost.h index ec345839ad..ca538d16c1 100644 --- a/include/core/SkFontHost.h +++ b/include/core/SkFontHost.h @@ -59,14 +59,16 @@ typedef uint32_t SkFontTableTag; class SkFontHost { public: /** Return a new, closest matching typeface given either an existing family - (specified by a typeface in that family) or by a familyName, and a - requested style. - 1) If familyFace is null, use famillyName. - 2) If famillyName is null, use familyFace. - 3) If both are null, return the default font that best matches style + (specified by a typeface in that family) or by a familyName and a + requested style, or by a set of Unicode codepoitns to cover in a given + style. + 1) If familyFace is null, use familyName. + 2) If familyName is null, use data (UTF-16 to cover). + 3) If all are null, return the default font that best matches style */ static SkTypeface* CreateTypeface(const SkTypeface* familyFace, - const char famillyName[], + const char familyName[], + const void* data, size_t bytelength, SkTypeface::Style style); /** Return a new typeface given the data buffer. If the data does not diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h index bf783a3ff7..d4af700b34 100644 --- a/include/core/SkTypeface.h +++ b/include/core/SkTypeface.h @@ -83,6 +83,18 @@ public: */ static SkTypeface* CreateFromName(const char familyName[], Style style); + /** Return a new reference to the typeface that covers a set of Unicode + code points with the specified Style. Use this call if you want to + pick any font that covers a given string of text. + + @param data UTF-16 characters + @param bytelength length of data, in bytes + @return reference to the closest-matching typeface. Call must call + unref() when they are done. + */ + static SkTypeface* CreateForChars(const void* data, size_t bytelength, + Style s); + /** Return a new reference to the typeface that most closely matches the requested typeface and specified Style. Use this call if you want to pick a new style from the same family of the existing typeface. |