| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 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 "SkFontConfigParser_android.h" | 8 #include "SkFontConfigParser_android.h" |
| 9 #include "SkFontDescriptor.h" | 9 #include "SkFontDescriptor.h" |
| 10 #include "SkFontHost_FreeType_common.h" | 10 #include "SkFontHost_FreeType_common.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 SkString name; | 240 SkString name; |
| 241 SkFontStyleSet_Android* styleSet; | 241 SkFontStyleSet_Android* styleSet; |
| 242 }; | 242 }; |
| 243 | 243 |
| 244 class SkFontMgr_Android : public SkFontMgr { | 244 class SkFontMgr_Android : public SkFontMgr { |
| 245 public: | 245 public: |
| 246 SkFontMgr_Android(const SkFontMgr_Android_CustomFonts* custom) { | 246 SkFontMgr_Android(const SkFontMgr_Android_CustomFonts* custom) { |
| 247 SkTDArray<FontFamily*> families; | 247 SkTDArray<FontFamily*> families; |
| 248 if (custom && SkFontMgr_Android_CustomFonts::kPreferSystem != custom->fS
ystemFontUse) { | 248 if (custom && SkFontMgr_Android_CustomFonts::kPreferSystem != custom->fS
ystemFontUse) { |
| 249 SkString base(custom->fBasePath); | 249 SkString base(custom->fBasePath); |
| 250 SkFontConfigParser::GetCustomFontFamilies(families, base, | 250 SkFontConfigParser::GetCustomFontFamilies( |
| 251 custom->fFontsXml, custom-
>fFallbackFontsXml); | 251 families, base, custom->fFontsXml, custom->fFallbackFontsXml, NU
LL); |
| 252 } | 252 } |
| 253 if (!custom || | 253 if (!custom || |
| 254 (custom && SkFontMgr_Android_CustomFonts::kOnlyCustom != custom->fSy
stemFontUse)) | 254 (custom && SkFontMgr_Android_CustomFonts::kOnlyCustom != custom->fSy
stemFontUse)) |
| 255 { | 255 { |
| 256 SkFontConfigParser::GetSystemFontFamilies(families); | 256 SkFontConfigParser::GetSystemFontFamilies(families); |
| 257 } | 257 } |
| 258 if (custom && SkFontMgr_Android_CustomFonts::kPreferSystem == custom->fS
ystemFontUse) { | 258 if (custom && SkFontMgr_Android_CustomFonts::kPreferSystem == custom->fS
ystemFontUse) { |
| 259 SkString base(custom->fBasePath); | 259 SkString base(custom->fBasePath); |
| 260 SkFontConfigParser::GetCustomFontFamilies(families, base, | 260 SkFontConfigParser::GetCustomFontFamilies( |
| 261 custom->fFontsXml, custom-
>fFallbackFontsXml); | 261 families, base, custom->fFontsXml, custom->fFallbackFontsXml, NU
LL); |
| 262 } | 262 } |
| 263 this->buildNameToFamilyMap(families); | 263 this->buildNameToFamilyMap(families); |
| 264 this->findDefaultFont(); | 264 this->findDefaultFont(); |
| 265 families.deleteAll(); | 265 families.deleteAll(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 protected: | 268 protected: |
| 269 /** Returns not how many families we have, but how many unique names | 269 /** Returns not how many families we have, but how many unique names |
| 270 * exist among the families. | 270 * exist among the families. |
| 271 */ | 271 */ |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 { | 540 { |
| 541 gTestFontsXml = fontsXml; | 541 gTestFontsXml = fontsXml; |
| 542 gTestFallbackFontsXml = fallbackFontsXml; | 542 gTestFallbackFontsXml = fallbackFontsXml; |
| 543 gTestBasePath = basePath; | 543 gTestBasePath = basePath; |
| 544 SkASSERT(gTestFontsXml); | 544 SkASSERT(gTestFontsXml); |
| 545 SkASSERT(gTestFallbackFontsXml); | 545 SkASSERT(gTestFallbackFontsXml); |
| 546 SkASSERT(gTestBasePath); | 546 SkASSERT(gTestBasePath); |
| 547 SkDEBUGF(("Test BasePath: %s Fonts: %s FallbackFonts: %s\n", | 547 SkDEBUGF(("Test BasePath: %s Fonts: %s FallbackFonts: %s\n", |
| 548 gTestBasePath, gTestFontsXml, gTestFallbackFontsXml)); | 548 gTestBasePath, gTestFontsXml, gTestFallbackFontsXml)); |
| 549 } | 549 } |
| OLD | NEW |