1 /////////////////////////////////////////////////////////////////////////////
2 // Name: common/fontmap.cpp
3 // Purpose: wxFontMapper class
4 // Author: Vadim Zeitlin
8 // Copyright: (c) Vadim Zeitlin
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "fontmap.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
39 #include "wx/fontmap.h"
42 #include "wx/config.h"
43 #include "wx/memconf.h"
47 #include "wx/fontutil.h"
48 #include "wx/msgdlg.h"
49 #include "wx/fontdlg.h"
50 #include "wx/choicdlg.h"
53 #include "wx/encconv.h"
55 // ----------------------------------------------------------------------------
57 // ----------------------------------------------------------------------------
59 // the config paths we use
61 static const wxChar
* FONTMAPPER_ROOT_PATH
= wxT("/wxWindows/FontMapper");
62 static const wxChar
* FONTMAPPER_CHARSET_PATH
= wxT("Charsets");
63 static const wxChar
* FONTMAPPER_CHARSET_ALIAS_PATH
= wxT("Aliases");
65 // we only ask questions in GUI mode
67 static const wxChar
* FONTMAPPER_FONT_FROM_ENCODING_PATH
= wxT("Encodings");
68 static const wxChar
* FONTMAPPER_FONT_DONT_ASK
= wxT("none");
70 #endif // wxUSE_CONFIG
72 // encodings supported by GetEncodingDescription
73 static wxFontEncoding gs_encodings
[] =
75 wxFONTENCODING_ISO8859_1
,
76 wxFONTENCODING_ISO8859_2
,
77 wxFONTENCODING_ISO8859_3
,
78 wxFONTENCODING_ISO8859_4
,
79 wxFONTENCODING_ISO8859_5
,
80 wxFONTENCODING_ISO8859_6
,
81 wxFONTENCODING_ISO8859_7
,
82 wxFONTENCODING_ISO8859_8
,
83 wxFONTENCODING_ISO8859_9
,
84 wxFONTENCODING_ISO8859_10
,
85 wxFONTENCODING_ISO8859_11
,
86 wxFONTENCODING_ISO8859_12
,
87 wxFONTENCODING_ISO8859_13
,
88 wxFONTENCODING_ISO8859_14
,
89 wxFONTENCODING_ISO8859_15
,
95 wxFONTENCODING_CP1250
,
96 wxFONTENCODING_CP1251
,
97 wxFONTENCODING_CP1252
,
98 wxFONTENCODING_CP1253
,
99 wxFONTENCODING_CP1254
,
100 wxFONTENCODING_CP1255
,
101 wxFONTENCODING_CP1256
,
102 wxFONTENCODING_CP1257
,
103 wxFONTENCODING_CP437
,
108 // the descriptions for them
109 static const wxChar
* gs_encodingDescs
[] =
111 wxTRANSLATE( "Western European (ISO-8859-1)" ),
112 wxTRANSLATE( "Central European (ISO-8859-2)" ),
113 wxTRANSLATE( "Esperanto (ISO-8859-3)" ),
114 wxTRANSLATE( "Baltic (old) (ISO-8859-4)" ),
115 wxTRANSLATE( "Cyrillic (ISO-8859-5)" ),
116 wxTRANSLATE( "Arabic (ISO-8859-6)" ),
117 wxTRANSLATE( "Greek (ISO-8859-7)" ),
118 wxTRANSLATE( "Hebrew (ISO-8859-8)" ),
119 wxTRANSLATE( "Turkish (ISO-8859-9)" ),
120 wxTRANSLATE( "Nordic (ISO-8859-10)" ),
121 wxTRANSLATE( "Thai (ISO-8859-11)" ),
122 wxTRANSLATE( "Indian (ISO-8859-12)" ),
123 wxTRANSLATE( "Baltic (ISO-8859-13)" ),
124 wxTRANSLATE( "Celtic (ISO-8859-14)" ),
125 wxTRANSLATE( "Western European with Euro (ISO-8859-15)" ),
126 wxTRANSLATE( "KOI8-R" ),
127 wxTRANSLATE( "Windows Japanese (CP 932)" ),
128 wxTRANSLATE( "Windows Chinese Simplified (CP 936)" ),
129 wxTRANSLATE( "Windows Korean (CP 949)" ),
130 wxTRANSLATE( "Windows Chinese Traditional (CP 950)" ),
131 wxTRANSLATE( "Windows Central European (CP 1250)" ),
132 wxTRANSLATE( "Windows Cyrillic (CP 1251)" ),
133 wxTRANSLATE( "Windows Western European (CP 1252)" ),
134 wxTRANSLATE( "Windows Greek (CP 1253)" ),
135 wxTRANSLATE( "Windows Turkish (CP 1254)" ),
136 wxTRANSLATE( "Windows Hebrew (CP 1255)" ),
137 wxTRANSLATE( "Windows Arabic (CP 1256)" ),
138 wxTRANSLATE( "Windows Baltic (CP 1257)" ),
139 wxTRANSLATE( "Windows/DOS OEM (CP 437)" ),
140 wxTRANSLATE( "Unicode 7 bit (UTF-7)" ),
141 wxTRANSLATE( "Unicode 8 bit (UTF-8)" ),
144 // and the internal names (these are not translated on purpose!)
145 static const wxChar
* gs_encodingNames
[] =
156 wxT( "iso-8859-10" ),
157 wxT( "iso-8859-11" ),
158 wxT( "iso-8859-12" ),
159 wxT( "iso-8859-13" ),
160 wxT( "iso-8859-14" ),
161 wxT( "iso-8859-15" ),
163 wxT( "windows-932" ),
164 wxT( "windows-936" ),
165 wxT( "windows-949" ),
166 wxT( "windows-950" ),
167 wxT( "windows-1250" ),
168 wxT( "windows-1251" ),
169 wxT( "windows-1252" ),
170 wxT( "windows-1253" ),
171 wxT( "windows-1254" ),
172 wxT( "windows-1255" ),
173 wxT( "windows-1256" ),
174 wxT( "windows-1257" ),
175 wxT( "windows-437" ),
180 // ----------------------------------------------------------------------------
182 // ----------------------------------------------------------------------------
185 static wxFontMapper gs_fontMapper
;
187 // and public pointer
188 wxFontMapper
* wxTheFontMapper
= &gs_fontMapper
;
190 // ----------------------------------------------------------------------------
192 // ----------------------------------------------------------------------------
194 // change the config path during the lifetime of this object
195 class wxFontMapperPathChanger
198 wxFontMapperPathChanger(wxFontMapper
*fontMapper
, const wxString
& path
)
200 m_fontMapper
= fontMapper
;
201 m_ok
= m_fontMapper
->ChangePath(path
, &m_pathOld
);
204 bool IsOk() const { return m_ok
; }
206 ~wxFontMapperPathChanger()
209 m_fontMapper
->RestorePath(m_pathOld
);
213 wxFontMapper
*m_fontMapper
;
218 // ============================================================================
220 // ============================================================================
222 // ----------------------------------------------------------------------------
224 // ----------------------------------------------------------------------------
226 wxFontMapper::wxFontMapper()
230 m_configIsDummy
= FALSE
;
231 #endif // wxUSE_CONFIG
234 m_windowParent
= NULL
;
238 wxFontMapper::~wxFontMapper()
241 if ( m_configIsDummy
)
243 #endif // wxUSE_CONFIG
246 // ----------------------------------------------------------------------------
248 // ----------------------------------------------------------------------------
252 /* static */ const wxChar
*wxFontMapper::GetDefaultConfigPath()
254 return FONTMAPPER_ROOT_PATH
;
257 void wxFontMapper::SetConfigPath(const wxString
& prefix
)
259 wxCHECK_RET( !prefix
.IsEmpty() && prefix
[0] == wxCONFIG_PATH_SEPARATOR
,
260 wxT("an absolute path should be given to wxFontMapper::SetConfigPath()") );
262 m_configRootPath
= prefix
;
265 // ----------------------------------------------------------------------------
266 // get config object and path for it
267 // ----------------------------------------------------------------------------
269 wxConfigBase
*wxFontMapper::GetConfig()
274 m_config
= wxConfig::Get(FALSE
/*don't create on demand*/ );
278 // we still want to have a config object because otherwise we would
279 // keep asking the user the same questions in the interactive mode,
280 // so create a dummy config which won't write to any files/registry
281 // but will allow us to remember the results of the questions at
282 // least during this run
283 m_config
= new wxMemoryConfig
;
284 m_configIsDummy
= TRUE
;
285 // VS: we can't call wxConfig::Set(m_config) here because that would
286 // disable automatic wxConfig instance creation if this code was
287 // called before wxApp::OnInit (this happens in wxGTK -- it sets
288 // default wxFont encoding in wxApp::Initialize())
292 if ( m_configIsDummy
&& wxConfig::Get(FALSE
) != NULL
)
294 // VS: in case we created dummy m_config (see above), we want to switch back
295 // to the real one as soon as one becomes available.
297 m_config
= wxConfig::Get(FALSE
);
298 m_configIsDummy
= FALSE
;
299 // FIXME: ideally, we should add keys from dummy config to the real one now,
300 // but it is a low-priority task because typical wxWin application
301 // either doesn't use wxConfig at all or creates wxConfig object in
302 // wxApp::OnInit(), before any real interaction with the user takes
309 const wxString
& wxFontMapper::GetConfigPath()
311 if ( !m_configRootPath
)
314 m_configRootPath
= GetDefaultConfigPath();
317 return m_configRootPath
;
321 bool wxFontMapper::ChangePath(const wxString
& pathNew
, wxString
*pathOld
)
324 wxConfigBase
*config
= GetConfig();
328 *pathOld
= config
->GetPath();
330 wxString path
= GetConfigPath();
331 if ( path
.IsEmpty() || path
.Last() != wxCONFIG_PATH_SEPARATOR
)
333 path
+= wxCONFIG_PATH_SEPARATOR
;
336 wxASSERT_MSG( !pathNew
|| (pathNew
[0] != wxCONFIG_PATH_SEPARATOR
),
337 wxT("should be a relative path") );
341 config
->SetPath(path
);
349 void wxFontMapper::RestorePath(const wxString
& pathOld
)
352 GetConfig()->SetPath(pathOld
);
357 // ----------------------------------------------------------------------------
358 // charset/encoding correspondence
359 // ----------------------------------------------------------------------------
362 wxString
wxFontMapper::GetEncodingDescription(wxFontEncoding encoding
)
364 if ( encoding
== wxFONTENCODING_DEFAULT
)
366 return _("Default encoding");
369 size_t count
= WXSIZEOF(gs_encodingDescs
);
371 wxASSERT_MSG( count
== WXSIZEOF(gs_encodings
),
372 wxT("inconsitency detected - forgot to update one of the arrays?") );
374 for ( size_t i
= 0; i
< count
; i
++ )
376 if ( gs_encodings
[i
] == encoding
)
378 return wxGetTranslation(gs_encodingDescs
[i
]);
383 str
.Printf(_("Unknown encoding (%d)"), encoding
);
389 wxString
wxFontMapper::GetEncodingName(wxFontEncoding encoding
)
391 if ( encoding
== wxFONTENCODING_DEFAULT
)
396 size_t count
= WXSIZEOF(gs_encodingNames
);
398 wxASSERT_MSG( count
== WXSIZEOF(gs_encodings
),
399 wxT("inconsistency detected - forgot to update one of the arrays?") );
401 for ( size_t i
= 0; i
< count
; i
++ )
403 if ( gs_encodings
[i
] == encoding
)
405 return gs_encodingNames
[i
];
410 str
.Printf(_("unknown-%d"), encoding
);
415 wxFontEncoding
wxFontMapper::CharsetToEncoding(const wxString
& charset
,
418 // a special pseudo encoding which means "don't ask me about this charset
419 // any more" - we need it to avoid driving the user crazy with asking him
420 // time after time about the same charset which he [presumably] doesn't
421 // have the fonts fot
422 static const int wxFONTENCODING_UNKNOWN
= -2;
424 wxFontEncoding encoding
= wxFONTENCODING_SYSTEM
;
426 // we're going to modify it, make a copy
427 wxString cs
= charset
;
430 // first try the user-defined settings
432 if ( ChangePath(FONTMAPPER_CHARSET_PATH
, &pathOld
) )
434 wxConfigBase
*config
= GetConfig();
436 // do we have an encoding for this charset?
437 long value
= config
->Read(charset
, -1l);
440 if ( value
== wxFONTENCODING_UNKNOWN
)
442 // don't try to find it, in particular don't ask the user
443 return wxFONTENCODING_SYSTEM
;
446 if ( value
>= 0 && value
<= wxFONTENCODING_MAX
)
448 encoding
= (wxFontEncoding
)value
;
452 wxLogDebug(wxT("corrupted config data: invalid encoding %ld for charset '%s' ignored"),
453 value
, charset
.c_str());
457 if ( encoding
== wxFONTENCODING_SYSTEM
)
459 // may be we have an alias?
460 config
->SetPath(FONTMAPPER_CHARSET_ALIAS_PATH
);
462 wxString alias
= config
->Read(charset
);
465 // yes, we do - use it instead
470 RestorePath(pathOld
);
472 #endif // wxUSE_CONFIG
474 // if didn't find it there, try to recognize it ourselves
475 if ( encoding
== wxFONTENCODING_SYSTEM
)
481 // discard the optional quotes
484 if ( cs
[0u] == _T('"') && cs
.Last() == _T('"') )
486 cs
= wxString(cs
.c_str(), cs
.length() - 1);
492 if ( cs
.empty() || cs
== _T("US-ASCII") )
494 encoding
= wxFONTENCODING_DEFAULT
;
496 else if ( cs
== wxT("UTF-7") )
498 encoding
= wxFONTENCODING_UTF7
;
500 else if ( cs
== wxT("UTF-8") )
502 encoding
= wxFONTENCODING_UTF8
;
504 else if ( cs
== wxT("KOI8-R") ||
505 cs
== wxT("KOI8-U") ||
506 cs
== wxT("KOI8-RU") )
508 // although koi8-ru is not strictly speaking the same as koi8-r,
509 // they are similar enough to make mapping it to koi8 better than
510 // not reckognizing it at all
511 encoding
= wxFONTENCODING_KOI8
;
513 else if ( cs
.Left(3) == wxT("ISO") )
515 // the dash is optional (or, to be exact, it is not, but
516 // several brokenmails "forget" it)
517 const wxChar
*p
= cs
.c_str() + 3;
518 if ( *p
== wxT('-') )
522 if ( wxSscanf(p
, wxT("8859-%u"), &value
) == 1 )
524 // make it 0 based and check that it is strictly positive in
525 // the process (no such thing as iso8859-0 encoding)
526 if ( (value
-- > 0) &&
527 (value
< wxFONTENCODING_ISO8859_MAX
-
528 wxFONTENCODING_ISO8859_1
) )
530 // it's a valid ISO8859 encoding
531 value
+= wxFONTENCODING_ISO8859_1
;
532 encoding
= (wxFontEncoding
)value
;
536 else // check for Windows charsets
539 if ( cs
.Left(7) == wxT("WINDOWS") )
543 else if ( cs
.Left(2) == wxT("CP") )
547 else // not a Windows encoding
554 const wxChar
*p
= cs
.c_str() + len
;
555 if ( *p
== wxT('-') )
559 if ( wxSscanf(p
, wxT("%u"), &value
) == 1 )
564 if ( value
< wxFONTENCODING_CP12_MAX
-
565 wxFONTENCODING_CP1250
)
567 // a valid Windows code page
568 value
+= wxFONTENCODING_CP1250
;
569 encoding
= (wxFontEncoding
)value
;
576 encoding
= wxFONTENCODING_CP932
;
580 encoding
= wxFONTENCODING_CP936
;
584 encoding
= wxFONTENCODING_CP949
;
588 encoding
= wxFONTENCODING_CP950
;
598 // if still no luck, ask the user - unless disabled
599 if ( (encoding
== wxFONTENCODING_SYSTEM
) && interactive
)
601 // prepare the dialog data
604 wxString
title(m_titleDialog
);
606 title
<< wxTheApp
->GetAppName() << _(": unknown charset");
610 msg
.Printf(_("The charset '%s' is unknown. You may select\nanother charset to replace it with or choose\n[Cancel] if it cannot be replaced"), charset
.c_str());
612 // the list of choices
613 size_t count
= WXSIZEOF(gs_encodingDescs
);
615 wxASSERT_MSG( count
== WXSIZEOF(gs_encodings
),
616 wxT("inconsitency detected - forgot to update one of the arrays?") );
618 wxString
*encodingNamesTranslated
= new wxString
[count
];
620 for ( size_t i
= 0; i
< count
; i
++ )
622 encodingNamesTranslated
[i
] = wxGetTranslation(gs_encodingDescs
[i
]);
626 wxWindow
*parent
= m_windowParent
;
628 parent
= wxTheApp
->GetTopWindow();
630 // do ask the user and get back the index in encodings table
631 int n
= wxGetSingleChoiceIndex(msg
, title
,
633 encodingNamesTranslated
,
636 delete [] encodingNamesTranslated
;
640 encoding
= gs_encodings
[n
];
644 // save the result in the config now
645 if ( ChangePath(FONTMAPPER_CHARSET_PATH
, &pathOld
) )
647 wxConfigBase
*config
= GetConfig();
649 // remember the alt encoding for this charset - or remember that
651 long value
= n
== -1 ? wxFONTENCODING_UNKNOWN
: (long)encoding
;
652 if ( !config
->Write(charset
, value
) )
654 wxLogError(_("Failed to remember the encoding for the charset '%s'."), charset
.c_str());
657 RestorePath(pathOld
);
659 #endif // wxUSE_CONFIG
666 // ----------------------------------------------------------------------------
667 // support for unknown encodings: we maintain a map between the
668 // (platform-specific) strings identifying them and our wxFontEncodings they
669 // correspond to which is used by GetFontForEncoding() function
670 // ----------------------------------------------------------------------------
674 bool wxFontMapper::TestAltEncoding(const wxString
& configEntry
,
675 wxFontEncoding encReplacement
,
676 wxNativeEncodingInfo
*info
)
678 if ( wxGetNativeFontEncoding(encReplacement
, info
) &&
679 wxTestFontEncoding(*info
) )
682 // remember the mapping in the config
683 wxFontMapperPathChanger
path(this, FONTMAPPER_FONT_FROM_ENCODING_PATH
);
687 GetConfig()->Write(configEntry
, info
->ToString());
689 #endif // wxUSE_CONFIG
697 class ReentrancyBlocker
700 ReentrancyBlocker(bool& b
) : m_b(b
) { m_b
= TRUE
; }
701 ~ReentrancyBlocker() { m_b
= FALSE
; }
708 bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding
,
709 wxNativeEncodingInfo
*info
,
710 const wxString
& facename
,
714 // we need a flag to prevent infinite recursion which happens, for
715 // example, when GetAltForEncoding() is called from an OnPaint() handler:
716 // in this case, wxYield() which is called from wxMessageBox() we use here
717 // will lead to another call of OnPaint() and hence to another call of
718 // GetAltForEncoding() - and it is impossible to catch this from the user
719 // code because we are called from wxFont ctor implicitly.
721 // assume we're always called from the main thread, so that it is safe to
723 static bool s_inGetAltForEncoding
= FALSE
;
725 if ( interactive
&& s_inGetAltForEncoding
)
728 ReentrancyBlocker
blocker(s_inGetAltForEncoding
);
731 wxCHECK_MSG( info
, FALSE
, wxT("bad pointer in GetAltForEncoding") );
733 info
->facename
= facename
;
735 if ( encoding
== wxFONTENCODING_DEFAULT
)
737 encoding
= wxFont::GetDefaultEncoding();
740 // if we failed to load the system default encoding, something is really
741 // wrong and we'd better stop now - otherwise we will go into endless
742 // recursion trying to create the font in the msg box with the error
744 if ( encoding
== wxFONTENCODING_SYSTEM
)
746 wxLogFatalError(_("can't load any font, aborting"));
748 // wxLogFatalError doesn't return
751 wxString configEntry
,
752 encName
= GetEncodingName(encoding
);
755 configEntry
= facename
+ _T("_");
757 configEntry
+= encName
;
760 // do we have a font spec for this encoding?
762 if ( ChangePath(FONTMAPPER_FONT_FROM_ENCODING_PATH
, &pathOld
) )
764 wxConfigBase
*config
= GetConfig();
766 wxString fontinfo
= config
->Read(configEntry
);
768 RestorePath(pathOld
);
770 // this special value means that we don't know of fonts for this
771 // encoding but, moreover, have already asked the user as well and he
772 // didn't specify any font neither
773 if ( fontinfo
== FONTMAPPER_FONT_DONT_ASK
)
777 else // use the info entered the last time
779 if ( !!fontinfo
&& !!facename
)
781 // we tried to find a match with facename - now try without it
782 fontinfo
= config
->Read(encName
);
787 if ( info
->FromString(fontinfo
) )
789 if ( wxTestFontEncoding(*info
) )
794 //else: no such fonts, look for something else
795 // (should we erase the outdated value?)
799 wxLogDebug(wxT("corrupted config data: string '%s' is not a valid font encoding info"),
803 //else: there is no information in config about this encoding
806 #endif // wxUSE_CONFIG
808 // now try to map this encoding to a compatible one which we have on this
810 wxFontEncodingArray equiv
= wxEncodingConverter::GetAllEquivalents(encoding
);
811 size_t count
= equiv
.GetCount();
812 bool foundEquivEncoding
= FALSE
;
813 wxFontEncoding equivEncoding
= wxFONTENCODING_SYSTEM
;
816 for ( size_t i
= 0; i
< count
&& !foundEquivEncoding
; i
++ )
818 // don't test for encoding itself, we already know we don't have it
819 if ( equiv
[i
] == encoding
)
822 if ( TestAltEncoding(configEntry
, equiv
[i
], info
) )
824 equivEncoding
= equiv
[i
];
826 foundEquivEncoding
= TRUE
;
835 wxString
title(m_titleDialog
);
837 title
<< wxTheApp
->GetAppName() << _(": unknown encoding");
840 wxString encDesc
= GetEncodingDescription(encoding
),
842 if ( foundEquivEncoding
)
844 // ask the user if he wants to override found alternative encoding
845 msg
.Printf(_("No font for displaying text in encoding '%s' found,\nbut an alternative encoding '%s' is available.\nDo you want to use this encoding (otherwise you will have to choose another one)?"),
846 encDesc
.c_str(), GetEncodingDescription(equivEncoding
).c_str());
850 msg
.Printf(_("No font for displaying text in encoding '%s' found.\nWould you like to select a font to be used for this encoding\n(otherwise the text in this encoding will not be shown correctly)?"),
854 // the question is different in 2 cases so the answer has to be
855 // interpreted differently as well
856 int answer
= foundEquivEncoding
? wxNO
: wxYES
;
858 if ( wxMessageBox(msg
, title
,
859 wxICON_QUESTION
| wxYES_NO
,
860 m_windowParent
) == answer
)
863 data
.SetEncoding(encoding
);
864 data
.EncodingInfo() = *info
;
865 wxFontDialog
dialog(m_windowParent
, &data
);
866 if ( dialog
.ShowModal() == wxID_OK
)
868 wxFontData retData
= dialog
.GetFontData();
869 wxFont font
= retData
.GetChosenFont();
871 *info
= retData
.EncodingInfo();
872 info
->encoding
= retData
.GetEncoding();
875 // remember this in the config
876 if ( ChangePath(FONTMAPPER_FONT_FROM_ENCODING_PATH
, &pathOld
) )
878 GetConfig()->Write(configEntry
, info
->ToString());
880 RestorePath(pathOld
);
882 #endif // wxUSE_CONFIG
886 //else: the user canceled the font selection dialog
890 // the user doesn't want to select a font for this encoding
891 // or selected to use equivalent encoding
893 // remember it to avoid asking the same question again later
895 if ( ChangePath(FONTMAPPER_FONT_FROM_ENCODING_PATH
, &pathOld
) )
900 foundEquivEncoding
? info
->ToString().c_str()
901 : FONTMAPPER_FONT_DONT_ASK
904 RestorePath(pathOld
);
906 #endif // wxUSE_CONFIG
909 //else: we're in non-interactive mode
910 #endif // wxUSE_FONTDLG
912 return foundEquivEncoding
;
915 bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding
,
916 wxFontEncoding
*alt_encoding
,
917 const wxString
& facename
,
920 wxNativeEncodingInfo info
;
921 bool r
= GetAltForEncoding(encoding
, &info
, facename
, interactive
);
922 *alt_encoding
= info
.encoding
;
926 bool wxFontMapper::IsEncodingAvailable(wxFontEncoding encoding
,
927 const wxString
& facename
)
929 wxNativeEncodingInfo info
;
931 if (wxGetNativeFontEncoding(encoding
, &info
))
933 info
.facename
= facename
;
934 return wxTestFontEncoding(info
);
942 #endif // wxUSE_FONTMAP