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.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/timer/elapsed_timer.h" | 10 #include "base/timer/elapsed_timer.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // https://android.googlesource.com/platform/frameworks/base/+/master/core/jav
a/android/text/Hyphenator.java | 136 // https://android.googlesource.com/platform/frameworks/base/+/master/core/jav
a/android/text/Hyphenator.java |
137 using LocaleFallback = const char * [2]; | 137 using LocaleFallback = const char * [2]; |
138 static LocaleFallback localeFallbackData[] = { | 138 static LocaleFallback localeFallbackData[] = { |
139 {"en-AS", "en-us"}, // English (American Samoa) | 139 {"en-AS", "en-us"}, // English (American Samoa) |
140 {"en-GU", "en-us"}, // English (Guam) | 140 {"en-GU", "en-us"}, // English (Guam) |
141 {"en-MH", "en-us"}, // English (Marshall Islands) | 141 {"en-MH", "en-us"}, // English (Marshall Islands) |
142 {"en-MP", "en-us"}, // English (Northern Mariana Islands) | 142 {"en-MP", "en-us"}, // English (Northern Mariana Islands) |
143 {"en-PR", "en-us"}, // English (Puerto Rico) | 143 {"en-PR", "en-us"}, // English (Puerto Rico) |
144 {"en-UM", "en-us"}, // English (United States Minor Outlying Islands) | 144 {"en-UM", "en-us"}, // English (United States Minor Outlying Islands) |
145 {"en-VI", "en-us"}, // English (Virgin Islands) | 145 {"en-VI", "en-us"}, // English (Virgin Islands) |
146 // All English locales other than those falling back to en-US are mapped t
o en-GB. | 146 // All English locales other than those falling back to en-US are mapped |
| 147 // to en-GB. |
147 {"en", "en-gb"}, | 148 {"en", "en-gb"}, |
148 // For German, we're assuming the 1996 (and later) orthography by default. | 149 // For German, we're assuming the 1996 (and later) orthography by default. |
149 {"de", "de-1996"}, | 150 {"de", "de-1996"}, |
150 // Liechtenstein uses the Swiss hyphenation rules for the 1901 orthography
. | 151 // Liechtenstein uses the Swiss hyphenation rules for the 1901 |
| 152 // orthography. |
151 {"de-LI-1901", "de-ch-1901"}, | 153 {"de-LI-1901", "de-ch-1901"}, |
152 // Norwegian is very probably Norwegian Bokmål. | 154 // Norwegian is very probably Norwegian Bokmål. |
153 {"no", "nb"}, | 155 {"no", "nb"}, |
154 {"mn", "mn-cyrl"}, // Mongolian | 156 {"mn", "mn-cyrl"}, // Mongolian |
155 {"am", "und-ethi"}, // Amharic | 157 {"am", "und-ethi"}, // Amharic |
156 {"byn", "und-ethi"}, // Blin | 158 {"byn", "und-ethi"}, // Blin |
157 {"gez", "und-ethi"}, // Geʻez | 159 {"gez", "und-ethi"}, // Geʻez |
158 {"ti", "und-ethi"}, // Tigrinya | 160 {"ti", "und-ethi"}, // Tigrinya |
159 {"wal", "und-ethi"}, // Wolaytta | 161 {"wal", "und-ethi"}, // Wolaytta |
160 }; | 162 }; |
(...skipping 12 matching lines...) Expand all Loading... |
173 | 175 |
174 DEFINE_STATIC_LOCAL(LocaleMap, localeFallback, (createLocaleFallbackMap())); | 176 DEFINE_STATIC_LOCAL(LocaleMap, localeFallback, (createLocaleFallbackMap())); |
175 const auto& it = localeFallback.find(locale); | 177 const auto& it = localeFallback.find(locale); |
176 if (it != localeFallback.end()) | 178 if (it != localeFallback.end()) |
177 return LayoutLocale::get(it->value)->getHyphenation(); | 179 return LayoutLocale::get(it->value)->getHyphenation(); |
178 | 180 |
179 return nullptr; | 181 return nullptr; |
180 } | 182 } |
181 | 183 |
182 } // namespace blink | 184 } // namespace blink |
OLD | NEW |