Closed Bug 190778 Opened 17 years ago Closed 11 years ago

[gtk2] Assumes font sizes are integers, they are not

Categories

(Core :: Graphics, defect, minor)

x86
Linux
defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: ross, Assigned: andersk)

References

Details

(Keywords: fixed1.9.1)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b) Gecko/20030121
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b) Gecko/20030121

My GTK+ 2.x font is 7.5pt.  (7pt is too small, 8pt is too large). This is fine
as GTK+ 2.x uses Pango to render, and Pango draws in 1000ths of a point.

Mozilla is getting my GTK+ font size (7.5pt), forcing it into an integer (7) and
then reapplying that style to GTK+ widgets. Thus all of the widgets in HTML
pages are too small in Galeon2 :(

Reproducible: Always

Steps to Reproduce:
Set the GTK+ font size to a non-integer value and run a GTK+ 2 Mozilla.
heh
Assignee: jaggernaut → font
Component: XP Toolkit/Widgets → Layout: Fonts and Text
QA Contact: jrgm → ian
->blizzard
Assignee: font → blizzard
Component: Layout: Fonts and Text → GFX: Gtk
Flags: blocking-aviary1.0+
Flags: blocking1.8a5+
Flags: blocking1.7.x+
Flags: blocking-aviary1.0-L10N+
Only component owners, peers, and drivers may set + flags on blocking. If you
wish blocking considered, set ? on the flag. Unlikely an unconfirmed bug will
block anything though.
Flags: blocking1.8a5+
Flags: blocking1.7.x+
Flags: blocking-aviary1.0-L10N+
Flags: blocking-aviary1.0+
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
Status: UNCONFIRMED → NEW
Ever confirmed: true
Does this bug still occur in a recent trunk build?
http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/
Yes, it does.
Assignee: blizzard → nobody
Component: GFX: Gtk → GFX: Thebes
QA Contact: ian → thebes
This still happens in Firefox 3.0 and 3.5 on Jaunty.
I spotted this mistake, which I bet is responsible for this bug:

--- xulrunner-1.9.0.9.orig/mozilla/gfx/src/thebes/nsSystemFontsGTK2.cpp
+++ xulrunner-1.9.0.9/mozilla/gfx/src/thebes/nsSystemFontsGTK2.cpp
@@ -210,7 +210,7 @@
 
     aFontStyle->weight = pango_font_description_get_weight(desc);
 
-    float size = float(pango_font_description_get_size(desc) / PANGO_SCALE);
+    float size = float(pango_font_description_get_size(desc)) / PANGO_SCALE;
 
     // |size| is now either pixels or pango-points (not Mozilla-points!)
Yeah, that does the trick.  Tested in xulrunner 1.9.1 and firefox 3.5 on Jaunty.  Here’s the same patch as an attachment.
Comment on attachment 374580 [details] [diff] [review]
cast to float before integer division, not after
[Checkin: Comment 14]

Wow, yeah, that's a bug.  Good find.
Attachment #374580 - Flags: review+
Attachment #374580 - Flags: superreview?(roc)
Roc - cheap and easy fix for linux.  Can you give a quick sr?
Comment on attachment 374580 [details] [diff] [review]
cast to float before integer division, not after
[Checkin: Comment 14]

sr not needed here
Attachment #374580 - Flags: superreview?(roc) → superreview+
I'm old-school.  Back where I come from it all needs an sr.  :)
Comment on attachment 374580 [details] [diff] [review]
cast to float before integer division, not after
[Checkin: Comment 14]


http://hg.mozilla.org/mozilla-central/rev/4561d478f6ba
Attachment #374580 - Attachment description: cast to float before integer division, not after → cast to float before integer division, not after [Checkin: Comment 14]
Attachment #374580 - Flags: approval1.9.1?
Assignee: nobody → anders
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite-
Keywords: checkin-needed
Resolution: --- → FIXED
Whiteboard: [needs 1.9.1 landing: needs approval]
Target Milestone: --- → mozilla1.9.2a1
Attachment #374580 - Flags: approval1.9.1? → approval1.9.1+
Keywords: checkin-needed
Whiteboard: [needs 1.9.1 landing: needs approval] → [needs 1.9.1 landing]
You need to log in before you can comment on or make changes to this bug.