Handle text color when printing and plotting.
Fixes https://gitlab.com/kicad/code/kicad/issues/11491
This commit is contained in:
parent
3ef397b4bd
commit
3589eb33f0
|
@ -127,10 +127,14 @@ void LIB_FIELD::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
|
|||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
COLOR4D color = aSettings->GetLayerColor( IsVisible() ? GetDefaultLayer() : LAYER_HIDDEN );
|
||||
bool blackAndWhiteMode = GetGRForceBlackPenState();
|
||||
int penWidth = GetEffectivePenWidth( aSettings );
|
||||
VECTOR2I text_pos = aTransform.TransformCoordinate( GetTextPos() ) + aOffset;
|
||||
wxString text = aData ? *static_cast<wxString*>( aData ) : GetText();
|
||||
|
||||
if( !blackAndWhiteMode && GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = GetTextColor();
|
||||
|
||||
GRPrintText( DC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(),
|
||||
GetVertJustify(), penWidth, IsItalic(), IsBold(), GetDrawFont() );
|
||||
}
|
||||
|
@ -322,9 +326,16 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
|
|||
COLOR4D color;
|
||||
|
||||
if( aPlotter->GetColorMode() )
|
||||
color = aPlotter->RenderSettings()->GetLayerColor( GetDefaultLayer() );
|
||||
{
|
||||
if( GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = GetTextColor();
|
||||
else
|
||||
color = aPlotter->RenderSettings()->GetLayerColor( GetDefaultLayer() );
|
||||
}
|
||||
else
|
||||
{
|
||||
color = COLOR4D::BLACK;
|
||||
}
|
||||
|
||||
int penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
|
||||
|
||||
|
|
|
@ -279,10 +279,17 @@ void LIB_TEXT::Plot( PLOTTER* plotter, bool aBackground, const VECTOR2I& offset,
|
|||
// Get color
|
||||
COLOR4D color;
|
||||
|
||||
if( plotter->GetColorMode() ) // Used normal color or selected color
|
||||
color = plotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
|
||||
if( plotter->GetColorMode() )
|
||||
{
|
||||
if( GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = GetTextColor();
|
||||
else
|
||||
color = plotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
|
||||
}
|
||||
else
|
||||
{
|
||||
color = COLOR4D::BLACK;
|
||||
}
|
||||
|
||||
RENDER_SETTINGS* settings = plotter->RenderSettings();
|
||||
|
||||
|
@ -316,8 +323,12 @@ void LIB_TEXT::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
|
|||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
|
||||
bool blackAndWhiteMode = GetGRForceBlackPenState();
|
||||
int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||
|
||||
if( !blackAndWhiteMode && GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = GetTextColor();
|
||||
|
||||
// Calculate the text orientation, according to the symbol orientation/mirror (needed when
|
||||
// draw text in schematic)
|
||||
EDA_ANGLE orient = GetTextAngle();
|
||||
|
|
|
@ -236,6 +236,9 @@ void LIB_TEXTBOX::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffs
|
|||
|
||||
LIB_TEXTBOX text( *this );
|
||||
|
||||
if( !blackAndWhiteMode && GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = GetTextColor();
|
||||
|
||||
penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetMinPenWidth() );
|
||||
|
||||
if( aTransform.y1 )
|
||||
|
@ -338,6 +341,18 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOf
|
|||
|
||||
LIB_TEXTBOX text( *this );
|
||||
|
||||
if( aPlotter->GetColorMode() )
|
||||
{
|
||||
if( GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = GetTextColor();
|
||||
else
|
||||
color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
|
||||
}
|
||||
else
|
||||
{
|
||||
color = COLOR4D::BLACK;
|
||||
}
|
||||
|
||||
penWidth = std::max( GetEffectiveTextPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
|
||||
|
||||
if( aTransform.y1 )
|
||||
|
|
|
@ -324,12 +324,16 @@ void SCH_FIELD::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
|
|||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
COLOR4D color = aSettings->GetLayerColor( IsForceVisible() ? LAYER_HIDDEN : m_layer );
|
||||
bool blackAndWhiteMode = GetGRForceBlackPenState();
|
||||
VECTOR2I textpos;
|
||||
int penWidth = GetEffectiveTextPenWidth( aSettings->GetDefaultPenWidth() );
|
||||
|
||||
if( ( !IsVisible() && !IsForceVisible() ) || IsVoid() )
|
||||
return;
|
||||
|
||||
if( !blackAndWhiteMode && GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = GetTextColor();
|
||||
|
||||
// Calculate the text orientation according to the symbol orientation.
|
||||
EDA_ANGLE orient = GetTextAngle();
|
||||
|
||||
|
@ -934,6 +938,9 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
COLOR4D color = settings->GetLayerColor( GetLayer() );
|
||||
int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
|
||||
|
||||
if( aPlotter->GetColorMode() && GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = GetTextColor();
|
||||
|
||||
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
|
||||
|
||||
if( !IsVisible() )
|
||||
|
|
|
@ -840,6 +840,9 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
COLOR4D color = settings->GetLayerColor( layer );
|
||||
int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
|
||||
|
||||
if( aPlotter->GetColorMode() && GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = GetTextColor();
|
||||
|
||||
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
|
||||
aPlotter->SetCurrentLineWidth( penWidth );
|
||||
|
||||
|
@ -873,9 +876,13 @@ void SCH_LABEL_BASE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aO
|
|||
int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer;
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
COLOR4D color = aSettings->GetLayerColor( layer );
|
||||
bool blackAndWhiteMode = GetGRForceBlackPenState();
|
||||
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||
VECTOR2I text_offset = aOffset + GetSchematicTextOffset( aSettings );
|
||||
|
||||
if( !blackAndWhiteMode && GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = GetTextColor();
|
||||
|
||||
EDA_TEXT::Print( aSettings, text_offset, color );
|
||||
|
||||
CreateGraphicShape( aSettings, s_poly, GetTextPos() + aOffset );
|
||||
|
|
|
@ -288,8 +288,12 @@ KIFONT::FONT* SCH_TEXT::GetDrawFont() const
|
|||
void SCH_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
|
||||
{
|
||||
COLOR4D color = aSettings->GetLayerColor( m_layer );
|
||||
bool blackAndWhiteMode = GetGRForceBlackPenState();
|
||||
VECTOR2I text_offset = aOffset + GetSchematicTextOffset( aSettings );
|
||||
|
||||
if( !blackAndWhiteMode && GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = GetTextColor();
|
||||
|
||||
// Adjust text drawn in an outline font to more closely mimic the positioning of
|
||||
// SCH_FIELD text.
|
||||
if( GetDrawFont()->IsOutline() )
|
||||
|
@ -432,6 +436,9 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
KIFONT::FONT* font = GetDrawFont();
|
||||
VECTOR2I text_offset = GetSchematicTextOffset( aPlotter->RenderSettings() );
|
||||
|
||||
if( aPlotter->GetColorMode() && GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = GetTextColor();
|
||||
|
||||
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
|
||||
aPlotter->SetCurrentLineWidth( penWidth );
|
||||
|
||||
|
|
|
@ -233,6 +233,10 @@ void SCH_TEXTBOX::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffs
|
|||
}
|
||||
|
||||
color = aSettings->GetLayerColor( m_layer );
|
||||
|
||||
if( !blackAndWhiteMode && GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = GetTextColor();
|
||||
|
||||
EDA_TEXT::Print( aSettings, aOffset, color );
|
||||
}
|
||||
|
||||
|
@ -349,6 +353,9 @@ void SCH_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
aPlotter->Rect( m_start, m_end, FILL_T::NO_FILL, penWidth );
|
||||
}
|
||||
|
||||
if( aPlotter->GetColorMode() && GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = GetTextColor();
|
||||
|
||||
penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
|
||||
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
|
||||
aPlotter->SetCurrentLineWidth( penWidth );
|
||||
|
|
Loading…
Reference in New Issue