Archive | September 2012

Adventures with screen dpi and text editors

Just a quick note in case anyone else finds themselves in the same position.

I have just recently set up the excellent Sublime Text 2. One of the appeals of using this editor was sharing the one set-up across my Windows desktop, my Macbook Pro and the various Ubuntu virtual machines that I run in Virtualbox.

All was going swimmingly until I tried to set a convenient font size. The font size that looked right on the Linux guest (on the Macbook Pro) looked too small on the Macbook. To cut a long story short – I found no great answer. 

In this configuration the difference was caused by a different dpi setting for the two systems. The native Mac was working with a 72dpi, and the Ubuntu virtualbox was working with 96dpi. There didn’t seem to be any way to dpi setting for Ubuntu. The closest I got was change the text scaling factor as so:

 gsettings set org.gnome.desktop.interface text-scaling-factor X

I tried setting X to 0.75 (75dpi / 96dpi). This made all of the system fonts smaller. So then I was able to set larger system fonts on the Ubuntu guest that looked about the same size as they did on the Macbook Pro host – for most applications. (e.g. Terminal and gEdit.) However for some unknown reason, Sublime Text 2 did not seem to recognise this change in any way. (I am guessing this is because I did not acutally change the dpi in the Ubuntu vm – just changed the text scaling… and Sublime Text must be referencing the dpi in some way.)

So where I am at now is setting the text-scaling-factor back to 1 (so that within Ubuntu, font sizes with Sublime and other apps are aligned) – and having to manually change (increase) font size whenever I switch to editing within OS X.

So if anyone reads this after spending an hour or two looking for a solution…. feel consoled that you are not alone.

And if you happen to know a better answer – I would really like to know it.