summaryrefslogtreecommitdiff
path: root/src/mbgl/layout/symbol_layout.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/layout/symbol_layout.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/layout/symbol_layout.cpp')
-rw-r--r--src/mbgl/layout/symbol_layout.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp
index 41ad6f6452..7dad5c9429 100644
--- a/src/mbgl/layout/symbol_layout.cpp
+++ b/src/mbgl/layout/symbol_layout.cpp
@@ -20,8 +20,6 @@
#include <mbgl/util/platform.hpp>
#include <mbgl/util/logging.hpp>
-#include <mbgl/text/bidi.hpp>
-
namespace mbgl {
using namespace style;
@@ -92,9 +90,7 @@ SymbolLayout::SymbolLayout(std::string bucketName_,
u8string = platform::lowercase(u8string);
}
- std::u16string u16string = util::utf8_to_utf16::convert(u8string);
- ft.text = bidi.bidiTransform(u16string);
- ft.writingDirection = bidi.baseWritingDirection(u16string);
+ ft.text = applyArabicShaping(util::utf8_to_utf16::convert(u8string));
// Loop through all characters of this text and collect unique codepoints.
for (char16_t chr : *ft.text) {
@@ -198,7 +194,6 @@ void SymbolLayout::prepare(uintptr_t tileUID,
if (feature.text) {
shapedText = glyphSet->getShaping(
/* string */ *feature.text,
- /* base direction of text */ *feature.writingDirection,
/* maxWidth: ems */ layout.get<SymbolPlacement>() != SymbolPlacementType::Line ?
layout.get<TextMaxWidth>() * 24 : 0,
/* lineHeight: ems */ layout.get<TextLineHeight>() * 24,
@@ -206,7 +201,8 @@ void SymbolLayout::prepare(uintptr_t tileUID,
/* verticalAlign */ verticalAlign,
/* justify */ justify,
/* spacing: ems */ layout.get<TextLetterSpacing>() * 24,
- /* translate */ Point<float>(layout.get<TextOffset>()[0], layout.get<TextOffset>()[1]));
+ /* translate */ Point<float>(layout.get<TextOffset>()[0], layout.get<TextOffset>()[1]),
+ /* bidirectional algorithm object */ bidi);
// Add the glyphs we need for this label to the glyph atlas.
if (shapedText) {