From fbd68722b23fce04fc5e6954ec96ea88925c4eb4 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 21 Apr 2020 21:17:01 +0100 Subject: [PATCH] Fix a couple of problems with text stroke thickness. --- common/base_units.cpp | 3 --- common/eda_text.cpp | 2 +- include/base_units.h | 20 +++++++++++++++----- pcbnew/plot_brditems_plotter.cpp | 2 ++ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/common/base_units.cpp b/common/base_units.cpp index 318cb9fe48..a83e56fd4e 100644 --- a/common/base_units.cpp +++ b/common/base_units.cpp @@ -34,15 +34,12 @@ * depending on the application. */ -#include #include #include #include // for KiROUND #include #include -#include "libeval/numeric_evaluator.h" - #if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA ) || defined( GERBVIEW ) || defined( PL_EDITOR ) #define IU_TO_MM( x ) ( x / IU_PER_MM ) diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 5808ab1b36..033ce019db 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -154,7 +154,7 @@ int EDA_TEXT::GetEffectiveTextPenWidth() const } // Clip pen size for small texts: - width = Clamp_Text_PenSize( width, GetTextSize(), IsBold() ); + width = Clamp_Text_PenSize( width, GetTextSize(), ALLOW_BOLD_THICKNESS ); return width; } diff --git a/include/base_units.h b/include/base_units.h index 281088657e..a075a7b8a3 100644 --- a/include/base_units.h +++ b/include/base_units.h @@ -48,6 +48,15 @@ #define INDETERMINATE wxString( "..." ) +// PCBNew doesn't support a bold style so we want to allow text thicknesses +// that achieve the same effect +#if defined( PCBNEW ) +#define ALLOW_BOLD_THICKNESS true +#else +#define ALLOW_BOLD_THICKNESS IsBold() +#endif + + /// Convert mm to mils. inline int Mm2mils( double x ) { return KiROUND( x * 1000./25.4 ); } @@ -139,8 +148,8 @@ wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, bool aUse * @param aUseMils Indicates mils should be used for imperial units (inches). * @return A wxString object containing value and optionally the symbol unit (like 2.000 mm) */ -wxString StringFromValue( - EDA_UNITS aUnit, double aValue, bool aAddUnitSymbol = false, bool aUseMils = false ); +wxString StringFromValue( EDA_UNITS aUnit, double aValue, bool aAddUnitSymbol = false, + bool aUseMils = false ); /** * Return in internal units the value "val" given in a real unit @@ -157,7 +166,8 @@ double From_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils = false ); * @param aUseMils Indicates mils should be used for imperial units (inches). * @return A double representing that value in internal units */ -double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils = false ); +double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, + bool aUseMils = false ); /** * Function ValueFromString @@ -168,8 +178,8 @@ double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool * @param aUseMils Indicates mils should be used for imperial units (inches). * @return The string from Value, according to units (inch, mm ...) for display, */ -long long int ValueFromString( - EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils = false ); +long long int ValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, + bool aUseMils = false ); /** * Function FetchUnitsFromString diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index b4832ebc23..1ffd4ea24f 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -667,6 +667,8 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte ) // So we set bold flag to true bool allow_bold = pt_texte->IsBold() || thickness; + m_plotter->SetCurrentLineWidth( thickness ); + if( pt_texte->IsMultilineAllowed() ) { std::vector positions;