[Gdiplus 4/5] Paritially implement GdipPrivateAddFontFile

Adam Petaccia adam at tpetaccia.com
Sat Aug 16 22:29:20 CDT 2008


GDI32 doesn't return font information such as the actual name of what we added,
      so that remains to be implemented.
---
 dlls/gdiplus/font.c       |   20 ++++++++++++++++++--
 dlls/gdiplus/tests/font.c |    5 +++--
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c
index 5a3b3df..ce43a80 100644
--- a/dlls/gdiplus/font.c
+++ b/dlls/gdiplus/font.c
@@ -705,12 +705,28 @@ GpStatus WINGDIPAPI GdipDeletePrivateFontCollection(GpFontCollection **fontColle
 GpStatus WINGDIPAPI GdipPrivateAddFontFile(GpFontCollection* fontCollection,
         GDIPCONST WCHAR* filename)
 {
-    FIXME("stub: %p, %s\n", fontCollection, debugstr_w(filename));
+    TRACE("%p, %s\n", fontCollection, debugstr_w(filename));
 
     if (!(fontCollection && filename))
         return InvalidParameter;
 
-    return NotImplemented;
+    if (!AddFontResourceExW(filename, FR_PRIVATE, 0))
+    {
+        TRACE("Filename %s not found\n", debugstr_w(filename));
+        return FileNotFound;
+    }
+
+    TRACE("Found %s\n", debugstr_w(filename));
+
+    /* We're currently able to add the font family, so that the application
+     * could request it if it knew the name. Storing a list of what was
+     * added isn't supported, yet.
+     */
+    FIXME("%s may not be discoverable!\n", debugstr_w(filename));
+
+    fontCollection->FamilyCount++;
+
+    return Ok;
 }
 
 /*****************************************************************************
diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c
index 9b14713..2b7a5c9 100644
--- a/dlls/gdiplus/tests/font.c
+++ b/dlls/gdiplus/tests/font.c
@@ -351,7 +351,6 @@ static void test_fontcollections(void)
     expect(Ok, stat);
     stat = GdipPrivateAddFontFile(PrivateFontCollection, NULL);
     expect(InvalidParameter, stat);
-todo_wine{
     stat = GdipPrivateAddFontFile(PrivateFontCollection, badFileName);
     expect(FileNotFound, stat);
 
@@ -369,10 +368,12 @@ todo_wine{
         hastimesnr = TRUE;
     }
 
+todo_wine
+{
     stat = GdipGetFontCollectionFamilyCount(PrivateFontCollection, &count);
     expect(Ok, stat);
-}
     expect(expected, count);
+}
 
     expected = count;
 
-- 
1.5.4.3




More information about the wine-patches mailing list