From ee3533baebb19539fc0952c550cf04e2b41646d0 Mon Sep 17 00:00:00 2001 From: Roberto Fernandez Bautista Date: Tue, 21 May 2024 20:00:35 +0000 Subject: [PATCH] kicad-cli sym export svg: Ensure bounding box is correctly calculated Fixes https://gitlab.com/kicad/code/kicad/-/issues/18062 (cherry picked from commit 3e5ceaa3191d7f78bb422296853827c7aa308840) Co-authored-by: Roberto Fernandez Bautista --- eeschema/eeschema_jobs_handler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eeschema/eeschema_jobs_handler.cpp b/eeschema/eeschema_jobs_handler.cpp index 63c159a104..f7a4b31eee 100644 --- a/eeschema/eeschema_jobs_handler.cpp +++ b/eeschema/eeschema_jobs_handler.cpp @@ -733,7 +733,7 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob, } // Get the symbol bounding box to fit the plot page to it - BOX2I symbolBB = symbol->Flatten()->GetUnitBoundingBox( unit, bodyStyle, false ); + BOX2I symbolBB = symbol->Flatten()->GetUnitBoundingBox( unit, bodyStyle, !aSvgJob->m_includeHiddenFields ); PAGE_INFO pageInfo( PAGE_INFO::Custom ); pageInfo.SetHeightMils( schIUScale.IUToMils( symbolBB.GetHeight() * 1.2 ) ); pageInfo.SetWidthMils( schIUScale.IUToMils( symbolBB.GetWidth() * 1.2 ) ); @@ -743,7 +743,7 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob, plotter->SetPageSettings( pageInfo ); plotter->SetColorMode( !aSvgJob->m_blackAndWhite ); - VECTOR2I plot_offset; + VECTOR2I plot_offset = symbolBB.GetCenter(); const double scale = 1.0; // Currently, plot units are in decimal