PDF_plotter: fix crash when the font used to plot texts is not specified.

(In this case the default Kicad font must be used)
Fixes #13615
https://gitlab.com/kicad/code/kicad/issues/13615
This commit is contained in:
jean-pierre charras 2023-01-21 20:11:43 +01:00
parent b2421c7d9f
commit f14e24d2cf
1 changed files with 5 additions and 1 deletions

View File

@ -7,7 +7,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 Lorenzo Marcantonio, l.marcantonio@logossrl.com
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -1385,6 +1385,10 @@ void PDF_PLOTTER::Text( const VECTOR2I& aPos,
wxStringTokenizer str_tok( aText, " ", wxTOKEN_RET_DELIMS );
// If aFont is not specilied (== nullptr), use the default kicad stroke font
if( !aFont )
aFont = KIFONT::FONT::GetFont();
VECTOR2I full_box( aFont->StringBoundaryLimits( aText, aSize, aWidth, aBold, aItalic ) );
VECTOR2I box_x( full_box.x, 0 );
VECTOR2I box_y( 0, full_box.y );