[3/5] gdiplus: Derive GpFont from GpFontFamily.

Dmitry Timoshkov dmitry at baikal.ru
Tue May 8 05:29:41 CDT 2012


---
 dlls/gdiplus/font.c            |   25 +++++++++++++++++++++++--
 dlls/gdiplus/gdiplus_private.h |    1 +
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c
index 7cc5910..a07333a 100644
--- a/dlls/gdiplus/font.c
+++ b/dlls/gdiplus/font.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2007 Google (Evan Stade)
+ * Copyright (C) 2012 Dmitry Timoshkov
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -158,6 +159,13 @@ GpStatus WINGDIPAPI GdipCreateFont(GDIPCONST GpFontFamily *fontFamily,
     (*font)->height = otm->otmEMSquare;
     (*font)->line_spacing = otm->otmTextMetrics.tmAscent + otm->otmTextMetrics.tmDescent + otm->otmTextMetrics.tmExternalLeading;
 
+    stat = GdipCloneFontFamily((GpFontFamily *)fontFamily, &(*font)->family);
+    if (stat != Ok)
+    {
+        GdipFree(*font);
+        return stat;
+    }
+
     TRACE("<-- %p\n", *font);
 
     return Ok;
@@ -171,6 +179,7 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc,
 {
     HFONT hfont, oldfont;
     TEXTMETRICW textmet;
+    GpStatus stat;
 
     TRACE("(%p, %p, %p)\n", hdc, logfont, font);
 
@@ -206,6 +215,13 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc,
     SelectObject(hdc, oldfont);
     DeleteObject(hfont);
 
+    stat = GdipCreateFontFamilyFromName(logfont->lfFaceName, NULL, &(*font)->family);
+    if (stat != Ok)
+    {
+        GdipFree(*font);
+        return NotTrueTypeFont;
+    }
+
     TRACE("<-- %p\n", *font);
 
     return Ok;
@@ -242,6 +258,7 @@ GpStatus WINGDIPAPI GdipDeleteFont(GpFont* font)
     if(!font)
         return InvalidParameter;
 
+    GdipDeleteFontFamily(font->family);
     GdipFree(font);
 
     return Ok;
@@ -290,7 +307,7 @@ GpStatus WINGDIPAPI GdipGetFamily(GpFont *font, GpFontFamily **family)
     if (!(font && family))
         return InvalidParameter;
 
-    return GdipCreateFontFamilyFromName(font->lfw.lfFaceName, NULL, family);
+    return GdipCloneFontFamily(font->family, family);
 }
 
 /******************************************************************************
@@ -424,6 +441,8 @@ GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics,
  */
 GpStatus WINGDIPAPI GdipCloneFont(GpFont *font, GpFont **cloneFont)
 {
+    GpStatus stat;
+
     TRACE("(%p, %p)\n", font, cloneFont);
 
     if(!font || !cloneFont)
@@ -433,8 +452,10 @@ GpStatus WINGDIPAPI GdipCloneFont(GpFont *font, GpFont **cloneFont)
     if(!*cloneFont)    return OutOfMemory;
 
     **cloneFont = *font;
+    stat = GdipCloneFontFamily(font->family, &(*cloneFont)->family);
+    if (stat != Ok) GdipFree(*cloneFont);
 
-    return Ok;
+    return stat;
 }
 
 /*******************************************************************************
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index 72de9cb..3676358 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -346,6 +346,7 @@ struct GpImageAttributes{
 };
 
 struct GpFont{
+    GpFontFamily *family;
     LOGFONTW lfw;
     REAL emSize;
     REAL pixel_size;
-- 
1.7.10.1




More information about the wine-patches mailing list