| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 Google Inc. All rights reserved. | 2 * Copyright (c) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "platform/fonts/SimpleFontData.h" | 34 #include "platform/fonts/SimpleFontData.h" |
| 35 #include "platform/fonts/FontDescription.h" | 35 #include "platform/fonts/FontDescription.h" |
| 36 #include "platform/fonts/FontFaceCreationParams.h" | 36 #include "platform/fonts/FontFaceCreationParams.h" |
| 37 #include "third_party/skia/include/core/SkTypeface.h" | 37 #include "third_party/skia/include/core/SkTypeface.h" |
| 38 #include "third_party/skia/include/ports/SkFontMgr.h" | 38 #include "third_party/skia/include/ports/SkFontMgr.h" |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter(const FontDescrip
tion& fontDescription, UChar32 c, const SimpleFontData*, FontFallbackPriority fa
llbackPriority) | 42 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter(const FontDescrip
tion& fontDescription, UChar32 c, const SimpleFontData*, FontFallbackPriority fa
llbackPriority) |
| 43 { | 43 { |
| 44 RefPtr<SkFontMgr> fm = adoptRef(SkFontMgr::RefDefault()); | 44 sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); |
| 45 AtomicString familyName = getFamilyNameForCharacter(fm.get(), c, fontDescrip
tion, fallbackPriority); | 45 AtomicString familyName = getFamilyNameForCharacter(fm.get(), c, fontDescrip
tion, fallbackPriority); |
| 46 if (familyName.isEmpty()) | 46 if (familyName.isEmpty()) |
| 47 return getLastResortFallbackFont(fontDescription, DoNotRetain); | 47 return getLastResortFallbackFont(fontDescription, DoNotRetain); |
| 48 return fontDataFromFontPlatformData(getFontPlatformData(fontDescription, Fon
tFaceCreationParams(familyName)), DoNotRetain); | 48 return fontDataFromFontPlatformData(getFontPlatformData(fontDescription, Fon
tFaceCreationParams(familyName)), DoNotRetain); |
| 49 } | 49 } |
| 50 | 50 |
| 51 // static | 51 // static |
| 52 AtomicString FontCache::getGenericFamilyNameForScript(const AtomicString& family
Name, const FontDescription& fontDescription) | 52 AtomicString FontCache::getGenericFamilyNameForScript(const AtomicString& family
Name, const FontDescription& fontDescription) |
| 53 { | 53 { |
| 54 // If monospace, do not apply CJK hack to find i18n fonts, because | 54 // If monospace, do not apply CJK hack to find i18n fonts, because |
| (...skipping 15 matching lines...) Expand all Loading... |
| 70 examplerChar = 0x4E00; // A common character in Japanese and Chinese. | 70 examplerChar = 0x4E00; // A common character in Japanese and Chinese. |
| 71 break; | 71 break; |
| 72 case USCRIPT_HANGUL: | 72 case USCRIPT_HANGUL: |
| 73 examplerChar = 0xAC00; | 73 examplerChar = 0xAC00; |
| 74 break; | 74 break; |
| 75 default: | 75 default: |
| 76 // For other scripts, use the default generic family mapping logic. | 76 // For other scripts, use the default generic family mapping logic. |
| 77 return familyName; | 77 return familyName; |
| 78 } | 78 } |
| 79 | 79 |
| 80 RefPtr<SkFontMgr> fm = adoptRef(SkFontMgr::RefDefault()); | 80 sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); |
| 81 return getFamilyNameForCharacter(fm.get(), examplerChar, fontDescription, Fo
ntFallbackPriority::Text); | 81 return getFamilyNameForCharacter(fm.get(), examplerChar, fontDescription, Fo
ntFallbackPriority::Text); |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace blink | 84 } // namespace blink |
| OLD | NEW |