| 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" | |
| 9 #include "SkFontDescriptor.h" | 8 #include "SkFontDescriptor.h" |
| 10 #include "SkFontHost_FreeType_common.h" | 9 #include "SkFontHost_FreeType_common.h" |
| 11 #include "SkFontMgr.h" | 10 #include "SkFontMgr.h" |
| 12 #include "SkFontMgr_android.h" | 11 #include "SkFontMgr_android.h" |
| 12 #include "SkFontMgr_android_parser.h" |
| 13 #include "SkFontStyle.h" | 13 #include "SkFontStyle.h" |
| 14 #include "SkStream.h" | 14 #include "SkStream.h" |
| 15 #include "SkTDArray.h" | 15 #include "SkTDArray.h" |
| 16 #include "SkTSearch.h" | 16 #include "SkTSearch.h" |
| 17 #include "SkTypeface.h" | 17 #include "SkTypeface.h" |
| 18 #include "SkTypefaceCache.h" | 18 #include "SkTypefaceCache.h" |
| 19 | 19 |
| 20 #include <limits> | 20 #include <limits> |
| 21 | 21 |
| 22 class SkTypeface_Android : public SkTypeface_FreeType { | 22 class SkTypeface_Android : public SkTypeface_FreeType { |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 SkString name; | 298 SkString name; |
| 299 SkFontStyleSet_Android* styleSet; | 299 SkFontStyleSet_Android* styleSet; |
| 300 }; | 300 }; |
| 301 | 301 |
| 302 class SkFontMgr_Android : public SkFontMgr { | 302 class SkFontMgr_Android : public SkFontMgr { |
| 303 public: | 303 public: |
| 304 SkFontMgr_Android(const SkFontMgr_Android_CustomFonts* custom) { | 304 SkFontMgr_Android(const SkFontMgr_Android_CustomFonts* custom) { |
| 305 SkTDArray<FontFamily*> families; | 305 SkTDArray<FontFamily*> families; |
| 306 if (custom && SkFontMgr_Android_CustomFonts::kPreferSystem != custom->fS
ystemFontUse) { | 306 if (custom && SkFontMgr_Android_CustomFonts::kPreferSystem != custom->fS
ystemFontUse) { |
| 307 SkString base(custom->fBasePath); | 307 SkString base(custom->fBasePath); |
| 308 SkFontConfigParser::GetCustomFontFamilies(families, base, | 308 SkFontMgr_Android_Parser::GetCustomFontFamilies( |
| 309 custom->fFontsXml, custom-
>fFallbackFontsXml); | 309 families, base, custom->fFontsXml, custom->fFallbackFontsXml); |
| 310 } | 310 } |
| 311 if (!custom || | 311 if (!custom || |
| 312 (custom && SkFontMgr_Android_CustomFonts::kOnlyCustom != custom->fSy
stemFontUse)) | 312 (custom && SkFontMgr_Android_CustomFonts::kOnlyCustom != custom->fSy
stemFontUse)) |
| 313 { | 313 { |
| 314 SkFontConfigParser::GetSystemFontFamilies(families); | 314 SkFontMgr_Android_Parser::GetSystemFontFamilies(families); |
| 315 } | 315 } |
| 316 if (custom && SkFontMgr_Android_CustomFonts::kPreferSystem == custom->fS
ystemFontUse) { | 316 if (custom && SkFontMgr_Android_CustomFonts::kPreferSystem == custom->fS
ystemFontUse) { |
| 317 SkString base(custom->fBasePath); | 317 SkString base(custom->fBasePath); |
| 318 SkFontConfigParser::GetCustomFontFamilies(families, base, | 318 SkFontMgr_Android_Parser::GetCustomFontFamilies( |
| 319 custom->fFontsXml, custom-
>fFallbackFontsXml); | 319 families, base, custom->fFontsXml, custom->fFallbackFontsXml); |
| 320 } | 320 } |
| 321 this->buildNameToFamilyMap(families); | 321 this->buildNameToFamilyMap(families); |
| 322 this->findDefaultFont(); | 322 this->findDefaultFont(); |
| 323 families.deleteAll(); | 323 families.deleteAll(); |
| 324 } | 324 } |
| 325 | 325 |
| 326 protected: | 326 protected: |
| 327 /** Returns not how many families we have, but how many unique names | 327 /** Returns not how many families we have, but how many unique names |
| 328 * exist among the families. | 328 * exist among the families. |
| 329 */ | 329 */ |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 SkASSERT(custom->fSystemFontUse < SK_ARRAY_COUNT(gSystemFontUseStrings))
; | 579 SkASSERT(custom->fSystemFontUse < SK_ARRAY_COUNT(gSystemFontUseStrings))
; |
| 580 SkDEBUGF(("SystemFontUse: %s BasePath: %s Fonts: %s FallbackFonts: %s\n"
, | 580 SkDEBUGF(("SystemFontUse: %s BasePath: %s Fonts: %s FallbackFonts: %s\n"
, |
| 581 gSystemFontUseStrings[custom->fSystemFontUse], | 581 gSystemFontUseStrings[custom->fSystemFontUse], |
| 582 custom->fBasePath, | 582 custom->fBasePath, |
| 583 custom->fFontsXml, | 583 custom->fFontsXml, |
| 584 custom->fFallbackFontsXml)); | 584 custom->fFallbackFontsXml)); |
| 585 } | 585 } |
| 586 | 586 |
| 587 return SkNEW_ARGS(SkFontMgr_Android, (custom)); | 587 return SkNEW_ARGS(SkFontMgr_Android, (custom)); |
| 588 } | 588 } |
| OLD | NEW |