font.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: font.h
  3. // Purpose: topic overview
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. @page overview_font wxFont Overview
  9. @tableofcontents
  10. A font is an object which determines the appearance of text, primarily when
  11. drawing text to a window or device context. A font is determined by the
  12. following parameters (not all of them have to be specified, of course):
  13. @beginDefList
  14. @itemdef{Point size, This is the standard way of referring to text size.}
  15. @itemdef{Family,
  16. Supported families are:
  17. @b wxDEFAULT, @b wxDECORATIVE, @b wxROMAN, @b wxSCRIPT, @b wxSWISS, @b wxMODERN.
  18. @b wxMODERN is a fixed pitch font; the others are either fixed or variable pitch.}
  19. @itemdef{Style, The value can be @b wxNORMAL, @b wxSLANT or @b wxITALIC.}
  20. @itemdef{Weight, The value can be @b wxNORMAL, @b wxLIGHT or @b wxBOLD.}
  21. @itemdef{Underlining, The value can be @true or @false.}
  22. @itemdef{Face name,
  23. An optional string specifying the actual typeface to be used. If @NULL,
  24. a default typeface will chosen based on the family.}
  25. @itemdef{Encoding,
  26. The font encoding (see @b wxFONTENCODING_XXX
  27. constants and the @ref overview_fontencoding for more details)}
  28. @endDefList
  29. Specifying a family, rather than a specific typeface name, ensures a degree of
  30. portability across platforms because a suitable font will be chosen for the
  31. given font family, however it doesn't allow to choose a font precisely as the
  32. parameters above don't suffice, in general, to identify all the available fonts
  33. and this is where using the native font descriptions may be helpful - see
  34. below.
  35. Under Windows, the face name can be one of the installed fonts on the user's
  36. system. Since the choice of fonts differs from system to system, either choose
  37. standard Windows fonts, or if allowing the user to specify a face name, store
  38. the family name with any file that might be transported to a different Windows
  39. machine or other platform.
  40. @see wxFont, wxFontDialog
  41. @note There is currently a difference between the appearance of fonts on the
  42. two platforms, if the mapping mode is anything other than wxMM_TEXT.
  43. Under X, font size is always specified in points. Under MS Windows, the
  44. unit for text is points but the text is scaled according to the current
  45. mapping mode. However, user scaling on a device context will also scale
  46. fonts under both environments.
  47. @section overview_font_nativeinfo Native Font Information
  48. An alternative way of choosing fonts is to use the native font description.
  49. This is the only acceptable solution if the user is allowed to choose the font
  50. using the wxFontDialog because the selected font cannot
  51. be described using only the family name and so, if only family name is stored
  52. permanently, the user would almost surely see a different font in the program
  53. later.
  54. Instead, you should store the value returned by wxFont::GetNativeFontInfoDesc and pass
  55. it to wxFont::SetNativeFontInfo later to recreate exactly the same font.
  56. Note that the contents of this string depends on the platform and shouldn't be
  57. used for any other purpose (in particular, it is not meant to be shown to the
  58. user). Also please note that although the native font information is currently
  59. implemented for Windows and Unix (GTK+ and Motif) ports only, all the methods
  60. are available for all the ports and should be used to make your program work
  61. correctly when they are implemented later.
  62. */