Larger "xterm" fonts on HIDPI displays

After several years of happily using different terminal emulators like Konsole, Gnome-TERMINAL, and lately XFCE Terminal in their appropriate desktop environments, I decided to use good old xterm with its bitmap fonts. It works just fine, it supports Unicode, and the default fixed font family contains characters from nearly all languages, which is great.

But I came across an important problem. The fonts are really small. Even the so called Huge size (which is 10×20 bitmap font) is very small for me, and unusable.

My default setting for the XFCE environment is set to 120 dpi, but xpdyinfo reports 97×97 DPI

$ xdpyinfo |grep resolution
  resolution:    97x97 dots per inch

So I tried to change the DPI with xrandr, but It didn’t help.

$ xrandr --dpi 120

The result seems to be applied

$ xdpyinfo | grep resolution
  resolution:    120x120 dots per inch

but it does not change the resolution of xterm at all. I have even tried to use scaling, but it affected the whole X, rather than a single application:

$ xrandr --output LVDS1 --scale 0.5x0.5

There are workarounds for Qt and Gtk, but what about Xlib-based applications like Xterm, Xcalc, Xman, Xfige, etc? Should we watch them fade away, as the display DPI goes up? Please Help if you know any workarounds.


This is what I have done, which worked somehow, but I couldn’t be able to use the original “fixed font family”, so it may now work for some languages only.


PS1: I have installed 100 DPI fonts for X, but I couldn’t use them

$ sudo apt-get install xfonts-100dpi

PS2: Fontforge which also uses Xlib, uses a nice theme and normal font sizes. I don’t know how it does that.

PS3: I am testing otf2bdf and bdftopcf utiliites to create experimental PCF bitmap fonts for HIDPI from vector TTF/OTF fonts.

PS4: After installing 100DPI fonts, this was good, although it lacks great language support of the default fixed font.

$ xterm -font -Adobe-Courier-Bold-r-Normal-*-34-*-100-100-*-*-*-*

I have used fontsel. It is really helpful.

PS5: This is also useful.

PS6: I could be able to create 120DPI bitmap font from Courier New with 20pt

$ otf2bdf -p 20 -r 120 cour.ttf > cour.bdf
$ bdftopcf cour.bdf | gzip - > cour.pcf.gz
$ sudo cp cour.pcf.gz /usr/share/fonts/X11/misc/
$ fc-cache
$ xterm -font -*-*-*-*-*-*-*-*-120-120-*-*-*-*

PS7: 75 DPI is hardcoded in the BDF font. Maybe changing it will help.

PS8: vncdesk is a good tool to use to scale up a single window.

Asked By: Ho1

||

Right now you can increase the font size by holding control and right mouse button(i.e ctrl+right mouse button) and select the font size. To make it default you need to have an Xresources configuration. I am trying it and I will update the answer once I get it.

Update:

You can create .Xresources file inside your home directory and add the below line xterm*font: *-fixed-*-*-*-18-*. Then merge your changes with the X server resource utility using xrdb(i.e xrdb -merge ~/.Xresources) or you can restart the X also. The new xterms should have the changed font size.

Answered By: Thushi

I’m not sure but you can maybe merge the font and the siz like this:

xterm -fn helvetica -fs 20x10

small test of fonts

regards,
maniat1k

Answered By: maniat1k13

You have hinted the answer yourself by referencing https://en.wikipedia.org/wiki/Fixed_(typeface)

This is the standard fixed bitmap font which has been expanded by Markus Kuhn to have a rather complete character set. The question is then how to scale a bitmap.

What you have achieved so far is scaling a vector font and converting it to a bitmap (ttf → bdf → pcf). That is a fine strategy but as you mention it lacks some language support. That seems strange as Courier New is one of the more unicode complete fonts but I digress! Maybe try using Mono which is a clone.

I do however not understand why you are doing this as xterm does support truetype.

Modify ~/.Xresources such as this (note that you’ll need to reload it using xrdb as seen in another answer to this question):

XTerm*renderFont: true
XTerm*faceName: VeraMono
XTerm*faceSize: 10

But back to the task: You want a larger bitmap font.

The largest available bitmap available is:

10x20   -Misc-Fixed-Medium-R-Normal--20-200-75-75-C-100-ISO10646-1

Markus have been so nice that he supplies the source BDF files. If your distribution does not have the most recent updates (from April 2009) you can grab the package directly from him.

The “-misc-fixed-*” font package:

http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts.tar.gz

Rather than converting back and forth between pcf and bdf you could/should stick to the source format. You can use a BDF font editor to resize the font. Do not expect any antialiasing or such trickery – but at least you can get a readable size.

Or you can use bdfresize by Hiroto Kagotani (also found in some package systems).

UPDATE:

I do not know of a way to scale just one window (never had the need). You could track this Superuser question. When I have had the need I have scaled the entire environment.

You can downgrade a 3200×1800 display to 1920×1080 using:

xrandr --dpi 141
xrandr --output eDP1 --scale 0.6x0.6

Other tricks for screen scaling in different window managers can be found here. They suggest using VNC:

One approach is to run the application full screen and without
decoration in its own VNC desktop. Then scale the viewer. With Vncdesk
(vncdesk-git from the AUR) you can set up a desktop per
application, then start server and client with a simple command such
as vncdesk 2.

x11vnc has an experimental
option -appshare, which opens
one viewer per application window. Perhaps something could be hacked
up with that.

Answered By: Claus Andersen
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.