| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007 Apple Computer, Inc. | 2 * Copyright (C) 2006, 2007 Apple Computer, Inc. |
| 3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved. | 3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // Subpixel text positioning is only supported by the DirectWrite backend (n
ot GDI). | 108 // Subpixel text positioning is only supported by the DirectWrite backend (n
ot GDI). |
| 109 s_useSubpixelPositioning = s_useDirectWrite; | 109 s_useSubpixelPositioning = s_useDirectWrite; |
| 110 | 110 |
| 111 ASSERT(m_fontManager.get()); | 111 ASSERT(m_fontManager.get()); |
| 112 } | 112 } |
| 113 | 113 |
| 114 // Given the desired base font, this will create a SimpleFontData for a specific | 114 // Given the desired base font, this will create a SimpleFontData for a specific |
| 115 // font that can be used to render the given range of characters. | 115 // font that can be used to render the given range of characters. |
| 116 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter( | 116 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter( |
| 117 const FontDescription& fontDescription, UChar32 character, | 117 const FontDescription& fontDescription, UChar32 character, |
| 118 const SimpleFontData* originalFontData) | 118 const SimpleFontData* originalFontData, |
| 119 FontFallbackPriority fallbackPriority) |
| 119 { | 120 { |
| 120 // First try the specified font with standard style & weight. | 121 // First try the specified font with standard style & weight. |
| 121 if (fontDescription.style() == FontStyleItalic | 122 if (fallbackPriority != FontFallbackPriority::EmojiEmoji |
| 122 || fontDescription.weight() >= FontWeightBold) { | 123 && (fontDescription.style() == FontStyleItalic |
| 124 || fontDescription.weight() >= FontWeightBold)) { |
| 123 RefPtr<SimpleFontData> fontData = fallbackOnStandardFontStyle( | 125 RefPtr<SimpleFontData> fontData = fallbackOnStandardFontStyle( |
| 124 fontDescription, character); | 126 fontDescription, character); |
| 125 if (fontData) | 127 if (fontData) |
| 126 return fontData; | 128 return fontData; |
| 127 } | 129 } |
| 128 | 130 |
| 129 UScriptCode script; | 131 UScriptCode script; |
| 130 const wchar_t* family = getFallbackFamily(character, | 132 const wchar_t* family = getFallbackFamily(character, |
| 131 fontDescription.genericFamily(), | 133 fontDescription.genericFamily(), |
| 132 fontDescription.script(), | 134 fontDescription.script(), |
| 133 fontDescription.locale(), | 135 fontDescription.locale(), |
| 134 &script, | 136 &script, |
| 137 fallbackPriority, |
| 135 m_fontManager.get()); | 138 m_fontManager.get()); |
| 136 FontPlatformData* data = 0; | 139 FontPlatformData* data = 0; |
| 137 if (family) { | 140 if (family) { |
| 138 FontFaceCreationParams createByFamily(AtomicString(family, wcslen(family
))); | 141 FontFaceCreationParams createByFamily(AtomicString(family, wcslen(family
))); |
| 139 data = getFontPlatformData(fontDescription, createByFamily); | 142 data = getFontPlatformData(fontDescription, createByFamily); |
| 140 } | 143 } |
| 141 | 144 |
| 142 // Last resort font list : PanUnicode. CJK fonts have a pretty | 145 // Last resort font list : PanUnicode. CJK fonts have a pretty |
| 143 // large repertoire. Eventually, we need to scan all the fonts | 146 // large repertoire. Eventually, we need to scan all the fonts |
| 144 // on the system to have a Firefox-like coverage. | 147 // on the system to have a Firefox-like coverage. |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 if (typefacesMatchesFamily(tf.get(), family)) { | 422 if (typefacesMatchesFamily(tf.get(), family)) { |
| 420 result->setMinSizeForSubpixel(minSizeForSubpixelForFont); | 423 result->setMinSizeForSubpixel(minSizeForSubpixelForFont); |
| 421 break; | 424 break; |
| 422 } | 425 } |
| 423 } | 426 } |
| 424 | 427 |
| 425 return result.release(); | 428 return result.release(); |
| 426 } | 429 } |
| 427 | 430 |
| 428 } // namespace blink | 431 } // namespace blink |
| OLD | NEW |