From 9c78e4cf54b99757614f21f3b75753f0ba624bc7 Mon Sep 17 00:00:00 2001
From: Jeff Young <jeff@rokeby.ie>
Date: Sat, 11 Sep 2021 20:07:33 +0100
Subject: [PATCH] Mac needs different font size handling than MSW & GTK.

Mac already uses diverse font sizes (for instance, smaller fonts for
radio button groups), and the anti-aliasing is a lot better.  The
other platforms need a more limited range of sizes.

Fixes https://gitlab.com/kicad/code/kicad/issues/8608
---
 common/dialogs/panel_setup_netclasses.cpp     |  2 +-
 common/eda_draw_frame.cpp                     |  2 +-
 common/widgets/msgpanel.cpp                   |  4 +--
 common/widgets/ui_common.cpp                  | 31 ++++++++++++----
 common/widgets/wx_grid.cpp                    |  4 +--
 cvpcb/cvpcb_mainframe.cpp                     |  6 ++--
 eeschema/dialogs/dialog_junction_props.cpp    |  4 +--
 .../dialogs/dialog_lib_text_properties.cpp    |  2 +-
 .../dialog_line_wire_bus_properties.cpp       |  4 +--
 eeschema/dialogs/dialog_sheet_properties.cpp  |  2 +-
 .../dialog_text_and_label_properties.cpp      |  4 +--
 .../panel_eeschema_display_options.cpp        |  2 +-
 include/widgets/ui_common.h                   |  4 ++-
 kicad/kicad_manager_frame.cpp                 |  2 +-
 kicad/project_tree.cpp                        |  2 +-
 .../dialogs/properties_frame.cpp              |  2 +-
 pcb_calculator/pcb_calculator_frame.cpp       |  2 +-
 pcbnew/dialogs/dialog_board_statistics.cpp    |  2 +-
 .../dialogs/dialog_footprint_properties.cpp   |  2 +-
 .../dialog_footprint_properties_fp_editor.cpp |  2 +-
 pcbnew/dialogs/dialog_get_footprint_by_name.h |  2 +-
 .../dialog_global_edit_text_and_graphics.cpp  |  2 +-
 .../dialog_global_edit_tracks_and_vias.cpp    |  2 +-
 pcbnew/dialogs/dialog_pad_properties.cpp      |  2 +-
 pcbnew/dialogs/dialog_text_properties.cpp     |  2 +-
 pcbnew/dialogs/panel_fp_editor_defaults.cpp   |  2 +-
 pcbnew/dialogs/panel_setup_constraints.cpp    |  2 +-
 pcbnew/widgets/appearance_controls.cpp        | 36 +++++++++++++------
 pcbnew/widgets/appearance_controls_base.cpp   | 31 +++++++---------
 pcbnew/widgets/appearance_controls_base.fbp   | 30 ++++++++--------
 pcbnew/widgets/appearance_controls_base.h     |  6 ++--
 pcbnew/widgets/panel_selection_filter.cpp     |  6 +++-
 32 files changed, 121 insertions(+), 87 deletions(-)

diff --git a/common/dialogs/panel_setup_netclasses.cpp b/common/dialogs/panel_setup_netclasses.cpp
index 1f96f25741..750db8e911 100644
--- a/common/dialogs/panel_setup_netclasses.cpp
+++ b/common/dialogs/panel_setup_netclasses.cpp
@@ -136,7 +136,7 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, NETCLASSE
         attr->SetEditor( new GRID_CELL_ICON_TEXT_POPUP( g_lineStyleIcons, g_lineStyleNames ) );
         m_netclassGrid->SetColAttr( GRID_LINESTYLE, attr );
 
-        m_colorDefaultHelpText->SetFont( KIUI::GetGUIFont( this, -1 ) );
+        m_colorDefaultHelpText->SetFont( KIUI::GetInfoFont( this ) );
     }
     else
     {
diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp
index 1960876397..ad24b6669c 100644
--- a/common/eda_draw_frame.cpp
+++ b/common/eda_draw_frame.cpp
@@ -145,7 +145,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
     };
 
     SetStatusWidths( arrayDim( dims ), dims );
-    stsbar->SetFont( KIUI::GetGUIFont( this, -2 ) );
+    stsbar->SetFont( KIUI::GetStatusFont( this ) );
 
     // Create child subwindows.
     GetClientSize( &m_frameSize.x, &m_frameSize.y );
diff --git a/common/widgets/msgpanel.cpp b/common/widgets/msgpanel.cpp
index 77e6642784..d3410400c5 100644
--- a/common/widgets/msgpanel.cpp
+++ b/common/widgets/msgpanel.cpp
@@ -43,7 +43,7 @@ EDA_MSG_PANEL::EDA_MSG_PANEL( wxWindow* aParent, int aId,
                               long style, const wxString &name ) :
     wxPanel( aParent, aId, aPosition, aSize, style, name )
 {
-    SetFont( KIUI::GetGUIFont( this, -2 ) );
+    SetFont( KIUI::GetStatusFont( this ) );
     SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
 
     // informs wx not to paint the background itself as we will paint it later in erase()
@@ -90,7 +90,7 @@ void EDA_MSG_PANEL::OnPaint( wxPaintEvent& aEvent )
     dc.SetBackground( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
     dc.SetBackgroundMode( wxSOLID );
     dc.SetTextBackground( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
-    dc.SetFont( KIUI::GetGUIFont( this ) );
+    dc.SetFont( KIUI::GetControlFont( this ) );
 
     for( const MSG_PANEL_ITEM& item : m_Items )
         showItem( dc, item );
diff --git a/common/widgets/ui_common.cpp b/common/widgets/ui_common.cpp
index 7504e1daff..f2c76c4f48 100644
--- a/common/widgets/ui_common.cpp
+++ b/common/widgets/ui_common.cpp
@@ -95,15 +95,10 @@ wxFont KIUI::GetMonospacedUIFont()
 }
 
 
-wxFont KIUI::GetGUIFont( wxWindow* aWindow, int aRelativeSize )
+wxFont getGUIFont( wxWindow* aWindow, int aRelativeSize )
 {
     wxFont font = aWindow->GetFont();
 
-#ifdef __WXMSW__
-    // -2 is too small on MSW
-    aRelativeSize = std::max( aRelativeSize, -1 );
-#endif
-
     font.SetPointSize( font.GetPointSize() + aRelativeSize );
 
     // Both wxFont::SetSymbolicSize() and wxWindow::ConvertDialogToPixels() fail on some GTKs
@@ -131,6 +126,30 @@ wxFont KIUI::GetGUIFont( wxWindow* aWindow, int aRelativeSize )
 }
 
 
+wxFont KIUI::GetStatusFont( wxWindow* aWindow )
+{
+#ifdef __WXMAC__
+    int scale = -2;
+#else
+    int scale = -1;
+#endif
+
+    return getGUIFont( aWindow, scale );
+}
+
+
+wxFont KIUI::GetInfoFont( wxWindow* aWindow )
+{
+    return getGUIFont( aWindow, -1 );
+}
+
+
+wxFont KIUI::GetControlFont( wxWindow* aWindow )
+{
+    return getGUIFont( aWindow, 0 );
+}
+
+
 bool KIUI::EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString )
 {
     wxWindow* window = aCtrl->GetParent();
diff --git a/common/widgets/wx_grid.cpp b/common/widgets/wx_grid.cpp
index b4b8d981f0..e445993aa3 100644
--- a/common/widgets/wx_grid.cpp
+++ b/common/widgets/wx_grid.cpp
@@ -40,7 +40,7 @@ WX_GRID::WX_GRID( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxS
     SetDefaultCellOverflow( false );
 
     // Make sure the GUI font scales properly on GTK
-    SetDefaultCellFont( KIUI::GetGUIFont( this ) );
+    SetDefaultCellFont( KIUI::GetControlFont( this ) );
 }
 
 
@@ -60,7 +60,7 @@ void WX_GRID::SetColLabelSize( int aHeight )
     }
 
     // Make sure the GUI font scales properly on GTK
-    wxFont headingFont = KIUI::GetGUIFont( this );
+    wxFont headingFont = KIUI::GetControlFont( this );
     headingFont.MakeBold();
     SetLabelFont( headingFont );
 
diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp
index 4cedd5652f..d056aac668 100644
--- a/cvpcb/cvpcb_mainframe.cpp
+++ b/cvpcb/cvpcb_mainframe.cpp
@@ -132,9 +132,9 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
     wxStaticLine* staticline1 = new wxStaticLine( bottomPanel );
     panelSizer->Add( staticline1, 0, wxEXPAND, 5 );
 
-    m_statusLine1->SetFont( KIUI::GetGUIFont( this, -1 ) );
-    m_statusLine2->SetFont( KIUI::GetGUIFont( this, -1 ) );
-    m_statusLine3->SetFont( KIUI::GetGUIFont( this, -1 ) );
+    m_statusLine1->SetFont( KIUI::GetStatusFont( this ) );
+    m_statusLine2->SetFont( KIUI::GetStatusFont( this ) );
+    m_statusLine3->SetFont( KIUI::GetStatusFont( this ) );
 
     // Add buttons:
     auto buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
diff --git a/eeschema/dialogs/dialog_junction_props.cpp b/eeschema/dialogs/dialog_junction_props.cpp
index bb25e36d90..562c514ca6 100644
--- a/eeschema/dialogs/dialog_junction_props.cpp
+++ b/eeschema/dialogs/dialog_junction_props.cpp
@@ -37,8 +37,8 @@ DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS( SCH_EDIT_FRAME* aParent,
 
     m_colorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
 
-    m_helpLabel1->SetFont( KIUI::GetGUIFont( this, -1 ) );
-    m_helpLabel2->SetFont( KIUI::GetGUIFont( this, -1 ) );
+    m_helpLabel1->SetFont( KIUI::GetInfoFont( this ) );
+    m_helpLabel2->SetFont( KIUI::GetInfoFont( this ) );
 
     SetInitialFocus( m_textCtrlDiameter );
 
diff --git a/eeschema/dialogs/dialog_lib_text_properties.cpp b/eeschema/dialogs/dialog_lib_text_properties.cpp
index ff250a6fa9..1f01551bf2 100644
--- a/eeschema/dialogs/dialog_lib_text_properties.cpp
+++ b/eeschema/dialogs/dialog_lib_text_properties.cpp
@@ -45,7 +45,7 @@ DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES( SYMBOL_EDIT_FRAME* aPare
     m_TextValueSelectButton->Hide();
     m_PowerComponentValues->Show( false );
 
-    m_PowerComponentValues->SetFont( KIUI::GetGUIFont( this, -1 ) );
+    m_PowerComponentValues->SetFont( KIUI::GetInfoFont( this ) );
 
     SetInitialFocus( m_TextCtrl );
     m_StyledTextCtrl->Show( false );
diff --git a/eeschema/dialogs/dialog_line_wire_bus_properties.cpp b/eeschema/dialogs/dialog_line_wire_bus_properties.cpp
index 1990b0cee5..e3cb76e709 100644
--- a/eeschema/dialogs/dialog_line_wire_bus_properties.cpp
+++ b/eeschema/dialogs/dialog_line_wire_bus_properties.cpp
@@ -64,8 +64,8 @@ DIALOG_LINE_WIRE_BUS_PROPERTIES::DIALOG_LINE_WIRE_BUS_PROPERTIES( SCH_EDIT_FRAME
 
     m_colorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
 
-    m_helpLabel1->SetFont( KIUI::GetGUIFont( this, -1 ) );
-    m_helpLabel2->SetFont( KIUI::GetGUIFont( this, -1 ) );
+    m_helpLabel1->SetFont( KIUI::GetInfoFont( this ) );
+    m_helpLabel2->SetFont( KIUI::GetInfoFont( this ) );
 
     SetInitialFocus( m_lineWidth );
 
diff --git a/eeschema/dialogs/dialog_sheet_properties.cpp b/eeschema/dialogs/dialog_sheet_properties.cpp
index 3061d53581..f07376731b 100644
--- a/eeschema/dialogs/dialog_sheet_properties.cpp
+++ b/eeschema/dialogs/dialog_sheet_properties.cpp
@@ -81,7 +81,7 @@ DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_S
     m_bpMoveDown->SetBitmap( KiBitmap( BITMAPS::small_down ) );
 
     // Set font sizes
-    m_hierarchicalPathLabel->SetFont( KIUI::GetGUIFont( this, -2 ) );
+    m_hierarchicalPathLabel->SetFont( KIUI::GetInfoFont( this ) );
 
     // wxFormBuilder doesn't include this event...
     m_grid->Connect( wxEVT_GRID_CELL_CHANGING,
diff --git a/eeschema/dialogs/dialog_text_and_label_properties.cpp b/eeschema/dialogs/dialog_text_and_label_properties.cpp
index 05aabf6201..a5b9bb79cd 100644
--- a/eeschema/dialogs/dialog_text_and_label_properties.cpp
+++ b/eeschema/dialogs/dialog_text_and_label_properties.cpp
@@ -116,8 +116,8 @@ DIALOG_TEXT_AND_LABEL_PROPERTIES::DIALOG_TEXT_AND_LABEL_PROPERTIES( SCH_EDIT_FRA
 
     if( m_CurrentText->Type() == SCH_GLOBAL_LABEL_T )
     {
-        m_note1->SetFont( KIUI::GetGUIFont( this, -1 ) );
-        m_note2->SetFont( KIUI::GetGUIFont( this, -1 ) );
+        m_note1->SetFont( KIUI::GetInfoFont( this ) );
+        m_note2->SetFont( KIUI::GetInfoFont( this ) );
     }
     else
     {
diff --git a/eeschema/dialogs/panel_eeschema_display_options.cpp b/eeschema/dialogs/panel_eeschema_display_options.cpp
index 5412bbaf80..d36effa451 100644
--- a/eeschema/dialogs/panel_eeschema_display_options.cpp
+++ b/eeschema/dialogs/panel_eeschema_display_options.cpp
@@ -37,7 +37,7 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS::PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME*
 
     m_galOptionsSizer->Add( m_galOptsPanel, 1, wxEXPAND, 0 );
 
-    m_highlightColorNote->SetFont( KIUI::GetGUIFont( this, -1 ) );
+    m_highlightColorNote->SetFont( KIUI::GetInfoFont( this ) );
 }
 
 
diff --git a/include/widgets/ui_common.h b/include/widgets/ui_common.h
index 3aa2bab463..b54ed4cf8d 100644
--- a/include/widgets/ui_common.h
+++ b/include/widgets/ui_common.h
@@ -52,7 +52,9 @@ wxSize GetTextSize( const wxString& aSingleLine, wxWindow* aWindow );
 
 wxFont GetMonospacedUIFont();
 
-wxFont GetGUIFont( wxWindow* aWindow, int aRelativeSize = 0 );
+wxFont GetControlFont( wxWindow* aWindow );
+wxFont GetInfoFont( wxWindow* aWindow );
+wxFont GetStatusFont( wxWindow* aWindow );
 
 /**
  * Set the minimum pixel width on a text control in order to make a text
diff --git a/kicad/kicad_manager_frame.cpp b/kicad/kicad_manager_frame.cpp
index 9bef568052..d0088b143a 100644
--- a/kicad/kicad_manager_frame.cpp
+++ b/kicad/kicad_manager_frame.cpp
@@ -126,7 +126,7 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& titl
     // Create the status line (bottom of the frame).  Left half is for project name; right half
     // is for Reporter (currently used by archiver/unarchiver).
     CreateStatusBar( 2 );
-    GetStatusBar()->SetFont( KIUI::GetGUIFont( this, -2 ) );
+    GetStatusBar()->SetFont( KIUI::GetStatusFont( this ) );
 
     // Give an icon
     wxIcon icon;
diff --git a/kicad/project_tree.cpp b/kicad/project_tree.cpp
index 8ef5402ab9..4348e7c866 100644
--- a/kicad/project_tree.cpp
+++ b/kicad/project_tree.cpp
@@ -49,7 +49,7 @@ PROJECT_TREE::PROJECT_TREE( PROJECT_TREE_PANE* parent ) :
     m_projectTreePane = parent;
 
     // Make sure the GUI font scales properly on GTK
-    SetFont( KIUI::GetGUIFont( this ) );
+    SetFont( KIUI::GetControlFont( this ) );
 
     // icons size is not know (depending on they are built)
     // so get it:
diff --git a/pagelayout_editor/dialogs/properties_frame.cpp b/pagelayout_editor/dialogs/properties_frame.cpp
index 9f7f8bccea..f4adadbaf3 100644
--- a/pagelayout_editor/dialogs/properties_frame.cpp
+++ b/pagelayout_editor/dialogs/properties_frame.cpp
@@ -78,7 +78,7 @@ PROPERTIES_FRAME::PROPERTIES_FRAME( PL_EDITOR_FRAME* aParent ) :
     m_stcText->SetUseHorizontalScrollBar( false );
     m_scintillaTricks = new SCINTILLA_TRICKS( m_stcText, wxT( "{}" ), false );
 
-    m_staticTextSizeInfo->SetFont( KIUI::GetGUIFont( this, -1 ) );
+    m_staticTextSizeInfo->SetFont( KIUI::GetInfoFont( this ) );
 
     m_buttonOK->SetDefault();
 
diff --git a/pcb_calculator/pcb_calculator_frame.cpp b/pcb_calculator/pcb_calculator_frame.cpp
index 53686f6e8e..e0ba77b6f9 100644
--- a/pcb_calculator/pcb_calculator_frame.cpp
+++ b/pcb_calculator/pcb_calculator_frame.cpp
@@ -74,7 +74,7 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
     m_attenuator_list.push_back( new ATTENUATOR_SPLITTER() );
     m_currAttenuator = m_attenuator_list[0];
 
-    m_staticTextAttMsg->SetFont( KIUI::GetGUIFont( this, -1 ) );
+    m_staticTextAttMsg->SetFont( KIUI::GetInfoFont( this ) );
 
     m_IadjUnitLabel->SetLabel( wxT( "µA" ) );
 
diff --git a/pcbnew/dialogs/dialog_board_statistics.cpp b/pcbnew/dialogs/dialog_board_statistics.cpp
index 416a86b354..6d2ca5d8e7 100644
--- a/pcbnew/dialogs/dialog_board_statistics.cpp
+++ b/pcbnew/dialogs/dialog_board_statistics.cpp
@@ -91,7 +91,7 @@ DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS( PCB_EDIT_FRAME* aParentFrame )
     m_checkBoxSubtractHoles->SetValue( s_savedDialogState.subtractHoles );
 
     // Make labels for grids
-    wxFont headingFont = KIUI::GetGUIFont( this, -1 );
+    wxFont headingFont = KIUI::GetStatusFont( this );
     m_gridComponents->SetCellValue( ROW_LABEL, COL_FRONT_SIDE, _( "Front Side" ) );
     m_gridComponents->SetCellFont( ROW_LABEL, COL_FRONT_SIDE, headingFont );
     m_gridComponents->SetCellValue( ROW_LABEL, COL_BOTTOM_SIDE, _( "Back Side" ) );
diff --git a/pcbnew/dialogs/dialog_footprint_properties.cpp b/pcbnew/dialogs/dialog_footprint_properties.cpp
index bec230f6bf..e0554dd3bd 100644
--- a/pcbnew/dialogs/dialog_footprint_properties.cpp
+++ b/pcbnew/dialogs/dialog_footprint_properties.cpp
@@ -109,7 +109,7 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
     m_orientValidator.SetWindow( m_OrientValueCtrl );
 
     // Set font size for items showing long strings:
-    wxFont infoFont = KIUI::GetGUIFont( this, -1 );
+    wxFont infoFont = KIUI::GetInfoFont( this );
 #if __WXMAC__
     m_allow90Label->SetFont( infoFont );
     m_allow180Label->SetFont( infoFont );
diff --git a/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp b/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp
index 4ead4641e3..f50b350a64 100644
--- a/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp
+++ b/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp
@@ -100,7 +100,7 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(
     m_FootprintNameCtrl->SetValidator( FOOTPRINT_NAME_VALIDATOR() );
 
     // Set font sizes
-    wxFont infoFont = KIUI::GetGUIFont( this, -1 );
+    wxFont infoFont = KIUI::GetInfoFont( this );
 #if __WXMAC__
     m_allow90Label->SetFont( infoFont );
     m_allow180Label->SetFont( infoFont );
diff --git a/pcbnew/dialogs/dialog_get_footprint_by_name.h b/pcbnew/dialogs/dialog_get_footprint_by_name.h
index 33c9ee9bff..d7b989d99c 100644
--- a/pcbnew/dialogs/dialog_get_footprint_by_name.h
+++ b/pcbnew/dialogs/dialog_get_footprint_by_name.h
@@ -46,7 +46,7 @@ public:
         m_sdbSizerOK->SetDefault();
         m_choiceFpList->Append( aFpList );
 
-        m_multipleHint->SetFont( KIUI::GetGUIFont( this, -1 ) );
+        m_multipleHint->SetFont( KIUI::GetInfoFont( this ) );
 
         // Hide help string until someone implements successive placement (#2227)
         m_multipleHint->Show( false );
diff --git a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp
index f1bfba80df..93169a33c0 100644
--- a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp
+++ b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp
@@ -139,7 +139,7 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( PCB_
     m_LayerCtrl->Resync();
 
     m_grid->SetCellHighlightPenWidth( 0 );
-    m_grid->SetDefaultCellFont( KIUI::GetGUIFont( this, -1 ) );
+    m_grid->SetDefaultCellFont( KIUI::GetInfoFont( this ) );
 
     m_sdbSizerButtonsOK->SetDefault();
 
diff --git a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp
index ec53417a3a..bdd4204ba8 100644
--- a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp
+++ b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp
@@ -129,7 +129,7 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( PCB_EDIT
     m_layerBox->SetUndefinedLayerName( INDETERMINATE_ACTION );
     m_layerBox->Resync();
 
-    m_netclassGrid->SetDefaultCellFont( KIUI::GetGUIFont( this, -1 ) );
+    m_netclassGrid->SetDefaultCellFont( KIUI::GetInfoFont( this ) );
     buildNetclassesGrid();
 
     m_netclassGrid->SetCellHighlightPenWidth( 0 );
diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp
index 06b48a3f8f..a2ceacad73 100644
--- a/pcbnew/dialogs/dialog_pad_properties.cpp
+++ b/pcbnew/dialogs/dialog_pad_properties.cpp
@@ -205,7 +205,7 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, PAD* aPad
 
     initValues();
 
-    wxFont infoFont = KIUI::GetGUIFont( this, -1 );
+    wxFont infoFont = KIUI::GetInfoFont( this );
     m_copperLayersLabel->SetFont( infoFont );
     m_techLayersLabel->SetFont( infoFont );
     m_parentInfo->SetFont( infoFont );
diff --git a/pcbnew/dialogs/dialog_text_properties.cpp b/pcbnew/dialogs/dialog_text_properties.cpp
index 89e63d3e72..f19eb9cbdd 100644
--- a/pcbnew/dialogs/dialog_text_properties.cpp
+++ b/pcbnew/dialogs/dialog_text_properties.cpp
@@ -131,7 +131,7 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO
         m_OrientCtrl->SetString( ii, wxString::Format( "%.1f", rot_list[ii] ) );
 
     // Set font sizes
-    m_statusLine->SetFont( KIUI::GetGUIFont( this, -2 ) );
+    m_statusLine->SetFont( KIUI::GetInfoFont( this ) );
 
     m_sdbSizerOK->SetDefault();
 
diff --git a/pcbnew/dialogs/panel_fp_editor_defaults.cpp b/pcbnew/dialogs/panel_fp_editor_defaults.cpp
index c9db2d4fee..f2215cdce4 100644
--- a/pcbnew/dialogs/panel_fp_editor_defaults.cpp
+++ b/pcbnew/dialogs/panel_fp_editor_defaults.cpp
@@ -199,7 +199,7 @@ PANEL_FP_EDITOR_DEFAULTS::PANEL_FP_EDITOR_DEFAULTS( FOOTPRINT_EDIT_FRAME* aFrame
 
     m_graphicsGrid->PushEventHandler( new GRID_TRICKS( m_graphicsGrid ) );
 
-    m_staticTextInfo->SetFont( KIUI::GetGUIFont( this, -1 ) );
+    m_staticTextInfo->SetFont( KIUI::GetInfoFont( this ) );
 }
 
 
diff --git a/pcbnew/dialogs/panel_setup_constraints.cpp b/pcbnew/dialogs/panel_setup_constraints.cpp
index 5e596b163f..4a12988ffb 100644
--- a/pcbnew/dialogs/panel_setup_constraints.cpp
+++ b/pcbnew/dialogs/panel_setup_constraints.cpp
@@ -51,7 +51,7 @@ PANEL_SETUP_CONSTRAINTS::PANEL_SETUP_CONSTRAINTS( PAGED_DIALOG* aParent, PCB_EDI
     m_Frame = aFrame;
     m_BrdSettings = &m_Frame->GetBoard()->GetDesignSettings();
 
-    m_stCircleToPolyWarning->SetFont( KIUI::GetGUIFont( this, -1 ) );
+    m_stCircleToPolyWarning->SetFont( KIUI::GetInfoFont( this ) );
 }
 
 
diff --git a/pcbnew/widgets/appearance_controls.cpp b/pcbnew/widgets/appearance_controls.cpp
index 4476768e77..2462fae555 100644
--- a/pcbnew/widgets/appearance_controls.cpp
+++ b/pcbnew/widgets/appearance_controls.cpp
@@ -429,6 +429,17 @@ APPEARANCE_CONTROLS::APPEARANCE_CONTROLS( PCB_BASE_FRAME* aParent, wxWindow* aFo
     m_windowObjects->SetScrollRate( 0, 5 );
     m_windowObjects->Bind( wxEVT_SET_FOCUS, &APPEARANCE_CONTROLS::OnSetFocus, this );
 
+    wxFont infoFont = KIUI::GetInfoFont( this );
+    m_staticTextNets->SetFont( infoFont );
+    m_staticTextNetClasses->SetFont( infoFont );
+    m_panelLayers->SetFont( infoFont );
+    m_windowLayers->SetFont( infoFont );
+    m_windowObjects->SetFont( infoFont );
+
+    infoFont = KIUI::GetStatusFont( this );
+    m_presetsLabel->SetFont( infoFont );
+    m_presetsHotkey->SetFont( infoFont );
+
     createControls();
 
     m_btnNetInspector->SetBitmap( KiBitmap( BITMAPS::list_nets_16 ) );
@@ -855,11 +866,9 @@ void APPEARANCE_CONTROLS::OnNetGridRightClick( wxGridEvent& event )
     menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_NETS,
                                  _( "Show All Nets" ), wxEmptyString, wxITEM_NORMAL ) );
     menu.Append( new wxMenuItem( &menu, ID_HIDE_OTHER_NETS,
-                                 _( "Hide All Other Nets" ), wxEmptyString,
-                                 wxITEM_NORMAL ) );
+                                 _( "Hide All Other Nets" ), wxEmptyString, wxITEM_NORMAL ) );
 
-    menu.Bind( wxEVT_COMMAND_MENU_SELECTED,
-               &APPEARANCE_CONTROLS::onNetContextMenu, this );
+    menu.Bind( wxEVT_COMMAND_MENU_SELECTED, &APPEARANCE_CONTROLS::onNetContextMenu, this );
 
     PopupMenu( &menu );
 }
@@ -1287,9 +1296,11 @@ std::vector<LAYER_PRESET> APPEARANCE_CONTROLS::GetUserLayerPresets() const
 {
     std::vector<LAYER_PRESET> ret;
 
-    for( const auto& pair : m_layerPresets )
+    for( const std::pair<const wxString, LAYER_PRESET>& pair : m_layerPresets )
+    {
         if( !pair.second.readOnly )
             ret.emplace_back( pair.second );
+    }
 
     return ret;
 }
@@ -1981,7 +1992,7 @@ void APPEARANCE_CONTROLS::rebuildObjects()
                                                      wxDefaultPosition, wxDefaultSize,
                                                      wxSL_HORIZONTAL );
 #ifdef __WXMAC__
-                    slider->SetMinSize( wxSize( 80, 22 ) );
+                    slider->SetMinSize( wxSize( 80, 16 ) );
 #else
                     slider->SetMinSize( wxSize( 80, -1 ) );
 #endif
@@ -2013,7 +2024,9 @@ void APPEARANCE_CONTROLS::rebuildObjects()
 
                 aSetting->ctl_text = label;
                 m_objectsOuterSizer->Add( sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, 5 );
-                m_objectsOuterSizer->AddSpacer( 1 );
+
+                if( !aSetting->can_control_opacity )
+                    m_objectsOuterSizer->AddSpacer( 2 );
             };
 
     for( const APPEARANCE_SETTING& s_setting : s_objectSettings )
@@ -2035,7 +2048,7 @@ void APPEARANCE_CONTROLS::rebuildObjects()
 
             if( setting->can_control_opacity )
             {
-                int width = m_windowObjects->GetTextExtent( setting->label ).x;
+                int width = m_windowObjects->GetTextExtent( setting->label ).x + 5;
                 labelWidth = std::max( labelWidth, width );
             }
 
@@ -2134,9 +2147,10 @@ void APPEARANCE_CONTROLS::rebuildNets()
                 if( isDefaultClass )
                     setting->ctl_color->Hide();
 
-                setting->ctl_visibility =
-                        new BITMAP_TOGGLE( setting->ctl_panel, aId, KiBitmap( BITMAPS::visibility ),
-                                           KiBitmap( BITMAPS::visibility_off ), true );
+                setting->ctl_visibility = new BITMAP_TOGGLE( setting->ctl_panel, aId,
+                                                             KiBitmap( BITMAPS::visibility ),
+                                                             KiBitmap( BITMAPS::visibility_off ),
+                                                             true );
 
                 wxString tip;
                 tip.Printf( _( "Show or hide ratsnest for nets in %s" ), name );
diff --git a/pcbnew/widgets/appearance_controls_base.cpp b/pcbnew/widgets/appearance_controls_base.cpp
index ebab96b962..ca33b44ed4 100644
--- a/pcbnew/widgets/appearance_controls_base.cpp
+++ b/pcbnew/widgets/appearance_controls_base.cpp
@@ -14,7 +14,6 @@
 
 APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
 {
-	this->SetFont( wxFont( 10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
 	this->SetMinSize( wxSize( 200,360 ) );
 
 	m_sizerOuter = new wxBoxSizer( wxVERTICAL );
@@ -61,19 +60,17 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID
 
 	m_staticTextNets = new wxStaticText( m_panelNets, wxID_ANY, _("Nets"), wxDefaultPosition, wxDefaultSize, 0 );
 	m_staticTextNets->Wrap( -1 );
-	m_staticTextNets->SetFont( wxFont( 9, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
-
-	bSizer17->Add( m_staticTextNets, 1, wxALL, 5 );
+	bSizer17->Add( m_staticTextNets, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
 
 	m_txtNetFilter = new wxTextCtrl( m_panelNets, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
 	m_txtNetFilter->Hide();
 
-	bSizer17->Add( m_txtNetFilter, 1, wxLEFT|wxTOP, 5 );
+	bSizer17->Add( m_txtNetFilter, 1, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
 
 	m_btnNetInspector = new BITMAP_BUTTON( m_panelNets, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
 	m_btnNetInspector->SetToolTip( _("Show the Net Inspector") );
 
-	bSizer17->Add( m_btnNetInspector, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
+	bSizer17->Add( m_btnNetInspector, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
 
 
 	bSizer192->Add( bSizer17, 0, wxEXPAND, 5 );
@@ -118,16 +115,14 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID
 	wxBoxSizer* bSizer20;
 	bSizer20 = new wxBoxSizer( wxHORIZONTAL );
 
-	m_staticText14 = new wxStaticText( m_panelNetclasses, wxID_ANY, _("Net Classes"), wxDefaultPosition, wxDefaultSize, 0 );
-	m_staticText14->Wrap( -1 );
-	m_staticText14->SetFont( wxFont( 9, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
-
-	bSizer20->Add( m_staticText14, 1, wxALL, 5 );
+	m_staticTextNetClasses = new wxStaticText( m_panelNetclasses, wxID_ANY, _("Net Classes"), wxDefaultPosition, wxDefaultSize, 0 );
+	m_staticTextNetClasses->Wrap( -1 );
+	bSizer20->Add( m_staticTextNetClasses, 1, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
 
 	m_btnConfigureNetClasses = new BITMAP_BUTTON( m_panelNetclasses, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
 	m_btnConfigureNetClasses->SetToolTip( _("Configure net classes") );
 
-	bSizer20->Add( m_btnConfigureNetClasses, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP, 5 );
+	bSizer20->Add( m_btnConfigureNetClasses, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
 
 
 	bSizerNetClasses->Add( bSizer20, 0, wxEXPAND, 5 );
@@ -166,13 +161,13 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID
 	wxBoxSizer* bPresetsLabels;
 	bPresetsLabels = new wxBoxSizer( wxHORIZONTAL );
 
-	presetsLabel = new wxStaticText( this, wxID_ANY, _("Presets:"), wxDefaultPosition, wxDefaultSize, 0 );
-	presetsLabel->Wrap( -1 );
-	bPresetsLabels->Add( presetsLabel, 1, wxRIGHT|wxLEFT, 2 );
+	m_presetsLabel = new wxStaticText( this, wxID_ANY, _("Presets:"), wxDefaultPosition, wxDefaultSize, 0 );
+	m_presetsLabel->Wrap( -1 );
+	bPresetsLabels->Add( m_presetsLabel, 1, wxRIGHT|wxLEFT, 2 );
 
-	presetsHotkey = new wxStaticText( this, wxID_ANY, _("(Ctrl+Tab)"), wxDefaultPosition, wxDefaultSize, 0 );
-	presetsHotkey->Wrap( -1 );
-	bPresetsLabels->Add( presetsHotkey, 0, wxRIGHT|wxLEFT, 2 );
+	m_presetsHotkey = new wxStaticText( this, wxID_ANY, _("(Ctrl+Tab)"), wxDefaultPosition, wxDefaultSize, 0 );
+	m_presetsHotkey->Wrap( -1 );
+	bPresetsLabels->Add( m_presetsHotkey, 0, wxRIGHT|wxLEFT, 2 );
 
 
 	bPresets->Add( bPresetsLabels, 1, wxEXPAND|wxTOP, 7 );
diff --git a/pcbnew/widgets/appearance_controls_base.fbp b/pcbnew/widgets/appearance_controls_base.fbp
index bec2d28f69..7fb814384b 100644
--- a/pcbnew/widgets/appearance_controls_base.fbp
+++ b/pcbnew/widgets/appearance_controls_base.fbp
@@ -36,7 +36,7 @@
             <property name="enabled">1</property>
             <property name="event_handler">impl_virtual</property>
             <property name="fg"></property>
-            <property name="font">,90,90,10,70,0</property>
+            <property name="font"></property>
             <property name="hidden">0</property>
             <property name="id">wxID_ANY</property>
             <property name="maximum_size"></property>
@@ -490,7 +490,7 @@
                                             <property name="window_name"></property>
                                             <property name="window_style"></property>
                                             <object class="splitteritem" expanded="1">
-                                                <object class="wxPanel" expanded="0">
+                                                <object class="wxPanel" expanded="1">
                                                     <property name="BottomDockable">1</property>
                                                     <property name="LeftDockable">1</property>
                                                     <property name="RightDockable">1</property>
@@ -542,23 +542,23 @@
                                                     <property name="window_name"></property>
                                                     <property name="window_style">wxTAB_TRAVERSAL</property>
                                                     <event name="OnSetFocus">OnSetFocus</event>
-                                                    <object class="wxBoxSizer" expanded="0">
+                                                    <object class="wxBoxSizer" expanded="1">
                                                         <property name="minimum_size"></property>
                                                         <property name="name">bSizer192</property>
                                                         <property name="orient">wxVERTICAL</property>
                                                         <property name="permission">none</property>
-                                                        <object class="sizeritem" expanded="0">
+                                                        <object class="sizeritem" expanded="1">
                                                             <property name="border">5</property>
                                                             <property name="flag">wxEXPAND</property>
                                                             <property name="proportion">0</property>
-                                                            <object class="wxBoxSizer" expanded="0">
+                                                            <object class="wxBoxSizer" expanded="1">
                                                                 <property name="minimum_size"></property>
                                                                 <property name="name">bSizer17</property>
                                                                 <property name="orient">wxHORIZONTAL</property>
                                                                 <property name="permission">none</property>
                                                                 <object class="sizeritem" expanded="0">
                                                                     <property name="border">5</property>
-                                                                    <property name="flag">wxALL</property>
+                                                                    <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
                                                                     <property name="proportion">1</property>
                                                                     <object class="wxStaticText" expanded="0">
                                                                         <property name="BottomDockable">1</property>
@@ -584,7 +584,7 @@
                                                                         <property name="enabled">1</property>
                                                                         <property name="fg"></property>
                                                                         <property name="floatable">1</property>
-                                                                        <property name="font">,90,92,9,70,0</property>
+                                                                        <property name="font"></property>
                                                                         <property name="gripper">0</property>
                                                                         <property name="hidden">0</property>
                                                                         <property name="id">wxID_ANY</property>
@@ -619,7 +619,7 @@
                                                                 </object>
                                                                 <object class="sizeritem" expanded="0">
                                                                     <property name="border">5</property>
-                                                                    <property name="flag">wxLEFT|wxTOP</property>
+                                                                    <property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
                                                                     <property name="proportion">1</property>
                                                                     <object class="wxTextCtrl" expanded="0">
                                                                         <property name="BottomDockable">1</property>
@@ -683,7 +683,7 @@
                                                                 </object>
                                                                 <object class="sizeritem" expanded="0">
                                                                     <property name="border">5</property>
-                                                                    <property name="flag">wxLEFT|wxRIGHT|wxTOP</property>
+                                                                    <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
                                                                     <property name="proportion">0</property>
                                                                     <object class="CustomControl" expanded="0">
                                                                         <property name="BottomDockable">1</property>
@@ -909,7 +909,7 @@
                                                                 <property name="permission">none</property>
                                                                 <object class="sizeritem" expanded="0">
                                                                     <property name="border">5</property>
-                                                                    <property name="flag">wxALL</property>
+                                                                    <property name="flag">wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
                                                                     <property name="proportion">1</property>
                                                                     <object class="wxStaticText" expanded="0">
                                                                         <property name="BottomDockable">1</property>
@@ -935,7 +935,7 @@
                                                                         <property name="enabled">1</property>
                                                                         <property name="fg"></property>
                                                                         <property name="floatable">1</property>
-                                                                        <property name="font">,90,92,9,70,0</property>
+                                                                        <property name="font"></property>
                                                                         <property name="gripper">0</property>
                                                                         <property name="hidden">0</property>
                                                                         <property name="id">wxID_ANY</property>
@@ -948,7 +948,7 @@
                                                                         <property name="minimize_button">0</property>
                                                                         <property name="minimum_size"></property>
                                                                         <property name="moveable">1</property>
-                                                                        <property name="name">m_staticText14</property>
+                                                                        <property name="name">m_staticTextNetClasses</property>
                                                                         <property name="pane_border">1</property>
                                                                         <property name="pane_position"></property>
                                                                         <property name="pane_size"></property>
@@ -970,7 +970,7 @@
                                                                 </object>
                                                                 <object class="sizeritem" expanded="0">
                                                                     <property name="border">5</property>
-                                                                    <property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP</property>
+                                                                    <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
                                                                     <property name="proportion">0</property>
                                                                     <object class="CustomControl" expanded="0">
                                                                         <property name="BottomDockable">1</property>
@@ -1175,7 +1175,7 @@
                                                 <property name="minimize_button">0</property>
                                                 <property name="minimum_size"></property>
                                                 <property name="moveable">1</property>
-                                                <property name="name">presetsLabel</property>
+                                                <property name="name">m_presetsLabel</property>
                                                 <property name="pane_border">1</property>
                                                 <property name="pane_position"></property>
                                                 <property name="pane_size"></property>
@@ -1236,7 +1236,7 @@
                                                 <property name="minimize_button">0</property>
                                                 <property name="minimum_size"></property>
                                                 <property name="moveable">1</property>
-                                                <property name="name">presetsHotkey</property>
+                                                <property name="name">m_presetsHotkey</property>
                                                 <property name="pane_border">1</property>
                                                 <property name="pane_position"></property>
                                                 <property name="pane_size"></property>
diff --git a/pcbnew/widgets/appearance_controls_base.h b/pcbnew/widgets/appearance_controls_base.h
index 2e51f0b7d4..c98b1b3253 100644
--- a/pcbnew/widgets/appearance_controls_base.h
+++ b/pcbnew/widgets/appearance_controls_base.h
@@ -59,12 +59,12 @@ class APPEARANCE_CONTROLS_BASE : public wxPanel
 		BITMAP_BUTTON* m_btnNetInspector;
 		WX_GRID* m_netsGrid;
 		wxPanel* m_panelNetclasses;
-		wxStaticText* m_staticText14;
+		wxStaticText* m_staticTextNetClasses;
 		BITMAP_BUTTON* m_btnConfigureNetClasses;
 		wxScrolledWindow* m_netclassScrolledWindow;
 		wxBoxSizer* m_netclassOuterSizer;
-		wxStaticText* presetsLabel;
-		wxStaticText* presetsHotkey;
+		wxStaticText* m_presetsLabel;
+		wxStaticText* m_presetsHotkey;
 		wxChoice* m_cbLayerPresets;
 
 		// Virtual event handlers, overide them in your derived class
diff --git a/pcbnew/widgets/panel_selection_filter.cpp b/pcbnew/widgets/panel_selection_filter.cpp
index 3f4d868753..5f8360cc5e 100644
--- a/pcbnew/widgets/panel_selection_filter.cpp
+++ b/pcbnew/widgets/panel_selection_filter.cpp
@@ -29,7 +29,11 @@ PANEL_SELECTION_FILTER::PANEL_SELECTION_FILTER( wxWindow* aParent ) :
         m_frame( dynamic_cast<PCB_BASE_EDIT_FRAME*>( aParent ) ),
         m_onlyCheckbox( nullptr )
 {
-    wxFont font = KIUI::GetGUIFont( this, -2 );
+#ifdef __WXMAC__
+    wxFont font = KIUI::GetStatusFont( this );
+#else
+    wxFont font = KIUI::GetInfoFont( this );
+#endif
     m_cbLockedItems->SetFont( font );
     m_cbFootprints->SetFont( font );
     m_cbText->SetFont( font );