[PATCH] CreateFontIndirectEx implementation on top of CreateFontIndirect
Nikolay Sivov
nsivov at codeweavers.com
Thu Jun 10 16:42:06 CDT 2010
---
dlls/gdi32/font.c | 17 +++++++++++++++++
dlls/gdi32/gdi32.spec | 4 ++--
dlls/gdi32/tests/font.c | 34 ++++++++++++++++++++++++++++++++++
include/wingdi.h | 27 +++++++++++++++++++++++++++
4 files changed, 80 insertions(+), 2 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 17fb381..5bbf595 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -287,6 +287,23 @@ static LPWSTR FONT_mbtowc(HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP)
return strW;
}
+/***********************************************************************
+ * CreateFontIndirectExA (GDI32.@)
+ */
+HFONT WINAPI CreateFontIndirectExA( const ENUMLOGFONTEXDVA *penumexA )
+{
+ if (!penumexA) return 0;
+ return CreateFontIndirectA(&(penumexA->elfEnumLogfontEx.elfLogFont));
+}
+
+/***********************************************************************
+ * CreateFontIndirectExA (GDI32.@)
+ */
+HFONT WINAPI CreateFontIndirectExW( const ENUMLOGFONTEXDVW *penumex )
+{
+ if (!penumex) return 0;
+ return CreateFontIndirectW(&(penumex->elfEnumLogfontEx.elfLogFont));
+}
/***********************************************************************
* CreateFontIndirectA (GDI32.@)
diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec
index e33a7ae..d3843e6 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 6ef98c8..d89132d 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -43,6 +43,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 ENUMLOGFONTEXDV *);
static HMODULE hgdi32 = 0;
@@ -57,6 +58,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)
@@ -3109,6 +3111,37 @@ static void test_CreateFontIndirect(void)
}
}
+static void test_CreateFontIndirectEx(void)
+{
+ ENUMLOGFONTEXDVA lfex;
+ HFONT hfont;
+
+ if (!pCreateFontIndirectExA)
+ {
+ win_skip("CreateFontIndirectExA is not available\n");
+ return;
+ }
+
+ if (!is_truetype_font_installed("Arial"))
+ {
+ skip("Arial is not installed\n");
+ return;
+ }
+
+ SetLastError(0xdeadbeef);
+ hfont = pCreateFontIndirectExA(NULL);
+ ok(hfont == NULL, "got %p\n", hfont);
+ ok(GetLastError() == 0xdeadbeef, "got error %d\n", GetLastError());
+
+ memset(&lfex, 0, sizeof(lfex));
+ lstrcpyA(lfex.elfEnumLogfontEx.elfLogFont.lfFaceName, "Arial");
+ hfont = pCreateFontIndirectExA(&lfex);
+ ok(hfont != 0, "CreateFontIndirectEx failed\n");
+ if (hfont)
+ check_font("Arial", &lfex.elfEnumLogfontEx.elfLogFont, hfont);
+ DeleteObject(hfont);
+}
+
START_TEST(font)
{
init();
@@ -3155,5 +3188,6 @@ START_TEST(font)
test_GetTextMetrics2("Arial", -55);
test_GetTextMetrics2("Arial", -110);
test_CreateFontIndirect();
+ test_CreateFontIndirectEx();
test_oemcharset();
}
diff --git a/include/wingdi.h b/include/wingdi.h
index 99fd2bc..e7aafb2 100644
--- a/include/wingdi.h
+++ b/include/wingdi.h
@@ -610,6 +610,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.
@@ -3356,6 +3380,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.5.6.5
--------------060508090708050108020401--
More information about the wine-patches
mailing list