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
|
<!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: Font Encodings</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 Page</span></a></li>
<li class="current"><a href="pages.html"><span>Related 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">Font Encodings </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>wxWidgets has support for multiple font encodings.</p>
<p>By encoding we mean here the mapping between the character codes and the letters. Probably the most well-known encoding is (7 bit) ASCII one which is used almost universally now to represent the letters of the English alphabet and some other common characters. However, it is not enough to represent the letters of foreign alphabets and here other encodings come into play. Please note that we will only discuss 8-bit fonts here and not Unicode (see <a class="el" href="overview_unicode.html">Unicode Support in wxWidgets</a>).</p>
<p>Font encoding support is ensured by several classes: <a class="el" href="classwx_font.html" title="A font is an object which determines the appearance of text.">wxFont</a> itself, but also <a class="el" href="classwx_font_enumerator.html" title="wxFontEnumerator enumerates either all available fonts on the system or only the ones with given attr...">wxFontEnumerator</a> and <a class="el" href="classwx_font_mapper.html" title="wxFontMapper manages user-definable correspondence between logical font names and the fonts present o...">wxFontMapper</a>. <a class="el" href="classwx_font.html" title="A font is an object which determines the appearance of text.">wxFont</a> encoding support is reflected by a (new) constructor parameter <em>encoding</em> which takes one of the following values (elements of enumeration type <code>wxFontEncoding</code>):</p>
<table class="doclist" border="1" cellspacing="0">
<tr>
<td><span class="itemdef">wxFONTENCODING_SYSTEM</span> </td><td>The default encoding of the underlying operating system (notice that this might be a "foreign" encoding for foreign versions of Windows 9x/NT). </td></tr>
<tr>
<td><span class="itemdef">wxFONTENCODING_DEFAULT</span> </td><td>The applications default encoding as returned by <a class="el" href="classwx_font.html#a25477da7dac4edbf65fab4a72191d729" title="Returns the current application's default encoding.">wxFont::GetDefaultEncoding</a>. On program startup, the applications default encoding is the same as wxFONTENCODING_SYSTEM, but may be changed to make all the fonts created later to use it (by default). </td></tr>
<tr>
<td><span class="itemdef">wxFONTENCODING_ISO8859_1..15</span> </td><td>ISO8859 family encodings which are usually used by all non-Microsoft operating systems. </td></tr>
<tr>
<td><span class="itemdef">wxFONTENCODING_KOI8</span> </td><td>Standard Cyrillic encoding for the Internet (but see also wxFONTENCODING_ISO8859_5 and wxFONTENCODING_CP1251). </td></tr>
<tr>
<td><span class="itemdef">wxFONTENCODING_CP1250</span> </td><td>Microsoft analogue of ISO8859-2 </td></tr>
<tr>
<td><span class="itemdef">wxFONTENCODING_CP1251</span> </td><td>Microsoft analogue of ISO8859-5 </td></tr>
<tr>
<td><span class="itemdef">wxFONTENCODING_CP1252</span> </td><td>Microsoft analogue of ISO8859-1 </td></tr>
</table>
<p>As you may see, Microsoft's encoding partly mirror the standard ISO8859 ones, but there are (minor) differences even between ISO8859-1 (Latin1, ISO encoding for Western Europe) and CP1251 (WinLatin1, standard code page for English versions of Windows) and there are more of them for other encodings.</p>
<p>The situation is particularly complicated with Cyrillic encodings for which (more than) three incompatible encodings exist: KOI8 (the old standard, widely used on the Internet), ISO8859-5 (ISO standard for Cyrillic) and CP1251 (WinCyrillic).</p>
<p>This abundance of (incompatible) encodings should make it clear that using encodings is less easy than it might seem. The problems arise both from the fact that the standard encodings for the given language (say Russian, which is written in Cyrillic) are different on different platforms and because the fonts in the given encoding might just not be installed (this is especially a problem with Unix, or, in general, non-Win32 systems).</p>
<p>To clarify, the <a class="el" href="classwx_font_enumerator.html" title="wxFontEnumerator enumerates either all available fonts on the system or only the ones with given attr...">wxFontEnumerator</a> class may be used to enumerate both all available encodings and to find the facename(s) in which the given encoding exists. If you can find the font in the correct encoding with <a class="el" href="classwx_font_enumerator.html" title="wxFontEnumerator enumerates either all available fonts on the system or only the ones with given attr...">wxFontEnumerator</a> then your troubles are over, but, unfortunately, sometimes this is not enough. For example, there is no standard way (that I know of, please tell me if you do!) to find a font on a Windows system for KOI8 encoding (only for WinCyrillic one which is quite different), so <a class="el" href="classwx_font_enumerator.html" title="wxFontEnumerator enumerates either all available fonts on the system or only the ones with given attr...">wxFontEnumerator</a> will never return one, even if the user has installed a KOI8 font on his system.</p>
<p>To solve this problem, a <a class="el" href="classwx_font_mapper.html" title="wxFontMapper manages user-definable correspondence between logical font names and the fonts present o...">wxFontMapper</a> class is provided.</p>
<p>This class stores the mapping between the encodings and the font face names which support them in <a class="el" href="classwx_config_base.html" title="wxConfigBase defines the basic interface of all config classes.">wxConfigBase</a> object. Of course, it would be fairly useless if it tried to determine these mappings by itself, so, instead, it (optionally) asks the user and remembers his answers so that the next time the program will automatically choose the correct font. All these topics are illustrated by the <a class="el" href="page_samples.html#page_samples_font">Font Sample</a>; please refer to it and the documentation of the classes mentioned here for further explanations. </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>
|