derf / feh

a fast and light image viewer
https://feh.finalrewind.org
Other
1.54k stars 159 forks source link

feh doesn't display Chinese chars correctly #518

Open ri-aje opened 4 years ago

ri-aje commented 4 years ago

hi, when I use --draw-filename or %F, feh gives me a bunch of boxes for filenames with Chinese chars. same happens to Japanese chars, so maybe it's a general issue with unicode chars? anyone knows how to make it work? thanks.

Ferada commented 4 years ago

Yeah you need a font that has the characters, e.g. feh -C /usr/share/fonts/truetype/unifont -e unifont/12 --draw-filename ... renders for me (that's from ttf-unifont on Debian/Ubuntu/...; not the prettiest, but it at least works).

ri-aje commented 4 years ago

@Ferada thanks. that worked. then hit another issue, which is the not-pretty part. how do I instruct feh to use two fonts? i.e., display with a primary font and only fall back to the secondary when the primary font doesn't have certain chars.

in my case, I have one font that I like its English chars and the other its Chinese chars. let's call them E.ttf and C.ttf for example. judging from the effects, I believe E.ttf doesn't have Chinese chars and that's why feh renders boxes with it, and C.ttf has both English and Chinese chars but I don't like its English chars. I am hoping for something like feh -C font/folder/ -e E.ttf/12 -e C.ttf/12 --draw-filename, but it looks like command will use the last -e flag, i.e., C.ttf/12, for everything.

on my terminal (terminator 1.91), if I just pick E.ttf, it is able to render CJK chars with some acceptable font (I don't know which font it's using for that). can feh do something similar?

Ferada commented 1 year ago

As far as I know, no, taking a look at what the underlying library Imlib2 offers, it's simply one font selected, that's it. For the font selection mechanism you'd want, you'd need a library that e.g. uses fontconfig.