summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-12-19 17:16:43 +0200
committerTobrun <tobrun.van.nuland@gmail.com>2019-12-19 20:53:28 +0100
commita552d151ea14f47144acfeec79964537071c21ae (patch)
tree11a344c0e3a5b7db96e50ac185b5a3afe903c2c3
parent47c87422a0b020bd9418d171f2aa0ed3ba524ca9 (diff)
downloadqtlocation-mapboxgl-a552d151ea14f47144acfeec79964537071c21ae.tar.gz
[core] Handle zero text size
The style specification stipulates that `text-size` values must be positive (https://docs.mapbox.com/mapbox-gl-js/style-spec/#layout-symbol-text-size). However, a zero value could be passed to the engine (e.g. as a result of an expression) this patch handles it and avoids assertion hit in `shaping.cpp`.
-rw-r--r--src/mbgl/layout/symbol_layout.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp
index fc8af2c076..499f1113cc 100644
--- a/src/mbgl/layout/symbol_layout.cpp
+++ b/src/mbgl/layout/symbol_layout.cpp
@@ -359,7 +359,7 @@ void SymbolLayout::prepareSymbols(const GlyphMap& glyphMap,
const float layoutIconSize = layout->evaluate<IconSize>(zoom + 1, feature);
// if feature has text, shape the text
- if (feature.formattedText) {
+ if (feature.formattedText && layoutTextSize > 0.0f) {
const float lineHeight = layout->get<TextLineHeight>() * util::ONE_EM;
const float spacing = util::i18n::allowsLetterSpacing(feature.formattedText->rawText()) ? layout->evaluate<TextLetterSpacing>(zoom, feature) * util::ONE_EM : 0.0f;