f3d-app / f3d

Fast and minimalist 3D viewer.
https://f3d.app
BSD 3-Clause "New" or "Revised" License
2.58k stars 182 forks source link

Default font does not support Unicode #1016

Open Meakk opened 9 months ago

Meakk commented 9 months ago

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:

F3D Information 2.2 RC2

mwestphal commented 9 months ago

not windows specific

mwestphal commented 9 months ago

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

mwestphal commented 9 months ago

more info here.

Ni-g-3l commented 7 months ago

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.

mwestphal commented 7 months ago

good point, that is probably a possible fix.

Ni-g-3l commented 7 months ago

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

mwestphal commented 7 months ago

Ok!

Watch out, this may not be as simple as it looks like, here is what is neede imo:

snoyer commented 7 months ago

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.

mwestphal commented 7 months ago

You are very probably right @snoyer

snoyer commented 7 months ago

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

Ni-g-3l commented 7 months ago

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 :

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

mwestphal commented 7 months ago

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

Meakk commented 7 months ago

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

Meakk commented 7 months ago

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?

mwestphal commented 7 months ago

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 commented 7 months ago

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