Fix issue when the family name is reused among multiple families.
authordjsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 27 Aug 2013 17:40:03 +0000 (17:40 +0000)
committerdjsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 27 Aug 2013 17:40:03 +0000 (17:40 +0000)
BUG=chromium:274117
R=reed@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@10942 2bbb7eff-a529-9590-31e7-b0007b416f81

src/ports/SkFontConfigInterface_android.cpp

index e988618..c9dc944 100644 (file)
@@ -183,7 +183,12 @@ static void get_path_for_sys_fonts(SkString* full, const char name[]) {
 static void insert_into_name_dict(SkTDict<FamilyRecID>& familyNameDict,
                                   const char* name, FamilyRecID familyRecID) {
     SkAutoAsciiToLC tolc(name);
-    familyNameDict.set(tolc.lc(), familyRecID);
+    if (familyNameDict.find(tolc.lc())) {
+        SkDebugf("---- system font attempting to use a the same name [%s] for"
+                 "multiple families. skipping subsequent occurrences", tolc.lc());
+    } else {
+        familyNameDict.set(tolc.lc(), familyRecID);
+    }
 }
 
 // Defined in SkFontHost_FreeType.cpp