diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2021-11-18 23:23:58 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-20 00:31:55 +0100 |
commit | b06b54772e0cfc3009c5f1b1c86eec7bef066fa1 (patch) | |
tree | b92f85c9f7cf431dbe4a646a56ad84365a57b1f2 /Userland | |
parent | 4bd4ce439a30e5274c8e6005ffe41f4211a8d4a3 (diff) | |
download | serenity-b06b54772e0cfc3009c5f1b1c86eec7bef066fa1.zip |
Meta+LibUnicode: Provide code point names through library
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibUnicode/CharacterTypes.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibUnicode/CharacterTypes.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/Userland/Libraries/LibUnicode/CharacterTypes.cpp b/Userland/Libraries/LibUnicode/CharacterTypes.cpp index a48409e61f..d74bc5892a 100644 --- a/Userland/Libraries/LibUnicode/CharacterTypes.cpp +++ b/Userland/Libraries/LibUnicode/CharacterTypes.cpp @@ -222,6 +222,18 @@ u32 to_unicode_uppercase(u32 code_point) #endif } +Optional<StringView> code_point_display_name([[maybe_unused]] u32 code_point) +{ +#if ENABLE_UNICODE_DATA + auto name = Detail::code_point_display_name(code_point); + if (name.is_null()) + return {}; + return name; +#else + return {}; +#endif +} + String to_unicode_lowercase_full(StringView string, [[maybe_unused]] Optional<StringView> locale) { #if ENABLE_UNICODE_DATA diff --git a/Userland/Libraries/LibUnicode/CharacterTypes.h b/Userland/Libraries/LibUnicode/CharacterTypes.h index 2193eb3826..20b6601c5a 100644 --- a/Userland/Libraries/LibUnicode/CharacterTypes.h +++ b/Userland/Libraries/LibUnicode/CharacterTypes.h @@ -19,6 +19,8 @@ namespace Unicode { u32 to_unicode_lowercase(u32 code_point); u32 to_unicode_uppercase(u32 code_point); +Optional<StringView> code_point_display_name(u32 code_point); + String to_unicode_lowercase_full(StringView, Optional<StringView> locale = {}); String to_unicode_uppercase_full(StringView, Optional<StringView> locale = {}); |