LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   xterm and -fa (https://www.linuxquestions.org/questions/slackware-14/xterm-and-fa-4175669425/)

joenew 02-12-2020 04:08 AM

xterm and -fa
 
Hi all, I noticed I can't change xterm font to any TTF font, like "Dejavu Sans Mono" or "Hack".
Those fonts are installed and fc-list report them:
Code:

fc-list|grep TTF|grep -i "Hack\|DejaVuSansMono"|sort
/usr/share/fonts/TTF/DejaVuSansMono-Bold.ttf: DejaVu Sans Mono:style=Bold
/usr/share/fonts/TTF/DejaVuSansMono-BoldOblique.ttf: DejaVu Sans Mono:style=Bold Oblique
/usr/share/fonts/TTF/DejaVuSansMono-Oblique.ttf: DejaVu Sans Mono:style=Oblique
/usr/share/fonts/TTF/DejaVuSansMono.ttf: DejaVu Sans Mono:style=Book
/usr/share/fonts/TTF/Hack-Bold.ttf: Hack:style=Bold
/usr/share/fonts/TTF/Hack-BoldItalic.ttf: Hack:style=Bold Italic
/usr/share/fonts/TTF/Hack-Italic.ttf: Hack:style=Italic
/usr/share/fonts/TTF/Hack-Regular.ttf: Hack:style=Regular

xterm version is the one shipped with slackware-current, and should be compiled with truetype fonts support:
Code:

$ xterm -v
X.Org 7.7.0(353)

$ ldd /usr/bin/xterm |grep "freetype\|fontconfig"
        libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x00007f085a28a000)
        libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x00007f085a1ce000)

I can also use "Hack" font in "suckless st" terminal both via .Xresources, but also by command line:

Code:

st -f  Hack:pixelsize=20:antialias=true:autohint=true
Code:

~/.Xresources

st.font:        Hack:pixelsize=20:antialias=true:autohint=true

Any idea why launching xterm with font Hack or DejaVu Sans Mono doesn't work?
Thanks in advance!

GazL 02-12-2020 04:59 AM

slackware-current's xterm uses bitmapped fonts by default╣.
Try setting XTerm.vt100.renderFont: true in your user's Xresources, or edit /etc/X11/app-defaults/XTerm

You can also override it with the -xrm option on the command-line, e.g.:
Code:

xterm -xrm 'XTerm.vt100.renderFont: true' -fa monospace-16

╣ Using bitmapped fonts allows xterm to support Double Height Characters, which is why I like it configured this way, but each to their own.

Petri Kaukasoina 02-12-2020 05:13 AM

You could restore the upstream defaults:
Code:

cp /etc/X11/app-defaults/XTerm.upstream.default /etc/X11/app-defaults/XTerm

GazL 02-12-2020 05:19 AM

Yes, that works too. I should have mentioned that. Thanks Petri

joenew 02-12-2020 08:20 AM

1 Attachment(s)
Quote:

Originally Posted by GazL (Post 6089033)
slackware-current's xterm uses bitmapped fonts by default.

Ok, thanks for your answers folks!

I just copied my Xresources from slackware stable 14.2, where it seems to work fine, I doesn't usually use xterm, so maybe I don't well remember.
Anyway, I've copied a Xresource that apply the "Solarized" color scheme.
It was generic not specific for for xterm:
Code:

*background:              S_base03
*foreground:              S_base0
*fading:                  40

I attached it after latest touches, it seems working now: solarized theme, and faceName regularly defined to Hack font.
It works only if ".vt100." "class" is specified:
The following aren't working
Code:

XTerm*renderFont: true
XTerm*faceName: xft:DejaVu Sans Mono:style=Book
XTerm*faceSize: 16

Instead here below a config that works fine
Code:

XTerm.vt100.renderFont: true
XTerm.vt100.faceName: Hack:style=Regular
XTerm.vt100.faceSize: 18

Why "vt100" specification does the trick?



Are the Xresources "generic" (XTerm*fooBar: value) settings are overwritten by the vt100 specific of global XTerm default in /etc/X11 ?
Code:

$ sed -n '/^XTerm.vt100/p' /etc/X11/app-defaults/XTerm
XTerm.vt100.metaSendsEscape: true
XTerm.vt100.bellIsUrgent: true
XTerm.vt100.renderFont: false
XTerm.vt100.font: -*-terminus-medium-r-normal-*-20-*-*-*-*-*-iso10646-1
XTerm.vt100.font1: -*-terminus-medium-r-normal-*-12-*-*-*-*-*-iso10646-1
XTerm.vt100.font2: -*-terminus-medium-r-normal-*-14-*-*-*-*-*-iso10646-1
XTerm.vt100.font3: -*-terminus-medium-r-normal-*-16-*-*-*-*-*-iso10646-1
XTerm.vt100.font4: -*-terminus-medium-r-normal-*-20-*-*-*-*-*-iso10646-1
XTerm.vt100.font5: -*-terminus-medium-r-normal-*-24-*-*-*-*-*-iso10646-1
XTerm.vt100.font6: -*-terminus-medium-r-normal-*-32-*-*-*-*-*-iso10646-1
XTerm.vt100.faceName: monospace
XTerm.vt100.faceSize: 14.0

Shouldn't be the opposite?

GazL 02-12-2020 08:31 AM

More specific resource specifications take precedence over those specified using wildcards. So the fully qualified ones in the app-defaults will always take precedence over wildcarded ones supplied by the user.

One might argue that it's a good idea to always use wildcards in the app-defaults file to allow for then to be overwritten by wildcarded resources.

joenew 02-12-2020 11:08 AM

Ok, thanks again for reply.
I have some other questions about terminals, xterm, st and also GNU screen.. But I'll open a topic for that.
Here I'd just conclude reporting this instruction I added to .Xresources:

Code:

XTerm.termName: xterm-256color
Could that be a good idea for enabling 256 colors support?

GazL 02-12-2020 11:11 AM

Yes, that's a good choice of $TERM when using xterm.


All times are GMT -5. The time now is 07:26 AM.