Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom fonts in symbol layers #771

Open
jasperdemmers opened this issue Nov 16, 2024 · 2 comments
Open

Custom fonts in symbol layers #771

jasperdemmers opened this issue Nov 16, 2024 · 2 comments

Comments

@jasperdemmers
Copy link

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:

  • The text-font expression for the symbol layer seems to only allow pre-defined fonts, which limits the ability to specify custom glyph ranges.
  • The Euro symbol is outside the glyph range 0-255 and requires an extended range, such as 0-767, to be included.

Questions:

  • Is there a recommended way to include extended glyph ranges in mapbox-maps-flutter?
  • Are there plans to enhance the text-font expression to support custom fonts more flexibly?

Environment:

  • Mapbox Maps Flutter version: 2.4.0
  • Platform: iOS, Android
@evil159
Copy link
Contributor

evil159 commented Nov 18, 2024

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:

  • Switch to fully local glyph rasterization mode, then all glyphs will be rendered with system fonts
  • Update the server font to include the Euro sign (U+20AC) by expanding the glyph range to include it. This would require updating the font on the server to support U+20AC.

@jasperdemmers
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants