// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "fontutil.h"
#endif
#endif
#ifndef WX_PRECOMP
+ #include "wx/encinfo.h"
#endif // PCH
#include "wx/fontutil.h"
return wxFONTENCODING_SYSTEM;
}
+
+void wxNativeFontInfo::SetPointSize(int WXUNUSED(pointsize))
+{
+ wxFAIL_MSG( _T("not implemented") );
+}
+
+void wxNativeFontInfo::SetStyle(wxFontStyle WXUNUSED(style))
+{
+ wxFAIL_MSG( _T("not implemented") );
+}
+
+void wxNativeFontInfo::SetWeight(wxFontWeight WXUNUSED(weight))
+{
+ wxFAIL_MSG( _T("not implemented") );
+}
+
+void wxNativeFontInfo::SetUnderlined(bool WXUNUSED(underlined))
+{
+ wxFAIL_MSG( _T("not implemented") );
+}
+
+void wxNativeFontInfo::SetFaceName(wxString WXUNUSED(facename))
+{
+ wxFAIL_MSG( _T("not implemented") );
+}
+
+void wxNativeFontInfo::SetFamily(wxFontFamily WXUNUSED(family))
+{
+ wxFAIL_MSG( _T("not implemented") );
+}
+
+void wxNativeFontInfo::SetEncoding(wxFontEncoding WXUNUSED(encoding))
+{
+ wxFAIL_MSG( _T("not implemented") );
+}
+
+
+
bool wxNativeFontInfo::FromString(const wxString& s)
{
if (description)
*xFontName = newFontName;
}
- // try to load exactly the font requested first
- if( !font )
- {
- font = wxLoadQueryFont( pointSize, family, style, weight,
- underlined, facename,
- info.xregistry, info.xencoding,
- xFontName );
- }
-
if ( !font )
{
// search up and down by stepsize 10
int max_size = pointSize + 20 * (1 + (pointSize/180));
int min_size = pointSize - 20 * (1 + (pointSize/180));
- int i;
+ int i, round; // counters
+
+ // first round: search for equal, then for smaller and for larger size with the given weight and style
+ int testweight = weight;
+ int teststyle = style;
- // Search for smaller size (approx.)
- for ( i = pointSize - 10; !font && i >= 10 && i >= min_size; i -= 10 )
+ for ( round = 0; round < 3; round++ )
+ {
+ // second round: use normal weight
+ if ( round == 1 )
{
- font = wxLoadQueryFont(i, family, style, weight, underlined,
+ if ( testweight != wxNORMAL )
+ {
+ testweight = wxNORMAL;
+ }
+ else
+ {
+ ++round; // fall through to third round
+ }
+ }
+
+ // third round: ... and use normal style
+ if ( round == 2 )
+ {
+ if ( teststyle != wxNORMAL )
+ {
+ teststyle = wxNORMAL;
+ }
+ else
+ {
+ break;
+ }
+ }
+ // Search for equal or smaller size (approx.)
+ for ( i = pointSize; !font && i >= 10 && i >= min_size; i -= 10 )
+ {
+ font = wxLoadQueryFont(i, family, teststyle, testweight, underlined,
facename, info.xregistry, info.xencoding,
xFontName);
}
// Search for larger size (approx.)
for ( i = pointSize + 10; !font && i <= max_size; i += 10 )
{
- font = wxLoadQueryFont(i, family, style, weight, underlined,
+ font = wxLoadQueryFont(i, family, teststyle, testweight, underlined,
facename, info.xregistry, info.xencoding,
xFontName);
+ }
}
// Try default family