- fontSpec.Printf(wxT("-*-%s-*-*-normal-*-*-*-*-*-*-*-*-*"),
- facename.c_str());
-
- if ( wxTestFontSpec(fontSpec) )
- {
- xfamily = facename;
- }
- //else: no such family, use default one instead
- }
-
- wxString xstyle;
- switch (style)
- {
- case wxITALIC: xstyle = wxT("i"); break;
- case wxSLANT: xstyle = wxT("o"); break;
- case wxNORMAL: xstyle = wxT("r"); break;
- default: xstyle = wxT("*"); break;
- }
-
- wxString xweight;
- switch (weight)
- {
- case wxBOLD:
- {
- fontSpec.Printf(wxT("-*-%s-bold-*-*-*-*-*-*-*-*-*-*-*"),
- xfamily.c_str());
- if ( wxTestFontSpec(fontSpec) )
- {
- xweight = wxT("bold");
- break;
- }
- fontSpec.Printf(wxT("-*-%s-heavy-*-*-*-*-*-*-*-*-*-*-*"),
- xfamily.c_str());
- if ( wxTestFontSpec(fontSpec) )
- {
- xweight = wxT("heavy");
- break;
- }
- fontSpec.Printf(wxT("-*-%s-extrabold-*-*-*-*-*-*-*-*-*-*-*"),
- xfamily.c_str());
- if ( wxTestFontSpec(fontSpec) )
- {
- xweight = wxT("extrabold");
- break;
- }
- fontSpec.Printf(wxT("-*-%s-demibold-*-*-*-*-*-*-*-*-*-*-*"),
- xfamily.c_str());
- if ( wxTestFontSpec(fontSpec) )
- {
- xweight = wxT("demibold");
- break;
- }
- fontSpec.Printf(wxT("-*-%s-black-*-*-*-*-*-*-*-*-*-*-*"),
- xfamily.c_str());
- if ( wxTestFontSpec(fontSpec) )
- {
- xweight = wxT("black");
- break;
- }
- fontSpec.Printf(wxT("-*-%s-ultrablack-*-*-*-*-*-*-*-*-*-*-*"),
- xfamily.c_str());
- if ( wxTestFontSpec(fontSpec) )
- {
- xweight = wxT("ultrablack");
- break;
- }
- }
- break;
- case wxLIGHT:
- {
- fontSpec.Printf(wxT("-*-%s-light-*-*-*-*-*-*-*-*-*-*-*"),
- xfamily.c_str());
- if ( wxTestFontSpec(fontSpec) )
- {
- xweight = wxT("light");
- break;
- }
- fontSpec.Printf(wxT("-*-%s-thin-*-*-*-*-*-*-*-*-*-*-*"),
- xfamily.c_str());
- if ( wxTestFontSpec(fontSpec) )
- {
- xweight = wxT("thin");
- break;
- }
- }
- break;
- case wxNORMAL:
- {
- fontSpec.Printf(wxT("-*-%s-medium-*-*-*-*-*-*-*-*-*-*-*"),
- xfamily.c_str());
- if ( wxTestFontSpec(fontSpec) )
- {
- xweight = wxT("medium");
- break;
- }
- fontSpec.Printf(wxT("-*-%s-normal-*-*-*-*-*-*-*-*-*-*-*"),
- xfamily.c_str());
- if ( wxTestFontSpec(fontSpec) )
- {
- xweight = wxT("normal");
- break;
- }
- fontSpec.Printf(wxT("-*-%s-regular-*-*-*-*-*-*-*-*-*-*-*"),
- xfamily.c_str());
- if ( wxTestFontSpec(fontSpec) )
- {
- xweight = wxT("regular");
- break;
- }
- xweight = wxT("*");
- }
- break;
- default: xweight = wxT("*"); break;
- }
-
- 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("*");
- }