Dmitry Timoshkov : gdiplus: Move internal helper get_log_fontW() out of public GdipGetLogFontW() export.

Alexandre Julliard julliard at winehq.org
Fri Oct 26 11:36:22 CDT 2012


Module: wine
Branch: master
Commit: 71eb1644821bb2707c5d6ccf3a14436ddb91410e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=71eb1644821bb2707c5d6ccf3a14436ddb91410e

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Wed Oct 24 18:10:30 2012 +0900

gdiplus: Move internal helper get_log_fontW() out of public GdipGetLogFontW() export.

---

 dlls/gdiplus/font.c     |   25 ++++++++++---------------
 dlls/gdiplus/graphics.c |   34 ++++++++++++++++++++++++++++++++--
 2 files changed, 42 insertions(+), 17 deletions(-)

diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c
index e4f979c..6588f12 100644
--- a/dlls/gdiplus/font.c
+++ b/dlls/gdiplus/font.c
@@ -449,10 +449,18 @@ GpStatus WINGDIPAPI GdipGetLogFontA(GpFont *font, GpGraphics *graphics,
     return Ok;
 }
 
-void get_log_fontW(const GpFont *font, GpGraphics *graphics, LOGFONTW *lf)
+/*******************************************************************************
+ * GdipGetLogFontW [GDIPLUS.@]
+ */
+GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics, LOGFONTW *lf)
 {
     REAL height;
 
+    TRACE("(%p, %p, %p)\n", font, graphics, lf);
+
+    if (!font || !graphics || !lf)
+        return InvalidParameter;
+
     if (font->unit == UnitPixel)
     {
         height = units_to_pixels(font->emSize, graphics->unit, graphics->yres);
@@ -481,21 +489,8 @@ void get_log_fontW(const GpFont *font, GpGraphics *graphics, LOGFONTW *lf)
     lf->lfQuality = DEFAULT_QUALITY;
     lf->lfPitchAndFamily = 0;
     strcpyW(lf->lfFaceName, font->family->FamilyName);
-}
-
-/*******************************************************************************
- * GdipGetLogFontW [GDIPLUS.@]
- */
-GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics,
-    LOGFONTW *lfw)
-{
-    TRACE("(%p, %p, %p)\n", font, graphics, lfw);
-
-    if(!font || !graphics || !lfw)
-        return InvalidParameter;
 
-    get_log_fontW(font, graphics, lfw);
-    TRACE("=> %s,%d\n", debugstr_w(lfw->lfFaceName), lfw->lfHeight);
+    TRACE("=> %s,%d\n", debugstr_w(lf->lfFaceName), lf->lfHeight);
 
     return Ok;
 }
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index b2ebf40..726885b 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -2133,6 +2133,38 @@ end:
     return stat;
 }
 
+void get_log_fontW(const GpFont *font, GpGraphics *graphics, LOGFONTW *lf)
+{
+    REAL height;
+
+    if (font->unit == UnitPixel)
+    {
+        height = units_to_pixels(font->emSize, graphics->unit, graphics->yres);
+    }
+    else
+    {
+        if (graphics->unit == UnitDisplay || graphics->unit == UnitPixel)
+            height = units_to_pixels(font->emSize, font->unit, graphics->xres);
+        else
+            height = units_to_pixels(font->emSize, font->unit, graphics->yres);
+    }
+
+    lf->lfHeight = -(height + 0.5);
+    lf->lfWidth = 0;
+    lf->lfEscapement = 0;
+    lf->lfOrientation = 0;
+    lf->lfWeight = font->otm.otmTextMetrics.tmWeight;
+    lf->lfItalic = font->otm.otmTextMetrics.tmItalic ? 1 : 0;
+    lf->lfUnderline = font->otm.otmTextMetrics.tmUnderlined ? 1 : 0;
+    lf->lfStrikeOut = font->otm.otmTextMetrics.tmStruckOut ? 1 : 0;
+    lf->lfCharSet = font->otm.otmTextMetrics.tmCharSet;
+    lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
+    lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
+    lf->lfQuality = DEFAULT_QUALITY;
+    lf->lfPitchAndFamily = 0;
+    strcpyW(lf->lfFaceName, font->family->FamilyName);
+}
+
 static void get_font_hfont(GpGraphics *graphics, GDIPCONST GpFont *font,
                            GDIPCONST GpStringFormat *format, HFONT *hfont)
 {
@@ -2153,8 +2185,6 @@ static void get_font_hfont(GpGraphics *graphics, GDIPCONST GpFont *font,
         unit_scale = units_scale(font->unit, graphics->unit, res);
 
         font_height = font->emSize * unit_scale;
-        if (graphics->unit != UnitDisplay)
-            font_height /= graphics->scale;
     }
 
     pt[0].X = 0.0;




More information about the wine-cvs mailing list