本文整理汇总了C++中wxNativeFontInfo类的典型用法代码示例。如果您正苦于以下问题:C++ wxNativeFontInfo类的具体用法?C++ wxNativeFontInfo怎么用?C++ wxNativeFontInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxNativeFontInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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);
}
示例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
}
示例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();
}
示例5: Create
wxFont::wxFont(const wxNativeFontInfo& info)
{
(void) Create(info.GetXFontName());
}
示例6: Init
wxFont::wxFont(const wxNativeFontInfo& info)
{
Init();
(void) Create(info.GetBFontName());
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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
}
示例12: SetFaceName
bool wxFontRefData::SetFaceName(const wxString& facename)
{
m_faceName = facename;
if ( HasNativeFont() )
{
m_nativeFontInfo.SetXFontComponent(wxXLFD_FAMILY, facename);
}
return true;
}
示例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);
}
}
}
示例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;
}
示例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;
}