From e1e791fc758387d2e2287b3ebddce8675445f3f9 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 9 Jul 2023 10:51:33 +0200 Subject: [PATCH] *.wks files: always save text font when it is not the default font. From Master branch Fixes #15154 https://gitlab.com/kicad/code/kicad/-/issues/15154 --- common/drawing_sheet/ds_data_model_io.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/drawing_sheet/ds_data_model_io.cpp b/common/drawing_sheet/ds_data_model_io.cpp index b346058818..10769670a0 100644 --- a/common/drawing_sheet/ds_data_model_io.cpp +++ b/common/drawing_sheet/ds_data_model_io.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2013-2016 CERN - * Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors. * * @author Jean-Pierre Charras, jp.charras at wanadoo.fr * @@ -247,13 +247,14 @@ void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_TEXT* aItem, int aNestLevel ) const // Write font info, only if it is not the default setup bool write_size = aItem->m_TextSize.x != 0.0 || aItem->m_TextSize.y != 0.0; bool write_thickness = aItem->m_LineWidth != 0.0; + bool write_face = aItem->m_Font && !aItem->m_Font->GetName().IsEmpty(); - if( write_thickness || write_size || aItem->m_Bold - || aItem->m_Italic || aItem->m_TextColor != COLOR4D::UNSPECIFIED ) + if( write_thickness || write_size || aItem->m_Bold || aItem->m_Italic + || write_face || aItem->m_TextColor != COLOR4D::UNSPECIFIED ) { m_out->Print( 0, " (font" ); - if( aItem->m_Font && !aItem->m_Font->GetName().IsEmpty() ) + if( write_face ) m_out->Print( 0, " (face \"%s\")", aItem->m_Font->NameAsToken() ); if( write_thickness )