• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ wxNativeFontInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Init

void wxNativeFontInfo::Init(const wxNativeFontInfo& info)
{
    if (info.description)
    {
        description = pango_font_description_copy(info.description);
        m_underlined = info.GetUnderlined();
        m_strikethrough = info.GetStrikethrough();
    }
    else
    {
        description = NULL;
        m_underlined = false;
        m_strikethrough = false;
    }
}
开发者ID:CodeSmithyIDE,项目名称:wxWidgets,代码行数:15,代码来源:fontutil.cpp


示例2: Create

wxFont::wxFont(const wxNativeFontInfo& info)
{
    Create( info.GetPointSize(),
            info.GetFamily(),
            info.GetStyle(),
            info.GetWeight(),
            info.GetUnderlined(),
            info.GetFaceName(),
            info.GetEncoding() );

    if ( info.GetStrikethrough() )
        SetStrikethrough(true);
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:13,代码来源:font.cpp


示例3: Create

wxFont::wxFont(const wxNativeFontInfo& info)
{
#if wxUSE_UNICODE
    Create( info.GetPointSize(),
            info.GetFamily(),
            info.GetStyle(),
            info.GetWeight(),
            info.GetUnderlined(),
            info.GetFaceName(),
            info.GetEncoding() );

    if ( info.GetStrikethrough() )
        SetStrikethrough(true);
#else
    (void) Create(info.GetXFontName());
#endif
}
开发者ID:utelle,项目名称:wxWidgets,代码行数:17,代码来源:font.cpp


示例4: SetNativeFontInfo

void wxFontRefData::SetNativeFontInfo(const wxNativeFontInfo& info)
{
    // previously cached fonts shouldn't be used
    ClearX11Fonts();

    m_nativeFontInfo = info;

    m_family = info.GetFamily();

    // set all the other font parameters from the native font info
    InitFromNative();
}
开发者ID:utelle,项目名称:wxWidgets,代码行数:12,代码来源:font.cpp


示例5: Create

wxFont::wxFont(const wxNativeFontInfo& info)
{
    (void) Create(info.GetXFontName());
}
开发者ID:beanhome,项目名称:dev,代码行数:4,代码来源:font.cpp


示例6: Init

wxFont::wxFont(const wxNativeFontInfo& info)
{
    Init();
    (void) Create(info.GetBFontName());
}
开发者ID:BackupTheBerlios,项目名称:wxbeos-svn,代码行数:5,代码来源:font.cpp


示例7: Init

void wxFontRefData::Init(int pointSize,
                         wxFontFamily family,
                         wxFontStyle style,
                         wxFontWeight weight,
                         bool underlined,
                         const wxString& faceName,
                         wxFontEncoding encoding)
{
    m_family = family == wxFONTFAMILY_DEFAULT ? wxFONTFAMILY_SWISS : family;

    m_faceName = faceName;

    // we accept both wxDEFAULT and wxNORMAL here - should we?
    m_style = style == wxDEFAULT ? wxFONTSTYLE_NORMAL : style;
    m_weight = weight == wxDEFAULT ? wxFONTWEIGHT_NORMAL : weight;

    m_underlined = underlined;
    m_encoding = encoding;

#if wxUSE_UNICODE
    if ( m_nativeFontInfo.description )
        pango_font_description_free(m_nativeFontInfo.description);

    // Create native font info
    m_nativeFontInfo.description = pango_font_description_new();

    // if a face name is specified, use it if it's available, otherwise use
    // just the family
    if ( faceName.empty() || !wxFontEnumerator::IsValidFacename(faceName) )
    {
        // TODO: scan system for valid fonts matching the given family instead
        //       of hardcoding them here
        switch ( m_family )
        {
            case wxFONTFAMILY_TELETYPE:
                m_faceName = wxT("monospace");
                break;

            case wxFONTFAMILY_ROMAN:
                m_faceName = wxT("serif");
                break;

            default:
                m_faceName = wxT("sans");
        }
    }
    else // specified face name is available, use it
    {
        m_faceName = faceName;
    }

    m_nativeFontInfo.SetFaceName(m_faceName);
    m_nativeFontInfo.SetWeight((wxFontWeight)m_weight);
    m_nativeFontInfo.SetStyle((wxFontStyle)m_style);
#endif // wxUSE_UNICODE

    SetPointSize(pointSize);
}
开发者ID:beanhome,项目名称:dev,代码行数:58,代码来源:font.cpp


示例8: SetWeight

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);
    }
}
开发者ID:beanhome,项目名称:dev,代码行数:29,代码来源:font.cpp


示例9: SetStyle

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);
    }
}
开发者ID:beanhome,项目名称:dev,代码行数:28,代码来源:font.cpp


示例10: InitFromNative

void wxFontRefData::InitFromNative()
{
    // Get native info
    PangoFontDescription *desc = m_nativeFontInfo.description;

    // Pango sometimes needs to have a size
    int pango_size = pango_font_description_get_size( desc );
    if (pango_size == 0)
        m_nativeFontInfo.SetPointSize(wxDEFAULT_FONT_SIZE);
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:10,代码来源:font.cpp


示例11: SetPointSize

void wxFontRefData::SetPointSize(int pointSize)
{
    // NB: Pango doesn't support point sizes less than 1
    m_pointSize = pointSize == wxDEFAULT || pointSize < 1 ? wxDEFAULT_FONT_SIZE
                                                          : pointSize;

#if wxUSE_UNICODE
    m_nativeFontInfo.SetPointSize(m_pointSize);
#endif
}
开发者ID:beanhome,项目名称:dev,代码行数:10,代码来源:font.cpp


示例12: SetFaceName

bool wxFontRefData::SetFaceName(const wxString& facename)
{
    m_faceName = facename;

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

    return true;
}
开发者ID:beanhome,项目名称:dev,代码行数:11,代码来源:font.cpp


示例13: SetEncoding

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);
        }
    }
}
开发者ID:beanhome,项目名称:dev,代码行数:14,代码来源:font.cpp


示例14: InitFromNative

void wxFontRefData::InitFromNative()
{
    // Get native info
    PangoFontDescription *desc = m_nativeFontInfo.description;

    // Pango sometimes needs to have a size
    int pango_size = pango_font_description_get_size( desc );
    if (pango_size == 0)
        m_nativeFontInfo.SetPointSize(wxDEFAULT_FONT_SIZE);

    // Pango description are never underlined
    m_underlined = false;
    m_strikethrough = false;
}
开发者ID:Annovae,项目名称:Dolphin-Core,代码行数:14,代码来源:font.cpp


示例15: InitFromNative

void wxFontRefData::InitFromNative()
{
    m_noAA = false;

    // Get native info
    PangoFontDescription *desc = m_nativeFontInfo.description;

    // Pango sometimes needs to have a size
    int pango_size = pango_font_description_get_size( desc );
    if (pango_size == 0)
        m_nativeFontInfo.SetPointSize(wxDEFAULT_FONT_SIZE);

    wxString faceName = wxGTK_CONV_BACK_SYS(pango_font_description_get_family(desc));
    if (faceName == wxT("monospace"))
    {
        m_family = wxFONTFAMILY_TELETYPE;
    }
    else if (faceName == wxT("sans"))
    {
        m_family = wxFONTFAMILY_SWISS;
    }
    else if (faceName == wxT("serif"))
    {
        m_family = wxFONTFAMILY_ROMAN;
    }
    else
    {
        m_family = wxFONTFAMILY_UNKNOWN;
    }

    // Pango description are never underlined
    m_underlined = false;

    // always with GTK+ 2
    m_encoding = wxFONTENCODING_UTF8;
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:36,代码来源:font.cpp


示例16: SetUnderlined

void wxFontRefData::SetUnderlined(bool underlined)
{
    m_nativeFontInfo.SetUnderlined(underlined);
    // the XLFD doesn't have "underlined" field anyhow
}
开发者ID:utelle,项目名称:wxWidgets,代码行数:5,代码来源:font.cpp


示例17: SetWeight

void wxFontRefData::SetWeight(wxFontWeight weight)
{
    m_nativeFontInfo.SetWeight((wxFontWeight)weight);
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:4,代码来源:font.cpp


示例18: SetPointSize

void wxFontRefData::SetPointSize(int pointSize)
{
    m_nativeFontInfo.SetPointSize(pointSize);
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:4,代码来源:font.cpp


示例19: SetStrikethrough

void wxFontRefData::SetStrikethrough(bool strikethrough)
{
    m_nativeFontInfo.SetStrikethrough(strikethrough);
}
开发者ID:utelle,项目名称:wxWidgets,代码行数:4,代码来源:font.cpp


示例20: InitFromNative

void wxFontRefData::InitFromNative()
{
    // get the font parameters from the XLFD
    // -------------------------------------

    m_faceName = m_nativeFontInfo.GetXFontComponent(wxXLFD_FAMILY);

    m_weight = wxFONTWEIGHT_NORMAL;

    wxString w = m_nativeFontInfo.GetXFontComponent(wxXLFD_WEIGHT).Upper();
    if ( !w.empty() && w != wxT('*') )
    {
        // the test below catches all of BOLD, EXTRABOLD, DEMIBOLD, ULTRABOLD
        // and BLACK
        if ( ((w[0u] == wxT('B') && (!wxStrcmp(w.c_str() + 1, wxT("OLD")) ||
                                   !wxStrcmp(w.c_str() + 1, wxT("LACK"))))) ||
             wxStrstr(w.c_str() + 1, wxT("BOLD")) )
        {
            m_weight = wxFONTWEIGHT_BOLD;
        }
        else if ( w == wxT("LIGHT") || w == wxT("THIN") )
        {
            m_weight = wxFONTWEIGHT_LIGHT;
        }
    }

    switch ( wxToupper(m_nativeFontInfo.
                           GetXFontComponent(wxXLFD_SLANT)[0u]).GetValue() )
    {
        case wxT('I'):   // italique
            m_style = wxFONTSTYLE_ITALIC;
            break;

        case wxT('O'):   // oblique
            m_style = wxFONTSTYLE_SLANT;
            break;

        default:
            m_style = wxFONTSTYLE_NORMAL;
    }

    long ptSize;
    if ( m_nativeFontInfo.GetXFontComponent(wxXLFD_POINTSIZE).ToLong(&ptSize) )
    {
        // size in XLFD is in 10 point units
        m_pointSize = (int)(ptSize / 10);
    }
    else
    {
        m_pointSize = wxDEFAULT_FONT_SIZE;
    }

    // examine the spacing: if the font is monospaced, assume wxTELETYPE
    // family for compatibility with the old code which used it instead of
    // IsFixedWidth()
    if ( m_nativeFontInfo.GetXFontComponent(wxXLFD_SPACING).Upper() == wxT('M') )
    {
        m_family = wxFONTFAMILY_TELETYPE;
    }
    else // not monospaceed
    {
        // don't even try guessing it, it doesn't work for too many fonts
        // anyhow
        m_family = wxFONTFAMILY_UNKNOWN;
    }

    // X fonts are never underlined...
    m_underlined = false;

    // deal with font encoding
    wxString
        registry = m_nativeFontInfo.GetXFontComponent(wxXLFD_REGISTRY).Upper(),
        encoding = m_nativeFontInfo.GetXFontComponent(wxXLFD_ENCODING).Upper();

    if ( registry == wxT("ISO8859") )
    {
        int cp;
        if ( wxSscanf(encoding, wxT("%d"), &cp) == 1 )
        {
            m_encoding = (wxFontEncoding)(wxFONTENCODING_ISO8859_1 + cp - 1);
        }
    }
    else if ( registry == wxT("MICROSOFT") )
    {
        int cp;
        if ( wxSscanf(encoding, wxT("cp125%d"), &cp) == 1 )
        {
            m_encoding = (wxFontEncoding)(wxFONTENCODING_CP1250 + cp);
        }
    }
    else if ( registry == wxT("KOI8") )
    {
        m_encoding = wxFONTENCODING_KOI8;
    }
    else // unknown encoding
    {
        // may be give a warning here? or use wxFontMapper?
        m_encoding = wxFONTENCODING_SYSTEM;
    }
}
开发者ID:beanhome,项目名称:dev,代码行数:100,代码来源:font.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ wxNavigationKeyEvent类代码示例发布时间:2022-05-31
下一篇:
C++ wxMutex类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap