7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-11 14:50:11 +00:00

Don't discard render cache when substituting font.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18672
This commit is contained in:
Jeff Young 2024-12-24 20:06:06 +00:00
parent 3d9784ded3
commit 61dac76224
3 changed files with 16 additions and 3 deletions
common
include
pcbnew/pcb_io/kicad_sexpr

View File

@ -495,6 +495,15 @@ void EDA_TEXT::SetFont( KIFONT::FONT* aFont )
}
void EDA_TEXT::AssignFont( KIFONT::FONT* aFont )
{
m_attributes.m_Font = aFont;
if( !m_render_cache.empty() )
m_render_cache_font = aFont;
}
void EDA_TEXT::SetLineSpacing( double aLineSpacing )
{
m_attributes.m_LineSpacing = aLineSpacing;

View File

@ -233,6 +233,10 @@ public:
void SetFont( KIFONT::FONT* aFont );
KIFONT::FONT* GetFont() const { return m_attributes.m_Font; }
// This sets a font WITHOUT invalidating the render cache. Use it when reading a document
// to assign a font to be used only if the item is edited.
void AssignFont( KIFONT::FONT* aFont );
wxString GetFontName() const;
void SetFontIndex( int aIdx );

View File

@ -875,9 +875,9 @@ BOARD_ITEM* PCB_IO_KICAD_SEXPR_PARSER::Parse()
{
const std::vector<wxString>* embeddedFonts = item->GetEmbeddedFiles()->UpdateFontFiles();
text->SetFont( KIFONT::FONT::GetFont( std::get<0>( params ), std::get<1>( params ),
std::get<2>( params ),
embeddedFonts ) );
text->AssignFont( KIFONT::FONT::GetFont( std::get<0>( params ), std::get<1>( params ),
std::get<2>( params ),
embeddedFonts ) );
}
resolveGroups( item );