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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
407 SkAutoAsciiToLC tolc(familyName); | 407 SkAutoAsciiToLC tolc(familyName); |
408 if (fFamilyNameDict.find(tolc.lc(), &familyRecID)) { | 408 if (fFamilyNameDict.find(tolc.lc(), &familyRecID)) { |
409 exactNameMatch = true; | 409 exactNameMatch = true; |
410 } | 410 } |
411 } else { | 411 } else { |
412 familyRecID = fDefaultFamilyRecID; | 412 familyRecID = fDefaultFamilyRecID; |
413 | 413 |
414 } | 414 } |
415 | 415 |
416 if (INVALID_FAMILY_REC_ID == familyRecID) { | 416 if (INVALID_FAMILY_REC_ID == familyRecID) { |
417 //TODO this ensures that we always return something | 417 return false; |
418 familyRecID = fDefaultFamilyRecID; | |
419 //return false; | |
420 } | 418 } |
421 | 419 |
422 FontRecID fontRecID = find_best_style(fFontFamilies[familyRecID], style); | 420 FontRecID fontRecID = find_best_style(fFontFamilies[familyRecID], style); |
423 FontRec& fontRec = fFonts[fontRecID]; | 421 FontRec& fontRec = fFonts[fontRecID]; |
424 | 422 |
425 if (NULL != outFontIdentifier) { | 423 if (NULL != outFontIdentifier) { |
426 outFontIdentifier->fID = fontRecID; | 424 outFontIdentifier->fID = fontRecID; |
427 outFontIdentifier->fTTCIndex = 0; | 425 outFontIdentifier->fTTCIndex = 0; |
428 outFontIdentifier->fString.set(fontRec.fFileName); | 426 outFontIdentifier->fString.set(fontRec.fFileName); |
429 // outFontIdentifier->fStyle = fontRec.fStyle; | 427 // outFontIdentifier->fStyle = fontRec.fStyle; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 if (!face) { | 486 if (!face) { |
489 // look for it in the typeface cache | 487 // look for it in the typeface cache |
490 face = SkTypefaceCache::FindByProcAndRef(find_proc, &fontRecID); | 488 face = SkTypefaceCache::FindByProcAndRef(find_proc, &fontRecID); |
491 | 489 |
492 // if it is not in the cache then create it | 490 // if it is not in the cache then create it |
493 if (!face) { | 491 if (!face) { |
494 const char* familyName = NULL; | 492 const char* familyName = NULL; |
495 SkAssertResult(fFamilyNameDict.findKey(fontRec.fFamilyRecID, &family Name)); | 493 SkAssertResult(fFamilyNameDict.findKey(fontRec.fFamilyRecID, &family Name)); |
496 SkASSERT(familyName); | 494 SkASSERT(familyName); |
497 face = SkTypeface::CreateFromName(familyName, fontRec.fStyle); | 495 face = SkTypeface::CreateFromName(familyName, fontRec.fStyle); |
496 SkASSERT(face); | |
reed1
2013/09/18 19:51:37
Why are we asserting here?
djsollen
2013/09/18 19:57:30
This function takes fontRecID's which correspond t
| |
498 } | 497 } |
499 | 498 |
500 // store the result for subsequent lookups | 499 // store the result for subsequent lookups |
501 fontRec.fTypeface = face; | 500 fontRec.fTypeface = face; |
502 } | 501 } |
503 SkASSERT(face); | 502 SkASSERT(face); |
504 return face; | 503 return face; |
505 } | 504 } |
506 | 505 |
507 bool SkFontConfigInterfaceAndroid::getFallbackFamilyNameForChar(SkUnichar uni, S kString* name) { | 506 bool SkFontConfigInterfaceAndroid::getFallbackFamilyNameForChar(SkUnichar uni, S kString* name) { |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
834 return SkCreateTypefaceForScriptNG(getHBScriptFromHBScriptOld(script), style , fontVariant); | 833 return SkCreateTypefaceForScriptNG(getHBScriptFromHBScriptOld(script), style , fontVariant); |
835 } | 834 } |
836 | 835 |
837 #endif | 836 #endif |
838 | 837 |
839 /////////////////////////////////////////////////////////////////////////////// | 838 /////////////////////////////////////////////////////////////////////////////// |
840 | 839 |
841 SkFontMgr* SkFontMgr::Factory() { | 840 SkFontMgr* SkFontMgr::Factory() { |
842 return NULL; | 841 return NULL; |
843 } | 842 } |
OLD | NEW |