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

Detect and use system fonts for extended language support #530

Closed
Stoppedpuma opened this issue Dec 1, 2024 · 5 comments
Closed

Detect and use system fonts for extended language support #530

Stoppedpuma opened this issue Dec 1, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@Stoppedpuma
Copy link
Collaborator

Most non-english characters fail to be recognised and instead load a missing unicode. Checking for system installed fonts could be a work around to this.

image

@Stoppedpuma Stoppedpuma added the enhancement New feature or request label Dec 1, 2024
@woelper
Copy link
Owner

woelper commented Dec 2, 2024

This is rather easy to fix but will increase binary size. I am thinking of Japanese, Korean, Chinese, Arabic, are you missing anything in particular?

@Stoppedpuma
Copy link
Collaborator Author

Stoppedpuma commented Dec 2, 2024

Nothing in particular from my end, I think those four would be a good start and cover a good portion. Accented letters and cyrillics seem to be covered in my testing so this covers a good majority if the above are added as well.

On the binary size increasing part, is checking against system installed fonts not an option? This implementation could also be used in the future for text annotations.

@woelper
Copy link
Owner

woelper commented Dec 2, 2024

There is an interesting thread here:
emilk/egui#1344
This is not directly possible with egui, so we'd have to balance either using system fonts and external libraries and deal with it on every platform against larger binary size.

@Stoppedpuma
Copy link
Collaborator Author

Stoppedpuma commented Dec 2, 2024

Lets go for your suggestion then!

Regarding interfacing with annotations:

It seems to be possible to manually load a system font according to a user in that thread:

let font = std::fs::read("c:/Windows/Fonts/msyh.ttc").unwrap();
fonts.font_data.insert(
    "my_font".to_owned(),
    egui::FontData::from_owned(font)
);

How we could handle text annotations in the future is we can either choose to have the option for the user to select a font, or just use the default font and exclude this option entirely. Assuming we want to allow users to have font options, this could be achieved by a fonts folder in the oculante directory so that it's portable and can be chosen in a drop down, "exposing" the above to the user. UX wise this also allows remembering the last font used state which may be something desired?

Slightly off-topic but perhaps we use the "fonts" folder idea with favourite images as well by creating a copy or if possible a hardlink? This should definitely be a toggle though since it can take up a lot more storage than a few fonts, and some may not be using oculante portably.

@Stoppedpuma Stoppedpuma moved this to In progress in Oculante Release Plan Dec 23, 2024
@Stoppedpuma Stoppedpuma added this to the 0.9.2 milestone Dec 23, 2024
@Stoppedpuma Stoppedpuma changed the title Most non-english characters are missing Detect and use system fonts for extended language support Jan 11, 2025
@Stoppedpuma Stoppedpuma modified the milestones: 0.9.2, 0.9.3 Jan 11, 2025
@Stoppedpuma
Copy link
Collaborator Author

Related to #603, should be closed when addressed.

@github-project-automation github-project-automation bot moved this from In progress to Complete in Oculante Release Plan Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Complete
Development

No branches or pull requests

2 participants