From 3e5ceaa3191d7f78bb422296853827c7aa308840 Mon Sep 17 00:00:00 2001 From: Roberto Fernandez Bautista Date: Tue, 21 May 2024 15:52:24 +0200 Subject: [PATCH] kicad-cli sym export svg: Ensure bounding box is correctly calculated Fixes https://gitlab.com/kicad/code/kicad/-/issues/18062 --- 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 dc80571eb5..cdda54cab3 100644 --- a/eeschema/eeschema_jobs_handler.cpp +++ b/eeschema/eeschema_jobs_handler.cpp @@ -740,7 +740,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 ) ); @@ -750,7 +750,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