@@ -33,6 +33,8 @@ GUIPanelRepresentation::GUIPanelRepresentation(wxWindow *parent, const wxString&
3333 m_EnclosureY = 0 ;
3434 m_CenterY = 0 ;
3535 m_CenterWidth = 0 ;
36+ m_FontScale = 1.0 ;
37+ InitFont ();
3638}
3739
3840GUIPanelRepresentation::~GUIPanelRepresentation () {
@@ -158,7 +160,11 @@ void GUIPanelRepresentation::RenderPanel(wxDC& dc) {
158160 TileBitmap (imgRect, dc, theBmp, btnElement->getTileOffsetX (), btnElement->getTileOffsetY ());
159161
160162 if (btnElement->getTextBreakWidth ()) {
161- dc.SetFont (btnElement->getDispLabelFont ());
163+ wxFont theFont = btnElement->getDispLabelFont ();
164+ int pointSize = theFont.GetPointSize ();
165+ pointSize *= m_FontScale;
166+ theFont.SetPointSize (pointSize);
167+ dc.SetFont (theFont);
162168 dc.SetBackgroundMode (wxTRANSPARENT);
163169 dc.SetTextForeground (btnElement->getDispLabelColour ()->getColor ());
164170 wxRect textRect (
@@ -233,7 +239,11 @@ void GUIPanelRepresentation::RenderPanel(wxDC& dc) {
233239 TileBitmap (imgRect, dc, theBmp, btnElement->getTileOffsetX (), btnElement->getTileOffsetY ());
234240
235241 if (btnElement->getTextBreakWidth ()) {
236- dc.SetFont (btnElement->getDispLabelFont ());
242+ wxFont theFont = btnElement->getDispLabelFont ();
243+ int pointSize = theFont.GetPointSize ();
244+ pointSize *= m_FontScale;
245+ theFont.SetPointSize (pointSize);
246+ dc.SetFont (theFont);
237247 dc.SetBackgroundMode (wxTRANSPARENT);
238248 dc.SetTextForeground (btnElement->getDispLabelColour ()->getColor ());
239249 wxRect textRect (
@@ -303,7 +313,11 @@ void GUIPanelRepresentation::RenderPanel(wxDC& dc) {
303313 TileBitmap (imgRect, dc, theBmp, encElement->getTileOffsetX (), encElement->getTileOffsetY ());
304314
305315 if (encElement->getTextBreakWidth ()) {
306- dc.SetFont (encElement->getDispLabelFont ());
316+ wxFont theFont = encElement->getDispLabelFont ();
317+ int pointSize = theFont.GetPointSize ();
318+ pointSize *= m_FontScale;
319+ theFont.SetPointSize (pointSize);
320+ dc.SetFont (theFont);
307321 dc.SetBackgroundMode (wxTRANSPARENT);
308322 dc.SetTextForeground (encElement->getDispLabelColour ()->getColor ());
309323 wxRect textRect (
@@ -370,7 +384,11 @@ void GUIPanelRepresentation::RenderPanel(wxDC& dc) {
370384 }
371385
372386 if (labelElement->getTextBreakWidth () && labelElement->getName () != wxEmptyString) {
373- dc.SetFont (labelElement->getDispLabelFont ());
387+ wxFont theFont = labelElement->getDispLabelFont ();
388+ int pointSize = theFont.GetPointSize ();
389+ pointSize *= m_FontScale;
390+ theFont.SetPointSize (pointSize);
391+ dc.SetFont (theFont);
374392 dc.SetBackgroundMode (wxTRANSPARENT);
375393 dc.SetTextForeground (labelElement->getDispLabelColour ()->getColor ());
376394 wxRect textRect (
@@ -709,3 +727,13 @@ void GUIPanelRepresentation::DoUpdateLayout() {
709727 UpdateLayout ();
710728 DoPaintNow ();
711729}
730+
731+ void GUIPanelRepresentation::InitFont () {
732+ wxMemoryDC dc;
733+ wxFont font = *wxNORMAL_FONT;
734+ wxCoord cx, cy;
735+ font.SetPointSize (39 );
736+ dc.SetFont (font);
737+ dc.GetTextExtent (wxT (" M" ), &cx, &cy);
738+ m_FontScale = 62.0 / cy;
739+ }
0 commit comments