[1/5] gdi32: simple implementation of CreateFontIndirectEx with tests (fixes 13064)
Nikolay Sivov
bunglehead at gmail.com
Sun Jun 29 04:01:55 CDT 2008
Changelog:
- Simple implementation of CreateFontIndirectEx + tests
---
dlls/gdi32/font.c | 20 ++++++++++++++++++++
dlls/gdi32/gdi32.spec | 4 ++--
dlls/gdi32/tests/font.c | 35 +++++++++++++++++++++++++++++++++--
include/wingdi.h | 27 +++++++++++++++++++++++++++
4 files changed, 82 insertions(+), 4 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 91e41e7..6d9f85c 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 868661c..eb24c61 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -40,6 +40,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;
@@ -54,6 +55,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)
@@ -120,12 +122,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;
@@ -137,11 +149,30 @@ 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
+ {
+ /* NULL argument */
+ hfont = pCreateFontIndirectExA(NULL);
+ ok(hfont == NULL, "CreateFontIndirectEx should return NULL on NULL argument\n");
+
+ /* not NULL argument */
+ memcpy(&lfex.elfEnumLogfontEx.elfLogFont, &lf, sizeof(lf));
+
+ lstrcpyA((CHAR*)lfex.elfEnumLogfontEx.elfFullName,"Arial");
+ lstrcpyA((CHAR*)lfex.elfEnumLogfontEx.elfStyle,"Regular");
+ lstrcpyA((CHAR*)lfex.elfEnumLogfontEx.elfScript,"Western");
+
+ 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);
diff --git a/include/wingdi.h b/include/wingdi.h
index 14c307d..39b6699 100644
--- a/include/wingdi.h
+++ b/include/wingdi.h
@@ -606,6 +606,30 @@ typedef struct
DECL_WINELIB_TYPE_AW(ENUMLOGFONTEX)
DECL_WINELIB_TYPE_AW(LPENUMLOGFONTEX)
+#define MM_MAX_NUMAXES 16
+
+typedef struct
+{
+ DWORD dvReserved;
+ DWORD dvNumAxes;
+ LONG dvValues[MM_MAX_NUMAXES];
+} DESIGNVECTOR, *PDESIGNVECTOR;
+
+typedef struct
+{
+ ENUMLOGFONTEXA elfEnumLogfontEx;
+ DESIGNVECTOR elfDesignVector;
+} ENUMLOGFONTEXDVA, *PENUMLOGFONTEXDVA;
+
+typedef struct
+{
+ ENUMLOGFONTEXW elfEnumLogfontEx;
+ DESIGNVECTOR elfDesignVector;
+} ENUMLOGFONTEXDVW, *PENUMLOGFONTEXDVW;
+
+DECL_WINELIB_TYPE_AW(ENUMLOGFONTEXDV)
+DECL_WINELIB_TYPE_AW(PENUMLOGFONTEXDV)
+
/*
* The FONTSIGNATURE tells which Unicode ranges and which code pages
* have glyphs in a font.
@@ -3342,6 +3366,9 @@ WINGDIAPI HFONT WINAPI CreateFontW(INT,INT,INT,INT,INT,DWORD,DWORD,DWORD,D
WINGDIAPI HFONT WINAPI CreateFontIndirectA(const LOGFONTA*);
WINGDIAPI HFONT WINAPI CreateFontIndirectW(const LOGFONTW*);
#define CreateFontIndirect WINELIB_NAME_AW(CreateFontIndirect)
+WINGDIAPI HFONT WINAPI CreateFontIndirectExA(const ENUMLOGFONTEXDVA*);
+WINGDIAPI HFONT WINAPI CreateFontIndirectExW(const ENUMLOGFONTEXDVW*);
+#define CreateFontIndirectEx WINELIB_NAME_AW(CreateFontIndirectEx)
WINGDIAPI HPALETTE WINAPI CreateHalftonePalette(HDC);
WINGDIAPI HBRUSH WINAPI CreateHatchBrush(INT,COLORREF);
WINGDIAPI HDC WINAPI CreateICA(LPCSTR,LPCSTR,LPCSTR,const DEVMODEA*);
--
1.4.4.4
More information about the wine-patches
mailing list