From aa0863cdf48229f5d013893553b13fff0f7b8f5c Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 16 Sep 2022 00:45:43 +0100 Subject: [PATCH] Don't mirror text on non-physical layers when in flip board view. Fixes https://gitlab.com/kicad/code/kicad/issues/10037 --- pcbnew/pcb_painter.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 342876d2c5..7cbfc80f2c 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -1854,6 +1854,12 @@ void PCB_PAINTER::draw( const PCB_TEXT* aText, int aLayer ) else attrs.m_StrokeWidth = getLineThickness( aText->GetEffectiveTextPenWidth() ); + if( m_gal->IsFlippedX() && !( aText->GetLayerSet() & LSET::PhysicalLayersMask() ).any() ) + { + attrs.m_Mirrored = !attrs.m_Mirrored; + attrs.m_Halign = static_cast( -attrs.m_Halign ); + } + std::vector>* cache = aText->GetRenderCache( resolvedText ); if( cache ) @@ -1931,6 +1937,12 @@ void PCB_PAINTER::draw( const PCB_TEXTBOX* aTextBox, int aLayer ) TEXT_ATTRIBUTES attrs = aTextBox->GetAttributes(); attrs.m_StrokeWidth = getLineThickness( aTextBox->GetEffectiveTextPenWidth() ); + if( m_gal->IsFlippedX() && !( aTextBox->GetLayerSet() & LSET::PhysicalLayersMask() ).any() ) + { + attrs.m_Mirrored = !attrs.m_Mirrored; + attrs.m_Halign = static_cast( -attrs.m_Halign ); + } + std::vector>* cache = aTextBox->GetRenderCache( resolvedText ); if( aLayer == LAYER_LOCKED_ITEM_SHADOW ) @@ -2007,6 +2019,12 @@ void PCB_PAINTER::draw( const FP_TEXT* aText, int aLayer ) else attrs.m_StrokeWidth = getLineThickness( aText->GetEffectiveTextPenWidth() ); + if( m_gal->IsFlippedX() && !( aText->GetLayerSet() & LSET::PhysicalLayersMask() ).any() ) + { + attrs.m_Mirrored = !attrs.m_Mirrored; + attrs.m_Halign = static_cast( -attrs.m_Halign ); + } + std::vector>* cache = aText->GetRenderCache( resolvedText ); if( cache ) @@ -2076,6 +2094,12 @@ void PCB_PAINTER::draw( const FP_TEXTBOX* aTextBox, int aLayer ) attrs.m_Angle = aTextBox->GetDrawRotation(); attrs.m_StrokeWidth = getLineThickness( aTextBox->GetEffectiveTextPenWidth() ); + if( m_gal->IsFlippedX() && !( aTextBox->GetLayerSet() & LSET::PhysicalLayersMask() ).any() ) + { + attrs.m_Mirrored = !attrs.m_Mirrored; + attrs.m_Halign = static_cast( -attrs.m_Halign ); + } + std::vector>* cache = aTextBox->GetRenderCache( resolvedText ); if( cache ) @@ -2350,6 +2374,9 @@ void PCB_PAINTER::draw( const PCB_DIMENSION_BASE* aDimension, int aLayer ) wxString resolvedText = text.GetShownText(); TEXT_ATTRIBUTES attrs = text.GetAttributes(); + if( m_gal->IsFlippedX() && !( aDimension->GetLayerSet() & LSET::PhysicalLayersMask() ).any() ) + attrs.m_Mirrored = !attrs.m_Mirrored; + if( outline_mode ) attrs.m_StrokeWidth = m_pcbSettings.m_outlineWidth; else