gdi32: added CreateFontIndirectEx[A/W] (try2)
Nikolay Sivov
bunglehead at gmail.com
Sun Oct 26 10:14:02 CDT 2008
Changelog(try2):
- win_skip on unimplemented call
- added CreateFontIndirectEx[A/W]
>From 50c8b6c9cfe850ef499c82b99a8071c8e2d67c63 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Sun, 26 Oct 2008 18:11:29 +0300
Subject: Added CreateFontIndirectEx[A/W]
---
dlls/gdi32/font.c | 20 ++++++++++++++++++++
dlls/gdi32/tests/font.c | 31 +++++++++++++++++++++++++++++--
include/wingdi.h | 29 +++++++++++++++++++++++++++++
3 files changed, 78 insertions(+), 2 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 7862565..0ed5365 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/tests/font.c b/dlls/gdi32/tests/font.c
index 48a8fe5..9bc2366 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)
@@ -123,9 +125,10 @@ static HFONT create_font(const char* test, const LOGFONTA* lf)
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;
@@ -138,10 +141,34 @@ static void test_logfont(void)
hfont = create_font("Arial", &lf);
DeleteObject(hfont);
+ if(!pCreateFontIndirectExA)
+ win_skip("CreateFontIndirectExA not implemeted on this platform\n");
+ else
+ {
+ /* NULL argument */
+ HFONT hfont2 = pCreateFontIndirectExA(NULL);
+ ok(hfont2 == 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");
+ lfex.elfDesignVector.dvReserved = STAMP_DESIGNVECTOR;
+ lfex.elfDesignVector.dvNumAxes = 0;
+
+ hfont2 = pCreateFontIndirectExA(&lfex);
+ ok(hfont2 != 0, "CreateFontIndirectEx failed\n");
+ if (hfont2)
+ check_font("Arial", &lfex.elfEnumLogfontEx.elfLogFont, hfont2);
+ DeleteObject(hfont2);
+ }
+
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 322a267..2d7b74b 100644
--- a/include/wingdi.h
+++ b/include/wingdi.h
@@ -607,6 +607,32 @@ typedef struct
DECL_WINELIB_TYPE_AW(ENUMLOGFONTEX)
DECL_WINELIB_TYPE_AW(LPENUMLOGFONTEX)
+#define MM_MAX_NUMAXES 16
+
+#define STAMP_DESIGNVECTOR (0x8000000 + 'd' + ('v' << 8))
+
+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.
@@ -3343,6 +3369,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