HIDPI顯示屏上的較大" xterm"字體


18

在適當的桌面環境中愉快地使用了不同的終端模擬器(例如KonsoleGnome-TERMINAL和最近的XFCE Terminal)幾年後,我決定使用具有 bitmap字體的老式xterm。它工作得很好,它支持Unicode,默認的fixed font family包含幾乎所有語言的字符,這很棒。

但是我遇到了一個重要問題。字體很小。即使是所謂的巨大大小(10x20位圖字體)對我來說也很小,無法使用。

我的XFCE環境默認設置為120 dpi,但是xpdyinfo報告97x97 DPI

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

因此,我嘗試使用xrandr更改DPI,但這沒有幫助。

$ xrandr --dpi 120

結果似乎適用

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

,但它根本不會改變xterm的分辨率。我什至嘗試使用縮放,但它影響了整個X,而不是單個應用程序:

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

workarounds for Qt and Gtk,但是基於Xlib的應用程序(如XtermXcalcXmanXfige等)呢?隨著顯示DPI上升,我們應該看著它們消失嗎?如果您有任何解決方法,請幫助。


這是我所做的,雖然可以正常工作,但是我無法使用原始的"固定字體系列",因此它現在僅適用於某些語言。


PS1:我已經為X安裝了100種DPI字體,但是我無法使用它們

$ sudo apt-get install xfonts-100dpi

PS2:Fontforge(也使用Xlib)使用漂亮的主題和正常的字體大小。我不知道它是怎麼做到的。

PS3:我正在測試xrandr0和xrandr1實用程序,以從矢量xrandr3字體為HIDPI創建實驗性的xrandr2位圖字體。

PS4:安裝100DPI字體後,這很好,儘管它缺乏默認xrandr4字體的強大語言支持。

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

我用過xrandr5。這真的很有幫助。

PS5:This也很有用。

PS6:我可以通過 Courier New 和20pt來創建120DPI位圖字體

$ 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以BDF字體硬編碼。也許更改它會有所幫助。

PS8:vncdesk是用於scale up a single window的好工具。

0

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.


0

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


12

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.