| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 WebFontInfo::fallbackFontForChar(c, preferredLocale, &webFallbackFont); | 43 WebFontInfo::fallbackFontForChar(c, preferredLocale, &webFallbackFont); |
| 44 fallbackFont->name = String::fromUTF8(CString(webFallbackFont.name)); | 44 fallbackFont->name = String::fromUTF8(CString(webFallbackFont.name)); |
| 45 fallbackFont->filename = webFallbackFont.filename; | 45 fallbackFont->filename = webFallbackFont.filename; |
| 46 fallbackFont->fontconfigInterfaceId = webFallbackFont.fontconfigInterfaceId; | 46 fallbackFont->fontconfigInterfaceId = webFallbackFont.fontconfigInterfaceId; |
| 47 fallbackFont->ttcIndex = webFallbackFont.ttcIndex; | 47 fallbackFont->ttcIndex = webFallbackFont.ttcIndex; |
| 48 fallbackFont->isBold = webFallbackFont.isBold; | 48 fallbackFont->isBold = webFallbackFont.isBold; |
| 49 fallbackFont->isItalic = webFallbackFont.isItalic; | 49 fallbackFont->isItalic = webFallbackFont.isItalic; |
| 50 } | 50 } |
| 51 | 51 |
| 52 #if !OS(ANDROID) | 52 #if !OS(ANDROID) |
| 53 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter(const FontDescrip
tion& fontDescription, UChar32 c, const SimpleFontData*) | 53 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter( |
| 54 const FontDescription& fontDescription, |
| 55 UChar32 c, |
| 56 const SimpleFontData*, |
| 57 FontFallbackPriority fallbackPriority) |
| 54 { | 58 { |
| 59 if (fallbackPriority == FontFallbackPriority::EmojiEmoji) { |
| 60 // FIXME crbug.com/591346: We're overriding the fallback character here |
| 61 // with the FAMILY emoji in the hope to find a suitable emoji font. |
| 62 // This should be improved by supporting fallback for character |
| 63 // sequences like DIGIT ONE + COMBINING keycap etc. |
| 64 c = familyCharacter; |
| 65 } |
| 66 |
| 55 // First try the specified font with standard style & weight. | 67 // First try the specified font with standard style & weight. |
| 56 if (fontDescription.style() == FontStyleItalic | 68 if (fallbackPriority != FontFallbackPriority::EmojiEmoji |
| 57 || fontDescription.weight() >= FontWeight600) { | 69 && (fontDescription.style() == FontStyleItalic |
| 70 || fontDescription.weight() >= FontWeight600)) { |
| 58 RefPtr<SimpleFontData> fontData = fallbackOnStandardFontStyle( | 71 RefPtr<SimpleFontData> fontData = fallbackOnStandardFontStyle( |
| 59 fontDescription, c); | 72 fontDescription, c); |
| 60 if (fontData) | 73 if (fontData) |
| 61 return fontData; | 74 return fontData; |
| 62 } | 75 } |
| 63 | 76 |
| 64 FontCache::PlatformFallbackFont fallbackFont; | 77 FontCache::PlatformFallbackFont fallbackFont; |
| 65 FontCache::getFontForCharacter(c, fontDescription.locale().ascii().data(), &
fallbackFont); | 78 FontCache::getFontForCharacter(c, fontDescription.locale().ascii().data(), &
fallbackFont); |
| 66 if (fallbackFont.name.isEmpty()) | 79 if (fallbackFont.name.isEmpty()) |
| 67 return nullptr; | 80 return nullptr; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 93 return nullptr; | 106 return nullptr; |
| 94 FontPlatformData platformData = FontPlatformData(*substitutePlatformData); | 107 FontPlatformData platformData = FontPlatformData(*substitutePlatformData); |
| 95 platformData.setSyntheticBold(shouldSetSyntheticBold); | 108 platformData.setSyntheticBold(shouldSetSyntheticBold); |
| 96 platformData.setSyntheticItalic(shouldSetSyntheticItalic); | 109 platformData.setSyntheticItalic(shouldSetSyntheticItalic); |
| 97 return fontDataFromFontPlatformData(&platformData, DoNotRetain); | 110 return fontDataFromFontPlatformData(&platformData, DoNotRetain); |
| 98 } | 111 } |
| 99 | 112 |
| 100 #endif // !OS(ANDROID) | 113 #endif // !OS(ANDROID) |
| 101 | 114 |
| 102 } // namespace blink | 115 } // namespace blink |
| OLD | NEW |