You are not logged in.

#1 2023-02-16 03:09:38

k395
Member
Registered: 2020-01-29
Posts: 37

Xterm font substitution does not work?

I'm using xterm, with the following default setting in .Xresources:

XTerm.vt100.faceName: DejaVu Sans Mono
XTerm.vt100.faceSize: 9

which displays the text in the terminal in that font.

However, the font does not have some characters such as ?, so I want to substitute it with some different font.

Using askubuntu.com/q/27598 I check which font contains the characters:

fc-list ":charset=0x1d54f"

and get that DejaVu Sans contains it.

I try to follow Arch Wiki https://wiki.archlinux.org/title/Font_c … back_fonts to setup a fallback font

<alias>
    <family>DejaVu Sans Mono</family>
    <prefer>
        <family>DejaVu Sans</family>
    </prefer>
</alias>

but the character just show up as blank in xterm.

Did I misunderstand anything?

Looking at the wiki page for XTerm https://wiki.archlinux.org/title/Xterm#Fonts I don't see any good explanation.

Offline

#2 2023-02-16 04:07:12

teckk
Member
Registered: 2013-02-21
Posts: 586

Re: Xterm font substitution does not work?

I don't require much from xterm.

I have

XTerm*faceName: Monospace
XTerm*faceSize:  14

Gives me

abcdefghijklmnopqrstuvwxyz!@#$%^&*()-|\_+1234567890<>,.?/"':;~`

Offline

#3 2023-02-16 07:22:59

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,390

Re: Xterm font substitution does not work?

FC_DEBUG=4 pango-view --font="DejaVu Sans Mono" -t "?" | grep family:

resolves the glyph from "DejaVu Math TeX Gyre" for me.

Are you maybe using https://archlinux.org/packages/communit … javu-nerd/ ?

Otherwise some sanity checks:

xrdb -q | grep -i face
locale

Can you copy & paste either ? or ü into the xterm?

Offline

#4 2023-02-16 07:37:47

k395
Member
Registered: 2020-01-29
Posts: 37

Re: Xterm font substitution does not work?

Re-reading the original post I realize that the forum does not render the character "?" correctly, it becomes a question mark. It's supposed to be "MATHEMATICAL DOUBLE-STRUCK CAPITAL X" i.e. Unicode 0x1d54f.

Using the pango-view command shows the character correctly, showing the family as "DejaVu Sans". Meanwhile using it to show "?" (the actual question mark character) or "ü" results in the correct font (DejaVu Sans Mono) being used, because the font does have that character and I have the font installed.

Pacman gives

ttf-dejavu 2.37+18+g9b5d1b2f-3

so it isn't the case.

One more detail, in case it helps: if I use it to show the "?" character (MATHEMATICAL BOLD SMALL A, 0x1d41a) then it occasionally shows, but only at some font sizes; in other font sizes it's blanked out. pango-view gives         family: "DejaVu Math TeX Gyre".

Last edited by k395 (2023-02-16 07:39:41)

Offline

#5 2023-02-16 07:56:42

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,390

Re: Xterm font substitution does not work?

if I use it to show the "?" character (MATHEMATICAL BOLD SMALL A, 0x1d41a) then it occasionally shows, but only at some font sizes; in other font sizes it's blanked out

That's because it's a variable width glyph while xterm (as pretty much every TE) renders in a fixed width box.
The consequence is that some glyphs will be too small, others too big and TEs deal w/ that by either clamping or overflowing. The result is never pretty.

Eg. urxvt doesn't use the fontconfig substitution and allows you to specify a font cascade w/ different sizes (ie. I'd eg. got a default 9pt and set DVMTG to 7pt to make sure it fits; there're also patached versions in the AUR w/ specific code to deal w/ wide characters momre automatically.

Offline

#6 2023-02-16 08:11:18

k395
Member
Registered: 2020-01-29
Posts: 37

Re: Xterm font substitution does not work?

I realize that issue (for example when it works, the bold m (0x1d426) is truncated and looks like bold n instead), but anyway the issue here is that sometimes the character is blanked out entirely.

How can I specify a fallback font for xterm then? (the question of which font look good can be left for later)

Offline

#7 2023-02-16 08:34:02

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,390

Re: Xterm font substitution does not work?

https://wiki.archlinux.org/title/Font_c … back_fonts - but that doesn't allow you to control the size and even if you prefer a different monospace font, that doesn't mean that the pixel sizes align.

You could try and see whether the glyph is included in the patched nerd fonts.

Offline

#8 2023-02-16 09:21:36

k395
Member
Registered: 2020-01-29
Posts: 37

Re: Xterm font substitution does not work?

Isn't that what I already do? From the original post:

<alias>
    <family>DejaVu Sans Mono</family>
    <prefer>
        <family>DejaVu Sans</family>
    </prefer>
</alias>

This should use glyphs from DejaVu Sans whenever the glyph is not available in DejaVu Sans Mono, right? (the match-test-edit one in the wiki will completely replaces the font with the new font, which is not what I want)



For the suggestion of trying the nerd fonts, I'll consider that.

Offline

#9 2023-02-16 09:33:53

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,390

Re: Xterm font substitution does not work?

Yes and assumign you ddi it correctly, DJVSM will now fall back to DJVS

~/.config/fontconfig/conf.d/99-dejavumonofallback.conf

<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<alias>
    <family>DejaVu Sans Mono</family>
    <prefer>
        <family>DejaVu Sans</family>
    </prefer>
</alias>
</fontconfig>

which should™ be reflected in the pango-view test.

This does however not change anything about the fixed/variable width situation - DJVS is variable width just as DJVMTG.

Offline

Board footer

Powered by FluxBB