Fix Firefox DPI Settings

Firefox Logo

After moving my main desktop computer from its own setup on a computer monitor to the living room’s HDTV and bumping up Windows’ DPI setting so I could read text from across the room, I found Firefox did not quite behave correctly. While the Chrome interface scaled correctly, the web content did not. Quite oddly, it seem to stick at the original DPI setting until Windows’ DPI was set at 192 DPI (200%), at which point Firefox would finally double the size of the web content.

After some searching and a little head-banging, I found that the layout.css.devPixelsPerPx property in about:config did the trick for me.

On Windows, I found the correct setting should be set to your custom DPI divided by 96.

Mac uses a default DPI of 72. According to Mozilla, “For cross-platform uniformity reasons, Mozilla by default uses the greater of your system setting or 96.” So perhaps the divide by 96 rule still applies.

Linux, on the other hand, is a bit goofy. XFree86/Xorg has opted for the actual DPI of the screen. A 17-inch monitor at 1366×768 native resolution would have an actual DPI of 100 as its native resolution. At lower resolutions, the DPI would change and allow the screen to remain relatively unchanged assuming all sizes were specified in points not pixels. However, Gnome usually forces a DPI of 96, and will even set X’s DPI via gnome-settings-daemon. At this point I throw my hands up and say “Try dividing by 96, and good luck if that doesn’t work.”