aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-08-02 00:20:34 +0000
committerGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-08-02 00:20:34 +0000
commitfebfd70d26dce3eb30da5384e36d740576a56161 (patch)
tree973e73cc38e8e778b965c74c28d1e68a5c0d01fd /src
parent5ecd4fac89e854b85850bee1920d96c6ba1af259 (diff)
Add onRefMatchingStyle to SkFontHost_linux.
git-svn-id: http://skia.googlecode.com/svn/trunk@10502 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/ports/SkFontHost_linux.cpp39
1 files changed, 18 insertions, 21 deletions
diff --git a/src/ports/SkFontHost_linux.cpp b/src/ports/SkFontHost_linux.cpp
index 71438986e6..2487976b86 100644
--- a/src/ports/SkFontHost_linux.cpp
+++ b/src/ports/SkFontHost_linux.cpp
@@ -113,20 +113,6 @@ static FamilyRec* find_family(const SkTypeface* member) {
return NULL;
}
-static SkTypeface* find_from_uniqueID(uint32_t uniqueID) {
- FamilyRec* curr = gFamilyHead;
- while (curr != NULL) {
- for (int i = 0; i < 4; i++) {
- SkTypeface* face = curr->fFaces[i];
- if (face != NULL && face->uniqueID() == uniqueID) {
- return face;
- }
- }
- curr = curr->fNext;
- }
- return NULL;
-}
-
/* Remove reference to this face from its family. If the resulting family
is empty (has no faces), return that family, otherwise return NULL
*/
@@ -263,6 +249,7 @@ public:
protected:
virtual void onGetFontDescriptor(SkFontDescriptor*, bool*) const SK_OVERRIDE;
+ virtual SkTypeface* onRefMatchingStyle(Style styleBits) const SK_OVERRIDE;
private:
FamilyRec* fFamilyRec; // we don't own this, just point to it
@@ -467,13 +454,9 @@ void FamilyTypeface::onGetFontDescriptor(SkFontDescriptor* desc,
*isLocalStream = !this->isSysFont();
}
-///////////////////////////////////////////////////////////////////////////////
-
-#ifndef SK_FONTHOST_USES_FONTMGR
-
-SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
- const char familyName[],
- SkTypeface::Style style) {
+static SkTypeface* create_typeface(const SkTypeface* familyFace,
+ const char familyName[],
+ SkTypeface::Style style) {
load_system_fonts();
SkAutoMutexAcquire ac(gFamilyMutex);
@@ -498,6 +481,20 @@ SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
return tf;
}
+SkTypeface* FamilyTypeface::onRefMatchingStyle(Style style) const {
+ return create_typeface(this, NULL, style);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SK_FONTHOST_USES_FONTMGR
+
+SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
+ const char familyName[],
+ SkTypeface::Style style) {
+ return create_typeface(familyFace, NULL, style);
+}
+
SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) {
if (NULL == stream || stream->getLength() <= 0) {
SkDELETE(stream);