| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 switch (localeToScriptCodeForFontSelection(locale)) { | 50 switch (localeToScriptCodeForFontSelection(locale)) { |
| 51 case USCRIPT_SIMPLIFIED_HAN: | 51 case USCRIPT_SIMPLIFIED_HAN: |
| 52 return "zh-Hans"; | 52 return "zh-Hans"; |
| 53 case USCRIPT_TRADITIONAL_HAN: | 53 case USCRIPT_TRADITIONAL_HAN: |
| 54 return "zh-Hant"; | 54 return "zh-Hant"; |
| 55 default: | 55 default: |
| 56 return locale.ascii(); | 56 return locale.ascii(); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 void FontCache::acceptLanguagesChanged(const String&) |
| 61 { |
| 62 // TODO(kojii): Take acceptLanguages into account for ambiguos scripts. |
| 63 } |
| 64 |
| 60 static AtomicString getFamilyNameForCharacter(UChar32 c, const FontDescription&
fontDescription) | 65 static AtomicString getFamilyNameForCharacter(UChar32 c, const FontDescription&
fontDescription) |
| 61 { | 66 { |
| 62 RefPtr<SkFontMgr> fm = adoptRef(SkFontMgr::RefDefault()); | 67 RefPtr<SkFontMgr> fm = adoptRef(SkFontMgr::RefDefault()); |
| 63 const char* bcp47Locales[2]; | 68 const char* bcp47Locales[2]; |
| 64 int localeCount = 0; | 69 int localeCount = 0; |
| 65 CString defaultLocale = toSkFontMgrLocale(defaultLanguage()); | 70 CString defaultLocale = toSkFontMgrLocale(defaultLanguage()); |
| 66 bcp47Locales[localeCount++] = defaultLocale.data(); | 71 bcp47Locales[localeCount++] = defaultLocale.data(); |
| 67 CString fontLocale; | 72 CString fontLocale; |
| 68 if (!fontDescription.locale().isEmpty()) { | 73 if (!fontDescription.locale().isEmpty()) { |
| 69 fontLocale = toSkFontMgrLocale(fontDescription.locale()); | 74 fontLocale = toSkFontMgrLocale(fontDescription.locale()); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 break; | 108 break; |
| 104 default: | 109 default: |
| 105 // For other scripts, use the default generic family mapping logic. | 110 // For other scripts, use the default generic family mapping logic. |
| 106 return familyName; | 111 return familyName; |
| 107 } | 112 } |
| 108 | 113 |
| 109 return getFamilyNameForCharacter(examplerChar, fontDescription); | 114 return getFamilyNameForCharacter(examplerChar, fontDescription); |
| 110 } | 115 } |
| 111 | 116 |
| 112 } // namespace blink | 117 } // namespace blink |
| OLD | NEW |