f3d icon indicating copy to clipboard operation
f3d copied to clipboard

Default font does not support Unicode

Open Meakk opened this issue 2 years ago • 18 comments

Describe the bug The default font should support Unicode characters.

To Reproduce Steps to reproduce the behavior:

  1. Open the file using f3d -n f3d\testing\data\(ノಠ益ಠ )ノ.vtp

image

Expected behavior

Supports Unicode characters in the file name actor and the title bar.

System Information:

  • OS: Windows

F3D Information 2.2 RC2

Meakk avatar Sep 30 '23 20:09 Meakk

not windows specific

mwestphal avatar Sep 30 '23 22:09 mwestphal

duplicate of https://github.com/f3d-app/f3d/issues/42

mwestphal avatar Oct 01 '23 06:10 mwestphal

more info here.

mwestphal avatar Oct 01 '23 06:10 mwestphal

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.

Ni-g-3l avatar Nov 28 '23 18:11 Ni-g-3l

good point, that is probably a possible fix.

mwestphal avatar Nov 28 '23 19:11 mwestphal

I you want I can make some tests this week :)

Ni-g-3l avatar Nov 28 '23 20:11 Ni-g-3l

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!

mwestphal avatar Nov 29 '23 08:11 mwestphal

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.

snoyer avatar Nov 29 '23 12:11 snoyer

You are very probably right @snoyer

mwestphal avatar Nov 29 '23 13:11 mwestphal

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:

f3d-utf8

  • 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

snoyer avatar Nov 29 '23 13:11 snoyer

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) image

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 ..

Ni-g-3l avatar Dec 03 '23 13:12 Ni-g-3l

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

mwestphal avatar Dec 03 '23 17:12 mwestphal

Title bar on Windows fixed here: https://gitlab.kitware.com/vtk/vtk/-/merge_requests/10737

Meakk avatar Dec 04 '23 09:12 Meakk

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?

Meakk avatar Dec 04 '23 09:12 Meakk

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 ?

mwestphal avatar Dec 08 '23 08:12 mwestphal

Title bar is still broken on some linux desktop env, so we can consider investigating that too.

mwestphal avatar Dec 08 '23 08:12 mwestphal

FYI this is not fixed yet.

mwestphal avatar Dec 17 '24 19:12 mwestphal

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

incompetentcoder avatar Oct 20 '25 04:10 incompetentcoder