aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-04-08 05:03:52 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-04-08 05:03:52 +0000
commitd6638e644e430a721ea2dc2372e1880e16a3ff5d (patch)
tree193a8ec896667b1aa9721cd877b79a5f4a94f2d1 /include
parent16690af1c21dead3eedb25ebd0a4b9a091684ed4 (diff)
add Table apis to SkFontHost
need to implement in _win backend git-svn-id: http://skia.googlecode.com/svn/trunk@149 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkFontHost.h48
1 files changed, 45 insertions, 3 deletions
diff --git a/include/core/SkFontHost.h b/include/core/SkFontHost.h
index 942350f9d1..03ebfc7357 100644
--- a/include/core/SkFontHost.h
+++ b/include/core/SkFontHost.h
@@ -24,6 +24,9 @@ class SkDescriptor;
class SkStream;
class SkWStream;
+typedef uint32_t SkFontID;
+typedef uint32_t SkFontTableTag;
+
/** \class SkFontHost
This class is ported to each environment. It is responsible for bridging
@@ -91,13 +94,13 @@ public:
Returning false is similar to calling OpenStream with an invalid ID,
which will return NULL in that case.
*/
- static bool ValidFontID(uint32_t uniqueID);
+ 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.
*/
- static SkStream* OpenStream(uint32_t uniqueID);
+ static SkStream* OpenStream(SkFontID uniqueID);
///////////////////////////////////////////////////////////////////////////
@@ -124,10 +127,49 @@ public:
on. This process must be finite, and when the fonthost sees a
font with no logical successor, it must return 0.
*/
- static uint32_t NextLogicalFont(uint32_t fontID);
+ static uint32_t NextLogicalFont(SkFontID fontID);
///////////////////////////////////////////////////////////////////////////
+
+ /** Return the number of tables in the font
+ */
+ static int CountTables(SkFontID);
+
+ /** Copy into tags[] (allocated by the caller) the list of table tags in
+ the font, and return the number. This will be the same as CountTables()
+ or 0 if an error occured.
+ */
+ static int GetTableTags(SkFontID, SkFontTableTag[]);
+
+ /** 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
+ not found, or there is an error copying the data, then 0 is returned.
+ If this happens, it is possible that some or all of the memory pointed
+ to by data may have been written to, even though an error has occured.
+
+ @param fontID the font to copy the table from
+ @param tag The table tag whose contents are to be copied
+ @param offset The offset in bytes into the table's contents where the
+ copy should start from.
+ @param length The number of bytes, starting at offset, of table data
+ to copy.
+ @param data storage address where the table contents are copied to
+ @return the number of bytes actually copied into data. If offset+length
+ exceeds the table's size, then only the bytes up to the table's
+ size are actually copied, and this is the value returned. If
+ offset > the table's size, or tag is not a valid table,
+ then 0 is returned.
+ */
+ static size_t GetTableData(SkFontID fontID, SkFontTableTag tag,
+ size_t offset, size_t length, void* data);
+
+ ///////////////////////////////////////////////////////////////////////////
+
/** Return the number of bytes (approx) that should be purged from the font
cache. The input parameter is the cache's estimate of how much as been
allocated by the cache so far.