aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkFontHost.h
diff options
context:
space:
mode:
authorGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-16 22:45:43 +0000
committerGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-16 22:45:43 +0000
commite7f3300f4250cbe308651f59c992edf6b779a24d (patch)
treea1f8258618d536ca7e45764edd4493f53e15d3db /include/core/SkFontHost.h
parent8b4a64d3184de8c0680fbacd3fd89279ac06fb52 (diff)
Improve generation of glyph advance array.
Review URL: http://codereview.appspot.com/4830068 git-svn-id: http://skia.googlecode.com/svn/trunk@2126 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkFontHost.h')
-rw-r--r--include/core/SkFontHost.h30
1 files changed, 18 insertions, 12 deletions
diff --git a/include/core/SkFontHost.h b/include/core/SkFontHost.h
index 5900cc631f..8858ecb817 100644
--- a/include/core/SkFontHost.h
+++ b/include/core/SkFontHost.h
@@ -24,7 +24,7 @@ typedef uint32_t SkFontTableTag;
This class is ported to each environment. It is responsible for bridging
the gap between the (sort of) abstract class SkTypeface and the
platform-specific implementation that provides access to font files.
-
+
One basic task is for each create (subclass of) SkTypeface, the FontHost is
resonsible for assigning a uniqueID. The ID should be unique for the
underlying font file/data, not unique per typeface instance. Thus it is
@@ -36,7 +36,7 @@ typedef uint32_t SkFontTableTag;
returned). Either way, the fontID for those instance(s) will be the same.
In addition, the fontID should never be set to 0. That value is used as a
sentinel to indicate no-font-id.
-
+
The major aspects are:
1) Given either a name/style, return a subclass of SkTypeface that
references the closest matching font available on the host system.
@@ -65,17 +65,17 @@ public:
/** Return a new typeface given the data buffer. If the data does not
represent a valid font, returns null.
-
+
If a typeface instance is returned, the caller is responsible for
calling unref() on the typeface when they are finished with it.
-
+
The returned typeface may or may not have called ref() on the stream
parameter. If the typeface has not called ref(), then it may have made
a copy of the releveant data. In either case, the caller is still
- responsible for its refcnt ownership of the stream.
+ responsible for its refcnt ownership of the stream.
*/
static SkTypeface* CreateTypefaceFromStream(SkStream*);
-
+
/** Return a new typeface from the specified file path. If the file does not
represent a valid font, this returns null. If a typeface is returned,
the caller is responsible for calling unref() when it is no longer used.
@@ -83,13 +83,13 @@ public:
static SkTypeface* CreateTypefaceFromFile(const char path[]);
///////////////////////////////////////////////////////////////////////////
-
+
/** Returns true if the specified unique ID matches an existing font.
Returning false is similar to calling OpenStream with an invalid ID,
which will return NULL in that case.
*/
static bool ValidFontID(SkFontID uniqueID);
-
+
/** Return a new stream to read the font data, or null if the uniqueID does
not match an existing typeface. .The caller must call stream->unref()
when it is finished reading the data.
@@ -138,7 +138,7 @@ public:
static SkTypeface* Deserialize(SkStream*);
///////////////////////////////////////////////////////////////////////////
-
+
/** Return a subclass of SkScalarContext
*/
static SkScalerContext* CreateScalerContext(const SkDescriptor* desc);
@@ -181,10 +181,17 @@ public:
names, etc.) should be populated.
@return The returned object has already been referenced. NULL is
returned if the font is not found.
+ @param glyphIDs For per-glyph info, specify subset of the font by
+ giving glyph ids. Each integer represents a glyph
+ id. Passing NULL means all glyphs in the font.
+ @param glyphIDsCount Number of elements in subsetGlyphIds. Ignored if
+ glyphIDs is NULL.
*/
static SkAdvancedTypefaceMetrics* GetAdvancedTypefaceMetrics(
SkFontID fontID,
- SkAdvancedTypefaceMetrics::PerGlyphInfo perGlyphInfo);
+ SkAdvancedTypefaceMetrics::PerGlyphInfo perGlyphInfo,
+ const uint32_t* glyphIDs,
+ uint32_t glyphIDsCount);
/** Return the number of tables in the font
*/
@@ -199,7 +206,7 @@ public:
/** Given a table tag, return the size of its contents, or 0 if not present
*/
static size_t GetTableSize(SkFontID, SkFontTableTag);
-
+
/** Copy the contents of a table into data (allocated by the caller). Note
that the contents of the table will be in their native endian order
(which for most truetype tables is big endian). If the table tag is
@@ -293,4 +300,3 @@ public:
};
#endif
-