Dmitry Timoshkov : gdiplus: Use appropriate accessors to calculate font height instead of accessing GpFont internals directly .
Alexandre Julliard
julliard at winehq.org
Fri May 11 11:09:15 CDT 2012
Module: wine
Branch: master
Commit: 915cd7b5b27381b2899b0402458f78e955c86186
URL: http://source.winehq.org/git/wine.git/?a=commit;h=915cd7b5b27381b2899b0402458f78e955c86186
Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date: Fri May 11 19:19:59 2012 +0900
gdiplus: Use appropriate accessors to calculate font height instead of accessing GpFont internals directly.
---
dlls/gdiplus/font.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c
index a07333a..5b57ec6 100644
--- a/dlls/gdiplus/font.c
+++ b/dlls/gdiplus/font.c
@@ -504,14 +504,26 @@ GpStatus WINGDIPAPI GdipGetFontHeight(GDIPCONST GpFont *font,
*/
GpStatus WINGDIPAPI GdipGetFontHeightGivenDPI(GDIPCONST GpFont *font, REAL dpi, REAL *height)
{
- REAL font_height;
+ GpStatus stat;
+ INT style;
+ UINT16 line_spacing, em_height;
+ REAL font_height, font_size;
+
+ if (!font || !height) return InvalidParameter;
TRACE("%p (%s), %f, %p\n", font,
- debugstr_w(font->lfw.lfFaceName), dpi, height);
+ debugstr_w(font->family->FamilyName), dpi, height);
- if (!(font && height)) return InvalidParameter;
+ stat = GdipGetFontSize((GpFont *)font, &font_size);
+ if (stat != Ok) return stat;
+ stat = GdipGetFontStyle((GpFont *)font, &style);
+ if (stat != Ok) return stat;
+ stat = GdipGetLineSpacing(font->family, style, &line_spacing);
+ if (stat != Ok) return stat;
+ stat = GdipGetEmHeight(font->family, style, &em_height);
+ if (stat != Ok) return stat;
- font_height = font->line_spacing * (font->emSize / font->height);
+ font_height = (REAL)line_spacing * font_size / (REAL)em_height;
switch (font->unit)
{
More information about the wine-cvs
mailing list