| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 The Android Open Source Project | 2 * Copyright 2011 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 "SkFontConfigParser_android.h" | 8 #include "SkFontConfigParser_android.h" |
| 9 #include "SkTDArray.h" | 9 #include "SkTDArray.h" |
| 10 #include "SkTSearch.h" | 10 #include "SkTSearch.h" |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 *fontFamilies.append() = fallbackFonts[i]; | 580 *fontFamilies.append() = fallbackFonts[i]; |
| 581 } | 581 } |
| 582 } | 582 } |
| 583 | 583 |
| 584 void SkFontConfigParser::GetTestFontFamilies(SkTDArray<FontFamily*> &fontFamilie
s, | 584 void SkFontConfigParser::GetTestFontFamilies(SkTDArray<FontFamily*> &fontFamilie
s, |
| 585 const char* testMainConfigFile, | 585 const char* testMainConfigFile, |
| 586 const char* testFallbackConfigFile)
{ | 586 const char* testFallbackConfigFile)
{ |
| 587 parseConfigFile(testMainConfigFile, fontFamilies); | 587 parseConfigFile(testMainConfigFile, fontFamilies); |
| 588 | 588 |
| 589 SkTDArray<FontFamily*> fallbackFonts; | 589 SkTDArray<FontFamily*> fallbackFonts; |
| 590 if (NULL != testFallbackConfigFile) { | 590 if (testFallbackConfigFile) { |
| 591 parseConfigFile(testFallbackConfigFile, fallbackFonts); | 591 parseConfigFile(testFallbackConfigFile, fallbackFonts); |
| 592 } | 592 } |
| 593 | 593 |
| 594 // Append all fallback fonts to system fonts | 594 // Append all fallback fonts to system fonts |
| 595 for (int i = 0; i < fallbackFonts.count(); ++i) { | 595 for (int i = 0; i < fallbackFonts.count(); ++i) { |
| 596 fallbackFonts[i]->fIsFallbackFont = true; | 596 fallbackFonts[i]->fIsFallbackFont = true; |
| 597 *fontFamilies.append() = fallbackFonts[i]; | 597 *fontFamilies.append() = fallbackFonts[i]; |
| 598 } | 598 } |
| 599 } | 599 } |
| 600 | 600 |
| 601 SkLanguage SkLanguage::getParent() const { | 601 SkLanguage SkLanguage::getParent() const { |
| 602 SkASSERT(!fTag.isEmpty()); | 602 SkASSERT(!fTag.isEmpty()); |
| 603 const char* tag = fTag.c_str(); | 603 const char* tag = fTag.c_str(); |
| 604 | 604 |
| 605 // strip off the rightmost "-.*" | 605 // strip off the rightmost "-.*" |
| 606 const char* parentTagEnd = strrchr(tag, '-'); | 606 const char* parentTagEnd = strrchr(tag, '-'); |
| 607 if (parentTagEnd == NULL) { | 607 if (parentTagEnd == NULL) { |
| 608 return SkLanguage(); | 608 return SkLanguage(); |
| 609 } | 609 } |
| 610 size_t parentTagLen = parentTagEnd - tag; | 610 size_t parentTagLen = parentTagEnd - tag; |
| 611 return SkLanguage(tag, parentTagLen); | 611 return SkLanguage(tag, parentTagLen); |
| 612 } | 612 } |
| OLD | NEW |