On Fri, Jun 27, 2008 at 10:16:41AM -0400, Adam Petaccia wrote:
The previous patch I sent incorrectly calculated font-height. Now its correctly calculated using points_per_inch and the user's DPI setting.
diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c index 86a3223..85df905 100644 --- a/dlls/gdiplus/font.c +++ b/dlls/gdiplus/font.c @@ -34,6 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL (gdiplus); #include "gdiplus_private.h"
static const REAL mm_per_pixel = 25.4; +static const REAL points_per_inch = 1/72;
I know there are several definitions of a point, but none are this big!
points_per_inch should be around 72.
@@ -50,7 +51,7 @@ static inline REAL get_dpi (void)
static inline REAL point_to_pixel (REAL point) {
- return point * 1.5;
- return point * (get_dpi() * points_per_inch);
And this then becomes points * get_dpi() / points_per_inch;
[Hint check the units: pixels (aka dots) = points * (dots / inch) / (points / inch) ]
Huw.
On Fri, Jun 27, 2008 at 03:27:44PM +0100, Huw Davies wrote:
On Fri, Jun 27, 2008 at 10:16:41AM -0400, Adam Petaccia wrote:
--- a/dlls/gdiplus/font.c +++ b/dlls/gdiplus/font.c @@ -34,6 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL (gdiplus); #include "gdiplus_private.h"
static const REAL mm_per_pixel = 25.4;
Ah and I missed this one. Please rename to mm_per_inch !
Huw.
Am Freitag, den 27.06.2008, 15:27 +0100 schrieb Huw Davies:
static const REAL mm_per_pixel = 25.4; +static const REAL points_per_inch = 1/72;
I know there are several definitions of a point, but none are this big!
points_per_inch should be around 72.
And if this is code is compiled by a C compiler, you get points_per_pixel=0, as 1 and 72 are integers, so 1/72 is an integer division that yields zero. This zero *then* gets converted to REAL. You probably mean points_per_inch = 72 or inches_per_point = 1./72 (note the decimal dot!)
Regards, Michael Karcher
On Fri, 2008-06-27 at 16:46 +0200, Michael Karcher wrote:
Am Freitag, den 27.06.2008, 15:27 +0100 schrieb Huw Davies:
static const REAL mm_per_pixel = 25.4; +static const REAL points_per_inch = 1/72;
I know there are several definitions of a point, but none are this big!
points_per_inch should be around 72.
And if this is code is compiled by a C compiler, you get points_per_pixel=0, as 1 and 72 are integers, so 1/72 is an integer division that yields zero. This zero *then* gets converted to REAL. You probably mean points_per_inch = 72 or inches_per_point = 1./72 (note the decimal dot!)
Face, meet palm. Thank you. I think this went uncaught because 0 indicates a default value.
I'll resend this as well as some other function which got negatively affected by a cleanup patch -- and after lots of valgrinding (making sure that 3rd time is in fact a charm).
Regards, Michael Karcher