示例#1
0
文件: fontutil.cpp 项目: EdgarTx/wx
void
wxNativeFontInfo::SetXFontComponent(wxXLFDField field, const wxString& value)
{
    wxCHECK_RET( field < wxXLFD_MAX, _T("invalid XLFD field") );

    // this class should be initialized with a valid font spec first and only
    // then the fields may be modified!
    wxASSERT_MSG( !IsDefault(), _T("can't modify an uninitialized XLFD") );

    if ( !HasElements() )
    {
        // const_cast
        if ( !((wxNativeFontInfo *)this)->FromXFontName(xFontName) )
        {
            wxFAIL_MSG( _T("can't set font element for invalid XLFD") );

            return;
        }
    }

    fontElements[field] = value;

    // invalidate the XFLD, it doesn't correspond to the font elements any more
    xFontName.clear();
}
示例#2
0
wxString wxNativeFontInfo::GetXFontComponent(wxXLFDField field) const
{
    wxCHECK_MSG( field < wxXLFD_MAX, wxEmptyString, wxT("invalid XLFD field") );

    if ( !HasElements() )
    {
        if ( !const_cast<wxNativeFontInfo *>(this)->FromXFontName(xFontName) )
            return wxEmptyString;
    }

    return fontElements[field];
}
示例#3
0
void
wxNativeFontInfo::SetXFontComponent(wxXLFDField field, const wxString& value)
{
    wxCHECK_RET( field < wxXLFD_MAX, wxT("invalid XLFD field") );

    if ( !HasElements() )
    {
        for ( int field = 0; field < wxXLFD_MAX; field++ )
            fontElements[field] = '*';
    }

    fontElements[field] = value;

    // invalidate the XFLD, it doesn't correspond to the font elements any more
    xFontName.clear();
}