// NOTE: this algorithm for adjusting the font size is used by all
// implementations of wxFont except under wxMSW and wxGTK where
// native support to font creation using pixel-size is provided.
-
+
int largestGood = 0;
int smallestBad = 0;
wxString wxFontBase::GetNativeFontInfoDesc() const
{
+ wxCHECK_MSG( IsOk(), wxEmptyString, wxT("invalid font") );
+
wxString fontDesc;
const wxNativeFontInfo *fontInfo = GetNativeFontInfo();
if ( fontInfo )
wxString wxFontBase::GetNativeFontInfoUserDesc() const
{
+ wxCHECK_MSG( IsOk(), wxEmptyString, wxT("invalid font") );
+
wxString fontDesc;
const wxNativeFontInfo *fontInfo = GetNativeFontInfo();
if ( fontInfo )
);
}
+wxFontFamily wxFontBase::GetFamily() const
+{
+ wxCHECK_MSG( IsOk(), wxFONTFAMILY_UNKNOWN, wxS("invalid font") );
+
+ // Don't return wxFONTFAMILY_UNKNOWN from here because it prevents the code
+ // like wxFont(size, wxNORMAL_FONT->GetFamily(), ...) from working (see
+ // #12330). This is really just a hack but it allows to keep compatibility
+ // and doesn't really have any bad drawbacks so do this until someone comes
+ // up with a better idea.
+ const wxFontFamily family = DoGetFamily();
+
+ return family == wxFONTFAMILY_UNKNOWN ? wxFONTFAMILY_DEFAULT : family;
+}
+
wxString wxFontBase::GetFamilyString() const
{
wxCHECK_MSG( IsOk(), "wxFONTFAMILY_DEFAULT", "invalid font" );
token.Trim(true).Trim(false).MakeLower();
if (insideQuotes)
{
- if (token.StartsWith("'") ||
+ if (token.StartsWith("'") ||
token.EndsWith("'"))
{
insideQuotes = false;
family = wxFONTFAMILY_TELETYPE;
else
return false;
-
+
SetFamily(family);
}
// NB: the check on the facename is implemented in wxFontBase::SetFaceName