Default font does not support Unicode
Describe the bug The default font should support Unicode characters.
To Reproduce Steps to reproduce the behavior:
- Open the file using
f3d -n f3d\testing\data\(ノಠ益ಠ )ノ.vtp
Expected behavior
Supports Unicode characters in the file name actor and the title bar.
System Information:
- OS: Windows
F3D Information 2.2 RC2
not windows specific
duplicate of https://github.com/f3d-app/f3d/issues/42
more info here.
Hello !
I found on many website that VTK support only ASCII character, and the only way to fix this is to modify default font used, by a font which embed Unicode character.
good point, that is probably a possible fix.
I you want I can make some tests this week :)
Ok!
Watch out, this may not be as simple as it looks like, here is what is neede imo:
- Add a default font (with a free license) that support unicode in the resources
- Change the default font by using the dedicated font option (check the libf3d doc)
- Point to a location that works when building, installing and packaging F3D
- Update all baselines that displays text
- Ideally the font should be the same one we use with added unicode char, but this may not exist
Feel free to reach out on discord for help!
The window title being garbled on the original screenshot is a likely a separate encoding related issue as the OS (window manager?) should be able to display utf8 regardless of VTK's font choices.
You are very probably right @snoyer
I tried some random greek to start easier (better font support/coverage than the japanese+indian+chinese from the original case) by doing cp ../testing/data/\(ノಠ益ಠ\ \)ノ.vtp "/tmp/Γειά σας.vtp" and used the DejaVu font from Fedora:
- gnome-terminal's and Firefox's titles are ok
- F3D's title is not ok
- F3D's text actor is ok as DejaVu has the greek glyphs
Hello,
I tried a bunch of fonts which says that it supports Unicode. However only one is working for this type of CJK char.
Fonts :
- Droid Sans
- Droid Sans Fallback
- Noto
- Free Sans
- Roboto
- Deja Vu Sans
- Liberation Sans
- Arial Unicode MS (Screen bellow)
I added some greek char to test both alphabet. However I cann't find if we can embed Arial Unicode MS to F3D I can't find the license ..
Turns out its not that simple: https://stackoverflow.com/questions/3370512/font-equivalent-to-arial-unicode-ms
We have a thread currently about it on discord, wanna chat ? https://discord.com/channels/1046005690809978911/1179418393846231050
Title bar on Windows fixed here: https://gitlab.kitware.com/vtk/vtk/-/merge_requests/10737
Yes, Arial font requires a license, unfortunately.
It seems like it's possible to merge several Noto fonts: https://github.com/notofonts/nototools/blob/main/nototools/merge_fonts.py
To start, maybe we should try to merge NotoSans-Regular.ttf, NotoSansPhoenician-Regular.ttf (greek probably?) and all NotoSansCJKXX-Regular.otf and see if it works?
The title bar has been fixed by #1090 and will be available in the next release. The text actor will not be fixed because we cannot ship a 50 mb font and VTK cannot fallback on system font. Should we close this @Meakk ?
Title bar is still broken on some linux desktop env, so we can consider investigating that too.
FYI this is not fixed yet.
You could potentially use GNU Unifont which is considerably smaller but covers most planes with a single otf font and The GNU Font Embedding Exception and the SIL OFL allow for embedding into anything