From ef772ddb86e9ab5e7e2811c67ed75a24f3ce0e5e Mon Sep 17 00:00:00 2001 From: "reed@android.com" Date: Tue, 3 Mar 2009 21:20:49 +0000 Subject: [PATCH] remove unimplemented (and uncalled) SkTypeface::Hash() git-svn-id: http://skia.googlecode.com/svn/trunk@105 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkTypeface.h | 18 ++++++++---------- src/core/SkTypeface.cpp | 21 +++++++-------------- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h index 546edcaae8..72a0af1036 100644 --- a/include/core/SkTypeface.h +++ b/include/core/SkTypeface.h @@ -60,6 +60,9 @@ public: */ bool isItalic() const { return (fStyle & kItalic) != 0; } + /** Return a 32bit value for this typeface, unique for the underlying font + data. Will never return 0. + */ uint32_t uniqueID() const { return fUniqueID; } /** Return the uniqueID for the specified typeface. If the face is null, @@ -67,6 +70,11 @@ public: */ static uint32_t UniqueID(const SkTypeface* face); + /** Returns true if the two typefaces reference the same underlying font, + handling either being null (treating null as the default font) + */ + static bool Equal(const SkTypeface* facea, const SkTypeface* faceb); + /** Return a new reference to the typeface that most closely matches the requested familyName and style. Pass null as the familyName to return the default font for the requested style. Will never return null @@ -90,16 +98,6 @@ public: */ static SkTypeface* CreateFromTypeface(const SkTypeface* family, Style s); - /** Returns true if the two typefaces reference the same underlying font, - even if one is null (which maps to the default font). - */ - static bool Equal(const SkTypeface* facea, const SkTypeface* faceb); - - /** Returns a 32bit hash value for the typeface. Takes care of mapping null - to the default typeface. - */ - static uint32_t Hash(const SkTypeface* face); - /** Return a new typeface given a file. If the file does not exist, or is not a valid font file, returns null. */ diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp index 4604f6de67..1f2078e1eb 100644 --- a/src/core/SkTypeface.cpp +++ b/src/core/SkTypeface.cpp @@ -1,8 +1,7 @@ #include "SkTypeface.h" #include "SkFontHost.h" -static const SkTypeface* resolve_null_typeface(const SkTypeface* face) -{ +static const SkTypeface* resolve_null_typeface(const SkTypeface* face) { if (NULL == face) { face = SkFontHost::FindTypeface(NULL, NULL, SkTypeface::kNormal); SkASSERT(face); @@ -10,41 +9,35 @@ static const SkTypeface* resolve_null_typeface(const SkTypeface* face) return face; } -uint32_t SkTypeface::UniqueID(const SkTypeface* face) -{ +uint32_t SkTypeface::UniqueID(const SkTypeface* face) { return resolve_null_typeface(face)->uniqueID(); } -bool SkTypeface::Equal(const SkTypeface* facea, const SkTypeface* faceb) -{ +bool SkTypeface::Equal(const SkTypeface* facea, const SkTypeface* faceb) { return resolve_null_typeface(facea)->uniqueID() == resolve_null_typeface(faceb)->uniqueID(); } /////////////////////////////////////////////////////////////////////////////// -SkTypeface* SkTypeface::Create(const char name[], Style style) -{ +SkTypeface* SkTypeface::Create(const char name[], Style style) { SkTypeface* face = SkFontHost::FindTypeface(NULL, name, style); face->ref(); return face; } -SkTypeface* SkTypeface::CreateFromTypeface(const SkTypeface* family, Style s) -{ +SkTypeface* SkTypeface::CreateFromTypeface(const SkTypeface* family, Style s) { family = resolve_null_typeface(family); SkTypeface* face = SkFontHost::FindTypeface(family, NULL, s); face->ref(); return face; } -SkTypeface* SkTypeface::CreateFromStream(SkStream* stream) -{ +SkTypeface* SkTypeface::CreateFromStream(SkStream* stream) { return SkFontHost::CreateTypeface(stream); } -SkTypeface* SkTypeface::CreateFromFile(const char path[]) -{ +SkTypeface* SkTypeface::CreateFromFile(const char path[]) { return SkFontHost::CreateTypefaceFromFile(path); }