1. added encoding param to wxFontEncoding::EnumFamilies() which allows to get

the list of families supporting the given encoding
2. added encoding decoding logic to src/gtk/font.cpp so that now choosing an
   encoding different from default in GTK+ font selector dialog actually works


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4258 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-10-29 17:54:13 +00:00
parent 8b99adf475
commit 36f210c81e
8 changed files with 279 additions and 125 deletions

View File

@@ -780,6 +780,34 @@ static wxNativeFont wxLoadQueryFont(int pointSize,
}
wxString xregistry, xencoding;
if ( !wxGetXFontEncoding(encoding, &xregistry, &xencoding) )
{
fontSpec.Printf(wxT("-*-*-*-*-*-*-*-*-*-*-*-*-%s-%s"),
xregistry.c_str(), xencoding.c_str());
if ( !wxTestFontSpec(fontSpec) )
{
// this encoding isn't available - what to do?
xregistry =
xencoding = wxT("*");
}
}
// construct the X font spec from our data
fontSpec.Printf(wxT("-*-%s-%s-%s-normal-*-*-%d-*-*-*-*-%s-%s"),
xfamily.c_str(), xweight.c_str(), xstyle.c_str(),
pointSize, xregistry.c_str(), xencoding.c_str());
return wxLoadFont(fontSpec);
}
bool wxGetXFontEncoding(wxFontEncoding encoding,
wxString *pregistry, wxString *pencoding)
{
wxCHECK_MSG( pencoding && pregistry, FALSE, wxT("bad pointer") );
wxString& xencoding = *pencoding;
wxString& xregistry = *pregistry;
if ( encoding == wxFONTENCODING_DEFAULT )
{
// use the apps default
@@ -830,6 +858,7 @@ static wxNativeFont wxLoadQueryFont(int pointSize,
case wxFONTENCODING_CP1252:
{
int cp = encoding - wxFONTENCODING_CP1250 + 1250;
wxString fontSpec;
fontSpec.Printf(wxT("-*-*-*-*-*-*-*-*-*-*-*-*-microsoft-cp%d"),
cp);
if ( wxTestFontSpec(fontSpec) )
@@ -856,24 +885,7 @@ static wxNativeFont wxLoadQueryFont(int pointSize,
xencoding = wxT("*");
}
if ( test )
{
fontSpec.Printf(wxT("-*-*-*-*-*-*-*-*-*-*-*-*-%s-%s"),
xregistry.c_str(), xencoding.c_str());
if ( !wxTestFontSpec(fontSpec) )
{
// this encoding isn't available - what to do?
xregistry =
xencoding = wxT("*");
}
}
// construct the X font spec from our data
fontSpec.Printf(wxT("-*-%s-%s-%s-normal-*-*-%d-*-*-*-*-%s-%s"),
xfamily.c_str(), xweight.c_str(), xstyle.c_str(),
pointSize, xregistry.c_str(), xencoding.c_str());
return wxLoadFont(fontSpec);
return !test;
}
wxNativeFont wxLoadQueryNearestFont(int pointSize,