| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 static void createSubtagScriptMap(SubtagScriptMap& map, | 46 static void createSubtagScriptMap(SubtagScriptMap& map, |
| 47 const SubtagScript list[], | 47 const SubtagScript list[], |
| 48 size_t size) { | 48 size_t size) { |
| 49 map.reserveCapacityForSize(size); | 49 map.reserveCapacityForSize(size); |
| 50 for (size_t i = 0; i < size; ++i) | 50 for (size_t i = 0; i < size; ++i) |
| 51 map.set(list[i].subtag, list[i].script); | 51 map.set(list[i].subtag, list[i].script); |
| 52 } | 52 } |
| 53 | 53 |
| 54 UScriptCode scriptNameToCode(const String& scriptName) { | 54 UScriptCode scriptNameToCode(const String& scriptName) { |
| 55 // This generally maps an ISO 15924 script code to its UScriptCode, but certai
n families of script codes are | 55 // This generally maps an ISO 15924 script code to its UScriptCode, but |
| 56 // treated as a single script for assigning a per-script font in Settings. For
example, "hira" is mapped to | 56 // certain families of script codes are treated as a single script for |
| 57 // USCRIPT_KATAKANA_OR_HIRAGANA instead of USCRIPT_HIRAGANA, since we want all
Japanese scripts to be rendered | 57 // assigning a per-script font in Settings. For example, "hira" is mapped to |
| 58 // using the same font setting. | 58 // USCRIPT_KATAKANA_OR_HIRAGANA instead of USCRIPT_HIRAGANA, since we want all |
| 59 // Japanese scripts to be rendered using the same font setting. |
| 59 static const SubtagScript scriptNameCodeList[] = { | 60 static const SubtagScript scriptNameCodeList[] = { |
| 60 {"zyyy", USCRIPT_COMMON}, | 61 {"zyyy", USCRIPT_COMMON}, |
| 61 {"qaai", USCRIPT_INHERITED}, | 62 {"qaai", USCRIPT_INHERITED}, |
| 62 {"arab", USCRIPT_ARABIC}, | 63 {"arab", USCRIPT_ARABIC}, |
| 63 {"armn", USCRIPT_ARMENIAN}, | 64 {"armn", USCRIPT_ARMENIAN}, |
| 64 {"beng", USCRIPT_BENGALI}, | 65 {"beng", USCRIPT_BENGALI}, |
| 65 {"bopo", USCRIPT_BOPOMOFO}, | 66 {"bopo", USCRIPT_BOPOMOFO}, |
| 66 {"cher", USCRIPT_CHEROKEE}, | 67 {"cher", USCRIPT_CHEROKEE}, |
| 67 {"copt", USCRIPT_COPTIC}, | 68 {"copt", USCRIPT_COPTIC}, |
| 68 {"cyrl", USCRIPT_CYRILLIC}, | 69 {"cyrl", USCRIPT_CYRILLIC}, |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 script = scriptNameToCode(locale.substring(begin, len)); | 514 script = scriptNameToCode(locale.substring(begin, len)); |
| 514 if (isUnambiguousHanScript(script)) | 515 if (isUnambiguousHanScript(script)) |
| 515 return script; | 516 return script; |
| 516 } | 517 } |
| 517 } | 518 } |
| 518 | 519 |
| 519 return USCRIPT_COMMON; | 520 return USCRIPT_COMMON; |
| 520 } | 521 } |
| 521 | 522 |
| 522 } // namespace blink | 523 } // namespace blink |
| OLD | NEW |