2

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/

1

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.

  • You may also want to indicate how the magnification can be reset after the application is closed. – vanadium Jul 13 at 12:32
  • @vanadium I've done this plus given an overview of DPI in general. – WinEunuuchs2Unix Jul 13 at 17:28
  • Thanks for the reply, this is awesome. Apologies for not accepting yet - still out of town and waiting to get home on Monday to test. – Caleb Jay Jul 13 at 23:12
  • For me, on Gnome Shell with Xorg (Ubuntu 19.04) this does not seem to work. I have tested with the command "xrandr --dpi 144 ; leafpad", and leafpad starts as usual, without any change in resolution. – vanadium Jul 14 at 8:58
  • @vanadium I only used leafpad once on lubuntu 16.04 inside virtual box and to change font size I probably did something different. For myself I use --dpi 144 with kid3 if you have kid3 installed you can try that. – WinEunuuchs2Unix Jul 14 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.