Fix a couple of problems with text stroke thickness.

This commit is contained in:
Jeff Young 2020-04-21 21:17:01 +01:00
parent da7205ff32
commit fbd68722b2
4 changed files with 18 additions and 9 deletions

View File

@ -34,15 +34,12 @@
* depending on the application. * depending on the application.
*/ */
#include <base_struct.h>
#include <base_units.h> #include <base_units.h>
#include <common.h> #include <common.h>
#include <math/util.h> // for KiROUND #include <math/util.h> // for KiROUND
#include <macros.h> #include <macros.h>
#include <title_block.h> #include <title_block.h>
#include "libeval/numeric_evaluator.h"
#if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA ) || defined( GERBVIEW ) || defined( PL_EDITOR ) #if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA ) || defined( GERBVIEW ) || defined( PL_EDITOR )
#define IU_TO_MM( x ) ( x / IU_PER_MM ) #define IU_TO_MM( x ) ( x / IU_PER_MM )

View File

@ -154,7 +154,7 @@ int EDA_TEXT::GetEffectiveTextPenWidth() const
} }
// Clip pen size for small texts: // Clip pen size for small texts:
width = Clamp_Text_PenSize( width, GetTextSize(), IsBold() ); width = Clamp_Text_PenSize( width, GetTextSize(), ALLOW_BOLD_THICKNESS );
return width; return width;
} }

View File

@ -48,6 +48,15 @@
#define INDETERMINATE wxString( "..." ) #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. /// Convert mm to mils.
inline int Mm2mils( double x ) { return KiROUND( x * 1000./25.4 ); } 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). * @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) * @return A wxString object containing value and optionally the symbol unit (like 2.000 mm)
*/ */
wxString StringFromValue( wxString StringFromValue( EDA_UNITS aUnit, double aValue, bool aAddUnitSymbol = false,
EDA_UNITS aUnit, double aValue, bool aAddUnitSymbol = false, bool aUseMils = false ); bool aUseMils = false );
/** /**
* Return in internal units the value "val" given in a real unit * 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). * @param aUseMils Indicates mils should be used for imperial units (inches).
* @return A double representing that value in internal units * @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 * 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). * @param aUseMils Indicates mils should be used for imperial units (inches).
* @return The string from Value, according to units (inch, mm ...) for display, * @return The string from Value, according to units (inch, mm ...) for display,
*/ */
long long int ValueFromString( long long int ValueFromString( EDA_UNITS aUnits, const wxString& aTextValue,
EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils = false ); bool aUseMils = false );
/** /**
* Function FetchUnitsFromString * Function FetchUnitsFromString

View File

@ -667,6 +667,8 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte )
// So we set bold flag to true // So we set bold flag to true
bool allow_bold = pt_texte->IsBold() || thickness; bool allow_bold = pt_texte->IsBold() || thickness;
m_plotter->SetCurrentLineWidth( thickness );
if( pt_texte->IsMultilineAllowed() ) if( pt_texte->IsMultilineAllowed() )
{ {
std::vector<wxPoint> positions; std::vector<wxPoint> positions;