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

Add application font fallback. #101

Merged
merged 16 commits into from
Feb 3, 2024
Merged

Add application font fallback. #101

merged 16 commits into from
Feb 3, 2024

Conversation

Tatsu-syo
Copy link
Owner

I added application font fallback mechanism.
Application font fallback mechanism does when Windows don't have font that specified in language file FONT_FACE key, select alternative font.

When NoMeiryoUI::applyResource executed, add call NoMeiryoUI::getLanguageFallbackForCountry that select application font fallback mechanism.
NoMeiryoUI::getLanguageFallbackForCountry calls application fallback font detect functions..

Font detect functions is written in country specific folder located in country(country name) .

I write base functions and Japanese and no country specific function, and Japanese language setting.

Translators can write better look font name in FONT_FACE key.

I write recently added better font "BIZ UDPGothic" in Japanese translation file. This font is used in Windows 11 and later version of Windows 10.
In Earlyer version of Windows 10, Yu Gothic Medium is used. And in Windows 8.1.Yu Gothic is used. Earlyer than Windows 8.1 MS UI Gothic(bitmap) is used. This choice by my program.

@mon-jai
Copy link
Contributor

mon-jai commented Nov 12, 2023

I would suggest making the fallback font configurable.

Personally, I've installed Noto Sans CJK on my machine, and it looks much better, but it might not work for everyone. It would also be too much work if someone needs to recompile the program to specify their own fallback font (as it is a matter of taste and preferences).

Additionally, is there an option for "just using the system default fallback font"?

@Tatsu-syo
Copy link
Owner Author

I also installed noto

Additionally, is there an option for "just using the system default fallback font"?
Oh, I forgot this item. In weekend, went hospitals and make basic programs and solve my computer trouble in full of time.
Next, I plan to make alternative application font settings in language file.

Example (in Japanese):

FONT_FACE=Noto Sans CJK JP
ALTER_FONT_FACE=BIZ UDPGothic

And if each font didn't found in Windows, use system default fallback font.

How about?
i

@mon-jai
Copy link
Contributor

mon-jai commented Nov 13, 2023

I would suggest making the fallback font option available as a dropdown menu in the user interface, rather than via a config file, to leave the choice to the end user.

Because choosing the fallback font is a matter of preference, the font we pick may not suit all users well.

Having a language-sensitive default is good, though.

@Tatsu-syo
Copy link
Owner Author

@mon-jai

I would suggest making the fallback font option available as a dropdown menu in the user interface, rather than via a config file, to leave the choice to the end user.
Because choosing the fallback font is a matter of preference, the font we pick may not suit all users well.

If I implement this feature, I think I would have to implement these features.

For users:

  • Menu for users choice alternative application font setting.
  • User's selected application font setting storage (registry. setting file in AppData or application folder).
  • Option to run portably (Running as portable application).

For translators:

  • Alternative application font setting in language file.
  • Guidelines for translators to choice alternative application font setting (use Windows standard font, OS consideration, etc.).

To run application correctly:

  • Better application font choice on worst case.

Hmm, there are lot of work. I continue to consider feature and implementation.

Thanks.

@mon-jai
Copy link
Contributor

mon-jai commented Nov 16, 2023

It seems that it requires much more work than I expected :(

If we proceed with the current implementation, can I interpret the .lng files as language-specific configuration files? noMeiryoUI will look up a matching .lng file based on the system language and apply the fallback font defined in it.

Users can edit the corresponding .lng file if they want to define their own fallback font.

@mon-jai
Copy link
Contributor

mon-jai commented Nov 16, 2023

Some questions:

  • Would it be more user-friendly if we made use of a separate configuration file and looked up the matching .lng file if such a configuration file does not exist?

  • What happens if a character doesn't exist in both the base font and fallback font?
    For example, if you defined "Arial" as the base font and "Noto Sans JP" as the fallback font, which font would be used to render a Korean character?

I could help with the documentation. Thanks for your awesome work!

@mon-jai
Copy link
Contributor

mon-jai commented Nov 16, 2023

User's selected application font setting storage

Why do we need the name of the fallback font after the font setup operation has been completed?

@Tatsu-syo
Copy link
Owner Author

It seems that it requires much more work than I expected :(

If we proceed with the current implementation, can I interpret the .lng files as language-specific configuration files? noMeiryoUI will look up a matching .lng file based on the system language and apply the fallback font defined in it.

Users can edit the corresponding .lng file if they want to define their own fallback font.

I think again. And user can choice own No!! Meiryo UI user interface font better than translator's recommended font.
Reasons are below.

  • Translators has different favorite font. And if translator's recommended font confricted, I confuse to merge user interface font.
  • If user edit language file and unwanted items are edited, user might confuse.

I restore items about user interface in font settings language file.
And make user can choice user interface font.

@Tatsu-syo
Copy link
Owner Author

User's selected application font setting storage

Why do we need the name of the fallback font after the font setup operation has been completed?

If users run No!! Meiryo UI again, user can use No!! Meiryo UI their favorite font.
Situations are below.

  • Users test or want to change screen magnification ratio (example users working 4K 150% and change FHD in playing games.)
  • Users got better for user interface font and change to it.
  • Users wanted to test different font for user interface.I can't decide which is better font for user interface between Noto Sans serif series fonts (modern type face) and IPA series fonts (classical font face and pitch).

@Tatsu-syo
Copy link
Owner Author

I reconsidered.
On first start up, No!! Meiryo UI's application font is specified on language file.
And I add function to select application font.
Users choice own favorite font, application font setting are saved on application's folder.
On next start up, application uses user's application font setting.

@mon-jai
How about?

@mon-jai
Copy link
Contributor

mon-jai commented Jan 28, 2024

Thank you so much for your work.

Can I understand it this way?

  • The translator's recommended fallback font will be enabled by default.
  • Users can choose their own fallback font if they find the recommended fallback font unsuitable for them.
  • Applied font configurations will be stored in the application's folder. The next time the user launches the app, these configurations will be loaded automatically.

Some questions:

  • Can users choose to keep the system's fallback font instead?
  • What happens if a character doesn't exist in both the base font and fallback font? For example, if you defined "Arial" as the base font and "Noto Sans JP" as the fallback font, which font would be used to render a Korean character?

@Tatsu-syo
Copy link
Owner Author

@mon-jai

The translator's recommended fallback font will be enabled by default.
I decided not use translator's recommended fallback font.
Because if translator's favorite font are different, might be cause some confusion.

Users can choose their own fallback font if they find the recommended fallback font unsuitable for them.
Yes.

Applied font configurations will be stored in the application's folder. The next time the user launches the app, these configurations will be loaded automatically.
Yes.

Can users choose to keep the system's fallback font instead?
Yes.

What happens if a character doesn't exist in both the base font and fallback font? For example, if you defined "Arial" as the base font and "Noto Sans JP" as the fallback font, which font would be used to render a Korean character?
Windows has own font fallback mechanism. And if font don't have character, Windows uses own fallback character.
For example, Segoe UI don't have Japanese character, and if program try to draw Japanese character by Segoe UI, Windows use own fallback character Meiryo UI :( .

@Tatsu-syo
Copy link
Owner Author

There are no objections.
And I merge this PR.

@Tatsu-syo Tatsu-syo merged commit f20d3d2 into master Feb 3, 2024
@Tatsu-syo Tatsu-syo deleted the tatsu_20231112_font branch February 3, 2024 12:56
@mon-jai
Copy link
Contributor

mon-jai commented Feb 5, 2024

@Tatsu-syo That would be great. Thanks for your work.

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

Successfully merging this pull request may close these issues.

2 participants