Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Handle zero text size
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
pozdnyakov committed Dec 19, 2019
1 parent 28ccb0c commit cc684df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/mbgl/layout/symbol_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit cc684df

Please sign in to comment.