1 /* 2 * Copyright 2021 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 #ifndef SkUnicode_icu_DEFINED 8 #define SkUnicode_icu_DEFINED 9 10 #include <unicode/ubidi.h> 11 #include <unicode/ubrk.h> 12 #include <unicode/uscript.h> 13 #include <unicode/ustring.h> 14 #include <unicode/utext.h> 15 #include <unicode/utypes.h> 16 17 #include "include/private/SkTemplates.h" 18 19 #define SKICU_EMIT_FUNCS \ 20 SKICU_FUNC(u_errorName) \ 21 SKICU_FUNC(u_getIntPropertyValue) \ 22 SKICU_FUNC(u_iscntrl) \ 23 SKICU_FUNC(u_isspace) \ 24 SKICU_FUNC(u_isWhitespace) \ 25 SKICU_FUNC(u_strToUpper) \ 26 SKICU_FUNC(ubidi_close) \ 27 SKICU_FUNC(ubidi_getLength) \ 28 SKICU_FUNC(ubidi_getLevelAt) \ 29 SKICU_FUNC(ubidi_openSized) \ 30 SKICU_FUNC(ubidi_reorderVisual) \ 31 SKICU_FUNC(ubidi_setPara) \ 32 SKICU_FUNC(ubrk_close) \ 33 SKICU_FUNC(ubrk_current) \ 34 SKICU_FUNC(ubrk_first) \ 35 SKICU_FUNC(ubrk_following) \ 36 SKICU_FUNC(ubrk_getRuleStatus) \ 37 SKICU_FUNC(ubrk_next) \ 38 SKICU_FUNC(ubrk_open) \ 39 SKICU_FUNC(ubrk_preceding) \ 40 SKICU_FUNC(ubrk_setText) \ 41 SKICU_FUNC(ubrk_setUText) \ 42 SKICU_FUNC(uloc_getDefault) \ 43 SKICU_FUNC(uscript_getScript) \ 44 SKICU_FUNC(utext_close) \ 45 SKICU_FUNC(utext_openUChars) \ 46 SKICU_FUNC(utext_openUTF8) \ 47 48 #define SKICU_FUNC(funcname) decltype(funcname)* f_##funcname; 49 struct SkICULib { 50 SKICU_EMIT_FUNCS 51 52 // ubrk_clone added as draft in ICU69 and Android API 31 (first ICU NDK). 53 // ubrk_safeClone deprecated in ICU69 and not exposed by Android. 54 UBreakIterator* (*f_ubrk_clone_)(const UBreakIterator*, UErrorCode*); 55 UBreakIterator* (*f_ubrk_safeClone_)(const UBreakIterator*, void*, int32_t*, UErrorCode*); 56 }; 57 #undef SKICU_FUNC 58 59 // Platform/config specific ICU factory. 60 std::unique_ptr<SkICULib> SkLoadICULib(); 61 62 #endif // SkUnicode_icu_DEFINED 63