X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cc81d32f2bf8c159f3b1bf6ddaf62e6d77720209..6217b9aa7eec987c5177ad1300a0847b77c1abb5:/docs/latex/wx/fontmap.tex diff --git a/docs/latex/wx/fontmap.tex b/docs/latex/wx/fontmap.tex index b6b8836154..c5369cd2c5 100644 --- a/docs/latex/wx/fontmap.tex +++ b/docs/latex/wx/fontmap.tex @@ -23,14 +23,14 @@ and "interactive" is false or user denied to choose any replacement), the class queries \helpref{wxEncodingConverter}{wxencodingconverter} for "equivalent" encodings (e.g. iso8859-2 and cp1250) and tries them. -\wxheading{Using wxFontMapper in conjunction with wxEncodingConverter} +\wxheading{Using wxFontMapper in conjunction with wxMBConv classes} If you need to display text in encoding which is not available at host system (see \helpref{IsEncodingAvailable}{wxfontmapperisencodingavailable}), you may use these two classes to find font in some similar encoding (see \helpref{GetAltForEncoding}{wxfontmappergetaltforencoding}) and convert the text to this encoding -(\helpref{wxEncodingConverter::Convert}{wxencodingconverterconvert}). +(\helpref{wxMBConv classes}{mbconvclasses}). Following code snippet demonstrates it: @@ -41,11 +41,9 @@ if (!wxFontMapper::Get()->IsEncodingAvailable(enc, facename)) if (wxFontMapper::Get()->GetAltForEncoding(enc, &alternative, facename, false)) { - wxEncodingConverter encconv; - if (!encconv.Init(enc, alternative)) - ...failure... - else - text = encconv.Convert(text); + 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)... @@ -126,6 +124,15 @@ If no facename is given, find {\it any} font in this encoding. Returns the encoding for the given charset (in the form of RFC 2046) or wxFONTENCODING\_SYSTEM if couldn't decode it. +\membersection{wxFontMapper::GetEncoding}\label{wxfontmappergetencoding} + +\func{static wxFontEncoding}{GetEncoding}{\param{size\_t }{n}} + +Returns the {\it n}-th supported encoding. Together with +\helpref{GetSupportedEncodingsCount()}{wxfontmappergetsupportedencodingscount} +this method may be used to get all supported encodings. + + \membersection{wxFontMapper::GetEncodingName}\label{wxfontmappergetencodingname} \func{static wxString}{GetEncodingName}{\param{wxFontEncoding }{encoding}} @@ -139,6 +146,15 @@ Return internal string identifier for the encoding (see also Return user-readable string describing the given encoding. +\membersection{wxFontMapper::GetSupportedEncodingsCount}\label{wxfontmappergetsupportedencodingscount} + +\func{static size\_t}{GetSupportedEncodingsCount}{\void} + +Returns the number of the font encodings supported by this class. Together with +\helpref{GetEncoding}{wxfontmappergetencoding} this method may be used to get +all supported encodings. + + \membersection{wxFontMapper::SetDialogParent}\label{wxfontmappersetdialogparent} \func{void}{SetDialogParent}{\param{wxWindow* }{parent}}