After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 309868 - Incorrect font sizes
Incorrect font sizes
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
2.8.x
Other All
: Normal trivial
: ---
Assigned To: gtk-win32 maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2005-07-09 06:18 UTC by Bryan S
Modified: 2005-10-20 00:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot (5.33 KB, image/gif)
2005-10-20 00:34 UTC, Tor Lillqvist
Details

Description Bryan S 2005-07-09 06:18:28 UTC
Please describe the problem:
Hi, if you check on win32 GTK+ apps such as The GIMP or Gaim and then compare
them to AIM or a word processor you will notice the the font sizes seem to be a
point size off of what they should be.  This is a bug I have noticed for a long
time in the win32 GTK port and its really annoying.  Especially if you're doing
work in The GIMP and the font sizes are all wrong.

Steps to reproduce:
1. 
2. 
3. 


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Tor Lillqvist 2005-07-15 01:07:43 UTC
So are all other Windows apps consistent with each others regarding font size?
Is it only GTK+ apps that stand out?
Comment 2 Bryan S 2005-07-15 02:49:52 UTC
Yeah, Windows apps have no problems with font sizes as far as I can tell.  It's
just that with GTK+ apps for Windows there has always been a problem where the
fonts are either 1 pt size too large or too small.
Comment 3 Tor Lillqvist 2005-07-15 03:03:06 UTC
Hmm, yes. For instance wordpad and notepad seem to agree very closely on the
size of chars in "tahoma 12", while in GTK+ "tahoma 12" is *much* smaller. This
definitely is against user expectation, yes.
Comment 4 Bryan S 2005-07-15 03:13:48 UTC
Yeah, I loaded up Gaim and AIM and send messages to two accounts from both
clients and the font sizes were way off.
Comment 5 Tor Lillqvist 2005-09-26 09:29:27 UTC
The same problem still exists in GTK+ 2.8, but here the code path is quite
different, and the root cause presumably also. In GTK+ 2.8 the problems seems to
be that cairo-win32-font.c in _win32_scaled_font_get_scaled_hfont() sets
logfont.lfHeight to the (positive) value of scaled_font->logical_size. (And
correspondingly in _win32_scaled_font_get_unscaled_hfont() sets logfont.lfHeight
to the (positive) value of scaled_font->em_square.) If it would set lfHeight to
the negative of those values the font sizes would match what for instance
Wordpad uses.
Comment 6 Tor Lillqvist 2005-10-01 00:33:24 UTC
This should be fixed now in the upcoming cairo 1.0.2, and will thus help GTK+
2.8. GTK+ 2.6 is not maintained any longer.
Comment 7 Bryan S 2005-10-19 16:38:14 UTC
Are you certain this is fixed?  I'm running Gimp 2.3.4 with GTK+ 2.8.6 which is
supposed to have Cairo 1.0.2 but after comparing a 10pt arial font in Gimp to a
10pt arial font in WordPad they're way off.
Comment 8 Tor Lillqvist 2005-10-19 23:40:15 UTC
Pretty sure, yes. Is the libcairo-2.dll you are using 336102 bytes in size? In
which part of the GIMP are you comparing the font sizes, in the GTK GUI or the
text produced by the GIMP's text tool? This bug concerns only the first kind of
text. The GIMP's text tool uses a quite different API (PangoFT2) and goes
through a quite different code path. Please open another bug for that, if you
feel it is a problem. Please note though that Wordpad is not an image editor.
The GIMP is, and the only thing that matters, really, sizewise is the pixel size
of the image (and parts of it, like text). You can print an image at any size
you want anyway, no matter what size in "points" text on it is supposed to be.
Comment 9 Tor Lillqvist 2005-10-20 00:33:57 UTC
Yosh points out to me that the GIMP's text tool uses the image's dpi setting to
interpret what a font size in physical units like points or inches means in pixels.

The default dpi when creating a new image in the GIMP is 72. If you want the
font sizes used by the GIMP's text tool to correspond to the font size of
text-based applications like WordPad, or GTK+ font sizes, set the image's dpi to
the dpi of your display. Typically that would be 96 on current Windows boxes, I
think. Check Display Settings to be sure.

Then the font size (in the vertical direction) will closely correspond to what
you see in WordPad, or in GTK+ GUI text (like the text in the GIMP's dialogs).
See attached image for an example. The leftmost text is produced by GIMP's text
tool with font "arial" size 10 points, the middle one is GIMP's GUI (with
gtk-font-name="arial 10" in the gtkrc), and the rightmost is WordPad.

As one sees, the glyphs produced by the GIMP's text tool are shaped differently
and have different horizontal dimensions. That is because the GIMP's text tool
uses FreeType, while GTK+ and WordPad use GDI.
Comment 10 Tor Lillqvist 2005-10-20 00:34:47 UTC
Created attachment 53671 [details]
Screenshot