wxfont overviewclass: wxfont, wxfontdialog a font is an object which determines the appearance of text, primarily when drawing text to a window or device context. a font is determined by the following parameters (not all of them have to be specified, of course):
specifying a family, rather than a specific typeface name, ensures a degree of portability across platforms because a suitable font will be chosen for the given font family, however it doesn't allow to choose a font precisely as the parameters above don't suffice, in general, to identify all the available fonts and this is where using the native font descriptions may be helpful - see below. under windows, the face name can be one of the installed fonts on the user's system. since the choice of fonts differs from system to system, either choose standard windows fonts, or if allowing the user to specify a face name, store the family name with any file that might be transported to a different windows machine or other platform.
note: there is currently a difference between the appearance of fonts on the two platforms, if the mapping mode is anything other than wxmm_text. under x, font size is always specified in points. under ms windows, the unit for text is points but the text is scaled according to the current mapping mode. however, user scaling on a device context will also scale fonts under both environments.
native font informationan alternative way of choosing fonts is to use the native font description. this is the only acceptable solution if the user is allowed to choose the font using the wxfontdialog because the selected font cannot be described using only the family name and so, if only family name is stored permanently, the user would almost surely see a different font in the program later. instead, you should store the value returned by wxfont::getnativefontinfodesc and pass it to wxfont::setnativefontinfo later to recreate exactly the same font. note that the contents of this string depends on the platform and shouldn't be used for any other purpose (in particular, it is not meant to be shown to the user). also please note that although the native font information is currently implemented for windows and unix (gtk+ and motif) ports only, all the methods are available for all the ports and should be used to make your program work correctly when they are implemented later.
|