Esempio n. 1
0
void wxFontRefData::SetStyle(wxFontStyle style)
{
    m_style = style;

    if ( HasNativeFont() )
    {
        wxString slant;
        switch ( style )
        {
            case wxFONTSTYLE_ITALIC:
                slant = wxT('i');
                break;

            case wxFONTSTYLE_SLANT:
                slant = wxT('o');
                break;

            default:
                wxFAIL_MSG( wxT("unknown font style") );
                // fall through

            case wxFONTSTYLE_NORMAL:
                slant = wxT('r');
        }

        m_nativeFontInfo.SetXFontComponent(wxXLFD_SLANT, slant);
    }
}
Esempio n. 2
0
void wxFontRefData::SetWeight(wxFontWeight weight)
{
    m_weight = weight;

    if ( HasNativeFont() )
    {
        wxString boldness;
        switch ( weight )
        {
            case wxFONTWEIGHT_BOLD:
                boldness = wxT("bold");
                break;

            case wxFONTWEIGHT_LIGHT:
                boldness = wxT("light");
                break;

            default:
                wxFAIL_MSG( wxT("unknown font weight") );
                // fall through

            case wxFONTWEIGHT_NORMAL:
                // unspecified
                boldness = wxT("medium");
        }

        m_nativeFontInfo.SetXFontComponent(wxXLFD_WEIGHT, boldness);
    }
}
Esempio n. 3
0
bool wxFontRefData::SetFaceName(const wxString& facename)
{
    m_faceName = facename;

    if ( HasNativeFont() )
    {
        m_nativeFontInfo.SetXFontComponent(wxXLFD_FAMILY, facename);
    }

    return true;
}
Esempio n. 4
0
void wxFontRefData::SetEncoding(wxFontEncoding encoding)
{
    m_encoding = encoding;

    if ( HasNativeFont() )
    {
        wxNativeEncodingInfo info;
        if ( wxGetNativeFontEncoding(encoding, &info) )
        {
            m_nativeFontInfo.SetXFontComponent(wxXLFD_REGISTRY, info.xregistry);
            m_nativeFontInfo.SetXFontComponent(wxXLFD_ENCODING, info.xencoding);
        }
    }
}
Esempio n. 5
0
void wxFontRefData::SetPointSize(int pointSize)
{
    m_pointSize = pointSize;

    if ( HasNativeFont() )
    {
        wxString size;
        if ( pointSize == -1 )
            size = wxT('*');
        else
            size.Printf(wxT("%d"), 10*pointSize);

        m_nativeFontInfo.SetXFontComponent(wxXLFD_POINTSIZE, size);
    }
}