Aetf / kmscon

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

Way to specify bold font #53

Closed knghtbrd closed 2 years ago

knghtbrd commented 2 years ago

Hi, I'm wondering if there's a way to specify font weight in the kmscon config or if this might be added. I tried e.g. Monospace Bold but this didn't do what I hoped it would. The average VTE GUI terminal has a bunch of knobs besides those. Not sure which ones are worth implementing and which aren't. Most people seem happy once they have font, size, and color schemes. In my case DPI too. In fact setting DPI was the only thing I had to set. using a bold font would just allow me to use a slightly smaller font comfortably.

Aetf commented 2 years ago

How exactly is Monospace Bold not working? With my limited knowledge with fontconfig and pango, as long as Monospace Bold ends up resolved to the bold version of the font you want, it should work. Didn't find anything that actively disables bold fonts with a quick glance in font_pango.c.

knghtbrd commented 2 years ago

It comes out the same as Monospace if unquoted. If quoted, I think I'm getting some weird fallback where characters aren't centered … looks very strange. I could try taking some Ye Olde Screenshots(e) the way we did it back in the 8 bit days.

Aetf commented 2 years ago

What do you get with fc-match -s 'Monospace Bold'?

Could also simply be an issue with the config file parser that chokes on whitespaces.

Or in the worst case, the bold font changes size calculation etc and that needs to be accounted for in rendering (unlikely though, kmscon already does bold font for individual characters correctly).

knghtbrd commented 2 years ago

I get rather a lot for fc-match -s 'Monospace Bold':

Vera.ttf: "Bitstream Vera Sans" "Roman"
DejaVuSans.ttf: "DejaVu Sans" "Book"
DejaVuSans-Bold.ttf: "DejaVu Sans" "Bold"
DejaVuSans-Oblique.ttf: "DejaVu Sans" "Oblique"
DejaVuSans-BoldOblique.ttf: "DejaVu Sans" "Bold Oblique"
Verdana.ttf: "Verdana" "Regular"
Arial.ttf: "Arial" "Regular"
n019003l.pfb: "Nimbus Sans L" "Regular"
NimbusSans-Regular.otf: "Nimbus Sans" "Regular"
fonts-japanese-gothic.ttf: "IPAGothic" "Regular"
wqy-microhei.ttc: "WenQuanYi Micro Hei" "Regular"
FreeSans.otf: "FreeSans" "Regular"
FreeMono.otf: "FreeMono" "Regular"
FreeSerif.otf: "FreeSerif" "Regular"
opens___.ttf: "OpenSymbol" "Regular"
FiraCode-Regular.ttf: "Fira Code" "Regular"
LinLibertine_R.otf: "Linux Libertine O" "Regular"
LinLibertine_DR.otf: "Linux Libertine Display O" "Regular"
LinLibertine_M.otf: "Linux Libertine Mono O" "Mono"
FontAwesome.otf: "FontAwesome" "Regular"
Quicksand-Regular.ttf: "Quicksand" "Regular"
MathJax_AMS-Regular.otf: "MathJax_AMS" "Regular"
MathJax_Fraktur-Regular.otf: "MathJax_Fraktur" "Regular"
MathJax_Main-Regular.otf: "MathJax_Main" "Regular"
MathJax_Size1-Regular.otf: "MathJax_Size1" "Regular"
MathJax_Typewriter-Regular.otf: "MathJax_Typewriter" "Regular"
MathJax_WinChrome-Regular.otf: "MathJax_WinChrome" "Regular"
MathJax_WinIE6-Regular.otf: "MathJax_WinIE6" "Regular"
NotoSansAdlam-Regular.ttf: "Noto Sans Adlam" "Regular"
NotoSansWarangCiti-Regular.ttf: "Noto Sans Warang Citi" "Regular"
Courier_New.ttf: "Courier New" "Regular"
texgyreadventor-regular.otf: "TeX Gyre Adventor" "Regular"
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
DejaVuSerif.ttf: "DejaVu Serif" "Book"
Roboto-Regular.ttf: "Roboto" "Regular"
NotoSansHanifiRohingya-Regular.ttf: "Noto Sans Hanifi Rohingya" "Regular"
NotoSansSoraSompeng-Regular.ttf: "Noto Sans Sora Sompeng" "Regular"
Lato-Regular.ttf: "Lato" "Regular"
NotoSansMono-Regular.ttf: "Noto Sans Mono" "Regular"
NotoNaskhArabicUI-Regular.ttf: "Noto Naskh Arabic UI" "Regular"
NotoSansArabic-Regular.ttf: "Noto Sans Arabic" "Regular"
NotoSansArmenian-Regular.ttf: "Noto Sans Armenian" "Regular"
texgyreschola-regular.otf: "TeX Gyre Schola" "Regular"
lmmono10-regular.otf: "Latin Modern Mono" "10 Regular"
lmsansquot8-regular.otf: "Latin Modern Sans Quotation" "8 Regular"
NotoSansCJK-Regular.ttc: "Noto Sans CJK JP" "Regular"
NotoSansNewa-Regular.ttf: "Noto Sans Newa" "Regular"
NotoSansSymbols2-Regular.ttf: "Noto Sans Symbols2" "Regular"
NotoSerifAhom-Regular.ttf: "Noto Serif Ahom" "Regular"
NotoSansBalinese-Regular.ttf: "Noto Sans Balinese" "Regular"
NotoSansMarchen-Regular.ttf: "Noto Sans Marchen" "Regular"
NotoSansOlChiki-Regular.ttf: "Noto Sans Ol Chiki" "Regular"
NotoSansOldHungarian-Regular.ttf: "Noto Sans Old Hungarian" "Regular"
NotoSansOldItalic-Regular.ttf: "Noto Sans Old Italic" "Regular"
NotoSansSharada-Regular.ttf: "Noto Sans Sharada" "Regular"
NotoSansTakri-Regular.ttf: "Noto Sans Takri" "Regular"
NotoSansTifinagh-Regular.ttf: "Noto Sans Tifinagh" "Regular"
NotoSansZanabazarSquare-Regular.ttf: "Noto Sans Zanabazar Square" "Regular"
NotoSerifGujarati-Regular.ttf: "Noto Serif Gujarati" "Regular"
NotoSerifKannada-Regular.ttf: "Noto Serif Kannada" "Regular"
NotoSerifSinhala-Regular.ttf: "Noto Serif Sinhala" "Regular"
NotoSansAvestan-Regular.ttf: "Noto Sans Avestan" "Regular"
NotoSansBengali-Regular.ttf: "Noto Sans Bengali" "Regular"
NotoSansBhaiksuki-Regular.ttf: "Noto Sans Bhaiksuki" "Regular"
NotoSansBrahmi-Regular.ttf: "Noto Sans Brahmi" "Regular"
NotoSansCaucasianAlbanian-Regular.ttf: "Noto Sans Caucasian Albanian" "Regular"
NotoSansChakma-Regular.ttf: "Noto Sans Chakma" "Regular"
NotoSansDevanagari-Regular.ttf: "Noto Sans Devanagari" "Regular"
NotoSansGeorgian-Regular.ttf: "Noto Sans Georgian" "Regular"
NotoSansGrantha-Regular.ttf: "Noto Sans Grantha" "Regular"
NotoSansGurmukhi-Regular.ttf: "Noto Sans Gurmukhi" "Regular"
NotoSansKaithi-Regular.ttf: "Noto Sans Kaithi" "Regular"
NotoSansKharoshthi-Regular.ttf: "Noto Sans Kharoshthi" "Regular"
NotoSansKhmer-Regular.ttf: "Noto Sans Khmer" "Regular"
NotoSansKhojki-Regular.ttf: "Noto Sans Khojki" "Regular"
NotoSansLao-Regular.ttf: "Noto Sans Lao" "Regular"
NotoSansLinearB-Regular.ttf: "Noto Sans Linear B" "Regular"
NotoSansMalayalam-Regular.ttf: "Noto Sans Malayalam" "Regular"
NotoSansMandaic-Regular.ttf: "Noto Sans Mandaic" "Regular"
NotoSansMath-Regular.ttf: "Noto Sans Math" "Regular"
NotoSansMeeteiMayek-Regular.ttf: "Noto Sans Meetei Mayek" "Regular"
NotoSansMiao-Regular.ttf: "Noto Sans Miao" "Regular"
NotoSansMongolian-Regular.ttf: "Noto Sans Mongolian" "Regular"
NotoSansMyanmar-Regular.ttf: "Noto Sans Myanmar" "Regular"
NotoSansNKo-Regular.ttf: "Noto Sans NKo" "Regular"
NotoSansNewTaiLue-Regular.ttf: "Noto Sans New Tai Lue" "Regular"
NotoSansSiddham-Regular.ttf: "Noto Sans Siddham" "Regular"
NotoSansSignWriting-Regular.ttf: "Noto Sans SignWriting" "Regular"
NotoSansSundanese-Regular.ttf: "Noto Sans Sundanese" "Regular"
NotoSansSylotiNagri-Regular.ttf: "Noto Sans Syloti Nagri" "Regular"
NotoSansSymbols-Regular.ttf: "Noto Sans Symbols" "Regular"
NotoSansTaiTham-Regular.ttf: "Noto Sans Tai Tham" "Regular"
NotoSansTelugu-Regular.ttf: "Noto Sans Telugu" "Regular"
NotoSansTirhuta-Regular.ttf: "Noto Sans Tirhuta" "Regular"
NotoSerifTangut-Regular.ttf: "Noto Serif Tangut" "Regular"
NotoSerifTibetan-Regular.ttf: "Noto Serif Tibetan" "Regular"
C-64-Regular.ttf: "C-64" "Regular"
NotoMusic-Regular.ttf: "Noto Music" "Regular"
NotoSansAnatolianHieroglyphs-Regular.ttf: "Noto Sans Anatolian Hieroglyphs" "Regular"
NotoSansBamum-Regular.ttf: "Noto Sans Bamum" "Regular"
NotoSansBassaVah-Regular.ttf: "Noto Sans Bassa Vah" "Regular"
NotoSansBatak-Regular.ttf: "Noto Sans Batak" "Regular"
NotoSansBuginese-Regular.ttf: "Noto Sans Buginese" "Regular"
NotoSansBuhid-Regular.ttf: "Noto Sans Buhid" "Regular"
NotoSansCarian-Regular.ttf: "Noto Sans Carian" "Regular"
NotoSansCham-Regular.ttf: "Noto Sans Cham" "Regular"
NotoSansCherokee-Regular.ttf: "Noto Sans Cherokee" "Regular"
NotoSansCoptic-Regular.ttf: "Noto Sans Coptic" "Regular"
NotoSansCuneiform-Regular.ttf: "Noto Sans Cuneiform" "Regular"
NotoSansCypriot-Regular.ttf: "Noto Sans Cypriot" "Regular"
NotoSansDeseret-Regular.ttf: "Noto Sans Deseret" "Regular"
NotoSansDuployan-Regular.ttf: "Noto Sans Duployan" "Regular"
NotoSansEgyptianHieroglyphs-Regular.ttf: "Noto Sans Egyptian Hieroglyphs" "Regular"
NotoSansElbasan-Regular.ttf: "Noto Sans Elbasan" "Regular"
NotoSansEthiopic-Regular.ttf: "Noto Sans Ethiopic" "Regular"
NotoSansGlagolitic-Regular.ttf: "Noto Sans Glagolitic" "Regular"
NotoSansHatran-Regular.ttf: "Noto Sans Hatran" "Regular"
NotoSansImperialAramaic-Regular.ttf: "Noto Sans Imperial Aramaic" "Regular"
NotoSansIndicSiyaqNumbers-Regular.ttf: "Noto Sans Indic Siyaq Numbers" "Regular"
NotoSansInscriptionalPahlavi-Regular.ttf: "Noto Sans Inscriptional Pahlavi" "Regular"
NotoSansInscriptionalParthian-Regular.ttf: "Noto Sans Inscriptional Parthian" "Regular"
NotoSansJavanese-Regular.ttf: "Noto Sans Javanese" "Regular"
NotoSansKhudawadi-Regular.ttf: "Noto Sans Khudawadi" "Regular"
NotoSansLepcha-Regular.ttf: "Noto Sans Lepcha" "Regular"
NotoSansLimbu-Regular.ttf: "Noto Sans Limbu" "Regular"
NotoSansLinearA-Regular.ttf: "Noto Sans Linear A" "Regular"
NotoSansLycian-Regular.ttf: "Noto Sans Lycian" "Regular"
NotoSansLydian-Regular.ttf: "Noto Sans Lydian" "Regular"
NotoSansMahajani-Regular.ttf: "Noto Sans Mahajani" "Regular"
NotoSansManichaean-Regular.ttf: "Noto Sans Manichaean" "Regular"
NotoSansMendeKikakui-Regular.ttf: "Noto Sans Mende Kikakui" "Regular"
NotoSansMeroitic-Regular.ttf: "Noto Sans Meroitic" "Regular"
NotoSansModi-Regular.ttf: "Noto Sans Modi" "Regular"
NotoSansMro-Regular.ttf: "Noto Sans Mro" "Regular"
NotoSansMultani-Regular.ttf: "Noto Sans Multani" "Regular"
NotoSansNabataean-Regular.ttf: "Noto Sans Nabataean" "Regular"
NotoSansOldNorthArabian-Regular.ttf: "Noto Sans Old North Arabian" "Regular"
NotoSansOldPermic-Regular.ttf: "Noto Sans Old Permic" "Regular"
NotoSansOldSogdian-Regular.ttf: "Noto Sans Old Sogdian" "Regular"
NotoSansOldSouthArabian-Regular.ttf: "Noto Sans Old South Arabian" "Regular"
NotoSansOldTurkic-Regular.ttf: "Noto Sans Old Turkic" "Regular"
NotoSansOsage-Regular.ttf: "Noto Sans Osage" "Regular"
NotoSansPahawhHmong-Regular.ttf: "Noto Sans Pahawh Hmong" "Regular"
NotoSansPalmyrene-Regular.ttf: "Noto Sans Palmyrene" "Regular"
NotoSansPauCinHau-Regular.ttf: "Noto Sans Pau Cin Hau" "Regular"
NotoSansPhagsPa-Regular.ttf: "Noto Sans PhagsPa" "Regular"
NotoSansPsalterPahlavi-Regular.ttf: "Noto Sans Psalter Pahlavi" "Regular"
NotoSansRejang-Regular.ttf: "Noto Sans Rejang" "Regular"
NotoSansRunic-Regular.ttf: "Noto Sans Runic" "Regular"
NotoSansSamaritan-Regular.ttf: "Noto Sans Samaritan" "Regular"
NotoSansSaurashtra-Regular.ttf: "Noto Sans Saurashtra" "Regular"
NotoSansShavian-Regular.ttf: "Noto Sans Shavian" "Regular"
NotoSansSogdian-Regular.ttf: "Noto Sans Sogdian" "Regular"
NotoSansSoyombo-Regular.ttf: "Noto Sans Soyombo" "Regular"
NotoSansTagalog-Regular.ttf: "Noto Sans Tagalog" "Regular"
NotoSansTagbanwa-Regular.ttf: "Noto Sans Tagbanwa" "Regular"
NotoSansTaiViet-Regular.ttf: "Noto Sans Tai Viet" "Regular"
NotoSansWancho-Regular.ttf: "Noto Sans Wancho" "Regular"
NotoSansYi-Regular.ttf: "Noto Sans Yi" "Regular"
Carlito-Regular.ttf: "Carlito" "Regular"
GenBasR.ttf: "Gentium Basic" "Regular"
LinBiolinum_R.otf: "Linux Biolinum O" "Regular"
STIX-Regular.otf: "STIX" "Regular"
Gentium-R.ttf: "Gentium" "Regular"
glyphicons-halflings-regular.ttf: "GLYPHICONS Halflings" "Regular"
NotoSansMasaramGondi-Regular.ttf: "Noto Sans Masaram Gondi" "Regular"
NotoSerifDogra-Regular.ttf: "Noto Serif Dogra" "Regular"
wasy10.ttf: "wasy10" "LyX"
NotoSansGunjalaGondi-Regular.ttf: "Noto Sans Gunjala Gondi" "Regular"
NotoSansNushu-Regular.ttf: "Noto Sans Nushu" "Regular"
NotoSansMedefaidrin-Regular.ttf: "Noto Sans Medefaidrin" "Regular"
NotoSansTamilSupplement-Regular.ttf: "Noto Sans Tamil Supplement" "Regular"
NotoLoopedLao-Regular.ttf: "Noto Looped Lao" "Regular"
NotoLoopedThai-Regular.ttf: "Noto Looped Thai" "Regular"
NotoSansElymaic-Regular.ttf: "Noto Sans Elymaic" "Regular"
NotoSerifNyiakengPuachueHmong-Regular.ttf: "Noto Serif Hmong Nyiakeng" "Regular"
NotoSerifYezidi-Regular.ttf: "Noto Serif Yezidi" "Regular"
pcrr8a.pfb: "Courier" "Regular"
s050000l.pfb: "Standard Symbols L" "Regular"
Symbola_hint.ttf: "Symbola" "Regular"
texgyrechorus-mediumitalic.otf: "TeX Gyre Chorus" "Regular"
Tuffy.ttf: "Tuffy" "Regular"
LinLibertine_RZ.otf: "Linux Libertine O" "Semibold"
MathJax_Fraktur-Bold.otf: "MathJax_Fraktur" "Bold"
LinBiolinum_RB.otf: "Linux Biolinum O" "Bold"
STIX-Bold.otf: "STIX" "Bold"
LinBiolinum_K.otf: "Linux Biolinum Keyboard O" "Regular"
LinLibertine_RI.otf: "Linux Libertine O" "Italic"
STIX-Italic.otf: "STIX" "Italic"
LinLibertine_RZI.otf: "Linux Libertine O" "Semibold Italic"
STIX-BoldItalic.otf: "STIX" "Bold Italic"
NotoColorEmoji.ttf: "Noto Color Emoji" "Regular"
Webdings.ttf: "Webdings" "Regular"
Aetf commented 2 years ago

This is a sorted list of fonts matching "Monospace Bold". Looks like the top choices in the list aren't even monospaced fonts at all. That explains the spacing issue you see.

Try fc-match -s 'monospace:bold', or use directly the name of the font you want, e.g. fc-match -s 'DejaVu Sans Mono:bold'. And also use that in kmscon's config.

See https://man.archlinux.org/man/fonts-conf.5#FONT_NAMES

knghtbrd commented 2 years ago

Oh, that's a good point! I saw Bitstream Vera Sans and failed to realize that's the proportional version of the font. So probably it's using that when it cannot find a match.

Using monospace:bold for the fc-match does return a more useful result. In fact the one I would prefer:

VeraMoBd.ttf: "Bitstream Vera Sans Mono" "Bold"
PowerlineSymbols.otf: "PowerlineSymbols" "Medium"
DejaVuSansMono-Bold.ttf: "DejaVu Sans Mono" "Bold"
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
DejaVuSansMono-Oblique.ttf: "DejaVu Sans Mono" "Oblique"
Inconsolata.otf: "Inconsolata" "Medium"
Andale_Mono.ttf: "Andale Mono" "Regular"
Courier_New_Bold.ttf: "Courier New" "Bold"
   :

However:

font-dpi=213
font-engine=pango
font-name=Monospace:bold
font-size=14
hwaccel

Results in the same broken display.

IMG_20220715_033106

That's what it looked like before, so I assume I'm looking at Bitstream Vera Sans (not Mono), and also not bold weight.

Yes, 213 DPI. Legally blind and a really big, high resolution screen. I was forced ("forced" 😁) to upgrade my graphics card a little to properly drive it. As you can see, I'm running this on Debian sid, which has configured kmscon to run getty (because running login directly means backspace doesn't work, /etc/issue isn't displayed, etc.) and has a potentially handy fallback to run getty without kmscon should kmscon fail to start. No protection against it starting with slightly screwy fonts, of course.

knghtbrd commented 2 years ago

Otherwise, following this gist looks … well, actually it looks like the "bug" shown in comments, but it looks otherwise in mate-terminal so it's a VTE bug, not a kmscon bug. If "a" goal of kmscon was unlocking the color limitations, I'd say that's accomplished nicely.

IMG_20220715_034942_1

A way to specify a bold font for me is more of a want than a specific need for the time being. Like many of us, I grew up color substituting for proper bold on VGA text screens, so I'm quite used to that. Plus, using a boldface font allows me the opportunity to use a bit smaller font and not need to constantly devote the full screen to a terminal. That's less of an issue here since a VT is always going to be fullscreen and 33 lines is plenty. I don't need to run at 12 like I do in the GUI, even if I'd like to.

Here's a mate-terminal using Monospace Bold 12 for comparison.

IMG_20220715_040133_1

That's 172x36 fullscreen, which would be great for vimdiff … so if you can make it possible to do it without tearing your hair out or adding massive bloat, I'd certainly appreciate it.

Aetf commented 2 years ago

It turns kmscon already keeps two versions of the specified font for rendering: https://github.com/Aetf/kmscon/blob/develop/src/kmscon_terminal.c#L239-L252

Making it allow bold base font would be quite a lot of change of the logic. So sorry I'm going to mark this as won't fix.

Unrelated to this, but the blank line is a bug in the 24 bit color script itself, see https://gist.github.com/lifepillar/09a44b8cf0f9397465614e622979107f?permalink_comment_id=3899463#gistcomment-3899463 I can see full colors in kmscon after fixing that.