diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-14 15:09:40 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-14 15:09:40 +0000 |
commit | 2d927e95326befff35491ccfa88f97aa3500ea9d (patch) | |
tree | c2bd8f9c34010c229b9319476ddbccb2d80b92fa /include/core | |
parent | fed86bdb8b9f037439bbfa7cdbd53a581dbc5985 (diff) |
make OpenStream and GetFileName public ... for now, until we fix FreeType backend.
git-svn-id: http://skia.googlecode.com/svn/trunk@8157 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkFontHost.h | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/include/core/SkFontHost.h b/include/core/SkFontHost.h index 07957da319..a602f68cfb 100644 --- a/include/core/SkFontHost.h +++ b/include/core/SkFontHost.h @@ -134,6 +134,46 @@ public: */ static SkFontID NextLogicalFont(SkFontID currFontID, SkFontID origFontID); + + ///// public HACK FOR FREETYPE -- will be fixed + + /** 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(SkFontID uniqueID); + + /** Some fonts are stored in files. If that is true for the fontID, then + this returns the byte length of the full file path. If path is not null, + then the full path is copied into path (allocated by the caller), up to + length bytes. If index is not null, then it is set to the truetype + collection index for this font, or 0 if the font is not in a collection. + + Note: GetFileName does not assume that path is a null-terminated string, + so when it succeeds, it only copies the bytes of the file name and + nothing else (i.e. it copies exactly the number of bytes returned by the + function. If the caller wants to treat path[] as a C string, it must be + sure that it is allocated at least 1 byte larger than the returned size, + and it must copy in the terminating 0. + + If the fontID does not correspond to a file, then the function returns + 0, and the path and index parameters are ignored. + + @param fontID The font whose file name is being queried + @param path Either NULL, or storage for receiving up to length bytes + of the font's file name. Allocated by the caller. + @param length The maximum space allocated in path (by the caller). + Ignored if path is NULL. + @param index Either NULL, or receives the TTC index for this font. + If the font is not a TTC, then will be set to 0. + @return The byte length of th font's file name, or 0 if the font is not + baked by a file. + */ + static size_t GetFileName(SkFontID fontID, char path[], size_t length, + int32_t* index); + + // END_HACK for freetype + private: /** Return a new, closest matching typeface given either an existing family (specified by a typeface in that family) or by a familyName and a @@ -167,43 +207,6 @@ private: /////////////////////////////////////////////////////////////////////////// - /** 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(SkFontID uniqueID); - - /** Some fonts are stored in files. If that is true for the fontID, then - this returns the byte length of the full file path. If path is not null, - then the full path is copied into path (allocated by the caller), up to - length bytes. If index is not null, then it is set to the truetype - collection index for this font, or 0 if the font is not in a collection. - - Note: GetFileName does not assume that path is a null-terminated string, - so when it succeeds, it only copies the bytes of the file name and - nothing else (i.e. it copies exactly the number of bytes returned by the - function. If the caller wants to treat path[] as a C string, it must be - sure that it is allocated at least 1 byte larger than the returned size, - and it must copy in the terminating 0. - - If the fontID does not correspond to a file, then the function returns - 0, and the path and index parameters are ignored. - - @param fontID The font whose file name is being queried - @param path Either NULL, or storage for receiving up to length bytes - of the font's file name. Allocated by the caller. - @param length The maximum space allocated in path (by the caller). - Ignored if path is NULL. - @param index Either NULL, or receives the TTC index for this font. - If the font is not a TTC, then will be set to 0. - @return The byte length of th font's file name, or 0 if the font is not - baked by a file. - */ - static size_t GetFileName(SkFontID fontID, char path[], size_t length, - int32_t* index); - - /////////////////////////////////////////////////////////////////////////// - /** Write a unique identifier to the stream, so that the same typeface can be retrieved with Deserialize(). The standard format is to serialize a SkFontDescriptor followed by a uint32_t length value. If the length |