6

I installed the Unity Editor on my Thinkpad x1 Carbon, which has a resolution of 2560 x 1440, and is considered HiDPI. In order to deal with very small font sizes, I installed gnome-tweak-tools and set my Fonts Scaling Factor to 1.34. This has resulted in an acceptable font size in every application I have tried so far, with some tweaks in programs like Firefox.

However, the Unity Editor doesn't have a font size modifier for its UI. It looks like this on my machine:

Screenshot of Unity Editor on a Thinkpad x1 Carbon running Ubuntu 18.04 with Gnome

The font size is unreadably small.

I see that under gnome-tweak-tools, I can set font sizes specifically for things such as "Window Title" or "Document," but not, for example, "Unity Editor."

I could set "Scaling Factor" very high but this makes other programs have unacceptably large fonts.

I could modify, under the regular Settings app, under Displays, the Scale property, from 100% to 200%, but this makes every other application have a terribly bloated, nearly unusably large UI.

How can I change the font size for only one application, specifically, Unity Editor?

EDIT: By the way, there does not appear to be any intention on the Unity Editor engineering team to implement a font size changer: https://forum.unity.com/threads/how-to-change-font-size-in-unity-editor.149481/

Caleb Jay
  • 285

2 Answers2

3

Create a script call ue (Unity Editor). Place within it:

#!/bin/bash
xrandr --dpi 144
unity-editor "$@"    # Or whatever the program is you want to run

Mark the script as executable using:

chmod a+x ue

Call the script using

./ue
  • Or replace ./ with the directory name if not in the current directory
  • Or leave off ./ if you have placed ue in your $PATH like ~/bin or /usr/local/bin

Adjust 144 to 192 if you want it double magnification. Smaller if you want less magnification.

Your screen may blink when script starts up but that is normal.


TL;DR

The default DPI (Dots Per Inch) is 96. When set to 100 font size increased by 4% which might not be noticeable. To confirm initial DPI use one of these commands:

$ xdpyinfo | grep dots
  resolution:    96x96 dots per inch

$ grep DPI /var/log/Xorg.0.log
[     9.555] (--) NVIDIA(0): DPI set to (43, 44); computed from "UseEdidDpi" X config
[     9.761] (==) modeset(G0): DPI set to (96, 96)

In the above script you can reset xrandr back to default DPI of 96 by adding the following line to the bottom:

xrandr --dpi 96

I've never encountered a need to do this, but you might.

1

The following does not change only the font, but scales the entire interface:

 QT_SCALE_FACTOR=1.34 application

Possibly, one may also want to play around with the above in combination with QT_AUTO_SCREEN_SCALE_FACTOR=1 and QT_AUTO_SCREEN_SCALE_FACTOR=0.

I hope hope it can be useful, though it is not exactly what you seek.

Rasmus
  • 8,655