OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/text/Hyphenation.h" | 5 #include "platform/text/Hyphenation.h" |
6 | 6 |
7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
8 #include "base/files/memory_mapped_file.h" | 8 #include "base/files/memory_mapped_file.h" |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/timer/elapsed_timer.h" | 10 #include "base/timer/elapsed_timer.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // https://android.googlesource.com/platform/frameworks/base/+/master/core/jav
a/android/text/Hyphenator.java | 125 // https://android.googlesource.com/platform/frameworks/base/+/master/core/jav
a/android/text/Hyphenator.java |
126 using LocaleFallback = const char * [2]; | 126 using LocaleFallback = const char * [2]; |
127 static LocaleFallback localeFallbackData[] = { | 127 static LocaleFallback localeFallbackData[] = { |
128 {"en-AS", "en-us"}, // English (American Samoa) | 128 {"en-AS", "en-us"}, // English (American Samoa) |
129 {"en-GU", "en-us"}, // English (Guam) | 129 {"en-GU", "en-us"}, // English (Guam) |
130 {"en-MH", "en-us"}, // English (Marshall Islands) | 130 {"en-MH", "en-us"}, // English (Marshall Islands) |
131 {"en-MP", "en-us"}, // English (Northern Mariana Islands) | 131 {"en-MP", "en-us"}, // English (Northern Mariana Islands) |
132 {"en-PR", "en-us"}, // English (Puerto Rico) | 132 {"en-PR", "en-us"}, // English (Puerto Rico) |
133 {"en-UM", "en-us"}, // English (United States Minor Outlying Islands) | 133 {"en-UM", "en-us"}, // English (United States Minor Outlying Islands) |
134 {"en-VI", "en-us"}, // English (Virgin Islands) | 134 {"en-VI", "en-us"}, // English (Virgin Islands) |
135 // All English locales other than those falling back to en-US are mapped | 135 // All English locales other than those falling back |
136 // to en-GB. | 136 // to en-US are mapped to en-GB. |
137 {"en", "en-gb"}, | 137 {"en", "en-gb"}, |
138 // For German, we're assuming the 1996 (and later) orthography by default. | 138 // For German, we're assuming the 1996 (and later) orthography by default. |
139 {"de", "de-1996"}, | 139 {"de", "de-1996"}, |
140 // Liechtenstein uses the Swiss hyphenation rules for the 1901 | 140 // Liechtenstein uses the Swiss hyphenation rules for the 1901 |
141 // orthography. | 141 // orthography. |
142 {"de-LI-1901", "de-ch-1901"}, | 142 {"de-LI-1901", "de-ch-1901"}, |
143 // Norwegian is very probably Norwegian Bokmål. | 143 // Norwegian is very probably Norwegian Bokmål. |
144 {"no", "nb"}, | 144 {"no", "nb"}, |
145 {"mn", "mn-cyrl"}, // Mongolian | 145 {"mn", "mn-cyrl"}, // Mongolian |
146 {"am", "und-ethi"}, // Amharic | 146 {"am", "und-ethi"}, // Amharic |
(...skipping 17 matching lines...) Expand all Loading... |
164 | 164 |
165 DEFINE_STATIC_LOCAL(LocaleMap, localeFallback, (createLocaleFallbackMap())); | 165 DEFINE_STATIC_LOCAL(LocaleMap, localeFallback, (createLocaleFallbackMap())); |
166 const auto& it = localeFallback.find(locale); | 166 const auto& it = localeFallback.find(locale); |
167 if (it != localeFallback.end()) | 167 if (it != localeFallback.end()) |
168 return LayoutLocale::get(it->value)->getHyphenation(); | 168 return LayoutLocale::get(it->value)->getHyphenation(); |
169 | 169 |
170 return nullptr; | 170 return nullptr; |
171 } | 171 } |
172 | 172 |
173 } // namespace blink | 173 } // namespace blink |
OLD | NEW |