Larger "xterm" fonts on HIDPI displays

20,069

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 3200x1800 display to 1920x1080 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.

Share:
20,069
Ho1
Author by

Ho1

Updated on September 18, 2022

Comments

  • Ho1
    Ho1 over 1 year

    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 10x20 bitmap font) is very small for me, and unusable.

    My default setting for the XFCE environment is set to 120 dpi, but xpdyinfo reports 97x97 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.

    • ILMostro_7
      ILMostro_7 almost 9 years
      Xft.dpi: 120 in ~/.Xresources doesn't work?
    • Ho1
      Ho1 almost 9 years
      xrdb -query | grep dpi already reports: Xft.dpi: 120
    • ILMostro_7
      ILMostro_7 over 8 years
      Did you create an ~/.Xresources file or ~/.Xdefaults, or w/e is appropriate on your system? The link you pointed to that you said was helpful is not an all-encompassing set of options available for xterm. For example, Xft.lcdfilter: lcddefault Xft.antialias: true Xft.hinting: true Xft.hintstyle: hintslight, and many more.
    • Martin Schröder
      Martin Schröder over 8 years
      You can set the fontnames (and sizes) in the resources, see the man page.
    • Ho1
      Ho1 over 8 years
      @MartinSchröder Yes, in fact I have tested my own 120dpi fonts generated from truetype font Courier New. But that lacks all the languages which "Fixed bitmap font family" supports, so I'm looking for a better way to do this. Currently in my systme, /etc/X11/app-defaults/XTerm, as default VT100.font6 (Huge) is set to 10x20 font from Fixed font family, which is rather small on my screen. I would be happy if we had en.wikipedia.org/wiki/Fixed_%28typeface%29 for 20x40, but we don't.
    • Stéphane Chazelas
      Stéphane Chazelas over 8 years
      Do you need to use bitmap fonts? xterm supports truetype fonts as well. xterm -fa 'DejaVu Sans Mono' -fs 40 (though not switching between fonts when glyphs are not available like some other terminal emulators do)
  • Ho1
    Ho1 over 8 years
    Thanks for your answer, I am using the biggest bitmap font available for fixed font family: 10x20 which is used for Huge font size, but it is also very small on HIDIP displays. Plase note that I am talking about bitmap fonts, and not truetype fonts.
  • Ho1
    Ho1 over 8 years
    Thank you for your answer. This provides bigger fonts: xterm -fs 20x10, but it is not the "fixed font family": en.wikipedia.org/wiki/Fixed_%28typeface%29 ,So it does not contain international characters which fixed font family have.
  • Ho1
    Ho1 over 8 years
    Great answer, Thanks. I will happily accept the answer. Why not truetype? 1) I am want to use it on an old slow computer. 2) Fixed family has a great language support, as described in cl.cam.ac.uk/~mgk25/ucs-fonts.html And one last thing: Is there a way to just scale a single window in X? I think this will improve the answer.
  • gboffi
    gboffi over 6 years
    W/R to the original poster need for wide support of different languages, Vera is limited but the its spinoff DejaVu supports many different character sets. From this point of view also the more or less freely available monospaced fonts from MS are very good, both Courier10 and Calibri. ፨ I have fallen in love, sort of, with Calibri!