| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 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 | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 forString:(NSString*)string | 52 forString:(NSString*)string |
| 53 withRange:(NSRange)range | 53 withRange:(NSRange)range |
| 54 inLanguage:(id)useNil; | 54 inLanguage:(id)useNil; |
| 55 + (NSFont*)findFontLike:(NSFont*)font | 55 + (NSFont*)findFontLike:(NSFont*)font |
| 56 forCharacter:(UniChar)uc | 56 forCharacter:(UniChar)uc |
| 57 inLanguage:(id)useNil; | 57 inLanguage:(id)useNil; |
| 58 @end | 58 @end |
| 59 | 59 |
| 60 namespace blink { | 60 namespace blink { |
| 61 | 61 |
| 62 const char* g_k_color_emoji_font_mac = "Apple Color Emoji"; | 62 const char kColorEmojiFontMac[] = "Apple Color Emoji"; |
| 63 | 63 |
| 64 // static | 64 // static |
| 65 const AtomicString& FontCache::LegacySystemFontFamily() { | 65 const AtomicString& FontCache::LegacySystemFontFamily() { |
| 66 DEFINE_STATIC_LOCAL(AtomicString, legacy_system_font_family, | 66 DEFINE_STATIC_LOCAL(AtomicString, legacy_system_font_family, |
| 67 ("BlinkMacSystemFont")); | 67 ("BlinkMacSystemFont")); |
| 68 return legacy_system_font_family; | 68 return legacy_system_font_family; |
| 69 } | 69 } |
| 70 | 70 |
| 71 static void InvalidateFontCache() { | 71 static void InvalidateFontCache() { |
| 72 if (!IsMainThread()) { | 72 if (!IsMainThread()) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 return app_kit_font_weight >= 7; | 108 return app_kit_font_weight >= 7; |
| 109 } | 109 } |
| 110 | 110 |
| 111 PassRefPtr<SimpleFontData> FontCache::FallbackFontForCharacter( | 111 PassRefPtr<SimpleFontData> FontCache::FallbackFontForCharacter( |
| 112 const FontDescription& font_description, | 112 const FontDescription& font_description, |
| 113 UChar32 character, | 113 UChar32 character, |
| 114 const SimpleFontData* font_data_to_substitute, | 114 const SimpleFontData* font_data_to_substitute, |
| 115 FontFallbackPriority fallback_priority) { | 115 FontFallbackPriority fallback_priority) { |
| 116 if (fallback_priority == FontFallbackPriority::kEmojiEmoji) { | 116 if (fallback_priority == FontFallbackPriority::kEmojiEmoji) { |
| 117 RefPtr<SimpleFontData> emoji_font = | 117 RefPtr<SimpleFontData> emoji_font = |
| 118 GetFontData(font_description, AtomicString(g_k_color_emoji_font_mac)); | 118 GetFontData(font_description, AtomicString(kColorEmojiFontMac)); |
| 119 if (emoji_font) | 119 if (emoji_font) |
| 120 return emoji_font; | 120 return emoji_font; |
| 121 } | 121 } |
| 122 | 122 |
| 123 // FIXME: We should fix getFallbackFamily to take a UChar32 | 123 // FIXME: We should fix getFallbackFamily to take a UChar32 |
| 124 // and remove this split-to-UChar16 code. | 124 // and remove this split-to-UChar16 code. |
| 125 UChar code_units[2]; | 125 UChar code_units[2]; |
| 126 int code_units_length; | 126 int code_units_length; |
| 127 if (character <= 0xFFFF) { | 127 if (character <= 0xFFFF) { |
| 128 code_units[0] = character; | 128 code_units[0] = character; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 WTF::MakeUnique<FontPlatformData>( | 296 WTF::MakeUnique<FontPlatformData>( |
| 297 platform_font, size, synthetic_bold, synthetic_italic, | 297 platform_font, size, synthetic_bold, synthetic_italic, |
| 298 font_description.Orientation(), font_description.VariationSettings()); | 298 font_description.Orientation(), font_description.VariationSettings()); |
| 299 if (!platform_data->Typeface()) { | 299 if (!platform_data->Typeface()) { |
| 300 return nullptr; | 300 return nullptr; |
| 301 } | 301 } |
| 302 return platform_data; | 302 return platform_data; |
| 303 } | 303 } |
| 304 | 304 |
| 305 } // namespace blink | 305 } // namespace blink |
| OLD | NEW |