]> git.saurik.com Git - wxWidgets.git/blame - docs/doxygen/overviews/fontencoding.h
Fix problem with COMDLG_FILTERSPEC declaration with MinGW-w64 4.8.
[wxWidgets.git] / docs / doxygen / overviews / fontencoding.h
CommitLineData
15b6757b 1/////////////////////////////////////////////////////////////////////////////
3b88355f 2// Name: fontencoding.h
15b6757b
FM
3// Purpose: topic overview
4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
15b6757b
FM
6/////////////////////////////////////////////////////////////////////////////
7
880efa2a 8/**
36c9828f 9
dc28cdf8 10@page overview_fontencoding Font Encodings
36c9828f 11
831e1028
BP
12@tableofcontents
13
dc28cdf8 14wxWidgets has support for multiple font encodings.
3b88355f 15
dc28cdf8
FM
16By encoding we mean here the mapping between the character codes and the
17letters. Probably the most well-known encoding is (7 bit) ASCII one which is
18used almost universally now to represent the letters of the English alphabet
19and some other common characters. However, it is not enough to represent the
20letters of foreign alphabets and here other encodings come into play. Please
21note that we will only discuss 8-bit fonts here and not Unicode
22(see @ref overview_unicode).
3b88355f 23
831e1028
BP
24Font encoding support is ensured by several classes: wxFont itself, but also
25wxFontEnumerator and wxFontMapper. wxFont encoding support is reflected by a
26(new) constructor parameter @e encoding which takes one of the following values
27(elements of enumeration type @c wxFontEncoding):
36c9828f 28
dc28cdf8
FM
29@beginDefList
30@itemdef{wxFONTENCODING_SYSTEM,
31 The default encoding of the underlying
32 operating system (notice that this might be a "foreign" encoding for foreign
33 versions of Windows 9x/NT).}
34@itemdef{wxFONTENCODING_DEFAULT,
35 The applications default encoding as returned by wxFont::GetDefaultEncoding.
36 On program startup, the applications default encoding is the same as
37 wxFONTENCODING_SYSTEM, but may be changed to make all the fonts created later
38 to use it (by default).}
39@itemdef{wxFONTENCODING_ISO8859_1..15,
40 ISO8859 family encodings which are
41 usually used by all non-Microsoft operating systems.}
42@itemdef{wxFONTENCODING_KOI8,
43 Standard Cyrillic encoding for the Internet
44 (but see also wxFONTENCODING_ISO8859_5 and wxFONTENCODING_CP1251).}
45@itemdef{wxFONTENCODING_CP1250, Microsoft analogue of ISO8859-2}
46@itemdef{wxFONTENCODING_CP1251, Microsoft analogue of ISO8859-5}
47@itemdef{wxFONTENCODING_CP1252, Microsoft analogue of ISO8859-1}
48@endDefList
36c9828f 49
dc28cdf8
FM
50As you may see, Microsoft's encoding partly mirror the standard ISO8859 ones,
51but there are (minor) differences even between ISO8859-1 (Latin1, ISO encoding
52for Western Europe) and CP1251 (WinLatin1, standard code page for English
53versions of Windows) and there are more of them for other encodings.
3b88355f 54
dc28cdf8
FM
55The situation is particularly complicated with Cyrillic encodings for which
56(more than) three incompatible encodings exist: KOI8 (the old standard, widely
57used on the Internet), ISO8859-5 (ISO standard for Cyrillic) and CP1251
58(WinCyrillic).
3b88355f 59
dc28cdf8
FM
60This abundance of (incompatible) encodings should make it clear that using
61encodings is less easy than it might seem. The problems arise both from the
62fact that the standard encodings for the given language (say Russian, which is
63written in Cyrillic) are different on different platforms and because the
64fonts in the given encoding might just not be installed (this is especially a
65problem with Unix, or, in general, non-Win32 systems).
3b88355f 66
831e1028
BP
67To clarify, the wxFontEnumerator class may be used to enumerate both all
68available encodings and to find the facename(s) in which the given encoding
69exists. If you can find the font in the correct encoding with wxFontEnumerator
70then your troubles are over, but, unfortunately, sometimes this is not enough.
71For example, there is no standard way (that I know of, please tell me if you
72do!) to find a font on a Windows system for KOI8 encoding (only for WinCyrillic
73one which is quite different), so wxFontEnumerator will never return one, even
74if the user has installed a KOI8 font on his system.
3b88355f 75
dc28cdf8 76To solve this problem, a wxFontMapper class is provided.
3b88355f 77
831e1028
BP
78This class stores the mapping between the encodings and the font face names
79which support them in wxConfigBase object. Of course, it would be fairly
80useless if it tried to determine these mappings by itself, so, instead, it
81(optionally) asks the user and remembers his answers so that the next time the
82program will automatically choose the correct font. All these topics are
83illustrated by the @ref page_samples_font; please refer to it and the
84documentation of the classes mentioned here for further explanations.
36c9828f 85
3b88355f 86*/