当前位置: 首页>>代码示例>>C++>>正文


C++ wxFont::GetEncoding方法代码示例

本文整理汇总了C++中wxFont::GetEncoding方法的典型用法代码示例。如果您正苦于以下问题:C++ wxFont::GetEncoding方法的具体用法?C++ wxFont::GetEncoding怎么用?C++ wxFont::GetEncoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxFont的用法示例。


在下文中一共展示了wxFont::GetEncoding方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetFontAttributes

// Get attributes from font.
bool wxTextAttr::GetFontAttributes(const wxFont& font, int flags)
{
    if (!font.Ok())
        return false;

    if (flags & wxTEXT_ATTR_FONT_SIZE)
        m_fontSize = font.GetPointSize();

    if (flags & wxTEXT_ATTR_FONT_ITALIC)
        m_fontStyle = font.GetStyle();

    if (flags & wxTEXT_ATTR_FONT_WEIGHT)
        m_fontWeight = font.GetWeight();

    if (flags & wxTEXT_ATTR_FONT_UNDERLINE)
        m_fontUnderlined = font.GetUnderlined();

    if (flags & wxTEXT_ATTR_FONT_FACE)
        m_fontFaceName = font.GetFaceName();

    if (flags & wxTEXT_ATTR_FONT_ENCODING)
        m_fontEncoding = font.GetEncoding();

    if (flags & wxTEXT_ATTR_FONT_FAMILY)
        m_fontFamily = font.GetFamily();

    m_flags |= flags;

    return true;
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:31,代码来源:textcmn.cpp

示例2:

wxString wxFontPickerCtrl::Font2String(const wxFont &f)
{
    wxString ret = f.GetNativeFontInfoUserDesc();
#ifdef __WXMSW__
    // on wxMSW the encoding of the font is appended at the end of the string;
    // since encoding is not very user-friendly we remove it.
    wxFontEncoding enc = f.GetEncoding();
    if ( enc != wxFONTENCODING_DEFAULT && enc != wxFONTENCODING_SYSTEM )
        ret = ret.BeforeLast(wxT(' '));
#endif
    return ret;
}
开发者ID:EdgarTx,项目名称:wx,代码行数:12,代码来源:fontpickercmn.cpp

示例3: IsSameAs

bool wxFontBase::operator==(const wxFont& font) const
{
    // either it is the same font, i.e. they share the same common data or they
    // have different ref datas but still describe the same font
    return IsSameAs(font) ||
           (
            IsOk() == font.IsOk() &&
            GetPointSize() == font.GetPointSize() &&
            // in wxGTK1 GetPixelSize() calls GetInternalFont() which uses
            // operator==() resulting in infinite recursion so we can't use it
            // in that port
#if !defined(__WXGTK__) || defined(__WXGTK20__)
            GetPixelSize() == font.GetPixelSize() &&
#endif
            GetFamily() == font.GetFamily() &&
            GetStyle() == font.GetStyle() &&
            GetWeight() == font.GetWeight() &&
            GetUnderlined() == font.GetUnderlined() &&
            GetFaceName().IsSameAs(font.GetFaceName(), false) &&
            GetEncoding() == font.GetEncoding()
           );
}
开发者ID:madnessw,项目名称:thesnow,代码行数:22,代码来源:fontcmn.cpp

示例4: OnPaint

void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
{
    wxPaintDC dc(this);
    PrepareDC(dc);

    // set background
    dc.SetBackground(*wxWHITE_BRUSH);
    dc.Clear();
    dc.SetFont(m_font);

    // one text line height
    wxCoord hLine = dc.GetCharHeight();

    // the current text origin
    wxCoord x = 5,
            y = 5;

    // output the font name/info
    wxString fontInfo;

    fontInfo.Printf(wxT("Face name: %s, family: %s"),
                    m_font.GetFaceName().c_str(),
                    m_font.GetFamilyString().c_str());

    dc.DrawText(fontInfo, x, y);
    y += hLine;

    fontInfo.Printf(wxT("Size: %d points or %d pixels; %d*%d average char size"),
                    m_font.GetPointSize(),
                    m_font.GetPixelSize().y,
                    dc.GetCharWidth(), dc.GetCharHeight());

    dc.DrawText(fontInfo, x, y);
    y += hLine;

    fontInfo.Printf(wxT("Style: %s, weight: %s, fixed width: %s, encoding: %s"),
                    m_font.GetStyleString().c_str(),
                    m_font.GetWeightString().c_str(),
                    m_font.IsFixedWidth() ? wxT("yes") : wxT("no"),
                    wxFontMapper::GetEncodingDescription(m_font.GetEncoding()));

    dc.DrawText(fontInfo, x, y);
    y += hLine;

    if ( m_font.IsOk() )
    {
        const wxNativeFontInfo *info = m_font.GetNativeFontInfo();
        if ( info )
        {
            wxString fontDesc = m_font.GetNativeFontInfoUserDesc();
            fontInfo.Printf(wxT("Native font info: %s"), fontDesc.c_str());

            dc.DrawText(fontInfo, x, y);
            y += hLine;
        }
    }

    y += hLine;

    // prepare to draw the font
    dc.SetTextForeground(m_colour);

    // the size of one cell (Normally biggest char + small margin)
    wxCoord maxCharWidth, maxCharHeight;
    dc.GetTextExtent(wxT("W"), &maxCharWidth, &maxCharHeight);
    int w = maxCharWidth + 5,
        h = maxCharHeight + 4;


    // print all font symbols from 32 to 256 in 7 rows of 32 chars each
    for ( int i = 0; i < 7; i++ )
    {
        for ( int j = 0; j < 32; j++ )
        {
            wxChar c = (wxChar)(32 * (i + 1) + j);

            wxCoord charWidth, charHeight;
            dc.GetTextExtent(c, &charWidth, &charHeight);
            dc.DrawText
            (
                c,
                x + w*j + (maxCharWidth - charWidth) / 2 + 1,
                y + h*i + (maxCharHeight - charHeight) / 2
            );
        }
    }

    // draw the lines between them
    dc.SetPen(*wxBLUE_PEN);
    int l;

    // horizontal
    for ( l = 0; l < 8; l++ )
    {
        int yl = y + h*l - 2;
        dc.DrawLine(x - 2, yl, x + 32*w - 1, yl);
    }

    // and vertical
    for ( l = 0; l < 33; l++ )
//.........这里部分代码省略.........
开发者ID:ruifig,项目名称:nutcracker,代码行数:101,代码来源:font.cpp

示例5: GetFontAttributes

// Get attributes from font.
bool wxTextAttr::GetFontAttributes(const wxFont& font, int flags)
{
    if (!font.IsOk())
        return false;

    // If we pass both pixel and point size attributes, this is an indication
    // to choose the most appropriate units.
    if ((flags & wxTEXT_ATTR_FONT) == wxTEXT_ATTR_FONT)
    {
        if (font.IsUsingSizeInPixels())
        {
            m_fontSize = font.GetPixelSize().y;
            flags &= ~wxTEXT_ATTR_FONT_POINT_SIZE;
        }
        else
        {
            m_fontSize = font.GetPointSize();
            flags &= ~wxTEXT_ATTR_FONT_PIXEL_SIZE;
        }
    }
    else if (flags & wxTEXT_ATTR_FONT_POINT_SIZE)
    {
        m_fontSize = font.GetPointSize();
        flags &= ~wxTEXT_ATTR_FONT_PIXEL_SIZE;
    }
    else if (flags & wxTEXT_ATTR_FONT_PIXEL_SIZE)
    {
        m_fontSize = font.GetPixelSize().y;
    }

    if (flags & wxTEXT_ATTR_FONT_ITALIC)
        m_fontStyle = font.GetStyle();

    if (flags & wxTEXT_ATTR_FONT_WEIGHT)
        m_fontWeight = font.GetWeight();

    if (flags & wxTEXT_ATTR_FONT_UNDERLINE)
        m_fontUnderlined = font.GetUnderlined();

    if (flags & wxTEXT_ATTR_FONT_STRIKETHROUGH)
        m_fontStrikethrough = font.GetStrikethrough();

    if (flags & wxTEXT_ATTR_FONT_FACE)
        m_fontFaceName = font.GetFaceName();

    if (flags & wxTEXT_ATTR_FONT_ENCODING)
        m_fontEncoding = font.GetEncoding();

    if (flags & wxTEXT_ATTR_FONT_FAMILY)
    {
        // wxFont might not know its family, avoid setting m_fontFamily to an
        // invalid value and rather pretend that we don't have any font family
        // information at all in this case
        const wxFontFamily fontFamily = font.GetFamily();
        if ( fontFamily == wxFONTFAMILY_UNKNOWN )
            flags &= ~wxTEXT_ATTR_FONT_FAMILY;
        else
            m_fontFamily = fontFamily;
    }

    m_flags |= flags;

    return true;
}
开发者ID:djbarry004,项目名称:Ishiiruka,代码行数:65,代码来源:textcmn.cpp


注:本文中的wxFont::GetEncoding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。