exec /usr/bin/X11/X -dpi 100 -nolisten tcp
Hie^.n tho+`i la` pha?i start vo+’i X
Mozilla DPI-related Font Size Issues on Unix
Mozilla Fonts Overview
A number of factors can cause fonts in Mozilla to seem wrong. For web page text, you can choose your default sizes and styles via the UI preferences panel. Typically, web page authors override some or all of your preferences via stylesheets and/or presentational markup. Mozilla has a minimum text size preference and text zoom to help you combat author styles that override your defaults. It is also possible to override author overrides via user stylesheets.
Fonts can seem wrong in Mozilla’s menus, tools and bookmarks too. Doing something about it is the topic of this page.
Mozilla sets UI fonts by querying the operating system’s font subsystem for CSS system fonts. In most environments, these are set in points. Point sized controls only display at the intended size if the system
DPI is reasonably configured.
Since some web page authors size text in points, inappropriately configured
DPI also can adversely impact web page text sizes.
DPI Problem Solving
Both points and
DPI either too small or too big are typically caused by a mismatch between your real display size and the display size your X server thinks you have. So, if you don’t like Mozilla’s UI font sizes, start to correct your problem by reconciling the two sizes. Measure your display, and change whatever settings are required to cause the X server to report and use the actual display size.
GTK1 Mozilla does not respond to DPI adjustments with corresponding changes in UI fonts. Adjustments to GTK1 UI fonts must be made via
gnomecc or via userChrome.css.
To find out what your X server thinks your
DPI settings are, run the program
$ xdpyinfo | grep dimensions $ xdpyinfo | grep resolution
Note the dimensions in pixels and millimeters, and the resolution in
DPI. Compare to what you’re actually using, but don’t confuse dots and pixels – a dot may or may not equal a pixel. If you have KDE,
kinfocenter's X-Server section will conveniently show the same information.
For example, if you use a 17″ CRT display, your viewable screen dimensions will be approximately 328 mm wide by 246 mm tall. This actual size can usually be forced by adding:
DisplaySize 328 246
/etc/X11/xorg.conf, as applicable on your system. If you are running a
1400 X 1050 resolution with a
328 mm X 246 mm display, your system will be running at an actual
108 DPI. In most cases, this change will be sufficient to correct your problem.
If the above change improves your system, but the result is less than 100% to your satisfaction, you can tweak sizes up or down by making the
DisplaySize dimensions slightly larger or smaller than actual.
Unfortunately, variations in the implementations of X mean display size reconciliation as above won’t be a solution on every system. Failure here seems to be common on newer systems using
fontconfig instead of legacy
fontconfig provide an option for X and applications that understand it to set
DPI via the
Xft.dpi variable. To find out if
Xft.dpi has already been set, check by running the program
$ xrdb -query | grep dpi
The regular file
/etc/X11/Xresources is one place this might be set, where you might find it present, but commented out. On systems with the directory
Xft.dpi can be set in
~/.Xresources. Another location it can be set is
~/.Xdefaults. On such systems, adding to the applicable file:
or uncommenting an existing line would produce the same result as setting
DisplaySize produces for
xfs. On some systems, setting
DisplaySize first, and then setting
Xft.dpi to match the reported
DPI is required for proper results.
As above, if this works, but at less than 100% satisfaction, tweak the number lower or higher to suit your preference. If possible, use a number that is a multiple of 6, or even 12, as numbers that aren’t sometimes result in annoying rounding errors that cause adjacent bitmap font sizes to not increment and decrement linearly.
All Mozilla.org builds of Firefox and SeaMonkey, some of Mozilla, and most builds of these products supplied by recent Linux distros, are built using the GTK2 toolkit. This means that
gnome-control-center can be used to explicitly set DPI to a desired value that these builds will share with all other GTK2 apps.
Some users have found success in adjusting the X server’s
DPI by doing one of the following:
- Using the graphical login screen:
:0 local /usr/X11R6/bin/X
:0 local /usr/X11R6/bin/X -dpi 100
You need to restart xdm for this to work:
$ su - root # telinit 3 # telinit 5
- Using Redhat and gdm:
0=/usr/bin/X11/X -dpi 100
You will need to restart gdm for this to work
- In some Debian variants:
to include whatever DPI you wish to use instead of 75.
You will need to restart X for this to work
- Using startx from the command line:
$ startx -- -dpi 100
If none of the above or variations thereof work, as a last resort, you can use the brute force method of forcing Mozilla to use a particular
DPI directly. Edit your user.js file and add:
You may change the
DPI number to any resolution you like. Setting it to 0 will restore Mozilla’s use of the X Server
DPI. Like prefs.js, user.js is a plain text file in your profile directory. If it doesn’t exist, create it with your choice of text editor.
As an alternative to editing user.js, you can change
browser.display.screen_resolution by entering
in the urlbar, right clicking the current value, and changing it to any number you like.
A third way to change Mozilla
DPI by brute force is via the preferences UI:
Appearance -> Fonts -> Display resolution
browser.display.screen_resolution by any of the three methods above require a complete Mozilla restart to take effect.
Note that for cross-platform uniformity reasons, Mozilla for Mac by default uses the greater of your system setting or 96. If you wish Mozilla to use a
DPI of less than 96, you must force it to do so using browser.display.screen_resolution. /* Is this true? – Felix */
Note – The DPI preference for development builds of Mozilla was changed from
layout.css.dpi February 28, 2006.
Not all Mozilla builds are suitable for all systems. Legacy systems use the
xfs font service system exclusively. Standard builds must be used on these systems for reasonable results. Newer systems use the
fontconfig font service system in addition to
xfs. You can use any Mozilla build on these systems, but
xft labeled builds should produce clearly better results.
To find out which type of Mozilla build you are using, enter into the urlbar:
Only builds intended for
fontconfig systems will show
--enable-xft as a configure argument.
Finally, if you still can’t get Mozilla’s fonts just the way you like them by changing
DPI, you can customize them directly using standard CSS 2.1, in userChrome.css for the UI, and userContent.css for web page text. How to do this is covered generally at Customizing Mozilla.
Using CSS, you can customize Mozilla fonts via methods that don’t depend on
DPI. A few of the many possible UI CSS selectors you might wish to try in userChrome.css include:
- menu, menuitem (main menu items)
- .tabbrowser-tabs .tab-text
- toolbar (urlbar)
- .toolbarbutton-1 (nav button text in Modern theme)
- treechildren (mailnews folder & header panes; pref trees)
- .treecol-text (mailnews column headings)
DOM Inspector you can explore Mozilla’s application of CSS and find other selectors you might wish to experiment with.
Forums available for further help with Unix
DPI and fonts include:
- Mozilla newsgroups
- Moznet on IRC