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

Remove non-open source fonts #4820

Open
hyperknot opened this issue Oct 10, 2024 · 21 comments
Open

Remove non-open source fonts #4820

hyperknot opened this issue Oct 10, 2024 · 21 comments

Comments

@hyperknot
Copy link

Since MapLibre has grown up to be the reference open-source map library, I think it'd be important to remove non-open-source fonts from the codebase, examples and in hosted files.

Please make a grep in the codebase for:

  • "Arial Unicode"
  • "DIN Offc"

Also, the Arial fonts are actually hosted here, which are probably totally wrong, even if no one noticed it for 3 years:
https://github.com/maplibre/demotiles/tree/gh-pages/font/Open%20Sans%20Regular%2CArial%20Unicode%20MS%20Regular

@HarelM
Copy link
Collaborator

HarelM commented Oct 11, 2024

I think the problem is with the default font, which is also not free.
See here:
maplibre/maplibre-style-spec#834

In any case, feel free to remove the non-open-source fonts.

@hyperknot
Copy link
Author

I think these are quite high level decisions in this project, I just wanted to point out the situation. I'd recommend normalizing everything on Noto Sans, including the specs, but I'm just an outsider making suggestions.

@louwers
Copy link
Collaborator

louwers commented Oct 11, 2024

The Open Sans Regular, Arial Unicode MS Regular files only contain Open Sans Regular, not Arial.

Correct me if I'm wrong.

@louwers
Copy link
Collaborator

louwers commented Oct 11, 2024

Even though the font filenames contain the names of non open source fonts, the font files in the demotiles repo are actually open source (see maplibre/demotiles#1).

@hyperknot
Copy link
Author

Two things are weird for me:

  • Open Sans without Arial cannot cover the wider Unicode ranges. That's the specialty of Noto Sans, those ranges are simply missing from Open Sans. Hence the need of Arial for example, to cover them.
  • The generating script totally misses the Arial fonts.
    https://github.com/openmaptiles/fonts/blob/master/generate.js

Like I don't yet see how could the fonts repo generate the PBFs in the demotiles repo. The string "arial" is not present in the fonts repo.

@hyperknot
Copy link
Author

hyperknot commented Oct 26, 2024

If we really want to keep the Arial name for backwards compatibility, then I recommend

  1. Making a mix of Open Sans + Noto Sans for example
  2. Writing a script for this in the fonts repo
  3. Adding a section in the demotiles repo that the Arial font is actually Open + Noto Sans

@HarelM
Copy link
Collaborator

HarelM commented Nov 13, 2024

Monthly meeting discussion summary:
We are not planning on breaking the spec, even if it means the default is not an open licensed font.
The way forward to overcome it will be adding a default font property to allow overriding the current implicit non open licensed font:
maplibre/maplibre-style-spec#834

@hyperknot
Copy link
Author

I like the idea of the proposed property. Substituting Arial to Noto Sans and deploying this font as "Open Sans Regular, Arial Unicode MS Regular" is still a worthwhile idea though, that way we can clearly point out that the repository only contains open source fonts, even if it contains "Arial" in the name.

@HarelM
Copy link
Collaborator

HarelM commented Nov 13, 2024

You mean for the demotiles repo?
Sure, feel free to add it to the main readme or add a readme inside the font folder, which ever you think would be the place you would look for something like that.

@hyperknot
Copy link
Author

I think what's missing is the script to download and process the fonts in the first place. I guess this one needs some tweaking to combine two fonts.
https://github.com/openmaptiles/fonts/blob/master/generate.js

@HarelM
Copy link
Collaborator

HarelM commented Nov 13, 2024

openmaptiles it outside my reach :-) To generate glyphs there are a few ways as can be seen here:
https://github.com/maplibre/awesome-maplibre?tab=readme-ov-file#font-glyph-generation

@hyperknot
Copy link
Author

I mean the demotiles was generated using that script I believe. Or they were just copied in binaries from OMT, I'm not sure from the repo history.

@hyperknot
Copy link
Author

I see the best script we have today is from @bdon.
https://github.com/protomaps/basemaps-assets/blob/main/scripts/create_fonts.sh

Brandon, could you comment about how you made that script? OMT repo has this line "patched by Klokantech", is this what your script is doing?

@bdon
Copy link
Contributor

bdon commented Nov 14, 2024

It uses https://github.com/maplibre/font-maker from the command line - that script is a bit hacked together, but a closer anaysis of the code points available in each font could lead to more complete coverage.

@hyperknot
Copy link
Author

Do you think the same strategy could be used to make an Open Sans + Noto Sans font, which could be a true replacement for "Open Sans Regular, Arial Unicode MS Regular"? Does those codepages need to be written manually? I mean, can we not do something which takes all character ranges from Noto and Open and mixes them?

@bdon
Copy link
Contributor

bdon commented Nov 14, 2024

What is the gain of using Open Sans instead of just Noto for the entire range?

We want to exclude CJK since those are big and will be ignored by default with localIdeographs.

@hyperknot
Copy link
Author

It's just that then we could have an official replacement for the arial named font. The normal range would be identical and the unicode range would be from noto.

@hyperknot
Copy link
Author

hyperknot commented Nov 15, 2024

I think this is the best place to organise our efforts. I posted this on bsky as well.

Open source MapLibre font stack rabbit hole

I'm trying to make one reference PBF font stack for all MapLibre-based maps, including OpenFreeMap. Here's what I've found in the rabbit hole so far:

maplibre/demotiles These fonts were generated using openmaptiles/fonts.
Problem: I really want to replace the font called "Open Sans Regular,Arial Unicode MS Regular," as Arial isn't open-source. The name of the font has to be kept since it's a hardcoded default string in all MapLibre releases. Even if the name must be kept, at least the Arial Unicode content should be replaced with Noto Sans, which specializes in covering unicode ranges.
OpenFreeMap currently uses the pure Noto Sans from this repo. I've opened a ticket about the Arial situation in MapLibre: maplibre-gl-js#4820

openmaptiles/fonts repo might have been used to generate the maplibre/demotiles repo. It uses node-fontnik and @mapbox/glyph-pbf-composite. It's not clear what "Noto Sans (patched by Klokan Technologies)" means, and I'm not comfortable with it. A reference font stack should only source official fonts and include a script for any patching if needed.

@bdon has a fully open-source script for creating such a patched Noto Sans here: protomaps/basemaps-assets
It uses maplibre/font-maker.

The official release page of Noto Sans is notofonts.github.io - it has a Noto version for approximately 250 languages/writing systems.

The Noto Repo has an "experimental build" called megamerge, which combines all the Noto fonts into a single one. Maybe we could simply use NotoSansLiving-Regular.ttf?
notofonts/megamerge

VersaTiles uses node-fontnik, but there's a bug with the rendering: versatiles-style#29. They're currently considering migrating to PBF Font Tools, developed by Stadia Maps sdf_font_tools/pbf_font_tools, which, if I understand correctly, is an alternative to node-fontnik and maplibre/font-maker. The same repo has sdf_font_tools/build_pbf_glyphs, a CLI builder.

I guess we could use Noto Sans megamerge with either font-maker or sdf_font_tools to generate a pure Noto? Also, if someone could help me create the replacement for "Open Sans Regular,Arial Unicode MS Regular" that keeps the Open Sans parts but replaces Arial Unicode with Noto, it would solve the default font issue in MapLibre.

@HarelM
Copy link
Collaborator

HarelM commented Nov 15, 2024

@hyperknot thanks for the summary, but it is not clear what are the action items that should be done.
If it's about documentation updates, please submit a PR in the relevant repo.
If there are fonts to be changed in the demo tiles repo, please do that as well.
If you need help with something, please let us know and we'll be happy to land a hand.

@hyperknot
Copy link
Author

hyperknot commented Nov 15, 2024

I believe the action is to make a PR to demotiles:

  • create a script file which generates the demotiles binary files from clean sources
  • remove the dependency on the unknown origin openmaptiles/fonts repo

I mean the solution might be like a 10 line script file, nothing serious. I'm just asking for help in deciding what tools to use for these scripts, from those who have experience with these.

I mean, at the end, everyone in the ecosystem wants the same fonts for maplibre, so why not unify efforts.

@hyperknot
Copy link
Author

@HarelM I mean I'm happy to do the PR, I just want to research the topic first.

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

4 participants