OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 The Android Open Source Project | 3 * Copyright 2013 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkFontConfigInterface.h" | 9 #include "SkFontConfigInterface.h" |
10 #include "SkTypeface_android.h" | 10 #include "SkTypeface_android.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 fLocaleFallbackFontList(NULL) { | 198 fLocaleFallbackFontList(NULL) { |
199 | 199 |
200 for (int i = 0; i < fontFamilies.count(); ++i) { | 200 for (int i = 0; i < fontFamilies.count(); ++i) { |
201 FontFamily* family = fontFamilies[i]; | 201 FontFamily* family = fontFamilies[i]; |
202 | 202 |
203 // defer initializing the familyRec until we can be sure that at least | 203 // defer initializing the familyRec until we can be sure that at least |
204 // one of it's children contains a valid font file | 204 // one of it's children contains a valid font file |
205 FamilyRec* familyRec = NULL; | 205 FamilyRec* familyRec = NULL; |
206 FamilyRecID familyRecID = INVALID_FAMILY_REC_ID; | 206 FamilyRecID familyRecID = INVALID_FAMILY_REC_ID; |
207 | 207 |
208 for (int j = 0; j < family->fFontFiles.count(); ++j) { | 208 for (int j = 0; j < family->fFonts.count(); ++j) { |
209 SkString filename; | 209 SkString filename; |
210 get_path_for_sys_fonts(&filename, family->fFontFiles[j].fFileName); | 210 get_path_for_sys_fonts(&filename, family->fFonts[j].fFileName); |
211 | 211 |
212 if (has_font(fFonts, filename)) { | 212 if (has_font(fFonts, filename)) { |
213 DEBUG_FONT(("---- system font and fallback font files specify a
duplicate " | 213 DEBUG_FONT(("---- system font and fallback font files specify a
duplicate " |
214 "font %s, skipping the second occurrence", filename.c_st
r())); | 214 "font %s, skipping the second occurrence", filename.c_st
r())); |
215 } | 215 } |
216 | 216 |
217 FontRec& fontRec = fFonts.push_back(); | 217 FontRec& fontRec = fFonts.push_back(); |
218 fontRec.fFileName = filename; | 218 fontRec.fFileName = filename; |
219 fontRec.fStyle = SkTypeface::kNormal; | 219 fontRec.fStyle = SkTypeface::kNormal; |
220 fontRec.fIsValid = false; | 220 fontRec.fIsValid = false; |
(...skipping 24 matching lines...) Expand all Loading... |
245 } | 245 } |
246 | 246 |
247 // create a familyRec now that we know that at least one font in | 247 // create a familyRec now that we know that at least one font in |
248 // the family is valid | 248 // the family is valid |
249 if (familyRec == NULL) { | 249 if (familyRec == NULL) { |
250 familyRec = &fFontFamilies.push_back(); | 250 familyRec = &fFontFamilies.push_back(); |
251 familyRecID = fFontFamilies.count() - 1; | 251 familyRecID = fFontFamilies.count() - 1; |
252 fontRec.fFamilyRecID = familyRecID; | 252 fontRec.fFamilyRecID = familyRecID; |
253 | 253 |
254 familyRec->fIsFallbackFont = family->fIsFallbackFont; | 254 familyRec->fIsFallbackFont = family->fIsFallbackFont; |
255 familyRec->fPaintOptions = family->fFontFiles[j].fPaintOptions; | 255 familyRec->fPaintOptions = family->fFonts[j].fPaintOptions; |
256 | 256 |
257 } else if (familyRec->fPaintOptions != family->fFontFiles[j].fPaintO
ptions) { | 257 } else if (familyRec->fPaintOptions != family->fFonts[j].fPaintOptio
ns) { |
258 SkDebugf("Every font file within a family must have identical" | 258 SkDebugf("Every font file within a family must have identical" |
259 "language and variant attributes"); | 259 "language and variant attributes"); |
260 sk_throw(); | 260 sk_throw(); |
261 } | 261 } |
262 | 262 |
263 // add this font to the current familyRec | 263 // add this font to the current familyRec |
264 if (INVALID_FONT_REC_ID != familyRec->fFontRecID[fontRec.fStyle]) { | 264 if (INVALID_FONT_REC_ID != familyRec->fFontRecID[fontRec.fStyle]) { |
265 DEBUG_FONT(("Overwriting familyRec for style[%d] old,new:(%d,%d)
", | 265 DEBUG_FONT(("Overwriting familyRec for style[%d] old,new:(%d,%d)
", |
266 fontRec.fStyle, familyRec->fFontRecID[fontRec.fStyle
], | 266 fontRec.fStyle, familyRec->fFontRecID[fontRec.fStyle
], |
267 fontRecID)); | 267 fontRecID)); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 SkDEBUGF(("Use Test Config File Main %s, Fallback %s, Font Dir %s", | 577 SkDEBUGF(("Use Test Config File Main %s, Fallback %s, Font Dir %s", |
578 gTestMainConfigFile, gTestFallbackConfigFile, gTestFontFilePrefix)
); | 578 gTestMainConfigFile, gTestFallbackConfigFile, gTestFontFilePrefix)
); |
579 } | 579 } |
580 | 580 |
581 void SkGetTestFontConfiguration(const char** mainconf, const char** fallbackconf
, | 581 void SkGetTestFontConfiguration(const char** mainconf, const char** fallbackconf
, |
582 const char** fontsdir) { | 582 const char** fontsdir) { |
583 *mainconf = gTestMainConfigFile; | 583 *mainconf = gTestMainConfigFile; |
584 *fallbackconf = gTestFallbackConfigFile; | 584 *fallbackconf = gTestFallbackConfigFile; |
585 *fontsdir = gTestFontFilePrefix; | 585 *fontsdir = gTestFontFilePrefix; |
586 } | 586 } |
OLD | NEW |