You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It works well when all the fonts for which I want to generate previews exist. If, however, a font does not exist and the request for its glyph range(s) fails (with a 404 generally), the map never triggers its idle event. To get around this, I added a timeout so that if idle is not triggered before the timeout, the current font preview render is abandoned. You can simulate a bad font in the proof-of-concept by uncommenting the line // "BAD FONT",.
I think it would be nicer if the map instead triggered an event when a glyph request fails. Then, instead of using a timeout, I could listen for that that event, abandon the current font preview, and move on to the next one.
Design Alternatives
Design
Implementation
The text was updated successfully, but these errors were encountered:
If, however, a font does not exist and the request for its glyph range(s) fails (with a 404 generally), the map never triggers its idle event
I think the idle event is currently not triggered because affected tiles are not rendered at all -> #9546.
My understanding is that affected tiles should be rendered without labels (according to #662 (comment) bad glyph requests should not kill the entire tile).
So if affected tiles would be rendered without labels the idle event should be triggered.
An event which is triggered when a glyph request fails (as suggested here by @jseppi) would still be useful, e.g. to be able to notify the user of an app or trigger a fallback for this case.
Motivation
I am trying to render font previews using a mapbox-gl map instance and a small custom style that just shows a single text label.
The way I do this is:
map.setStyle(generatedStyle);
'idle'
event, that when triggered, will get the map canvas and save the canvas as a dataURLHere's a smallish proof-of-concept: https://jsbin.com/putowir/edit?html,js,console,output
It works well when all the fonts for which I want to generate previews exist. If, however, a font does not exist and the request for its glyph range(s) fails (with a
404
generally), the map never triggers itsidle
event. To get around this, I added a timeout so that ifidle
is not triggered before the timeout, the current font preview render is abandoned. You can simulate a bad font in the proof-of-concept by uncommenting the line// "BAD FONT",
.I think it would be nicer if the map instead triggered an event when a glyph request fails. Then, instead of using a timeout, I could listen for that that event, abandon the current font preview, and move on to the next one.
Design Alternatives
Design
Implementation
The text was updated successfully, but these errors were encountered: