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

[demo] use Oswald web font on shields #955

Closed
wants to merge 3 commits into from

Conversation

claysmalley
Copy link
Member

PR for preview purposes only; see discussion here

@1ec5
Copy link
Member

1ec5 commented Oct 8, 2023

There seems to be a race condition in which the font loads after some of the shields have been rendered and cached in the sprite sheet. This randomly affects different shields each time I reload the page in Firefox:

U.S. Route 35 in a lighter font U.S. Route 35 in a heavier font

Each browser engine has slightly different behavior around Web fonts. If I remember correctly, WebKit generally draws blank text until the font loads, which would be worse in a case like this.

We might want to listen for a font loading event and trash and repopulate the shields in the sprite sheet at that time.

@zekefarwell
Copy link
Collaborator

I think the issue may be that different font weights are being used randomly. Four weights are loaded from google fonts:
https://github.com/ZeLonewolf/openstreetmap-americana/blob/a70c4c7bb3564e3c79eabbb77ffebb333566cc74/src/index.html#L9
I'm not sure why this would be happening, but the number shapes all look the same to me just randomly varying by weight with each page load.

@zekefarwell
Copy link
Collaborator

the number shapes all look the same to me

Scratch that. After some testing I've seen varying number shapes too. Like these different 9s here:
Screenshot 2023-10-08 at 12 08 33 PM

Doesn't ensure that the font is loaded before shields start generating,
but makes it more likely
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants