[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`.
This commit is contained in:
Mikhail Pozdnyakov
2019-12-19 17:16:43 +02:00
parent 28ccb0ccc0
commit cc684df736

View File

@@ -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;