From f29bacbccd75a35cb63b82ecb09ac12e2442b8b0 Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Fri, 21 Jul 2023 05:08:03 +0500 Subject: [PATCH] Altium PCB import: some tweaks for font sizes. --- pcbnew/plugins/altium/altium_pcb.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/pcbnew/plugins/altium/altium_pcb.cpp b/pcbnew/plugins/altium/altium_pcb.cpp index f397a13d55..cc79a40be9 100644 --- a/pcbnew/plugins/altium/altium_pcb.cpp +++ b/pcbnew/plugins/altium/altium_pcb.cpp @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -3130,15 +3131,21 @@ void ALTIUM_PCB::ConvertTexts6ToFootprintItemOnLayer( FOOTPRINT* aFootprint, con void ALTIUM_PCB::ConvertTexts6ToEdaTextSettings( const ATEXT6& aElem, EDA_TEXT* aEdaText ) { + aEdaText->SetTextSize( VECTOR2I( aElem.height, aElem.height ) ); // TODO: parse text width + if( aElem.fonttype == ALTIUM_TEXT_TYPE::TRUETYPE ) { - // TODO: why is this required? Somehow, truetype size is calculated differently (tuned to Arial) - aEdaText->SetTextSize( VECTOR2I( aElem.height * 0.63, aElem.height * 0.63 ) ); - aEdaText->SetFont( KIFONT::FONT::GetFont( aElem.fontname, aElem.isBold, aElem.isItalic ) ); - } - else - { - aEdaText->SetTextSize( VECTOR2I( aElem.height, aElem.height ) ); // TODO: parse text width + KIFONT::FONT* font = KIFONT::FONT::GetFont( aElem.fontname, aElem.isBold, aElem.isItalic ); + aEdaText->SetFont( font ); + + if( font->IsOutline() ) + { + // TODO: why is this required? Somehow, truetype size is calculated differently + if( font->GetName().Contains( wxS( "Arial" ) ) ) + aEdaText->SetTextSize( VECTOR2I( aElem.height * 0.63, aElem.height * 0.63 ) ); + else + aEdaText->SetTextSize( VECTOR2I( aElem.height * 0.5, aElem.height * 0.5 ) ); + } } aEdaText->SetTextThickness( aElem.strokewidth );