[2/5] gdiplus: Use appropriate accessors to calculate font height instead of accessing GpFont internals directly. Resend.
Dmitry Timoshkov
dmitry at baikal.ru
Fri May 11 05:19:59 CDT 2012
---
dlls/gdiplus/font.c | 20 ++++++++++++++++----
1 file 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)
{
--
1.7.10.1
More information about the wine-patches
mailing list