summaryrefslogtreecommitdiff
path: root/include/rtl
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2019-05-26 14:32:09 +0800
committerMark Hung <marklh9@gmail.com>2019-05-30 10:58:33 +0200
commit6a7db071c75609093fc3a9cbc297b8069726a33e (patch)
tree58a7f32e63bcfbb9c1351b1c7bfa9c400f458cde /include/rtl
parent799dac2e621bf14f613b3ee4f6a711b49c0c5e81 (diff)
tdf#125497 allow backspace to remove CJK IVS.
Japanese users prefer to remove a CJK IVS character when pressing the backspace instead of removing the selector part of IVS. Change-Id: I4313d69ed52d82c5a7e4e4823b1da06f1d90bdad Reviewed-on: https://gerrit.libreoffice.org/72971 Tested-by: Jenkins Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'include/rtl')
-rw-r--r--include/rtl/character.hxx29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/rtl/character.hxx b/include/rtl/character.hxx
index a18d05d6a5e8..2a8933668964 100644
--- a/include/rtl/character.hxx
+++ b/include/rtl/character.hxx
@@ -57,6 +57,35 @@ inline bool isAscii(sal_uInt32 code)
return code <= 0x7F;
}
+/** Check for Unicode variation sequence selectors
+
+ @param code A Unicode code point.
+
+ @return True if code is an Unicode variation sequence selector.
+
+ @since LibreOffice 6.3
+ */
+inline bool isIVSSelector(sal_uInt32 nCode)
+{
+ return (nCode >= 0xFE00 && nCode <= 0xFE0F) // Variation Selectors block
+ || (nCode >= 0xE0100 && nCode <= 0xE01EF);// Variation Selectors Supplement block
+}
+
+/** Check for base characters of a CJK ideographic variation sequence (IVS)
+
+ @param code A Unicode code point.
+
+ @return True if code is an Unicode base character part of CJK IVS
+
+ @since LibreOffice 6.3
+ */
+inline bool isCJKIVSCharacter(sal_uInt32 nCode)
+{
+ return (nCode >= 0x4E00 && nCode <= 0x9FFF) // CJK Unified Ideographs
+ || (nCode >= 0x3400 && nCode <= 0x4DBF) // CJK Unified Ideographs Extension A
+ || (nCode >= 0x20000 && nCode <= 0x2A6DF); // CJK Unified Ideographs Extension B
+}
+
#if defined LIBO_INTERNAL_ONLY
bool isAscii(char) = delete;
bool isAscii(signed char) = delete;