From 90d03c784c964d4adf62dffaf18500f90bac5713 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Mon, 8 Jul 2013 20:04:43 +0200 Subject: [PATCH] Dynamic font scaling for pads netnames. --- pcbnew/pcb_painter.cpp | 10 ++++++---- pcbnew/pcb_painter.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index d4221b49e6..9c08ee2251 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -374,12 +374,14 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer ) if( aLayer == ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE ) ) { size = VECTOR2D( aPad->GetSize() / 2 ); + double scale = m_gal->GetZoomFactor(); + double maxSize = PCB_RENDER_SETTINGS::MAX_FONT_SIZE / scale; // Font size limits - if( size.x > PCB_RENDER_SETTINGS::MAX_FONT_SIZE ) - size.x = PCB_RENDER_SETTINGS::MAX_FONT_SIZE; - if( size.y > PCB_RENDER_SETTINGS::MAX_FONT_SIZE ) - size.y = PCB_RENDER_SETTINGS::MAX_FONT_SIZE; + if( size.x > maxSize ) + size.x = maxSize; + if( size.y > maxSize ) + size.y = maxSize; // Keep the size ratio for the font, but make it smaller if( size.x < size.y ) diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h index a9ebbc830c..bc673661ad 100644 --- a/pcbnew/pcb_painter.h +++ b/pcbnew/pcb_painter.h @@ -105,7 +105,7 @@ protected: bool m_visibleLayers [NB_LAYERS]; bool m_visibleItems [END_PCB_VISIBLE_LIST]; - static const double MAX_FONT_SIZE = 1500000; + static const double MAX_FONT_SIZE = 100000000; DisplayZonesMode m_displayZoneMode; };