- the class queries wxEncodingConverter
- for "equivalent" encodings (e.g. iso8859-2 and cp1250) and tries them.
+ the class queries wxEncodingConverter for "equivalent" encodings
+ (e.g. iso8859-2 and cp1250) and tries them.
+
+
+ @section fontmapper_mbconv Using wxFontMapper in conjunction with wxMBConv classes
+
+ If you need to display text in encoding which is not available at host
+ system (see wxFontMapper::IsEncodingAvailable), you may use these two
+ classes to find font in some similar encoding (see wxFontMapper::GetAltForEncoding)
+ and convert the text to this encoding (wxMBConv classes).
+ Following code snippet demonstrates it:
+
+ @code
+ if (!wxFontMapper::Get()->IsEncodingAvailable(enc, facename))
+ {
+ wxFontEncoding alternative;
+ if (wxFontMapper::Get()->GetAltForEncoding(enc, &alternative,
+ facename, false))
+ {
+ wxCSConv convFrom(wxFontMapper::Get()->GetEncodingName(enc));
+ wxCSConv convTo(wxFontMapper::Get()->GetEncodingName(alternative));
+ text = wxString(text.mb_str(convFrom), convTo);
+ }
+ else
+ ...failure (or we may try iso8859-1/7bit ASCII)...
+ }
+ ...display text...
+ @endcode