diff options
author | Molly Lloyd <molly@mapbox.com> | 2017-03-27 17:30:58 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-03-28 11:06:58 -0700 |
commit | 47c1e42ac1073ef02093b59336588f389f287227 (patch) | |
tree | 9e1737ff6c56f2d07fa2eddab4055a19af5479ba /src | |
parent | 5f402975267e0cb0baf87a13afcd0d1366791d01 (diff) | |
download | qtlocation-mapboxgl-47c1e42ac1073ef02093b59336588f389f287227.tar.gz |
[core] implement dds for text-offset
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/layout/symbol_layout.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/style/layers/symbol_layer.cpp | 6 | ||||
-rw-r--r-- | src/mbgl/style/layers/symbol_layer_properties.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/text/glyph_set.cpp | 6 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp index 3a2c082ad8..8e36bb84ea 100644 --- a/src/mbgl/layout/symbol_layout.cpp +++ b/src/mbgl/layout/symbol_layout.cpp @@ -250,7 +250,7 @@ void SymbolLayout::prepare(uintptr_t tileUID, /* verticalAlign */ verticalAlign, /* justify */ justify, /* spacing: ems */ layout.get<TextLetterSpacing>() * oneEm, - /* translate */ Point<float>(layout.get<TextOffset>()[0], layout.get<TextOffset>()[1]), + /* translate */ Point<float>(layout.evaluate<TextOffset>(zoom, feature)[0] * oneEm, layout.evaluate<TextOffset>(zoom, feature)[1] * oneEm), /* verticalHeight */ oneEm, /* writingMode */ writingMode, /* bidirectional algorithm object */ bidi); diff --git a/src/mbgl/style/layers/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp index 42bcf0e6b0..02e1e364f1 100644 --- a/src/mbgl/style/layers/symbol_layer.cpp +++ b/src/mbgl/style/layers/symbol_layer.cpp @@ -483,15 +483,15 @@ void SymbolLayer::setTextTransform(DataDrivenPropertyValue<TextTransformType> va impl->layout.unevaluated.get<TextTransform>() = value; impl->observer->onLayerLayoutPropertyChanged(*this, "text-transform"); } -PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultTextOffset() { +DataDrivenPropertyValue<std::array<float, 2>> SymbolLayer::getDefaultTextOffset() { return TextOffset::defaultValue(); } -PropertyValue<std::array<float, 2>> SymbolLayer::getTextOffset() const { +DataDrivenPropertyValue<std::array<float, 2>> SymbolLayer::getTextOffset() const { return impl->layout.unevaluated.get<TextOffset>(); } -void SymbolLayer::setTextOffset(PropertyValue<std::array<float, 2>> value) { +void SymbolLayer::setTextOffset(DataDrivenPropertyValue<std::array<float, 2>> value) { if (value == getTextOffset()) return; impl->layout.unevaluated.get<TextOffset>() = value; diff --git a/src/mbgl/style/layers/symbol_layer_properties.hpp b/src/mbgl/style/layers/symbol_layer_properties.hpp index f2b7bfa00f..e7cfb8d455 100644 --- a/src/mbgl/style/layers/symbol_layer_properties.hpp +++ b/src/mbgl/style/layers/symbol_layer_properties.hpp @@ -160,7 +160,7 @@ struct TextTransform : DataDrivenLayoutProperty<TextTransformType> { static TextTransformType defaultValue() { return TextTransformType::None; } }; -struct TextOffset : LayoutProperty<std::array<float, 2>> { +struct TextOffset : DataDrivenLayoutProperty<std::array<float, 2>> { static constexpr const char * key = "text-offset"; static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; } }; diff --git a/src/mbgl/text/glyph_set.cpp b/src/mbgl/text/glyph_set.cpp index 19a6e2cddd..ea0dd123db 100644 --- a/src/mbgl/text/glyph_set.cpp +++ b/src/mbgl/text/glyph_set.cpp @@ -45,7 +45,7 @@ const Shaping GlyphSet::getShaping(const std::u16string& logicalInput, const float verticalHeight, const WritingModeType writingMode, BiDi& bidi) const { - Shaping shaping(translate.x * 24, translate.y * 24, writingMode); + Shaping shaping(translate.x, translate.y, writingMode); std::vector<std::u16string> reorderedLines = bidi.processText(logicalInput, @@ -66,9 +66,9 @@ void align(Shaping& shaping, const std::size_t lineCount, const Point<float>& translate) { const float shiftX = - (justify - horizontalAlign) * maxLineLength + ::round(translate.x * 24 /* one em */); + (justify - horizontalAlign) * maxLineLength + ::round(translate.x); const float shiftY = - (-verticalAlign * lineCount + 0.5) * lineHeight + ::round(translate.y * 24 /* one em */); + (-verticalAlign * lineCount + 0.5) * lineHeight + ::round(translate.y); for (auto& glyph : shaping.positionedGlyphs) { glyph.x += shiftX; |