Firefox layout.css.dpi ignored

Bug #301158 reported by norimu on 2008-11-23
34
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Mozilla Firefox
New
Medium
firefox-3.0 (Ubuntu)
Undecided
Unassigned
firefox-3.5 (Ubuntu)
Medium
Unassigned

Bug Description

Binary package hint: firefox-3.0

The option layout.css.dpi in Firefox 3.0.4 (via about:config) is ignored in Kubuntu 8.10 (i386).

That is bad because the font size for web content is very small on my 19" CRT at 1280x1024

To adjust the system DPI I tried the following

1) ScreenSize option in xorg.conf (increases GTK User Interface fonts but not KDE fonts)
2) X-Server command option -dpi 108 in kdmrc (increases KDE fonts but not GTK fonts)
3) Xft.dpi: 108 in an ~/.Xdefaults file (increases GTK fonts but not KDE fonts)

So now I have a combination of 2) und 3)
xdpyinfo reports the correct target dpi of 108.

But all these settings are ignored by the Firefox web rendering and layout.css.dpi was a solution in previous versions I used (Firefox 2).

tommy (yobbobandana) wrote :

I also have this problem with Ubuntu 8.10 (amd64).

Setting layout.css.dpi doesn't seem to do anything at all.

norimu (baruckobima332) on 2008-11-23
description: updated
ibmt23 (bdsalern) wrote :

Same issue as I reported in 301559!
My system is set for 124dpi (1400x1050 on a 14.1 inch lcd). Both
X11.conf and Gnome setup and verified with xdpyinfo. Fonts and items are
rendered properly for all applications except for Web pages rendered in
Firefox. Text and content on web pages are extremely small.
Layout.css.dpi has no effect when changed from -1 to 124. All pages
continue to be rendered at 96dpi.

ProblemType: Bug
Architecture: i386
DistroRelease: Ubuntu 8.10
Package: firefox-3.0 3.0.4+nobinonly-0ubuntu0.8.10.1
ProcEnviron:
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: firefox-3.0
Uname: Linux 2.6.27-7-generic i686

norimu (baruckobima332) wrote :

Wait, totally ignored would be wrong. Some fonts do get bigger. I'm not familiar with web design and can't say what type of fonts these are but most of the text is still really small (e.g. the whole page www.nytimes.com is unreadable). In contrary layout.css.dpi in Firefox 2 affected all or nearly all fonts.

The only solution seems to be the zoom function - which worsens the quality of images.

Chris Conway (cconway) wrote :

I am having the same problem with firefox=3.0.5+nobinonly-0ubuntu0.8.10.1. I can see no difference between layout.css.dpi values -1 up to 191. At 192, the size of the Firefox icons and fonts gets much larger. There's another "quantum" at 258.

My relevant settings are:

Screen resolution: 1680x1050
X11 resolution (set via EDI): 96dpi
Font rendering resolution: 128dpi
Fond rendering: subpixel smoothing
Firefox preference layout.css.dpi: 0
Firefox default font size: 16

An image showing the fonts sizes in Firefox vs. OpenOffice is attached.

The only work-around I've found is to un-set "allow pages to choose their own fonts" and set a minimum font size. This causes some pages to render incorrectly, with overlapping boxes, etc.

Chris Conway (cconway) wrote :

By the way, I'm using Ubuntu 8.10, not Kubuntu.

Chris Conway (cconway) wrote :

Some more info on what I've found on my system...

The problem seems to be with fonts that have px units for font-size (let's call them "px fonts") vs. fonts with pt as font-size unit ("pt fonts"). Pt fonts match GNOME fonts of equal point sizes exactly with layout.css.dpi=0 and vary directly in proportion to layout.css.dpi for values >0. Px fonts are unreasonably small with layout.css.dpi=0 and are not affected by any value of layout.css.dpi from 0 through 191. At layout.css.dpi=192, px fonts suddenly double in size. They are unaffected by layout.css.dpi from 192 to 257. At layout.css.dpi=258, they grow another 50%.

It seems px fonts only vary at multiples of 96dpi, with a minimum of 96dpi. At the multiples of 96dpi, we have the traditional correspondence between px and pt: 96px=72pt. In between the multiples, the ratio gets lopsided, e.g., at layout.css.dpi=191, we have 96px~=36pt.

It seems to me the correct behavior would be for px fonts to vary directly with layout.css.dpi, maintaining approximately 96px=72pt for any DPI setting.

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.2) Gecko/20090803 Fedora/3.5.2-2.fc11 Firefox/3.5.2
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.2) Gecko/20090803 Fedora/3.5.2-2.fc11 Firefox/3.5.2

On my HP EliteBook 8530w laptop with a native resolution of 1920x1200 at 147x145 dpi, firefox renders many fonts and images on sites WAY too small. The firefox interface itself, including menus and preference dialogs all look fine.

After doing a bunch of research I found a "fix" that was done in bug 394103 to force any layout.css.dpi value under 192 to actually render at 96 dpi. This "fix" is killing my mozilla experience on this laptop.

Please take out this "rounding" and use the actual value set for layout.css.dpi allowing those of us with high resolution laptops to actually surf the web.

Reproducible: Always

Steps to Reproduce:
1. Get a laptop with a native resolution of 1920x1200
2. Launch Firefox
Actual Results:
Fonts and images are too small (rendered at 96 dpi)

Expected Results:
Fonts and images should be comfortably viewable at the native resolution of my monitor.

OS: Fedora 11 (all updates applied)

uname -a:
Linux mylaptop 2.6.29.6-217.2.8.fc11.x86_64 #1 SMP Sat Aug 15 01:06:26 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

xdpyinfo | egrep "dimens|resol":
  dimensions: 1920x1200 pixels (332x210 millimeters)
  resolution: 147x145 dots per inch

layout.css.dpi: -1

Graphics:
kmod-nvidia-185.18.31-1.fc11.x86_64

Created an attachment (id=396511)
Snapshot of the firefox dpi issue

There's a discussion going on about DPI handling here:
http://groups.google.com/group/mozilla.dev.platform/browse_frm/thread/7d6822e96dc10705#

And that references Bug 426788.

We *do* use the actual dpi value for determining the DPI that we use (for interpreting CSS 'pt', 'in', 'cm', etc., units.

What we use a multiple of 96 for is determining the number of CSS pixels per device pixel.

I'd say we directly use system dpi value for xul rendering, w/o rounding it to 96 multiples, but we round it for content rendering. This is IMHO actually a semi-dup of bug 426788, we just confuse users by different behavior for content and xul.

Okay, so the issue is somewhat complicated. (Thanks for linking the dev discussion, Brian.) I hope it gets fixed soon. My stepfather can't read his web browser (Firefox on Ubuntu) because the fonts are too small for his old eyes. Every other application is fine, respecting the system dpi setting. Firefox is the only one that makes him choose between too small to read and too large to tolerate.

Related Ubuntu bug report:
https://bugs.launchpad.net/firefox/+bug/301158

With Firefox 3.6 and later, you can now use the layout.css.devPixelsPerPx preference to control the number of device pixels per css pixels (with a non-integer ratio).
To simplify, if you set the preference to "1.5" everything will be 50% larger. That includes images too, which will look blurry as a side effect.

If you want something that works on 3.5 and only makes the text larger (without images), an alternative is to set a global text zoom content preference. You can do this by installing the Content Preferences extension (https://addons.mozilla.org/en-US/firefox/addon/4066), opening View > Sidebar > Content Preferences and changing the zoom value in the "Global" tab. Then you can check the "View > Zoom > Zoom Text Only" checkbox to zoom only text.

But this isn't related to this bug, so please do not discuss this here in order to keep the comments focused on this bug.

Forest (foresto) wrote :

This is a problem in regular Ubuntu and probably every other linux build of Firefox. I have changed the summary accordingly.

Mozilla's tracker has quite a few bugs relating to layout.css.dpi. Here is my favorite:
https://bugzilla.mozilla.org/show_bug.cgi?id=512522

This topic is being discussed among Mozilla developers:
http://groups.google.com/group/mozilla.dev.platform/browse_frm/thread/7d6822e96dc10705

summary: - Firefox layout.css.dpi ignored in Kubuntu
+ Firefox layout.css.dpi ignored
Changed in firefox:
status: Unknown → New
Micah Gersten (micahg) wrote :

Firefox 3.0 is only receiving Security Updates and major bug fixes at this point.

Changed in firefox-3.0 (Ubuntu):
status: New → Won't Fix
Micah Gersten (micahg) wrote :

This bug has been reported to the developers of the software. You can track it and make comments at: https://bugzilla.mozilla.org/show_bug.cgi?id=512522

Thanks to Forest for finding the upstream!

Changed in firefox-3.5 (Ubuntu):
importance: Undecided → Medium
status: New → Triaged

My laptop has a native resolution of 147x145 dpi (not a multiple of 96). The layout.css.devPixelsPerPx available in Firefox 3.6 simply gives me the "yucky" zoom effect. It's providing the same functionality as the "NoSquint" addon which looks UGLY!

If I set layout.css.dpi to 192, everything is much larger (too big in fact) but at least it doesn't look zoomed. I just want the same effect at the native resolution of my laptop. This seems pretty basic to me, but I must be missing something since it hasn't been fixed yet.

toasted_one (toasted124) wrote :

I was able to fix this in Kubuntu. Here are the steps I performed:

1) Opened System Settings
2) Clicked Appearance
3) Clicked on Fonts
4) Under Force Fonts DPI, I selected 96 and clicked Apply.

A notice pops up indicating "Some changes such as anti-aliasing will only affect newly started applications."

Opened up a new Firefox instance and the toolbar fonts look normal now.

Hope this helps....

hackel (hackel) wrote :

I have struggled with this as well, and consider it to be a bug. Just a reminder to anyone, the DPI settings (in GNOME, KDE, Xft, Firefox, et al.) should *ALWAYS* match the physical characteristics of your monitor. If the default font sizes chosen are too big/small, then they should be adjusted. It would be nice if there was a general "UI scale" control, but that is NOT what DPI is. Your computer should always know what the correct DPI is for all of your display device, and 10pt really should be 10/72" on ANY screen. I also don't agree with scaling pixel fonts on the web, other than perhaps as a "compatibility option" for websites designed by totally incompetent web developers.

Changed in firefox:
importance: Unknown → Medium

It's not usual that setting DPI to a multiple of 12 can produce more pleasing results than prime numbers or multiples of 5. On your display Kyle, 144, a multiple of 12 and exactly 1.5 times 96, might work better than 147 or 145.

(In reply to comment #8)
> It's not usual that setting DPI to a multiple of 12 can produce more pleasing
> results than prime numbers or multiples of 5. On your display Kyle, 144, a
> multiple of 12 and exactly 1.5 times 96, might work better than 147 or 145.

s/It's not usual/It's not unusual/

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.