| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2006 The Android Open Source Project | 2  * Copyright 2006 The Android Open Source Project | 
| 3  * | 3  * | 
| 4  * Use of this source code is governed by a BSD-style license that can be | 4  * Use of this source code is governed by a BSD-style license that can be | 
| 5  * found in the LICENSE file. | 5  * found in the LICENSE file. | 
| 6  */ | 6  */ | 
| 7 | 7 | 
| 8 #include "SkFontDescriptor.h" | 8 #include "SkFontDescriptor.h" | 
| 9 #include "SkFontHost_FreeType_common.h" | 9 #include "SkFontHost_FreeType_common.h" | 
| 10 #include "SkFontMgr.h" | 10 #include "SkFontMgr.h" | 
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 142     } | 142     } | 
| 143 | 143 | 
| 144     SkTypeface* createTypeface(int index) override { | 144     SkTypeface* createTypeface(int index) override { | 
| 145         SkASSERT(index < fStyles.count()); | 145         SkASSERT(index < fStyles.count()); | 
| 146         return SkRef(fStyles[index].get()); | 146         return SkRef(fStyles[index].get()); | 
| 147     } | 147     } | 
| 148 | 148 | 
| 149     static int match_score(const SkFontStyle& pattern, const SkFontStyle& candid
     ate) { | 149     static int match_score(const SkFontStyle& pattern, const SkFontStyle& candid
     ate) { | 
| 150         int score = 0; | 150         int score = 0; | 
| 151         score += (pattern.width() - candidate.width()) * 100; | 151         score += (pattern.width() - candidate.width()) * 100; | 
| 152         score += (pattern.isItalic() == candidate.isItalic()) ? 0 : 1000; | 152         score += (pattern.slant() == candidate.slant()) ? 0 : 1000; | 
| 153         score += pattern.weight() - candidate.weight(); | 153         score += pattern.weight() - candidate.weight(); | 
| 154         return score; | 154         return score; | 
| 155     } | 155     } | 
| 156 | 156 | 
| 157     SkTypeface* matchStyle(const SkFontStyle& pattern) override { | 157     SkTypeface* matchStyle(const SkFontStyle& pattern) override { | 
| 158         if (0 == fStyles.count()) { | 158         if (0 == fStyles.count()) { | 
| 159             return nullptr; | 159             return nullptr; | 
| 160         } | 160         } | 
| 161 | 161 | 
| 162         SkTypeface_Custom* closest = fStyles[0]; | 162         SkTypeface_Custom* closest = fStyles[0]; | 
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 511         SkFontStyleSet_Custom* family = new SkFontStyleSet_Custom(SkString()); | 511         SkFontStyleSet_Custom* family = new SkFontStyleSet_Custom(SkString()); | 
| 512         families->push_back().reset(family); | 512         families->push_back().reset(family); | 
| 513         family->appendTypeface(new SkTypeface_Empty); | 513         family->appendTypeface(new SkTypeface_Empty); | 
| 514     } | 514     } | 
| 515 | 515 | 
| 516 }; | 516 }; | 
| 517 | 517 | 
| 518 SK_API SkFontMgr* SkFontMgr_New_Custom_Empty() { | 518 SK_API SkFontMgr* SkFontMgr_New_Custom_Empty() { | 
| 519     return new SkFontMgr_Custom(EmptyFontLoader()); | 519     return new SkFontMgr_Custom(EmptyFontLoader()); | 
| 520 } | 520 } | 
| OLD | NEW | 
|---|