| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 const int ttcIndex = fontFile.fIndex; | 138 const int ttcIndex = fontFile.fIndex; |
| 139 SkString familyName; | 139 SkString familyName; |
| 140 SkFontStyle style; | 140 SkFontStyle style; |
| 141 bool isFixedWidth; | 141 bool isFixedWidth; |
| 142 if (!scanner.scanFont(stream.get(), ttcIndex, &familyName, &style, &
isFixedWidth)) { | 142 if (!scanner.scanFont(stream.get(), ttcIndex, &familyName, &style, &
isFixedWidth)) { |
| 143 SkDEBUGF(("Requested font file %s exists, but is not a valid fon
t.\n", | 143 SkDEBUGF(("Requested font file %s exists, but is not a valid fon
t.\n", |
| 144 pathName.c_str())); | 144 pathName.c_str())); |
| 145 continue; | 145 continue; |
| 146 } | 146 } |
| 147 | 147 |
| 148 if (fontFile.fWeight != 0) { | 148 int weight = fontFile.fWeight != 0 ? fontFile.fWeight : style.weight
(); |
| 149 style = SkFontStyle(fontFile.fWeight, style.width(), style.slant
()); | 149 SkFontStyle::Slant slant; |
| 150 switch (fontFile.fStyle) { |
| 151 case FontFileInfo::Style::Auto: slant = style.slant(); break; |
| 152 case FontFileInfo::Style::Normal: slant = SkFontStyle::kUpright_
Slant; break; |
| 153 case FontFileInfo::Style::Italic: slant = SkFontStyle::kItalic_S
lant; break; |
| 154 default: SkASSERT(false); break; |
| 150 } | 155 } |
| 156 style = SkFontStyle(weight, style.width(), slant); |
| 151 | 157 |
| 152 const SkLanguage& lang = family.fLanguage; | 158 const SkLanguage& lang = family.fLanguage; |
| 153 uint32_t variant = family.fVariant; | 159 uint32_t variant = family.fVariant; |
| 154 if (kDefault_FontVariant == variant) { | 160 if (kDefault_FontVariant == variant) { |
| 155 variant = kCompact_FontVariant | kElegant_FontVariant; | 161 variant = kCompact_FontVariant | kElegant_FontVariant; |
| 156 } | 162 } |
| 157 | 163 |
| 158 // The first specified family name overrides the family name found i
n the font. | 164 // The first specified family name overrides the family name found i
n the font. |
| 159 // TODO: SkTypeface_AndroidSystem::onCreateFamilyNameIterator should
return | 165 // TODO: SkTypeface_AndroidSystem::onCreateFamilyNameIterator should
return |
| 160 // all of the specified family names in addition to the names found
in the font. | 166 // all of the specified family names in addition to the names found
in the font. |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 { | 546 { |
| 541 gTestFontsXml = fontsXml; | 547 gTestFontsXml = fontsXml; |
| 542 gTestFallbackFontsXml = fallbackFontsXml; | 548 gTestFallbackFontsXml = fallbackFontsXml; |
| 543 gTestBasePath = basePath; | 549 gTestBasePath = basePath; |
| 544 SkASSERT(gTestFontsXml); | 550 SkASSERT(gTestFontsXml); |
| 545 SkASSERT(gTestFallbackFontsXml); | 551 SkASSERT(gTestFallbackFontsXml); |
| 546 SkASSERT(gTestBasePath); | 552 SkASSERT(gTestBasePath); |
| 547 SkDEBUGF(("Test BasePath: %s Fonts: %s FallbackFonts: %s\n", | 553 SkDEBUGF(("Test BasePath: %s Fonts: %s FallbackFonts: %s\n", |
| 548 gTestBasePath, gTestFontsXml, gTestFallbackFontsXml)); | 554 gTestBasePath, gTestFontsXml, gTestFallbackFontsXml)); |
| 549 } | 555 } |
| OLD | NEW |