Aetf / kmscon

Linux KMS/DRM based virtual Console Emulator
http://www.freedesktop.org/wiki/Software/kmscon
Other
186 stars 25 forks source link

Display of unicode-test.txt has error in some glyphs #11

Closed plntyk closed 6 years ago

plntyk commented 6 years ago

docs/unicode-test.txt Line 3, first 13 symbols for example are internally rendered bigger and then some small part of that rendered glyph is displayed: like some edge of a circle/square on other symbols (like emojis)

since kmscon uses Pango i checked in KDE, xfce4-terminal with

pango-view --text="♉♊♋♌♍♎♏♐♑♒" --font="DejaVu Sans Mono"

Result: color emoji due to font replacement/missing glyphs (?) and correct size with font - rending by default should be cairo However

pango-view --backend=ft2 --text="♉a♊s♋d♌f♍♎♏♐♑♒" --font="DejaVu Sans Mono"

Result: larger black/white glyphs (similar to parts displayed in kmscon) but complete symbols but different symbol and "normal" font size.

/etc/kmscon/kmscon.conf 
font-name=DejaVu Sans Mono
font-size=16
vt=5
no-switchvt

beside some glyphs of docs/unicode-test.txt the following emojis exhibit the problem too for example:

😀😂🙀😈😇😤🙌🙈🙏

According to kmscon docs it uses freetype2 so it might be some issue with different fonts from that side? Also, this might be "duplicate" of https://github.com/dvdhrm/kmscon/issues/133

System: Arch Linux, Intel HD4000 integrated in CPU i7-3770

Aetf commented 6 years ago

Hmm.... emoji font issues again. These little things never work correctly for me :/

According to kmscon docs it uses freetype2 so it might be some issue with different fonts from that side?

It's indeed possible this is caused by some misconfiguration in freetype2. Rendering docs/unicode-test.txt with pango-view + ft2 also shows incorrect results, for example the "other symbols" section. And there shouldn't be much special configuration done in kmscon.

Anyway, I need to investigate more into this mess. But I'm definitely not a guru in font rendering...

plntyk commented 6 years ago

Done some additional testing with pango-view, ft2 and cairo backends, some fontconfig changes: like custom FONTCONFIG_FILE=fonts.conf `FONTCONFIG_PATH=./ pango-view ........ using FC_DEBUG=<number> show that pango-view cairo backend can show "wrong" sizes if one disables/remove /etc/fonts/conf.d/10-scale-bitmap-fonts.conf IIRC the font-cache should be cleaned too between tests to make sure.

Using the shortcuts of kmscon --grab-zoom-in <grab> [<Ctrl>Plus] Shortcut to increase font size shows complete bitmap symbols on a ridiculous font-size.

For test/scripting notice that 'pango-view' can output to a picture file.

So "new" bitmap-fonts -- those that might have "CBDT Data Tables" in them -- and their scaling seems to be the culprit. Those color/picture fonts are probably going to stay and are developed even further: Colorfonts Checking of emoji/symbol content of a font was done with program "gucharmap" with setting "Only show glyph of this font"

Temporary "workaround" but with some bugs in character width too: use Symbola Font. The Symbola Font is a more "normal" font and has exotic symbols and emojis like 🦖 but the Symbola raptor is incomplete too on : only the left half of the glyph is displayed.

Aetf commented 6 years ago

Okay. So if I understand correctly, this is caused by some bitmap fonts not having correct scaling information with them? So it's not a bug in kmscon.

the Symbola raptor is incomplete too on : only the left half of the glyph is displayed.

This might be a separate issue about the character width and which wcwidth implementation your shell and kmscon is using. See Aetf/libtsm#1.

I'm closing the issue and adding a wiki page documenting this. Feel free to add more to the wiki if you find out more :)

plntyk commented 6 years ago

I extended documentation on unicode, colored glyphs, colored fonts and font formats and some test/bug issues in the wiki.

Aetf commented 6 years ago

@plntyk Thank you so much!