本文整理汇总了C++中wxFont::GetNativeFontInfoUserDesc方法的典型用法代码示例。如果您正苦于以下问题:C++ wxFont::GetNativeFontInfoUserDesc方法的具体用法?C++ wxFont::GetNativeFontInfoUserDesc怎么用?C++ wxFont::GetNativeFontInfoUserDesc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxFont
的用法示例。
在下文中一共展示了wxFont::GetNativeFontInfoUserDesc方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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;
}
示例2: ToString
wxString xsFontPropIO::ToString(wxFont value)
{
return value.GetNativeFontInfoUserDesc();
}
示例3: 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++ )
//.........这里部分代码省略.........
示例4: FontToString
// wxFont
static wxString FontToString(const wxFont & font)
{ return font.GetNativeFontInfoUserDesc(); }