remove unimplemented (and uncalled) SkTypeface::Hash()

git-svn-id: http://skia.googlecode.com/svn/trunk@105 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2009-03-03 21:20:49 +00:00
parent 1116fb25e5
commit ef772ddb86
2 changed files with 15 additions and 24 deletions

View File

@ -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.
*/

View File

@ -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);
}