Remove FontConfigTypeface::getFamilyName().
authorbungeman <bungeman@google.com>
Wed, 18 Feb 2015 21:22:26 +0000 (13:22 -0800)
committerCommit bot <commit-bot@chromium.org>
Wed, 18 Feb 2015 21:22:26 +0000 (13:22 -0800)
This method is hiding a method of the same name from the superclass.
This is confusing and error prone, and doesn't really add anything.

Review URL: https://codereview.chromium.org/924333003

src/ports/SkFontConfigTypeface.h
src/ports/SkFontHost_fontconfig.cpp

index 83cd3ad..7eecbf6 100644 (file)
@@ -33,7 +33,6 @@ public:
         return fIdentity;
     }
 
-    const char* getFamilyName() const { return fFamilyName.c_str(); }
     SkStreamAsset* getLocalStream() const { return fLocalStream.get(); }
 
     bool isFamilyName(const char* name) const {
index 591e9d5..aaee67a 100644 (file)
@@ -85,9 +85,10 @@ SkTypeface* FontConfigTypeface::LegacyCreateTypeface(
         return NULL;
     }
 
+    SkString familyFaceName;
     if (familyFace) {
-        FontConfigTypeface* fct = (FontConfigTypeface*)familyFace;
-        familyName = fct->getFamilyName();
+        familyFace->getFamilyName(&familyFaceName);
+        familyName = familyFaceName.c_str();
     }
 
     SkFontStyle requestedStyle(style);
@@ -144,12 +145,14 @@ SkStreamAsset* FontConfigTypeface::onOpenStream(int* ttcIndex) const {
 }
 
 void FontConfigTypeface::onGetFamilyName(SkString* familyName) const {
-    *familyName = this->getFamilyName();
+    *familyName = fFamilyName;
 }
 
 void FontConfigTypeface::onGetFontDescriptor(SkFontDescriptor* desc,
                                              bool* isLocalStream) const {
-    desc->setFamilyName(this->getFamilyName());
+    SkString name;
+    this->getFamilyName(&name);
+    desc->setFamilyName(name.c_str());
     desc->setFontIndex(this->getIdentity().fTTCIndex);
     *isLocalStream = SkToBool(this->getLocalStream());
 }