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
This commit is contained in:
reed@android.com 2010-04-15 14:04:52 +00:00
parent 258cb228c6
commit 887e4f325c

View File

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