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

Improved handling of glyph urls as commonly used in styles #1443

Open
bzeiss opened this issue Jul 28, 2024 · 0 comments · May be fixed by #1444
Open

Improved handling of glyph urls as commonly used in styles #1443

bzeiss opened this issue Jul 28, 2024 · 0 comments · May be fixed by #1444

Comments

@bzeiss
Copy link

bzeiss commented Jul 28, 2024

When trying to make the font service working, I stumbled across a small problem that is easy to fix, but not so easy to find out why it didn't work (at least for me).

I'm using a tilemaker mbtiles file together with publicly available openmaptiles style, for example, https://github.com/openmaptiles/osm-bright-gl-style/blob/master/style.json. Practically all openmapstyle styles listed on https://openmaptiles.org/styles/, have one thing in common in how they specify the glph url. They do it as something like
"glyphs": "https://api.maptiler.com/fonts/{fontstack}/{range}.pbf?key={key}",

When I first tried to make Martin work as glyph server, I adapted the url to
"glyphs": "font/{fontstack}/{range}.pbf"

This didn't work. Martin successfully scanned the font directory that I have provided:

Configured font Open Sans Regular with 883 glyphs (0020-FFFD) from fonts/open-sans/OpenSans-Regular.ttf

But when I tried to access the service with http://localhost:3000/font/Open%20Sans%20Regular/0-255.pbf as I have watched maplibre request the glyphs, I would get a response "can not parse "255.pbf" to a u32".

After enabling the debug logs, I got

2024-07-28T10:59:28Z DEBUG actix_web::types::path] Failed during Path extractor deserialization. Request path: "/font/Open%20Sans%20Regular/0-255.pbf"
[2024-07-28T10:59:28Z DEBUG actix_web::middleware::logger] Error in response: Error("can not parse "255.pbf" to a u32")

After some tinkering, I found out that http://localhost:3000/font/Open%20Sans%20Regular/0-255 works, but http://localhost:3000/font/Open%20Sans%20Regular/0-255 .pbf doesn't. After changing the glyph urls in the styles to "glyphs": "font/{fontstack}/{range}", everything started to work perfectly.

Ideally there would be either a pointer in the documentation how the glyph urls need to look like or the server would automatically detect such pbf urls and handle them correctly.

Thanks for this great server. I really enjoy tinkering with it!

bzeiss added a commit to bzeiss/martin that referenced this issue Jul 28, 2024
bzeiss added a commit to bzeiss/martin that referenced this issue Jul 28, 2024
bzeiss added a commit to bzeiss/martin that referenced this issue Jul 28, 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

Successfully merging a pull request may close this issue.

1 participant