diff options
author | mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-22 00:47:41 +0000 |
---|---|---|
committer | mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-22 00:47:41 +0000 |
commit | 66d831dc74953986fb1eef2e10d5b301213ccd4a (patch) | |
tree | ca03d38f369b20b318e3268b13a02795f30385df | |
parent | 25d5ab0c0e3d158d301c3a7e89d904adbf4864f4 (diff) |
remove SkFontHost::GetFileName
All remaining impls were either empty, or always return 0 for ttcIndex (its only value).
This functionality is now totally subsumed by SkTypeface::openStream()
git-svn-id: http://skia.googlecode.com/svn/trunk@8321 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | include/core/SkFontHost.h | 29 | ||||
-rw-r--r-- | src/core/SkTypeface.cpp | 6 | ||||
-rw-r--r-- | src/ports/SkFontHost_android.cpp | 21 | ||||
-rw-r--r-- | src/ports/SkFontHost_fontconfig.cpp | 6 | ||||
-rw-r--r-- | src/ports/SkFontHost_freetype_mac.cpp | 11 | ||||
-rw-r--r-- | src/ports/SkFontHost_linux.cpp | 6 | ||||
-rwxr-xr-x | src/ports/SkFontHost_mac.cpp | 5 | ||||
-rw-r--r-- | src/ports/SkFontHost_none.cpp | 6 | ||||
-rw-r--r-- | src/ports/SkFontHost_simple.cpp | 21 | ||||
-rwxr-xr-x | src/ports/SkFontHost_win.cpp | 5 | ||||
-rw-r--r-- | src/ports/SkFontHost_win_dw.cpp | 4 |
11 files changed, 3 insertions, 117 deletions
diff --git a/include/core/SkFontHost.h b/include/core/SkFontHost.h index eb0b841506..5ae5f203cd 100644 --- a/include/core/SkFontHost.h +++ b/include/core/SkFontHost.h @@ -126,35 +126,6 @@ private: */ 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); - /** Return a new, closest matching typeface given either an existing family (specified by a typeface in that family) or by a familyName and a requested style. diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp index 5632bbc6d7..dc0fefd5c6 100644 --- a/src/core/SkTypeface.cpp +++ b/src/core/SkTypeface.cpp @@ -156,10 +156,10 @@ int SkTypeface::onGetUPEM() const { } SkStream* SkTypeface::onOpenStream(int* ttcIndex) const { + // If this has not been overridden, then we just don't know the ttcIndex + // so we set it to 0 if (ttcIndex) { - int32_t ndx = 0; - (void)SkFontHost::GetFileName(fUniqueID, NULL, 0, &ndx); - *ttcIndex = (int)ndx; + *ttcIndex = 0; } return SkFontHost::OpenStream(fUniqueID); } diff --git a/src/ports/SkFontHost_android.cpp b/src/ports/SkFontHost_android.cpp index 416d61d661..5d3b583892 100644 --- a/src/ports/SkFontHost_android.cpp +++ b/src/ports/SkFontHost_android.cpp @@ -846,27 +846,6 @@ SkStream* SkFontHost::OpenStream(uint32_t fontID) { return stream; } -size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length, - int32_t* index) { - SkAutoMutexAcquire ac(gFamilyHeadAndNameListMutex); - - 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; - } -} - SkTypeface* SkFontHost::NextLogicalTypeface(SkFontID currFontID, SkFontID origFontID) { #if defined(SK_BUILD_FOR_ANDROID) && !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) // Skia does not support font fallback for ndk applications in order to diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp index 8cdca1e584..872d4e4a16 100644 --- a/src/ports/SkFontHost_fontconfig.cpp +++ b/src/ports/SkFontHost_fontconfig.cpp @@ -249,12 +249,6 @@ SkStream* SkFontHost::OpenStream(uint32_t) { return NULL; } -size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length, - int32_t* index) { - SkASSERT(!"SkFontHost::GetFileName is DEPRECATED: call SkTypeface::openStream\n"); - return 0; -} - /////////////////////////////////////////////////////////////////////////////// int FontConfigTypeface::onGetTableTags(SkFontTableTag tags[]) const { diff --git a/src/ports/SkFontHost_freetype_mac.cpp b/src/ports/SkFontHost_freetype_mac.cpp index fb67993b77..1339ffc6c7 100644 --- a/src/ports/SkFontHost_freetype_mac.cpp +++ b/src/ports/SkFontHost_freetype_mac.cpp @@ -76,17 +76,6 @@ SkStream* SkFontHost::OpenStream(uint32_t fontID) { return NULL; } -size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length, - int32_t* index) { - if (path) { - strncpy(path, "font", length); - } - if (index) { - *index = 0; - } - return 4; -} - void SkFontHost::Serialize(const SkTypeface*, SkWStream*) { SkDEBUGFAIL("SkFontHost::Serialize unimplemented"); } diff --git a/src/ports/SkFontHost_linux.cpp b/src/ports/SkFontHost_linux.cpp index d4840d863c..b82019159b 100644 --- a/src/ports/SkFontHost_linux.cpp +++ b/src/ports/SkFontHost_linux.cpp @@ -540,12 +540,6 @@ SkStream* SkFontHost::OpenStream(uint32_t fontID) { return stream; } -size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length, - int32_t* index) { -// SkDebugf("SkFontHost::GetFileName unimplemented\n"); - return 0; -} - SkTypeface* SkFontHost::NextLogicalTypeface(SkFontID currFontID, SkFontID origFontID) { return NULL; } diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp index 8f93c0e5d3..17117ae5eb 100755 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -1686,11 +1686,6 @@ SkStream* SkFontHost::OpenStream(SkFontID fontID) { return NULL; } -size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length, int32_t* index) { - SkASSERT(!"SkFontHost::GetFileName is DEPRECATED\n"); - return 0; -} - /////////////////////////////////////////////////////////////////////////////// #include "SkStream.h" diff --git a/src/ports/SkFontHost_none.cpp b/src/ports/SkFontHost_none.cpp index f41951aab2..cbbedfef17 100644 --- a/src/ports/SkFontHost_none.cpp +++ b/src/ports/SkFontHost_none.cpp @@ -34,12 +34,6 @@ SkStream* SkFontHost::OpenStream(uint32_t uniqueID) { return NULL; } -size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length, - int32_t* index) { - SkDebugf("SkFontHost::GetFileName unimplemented\n"); - return 0; -} - /////////////////////////////////////////////////////////////////////////////// void SkFontHost::Serialize(const SkTypeface* face, SkWStream* stream) { diff --git a/src/ports/SkFontHost_simple.cpp b/src/ports/SkFontHost_simple.cpp index 94341c219f..c1208d04e4 100644 --- a/src/ports/SkFontHost_simple.cpp +++ b/src/ports/SkFontHost_simple.cpp @@ -560,27 +560,6 @@ 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; - } -} - SkTypeface* SkFontHost::NextLogicalTypeface(SkFontID currFontID, SkFontID origFontID) { load_system_fonts(); diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index c6b3591863..8b8635b3d2 100755 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -1635,11 +1635,6 @@ SkStream* SkFontHost::OpenStream(SkFontID uniqueID) { return typeface ? typeface->openStream(NULL) : NULL; } -size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length, int32_t* index) { - SkASSERT(!"SkFontHost::GetFileName is DEPRECATED\n"); - return 0; -} - SkScalerContext* LogFontTypeface::onCreateScalerContext(const SkDescriptor* desc) const { return SkNEW_ARGS(SkScalerContext_Windows, (const_cast<LogFontTypeface*>(this), desc)); } diff --git a/src/ports/SkFontHost_win_dw.cpp b/src/ports/SkFontHost_win_dw.cpp index 76275f20a8..e5ade8f533 100644 --- a/src/ports/SkFontHost_win_dw.cpp +++ b/src/ports/SkFontHost_win_dw.cpp @@ -1165,10 +1165,6 @@ SkStream* DWriteFontTypeface::onOpenStream(int* ttcIndex) const { return SkNEW_ARGS(SkDWriteFontFileStream, (fontFileStream.get())); } -size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length, int32_t* index) { - return 0; -} - SkScalerContext* DWriteFontTypeface::onCreateScalerContext(const SkDescriptor* desc) const { return SkNEW_ARGS(SkScalerContext_Windows, (const_cast<DWriteFontTypeface*>(this), desc)); } |