From 09ddcdbbca3a513ccbcd42e413be479856222a98 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 11 Sep 2021 11:48:57 +0100 Subject: [PATCH] Fix logic error setting bold text. (Reported on Forum.) --- .../dialog_text_and_label_properties.cpp | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/eeschema/dialogs/dialog_text_and_label_properties.cpp b/eeschema/dialogs/dialog_text_and_label_properties.cpp index 3bf70765a6..a5b9bb79cd 100644 --- a/eeschema/dialogs/dialog_text_and_label_properties.cpp +++ b/eeschema/dialogs/dialog_text_and_label_properties.cpp @@ -361,18 +361,23 @@ bool DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow() m_CurrentText->SetShape( (PINSHEETLABEL_SHAPE) m_TextShape->GetSelection() ); int style = m_TextStyle->GetSelection(); + bool wantItalic = ( style & 1 ) > 0; + bool wantBold = (style & 2 ) > 0; - m_CurrentText->SetItalic( ( style & 1 ) ); + m_CurrentText->SetItalic( wantItalic ); - if( ( style & 2 ) && !m_CurrentText->IsBold() ) + if( wantBold != m_CurrentText->IsBold() ) { - m_CurrentText->SetBold( true ); - m_CurrentText->SetTextThickness( GetPenSizeForBold( m_CurrentText->GetTextWidth() ) ); - } - else if( m_CurrentText->IsBold() ) - { - m_CurrentText->SetBold( false ); - m_CurrentText->SetTextThickness( 0 ); // Use default pen width + if( wantBold ) + { + m_CurrentText->SetBold( true ); + m_CurrentText->SetTextThickness( GetPenSizeForBold( m_CurrentText->GetTextWidth() ) ); + } + else + { + m_CurrentText->SetBold( false ); + m_CurrentText->SetTextThickness( 0 ); // Use default pen width + } } m_Parent->UpdateItem( m_CurrentText );