summaryrefslogtreecommitdiffstats
path: root/skia/include
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-08 23:38:27 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-08 23:38:27 +0000
commit8afd0ad9907d3bab3689fe510881a8da9fa6a5ee (patch)
tree2c4b54f28eef60a8e5fe01704b567bf47cdae25f /skia/include
parenta96182f9c4be4a711bddf2c5aaee9e2638ea12e1 (diff)
downloadchromium_src-8afd0ad9907d3bab3689fe510881a8da9fa6a5ee.zip
chromium_src-8afd0ad9907d3bab3689fe510881a8da9fa6a5ee.tar.gz
chromium_src-8afd0ad9907d3bab3689fe510881a8da9fa6a5ee.tar.bz2
Skia: Merge upstream's r149.
This brings in support for reading TrueType tables via Skia. This should allow us to move some of our metrics changes into our WebKit port and out of Skia. http://codereview.chromium.org/63133 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13391 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/include')
-rw-r--r--skia/include/SkFontHost.h48
1 files changed, 45 insertions, 3 deletions
diff --git a/skia/include/SkFontHost.h b/skia/include/SkFontHost.h
index c3b2e2d..d140dec 100644
--- a/skia/include/SkFontHost.h
+++ b/skia/include/SkFontHost.h
@@ -24,6 +24,9 @@ class SkDescriptor;
class SkStream;
class SkWStream;
+typedef uint32_t SkFontTableTag;
+typedef uint32_t SkFontID;
+
/** \class SkFontHost
This class is ported to each environment. It is responsible for bridging
@@ -69,13 +72,13 @@ public:
/** Return the typeface associated with the uniqueID, or null if that ID
does not match any faces.
*/
- static SkTypeface* ResolveTypeface(uint32_t uniqueID);
+ static SkTypeface* ResolveTypeface(SkFontID uniqueID);
/** Return a new stream to read the font data, or null if the uniqueID does
not match an existing typeface
*/
- static SkStream* OpenStream(uint32_t uniqueID);
- static void CloseStream(uint32_t uniqueID, SkStream*);
+ static SkStream* OpenStream(SkFontID uniqueID);
+ static void CloseStream(SkFontID uniqueID, SkStream*);
/** Return a new typeface given the data buffer (owned by the caller).
If the data does not represent a valid font, return null.
@@ -84,6 +87,45 @@ public:
///////////////////////////////////////////////////////////////////////////
+ /** 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);
+
+ ///////////////////////////////////////////////////////////////////////////
+
/** Write a unique identifier to the stream, so that the same typeface can
be retrieved with Deserialize().
*/