Writes the script and the script extensions of the Unicode codepoint. Returns the number of written scripts.
| 23 | // Writes the script and the script extensions of the Unicode codepoint. |
| 24 | // Returns the number of written scripts. |
| 25 | size_t GetScriptExtensions(char32_t codepoint, TScriptsArray & scripts) |
| 26 | { |
| 27 | // Fill scripts with the script extensions. |
| 28 | UErrorCode icu_error = U_ZERO_ERROR; |
| 29 | size_t const count = uscript_getScriptExtensions(static_cast<UChar32>(codepoint), scripts.data(), |
| 30 | static_cast<int32_t>(scripts.max_size()), &icu_error); |
| 31 | if (U_FAILURE(icu_error)) |
| 32 | { |
| 33 | LOG(LWARNING, ("uscript_getScriptExtensions failed with error", icu_error)); |
| 34 | return 0; |
| 35 | } |
| 36 | |
| 37 | return count; |
| 38 | } |
| 39 | |
| 40 | // Intersects the script extensions set of codepoint with scripts and returns the updated size of the scripts. |
| 41 | // The output result will be a subset of the input result (thus resultSize can only be smaller). |
no test coverage detected