File: overview_font.html

package info (click to toggle)
wxpython3.0 3.0.2.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 482,760 kB
  • ctags: 518,293
  • sloc: cpp: 2,127,226; python: 294,045; makefile: 51,942; ansic: 19,033; sh: 3,013; xml: 1,629; perl: 17
file content (93 lines) | stat: -rw-r--r-- 7,153 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>wxWidgets: wxFont Overview</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="page_container">
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0" style="width: 100%;">
 <tbody>
 <tr>
  <td id="projectlogo">
    <a href="http://www.wxwidgets.org/" target="_new">
      <img alt="wxWidgets" src="logo.png"/>
    </a>
  </td>
  <td style="padding-left: 0.5em; text-align: right;">
   <span id="projectnumber">Version: 3.0.2</span>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.2 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Categories</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="index.html">Documentation</a></li><li class="navelem"><a class="el" href="page_topics.html">Programming Guides</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title"><a class="el" href="classwx_font.html" title="A font is an object which determines the appearance of text.">wxFont</a> Overview </div>  </div>
</div><!--header-->
<div class="contents">
<div class="toc"><h3>Table of Contents</h3>
<ul><li class="level1"><a href="#overview_font_nativeinfo">Native Font Information</a></li>
</ul>
</div>
<div class="textblock"><p>A font is an object which determines the appearance of text, primarily when drawing text to a window or device context.</p>
<p>A font is determined by the following parameters (not all of them have to be specified, of course):</p>
<table  class="doclist" border="1" cellspacing="0">
<tr>
<td><span class="itemdef">Point size</span> </td><td>This is the standard way of referring to text size. </td></tr>
<tr>
<td><span class="itemdef">Family</span> </td><td>Supported families are: <b>wxDEFAULT</b>, <b>wxDECORATIVE</b>, <b>wxROMAN</b>, <b>wxSCRIPT</b>, <b>wxSWISS</b>, <b>wxMODERN</b>. <b>wxMODERN</b> is a fixed pitch font; the others are either fixed or variable pitch. </td></tr>
<tr>
<td><span class="itemdef">Style</span> </td><td>The value can be <b>wxNORMAL</b>, <b>wxSLANT</b> or <b>wxITALIC</b>. </td></tr>
<tr>
<td><span class="itemdef">Weight</span> </td><td>The value can be <b>wxNORMAL</b>, <b>wxLIGHT</b> or <b>wxBOLD</b>. </td></tr>
<tr>
<td><span class="itemdef">Underlining</span> </td><td>The value can be <span class="literal">true</span> or <span class="literal">false</span>. </td></tr>
<tr>
<td><span class="itemdef">Face name</span> </td><td>An optional string specifying the actual typeface to be used. If <span class="literal">NULL</span>, a default typeface will chosen based on the family. </td></tr>
<tr>
<td><span class="itemdef">Encoding</span> </td><td>The font encoding (see <b>wxFONTENCODING_XXX</b> constants and the <a class="el" href="overview_fontencoding.html">Font Encodings</a> for more details) </td></tr>
</table>
<p>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.</p>
<p>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.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classwx_font.html" title="A font is an object which determines the appearance of text.">wxFont</a>, <a class="el" href="classwx_font_dialog.html" title="This class represents the font chooser dialog.">wxFontDialog</a></dd></dl>
<dl class="section note"><dt>Note</dt><dd>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.</dd></dl>
<h1><a class="anchor" id="overview_font_nativeinfo"></a>
Native Font Information</h1>
<p>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 font using the <a class="el" href="classwx_font_dialog.html" title="This class represents the font chooser dialog.">wxFontDialog</a> 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.</p>
<p>Instead, you should store the value returned by <a class="el" href="classwx_font.html#ac78bab66824b38f42669cfc0b4dc7c9f" title="Returns the platform-dependent string completely describing this font.">wxFont::GetNativeFontInfoDesc</a> and pass it to <a class="el" href="classwx_font.html#aaef8dc8fc6c8b81246af000a201b52c5" title="Creates the font corresponding to the given native font description string which must have been previ...">wxFont::SetNativeFontInfo</a> later to recreate exactly the same font.</p>
<p>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. </p>
</div></div><!-- contents -->

<address class="footer">
	<small>
		Generated on Thu Nov 27 2014 13:46:42 for wxWidgets by <a href="http://www.doxygen.org/index.html" target="_new">Doxygen</a> 1.8.2
	</small>
</address>
<script src="wxwidgets.js" type="text/javascript"></script>
</div><!-- #page_container -->
</body>
</html>