mapbox / mapbox-maps-flutter

Interactive, thoroughly customizable maps for Flutter powered by Mapbox Maps SDK
https://www.mapbox.com/mobile-maps-sdk
Other
292 stars 120 forks source link

Custom fonts in symbol layers #771

Open jasperdemmers opened 3 days ago

jasperdemmers commented 3 days ago

I'm using Mapbox Maps Flutter version 2.4.0, which introduces the experimental property MapboxMap.styleGlyphURL. This feature allows for applying custom fonts at runtime, including in symbol layers. However, I've encountered an issue where the Euro symbol (€) is not rendered when using a custom font. This appears to be because the glyph range specified (0-255) does not include the Euro symbol, which is located at Unicode code point U+20AC.

Steps to Reproduce:

  1. Use MapboxMap.styleGlyphURL to apply a custom font with the glyph range 0-255.
  2. Add a symbol layer with text that includes the Euro symbol (€).
  3. Observe that the Euro symbol is not rendered.

Expected Behavior:

The Euro symbol (€) should be rendered correctly in the symbol layer when using a custom font.

Actual Behavior:

The Euro symbol (€) is not visible or rendered in the symbol layer.

Additional Context:

Questions:

Environment:

evil159 commented 1 day ago

Hi @jasperdemmers, if the font requesting from the server only contains glyphs for the code points in the range 0–255, it is not possible to render the Euro sign (U+20AC) directly with that font, because the Euro sign’s Unicode code point (U+20AC, decimal 8364) lies outside this range.

So possible options to render it correctly:

jasperdemmers commented 1 day ago

Hey @evil159, thanks for the response! I switched to full local glyph rasterization mode and it works like a charm. Do you know if this has any significant performance impact compared to not doing this locally? Thanks in advance!