Screen DPI setting no longer affects browser font sizes?




18 years ago
13 years ago


(Reporter: Chris Siebenmann, Assigned: Erik van der Poel)



Firefox Tracking Flags

(Not tracked)




18 years ago
Build ID: current CVS build

 As far as I can see, altering the Screen DPI setting (either in
Preferences | Fonts or by hand-editing browser.display.screen_resolution
in prefs.js) no longer affects what size of font HTML content is
rendered in, even when the HTML content calls for no specific font
sizes. It does change the font size of UI elements, but nothing else.

 I've verified this behavior with the use of xmon with a page
displaying a TrueType font (which is thus available in any pixel
size Mozilla cares to ask for).

 This is an unfortunate regression now that GECKO_FONT_SIZE_FACTOR
is no longer there, since it leaves people with no way to magnify
or reduce the actual HTML content's fonts (save manual invocation
of View | Enlarge Text).

 It might be worthwhile having a general 'scale font sizes by <X>'
preference, as a more direct way of handling things than the somewhat
obscure method of setting screen DPI to a lie.

 I'm sending this off to Erik because he's the GTK font person as far
as I know, but it might actually be a bug in layout or something.

- find a Linux system with TrueType fonts.
- set up a simple web page showing text in, eg,
  <font face="verdana"> .... </font>
- view it with your normal DPI settings.
- quit Mozilla, change DPI settings to claim that you have an absurdly
  large DPI.
- view the page again.
- observe that various menu and urlbar fonts are now much bigger but the
  text on the web page is no bigger than before.

Comment 1

18 years ago
The DPI setting only affects CSS "absolute length units" like pt, mm, etc. It
does not affect the CSS "relative length unit" px. This makes sense because DPI
means Dots Per Inch, and so it affects pt, mm and so on, but a pixel is a pixel,
no matter how many there are per inch on the screen.

(Actually, this is not really true. On high res devices such as very high res
monitors and printers, CSS implementations are expected to use "reference
pixels". Mozilla currently implements reference pixels when printing, but not on
the screen. See the CSS spec's wording on this.)

The DPI setting was never intended to be a general text zoom facility like
GECKO_FONT_SIZE_FACTOR. The latter was removed because we now have the text zoom
working (View | Enlarge and Reduce Text Size). If you don't like the default
font size (16px for the variable width font), please change your font size
prefs. These prefs do not affect Web pages that hard-code font sizes (e.g. pt,
px), but such hard-coding is frowned upon, and those authors need to fix their
pages. Mozilla has the text zoom feature for such pages. The text zoom setting
is not a persistent pref so that Web page authors will have some incentive to
fix their pages.

Marking INVALID. Please add comments if you wish to discuss this.
Last Resolved: 18 years ago
Resolution: --- → INVALID

Comment 2

18 years ago
 Thanks for the explanation.

 I'll describe my problem at more length:

 My preferred browser font is 14 pixels high, and looks nice on all of my
displays. (It's available in no other sizes; the remaining sizes are filled
in by font aliases.) However, with a 14 pixel font size baseline, the web
pages which set themselves in small font sizes (1, 2, and even 3) are very
small, too small to be comfortable to read.

 What I think I want is some way to control the font size baseline
independantly from the pixel size I want my default font to be rendered
in for normal/default text. Then I could set Mozilla to render text by
default in 14-pixel Cannam Garamond but use a font pixel baseline of 16
for everything else, so that pages who set text in 'size=2' Verdana or
Arial or whatever will still be readable.

(A preference to say 'never allow a font to go below X pixels' might be
easier, but I don't think it's correct. I'm willing to allow peripheral
text to go small, but not text in normal paragraphs that I have to read
and so on.)

 I note peripherally that Netscape 4.xx appears to let an underhanded
person set the baseline pixel size for fonts on a font by font basis (!).
I think that this would be a very nice feature to have in Mozilla, although
I suspect it would do quite a bit of damage to the font code. If you add
such a thing, I'd suggest also having (optional) preferences for maximum and
minimum pixel sizes on a font-by-font basis.

 Possibly I can already accomplish what I want to do, and more, by judicious
(and possibly perverse) use of non-overrideable stylesheets somewhere. If so,
feel free to point me at what I should be hacking up and what I should be
You need to log in before you can comment on or make changes to this bug.