[2/8] gdi32: Implementation of CreateFontIndirectEx with test(fixes bug 13064)

Dmitry Timoshkov dmitry at codeweavers.com
Mon Jun 23 22:34:35 CDT 2008


"Nikolay Sivov" <bunglehead at gmail.com> wrote:

> +/***********************************************************************
> + *           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));

Why did you add the if(!plf) check?

> +static HFONT create_font_ex(const char* test, const ENUMLOGFONTEXDV* lfex)
> +{
> +    HFONT hfont = CreateFontIndirectExA(lfex);
> +    ok(hfont != 0, "CreateFontIndirectEx failed\n");
> +    if (hfont)
> +        check_font(test, &(lfex->elfEnumLogfontEx.elfLogFont), hfont);
> +    return hfont;
> +}

You need to load CreateFontIndirectExA dynamically, otherwise the test won't
run under NT4/Win9x.

> static void test_logfont(void)
> {
>     LOGFONTA lf;
> +    ENUMLOGFONTEXDVA lfex;
>     HFONT hfont;
> 
>     memset(&lf, 0, sizeof lf);
> @@ -137,6 +147,10 @@ static void test_logfont(void)
>     hfont = create_font("Arial", &lf);
>     DeleteObject(hfont);
> 
> +    lstrcpyA(lfex.elfEnumLogfontEx.elfLogFont.lfFaceName, "Arial");
> +    hfont = create_font_ex("Arial", &lfex);
> +    DeleteObject(hfont);

All the code in test_logfont() fully initializes the LOGFONT before passing
it to an API, the test above doesn't, is there any reason for that?

-- 
Dmitry.



More information about the wine-devel mailing list