There is a sort way to save all wxFontData and then load the string and construct wxFontData from that string?
Thanks
Jim
wxFontData as wxString
Re: wxFontData as wxString
wxFont::GetNativeFontInfoDesc() and wxFont::SetNativeFontInfo()
Use the source, Luke!
Re: wxFontData as wxString
Hello, thanks, but after data=wxFontData type object add choosing font and then i am taking error ..
Any Idea why? Compilation is ok.../src/common/fontcmn.cpp(321): assert "IsOk()" failed in GetNativeFontInfoDesc(): invalid font
Code: Select all
wxFontDialog fnt(this, data);
if ( fnt.ShowModal() == wxID_OK )
{
data = fnt.GetFontData();
}
wxString f=data.GetInitialFont().GetNativeFontInfoDesc();
Re: wxFontData as wxString
This has nothing to do with GetNativeFontInfoDesc(), you just have to make sure the font is valid.
Use GetChosenFont() instead of GetInitialFont(), of course this is only valid if ShowModal returned wxID_OK.
Use GetChosenFont() instead of GetInitialFont(), of course this is only valid if ShowModal returned wxID_OK.
Use the source, Luke!
Re: wxFontData as wxString
Thanks very much.
Works fine.
Works fine.
Re: wxFontData as wxString
Hello loosing my code, i just make a new, but i have bugs.
In code i haven’t error in compiling and running .., but at dc text is ok, but with no font tha i have choose.
Any wrong in code?
Thank's
Jim
Ok Just find
In code i haven’t error in compiling and running .., but at dc text is ok, but with no font tha i have choose.
Any wrong in code?
Thank's
Jim
Code: Select all
wxFontData data;
wxFontDialog fnt(this, data);
if ( fnt.ShowModal() != wxID_OK )return;
data = fnt.GetFontData();
wxString FontData=wxToString(data.GetInitialFont());
------------------------
in other place ...
wxDC* dc;
wxFont font;
wxFromString(FontData,&font);
dc->SetFont(font); /// no error in compiling and running ..
I just find, just must put data.GetChosenFont().GetNativeFontInfoDesc();
or
FontData=wxToString(data.GetChosenFont());