📄 tfont.tex
字号:
\section{wxFont overview}\label{wxfontoverview}Class: \helpref{wxFont}{wxfont}, \helpref{wxFontDialog}{wxfontdialog}A font is an object which determines the appearance of text, primarilywhen drawing text to a window or device context. A font is determined bythe following parameters (not all of them have to be specified, of course):\begin{twocollist}\itemsep=0pt\twocolitem{Point size}{This is the standard way of referring to text size.}\twocolitem{Family}{Supported families are: {\bf wxDEFAULT, wxDECORATIVE, wxROMAN, wxSCRIPT, wxSWISS, wxMODERN}. {\bf wxMODERN} is a fixed pitch font; the others are either fixed or variable pitch.}\twocolitem{Style}{The value can be {\bf wxNORMAL, wxSLANT} or {\bf wxITALIC}.}\twocolitem{Weight}{The value can be {\bf wxNORMAL, wxLIGHT} or {\bf wxBOLD}.}\twocolitem{Underlining}{The value can be true or false.}\twocolitem{Face name}{An optional string specifying the actual typeface to be used. If NULL,a default typeface will chosen based on the family.}\twocolitem{Encoding}{The font encoding (see {\bf wxFONTENCODING\_XXX}constants and the \helpref{font overview}{wxfontencodingoverview} for moredetails)}\end{twocollist}Specifying a family, rather than a specific typeface name, ensures a degree ofportability across platforms because a suitable font will be chosen for thegiven font family, however it doesn't allow to choose a font precisely as theparameters above don't suffice, in general, to identify all the available fontsand this is where using the native font descriptions may be helpful - seebelow.Under Windows, the face name can be one of the installed fonts on the user'ssystem. Since the choice of fonts differs from system to system, either choosestandard Windows fonts, or if allowing the user to specify a face name, storethe family name with any file that might be transported to a different Windowsmachine or other platform.\normalbox{{\bf Note:} There is currently a difference between the appearanceof fonts on the two platforms, if the mapping mode is anything other thanwxMM\_TEXT. Under X, font size is always specified in points. Under MSWindows, the unit for text is points but the text is scaled according to thecurrent mapping mode. However, user scaling on a device context will alsoscale fonts under both environments.}\subsection{Native font information}\label{nativefontinformation}An 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 fontusing the \helpref{wxFontDialog}{wxfontdialog} because the selected font cannotbe described using only the family name and so, if only family name is storedpermanently, the user would almost surely see a different font in the programlater.Instead, you should store the value returned by \helpref{wxFont::GetNativeFontInfoDesc}{wxfontgetnativefontinfodesc} and passit to \helpref{wxFont::SetNativeFontInfo}{wxfontsetnativefontinfo} later torecreate exactly the same font.Note that the contents of this string depends on the platform and shouldn't beused for any other purpose (in particular, it is not meant to be shown to theuser). Also please note that although the native font information is currentlyimplemented for Windows and Unix (GTK+ and Motif) ports only, all the methodsare available for all the ports and should be used to make your program workcorrectly when they are implemented later.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -