[2/2] gdi32: implementation of CreateFontIndirectEx (fix for 13064) (resent)
Nikolay Sivov
bunglehead at gmail.com
Tue Jun 24 02:21:45 CDT 2008
Changelog:
- Implemented CreateFontIndirectEx with tests
- since prev patch: dynamic link to CreateFontIndirectExA in tests
fully initialized struct in tests
(thanks Dmitry Timoshkov)
---
dlls/gdi32/font.c | 20 ++++++++++++++++++++
dlls/gdi32/gdi32.spec | 4 ++--
dlls/gdi32/tests/font.c | 26 ++++++++++++++++++++++++--
3 files changed, 46 insertions(+), 4 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 1bfd97a..ace5021 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -392,6 +392,26 @@ HFONT WINAPI CreateFontIndirectW( const LOGFONTW *plf )
return hFont;
}
+/***********************************************************************
+ * CreateFontIndirectExA (GDI32.@)
+ */
+HFONT WINAPI CreateFontIndirectExA( const ENUMLOGFONTEXDVA *plf )
+{
+ if(!plf) return NULL;
+
+ return CreateFontIndirectA(&(plf->elfEnumLogfontEx.elfLogFont));
+}
+
+/***********************************************************************
+ * CreateFontIndirectExW (GDI32.@)
+ */
+HFONT WINAPI CreateFontIndirectExW( const ENUMLOGFONTEXDVW *plf )
+{
+ if(!plf) return NULL;
+
+ return CreateFontIndirectW(&(plf->elfEnumLogfontEx.elfLogFont));
+}
+
/*************************************************************************
* CreateFontA (GDI32.@)
*/
diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec
index 99df6d1..c0e5456 100644
--- a/dlls/gdi32/gdi32.spec
+++ b/dlls/gdi32/gdi32.spec
@@ -58,8 +58,8 @@
@ stdcall CreateEnhMetaFileW(long wstr ptr wstr)
@ stdcall CreateFontA(long long long long long long long long long long long long long str)
@ stdcall CreateFontIndirectA(ptr)
-# @ stub CreateFontIndirectExA
-# @ stub CreateFontIndirectExW
+@ stdcall CreateFontIndirectExA(ptr)
+@ stdcall CreateFontIndirectExW(ptr)
@ stdcall CreateFontIndirectW(ptr)
@ stdcall CreateFontW(long long long long long long long long long long long long long wstr)
@ stdcall CreateHalftonePalette(long)
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 3ae512c..83f3008 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -39,6 +39,7 @@ DWORD (WINAPI *pGetFontUnicodeRanges)(HDC hdc, LPGLYPHSET lpgs);
DWORD (WINAPI *pGetGlyphIndicesA)(HDC hdc, LPCSTR lpstr, INT count, LPWORD pgi, DWORD flags);
DWORD (WINAPI *pGetGlyphIndicesW)(HDC hdc, LPCWSTR lpstr, INT count, LPWORD pgi, DWORD flags);
BOOL (WINAPI *pGdiRealizationInfo)(HDC hdc, DWORD *);
+HFONT (WINAPI *pCreateFontIndirectExA)(CONST ENUMLOGFONTEXDVA *penumlfex);
static HMODULE hgdi32 = 0;
@@ -53,6 +54,7 @@ static void init(void)
pGetGlyphIndicesA = (void *)GetProcAddress(hgdi32, "GetGlyphIndicesA");
pGetGlyphIndicesW = (void *)GetProcAddress(hgdi32, "GetGlyphIndicesW");
pGdiRealizationInfo = (void *)GetProcAddress(hgdi32, "GdiRealizationInfo");
+ pCreateFontIndirectExA = (void *)GetProcAddress(hgdi32, "CreateFontIndirectExA");
}
static INT CALLBACK is_truetype_font_installed_proc(const LOGFONT *elf, const TEXTMETRIC *ntm, DWORD type, LPARAM lParam)
@@ -119,12 +121,22 @@ static HFONT create_font(const char* test, const LOGFONTA* lf)
return hfont;
}
+static HFONT create_font_ex(const char* test, const ENUMLOGFONTEXDV* lfex)
+{
+ HFONT hfont = pCreateFontIndirectExA(lfex);
+ ok(hfont != 0, "CreateFontIndirectEx failed\n");
+ if (hfont)
+ check_font(test, &(lfex->elfEnumLogfontEx.elfLogFont), hfont);
+ return hfont;
+}
+
static void test_logfont(void)
{
LOGFONTA lf;
+ ENUMLOGFONTEXDVA lfex;
HFONT hfont;
- memset(&lf, 0, sizeof lf);
+ memset(&lf, 0, sizeof(lf));
lf.lfCharSet = ANSI_CHARSET;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
@@ -136,11 +148,21 @@ static void test_logfont(void)
lstrcpyA(lf.lfFaceName, "Arial");
hfont = create_font("Arial", &lf);
DeleteObject(hfont);
+
+
+ if(!pCreateFontIndirectExA)
+ skip("CreateFontIndirectExA not implemeted on this platform\n");
+ else
+ {
+ memcpy(&lfex.elfEnumLogfontEx.elfLogFont, &lf, sizeof(lf));
+ hfont = create_font_ex("Arial", &lfex);
+ DeleteObject(hfont);
+ }
memset(&lf, 'A', sizeof(lf));
hfont = CreateFontIndirectA(&lf);
ok(hfont != 0, "CreateFontIndirectA with strange LOGFONT failed\n");
-
+
lf.lfFaceName[LF_FACESIZE - 1] = 0;
check_font("AAA...", &lf, hfont);
DeleteObject(hfont);
--
1.4.4.4
More information about the wine-patches
mailing list