Rationalize penWidth processing as first step in removing some globals.

This commit is contained in:
Jeff Young 2020-04-13 20:55:27 +01:00
parent d014dc47ab
commit 6e800bddae
53 changed files with 261 additions and 425 deletions

View File

@ -93,11 +93,13 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const TEXTE_PCB* aText,
s_boardItem = (const BOARD_ITEM *) &aText; s_boardItem = (const BOARD_ITEM *) &aText;
s_dstcontainer = aDstContainer; s_dstcontainer = aDstContainer;
s_textWidth = aText->GetThickness() + ( 2 * aClearanceValue ); s_textWidth = aText->GetEffectiveTextPenWidth( nullptr ) + ( 2 * aClearanceValue );
s_biuTo3Dunits = m_biuTo3Dunits; s_biuTo3Dunits = m_biuTo3Dunits;
// not actually used, but needed by GRText // not actually used, but needed by GRText
const COLOR4D dummy_color = COLOR4D::BLACK; const COLOR4D dummy_color = COLOR4D::BLACK;
bool forceBold = true;
int penWidth = 0; // force max width for bold
if( aText->IsMultilineAllowed() ) if( aText->IsMultilineAllowed() )
{ {
@ -111,16 +113,16 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const TEXTE_PCB* aText,
{ {
wxString txt = strings_list.Item( ii ); wxString txt = strings_list.Item( ii );
GRText( NULL, positions[ii], dummy_color, txt, aText->GetTextAngle(), size, GRText( nullptr, positions[ii], dummy_color, txt, aText->GetTextAngle(), size,
aText->GetHorizJustify(), aText->GetVertJustify(), aText->GetThickness(), aText->GetHorizJustify(), aText->GetVertJustify(), penWidth, aText->IsItalic(),
aText->IsItalic(), true, addTextSegmToContainer ); penWidth, addTextSegmToContainer );
} }
} }
else else
{ {
GRText( NULL, aText->GetTextPos(), dummy_color, aText->GetShownText(), GRText( nullptr, aText->GetTextPos(), dummy_color, aText->GetShownText(),
aText->GetTextAngle(), size, aText->GetHorizJustify(), aText->GetVertJustify(), aText->GetTextAngle(), size, aText->GetHorizJustify(), aText->GetVertJustify(),
aText->GetThickness(), aText->IsItalic(), true, addTextSegmToContainer ); penWidth, aText->IsItalic(), penWidth, addTextSegmToContainer );
} }
} }
@ -215,15 +217,17 @@ void BOARD_ADAPTER::AddGraphicsShapesWithClearanceToContainer( const MODULE* aMo
for( TEXTE_MODULE* text : texts ) for( TEXTE_MODULE* text : texts )
{ {
s_textWidth = text->GetThickness() + ( 2 * aInflateValue ); s_textWidth = text->GetEffectiveTextPenWidth( nullptr ) + ( 2 * aInflateValue );
wxSize size = text->GetTextSize(); wxSize size = text->GetTextSize();
bool forceBold = true;
int penWidth = 0; // force max width for bold
if( text->IsMirrored() ) if( text->IsMirrored() )
size.x = -size.x; size.x = -size.x;
GRText( NULL, text->GetTextPos(), BLACK, text->GetShownText(), text->GetDrawRotation(), GRText( NULL, text->GetTextPos(), BLACK, text->GetShownText(), text->GetDrawRotation(),
size, text->GetHorizJustify(), text->GetVertJustify(), text->GetThickness(), size, text->GetHorizJustify(), text->GetVertJustify(), penWidth, text->IsItalic(),
text->IsItalic(), true, addTextSegmToContainer ); forceBold, addTextSegmToContainer );
} }
} }

View File

@ -141,6 +141,23 @@ void EDA_TEXT::SwapEffects( EDA_TEXT& aTradingPartner )
} }
int EDA_TEXT::GetEffectiveTextPenWidth( RENDER_SETTINGS* aSettings ) const
{
int width = GetTextPenWidth();
if( width == 0 && IsBold() )
width = GetPenSizeForBold( GetTextWidth() );
if( width <= 0 && aSettings )
width = aSettings->GetDefaultPenWidth();
// Clip pen size for small texts:
width = Clamp_Text_PenSize( width, GetTextSize(), IsBold() );
return width;
}
bool EDA_TEXT::Replace( wxFindReplaceData& aSearchData ) bool EDA_TEXT::Replace( wxFindReplaceData& aSearchData )
{ {
return EDA_ITEM::Replace( aSearchData, m_text ); return EDA_ITEM::Replace( aSearchData, m_text );
@ -181,14 +198,15 @@ int EDA_TEXT::GetInterline() const
} }
EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY, int aMarkupFlags ) const EDA_RECT EDA_TEXT::GetTextBox( RENDER_SETTINGS* aSettings, int aLine, bool aInvertY ) const
{ {
EDA_RECT rect; EDA_RECT rect;
wxArrayString strings; wxArrayString strings;
wxString text = GetShownText(); wxString text = GetShownText();
int thickness = ( aThickness < 0 ) ? GetThickness() : aThickness; int thickness = GetEffectiveTextPenWidth( aSettings );
int linecount = 1; int linecount = 1;
bool hasOverBar = false; // true if the first line of text as an overbar bool hasOverBar = false; // true if the first line of text as an overbar
int markupFlags = aSettings ? aSettings->GetTextMarkupFlags() : 0;
if( IsMultilineAllowed() ) if( IsMultilineAllowed() )
{ {
@ -220,7 +238,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY, int aMa
const auto& font = basic_gal.GetStrokeFont(); const auto& font = basic_gal.GetStrokeFont();
VECTOR2D size( GetTextSize() ); VECTOR2D size( GetTextSize() );
double penWidth( thickness ); double penWidth( thickness );
int dx = KiROUND( font.ComputeStringBoundaryLimits( text, size, penWidth, aMarkupFlags ).x ); int dx = KiROUND( font.ComputeStringBoundaryLimits( text, size, penWidth, markupFlags ).x );
int dy = GetInterline(); int dy = GetInterline();
// Creates bounding box (rectangle) for an horizontal // Creates bounding box (rectangle) for an horizontal
@ -258,7 +276,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY, int aMa
for( unsigned ii = 1; ii < strings.GetCount(); ii++ ) for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
{ {
text = strings.Item( ii ); text = strings.Item( ii );
dx = KiROUND( font.ComputeStringBoundaryLimits( text, size, penWidth, aMarkupFlags ).x ); dx = KiROUND( font.ComputeStringBoundaryLimits( text, size, penWidth, markupFlags ).x );
textsize.x = std::max( textsize.x, dx ); textsize.x = std::max( textsize.x, dx );
textsize.y += dy; textsize.y += dy;
} }
@ -335,7 +353,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY, int aMa
bool EDA_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const bool EDA_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
{ {
EDA_RECT rect = GetTextBox( -1 ); // Get the full text area. EDA_RECT rect = GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
wxPoint location = aPoint; wxPoint location = aPoint;
rect.Inflate( aAccuracy ); rect.Inflate( aAccuracy );
@ -352,9 +370,9 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
rect.Inflate( aAccuracy ); rect.Inflate( aAccuracy );
if( aContains ) if( aContains )
return rect.Contains( GetTextBox( -1 ) ); return rect.Contains( GetTextBox( nullptr ) ); // JEY TODO: requires RENDER_SETTINGS
return rect.Intersects( GetTextBox( -1 ), GetTextAngle() ); return rect.Intersects( GetTextBox( nullptr ), GetTextAngle() ); // JEY TODO: requires RENDER_SETTINGS
} }
@ -427,7 +445,7 @@ void EDA_TEXT::printOneLineOfText( wxDC* aDC, const wxPoint& aOffset, COLOR4D aC
EDA_DRAW_MODE_T aFillMode, const wxString& aText, EDA_DRAW_MODE_T aFillMode, const wxString& aText,
const wxPoint &aPos ) const wxPoint &aPos )
{ {
int width = GetThickness(); int width = GetEffectiveTextPenWidth( nullptr );
if( aFillMode == SKETCH ) if( aFillMode == SKETCH )
width = -width; width = -width;
@ -469,7 +487,7 @@ bool EDA_TEXT::IsDefaultFormatting() const
&& !IsMirrored() && !IsMirrored()
&& GetHorizJustify() == GR_TEXT_HJUSTIFY_CENTER && GetHorizJustify() == GR_TEXT_HJUSTIFY_CENTER
&& GetVertJustify() == GR_TEXT_VJUSTIFY_CENTER && GetVertJustify() == GR_TEXT_VJUSTIFY_CENTER
&& GetThickness() == 0 && GetTextPenWidth() == 0
&& !IsItalic() && !IsItalic()
&& !IsBold() && !IsBold()
&& !IsMultilineAllowed() && !IsMultilineAllowed()
@ -492,8 +510,8 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
FormatInternalUnits( GetTextHeight() ).c_str(), FormatInternalUnits( GetTextHeight() ).c_str(),
FormatInternalUnits( GetTextWidth() ).c_str() ); FormatInternalUnits( GetTextWidth() ).c_str() );
if( GetThickness() ) if( GetTextPenWidth() )
aFormatter->Print( 0, " (thickness %s)", FormatInternalUnits( GetThickness() ).c_str() ); aFormatter->Print( 0, " (thickness %s)", FormatInternalUnits( GetTextPenWidth() ).c_str() );
if( IsBold() ) if( IsBold() )
aFormatter->Print( 0, " bold" ); aFormatter->Print( 0, " bold" );
@ -548,6 +566,9 @@ void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuf
if( IsMirrored() ) if( IsMirrored() )
size.x = -size.x; size.x = -size.x;
bool forceBold = true;
int penWidth = 0; // use max-width for bold text
COLOR4D color = COLOR4D::BLACK; // not actually used, but needed by GRText COLOR4D color = COLOR4D::BLACK; // not actually used, but needed by GRText
if( IsMultilineAllowed() ) if( IsMultilineAllowed() )
@ -562,14 +583,14 @@ void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuf
{ {
wxString txt = strings_list.Item( ii ); wxString txt = strings_list.Item( ii );
GRText( NULL, positions[ii], color, txt, GetTextAngle(), size, GetHorizJustify(), GRText( NULL, positions[ii], color, txt, GetTextAngle(), size, GetHorizJustify(),
GetVertJustify(), GetThickness(), IsItalic(), true, addTextSegmToBuffer, GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToBuffer,
&aCornerBuffer ); &aCornerBuffer );
} }
} }
else else
{ {
GRText( NULL, GetTextPos(), color, GetText(), GetTextAngle(), size, GetHorizJustify(), GRText( NULL, GetTextPos(), color, GetText(), GetTextAngle(), size, GetHorizJustify(),
GetVertJustify(), GetThickness(), IsItalic(), true, addTextSegmToBuffer, GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToBuffer,
&aCornerBuffer ); &aCornerBuffer );
} }
} }

View File

@ -220,9 +220,7 @@ void GRHaloText( wxDC * aDC, const wxPoint &aPos, const COLOR4D aBgColor, COLOR4
* @param aSize = text size (size.x or size.y can be < 0 for mirrored texts) * @param aSize = text size (size.x or size.y can be < 0 for mirrored texts)
* @param aH_justify = horizontal justification (Left, center, right) * @param aH_justify = horizontal justification (Left, center, right)
* @param aV_justify = vertical justification (bottom, center, top) * @param aV_justify = vertical justification (bottom, center, top)
* @param aWidth = line width (pen width) (default = 0) * @param aPenWidth = line width (if = 0, use plot default line width)
* if width < 0 : draw segments in sketch mode, width = abs(width)
* Use a value min(aSize.x, aSize.y) / 5 for a bold text
* @param aItalic = true to simulate an italic font * @param aItalic = true to simulate an italic font
* @param aBold = true to use a bold font Useful only with default width value (aWidth = 0) * @param aBold = true to use a bold font Useful only with default width value (aWidth = 0)
* @param aMultilineAllowed = true to plot text as multiline, otherwise single line * @param aMultilineAllowed = true to plot text as multiline, otherwise single line
@ -236,29 +234,14 @@ void PLOTTER::Text( const wxPoint& aPos,
const wxSize& aSize, const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
int aWidth, int aPenWidth,
bool aItalic, bool aItalic,
bool aBold, bool aBold,
bool aMultilineAllowed, bool aMultilineAllowed,
void* aData ) void* aData )
{ {
int textPensize = aWidth;
if( textPensize == 0 && aBold ) // Use default values if aWidth == 0
textPensize = GetPenSizeForBold( std::min( aSize.x, aSize.y ) );
if( textPensize >= 0 )
textPensize = Clamp_Text_PenSize( aWidth, aSize, aBold );
else
textPensize = -Clamp_Text_PenSize( -aWidth, aSize, aBold );
SetCurrentLineWidth( textPensize, aData );
SetColor( aColor ); SetColor( aColor );
GRText( NULL, aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, textPensize, GRText( NULL, aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aPenWidth,
aItalic, aBold, nullptr, nullptr, this ); aItalic, aBold, nullptr, nullptr, this );
if( aWidth != textPensize )
SetCurrentLineWidth( aWidth, aData );
} }

View File

@ -714,7 +714,7 @@ void WS_DATA_ITEM_TEXT::SetConstrainedTextSize()
dummy.SetVertJustify( m_Vjustify ); dummy.SetVertJustify( m_Vjustify );
dummy.SetTextAngle( m_Orient * 10 ); dummy.SetTextAngle( m_Orient * 10 );
EDA_RECT rect = dummy.GetTextBox(); EDA_RECT rect = dummy.GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
DSIZE size; DSIZE size;
size.x = rect.GetWidth() / FSCALE; size.x = rect.GetWidth() / FSCALE;
size.y = rect.GetHeight() / FSCALE; size.y = rect.GetHeight() / FSCALE;

View File

@ -163,7 +163,7 @@ void WS_DRAW_ITEM_TEXT::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D
const EDA_RECT WS_DRAW_ITEM_TEXT::GetBoundingBox() const const EDA_RECT WS_DRAW_ITEM_TEXT::GetBoundingBox() const
{ {
return EDA_TEXT::GetTextBox( -1 ); return EDA_TEXT::GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
} }

View File

@ -289,7 +289,7 @@ void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_TEXT* aItem, int aLayer ) const
m_gal->Translate( position ); m_gal->Translate( position );
m_gal->Rotate( -aItem->GetTextAngle() * M_PI / 1800.0 ); m_gal->Rotate( -aItem->GetTextAngle() * M_PI / 1800.0 );
m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) ); m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) );
m_gal->SetLineWidth( aItem->GetThickness() ); m_gal->SetLineWidth( aItem->GetEffectiveTextPenWidth( nullptr ) ); // JEY TODO: requires RENDER_SETTINGS
m_gal->SetTextAttributes( aItem ); m_gal->SetTextAttributes( aItem );
m_gal->SetIsFill( false ); m_gal->SetIsFill( false );
m_gal->SetIsStroke( true ); m_gal->SetIsStroke( true );

View File

@ -34,7 +34,6 @@ RENDER_SETTINGS::RENDER_SETTINGS()
// Set the default initial values // Set the default initial values
m_highlightFactor = 0.5f; m_highlightFactor = 0.5f;
m_selectFactor = 0.5f; m_selectFactor = 0.5f;
m_layerOpacity = 0.8f;
m_highlightItems = false; m_highlightItems = false;
m_highlightEnabled = false; m_highlightEnabled = false;
m_hiContrastEnabled = false; m_hiContrastEnabled = false;
@ -42,6 +41,8 @@ RENDER_SETTINGS::RENDER_SETTINGS()
m_highlightNetcode = -1; m_highlightNetcode = -1;
m_outlineWidth = 1; m_outlineWidth = 1;
m_worksheetLineWidth = 100000; m_worksheetLineWidth = 100000;
m_defaultPenWidth = 0;
m_textMarkupFlags = 0;
m_showPageLimits = false; m_showPageLimits = false;
} }

View File

@ -116,8 +116,8 @@ void PlotWorkSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BLOCK
plotter->Text( text->GetTextPos(), plotColor, text->GetShownText(), plotter->Text( text->GetTextPos(), plotColor, text->GetShownText(),
text->GetTextAngle(), text->GetTextSize(), text->GetTextAngle(), text->GetTextSize(),
text->GetHorizJustify(), text->GetVertJustify(), text->GetHorizJustify(), text->GetVertJustify(),
text->GetPenWidth(), text->IsItalic(), text->IsBold(), text->GetEffectiveTextPenWidth( nullptr ),
text->IsMultilineAllowed() ); text->IsItalic(), text->IsBold(), text->IsMultilineAllowed() );
} }
break; break;

View File

@ -460,12 +460,12 @@ bool DIALOG_LABEL_EDITOR::TransferDataFromWindow()
if( ( style & 2 ) ) if( ( style & 2 ) )
{ {
m_CurrentText->SetBold( true ); m_CurrentText->SetBold( true );
m_CurrentText->SetThickness( GetPenSizeForBold( m_CurrentText->GetTextWidth() ) ); m_CurrentText->SetTextPenWidth( GetPenSizeForBold( m_CurrentText->GetTextWidth() ) );
} }
else else
{ {
m_CurrentText->SetBold( false ); m_CurrentText->SetBold( false );
m_CurrentText->SetThickness( 0 ); m_CurrentText->SetTextPenWidth( 0 ); // Use default pen width
} }
m_Parent->RefreshItem( m_CurrentText ); m_Parent->RefreshItem( m_CurrentText );

View File

@ -234,7 +234,7 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* aText, KICAD_T aNewType )
newtext->SetShape( aText->GetShape() ); newtext->SetShape( aText->GetShape() );
newtext->SetLabelSpinStyle( orientation ); newtext->SetLabelSpinStyle( orientation );
newtext->SetTextSize( aText->GetTextSize() ); newtext->SetTextSize( aText->GetTextSize() );
newtext->SetThickness( aText->GetThickness() ); newtext->SetTextPenWidth( aText->GetTextPenWidth() );
newtext->SetItalic( aText->IsItalic() ); newtext->SetItalic( aText->IsItalic() );
newtext->SetBold( aText->IsBold() ); newtext->SetBold( aText->IsBold() );
newtext->SetIsDangling( aText->IsDangling() ); newtext->SetIsDangling( aText->IsDangling() );

View File

@ -101,15 +101,7 @@ void LIB_FIELD::Init( int id )
int LIB_FIELD::GetPenSize() const int LIB_FIELD::GetPenSize() const
{ {
int pensize = GetThickness(); return GetEffectiveTextPenWidth( nullptr ); // JEY TODO: requires RENDER_SETTINGS
if( pensize == 0 && IsBold() )
pensize = GetPenSizeForBold( GetTextWidth() );
// Clip pen size for small texts:
pensize = Clamp_Text_PenSize( pensize, GetTextSize(), IsBold() );
return pensize;
} }
@ -325,7 +317,7 @@ const EDA_RECT LIB_FIELD::GetBoundingBox() const
/* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when /* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
* calling GetTextBox() that works using top to bottom Y axis orientation. * calling GetTextBox() that works using top to bottom Y axis orientation.
*/ */
EDA_RECT rect = GetTextBox( -1, -1, true, GetTextMarkupFlags() ); EDA_RECT rect = GetTextBox( nullptr, -1, true ); // JEY TODO: requires RENDER_SETTINGS
rect.RevertYAxis(); rect.RevertYAxis();
// We are using now a bottom to top Y axis. // We are using now a bottom to top Y axis.

View File

@ -190,8 +190,8 @@ public:
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) override; const TRANSFORM& aTransform ) override;
int GetWidth() const override { return GetThickness(); } int GetWidth() const override { return GetTextPenWidth(); }
void SetWidth( int aWidth ) override { SetThickness( aWidth ); } void SetWidth( int aWidth ) override { SetTextPenWidth( aWidth ); }
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;

View File

@ -143,7 +143,7 @@ void LIB_TEXT::MoveTo( const wxPoint& newPosition )
void LIB_TEXT::NormalizeJustification( bool inverse ) void LIB_TEXT::NormalizeJustification( bool inverse )
{ {
wxPoint delta( 0, 0 ); wxPoint delta( 0, 0 );
EDA_RECT bbox = GetTextBox( -1 ); EDA_RECT bbox = GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
if( GetTextAngle() == 0.0 ) if( GetTextAngle() == 0.0 )
{ {
@ -300,15 +300,7 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
int LIB_TEXT::GetPenSize() const int LIB_TEXT::GetPenSize() const
{ {
int pensize = GetThickness(); return GetEffectiveTextPenWidth( nullptr ); // JEY TODO: requires RENDER_SETTINGS
if( pensize == 0 && IsBold() )
pensize = GetPenSizeForBold( GetTextWidth() );
// Clip pen size for small texts:
pensize = Clamp_Text_PenSize( pensize, GetTextSize(), IsBold() );
return pensize;
} }
@ -319,7 +311,7 @@ void LIB_TEXT::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRAN
/* Calculate the text orientation, according to the component /* Calculate the text orientation, according to the component
* orientation/mirror (needed when draw text in schematic) * orientation/mirror (needed when draw text in schematic)
*/ */
int orient = GetTextAngle(); int orient = (int) GetTextAngle();
if( aTransform.y1 ) // Rotate component 90 degrees. if( aTransform.y1 ) // Rotate component 90 degrees.
{ {
@ -350,7 +342,7 @@ void LIB_TEXT::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRAN
txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset; txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
GRText( aDC, txtpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_HJUSTIFY_CENTER, GRText( aDC, txtpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_CENTER, GetPenSize(), IsItalic(), IsBold() ); GR_TEXT_VJUSTIFY_CENTER, GetEffectiveTextPenWidth( nullptr ), IsItalic(), IsBold() );
} }
@ -358,7 +350,7 @@ void LIB_TEXT::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{ {
LIB_ITEM::GetMsgPanelInfo( aUnits, aList ); LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
wxString msg = MessageTextFromValue( aUnits, GetThickness(), true ); wxString msg = MessageTextFromValue( aUnits, GetTextPenWidth(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
} }
@ -368,7 +360,7 @@ const EDA_RECT LIB_TEXT::GetBoundingBox() const
/* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when /* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
* calling GetTextBox() that works using top to bottom Y axis orientation. * calling GetTextBox() that works using top to bottom Y axis orientation.
*/ */
EDA_RECT rect = GetTextBox( -1, -1, true, GetTextMarkupFlags() ); EDA_RECT rect = GetTextBox( nullptr, -1, true ); // JEY TODO: requires RENDER_SETTINGS
rect.RevertYAxis(); rect.RevertYAxis();
// We are using now a bottom to top Y axis. // We are using now a bottom to top Y axis.

View File

@ -94,8 +94,8 @@ public:
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) override; const TRANSFORM& aTransform ) override;
int GetWidth() const override { return GetThickness(); } int GetWidth() const override { return GetTextPenWidth(); }
void SetWidth( int aWidth ) override { SetThickness( aWidth ); } void SetWidth( int aWidth ) override { SetTextPenWidth( aWidth ); }
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;

View File

@ -1839,7 +1839,7 @@ void SCH_EAGLE_PLUGIN::loadTextAttributes( EDA_TEXT* aText, const ETEXT& aAttrib
if( aAttribs.ratio.CGet() > 12 ) if( aAttribs.ratio.CGet() > 12 )
{ {
aText->SetBold( true ); aText->SetBold( true );
aText->SetThickness( GetPenSizeForBold( aText->GetTextWidth() ) ); aText->SetTextPenWidth( GetPenSizeForBold( aText->GetTextWidth() ) );
} }
} }

View File

@ -131,15 +131,7 @@ wxString SCH_FIELD::GetShownText( int aDepth ) const
int SCH_FIELD::GetPenSize() const int SCH_FIELD::GetPenSize() const
{ {
int pensize = GetThickness(); return GetEffectiveTextPenWidth( nullptr ); // JEY TODO: requires RENDER_SETTINGS
if( pensize == 0 && IsBold() )
pensize = GetPenSizeForBold( GetTextWidth() );
// Clip pen size for small texts:
pensize = Clamp_Text_PenSize( pensize, GetTextSize(), IsBold() );
return pensize;
} }
@ -214,15 +206,12 @@ void SCH_FIELD::SwapData( SCH_ITEM* aItem )
const EDA_RECT SCH_FIELD::GetBoundingBox() const const EDA_RECT SCH_FIELD::GetBoundingBox() const
{ {
// Use the maximum clamped pen width to give us a bit of wiggle room
int linewidth = Clamp_Text_PenSize( GetTextSize().x, GetTextSize(), IsBold() );
// Calculate the text bounding box: // Calculate the text bounding box:
EDA_RECT rect; EDA_RECT rect;
SCH_FIELD text( *this ); // Make a local copy to change text SCH_FIELD text( *this ); // Make a local copy to change text
// because GetBoundingBox() is const // because GetBoundingBox() is const
text.SetText( GetShownText() ); text.SetText( GetShownText() );
rect = text.GetTextBox( -1, linewidth, false, GetTextMarkupFlags() ); rect = text.GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
// Calculate the bounding box position relative to the parent: // Calculate the bounding box position relative to the parent:
wxPoint origin = GetParentPosition(); wxPoint origin = GetParentPosition();

View File

@ -1427,7 +1427,7 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( LINE_READER& aReader )
SCH_PARSE_ERROR( "invalid label type", aReader, line ); SCH_PARSE_ERROR( "invalid label type", aReader, line );
} }
int thickness = 0; int penWidth = 0;
// The following tokens do not exist in version 1 schematic files, // The following tokens do not exist in version 1 schematic files,
// and not always in version 2 for HLabels and GLabels // and not always in version 2 for HLabels and GLabels
@ -1441,14 +1441,14 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( LINE_READER& aReader )
SCH_PARSE_ERROR( _( "expected 'Italics' or '~'" ), aReader, line ); SCH_PARSE_ERROR( _( "expected 'Italics' or '~'" ), aReader, line );
} }
// The thickness token does not exist in older versions of the schematic file format // The penWidth token does not exist in older versions of the schematic file format
// so calling parseInt will be made only if the EOL is not reached. // so calling parseInt will be made only if the EOL is not reached.
if( *line >= ' ' ) if( *line >= ' ' )
thickness = parseInt( aReader, line, &line ); penWidth = parseInt( aReader, line, &line );
} }
text->SetBold( thickness != 0 ); text->SetBold( penWidth != 0 );
text->SetThickness( thickness != 0 ? GetPenSizeForBold( size ) : 0 ); text->SetTextPenWidth( penWidth != 0 ? GetPenSizeForBold( size ) : 0 );
// Read the text string for the text. // Read the text string for the text.
char* tmp = aReader.ReadLine(); char* tmp = aReader.ReadLine();
@ -2357,7 +2357,7 @@ void SCH_LEGACY_PLUGIN::saveText( SCH_TEXT* aText )
Iu2Mils( aText->GetPosition().x ), Iu2Mils( aText->GetPosition().y ), Iu2Mils( aText->GetPosition().x ), Iu2Mils( aText->GetPosition().y ),
spinStyle, spinStyle,
Iu2Mils( aText->GetTextWidth() ), Iu2Mils( aText->GetTextWidth() ),
italics, Iu2Mils( aText->GetThickness() ), TO_UTF8( text ) ); italics, Iu2Mils( aText->GetTextPenWidth() ), TO_UTF8( text ) );
} }
else if( layer == LAYER_GLOBLABEL || layer == LAYER_HIERLABEL ) else if( layer == LAYER_GLOBLABEL || layer == LAYER_HIERLABEL )
{ {
@ -2372,7 +2372,7 @@ void SCH_LEGACY_PLUGIN::saveText( SCH_TEXT* aText )
Iu2Mils( aText->GetTextWidth() ), Iu2Mils( aText->GetTextWidth() ),
shapeLabelIt->second, shapeLabelIt->second,
italics, italics,
Iu2Mils( aText->GetThickness() ), TO_UTF8( text ) ); Iu2Mils( aText->GetTextPenWidth() ), TO_UTF8( text ) );
} }
} }

View File

@ -331,10 +331,7 @@ float SCH_PAINTER::getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows )
float SCH_PAINTER::getTextThickness( const SCH_TEXT* aItem, bool aDrawingShadows ) float SCH_PAINTER::getTextThickness( const SCH_TEXT* aItem, bool aDrawingShadows )
{ {
float width = (float) aItem->GetThickness(); float width = (float) aItem->GetEffectiveTextPenWidth( &m_schSettings );
if( width == 0 )
width = (float) m_schSettings.m_DefaultLineWidth;
if( aItem->IsSelected() && aDrawingShadows ) if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth(); width += getShadowWidth();

View File

@ -535,7 +535,7 @@ void SCH_SEXPR_PARSER::parseEDA_TEXT( EDA_TEXT* aText )
} }
case T_thickness: case T_thickness:
aText->SetThickness( parseInternalUnits( "text thickness" ) ); aText->SetTextPenWidth( parseInternalUnits( "text thickness" ) );
NeedRIGHT(); NeedRIGHT();
break; break;

View File

@ -282,30 +282,16 @@ bool SCH_TEXT::operator<( const SCH_ITEM& aItem ) const
int SCH_TEXT::GetPenSize() const int SCH_TEXT::GetPenSize() const
{ {
int pensize = GetThickness(); return GetEffectiveTextPenWidth( nullptr ); // JEY TODO: requires RENDER_SETTINGS
if( pensize == 0 && IsBold() )
pensize = GetPenSizeForBold( GetTextWidth() );
// Clip pen size for small texts:
pensize = Clamp_Text_PenSize( pensize, GetTextSize(), IsBold() );
return pensize;
} }
void SCH_TEXT::Print( wxDC* DC, const wxPoint& aOffset ) void SCH_TEXT::Print( wxDC* DC, const wxPoint& aOffset )
{ {
COLOR4D color = GetLayerColor( m_Layer ); COLOR4D color = GetLayerColor( m_Layer );
int linewidth = GetPenSize();
wxPoint text_offset = aOffset + GetSchematicTextOffset(); wxPoint text_offset = aOffset + GetSchematicTextOffset();
int savedWidth = GetThickness();
SetThickness( linewidth ); // Set the minimum width
EDA_TEXT::Print( DC, text_offset, color ); EDA_TEXT::Print( DC, text_offset, color );
SetThickness( savedWidth );
} }
@ -415,10 +401,7 @@ void SCH_TEXT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
const EDA_RECT SCH_TEXT::GetBoundingBox() const const EDA_RECT SCH_TEXT::GetBoundingBox() const
{ {
// Use the maximum clamped pen width to give us a bit of wiggle room EDA_RECT rect = GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
int linewidth = Clamp_Text_PenSize( GetTextSize().x, GetTextSize(), IsBold() );
EDA_RECT rect = GetTextBox( -1, linewidth, false, GetTextMarkupFlags() );
if( GetTextAngle() != 0 ) // Rotate rect if( GetTextAngle() != 0 ) // Rotate rect
{ {
@ -586,15 +569,10 @@ bool SCH_TEXT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
void SCH_TEXT::Plot( PLOTTER* aPlotter ) void SCH_TEXT::Plot( PLOTTER* aPlotter )
{ {
static std::vector<wxPoint> Poly; static std::vector<wxPoint> Poly;
COLOR4D color = aPlotter->ColorSettings()->GetColor( GetLayer() ); COLOR4D color = aPlotter->ColorSettings()->GetColor( GetLayer() );
int tmp = GetThickness(); int penWidth = GetEffectiveTextPenWidth( nullptr );
int thickness = GetPenSize();
// Two thicknesses are set here: aPlotter->SetCurrentLineWidth( penWidth );
// The first is for EDA_TEXT, which controls the interline spacing based on text thickness
// The second is for the output that sets the actual stroke size
SetThickness( thickness );
aPlotter->SetCurrentLineWidth( thickness );
if( IsMultilineAllowed() ) if( IsMultilineAllowed() )
{ {
@ -610,7 +588,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
wxPoint textpos = positions[ii] + GetSchematicTextOffset(); wxPoint textpos = positions[ii] + GetSchematicTextOffset();
wxString& txt = strings_list.Item( ii ); wxString& txt = strings_list.Item( ii );
aPlotter->Text( textpos, color, txt, GetTextAngle(), GetTextSize(), GetHorizJustify(), aPlotter->Text( textpos, color, txt, GetTextAngle(), GetTextSize(), GetHorizJustify(),
GetVertJustify(), thickness, IsItalic(), IsBold() ); GetVertJustify(), penWidth, IsItalic(), IsBold() );
} }
} }
else else
@ -618,7 +596,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
wxPoint textpos = GetTextPos() + GetSchematicTextOffset(); wxPoint textpos = GetTextPos() + GetSchematicTextOffset();
aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(), aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(),
GetHorizJustify(), GetVertJustify(), thickness, IsItalic(), IsBold() ); GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold() );
} }
// Draw graphic symbol for global or hierarchical labels // Draw graphic symbol for global or hierarchical labels
@ -628,8 +606,6 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
if( Poly.size() ) if( Poly.size() )
aPlotter->PlotPoly( Poly, NO_FILL ); aPlotter->PlotPoly( Poly, NO_FILL );
SetThickness( tmp );
} }
@ -765,10 +741,7 @@ bool SCH_LABEL::IsType( const KICAD_T aScanTypes[] ) const
const EDA_RECT SCH_LABEL::GetBoundingBox() const const EDA_RECT SCH_LABEL::GetBoundingBox() const
{ {
// Use the maximum clamped pen width to give us a bit of wiggle room EDA_RECT rect = GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
int linewidth = Clamp_Text_PenSize( GetTextSize().x, GetTextSize(), IsBold() );
EDA_RECT rect = GetTextBox( -1, linewidth, false, GetTextMarkupFlags() );
if( GetTextAngle() != 0.0 ) if( GetTextAngle() != 0.0 )
{ {
@ -908,17 +881,11 @@ void SCH_GLOBALLABEL::Print( wxDC* DC, const wxPoint& aOffset )
COLOR4D color = GetLayerColor( m_Layer ); COLOR4D color = GetLayerColor( m_Layer );
wxPoint text_offset = aOffset + GetSchematicTextOffset(); wxPoint text_offset = aOffset + GetSchematicTextOffset();
int linewidth = GetPenSize();
int save_width = GetThickness();
SetThickness( linewidth );
EDA_TEXT::Print( DC, text_offset, color ); EDA_TEXT::Print( DC, text_offset, color );
SetThickness( save_width ); // restore initial value
CreateGraphicShape( Poly, GetTextPos() + aOffset ); CreateGraphicShape( Poly, GetTextPos() + aOffset );
GRPoly( nullptr, DC, Poly.size(), &Poly[0], 0, linewidth, color, color ); GRPoly( nullptr, DC, Poly.size(), &Poly[0], false, GetTextPenWidth(), color, color );
} }
@ -1152,18 +1119,12 @@ void SCH_HIERLABEL::Print( wxDC* DC, const wxPoint& offset )
auto conn = Connection( *g_CurrentSheet ); auto conn = Connection( *g_CurrentSheet );
COLOR4D color = GetLayerColor( ( conn && conn->IsBus() ) ? LAYER_BUS : m_Layer ); COLOR4D color = GetLayerColor( ( conn && conn->IsBus() ) ? LAYER_BUS : m_Layer );
int linewidth = GetPenSize();
int save_width = GetThickness();
SetThickness( linewidth );
wxPoint text_offset = offset + GetSchematicTextOffset(); wxPoint text_offset = offset + GetSchematicTextOffset();
EDA_TEXT::Print( DC, text_offset, color ); EDA_TEXT::Print( DC, text_offset, color );
SetThickness( save_width ); // restore initial value
CreateGraphicShape( Poly, GetTextPos() + offset ); CreateGraphicShape( Poly, GetTextPos() + offset );
GRPoly( nullptr, DC, Poly.size(), &Poly[0], 0, linewidth, color, color ); GRPoly( nullptr, DC, Poly.size(), &Poly[0], false, GetTextPenWidth(), color, color );
} }

View File

@ -30,9 +30,12 @@
#include <gr_basic.h> // EDA_DRAW_MODE_T #include <gr_basic.h> // EDA_DRAW_MODE_T
#include <base_struct.h> // EDA_RECT #include <base_struct.h> // EDA_RECT
#include "kicad_string.h" #include "kicad_string.h"
#include "painter.h"
class SHAPE_POLY_SET; class SHAPE_POLY_SET;
using KIGFX::RENDER_SETTINGS;
// part of the kicad_plugin.h family of defines. // part of the kicad_plugin.h family of defines.
// See kicad_plugin.h for the choice of the value // See kicad_plugin.h for the choice of the value
// When set when calling EDA_TEXT::Format, disable writing the "hide" keyword in save file // When set when calling EDA_TEXT::Format, disable writing the "hide" keyword in save file
@ -137,15 +140,14 @@ public:
virtual void SetText( const wxString& aText ); virtual void SetText( const wxString& aText );
/** /**
* Set the pen width. * The TextPenWidth is that set by the user. The EffectiveTextPenWidth also factors
* * in bold text, default text thickness, and thickness clamping.
* @param aNewThickness is the new pen width
*/ */
void SetThickness( int aNewThickness ) { m_e.penwidth = aNewThickness; }; void SetTextPenWidth( int aWidth ) { m_e.penwidth = aWidth; };
int GetTextPenWidth() const { return m_e.penwidth; };
int GetEffectiveTextPenWidth( RENDER_SETTINGS* aSettings ) const;
/** // JEY TODO: delete
* Return the pen width.
*/
int GetThickness() const { return m_e.penwidth; }; int GetThickness() const { return m_e.penwidth; };
void SetTextAngle( double aAngle ) void SetTextAngle( double aAngle )
@ -308,25 +310,16 @@ public:
int LenSize( const wxString& aLine, int aThickness, int aMarkupFlags ) const; int LenSize( const wxString& aLine, int aThickness, int aMarkupFlags ) const;
/** /**
* Useful in multiline texts to calculate the full text or a line area (for * Useful in multiline texts to calculate the full text or a line area (for zones filling,
* zones filling, locate functions....) * locate functions....)
* * @param aSettings An options rendering context to provide defaults, processing flags, etc.
* @return the rect containing the line of text (i.e. the position and the * @param aLine The line of text to consider. Pass -1 for all lines.
* size of one line)
* this rectangle is calculated for 0 orient text.
* If orientation is not 0 the rect must be rotated to match the
* physical area
* @param aLine The line of text to consider.
* for single line text, aLine is unused
* If aLine == -1, the full area (considering all lines) is returned
* @param aThickness Overrides the current penwidth when greater than 0.
* This is needed when the current penwidth is 0 and a default penwidth is used.
* @param aInvertY Invert the Y axis when calculating bounding box. * @param aInvertY Invert the Y axis when calculating bounding box.
* @param aMarkupFlags a flagset of MARKUP_FLAG enums indicating which markup tokens should * @return the rect containing the line of text (i.e. the position and the size of one line)
* be processed * this rectangle is calculated for 0 orient text.
* If orientation is not 0 the rect must be rotated to match the physical area
*/ */
EDA_RECT GetTextBox( int aLine = -1, int aThickness = -1, bool aInvertY = false, EDA_RECT GetTextBox( RENDER_SETTINGS* aSettings, int aLine = -1, bool aInvertY = false ) const;
int aMarkupFlags = 0 ) const;
/** /**
* Return the distance between two lines of text. * Return the distance between two lines of text.

View File

@ -31,7 +31,6 @@
#include <set> #include <set>
#include <gal/color4d.h> #include <gal/color4d.h>
#include <ws_draw_item.h>
#include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h>
#include <memory> #include <memory>
@ -45,11 +44,12 @@ class VIEW_ITEM;
/** /**
* RENDER_SETTINGS * RENDER_SETTINGS
* Contains all the knowledge about how graphical objects are drawn on * Contains all the knowledge about how graphical objects are drawn on any output
* any output surface/device. This includes: * surface/device. This includes:
* - color/transparency settings * - color/transparency settings
* - highlighting and high contrast mode control * - highlighting and high contrast mode control
* - drawing quality control (sketch/outline mode) * - drawing quality control (sketch/outline mode)
* - text processing flags
* The class acts as an interface between the PAINTER object and the GUI (i.e. Layers/Items * The class acts as an interface between the PAINTER object and the GUI (i.e. Layers/Items
* widget or display options dialog). * widget or display options dialog).
*/ */
@ -143,22 +143,9 @@ public:
/** /**
* Function SetHighContrast * Function SetHighContrast
* Turns on/off high contrast display mode. * Turns on/off high contrast display mode.
* @param aEnabled determines if high contrast display mode should be enabled or not.
*/ */
inline void SetHighContrast( bool aEnabled ) void SetHighContrast( bool aEnabled ) { m_hiContrastEnabled = aEnabled; }
{ bool GetHighContrast() const { return m_hiContrastEnabled; }
m_hiContrastEnabled = aEnabled;
}
/**
* Function GetHighContrast
* Returns information about high contrast display mode.
* @return True if the high contrast mode is on, false otherwise.
*/
inline bool GetHighContrast() const
{
return m_hiContrastEnabled;
}
/** /**
* Function GetColor * Function GetColor
@ -170,20 +157,13 @@ public:
*/ */
virtual const COLOR4D& GetColor( const VIEW_ITEM* aItem, int aLayer ) const = 0; virtual const COLOR4D& GetColor( const VIEW_ITEM* aItem, int aLayer ) const = 0;
float GetWorksheetLineWidth() const float GetWorksheetLineWidth() const { return m_worksheetLineWidth; }
{
return m_worksheetLineWidth;
}
inline bool GetShowPageLimits() const int GetDefaultPenWidth() const { return m_defaultPenWidth; }
{ int GetTextMarkupFlags() const { return m_textMarkupFlags; }
return m_showPageLimits;
}
inline void SetShowPageLimits( bool aDraw ) bool GetShowPageLimits() const { return m_showPageLimits; }
{ void SetShowPageLimits( bool aDraw ) { m_showPageLimits = aDraw; }
m_showPageLimits = aDraw;
}
/** /**
* Function GetBackgroundColor * Function GetBackgroundColor
@ -256,40 +236,34 @@ protected:
std::set<unsigned int> m_activeLayers; ///< Stores active layers number std::set<unsigned int> m_activeLayers; ///< Stores active layers number
///> Colors for all layers (normal) COLOR4D m_layerColors[LAYER_ID_COUNT]; // Layer colors
COLOR4D m_layerColors[LAYER_ID_COUNT]; COLOR4D m_layerColorsHi[LAYER_ID_COUNT]; // Layer colors for highlighted objects
COLOR4D m_layerColorsSel[LAYER_ID_COUNT]; // Layer colors for selected objects
///> Colors for all layers (highlighted) COLOR4D m_hiContrastColor[LAYER_ID_COUNT]; // High-contrast mode layer colors
COLOR4D m_layerColorsHi[LAYER_ID_COUNT]; COLOR4D m_layerColorsDark[LAYER_ID_COUNT]; // Darkened layer colors (for high-contrast mode)
///> Colors for all layers (selected) COLOR4D m_backgroundColor; // The background color
COLOR4D m_layerColorsSel[LAYER_ID_COUNT];
///> Colors for all layers (darkened)
COLOR4D m_layerColorsDark[LAYER_ID_COUNT];
///< Colora used for high contrast display mode
COLOR4D m_hiContrastColor[LAYER_ID_COUNT];
/// Parameters for display modes /// Parameters for display modes
bool m_hiContrastEnabled; ///< High contrast display mode on/off bool m_hiContrastEnabled; // High contrast display mode on/off
float m_hiContrastFactor; ///< Factor used for computing high contrast color float m_hiContrastFactor; // Factor used for computing high contrast color
bool m_highlightEnabled; ///< Highlight display mode on/off bool m_highlightEnabled; // Highlight display mode on/off
int m_highlightNetcode; ///< Net number that is displayed in highlight int m_highlightNetcode; // Net number that is displayed in highlight
///< -1 means that there is no specific net, and whole active // -1 means that there is no specific net, and whole active
///< layer is highlighted // layer is highlighted
bool m_highlightItems; ///< Highlight items with their HIGHLIGHT flags set bool m_highlightItems; // Highlight items with their HIGHLIGHT flags set
float m_highlightFactor; ///< Factor used for computing highlight color float m_highlightFactor; // Factor used for computing highlight color
float m_selectFactor; ///< Specifies how color of selected items is changed float m_selectFactor; // Specifies how color of selected items is changed
float m_layerOpacity; ///< Determines opacity of all layers float m_outlineWidth; // Line width used when drawing outlines
float m_outlineWidth; ///< Line width used when drawing outlines float m_worksheetLineWidth; // Line width used when drawing worksheet
float m_worksheetLineWidth; ///< Line width used when drawing worksheet
int m_defaultPenWidth;
int m_textMarkupFlags; // Indicates whether or not certain markups (such as super-
// and subscript) should be processed.
bool m_showPageLimits; bool m_showPageLimits;
COLOR4D m_backgroundColor; ///< The background color
}; };

View File

@ -25,6 +25,7 @@
#define PREVIEW_PREVIEW_DRAW_CONTEXT__H_ #define PREVIEW_PREVIEW_DRAW_CONTEXT__H_
#include <painter.h> #include <painter.h>
#include <math/vector2d.h>
namespace KIGFX namespace KIGFX
{ {

View File

@ -27,7 +27,6 @@
#include <math/vector2d.h> #include <math/vector2d.h>
#include <eda_text.h> #include <eda_text.h>
#include <eda_text.h>
#include <bitmap_base.h> #include <bitmap_base.h>
#include "msgpanel.h" #include "msgpanel.h"
#include <geometry/shape_poly_set.h> #include <geometry/shape_poly_set.h>
@ -280,7 +279,7 @@ public:
{ {
SetTextPos( aPos ); SetTextPos( aPos );
SetTextSize( aSize ); SetTextSize( aSize );
SetThickness( aPenWidth ); SetTextPenWidth( aPenWidth );
SetItalic( aItalic ); SetItalic( aItalic );
SetBold( aBold ); SetBold( aBold );
} }
@ -289,9 +288,6 @@ public:
void PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor ) override; void PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor ) override;
// Accessors:
int GetPenWidth() { return GetThickness(); }
void SetTextAngle( double aAngle ) void SetTextAngle( double aAngle )
{ {
EDA_TEXT::SetTextAngle( NormalizeAngle360Min( aAngle ) ); EDA_TEXT::SetTextAngle( NormalizeAngle360Min( aAngle ) );

View File

@ -29,6 +29,7 @@
#include <gal/color4d.h> #include <gal/color4d.h>
#include <painter.h> #include <painter.h>
#include <page_info.h> #include <page_info.h>
#include <ws_draw_item.h>
// Forward declarations: // Forward declarations:
class EDA_RECT; class EDA_RECT;

View File

@ -758,7 +758,7 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem )
dimension->SetWidth( aElem.linewidth ); dimension->SetWidth( aElem.linewidth );
dimension->Text().SetThickness( aElem.textlinewidth ); dimension->Text().SetTextPenWidth( aElem.textlinewidth );
dimension->Text().SetTextSize( wxSize( aElem.textheight, aElem.textheight ) ); dimension->Text().SetTextSize( wxSize( aElem.textheight, aElem.textheight ) );
dimension->Text().SetBold( aElem.textbold ); dimension->Text().SetBold( aElem.textbold );
dimension->Text().SetItalic( aElem.textitalic ); dimension->Text().SetItalic( aElem.textitalic );
@ -855,7 +855,7 @@ void ALTIUM_PCB::HelperParseDimensions6Leader( const ADIMENSION6& aElem )
text->SetPosition( aElem.textPoint.at( 0 ) ); text->SetPosition( aElem.textPoint.at( 0 ) );
text->SetLayer( klayer ); text->SetLayer( klayer );
text->SetTextSize( wxSize( aElem.textheight, aElem.textheight ) ); // TODO: parse text width text->SetTextSize( wxSize( aElem.textheight, aElem.textheight ) ); // TODO: parse text width
text->SetThickness( aElem.textlinewidth ); text->SetTextPenWidth( aElem.textlinewidth );
text->SetHorizJustify( EDA_TEXT_HJUSTIFY_T::GR_TEXT_HJUSTIFY_LEFT ); text->SetHorizJustify( EDA_TEXT_HJUSTIFY_T::GR_TEXT_HJUSTIFY_LEFT );
text->SetVertJustify( EDA_TEXT_VJUSTIFY_T::GR_TEXT_VJUSTIFY_BOTTOM ); text->SetVertJustify( EDA_TEXT_VJUSTIFY_T::GR_TEXT_VJUSTIFY_BOTTOM );
} }
@ -1865,7 +1865,7 @@ void ALTIUM_PCB::ParseTexts6Data(
itm->SetLayer( klayer ); itm->SetLayer( klayer );
tx->SetTextSize( wxSize( elem.height, elem.height ) ); // TODO: parse text width tx->SetTextSize( wxSize( elem.height, elem.height ) ); // TODO: parse text width
tx->SetThickness( elem.strokewidth ); tx->SetTextPenWidth( elem.strokewidth );
tx->SetMirrored( elem.mirrored ); tx->SetMirrored( elem.mirrored );
if( elem.isDesignator || elem.isComment ) // That's just a bold assumption if( elem.isDesignator || elem.isComment ) // That's just a bold assumption
{ {

View File

@ -184,54 +184,48 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( PCB_LAYER_ID aLayer,
void MODULE::TransformGraphicShapesWithClearanceToPolygonSet( PCB_LAYER_ID aLayer, void MODULE::TransformGraphicShapesWithClearanceToPolygonSet( PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer, SHAPE_POLY_SET& aCornerBuffer,
int aInflateValue, int aInflateValue,
int aError, bool aIncludeText ) const int aError,
bool aIncludeText,
bool aIncludeEdges ) const
{ {
std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert
for( auto item : GraphicalItems() ) for( auto item : GraphicalItems() )
{ {
switch( item->Type() ) if( item->Type() == PCB_MODULE_TEXT_T && aIncludeText )
{
case PCB_MODULE_TEXT_T:
{ {
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item ); TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
if( ( aLayer != UNDEFINED_LAYER && text->GetLayer() == aLayer ) && text->IsVisible() ) if( aLayer != UNDEFINED_LAYER && text->GetLayer() == aLayer && text->IsVisible() )
texts.push_back( text ); texts.push_back( text );
} }
break;
case PCB_MODULE_EDGE_T: if( item->Type() == PCB_MODULE_EDGE_T && aIncludeEdges )
{ {
EDGE_MODULE* outline = (EDGE_MODULE*) item; EDGE_MODULE* outline = (EDGE_MODULE*) item;
if( aLayer != UNDEFINED_LAYER && outline->GetLayer() != aLayer ) if( aLayer != UNDEFINED_LAYER && outline->GetLayer() == aLayer )
break; outline->TransformShapeWithClearanceToPolygon( aCornerBuffer, 0, aError );
outline->TransformShapeWithClearanceToPolygon( aCornerBuffer, 0, aError );
}
break;
default:
break;
} }
} }
if( !aIncludeText ) if( aIncludeText )
return; {
if( Reference().GetLayer() == aLayer && Reference().IsVisible() )
texts.push_back( &Reference() );
// Convert texts sur modules if( Value().GetLayer() == aLayer && Value().IsVisible() )
if( Reference().GetLayer() == aLayer && Reference().IsVisible() ) texts.push_back( &Value() );
texts.push_back( &Reference() ); }
if( Value().GetLayer() == aLayer && Value().IsVisible() )
texts.push_back( &Value() );
prms.m_cornerBuffer = &aCornerBuffer; prms.m_cornerBuffer = &aCornerBuffer;
for( TEXTE_MODULE* textmod : texts ) for( TEXTE_MODULE* textmod : texts )
{ {
prms.m_textWidth = textmod->GetThickness() + ( 2 * aInflateValue ); bool forceBold = true;
int penWidth = 0; // force max width for bold text
prms.m_textWidth = textmod->GetEffectiveTextPenWidth( nullptr ) + ( 2 * aInflateValue );
prms.m_error = aError; prms.m_error = aError;
wxSize size = textmod->GetTextSize(); wxSize size = textmod->GetTextSize();
@ -240,66 +234,9 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet( PCB_LAYER_ID aLaye
GRText( NULL, textmod->GetTextPos(), BLACK, textmod->GetShownText(), GRText( NULL, textmod->GetTextPos(), BLACK, textmod->GetShownText(),
textmod->GetDrawRotation(), size, textmod->GetHorizJustify(), textmod->GetDrawRotation(), size, textmod->GetHorizJustify(),
textmod->GetVertJustify(), textmod->GetThickness(), textmod->IsItalic(), textmod->GetVertJustify(), penWidth, textmod->IsItalic(),
true, addTextSegmToPoly, &prms ); forceBold, addTextSegmToPoly, &prms );
} }
}
// Same as function TransformGraphicShapesWithClearanceToPolygonSet but this only for text
void MODULE::TransformGraphicTextWithClearanceToPolygonSet( PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer,
int aInflateValue, int aError ) const
{
std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert
for( auto item : GraphicalItems() )
{
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
if( text->GetLayer() == aLayer && text->IsVisible() )
texts.push_back( text );
}
break;
case PCB_MODULE_EDGE_T:
// This function does not render this
break;
default:
break;
}
}
// Convert texts sur modules
if( Reference().GetLayer() == aLayer && Reference().IsVisible() )
texts.push_back( &Reference() );
if( Value().GetLayer() == aLayer && Value().IsVisible() )
texts.push_back( &Value() );
prms.m_cornerBuffer = &aCornerBuffer;
for( TEXTE_MODULE* textmod : texts )
{
prms.m_textWidth = textmod->GetThickness() + ( 2 * aInflateValue );
prms.m_error = aError;
wxSize size = textmod->GetTextSize();
if( textmod->IsMirrored() )
size.x = -size.x;
GRText( NULL, textmod->GetTextPos(), BLACK, textmod->GetShownText(),
textmod->GetDrawRotation(), size, textmod->GetHorizJustify(),
textmod->GetVertJustify(), textmod->GetThickness(), textmod->IsItalic(),
true, addTextSegmToPoly, &prms );
}
} }
@ -342,8 +279,8 @@ void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCorn
wxPoint corners[4]; // Buffer of polygon corners wxPoint corners[4]; // Buffer of polygon corners
EDA_RECT rect = GetTextBox( -1 ); EDA_RECT rect = GetTextBox( nullptr );
rect.Inflate( aClearanceValue ); rect.Inflate( aClearanceValue + Millimeter2iu( DEFAULT_TEXT_WIDTH ) );
corners[0].x = rect.GetOrigin().x; corners[0].x = rect.GetOrigin().x;
corners[0].y = rect.GetOrigin().y; corners[0].y = rect.GetOrigin().y;
corners[1].y = corners[0].y; corners[1].y = corners[0].y;
@ -379,8 +316,11 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet( SHAPE_POLY_SET& aCorner
if( IsMirrored() ) if( IsMirrored() )
size.x = -size.x; size.x = -size.x;
bool forceBold = true;
int penWidth = 0; // force max width for bold text
prms.m_cornerBuffer = &aCornerBuffer; prms.m_cornerBuffer = &aCornerBuffer;
prms.m_textWidth = GetThickness() + ( 2 * aClearanceValue ); prms.m_textWidth = GetEffectiveTextPenWidth( nullptr ) + ( 2 * aClearanceValue );
prms.m_error = aError; prms.m_error = aError;
COLOR4D color = COLOR4D::BLACK; // not actually used, but needed by GRText COLOR4D color = COLOR4D::BLACK; // not actually used, but needed by GRText
@ -396,13 +336,13 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet( SHAPE_POLY_SET& aCorner
{ {
wxString txt = strings_list.Item( ii ); wxString txt = strings_list.Item( ii );
GRText( NULL, positions[ii], color, txt, GetTextAngle(), size, GetHorizJustify(), GRText( NULL, positions[ii], color, txt, GetTextAngle(), size, GetHorizJustify(),
GetVertJustify(), GetThickness(), IsItalic(), true, addTextSegmToPoly, &prms ); GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToPoly, &prms );
} }
} }
else else
{ {
GRText( NULL, GetTextPos(), color, GetShownText(), GetTextAngle(), size, GetHorizJustify(), GRText( NULL, GetTextPos(), color, GetShownText(), GetTextAngle(), size, GetHorizJustify(),
GetVertJustify(), GetThickness(), IsItalic(), true, addTextSegmToPoly, &prms ); GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToPoly, &prms );
} }
} }

View File

@ -245,7 +245,7 @@ void DIMENSION::AdjustDimensionDetails( int aPrecision )
m_Text.SetLayer( GetLayer() ); m_Text.SetLayer( GetLayer() );
// calculate the size of the dimension (text + line above the text) // calculate the size of the dimension (text + line above the text)
ii = m_Text.GetTextHeight() + m_Text.GetThickness() + ( m_Width ); ii = m_Text.GetTextHeight() + m_Text.GetEffectiveTextPenWidth( nullptr ) + m_Width; // JEY TODO: requires RENDER_SETTINGS
deltax = m_featureLineDO.x - m_featureLineGO.x; deltax = m_featureLineDO.x - m_featureLineGO.x;
deltay = m_featureLineDO.y - m_featureLineGO.y; deltay = m_featureLineDO.y - m_featureLineGO.y;
@ -456,7 +456,7 @@ const EDA_RECT DIMENSION::GetBoundingBox() const
EDA_RECT bBox; EDA_RECT bBox;
int xmin, xmax, ymin, ymax; int xmin, xmax, ymin, ymax;
bBox = m_Text.GetTextBox( -1 ); bBox = m_Text.GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
xmin = bBox.GetX(); xmin = bBox.GetX();
xmax = bBox.GetRight(); xmax = bBox.GetRight();
ymin = bBox.GetY(); ymin = bBox.GetY();

View File

@ -393,23 +393,23 @@ public:
* aInflateValue = 0 to have the exact shape size * aInflateValue = 0 to have the exact shape size
* @param aError = Maximum error between true arc and polygon approx * @param aError = Maximum error between true arc and polygon approx
* @param aIncludeText = True to transform text shapes * @param aIncludeText = True to transform text shapes
* @param aIncludeEdges = True to transform module shapes
*/ */
void TransformGraphicShapesWithClearanceToPolygonSet( PCB_LAYER_ID aLayer, void TransformGraphicShapesWithClearanceToPolygonSet( PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer, int aInflateValue, int aError = ARC_HIGH_DEF, SHAPE_POLY_SET& aCornerBuffer, int aInflateValue, int aError = ARC_HIGH_DEF,
bool aIncludeText = true ) const; bool aIncludeText = true, bool aIncludeEdges = true ) const;
/** /**
* @brief TransformGraphicTextWithClearanceToPolygonSet * @brief TransformGraphicTextWithClearanceToPolygonSet
* This function is the same as TransformGraphicShapesWithClearanceToPolygonSet * This function is the same as TransformGraphicShapesWithClearanceToPolygonSet
* but only generate text * but only generate text
* @param aLayer = the layer to consider, or UNDEFINED_LAYER to consider all
* @param aCornerBuffer = the buffer to store polygons
* @param aInflateValue = a value to inflate shapes
* aInflateValue = 0 to have the exact shape size
* @param aError = Maximum error between true arc and polygon approx
*/ */
void TransformGraphicTextWithClearanceToPolygonSet( PCB_LAYER_ID aLayer, void TransformGraphicTextWithClearanceToPolygonSet( PCB_LAYER_ID aLayer,
SHAPE_POLY_SET& aCornerBuffer, int aInflateValue, int aError = ARC_HIGH_DEF ) const; SHAPE_POLY_SET& aCornerBuffer, int aInflateValue, int aError = ARC_HIGH_DEF ) const
{
TransformGraphicShapesWithClearanceToPolygonSet( aLayer, aCornerBuffer, aInflateValue,
aError, true, false );
}
/** /**
* Resolve any references to system tokens supported by the component. * Resolve any references to system tokens supported by the component.

View File

@ -149,7 +149,7 @@ void TEXTE_PCB::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>&
msg.Printf( wxT( "%.1f" ), GetTextAngle() / 10.0 ); msg.Printf( wxT( "%.1f" ), GetTextAngle() / 10.0 );
aList.emplace_back( _( "Angle" ), msg, DARKGREEN ); aList.emplace_back( _( "Angle" ), msg, DARKGREEN );
msg = MessageTextFromValue( aUnits, GetThickness() ); msg = MessageTextFromValue( aUnits, GetTextPenWidth() );
aList.emplace_back( _( "Thickness" ), msg, MAGENTA ); aList.emplace_back( _( "Thickness" ), msg, MAGENTA );
msg = MessageTextFromValue( aUnits, GetTextWidth() ); msg = MessageTextFromValue( aUnits, GetTextWidth() );
@ -162,7 +162,7 @@ void TEXTE_PCB::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>&
const EDA_RECT TEXTE_PCB::GetBoundingBox() const const EDA_RECT TEXTE_PCB::GetBoundingBox() const
{ {
EDA_RECT rect = GetTextBox( -1, -1 ); EDA_RECT rect = GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
if( GetTextAngle() ) if( GetTextAngle() )
rect = rect.GetBoundingBoxRotated( GetTextPos(), GetTextAngle() ); rect = rect.GetBoundingBoxRotated( GetTextPos(), GetTextAngle() );
@ -197,9 +197,9 @@ void TEXTE_PCB::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
if( GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT || GetHorizJustify() == GR_TEXT_HJUSTIFY_RIGHT ) if( GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT || GetHorizJustify() == GR_TEXT_HJUSTIFY_RIGHT )
{ {
if( ( GetHorizJustify() == GR_TEXT_HJUSTIFY_RIGHT ) == IsMirrored() ) if( ( GetHorizJustify() == GR_TEXT_HJUSTIFY_RIGHT ) == IsMirrored() )
SetTextX( GetTextPos().x - GetTextBox().GetWidth() ); SetTextX( GetTextPos().x - GetTextBox( nullptr ).GetWidth() ); // JEY TODO: requires RENDER_SETTINGS
else else
SetTextX( GetTextPos().x + GetTextBox().GetWidth() ); SetTextX( GetTextPos().x + GetTextBox( nullptr ).GetWidth() ); // JEY TODO: requires RENDER_SETTINGS
} }
} }

View File

@ -54,7 +54,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, TEXT_TYPE text_type ) :
m_keepUpright = true; m_keepUpright = true;
// Set text thickness to a default value // Set text thickness to a default value
SetThickness( Millimeter2iu( DEFAULT_TEXT_WIDTH ) ); SetTextPenWidth( Millimeter2iu( DEFAULT_TEXT_WIDTH ) );
SetLayer( F_SilkS ); SetLayer( F_SilkS );
// Set position and give a default layer if a valid parent footprint exists // Set position and give a default layer if a valid parent footprint exists
@ -86,7 +86,7 @@ void TEXTE_MODULE::SetTextAngle( double aAngle )
bool TEXTE_MODULE::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const bool TEXTE_MODULE::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
{ {
EDA_RECT rect = GetTextBox( -1 ); EDA_RECT rect = GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
wxPoint location = aPoint; wxPoint location = aPoint;
rect.Inflate( aAccuracy ); rect.Inflate( aAccuracy );
@ -106,7 +106,7 @@ bool TEXTE_MODULE::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccu
if( aContains ) if( aContains )
return rect.Contains( GetBoundingBox() ); return rect.Contains( GetBoundingBox() );
else else
return rect.Intersects( GetTextBox( -1 ), GetDrawRotation() ); return rect.Intersects( GetTextBox( nullptr ), GetDrawRotation() ); // JEY TODO: requires RENDER_SETTINGS
} }
@ -252,7 +252,7 @@ void TEXTE_MODULE::SetLocalCoord()
const EDA_RECT TEXTE_MODULE::GetBoundingBox() const const EDA_RECT TEXTE_MODULE::GetBoundingBox() const
{ {
double angle = GetDrawRotation(); double angle = GetDrawRotation();
EDA_RECT text_area = GetTextBox( -1, -1 ); EDA_RECT text_area = GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
if( angle ) if( angle )
text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle ); text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
@ -292,7 +292,7 @@ void TEXTE_MODULE::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOff
} }
// Draw mode compensation for the width // Draw mode compensation for the width
int width = GetThickness(); int width = GetEffectiveTextPenWidth( nullptr );
if( aFrame->GetDisplayOptions().m_DisplayModTextFill == SKETCH ) if( aFrame->GetDisplayOptions().m_DisplayModTextFill == SKETCH )
width = -width; width = -width;
@ -382,7 +382,7 @@ void TEXTE_MODULE::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM
msg.Printf( wxT( "%.1f" ), GetTextAngleDegrees() ); msg.Printf( wxT( "%.1f" ), GetTextAngleDegrees() );
aList.emplace_back( _( "Angle" ), msg, DARKGREEN ); aList.emplace_back( _( "Angle" ), msg, DARKGREEN );
msg = MessageTextFromValue( aUnits, GetThickness(), true ); msg = MessageTextFromValue( aUnits, GetTextPenWidth(), true );
aList.emplace_back( _( "Thickness" ), msg, DARKGREEN ); aList.emplace_back( _( "Thickness" ), msg, DARKGREEN );
msg = MessageTextFromValue( aUnits, GetTextWidth(), true ); msg = MessageTextFromValue( aUnits, GetTextWidth(), true );
@ -430,7 +430,7 @@ EDA_ITEM* TEXTE_MODULE::Clone() const
const BOX2I TEXTE_MODULE::ViewBBox() const const BOX2I TEXTE_MODULE::ViewBBox() const
{ {
double angle = GetDrawRotation(); double angle = GetDrawRotation();
EDA_RECT text_area = GetTextBox( -1, -1 ); EDA_RECT text_area = GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
if( angle ) if( angle )
text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle ); text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );

View File

@ -784,7 +784,7 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField( wxCommandEvent& )
textMod.SetLayer( m_texts->at( m_texts->size() - 1 ).GetLayer() ); textMod.SetLayer( m_texts->at( m_texts->size() - 1 ).GetLayer() );
textMod.SetTextSize( dsnSettings.GetTextSize( textMod.GetLayer() ) ); textMod.SetTextSize( dsnSettings.GetTextSize( textMod.GetLayer() ) );
textMod.SetThickness( dsnSettings.GetTextThickness( textMod.GetLayer() ) ); textMod.SetTextPenWidth( dsnSettings.GetTextThickness( textMod.GetLayer() ) );
textMod.SetItalic( dsnSettings.GetTextItalic( textMod.GetLayer() ) ); textMod.SetItalic( dsnSettings.GetTextItalic( textMod.GetLayer() ) );
textMod.SetKeepUpright( dsnSettings.GetTextUpright( textMod.GetLayer() ) ); textMod.SetKeepUpright( dsnSettings.GetTextUpright( textMod.GetLayer() ) );
textMod.SetMirrored( IsBackLayer( textMod.GetLayer() ) ); textMod.SetMirrored( IsBackLayer( textMod.GetLayer() ) );

View File

@ -720,7 +720,7 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnAddField( wxCommandEvent& event )
textMod.SetLayer( m_texts->at( m_texts->size() - 1 ).GetLayer() ); textMod.SetLayer( m_texts->at( m_texts->size() - 1 ).GetLayer() );
textMod.SetTextSize( dsnSettings.GetTextSize( textMod.GetLayer() ) ); textMod.SetTextSize( dsnSettings.GetTextSize( textMod.GetLayer() ) );
textMod.SetThickness( dsnSettings.GetTextThickness( textMod.GetLayer() ) ); textMod.SetTextPenWidth( dsnSettings.GetTextThickness( textMod.GetLayer() ) );
textMod.SetItalic( dsnSettings.GetTextItalic( textMod.GetLayer() ) ); textMod.SetItalic( dsnSettings.GetTextItalic( textMod.GetLayer() ) );
m_texts->push_back( textMod ); m_texts->push_back( textMod );

View File

@ -277,7 +277,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B
textItem->SetTextSize( wxSize( textItem->GetTextSize().x, m_textHeight.GetValue() ) ); textItem->SetTextSize( wxSize( textItem->GetTextSize().x, m_textHeight.GetValue() ) );
if( !m_thickness.IsIndeterminate() && textItem ) if( !m_thickness.IsIndeterminate() && textItem )
textItem->SetThickness( m_thickness.GetValue() ); textItem->SetTextPenWidth( m_thickness.GetValue() );
if( m_Italic->Get3StateValue() != wxCHK_UNDETERMINED && textItem ) if( m_Italic->Get3StateValue() != wxCHK_UNDETERMINED && textItem )
textItem->SetItalic( m_Italic->GetValue() ); textItem->SetItalic( m_Italic->GetValue() );
@ -298,7 +298,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B
if( textItem ) if( textItem )
{ {
textItem->SetTextSize( m_brdSettings->GetTextSize( layer ) ); textItem->SetTextSize( m_brdSettings->GetTextSize( layer ) );
textItem->SetThickness( m_brdSettings->GetTextThickness( layer ) ); textItem->SetTextPenWidth( m_brdSettings->GetTextThickness( layer ) );
textItem->SetItalic( m_brdSettings->GetTextItalic( layer ) ); textItem->SetItalic( m_brdSettings->GetTextItalic( layer ) );
} }

View File

@ -451,7 +451,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
m_textWidth.SetValue( m_edaText->GetTextSize().x ); m_textWidth.SetValue( m_edaText->GetTextSize().x );
m_textHeight.SetValue( m_edaText->GetTextSize().y ); m_textHeight.SetValue( m_edaText->GetTextSize().y );
m_thickness.SetValue( m_edaText->GetThickness() ); m_thickness.SetValue( m_edaText->GetTextPenWidth() );
m_posX.SetValue( m_edaText->GetTextPos().x ); m_posX.SetValue( m_edaText->GetTextPos().x );
m_posY.SetValue( m_edaText->GetTextPos().y ); m_posY.SetValue( m_edaText->GetTextPos().y );
@ -542,20 +542,20 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
m_item->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) ); m_item->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) );
m_edaText->SetTextSize( wxSize( m_textWidth.GetValue(), m_textHeight.GetValue() ) ); m_edaText->SetTextSize( wxSize( m_textWidth.GetValue(), m_textHeight.GetValue() ) );
m_edaText->SetThickness( m_thickness.GetValue() ); m_edaText->SetTextPenWidth( m_thickness.GetValue() );
m_edaText->SetTextPos( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) ); m_edaText->SetTextPos( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) );
if( m_modText ) if( m_modText )
m_modText->SetLocalCoord(); m_modText->SetLocalCoord();
// Test for acceptable values for thickness and size and clamp if fails // Test for acceptable values for thickness and size and clamp if fails
int maxthickness = Clamp_Text_PenSize( m_edaText->GetThickness(), m_edaText->GetTextSize() ); int maxPenWidth = Clamp_Text_PenSize( m_edaText->GetTextPenWidth(), m_edaText->GetTextSize() );
if( m_edaText->GetThickness() > maxthickness ) if( m_edaText->GetTextPenWidth() > maxPenWidth )
{ {
DisplayError( this, _( "The text thickness is too large for the text size.\n" DisplayError( this, _( "The text thickness is too large for the text size.\n"
"It will be clamped." ) ); "It will be clamped." ) );
m_edaText->SetThickness( maxthickness ); m_edaText->SetTextPenWidth( maxPenWidth );
} }
m_edaText->SetVisible( m_Visible->GetValue() ); m_edaText->SetVisible( m_Visible->GetValue() );

View File

@ -1059,7 +1059,7 @@ void DRC::testCopperTextItem( BOARD_ITEM* aTextItem )
return; return;
std::vector<wxPoint> textShape; // a buffer to store the text shape (set of segments) std::vector<wxPoint> textShape; // a buffer to store the text shape (set of segments)
int textWidth = text->GetThickness(); int penWidth = text->GetEffectiveTextPenWidth( nullptr ); // JEY TODO: requires RENDER_SETTINGS
// So far the bounding box makes up the text-area // So far the bounding box makes up the text-area
text->TransformTextShapeToSegmentList( textShape ); text->TransformTextShapeToSegmentList( textShape );
@ -1067,7 +1067,7 @@ void DRC::testCopperTextItem( BOARD_ITEM* aTextItem )
if( textShape.size() == 0 ) // Should not happen (empty text?) if( textShape.size() == 0 ) // Should not happen (empty text?)
return; return;
EDA_RECT bbox = text->GetTextBox(); EDA_RECT bbox = text->GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
SHAPE_RECT rect_area( bbox.GetX(), bbox.GetY(), bbox.GetWidth(), bbox.GetHeight() ); SHAPE_RECT rect_area( bbox.GetX(), bbox.GetY(), bbox.GetWidth(), bbox.GetHeight() );
// Test tracks and vias // Test tracks and vias
@ -1076,7 +1076,7 @@ void DRC::testCopperTextItem( BOARD_ITEM* aTextItem )
if( !track->IsOnLayer( aTextItem->GetLayer() ) ) if( !track->IsOnLayer( aTextItem->GetLayer() ) )
continue; continue;
int minDist = ( track->GetWidth() + textWidth ) / 2 + track->GetClearance( NULL ); int minDist = ( track->GetWidth() + penWidth ) / 2 + track->GetClearance( NULL );
SEG trackAsSeg( track->GetStart(), track->GetEnd() ); SEG trackAsSeg( track->GetStart(), track->GetEnd() );
// Fast test to detect a trach segment candidate inside the text bounding box // Fast test to detect a trach segment candidate inside the text bounding box
@ -1122,7 +1122,7 @@ void DRC::testCopperTextItem( BOARD_ITEM* aTextItem )
SHAPE_POLY_SET padOutline; SHAPE_POLY_SET padOutline;
int minDist = textWidth/2 + pad->GetClearance( NULL ); int minDist = penWidth / 2 + pad->GetClearance( NULL );
pad->TransformShapeWithClearanceToPolygon( padOutline, 0 ); pad->TransformShapeWithClearanceToPolygon( padOutline, 0 );
for( unsigned jj = 0; jj < textShape.size(); jj += 2 ) for( unsigned jj = 0; jj < textShape.size(); jj += 2 )

View File

@ -547,7 +547,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
double ratio = t.ratio ? *t.ratio : 8; // DTD says 8 is default double ratio = t.ratio ? *t.ratio : 8; // DTD says 8 is default
pcbtxt->SetThickness( KiROUND( t.size.ToPcbUnits() * ratio / 100 ) ); pcbtxt->SetTextPenWidth( KiROUND( t.size.ToPcbUnits() * ratio / 100 ) );
int align = t.align ? *t.align : ETEXT::BOTTOM_LEFT; int align = t.align ? *t.align : ETEXT::BOTTOM_LEFT;
@ -762,7 +762,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
dimension->SetEnd( wxPoint( kicad_x( d.x2 ), kicad_y( d.y2 ) ), dimension->SetEnd( wxPoint( kicad_x( d.x2 ), kicad_y( d.y2 ) ),
DIMENSION_PRECISION ); DIMENSION_PRECISION );
dimension->Text().SetTextSize( designSettings.GetTextSize( layer ) ); dimension->Text().SetTextSize( designSettings.GetTextSize( layer ) );
dimension->Text().SetThickness( designSettings.GetTextThickness( layer ) ); dimension->Text().SetTextPenWidth( designSettings.GetTextThickness( layer ) );
dimension->SetWidth( designSettings.GetLineThickness( layer ) ); dimension->SetWidth( designSettings.GetLineThickness( layer ) );
dimension->SetUnits( EDA_UNITS::MILLIMETRES, false ); dimension->SetUnits( EDA_UNITS::MILLIMETRES, false );
@ -1307,8 +1307,7 @@ void EAGLE_PLUGIN::orientModuleText( MODULE* m, const EELEMENT& e,
ratio = *a.ratio; ratio = *a.ratio;
} }
int lw = int( fontz.y * ratio / 100 ); txt->SetTextPenWidth( KiROUND( fontz.y * ratio / 100 ) );
txt->SetThickness( lw );
int align = ETEXT::BOTTOM_LEFT; // bottom-left is eagle default int align = ETEXT::BOTTOM_LEFT; // bottom-left is eagle default
@ -1656,7 +1655,7 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, wxXmlNode* aTree ) const
double ratio = t.ratio ? *t.ratio : 8; // DTD says 8 is default double ratio = t.ratio ? *t.ratio : 8; // DTD says 8 is default
txt->SetThickness( KiROUND( t.size.ToPcbUnits() * ratio / 100 ) ); txt->SetTextPenWidth( KiROUND( t.size.ToPcbUnits() * ratio / 100 ) );
int align = t.align ? *t.align : ETEXT::BOTTOM_LEFT; // bottom-left is eagle default int align = t.align ? *t.align : ETEXT::BOTTOM_LEFT; // bottom-left is eagle default

View File

@ -773,16 +773,17 @@ static void vrml_text_callback( int x0, int y0, int xf, int yf, void* aData )
static void export_vrml_pcbtext( MODEL_VRML& aModel, TEXTE_PCB* text ) static void export_vrml_pcbtext( MODEL_VRML& aModel, TEXTE_PCB* text )
{ {
model_vrml->m_text_layer = text->GetLayer();
model_vrml->m_text_width = text->GetThickness();
wxSize size = text->GetTextSize(); wxSize size = text->GetTextSize();
if( text->IsMirrored() ) if( text->IsMirrored() )
size.x = -size.x; size.x = -size.x;
int penWidth = text->GetEffectiveTextPenWidth( nullptr );
COLOR4D color = COLOR4D::BLACK; // not actually used, but needed by GRText COLOR4D color = COLOR4D::BLACK; // not actually used, but needed by GRText
model_vrml->m_text_layer = text->GetLayer();
model_vrml->m_text_width = penWidth;
if( text->IsMultilineAllowed() ) if( text->IsMultilineAllowed() )
{ {
wxArrayString strings_list; wxArrayString strings_list;
@ -793,17 +794,16 @@ static void export_vrml_pcbtext( MODEL_VRML& aModel, TEXTE_PCB* text )
for( unsigned ii = 0; ii < strings_list.Count(); ii++ ) for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
{ {
wxString& txt = strings_list.Item( ii ); GRText( nullptr, positions[ii], color, strings_list[ii], text->GetTextAngle(), size,
GRText( NULL, positions[ii], color, txt, text->GetTextAngle(), size, text->GetHorizJustify(), text->GetVertJustify(), penWidth, text->IsItalic(),
text->GetHorizJustify(), text->GetVertJustify(), text->GetThickness(), true, vrml_text_callback );
text->IsItalic(), true, vrml_text_callback );
} }
} }
else else
{ {
GRText( NULL, text->GetTextPos(), color, text->GetShownText(), text->GetTextAngle(), GRText( nullptr, text->GetTextPos(), color, text->GetShownText(), text->GetTextAngle(),
size, text->GetHorizJustify(), text->GetVertJustify(), text->GetThickness(), size, text->GetHorizJustify(), text->GetVertJustify(), penWidth, text->IsItalic(),
text->IsItalic(), true, vrml_text_callback ); true, vrml_text_callback );
} }
} }
@ -1057,12 +1057,14 @@ static void export_vrml_text_module( TEXTE_MODULE* item )
if( item->IsMirrored() ) if( item->IsMirrored() )
size.x = -size.x; // Text is mirrored size.x = -size.x; // Text is mirrored
int penWidth = item->GetEffectiveTextPenWidth( nullptr );
model_vrml->m_text_layer = item->GetLayer(); model_vrml->m_text_layer = item->GetLayer();
model_vrml->m_text_width = item->GetThickness(); model_vrml->m_text_width = penWidth;
GRText( NULL, item->GetTextPos(), BLACK, item->GetShownText(), item->GetDrawRotation(), GRText( NULL, item->GetTextPos(), BLACK, item->GetShownText(), item->GetDrawRotation(),
size, item->GetHorizJustify(), item->GetVertJustify(), item->GetThickness(), size, item->GetHorizJustify(), item->GetVertJustify(), penWidth, item->IsItalic(),
item->IsItalic(), true, vrml_text_callback ); true, vrml_text_callback );
} }
} }

View File

@ -1058,7 +1058,7 @@ MODULE* PCB_BASE_FRAME::CreateNewModule( const wxString& aModuleName )
module->SetReference( settings.m_RefDefaultText ); module->SetReference( settings.m_RefDefaultText );
PCB_LAYER_ID layer = ToLAYER_ID( settings.m_RefDefaultlayer ); PCB_LAYER_ID layer = ToLAYER_ID( settings.m_RefDefaultlayer );
module->Reference().SetThickness( settings.GetTextThickness( layer ) ); module->Reference().SetTextPenWidth( settings.GetTextThickness( layer ) );
module->Reference().SetTextSize( settings.GetTextSize( layer ) ); module->Reference().SetTextSize( settings.GetTextSize( layer ) );
module->Reference().SetItalic( settings.GetTextItalic( layer ) ); module->Reference().SetItalic( settings.GetTextItalic( layer ) );
module->Reference().SetKeepUpright( settings.GetTextUpright( layer ) ); module->Reference().SetKeepUpright( settings.GetTextUpright( layer ) );
@ -1074,7 +1074,7 @@ MODULE* PCB_BASE_FRAME::CreateNewModule( const wxString& aModuleName )
module->SetValue( settings.m_ValueDefaultText ); module->SetValue( settings.m_ValueDefaultText );
layer = ToLAYER_ID( settings.m_ValueDefaultlayer ); layer = ToLAYER_ID( settings.m_ValueDefaultlayer );
module->Value().SetThickness( settings.GetTextThickness( layer ) ); module->Value().SetTextPenWidth( settings.GetTextThickness( layer ) );
module->Value().SetTextSize( settings.GetTextSize( layer ) ); module->Value().SetTextSize( settings.GetTextSize( layer ) );
module->Value().SetItalic( settings.GetTextItalic( layer ) ); module->Value().SetItalic( settings.GetTextItalic( layer ) );
module->Value().SetKeepUpright( settings.GetTextUpright( layer ) ); module->Value().SetKeepUpright( settings.GetTextUpright( layer ) );

View File

@ -419,14 +419,14 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
module->Reference().SetTextPos( textPos ); module->Reference().SetTextPos( textPos );
module->Reference().SetPos0( textPos ); module->Reference().SetPos0( textPos );
module->Reference().SetTextSize( wxSize( twsize, thsize ) ); module->Reference().SetTextSize( wxSize( twsize, thsize ) );
module->Reference().SetThickness( thickness ); module->Reference().SetTextPenWidth( thickness );
// gEDA/pcb shows only one of value/reference/description at a time. Which // gEDA/pcb shows only one of value/reference/description at a time. Which
// one is selectable by a global menu setting. pcbnew needs reference as // one is selectable by a global menu setting. pcbnew needs reference as
// well as value visible, so place the value right below the reference. // well as value visible, so place the value right below the reference.
module->Value().SetTextAngle( module->Reference().GetTextAngle() ); module->Value().SetTextAngle( module->Reference().GetTextAngle() );
module->Value().SetTextSize( module->Reference().GetTextSize() ); module->Value().SetTextSize( module->Reference().GetTextSize() );
module->Value().SetThickness( module->Reference().GetThickness() ); module->Value().SetTextPenWidth( module->Reference().GetTextPenWidth() );
textPos.y += thsize * 13 / 10; // 130% line height textPos.y += thsize * 13 / 10; // 130% line height
module->Value().SetTextPos( textPos ); module->Value().SetTextPos( textPos );
module->Value().SetPos0( textPos ); module->Value().SetPos0( textPos );

View File

@ -138,7 +138,7 @@ void GRAPHICS_IMPORTER_PCBNEW::AddText( const VECTOR2D& aOrigin, const wxString&
EDA_TEXT* textItem; EDA_TEXT* textItem;
tie( boardItem, textItem ) = createText(); tie( boardItem, textItem ) = createText();
boardItem->SetLayer( GetLayer() ); boardItem->SetLayer( GetLayer() );
textItem->SetThickness( MapLineWidth( aThickness ) ); textItem->SetTextPenWidth( MapLineWidth( aThickness ) );
textItem->SetTextPos( MapCoordinate( aOrigin ) ); textItem->SetTextPos( MapCoordinate( aOrigin ) );
textItem->SetTextAngle( aOrientation * 10.0 ); // Pcbnew uses the decidegree textItem->SetTextAngle( aOrientation * 10.0 ); // Pcbnew uses the decidegree
textItem->SetTextWidth( aWidth * ImportScalingFactor() ); textItem->SetTextWidth( aWidth * ImportScalingFactor() );

View File

@ -1813,15 +1813,7 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( TEXTE_MODULE* aText )
aText->SetTextAngle( orient ); aText->SetTextAngle( orient );
// Set a reasonable width: aText->SetTextPenWidth( thickn < 1 ? 0 : thickn );
if( thickn < 1 )
thickn = 1;
/* this is better left to the dialogs UIs
aText->SetThickness( Clamp_Text_PenSize( thickn, aText->GetSize() ) );
*/
aText->SetThickness( thickn );
aText->SetMirrored( mirror && *mirror == 'M' ); aText->SetMirrored( mirror && *mirror == 'M' );
@ -2137,8 +2129,7 @@ void LEGACY_PLUGIN::loadPCB_TEXT()
double angle = degParse( data ); double angle = degParse( data );
pcbtxt->SetTextSize( size ); pcbtxt->SetTextSize( size );
pcbtxt->SetTextPenWidth( thickn );
pcbtxt->SetThickness( thickn );
pcbtxt->SetTextAngle( angle ); pcbtxt->SetTextAngle( angle );
pcbtxt->SetTextPos( wxPoint( pos_x, pos_y ) ); pcbtxt->SetTextPos( wxPoint( pos_x, pos_y ) );
@ -2776,7 +2767,7 @@ void LEGACY_PLUGIN::loadDIMENSION()
dim->SetTextSize( wxSize( width, height ) ); dim->SetTextSize( wxSize( width, height ) );
dim->Text().SetMirrored( mirror && *mirror == '0' ); dim->Text().SetMirrored( mirror && *mirror == '0' );
dim->Text().SetThickness( thickn ); dim->Text().SetTextPenWidth( thickn );
dim->Text().SetTextAngle( orient ); dim->Text().SetTextAngle( orient );
} }

View File

@ -190,9 +190,9 @@ MODULE* MICROWAVE_TOOL::createBaseFootprint( const wxString& aValue,
if( aTextSize > 0 ) if( aTextSize > 0 )
{ {
module->Reference().SetTextSize( wxSize( aTextSize, aTextSize ) ); module->Reference().SetTextSize( wxSize( aTextSize, aTextSize ) );
module->Reference().SetThickness( aTextSize/5 ); module->Reference().SetTextPenWidth( aTextSize/5 );
module->Value().SetTextSize( wxSize( aTextSize, aTextSize ) ); module->Value().SetTextSize( wxSize( aTextSize, aTextSize ) );
module->Value().SetThickness( aTextSize/5 ); module->Value().SetTextPenWidth( aTextSize/5 );
} }
// Create 2 pads used in gaps and stubs. The gap is between these 2 pads // Create 2 pads used in gaps and stubs. The gap is between these 2 pads

View File

@ -503,12 +503,10 @@ void PCB_MODULE::AddToBoard()
// transform text positions // transform text positions
CorrectTextPosition( &m_name ); CorrectTextPosition( &m_name );
RotatePoint( &m_name.correctedPositionX, &m_name.correctedPositionY, RotatePoint( &m_name.correctedPositionX, &m_name.correctedPositionY, (double) -m_rotation );
(double) -m_rotation );
CorrectTextPosition( &m_value ); CorrectTextPosition( &m_value );
RotatePoint( &m_value.correctedPositionX, &m_value.correctedPositionY, RotatePoint( &m_value.correctedPositionX, &m_value.correctedPositionY, (double) -m_rotation );
(double) -m_rotation );
MODULE* module = new MODULE( m_board ); MODULE* module = new MODULE( m_board );
m_board->Add( module, ADD_MODE::APPEND ); m_board->Add( module, ADD_MODE::APPEND );
@ -541,7 +539,7 @@ void PCB_MODULE::AddToBoard()
ref_text->SetKeepUpright( false ); ref_text->SetKeepUpright( false );
ref_text->SetItalic( m_name.isItalic ); ref_text->SetItalic( m_name.isItalic );
ref_text->SetThickness( m_name.textstrokeWidth ); ref_text->SetTextPenWidth( m_name.textstrokeWidth );
ref_text->SetMirrored( m_name.mirror ); ref_text->SetMirrored( m_name.mirror );
ref_text->SetVisible( m_name.textIsVisible ); ref_text->SetVisible( m_name.textIsVisible );
@ -568,7 +566,7 @@ void PCB_MODULE::AddToBoard()
val_text->SetKeepUpright( false ); val_text->SetKeepUpright( false );
val_text->SetItalic( m_value.isItalic ); val_text->SetItalic( m_value.isItalic );
val_text->SetThickness( m_value.textstrokeWidth ); val_text->SetTextPenWidth( m_value.textstrokeWidth );
val_text->SetMirrored( m_value.mirror ); val_text->SetMirrored( m_value.mirror );
val_text->SetVisible( m_value.textIsVisible ); val_text->SetVisible( m_value.textIsVisible );

View File

@ -115,7 +115,7 @@ void PCB_TEXT::AddToBoard()
SetTextSizeFromStrokeFontHeight( pcbtxt, m_name.textHeight ); SetTextSizeFromStrokeFontHeight( pcbtxt, m_name.textHeight );
pcbtxt->SetItalic( m_name.isItalic ); pcbtxt->SetItalic( m_name.isItalic );
pcbtxt->SetThickness( m_name.textstrokeWidth ); pcbtxt->SetTextPenWidth( m_name.textstrokeWidth );
SetTextJustify( pcbtxt, m_name.justify ); SetTextJustify( pcbtxt, m_name.justify );
pcbtxt->SetTextPos( wxPoint( m_name.textPositionX, pcbtxt->SetTextPos( wxPoint( m_name.textPositionX,

View File

@ -1016,7 +1016,7 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer )
else else
{ {
// Filled mode // Filled mode
m_gal->SetLineWidth( getLineThickness( aText->GetThickness() ) ); m_gal->SetLineWidth( getLineThickness( aText->GetEffectiveTextPenWidth( nullptr ) ) ); // JEY TODO: requires RENDER_SETTINGS
} }
m_gal->SetStrokeColor( color ); m_gal->SetStrokeColor( color );
@ -1048,14 +1048,15 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
else else
{ {
// Filled mode // Filled mode
m_gal->SetLineWidth( getLineThickness( aText->GetThickness() ) ); m_gal->SetLineWidth( getLineThickness( aText->GetEffectiveTextPenWidth( nullptr ) ) ); // JEY TODO: requires RENDER_SETTINGS
} }
m_gal->SetStrokeColor( color ); m_gal->SetStrokeColor( color );
m_gal->SetIsFill( false ); m_gal->SetIsFill( false );
m_gal->SetIsStroke( true ); m_gal->SetIsStroke( true );
m_gal->SetTextAttributes( aText ); m_gal->SetTextAttributes( aText );
m_gal->StrokeText( shownText, position, aText->GetDrawRotationRadians(), GetTextMarkupFlags() ); m_gal->StrokeText( shownText, position, aText->GetDrawRotationRadians(),
GetTextMarkupFlags() ); // JEY TODO: requires RENDER_SETTINGS
// Draw the umbilical line // Draw the umbilical line
if( aText->IsSelected() ) if( aText->IsSelected() )
@ -1183,10 +1184,10 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer )
TEXTE_PCB& text = aDimension->Text(); TEXTE_PCB& text = aDimension->Text();
VECTOR2D position( text.GetTextPos().x, text.GetTextPos().y ); VECTOR2D position( text.GetTextPos().x, text.GetTextPos().y );
m_gal->SetLineWidth( text.GetThickness() ); m_gal->SetLineWidth( getLineThickness( text.GetEffectiveTextPenWidth( nullptr ) ) ); // JEY TODO: requires RENDER_SETTINGS
m_gal->SetTextAttributes( &text ); m_gal->SetTextAttributes( &text );
m_gal->StrokeText( text.GetShownText(), position, text.GetTextAngleRadians(), m_gal->StrokeText( text.GetShownText(), position, text.GetTextAngleRadians(),
GetTextMarkupFlags() ); GetTextMarkupFlags() ); // JEY TODO: requires RENDER_SETTINGS
} }

View File

@ -300,7 +300,7 @@ void PCB_PARSER::parseEDA_TEXT( EDA_TEXT* aText )
break; break;
case T_thickness: case T_thickness:
aText->SetThickness( parseBoardUnits( "text thickness" ) ); aText->SetTextPenWidth( parseBoardUnits( "text thickness" ) );
NeedRIGHT(); NeedRIGHT();
break; break;

View File

@ -361,7 +361,7 @@ void BRDITEMS_PLOTTER::PlotTextModule( TEXTE_MODULE* pt_texte, COLOR4D aColor )
orient = pt_texte->GetDrawRotation(); orient = pt_texte->GetDrawRotation();
thickness = pt_texte->GetThickness(); thickness = pt_texte->GetEffectiveTextPenWidth( nullptr );
if( pt_texte->IsMirrored() ) if( pt_texte->IsMirrored() )
size.x = -size.x; // Text is mirrored size.x = -size.x; // Text is mirrored
@ -653,7 +653,7 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte )
size = pt_texte->GetTextSize(); size = pt_texte->GetTextSize();
pos = pt_texte->GetTextPos(); pos = pt_texte->GetTextPos();
orient = pt_texte->GetTextAngle(); orient = pt_texte->GetTextAngle();
thickness = pt_texte->GetThickness(); thickness = pt_texte->GetEffectiveTextPenWidth( nullptr );
if( pt_texte->IsMirrored() ) if( pt_texte->IsMirrored() )
size.x = -size.x; size.x = -size.x;

View File

@ -942,7 +942,7 @@ bool PNS_KICAD_IFACE_BASE::syncTextItem( PNS::NODE* aWorld, EDA_TEXT* aText, PCB
if( !IsCopperLayer( aLayer ) ) if( !IsCopperLayer( aLayer ) )
return false; return false;
int textWidth = aText->GetThickness(); int textWidth = aText->GetEffectiveTextPenWidth( nullptr ); // JEY TODO: requires RENDER_SETTINGS
std::vector<wxPoint> textShape; std::vector<wxPoint> textShape;
aText->TransformTextShapeToSegmentList( textShape ); aText->TransformTextShapeToSegmentList( textShape );

View File

@ -195,7 +195,7 @@ wxString TEXT_MOD_GRID_TABLE::GetValue( int aRow, int aCol )
return StringFromValue( m_userUnits, text.GetTextHeight(), true, true ); return StringFromValue( m_userUnits, text.GetTextHeight(), true, true );
case TMC_THICKNESS: case TMC_THICKNESS:
return StringFromValue( m_userUnits, text.GetThickness(), true, true ); return StringFromValue( m_userUnits, text.GetTextPenWidth(), true, true );
case TMC_LAYER: case TMC_LAYER:
return text.GetLayerName(); return text.GetLayerName();
@ -268,7 +268,7 @@ void TEXT_MOD_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue )
break; break;
case TMC_THICKNESS: case TMC_THICKNESS:
text.SetThickness( ValueFromString( m_userUnits, aValue, true ) ); text.SetTextPenWidth( ValueFromString( m_userUnits, aValue, true ) );
break; break;
case TMC_ORIENTATION: case TMC_ORIENTATION:

View File

@ -347,7 +347,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
textMod->SetLayer( layer ); textMod->SetLayer( layer );
textMod->SetTextSize( dsnSettings.GetTextSize( layer ) ); textMod->SetTextSize( dsnSettings.GetTextSize( layer ) );
textMod->SetThickness( dsnSettings.GetTextThickness( layer ) ); textMod->SetTextPenWidth( dsnSettings.GetTextThickness( layer ) );
textMod->SetItalic( dsnSettings.GetTextItalic( layer ) ); textMod->SetItalic( dsnSettings.GetTextItalic( layer ) );
textMod->SetKeepUpright( dsnSettings.GetTextUpright( layer ) ); textMod->SetKeepUpright( dsnSettings.GetTextUpright( layer ) );
textMod->SetTextPos( (wxPoint) cursorPos ); textMod->SetTextPos( (wxPoint) cursorPos );
@ -386,7 +386,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
textPcb->SetMirrored( true ); textPcb->SetMirrored( true );
textPcb->SetTextSize( dsnSettings.GetTextSize( layer ) ); textPcb->SetTextSize( dsnSettings.GetTextSize( layer ) );
textPcb->SetThickness( dsnSettings.GetTextThickness( layer ) ); textPcb->SetTextPenWidth( dsnSettings.GetTextThickness( layer ) );
textPcb->SetItalic( dsnSettings.GetTextItalic( layer ) ); textPcb->SetItalic( dsnSettings.GetTextItalic( layer ) );
textPcb->SetTextPos( (wxPoint) cursorPos ); textPcb->SetTextPos( (wxPoint) cursorPos );
@ -596,7 +596,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
dimension->SetOrigin( (wxPoint) cursorPos, boardSettings.m_DimensionPrecision ); dimension->SetOrigin( (wxPoint) cursorPos, boardSettings.m_DimensionPrecision );
dimension->SetEnd( (wxPoint) cursorPos, boardSettings.m_DimensionPrecision ); dimension->SetEnd( (wxPoint) cursorPos, boardSettings.m_DimensionPrecision );
dimension->Text().SetTextSize( boardSettings.GetTextSize( layer ) ); dimension->Text().SetTextSize( boardSettings.GetTextSize( layer ) );
dimension->Text().SetThickness( boardSettings.GetTextThickness( layer ) ); dimension->Text().SetTextPenWidth( boardSettings.GetTextThickness( layer ) );
dimension->Text().SetItalic( boardSettings.GetTextItalic( layer ) ); dimension->Text().SetItalic( boardSettings.GetTextItalic( layer ) );
dimension->SetWidth( boardSettings.GetLineThickness( layer ) ); dimension->SetWidth( boardSettings.GetLineThickness( layer ) );
dimension->SetUnits( boardSettings.m_DimensionUnits == 2 ? EDA_UNITS::MILLIMETRES : dimension->SetUnits( boardSettings.m_DimensionUnits == 2 ? EDA_UNITS::MILLIMETRES :

View File

@ -359,7 +359,8 @@ public:
/// Display module edges as outlines /// Display module edges as outlines
static TOOL_ACTION moduleEdgeOutlines; static TOOL_ACTION moduleEdgeOutlines;
/// Display module texts as lines /// Display module texts as lines // JEY TODO: if we're going to keep this, it needs
// to be all text, not just module text....
static TOOL_ACTION moduleTextOutlines; static TOOL_ACTION moduleTextOutlines;
// Pad tools // Pad tools

View File

@ -1158,7 +1158,6 @@ void PCBNEW_CONTROL::setTransitions()
Go( &PCBNEW_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() ); Go( &PCBNEW_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::GraphicDisplayMode, PCB_ACTIONS::graphicDisplayMode.MakeEvent() ); Go( &PCBNEW_CONTROL::GraphicDisplayMode, PCB_ACTIONS::graphicDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ModuleEdgeOutlines, PCB_ACTIONS::moduleEdgeOutlines.MakeEvent() ); Go( &PCBNEW_CONTROL::ModuleEdgeOutlines, PCB_ACTIONS::moduleEdgeOutlines.MakeEvent() );
Go( &PCBNEW_CONTROL::ModuleTextOutlines, PCB_ACTIONS::moduleTextOutlines.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayEnable.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayEnable.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayDisable.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayDisable.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayOutlines.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayOutlines.MakeEvent() );