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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 outFontIdentifier->fString.set(fontRec.fFileName); | 405 outFontIdentifier->fString.set(fontRec.fFileName); |
406 // outFontIdentifier->fStyle = fontRec.fStyle; | 406 // outFontIdentifier->fStyle = fontRec.fStyle; |
407 } | 407 } |
408 | 408 |
409 if (NULL != outFamilyName) { | 409 if (NULL != outFamilyName) { |
410 if (exactNameMatch) { | 410 if (exactNameMatch) { |
411 outFamilyName->set(familyName); | 411 outFamilyName->set(familyName); |
412 } else { | 412 } else { |
413 // find familyName from list of names | 413 // find familyName from list of names |
414 const char* familyName = NULL; | 414 const char* familyName = NULL; |
415 bool found = fFamilyNameDict.findKey(familyRecID, &familyName); | 415 SkAssertResult(fFamilyNameDict.findKey(familyRecID, &familyName)); |
416 SkASSERT(found && familyName); | 416 SkASSERT(familyName); |
417 outFamilyName->set(familyName); | 417 outFamilyName->set(familyName); |
418 } | 418 } |
419 } | 419 } |
420 | 420 |
421 if (NULL != outStyle) { | 421 if (NULL != outStyle) { |
422 *outStyle = fontRec.fStyle; | 422 *outStyle = fontRec.fStyle; |
423 } | 423 } |
424 | 424 |
425 return true; | 425 return true; |
426 } | 426 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 SkFontID origFontI
D, | 535 SkFontID origFontI
D, |
536 const SkPaintOptio
nsAndroid& opts) { | 536 const SkPaintOptio
nsAndroid& opts) { |
537 // Skia does not support font fallback by default. This enables clients such | 537 // Skia does not support font fallback by default. This enables clients such |
538 // as WebKit to customize their font selection. In any case, clients can use | 538 // as WebKit to customize their font selection. In any case, clients can use |
539 // GetFallbackFamilyNameForChar() to get the fallback font for individual | 539 // GetFallbackFamilyNameForChar() to get the fallback font for individual |
540 // characters. | 540 // characters. |
541 if (!opts.isUsingFontFallbacks()) { | 541 if (!opts.isUsingFontFallbacks()) { |
542 return NULL; | 542 return NULL; |
543 } | 543 } |
544 | 544 |
545 const SkTypeface* origTypeface = SkTypefaceCache::FindByID(origFontID); | |
546 const SkTypeface* currTypeface = SkTypefaceCache::FindByID(currFontID); | 545 const SkTypeface* currTypeface = SkTypefaceCache::FindByID(currFontID); |
547 | 546 |
548 FallbackFontList* currentFallbackList = findFallbackFontList(opts.getLanguag
e()); | 547 FallbackFontList* currentFallbackList = findFallbackFontList(opts.getLanguag
e()); |
549 SkASSERT(currentFallbackList); | 548 SkASSERT(currentFallbackList); |
550 | 549 |
551 SkASSERT(origTypeface != 0); | |
552 SkASSERT(currTypeface != 0); | 550 SkASSERT(currTypeface != 0); |
553 | 551 |
554 // we must convert currTypeface into a FontRecID | 552 // we must convert currTypeface into a FontRecID |
555 FontRecID currFontRecID = ((FontConfigTypeface*)currTypeface)->getIdentity()
.fID; | 553 FontRecID currFontRecID = ((FontConfigTypeface*)currTypeface)->getIdentity()
.fID; |
556 | 554 |
557 // TODO lookup the index next font in the chain | 555 // TODO lookup the index next font in the chain |
558 int currFallbackFontIndex = currentFallbackList->find(currFontRecID); | 556 int currFallbackFontIndex = currentFallbackList->find(currFontRecID); |
559 int nextFallbackFontIndex = currFallbackFontIndex + 1; | 557 int nextFallbackFontIndex = currFallbackFontIndex + 1; |
560 SkASSERT(-1 == nextFallbackFontIndex); | 558 SkASSERT(-1 == nextFallbackFontIndex); |
561 | 559 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 SkFontConfigInterfaceAndroid* fontConfig = getSingletonInterface(); | 612 SkFontConfigInterfaceAndroid* fontConfig = getSingletonInterface(); |
615 return fontConfig->nextLogicalTypeface(currFontID, origFontID, options); | 613 return fontConfig->nextLogicalTypeface(currFontID, origFontID, options); |
616 | 614 |
617 } | 615 } |
618 | 616 |
619 /////////////////////////////////////////////////////////////////////////////// | 617 /////////////////////////////////////////////////////////////////////////////// |
620 | 618 |
621 SkFontMgr* SkFontMgr::Factory() { | 619 SkFontMgr* SkFontMgr::Factory() { |
622 return NULL; | 620 return NULL; |
623 } | 621 } |
OLD | NEW |