diff options
author | 2009-07-31 16:17:01 +0000 | |
---|---|---|
committer | 2009-07-31 16:17:01 +0000 | |
commit | ac98154faa0e786444bafcd093fd4842127fbf18 (patch) | |
tree | c45d07e7b62d121cd187a8635a16a8fa683eb946 /src/ports/SkFontHost_android.cpp | |
parent | 61608aaf932708e3e8ac05097ead1bf7885ec87d (diff) |
add GetFileName api to SkFontHost
git-svn-id: http://skia.googlecode.com/svn/trunk@299 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/ports/SkFontHost_android.cpp')
-rw-r--r-- | src/ports/SkFontHost_android.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/ports/SkFontHost_android.cpp b/src/ports/SkFontHost_android.cpp index e6d134a583..6aa7a0b41f 100644 --- a/src/ports/SkFontHost_android.cpp +++ b/src/ports/SkFontHost_android.cpp @@ -267,6 +267,7 @@ public: virtual SkStream* openStream() = 0; virtual const char* getUniqueString() const = 0; + virtual const char* getFilePath() const = 0; private: bool fIsSysFont; @@ -297,6 +298,7 @@ public: return fStream; } virtual const char* getUniqueString() const { return NULL; } + virtual const char* getFilePath() const { return NULL; } private: SkStream* fStream; @@ -341,6 +343,9 @@ public: } return str; } + virtual const char* getFilePath() const { + return fPath.c_str(); + } private: SkString fPath; @@ -592,6 +597,27 @@ SkStream* SkFontHost::OpenStream(uint32_t fontID) { return stream; } +size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length, + int32_t* index) { + SkAutoMutexAcquire ac(gFamilyMutex); + + FamilyTypeface* tf = (FamilyTypeface*)find_from_uniqueID(fontID); + const char* src = tf ? tf->getFilePath() : NULL; + + if (src) { + size_t size = strlen(src); + if (path) { + memcpy(path, src, SkMin32(size, length)); + } + if (index) { + *index = 0; // we don't have collections (yet) + } + return size; + } else { + return 0; + } +} + uint32_t SkFontHost::NextLogicalFont(uint32_t fontID) { load_system_fonts(); |