summaryrefslogtreecommitdiff
path: root/src/mbgl/util/i18n.hpp
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-11-14 14:53:21 -0800
committerGitHub <noreply@github.com>2016-11-14 14:53:21 -0800
commitdbd22357441ec66c46cc7e46a01ed114a18f685c (patch)
tree7f4af9a1276139863b6828b6f7ea152fd5b954a9 /src/mbgl/util/i18n.hpp
parent1c79147a84fe9f852fa21bcf5629f490e8e2a8bf (diff)
downloadqtlocation-mapboxgl-dbd22357441ec66c46cc7e46a01ed114a18f685c.tar.gz
[core] Line-break ideographic text by character (#6828)
* [core] Line-break ideographic text by character Allow a line break to be inserted after any supported Chinese, Japanese, or Yi character in a point-placed label. Balance the lines unless non-ideographic text such as Latin letters are present. Fixes #1223. * [core] Moved more character classing into util::i18n * [core] Detect character properties by Unicode block * [test] Reenabled ideographic breaking tests
Diffstat (limited to 'src/mbgl/util/i18n.hpp')
-rw-r--r--src/mbgl/util/i18n.hpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/mbgl/util/i18n.hpp b/src/mbgl/util/i18n.hpp
new file mode 100644
index 0000000000..fe324f5362
--- /dev/null
+++ b/src/mbgl/util/i18n.hpp
@@ -0,0 +1,27 @@
+#pragma once
+
+#include <string>
+
+namespace mbgl {
+namespace util {
+namespace i18n {
+
+/** Returns whether a character is a visible character. */
+bool isVisible(uint32_t chr);
+
+/** Returns whether a line break can be inserted after the character indicated
+ by the given Unicode codepoint due to word breaking. */
+bool allowsWordBreaking(uint32_t chr);
+
+/** Returns whether a line break can be inserted after any character in the
+ given string. If false, line breaking should occur on word boundaries
+ instead. */
+bool allowsIdeographicBreaking(const std::u32string& string);
+
+/** Returns whether a line break can be inserted after the character indicated
+ by the given Unicode codepoint due to ideographic breaking. */
+bool allowsIdeographicBreaking(uint32_t chr);
+
+} // namespace i18n
+} // namespace util
+} // namespace mbgl