aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-04-15 14:04:52 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-04-15 14:04:52 +0000
commit887e4f325c2b9b306116a4eea37c5afad1db3346 (patch)
tree88f16228b5cf7f34b7adee808957d0b28d313020
parent258cb228c636282a3e4f4ce87b1017498e207f33 (diff)
be sure to ref() before returning a typeface from Create
skip duplicate faces in the same family+style slot git-svn-id: http://skia.googlecode.com/svn/trunk@549 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/ports/SkFontHost_linux.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ports/SkFontHost_linux.cpp b/src/ports/SkFontHost_linux.cpp
index 62feef3ca1..22256faf3e 100644
--- a/src/ports/SkFontHost_linux.cpp
+++ b/src/ports/SkFontHost_linux.cpp
@@ -401,6 +401,12 @@ static void load_system_fonts() {
// SkDebugf("font: <%s> %d <%s>\n", realname.c_str(), style, filename.c_str());
FamilyRec* family = find_familyrec(realname.c_str());
+ if (family && family->fFaces[style]) {
+// SkDebugf("---- skipping duplicate typeface %s style %d\n",
+// realname.c_str(), style);
+ continue;
+ }
+
// this constructor puts us into the global gFamilyHead llist
FamilyTypeface* tf = SkNEW_ARGS(FileTypeface,
(style,
@@ -523,7 +529,8 @@ SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
if (NULL == tf) {
tf = find_best_face(gDefaultFamily, style);
}
-
+
+ SkSafeRef(tf);
return tf;
}