summaryrefslogtreecommitdiff
path: root/src/mbgl/util/i18n.cpp
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2016-11-20 09:36:07 -0800
committerChris Loer <chris.loer@gmail.com>2016-11-30 11:54:08 -0800
commit5f29c3ba26f84c8aea6f70640c348b32cdf397bf (patch)
tree2767e2cbb6aa826280fd7afc2b71f2d620010528 /src/mbgl/util/i18n.cpp
parentd8cef7850293bb801778c82d2d196cdeb22862f5 (diff)
downloadqtlocation-mapboxgl-5f29c3ba26f84c8aea6f70640c348b32cdf397bf.tar.gz
[core] Full support for line breaking bidirectional text using ICU bidi functionality.
- Trim whitespace from labels before determining their max-width for alignment. - Fix crash on labels that contain lines with only a single character of whitespace.
Diffstat (limited to 'src/mbgl/util/i18n.cpp')
-rw-r--r--src/mbgl/util/i18n.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/mbgl/util/i18n.cpp b/src/mbgl/util/i18n.cpp
index 97dda76320..4be624d2e5 100644
--- a/src/mbgl/util/i18n.cpp
+++ b/src/mbgl/util/i18n.cpp
@@ -294,12 +294,6 @@ namespace mbgl {
namespace util {
namespace i18n {
-bool isVisible(uint16_t chr) {
- return (chr == 0x0a /* newline */
- || chr == 0x20 /* space */
- || chr == 0x200b /* zero-width space */);
-}
-
bool allowsWordBreaking(uint16_t chr) {
return (chr == 0x0a /* newline */
|| chr == 0x20 /* space */
@@ -324,6 +318,10 @@ bool allowsIdeographicBreaking(const std::u16string& string) {
}
bool allowsIdeographicBreaking(uint16_t chr) {
+ // Allow U+2027 "Interpunct" for hyphenation of Chinese words
+ if (chr == 0x2027)
+ return true;
+
// Return early for characters outside all ideographic ranges.
if (chr < 0x2E80)
return false;