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

Look for a bundled Noto CJK font #2398

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tobylane
Copy link
Member

@tobylane tobylane commented Sep 4, 2023

Describe what the proposed change does

  • Look for a bundled Noto CJK font, or a packager chosen bundled font path or a system font path. The official Noto project doesn't release a suitable single file, but there are some third party builds that do. satbyy has GoNotoKurrent-Bold.ttf, I chose this because the licence on this project is clearer.
    Other font options include KlokanTechNotoSansCJK-Regular.otf from klokantech or GoNotoKurrent-Regular.ttf from satbyy.
  • The new priority is user setting > bundled font > system font. Linux users from before this change will have an old user setting by default that is probably worse than Noto for CJK.

Korean preview
Screen 2023-09-04 at 20 56 39

Fixes #1901 fixes #823 fixes #1219

Copy link
Member

@lewri lewri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the time being, I don't think we should remove the ability to set font manually. Instead, just let it sit as the default value.

Also these changes probably break the font dialog.

@TheCycoONE
Copy link
Member

Prefer not to bundle in the repo without first debating/setting up git lfs. It's sufficient to make it a packaging requirement.

@tobylane
Copy link
Member Author

tobylane commented Sep 5, 2023

Users's setting > bundled font > OS font. This means if the user has opened CorsixTH on Linux before, the incomplete OS font will be preferred. Line 138 could only choose the setting if it isn't the path two lines above?

I tried to have it pick up the youngest ttf file in the folder, but FileTreeNode isn't available.

Copy link
Member

@lewri lewri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth noting here, ARIALUNI.TTF was a Microsoft Office font (not Windows) and hasn't been included since Office 2016. This would explain why gfx:loadFontFile() never wrote a unicode font to the config.txt since that time on Windows.
https://learn.microsoft.com/en-us/typography/font-list/arial-unicode-ms

Edit: It looks like MacOS now also ships with Noto?

@lewri
Copy link
Member

lewri commented Sep 10, 2023

Users's setting > bundled font > OS font. This means if the user has opened CorsixTH on Linux before, the incomplete OS font will be preferred. Line 138 could only choose the setting if it isn't the path two lines above?

I tried to have it pick up the youngest ttf file in the folder, but FileTreeNode isn't available.

Why not make it an explicit setting?

@tobylane
Copy link
Member Author

I think Arial and Noto are the only pan-CJK fonts. Google font search for the first Korean string in the language file, where after the Noto fonts they are Korean or Korean+European only, not including Chinese and Japanese.

Could we have the non-free Arial package recommended or required by linux packages? Ask the packagers to set the other-os line to the location of the font that their distribution installs Arial to? eg https://packages.debian.org/buster/ttf-mscorefonts-installer

Why not make it an explicit setting?

Ideally it isn't a user decision at all, depending on how close we can get to an answer for everyone. Strictly free-only (avoiding debian non-free) users who don't like Noto may be left out.

@lewri
Copy link
Member

lewri commented Sep 26, 2023

We can't rely on Arial Unicode any more in Windows. In Mac, it's still okay (it is in the Font Library). I'd support cyco's suggestion to make it a packaging requirement. Worst case is that if a suitable unicode font is missing unicode languages are just hidden until a font is selected.

@Alberth289346
Copy link
Contributor

It should be possible to extract all code points from all strings in a language, and verify that they exist in the font.

When to do that, and what to do if indeed code points are missing are next choices.

@lewri lewri added the PR:Feature PR label label Oct 9, 2023
@lewri lewri added this to In progress in 0.68 Release via automation Oct 9, 2023
@tobylane
Copy link
Member Author

tobylane commented Feb 3, 2024

Rebased, and put the two new variables at the top of the file for packagers to edit.

@lewri
Copy link
Member

lewri commented Feb 4, 2024

I think part of the idea is to also change our make files to require the font too as an optional dependency. At the least, we'd need to add more directions to the make instructions say we want to use x specific noto bundle.

Remove references/settings about picking a font file. Do we want this option left in?

Did you put this back in now? If we want to encourage Noto you may need to add something perhaps to the config file and/or Wiki we're using Noto as the default, but if your language doesn't show properly for you you can specify another?
Do you know what specific languages we currently support that aren't covered by this bundle?

@tobylane tobylane changed the title Use an included Noto font Look for a bundled Noto CJK font Feb 14, 2024
@tobylane
Copy link
Member Author

Did you put this back in now?

I did, and have updated the title and post.

If we want to encourage Noto you may need to add something perhaps to the config file and/or Wiki we're using Noto as the default, but if your language doesn't show properly for you you can specify another?

I can draft a wiki page. The config file, and perhaps the folder settings tooltip, could say something like leave empty for a font chosen for you? Should the folder settings run Graphics:loadFontFile() when the font setting is cleared to find what it can?

Do you know what specific languages we currently support that aren't covered by this bundle?

So far as I've seen, all are supported by Noto CJK.

Copy link
Member

@lewri lewri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once merged I would suggest adding to the 'How to Compile' wiki page. We can add (yet another :) ) packaging note on release too.

I appreciate this PR is now only a 'look for', but it definitely is going to need its supporting docs where appropriate.

@TheCycoONE
Copy link
Member

I feel like we should favour a system noto if that's what we're packaging, over the system arial if available.

This is starting to feel similar to the hospital lookup function.

@lewri
Copy link
Member

lewri commented Feb 29, 2024

I feel like we should favour a system noto if that's what we're packaging, over the system arial if available.

This is starting to feel similar to the hospital lookup function.

Arial unicode is heavily deprecated/removed in Windows. Though that isn't (currently) what this PR is about now.

@tobylane
Copy link
Member Author

Debian follows the official project in not combining the font files. We could have the language file give the suffix (JP, KR, SC, TC from the debian page) for the right file for each non-European language select, but I don't like the sound of that.

@TheCycoONE
Copy link
Member

I might not hate language specific font files - it would let us cut down on what we package quite a bit.

Does raise the complexity though.

@tobylane
Copy link
Member Author

tobylane commented Mar 3, 2024

Strings are loaded after and depend on Graphics. Strings can load the font file suffix and make the switch later, but that means setting the font twice.

NotoSansCJK-VF.otf.ttc (33mb) is another good option, but not packaged.

@lewri
Copy link
Member

lewri commented Mar 29, 2024

@tobylane are #1901 and #823 resolved or partially resolved at all by this PR? If so, could you edit the summary so they point respectively?

@tobylane
Copy link
Member Author

Updated, also #1219.

@lewri lewri linked an issue Mar 30, 2024 that may be closed by this pull request
Comment on lines +23 to +24
-- The location of a globally installed font
local installed_path = "/usr/share/fonts/truetype/arphic/uming.ttc"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this global? The path given is likely only *nix global. It seems little odd why you isolated this path though from the other OS paths.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for *nix packagers to change, I can make that more clear here or in the wiki. It's likely that *nix packagers will put a font at a global path and Windows packagers will put a font at a local path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR:Feature PR label
Projects
0.68 Release
  
In progress
4 participants