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