can wxFont be created from native handle ? (msw)

Harry harry dot news at armadillo dot fr
Mon Apr 28 02:03:23 PDT 2008




Vadim - thanks for clarifying the differences.

Regards
Harry

Vadim Zeitlin wrote:
> On Fri, 25 Apr 2008 19:59:33 +0200 Harry <"harry dot news at armadillo dot fr"@riobu.com> wrote:
>
> H> It almost works, except that wxNativeFontInfo has no constructor with 
> H> LOGFONT.
>
>  It does in trunk, with 2.8 you use default ctor and assign your LOGFONT to
> its lf member.
>
> H> I found an undocumented function in fontutil.cpp which I use as follows:
> H> 
> H> extern wxFont wxCreateFontFromLogFont(const LOGFONT *logFont);
> H> 
> H> wxFont CreateFontFromHFONT(HFONT hfont)
> H> {
> H>     LOGFONT   lf;
> H>     ::GetObject(hfont, sizeof lf, &lf);
> H>     return wxCreateFontFromLogFont(&lf);
> H> }
>
>  This is not at all the same because it creates _another_ HFONT. In
> particular this one doesn't take ownership of the provided hfont whereas
> the version I posted did.
>
>  Regards,
> VZ
>
>   


More information about the wx-users mailing list