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 17 matching lines...) Expand all Loading... |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "platform/text/LocaleToScriptMapping.h" | 32 #include "platform/text/LocaleToScriptMapping.h" |
33 | 33 |
34 #include "wtf/HashMap.h" | 34 #include "wtf/HashMap.h" |
35 #include "wtf/HashSet.h" | 35 #include "wtf/HashSet.h" |
36 #include "wtf/text/StringHash.h" | 36 #include "wtf/text/StringHash.h" |
37 | 37 |
38 namespace WebCore { | 38 namespace blink { |
39 | 39 |
40 UScriptCode scriptNameToCode(const String& scriptName) | 40 UScriptCode scriptNameToCode(const String& scriptName) |
41 { | 41 { |
42 struct ScriptNameCode { | 42 struct ScriptNameCode { |
43 const char* name; | 43 const char* name; |
44 UScriptCode code; | 44 UScriptCode code; |
45 }; | 45 }; |
46 | 46 |
47 // This generally maps an ISO 15924 script code to its UScriptCode, but cert
ain families of script codes are | 47 // This generally maps an ISO 15924 script code to its UScriptCode, but cert
ain families of script codes are |
48 // treated as a single script for assigning a per-script font in Settings. F
or example, "hira" is mapped to | 48 // treated as a single script for assigning a per-script font in Settings. F
or example, "hira" is mapped to |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 if (pos == kNotFound) | 394 if (pos == kNotFound) |
395 break; | 395 break; |
396 UScriptCode code = scriptNameToCode(canonicalLocale.substring(pos + 1)); | 396 UScriptCode code = scriptNameToCode(canonicalLocale.substring(pos + 1)); |
397 if (code != USCRIPT_INVALID_CODE && code != USCRIPT_UNKNOWN) | 397 if (code != USCRIPT_INVALID_CODE && code != USCRIPT_UNKNOWN) |
398 return code; | 398 return code; |
399 canonicalLocale = canonicalLocale.substring(0, pos); | 399 canonicalLocale = canonicalLocale.substring(0, pos); |
400 } | 400 } |
401 return USCRIPT_COMMON; | 401 return USCRIPT_COMMON; |
402 } | 402 } |
403 | 403 |
404 } // namespace WebCore | 404 } // namespace blink |
OLD | NEW |