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

An empty/stubbed style with no glyphs URL declaration causes a SymbolLayer's icons to disappear when a textField is added #165

Open
TobiasDettmers-MW opened this issue Oct 11, 2021 · 1 comment

Comments

@TobiasDettmers-MW
Copy link

Hi, I'm using MapLibre in a semi-offline use-case to render GeoJsons which is a relatively fringe one but this is an issue nonetheless.

I'm developing for Android with MapLibre 9.5.1.

Repro

  1. Have a map without an explicit style (should be empty/stubbed; just Style.Builder() for instance)
  2. Add a symbolLayer with some markers
  3. Give those markers an icon (works)
  4. Also give the markers a textField (no markers or text! No warning emitted to logcat either)
  5. Change the style to
    Style.Builder().fromJson("""{
             "glyphs": "https://orangemug.github.io/font-glyphs/glyphs/{fontstack}/{range}.pbf"
         }""".trimIndent())
    
    and set a supported font on the textField like textFont(arrayOf("Roboto Black")).
    Now the text and icons show up again.

Expected behaviour

MapLibre should use a local font as fallback (i.e. "sans-serif") and at least show the icon without text.

Context

Supposedly that functionality already exists for symbolic/CJK characters:

mapbox/mapbox-gl-native#10522

and there's the localIdeographFontFamily mapboxOption which (at least to me) sounds like it should prevent this issue and is enabled by default.

@TobiasDettmers-MW
Copy link
Author

localIdeographFontFamily is for fixed-width CJK characters only because TinySDF can't handle (highly) variably-sized characters: mapbox/tiny-sdf#6

Here's the check whether a character can be handled:

https://github.com/maplibre/maplibre-gl-native/blob/004a849d8c53a22279a4901f5a44d5ac83d9425d/src/mbgl/util/i18n.cpp#L416-L420

Hacking the function to allow regular western characters makes it work technically but the result is bad spacing and correcting that with textLetterSpacing makes the text appear off-center and kerning is still non-existent.

@louwers louwers added the enhancement New feature or request label Jan 25, 2023
@louwers louwers removed the enhancement New feature or request label Nov 26, 2024
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