From 2cc574ed14a5e61ba2e1e80640344ff888559f35 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 14 Oct 2025 11:10:25 +0100 Subject: [PATCH] Adjust text offset after SCH_/LIB_ merger. (It was upside down as it originated from the flipped coordinate system.) Fixes https://gitlab.com/kicad/code/kicad/-/issues/21802 (cherry picked from commit 507ec29cc04cbb83bcfed53c0678c5f6c998c806) --- eeschema/sch_painter.cpp | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 5ada6fde27..fc8947a6eb 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -1670,6 +1670,19 @@ void SCH_PAINTER::draw( const SCH_TEXT* aText, int aLayer, bool aDimmed ) attrs.m_Angle = aText->GetDrawRotation(); attrs.m_StrokeWidth = KiROUND( getTextThickness( aText ) ); + // Adjust text drawn in an outline font to more closely mimic the positioning of + // SCH_FIELD text. + if( font->IsOutline() && aText->Type() == SCH_TEXT_T ) + { + BOX2I firstLineBBox = aText->GetTextBox( nullptr, 0 ); + int sizeDiff = firstLineBBox.GetHeight() - aText->GetTextSize().y; + int adjust = KiROUND( sizeDiff * 0.35 ); + VECTOR2I adjust_offset( 0, adjust ); + + RotatePoint( adjust_offset, aText->GetDrawRotation() ); + text_offset += adjust_offset; + } + if( drawingShadows && font->IsOutline() ) { BOX2I bBox = aText->GetBoundingBox(); @@ -1775,22 +1788,8 @@ void SCH_PAINTER::draw( const SCH_TEXT* aText, int aLayer, bool aDimmed ) attrs.m_Underlined = true; } - // Adjust text drawn in an outline font to more closely mimic the positioning of - // SCH_FIELD text. - if( font->IsOutline() && aText->Type() == SCH_TEXT_T ) - { - BOX2I firstLineBBox = aText->GetTextBox( nullptr, 0 ); - int sizeDiff = firstLineBBox.GetHeight() - aText->GetTextSize().y; - int adjust = KiROUND( sizeDiff * 0.4 ); - VECTOR2I adjust_offset( 0, - adjust ); - - RotatePoint( adjust_offset, aText->GetDrawRotation() ); - text_offset += adjust_offset; - } - - if( nonCached( aText ) - && aText->RenderAsBitmap( m_gal->GetWorldScale() ) - && !shownText.Contains( wxT( "\n" ) ) ) + if( nonCached( aText ) && aText->RenderAsBitmap( m_gal->GetWorldScale() ) + && !shownText.Contains( wxT( "\n" ) ) ) { bitmapText( *m_gal, shownText, aText->GetDrawPos() + text_offset, attrs ); const_cast( aText )->SetFlags( IS_SHOWN_AS_BITMAP );