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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 } | 586 } |
587 | 587 |
588 FallbackFontList* currentFallbackList = findFallbackFontList(opts.getLanguag
e()); | 588 FallbackFontList* currentFallbackList = findFallbackFontList(opts.getLanguag
e()); |
589 SkASSERT(currentFallbackList); | 589 SkASSERT(currentFallbackList); |
590 | 590 |
591 // we must convert currTypeface into a FontRecID | 591 // we must convert currTypeface into a FontRecID |
592 FontRecID currFontRecID = INVALID_FONT_REC_ID; | 592 FontRecID currFontRecID = INVALID_FONT_REC_ID; |
593 const SkTypeface* currTypeface = SkTypefaceCache::FindByID(currFontID); | 593 const SkTypeface* currTypeface = SkTypefaceCache::FindByID(currFontID); |
594 // non-system fonts are not in the font cache so if we are asked to fallback | 594 // non-system fonts are not in the font cache so if we are asked to fallback |
595 // for a non-system font we will start at the front of the chain. | 595 // for a non-system font we will start at the front of the chain. |
596 if (NULL != currTypeface && currFontID == origFontID) { | 596 if (NULL != currTypeface && currFontID != origFontID) { |
597 currFontRecID = ((FontConfigTypeface*)currTypeface)->getIdentity().fID; | 597 currFontRecID = ((FontConfigTypeface*)currTypeface)->getIdentity().fID; |
598 SkASSERT(INVALID_FONT_REC_ID != currFontRecID); | 598 SkASSERT(INVALID_FONT_REC_ID != currFontRecID); |
599 } | 599 } |
600 | 600 |
601 // lookup the index next font in the chain | 601 // lookup the index next font in the chain |
602 int currFallbackFontIndex = currentFallbackList->find(currFontRecID); | 602 int currFallbackFontIndex = currentFallbackList->find(currFontRecID); |
603 // We add 1 to the returned index for 2 reasons: (1) if find succeeds it mov
es | 603 // We add 1 to the returned index for 2 reasons: (1) if find succeeds it mov
es |
604 // our index to the next entry in the list; (2) if find() fails it returns | 604 // our index to the next entry in the list; (2) if find() fails it returns |
605 // -1 and incrementing it will set our starting index to 0 (the head of the
list) | 605 // -1 and incrementing it will set our starting index to 0 (the head of the
list) |
606 int nextFallbackFontIndex = currFallbackFontIndex + 1; | 606 int nextFallbackFontIndex = currFallbackFontIndex + 1; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 return SkCreateTypefaceForScriptNG(getHBScriptFromHBScriptOld(script), style
, fontVariant); | 811 return SkCreateTypefaceForScriptNG(getHBScriptFromHBScriptOld(script), style
, fontVariant); |
812 } | 812 } |
813 | 813 |
814 #endif | 814 #endif |
815 | 815 |
816 /////////////////////////////////////////////////////////////////////////////// | 816 /////////////////////////////////////////////////////////////////////////////// |
817 | 817 |
818 SkFontMgr* SkFontMgr::Factory() { | 818 SkFontMgr* SkFontMgr::Factory() { |
819 return NULL; | 819 return NULL; |
820 } | 820 } |
OLD | NEW |