aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/fonts
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2014-09-17 07:48:59 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-17 07:48:59 -0700
commitb374d6a62c0259387d90cad74753d8bad9ee1bea (patch)
treefd558326c3254d6be22818cab97f18e3223669c2 /src/fonts
parent3850971d54b2e07cbf69e282d1455ea1dc3333b6 (diff)
Add onGetFamilyName to SkTypeface.
This speeds up and documents this particular feature of SkTypeface and also frees up SkFontDescriptor to be used only in serialization. R=reed@google.com Author: bungeman@google.com Review URL: https://codereview.chromium.org/574873002
Diffstat (limited to 'src/fonts')
-rw-r--r--src/fonts/SkGScalerContext.cpp4
-rw-r--r--src/fonts/SkGScalerContext.h1
-rw-r--r--src/fonts/SkTestScalerContext.cpp4
-rw-r--r--src/fonts/SkTestScalerContext.h1
4 files changed, 10 insertions, 0 deletions
diff --git a/src/fonts/SkGScalerContext.cpp b/src/fonts/SkGScalerContext.cpp
index e543fdbd0a..34a788a9c9 100644
--- a/src/fonts/SkGScalerContext.cpp
+++ b/src/fonts/SkGScalerContext.cpp
@@ -206,6 +206,10 @@ int SkGTypeface::onGetUPEM() const {
return fProxy->getUnitsPerEm();
}
+void SkGTypeface::onGetFamilyName(SkString* familyName) const {
+ fProxy->getFamilyName(familyName);
+}
+
SkTypeface::LocalizedStrings* SkGTypeface::onCreateFamilyNameIterator() const {
return fProxy->createFamilyNameIterator();
}
diff --git a/src/fonts/SkGScalerContext.h b/src/fonts/SkGScalerContext.h
index faca50ed6b..8ad28173c0 100644
--- a/src/fonts/SkGScalerContext.h
+++ b/src/fonts/SkGScalerContext.h
@@ -34,6 +34,7 @@ protected:
virtual int onCountGlyphs() const SK_OVERRIDE;
virtual int onGetUPEM() const SK_OVERRIDE;
+ virtual void onGetFamilyName(SkString* familyName) const SK_OVERRIDE;
virtual SkTypeface::LocalizedStrings* onCreateFamilyNameIterator() const SK_OVERRIDE;
virtual int onGetTableTags(SkFontTableTag tags[]) const SK_OVERRIDE;
diff --git a/src/fonts/SkTestScalerContext.cpp b/src/fonts/SkTestScalerContext.cpp
index 854c980904..ee379f0a38 100644
--- a/src/fonts/SkTestScalerContext.cpp
+++ b/src/fonts/SkTestScalerContext.cpp
@@ -175,6 +175,10 @@ int SkTestTypeface::onCharsToGlyphs(const void* chars, Encoding encoding,
return glyphCount;
}
+void SkTestTypeface::onGetFamilyName(SkString* familyName) const {
+ *familyName = fTestFont->fName;
+}
+
SkTypeface::LocalizedStrings* SkTestTypeface::onCreateFamilyNameIterator() const {
SkString familyName(fTestFont->fName);
SkString language("und"); //undetermined
diff --git a/src/fonts/SkTestScalerContext.h b/src/fonts/SkTestScalerContext.h
index aed64e7e43..42f604952f 100644
--- a/src/fonts/SkTestScalerContext.h
+++ b/src/fonts/SkTestScalerContext.h
@@ -92,6 +92,7 @@ protected:
return 1;
}
+ virtual void onGetFamilyName(SkString* familyName) const SK_OVERRIDE;
virtual SkTypeface::LocalizedStrings* onCreateFamilyNameIterator() const SK_OVERRIDE;
virtual int onGetTableTags(SkFontTableTag tags[]) const SK_OVERRIDE {