Show the more metrics for the selected font in the sample.
Show the result of wxDC::GetChar{Width,Height}() and the font size in pixels in addition to the font size in points. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63168 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1012,6 +1012,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
// set background
|
// set background
|
||||||
dc.SetBackground(wxBrush(wxT("white"), wxSOLID));
|
dc.SetBackground(wxBrush(wxT("white"), wxSOLID));
|
||||||
dc.Clear();
|
dc.Clear();
|
||||||
|
dc.SetFont(m_font);
|
||||||
|
|
||||||
// one text line height
|
// one text line height
|
||||||
wxCoord hLine = dc.GetCharHeight();
|
wxCoord hLine = dc.GetCharHeight();
|
||||||
@@ -1030,18 +1031,19 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
dc.DrawText(fontInfo, x, y);
|
dc.DrawText(fontInfo, x, y);
|
||||||
y += hLine;
|
y += hLine;
|
||||||
|
|
||||||
fontInfo.Printf(wxT("Size: %d points, encoding: %s"),
|
fontInfo.Printf(wxT("Size: %d points or %d pixels; %d*%d average char size"),
|
||||||
m_font.GetPointSize(),
|
m_font.GetPointSize(),
|
||||||
wxFontMapper::
|
m_font.GetPixelSize().y,
|
||||||
GetEncodingDescription(m_font.GetEncoding()).c_str());
|
dc.GetCharWidth(), dc.GetCharHeight());
|
||||||
|
|
||||||
dc.DrawText(fontInfo, x, y);
|
dc.DrawText(fontInfo, x, y);
|
||||||
y += hLine;
|
y += hLine;
|
||||||
|
|
||||||
fontInfo.Printf(wxT("Style: %s, weight: %s, fixed width: %s"),
|
fontInfo.Printf(wxT("Style: %s, weight: %s, fixed width: %s, encoding: %s"),
|
||||||
m_font.GetStyleString().c_str(),
|
m_font.GetStyleString().c_str(),
|
||||||
m_font.GetWeightString().c_str(),
|
m_font.GetWeightString().c_str(),
|
||||||
m_font.IsFixedWidth() ? wxT("yes") : wxT("no"));
|
m_font.IsFixedWidth() ? wxT("yes") : wxT("no"),
|
||||||
|
wxFontMapper::GetEncodingDescription(m_font.GetEncoding()));
|
||||||
|
|
||||||
dc.DrawText(fontInfo, x, y);
|
dc.DrawText(fontInfo, x, y);
|
||||||
y += hLine;
|
y += hLine;
|
||||||
@@ -1062,7 +1064,6 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
y += hLine;
|
y += hLine;
|
||||||
|
|
||||||
// prepare to draw the font
|
// prepare to draw the font
|
||||||
dc.SetFont(m_font);
|
|
||||||
dc.SetTextForeground(m_colour);
|
dc.SetTextForeground(m_colour);
|
||||||
|
|
||||||
// the size of one cell (Normally biggest char + small margin)
|
// the size of one cell (Normally biggest char + small margin)
|
||||||
|
Reference in New Issue
Block a user