diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 3326acb158..6cf9633cd0 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -528,10 +528,13 @@ EDA_TEXT::GetRenderCache( const KIFONT::FONT* aFont, const wxString& forResolved } -void EDA_TEXT::SetupRenderCache( const wxString& aResolvedText, const EDA_ANGLE& aAngle ) +void EDA_TEXT::SetupRenderCache( const wxString& aResolvedText, const KIFONT::FONT* aFont, + const EDA_ANGLE& aAngle, const VECTOR2I& aOffset ) { m_render_cache_text = aResolvedText; + m_render_cache_font = aFont; m_render_cache_angle = aAngle; + m_render_cache_offset = aOffset; m_render_cache.clear(); } @@ -539,6 +542,7 @@ void EDA_TEXT::SetupRenderCache( const wxString& aResolvedText, const EDA_ANGLE& void EDA_TEXT::AddRenderCacheGlyph( const SHAPE_POLY_SET& aPoly ) { m_render_cache.emplace_back( std::make_unique( aPoly ) ); + static_cast( m_render_cache.back().get() )->CacheTriangulation(); } diff --git a/include/eda_text.h b/include/eda_text.h index fb5f3fd5d9..838c5c011f 100644 --- a/include/eda_text.h +++ b/include/eda_text.h @@ -348,7 +348,8 @@ public: const VECTOR2I& aOffset = { 0, 0 } ) const; // Support for reading the cache from disk. - void SetupRenderCache( const wxString& aResolvedText, const EDA_ANGLE& aAngle ); + void SetupRenderCache( const wxString& aResolvedText, const KIFONT::FONT* aFont, + const EDA_ANGLE& aAngle, const VECTOR2I& aOffset ); void AddRenderCacheGlyph( const SHAPE_POLY_SET& aPoly ); int Compare( const EDA_TEXT* aOther ) const; diff --git a/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.cpp b/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.cpp index b642af7985..096da7d6f9 100644 --- a/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.cpp +++ b/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.cpp @@ -1503,7 +1503,7 @@ void PCB_IO_EASYEDAPRO_PARSER::ParseBoard( if( font != wxS( "default" ) ) { text->SetFont( KIFONT::FONT::GetFont( font ) ); - //text->SetupRenderCache( text->GetShownText(), EDA_ANGLE( angle, DEGREES_T ) ); + //text->SetupRenderCache( text->GetShownText(), text->GetFont(), EDA_ANGLE( angle, DEGREES_T ) ); //text->AddRenderCacheGlyph(); // TODO: import geometry cache diff --git a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp index 2fee4a443f..6993034e6f 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp @@ -640,7 +640,7 @@ void PCB_IO_KICAD_SEXPR_PARSER::parseRenderCache( EDA_TEXT* text ) wxString cacheText = From_UTF8( CurText() ); EDA_ANGLE cacheAngle( parseDouble( "render cache angle" ), DEGREES_T ); - text->SetupRenderCache( cacheText, cacheAngle ); + text->SetupRenderCache( cacheText, text->GetFont(), cacheAngle, { 0, 0 } ); for( token = NextTok(); token != T_RIGHT; token = NextTok() ) {