static void FONT_EnumLogFontExWToA( const ENUMLOGFONTEXW *fontW, LPENUMLOGFONTEXA fontA )
{
- FONT_LogFontWToA( (const LOGFONTW *)fontW, (LPLOGFONTA)fontA);
+ FONT_LogFontWToA( &fontW->elfLogFont, &fontA->elfLogFont );
WideCharToMultiByte( CP_ACP, 0, fontW->elfFullName, -1,
(LPSTR) fontA->elfFullName, LF_FULLFACESIZE, NULL, NULL );
fontA->elfScript[LF_FACESIZE-1] = '\0';
}
+static void FONT_EnumLogFontExAToW( const ENUMLOGFONTEXA *fontA, LPENUMLOGFONTEXW fontW )
+{
+ FONT_LogFontAToW( &fontA->elfLogFont, &fontW->elfLogFont );
+
+ MultiByteToWideChar( CP_ACP, 0, (LPCSTR)fontA->elfFullName, -1,
+ fontW->elfFullName, LF_FULLFACESIZE );
+ fontW->elfFullName[LF_FULLFACESIZE-1] = '\0';
+ MultiByteToWideChar( CP_ACP, 0, (LPCSTR)fontA->elfStyle, -1,
+ fontW->elfStyle, LF_FACESIZE );
+ fontW->elfStyle[LF_FACESIZE-1] = '\0';
+ MultiByteToWideChar( CP_ACP, 0, (LPCSTR)fontA->elfScript, -1,
+ fontW->elfScript, LF_FACESIZE );
+ fontW->elfScript[LF_FACESIZE-1] = '\0';
+}
+
/***********************************************************************
* TEXTMETRIC conversion functions.
*/
return strW;
}
-
/***********************************************************************
- * CreateFontIndirectA (GDI32.@)
+ * CreateFontIndirectExA (GDI32.@)
*/
-HFONT WINAPI CreateFontIndirectA( const LOGFONTA *plfA )
+HFONT WINAPI CreateFontIndirectExA( const ENUMLOGFONTEXDVA *penumexA )
{
- LOGFONTW lfW;
+ ENUMLOGFONTEXDVW enumexW;
- if (!plfA) return 0;
+ if (!penumexA) return 0;
- FONT_LogFontAToW( plfA, &lfW );
- return CreateFontIndirectW( &lfW );
+ FONT_EnumLogFontExAToW( &penumexA->elfEnumLogfontEx, &enumexW.elfEnumLogfontEx );
+ enumexW.elfDesignVector = penumexA->elfDesignVector;
+ return CreateFontIndirectExW( &enumexW );
}
/***********************************************************************
- * CreateFontIndirectW (GDI32.@)
+ * CreateFontIndirectExA (GDI32.@)
*/
-HFONT WINAPI CreateFontIndirectW( const LOGFONTW *plf )
+HFONT WINAPI CreateFontIndirectExW( const ENUMLOGFONTEXDVW *penumex )
{
HFONT hFont;
FONTOBJ *fontPtr;
+ const LOGFONTW *plf;
- if (!plf) return 0;
+ if (!penumex) return 0;
+
+ if (penumex->elfEnumLogfontEx.elfFullName[0] ||
+ penumex->elfEnumLogfontEx.elfStyle[0] ||
+ penumex->elfEnumLogfontEx.elfScript[0])
+ {
+ FIXME("some fields ignored. fullname=%s, style=%s, script=%s\n",
+ debugstr_w(penumex->elfEnumLogfontEx.elfFullName),
+ debugstr_w(penumex->elfEnumLogfontEx.elfStyle),
+ debugstr_w(penumex->elfEnumLogfontEx.elfScript));
+ }
+ plf = &penumex->elfEnumLogfontEx.elfLogFont;
if (!(fontPtr = HeapAlloc( GetProcessHeap(), 0, sizeof(*fontPtr) ))) return 0;
fontPtr->logfont = *plf;
return hFont;
}
+/***********************************************************************
+ * CreateFontIndirectA (GDI32.@)
+ */
+HFONT WINAPI CreateFontIndirectA( const LOGFONTA *plfA )
+{
+ LOGFONTW lfW;
+
+ if (!plfA) return 0;
+
+ FONT_LogFontAToW( plfA, &lfW );
+ return CreateFontIndirectW( &lfW );
+}
+
+/***********************************************************************
+ * CreateFontIndirectW (GDI32.@)
+ */
+HFONT WINAPI CreateFontIndirectW( const LOGFONTW *plf )
+{
+ ENUMLOGFONTEXDVW exdv;
+
+ if (!plf) return 0;
+
+ exdv.elfEnumLogfontEx.elfLogFont = *plf;
+ exdv.elfEnumLogfontEx.elfFullName[0] = 0;
+ exdv.elfEnumLogfontEx.elfStyle[0] = 0;
+ exdv.elfEnumLogfontEx.elfScript[0] = 0;
+ return CreateFontIndirectExW( &exdv );
+}
+
/*************************************************************************
* CreateFontA (GDI32.@)
*/
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;
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)
}
}
+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();
test_GetTextMetrics2("Arial", -55);
test_GetTextMetrics2("Arial", -110);
test_CreateFontIndirect();
+ test_CreateFontIndirectEx();
test_oemcharset();
}
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.
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*);