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

no extra font should be necessary #293

Open
karussell opened this issue Nov 21, 2022 · 8 comments
Open

no extra font should be necessary #293

karussell opened this issue Nov 21, 2022 · 8 comments
Labels
bug Something isn't working firefox This issue only occurs in Firefox

Comments

@karussell
Copy link
Member

karussell commented Nov 21, 2022

After #288 it seems that we are downloading the Noto Sans font like:

https://graphhopper.com/maps/eae34fa8f1e0c4c6d797.ttf

even if we don't use the vector tiles.

@karussell karussell added the bug Something isn't working label Nov 21, 2022
@karussell karussell added this to the 0.5 milestone Nov 21, 2022
@karussell
Copy link
Member Author

karussell commented Nov 21, 2022

It fetches this font even if I remove all vector tile layers. And if I remove Noto Sans the network request disappears, but then the font is fetched again from the Google servers again. What is so special about Noto Sans!? (it isn't used elsewhere in our code)

But it seems to happen only for Firefox

@karussell karussell added the firefox This issue only occurs in Firefox label Nov 21, 2022
@otbutz
Copy link
Contributor

otbutz commented Nov 23, 2022

Vector layers use client side rendering. Noto Sans covers a wide range of UTF-8 and ensures that the map doesn't display tofu like �.

What should be fixed though is the absence of headers like cache-control and expires which would allow for proper caching.

@karussell
Copy link
Member Author

karussell commented Nov 23, 2022

Vector layers use client side rendering. Noto Sans covers a wide range of UTF-8 and ensures that the map doesn't display tofu like �.

If we would not serve the font the browser would just use a different font in this case, so not a big problem, but it cannot hurt to make them work as intended so we included them.

The problem here is a different one: firefox fetches the font although the maptiler layer is not used. It is not consistent with the other 2 fonts also required for the Maptiler layer (they are not requested).

Chrome handles this properly and requests all 3 fonts only if the maptiler layer is selected.

@otbutz
Copy link
Contributor

otbutz commented Nov 23, 2022

I can't see a ttf request when I open https://graphhopper.com/maps/?profile=car&layer=Omniscale in Firefox 107. Only switching layers to a vector based map triggers them.

@easbar
Copy link
Member

easbar commented Nov 23, 2022

I see a request against: https://graphhopper.com/maps/eae34fa8f1e0c4c6d797.ttf (also using Firefox 107). Maybe this depends on the OS? I used Kubuntu.

@otbutz
Copy link
Contributor

otbutz commented Nov 23, 2022

Maybe the difference is prefetching: https://github.com/gorhill/uBlock/wiki/Dashboard:-Settings#disable-prefetching

@otbutz
Copy link
Contributor

otbutz commented Nov 30, 2022

@karussell for consistency, could you move the fonts to the assets directory? This might also improve cache header logic in your nginx config as those are all static.

@karussell
Copy link
Member Author

@karussell for consistency, could you move the fonts to the assets directory?

Not sure. Does not seem to be the default https://webpack.js.org/guides/asset-management/#loading-fonts

This might also improve cache header logic in your nginx config as those are all static.

The content type for the fonts is the problem here, which I fixed in #296 (but needs a server side change on our side too).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working firefox This issue only occurs in Firefox
Projects
None yet
Development

No branches or pull requests

3 participants