| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // to only when the content locale is available. crbug.com/652146 | 106 // to only when the content locale is available. crbug.com/652146 |
| 107 const LayoutLocale* content_locale = font_description.Locale(); | 107 const LayoutLocale* content_locale = font_description.Locale(); |
| 108 if (!content_locale) | 108 if (!content_locale) |
| 109 return family_name; | 109 return family_name; |
| 110 | 110 |
| 111 // This is a hack to use the preferred font for CJK scripts. | 111 // This is a hack to use the preferred font for CJK scripts. |
| 112 // TODO(kojii): This logic disregards either generic family name | 112 // TODO(kojii): This logic disregards either generic family name |
| 113 // or locale. We need an API that honors both to find appropriate | 113 // or locale. We need an API that honors both to find appropriate |
| 114 // fonts. crbug.com/642340 | 114 // fonts. crbug.com/642340 |
| 115 UChar32 exampler_char; | 115 UChar32 exampler_char; |
| 116 switch (content_locale->Script()) { | 116 switch (content_locale->GetScript()) { |
| 117 case USCRIPT_SIMPLIFIED_HAN: | 117 case USCRIPT_SIMPLIFIED_HAN: |
| 118 case USCRIPT_TRADITIONAL_HAN: | 118 case USCRIPT_TRADITIONAL_HAN: |
| 119 case USCRIPT_KATAKANA_OR_HIRAGANA: | 119 case USCRIPT_KATAKANA_OR_HIRAGANA: |
| 120 exampler_char = 0x4E00; // A common character in Japanese and Chinese. | 120 exampler_char = 0x4E00; // A common character in Japanese and Chinese. |
| 121 break; | 121 break; |
| 122 case USCRIPT_HANGUL: | 122 case USCRIPT_HANGUL: |
| 123 exampler_char = 0xAC00; | 123 exampler_char = 0xAC00; |
| 124 break; | 124 break; |
| 125 default: | 125 default: |
| 126 // For other scripts, use the default generic family mapping logic. | 126 // For other scripts, use the default generic family mapping logic. |
| 127 return family_name; | 127 return family_name; |
| 128 } | 128 } |
| 129 | 129 |
| 130 sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); | 130 sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); |
| 131 return GetFamilyNameForCharacter(fm.get(), exampler_char, font_description, | 131 return GetFamilyNameForCharacter(fm.get(), exampler_char, font_description, |
| 132 FontFallbackPriority::kText); | 132 FontFallbackPriority::kText); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace blink | 135 } // namespace blink |
| OLD | NEW |