Eeschema: Fix incorrect parsing of old schematic files (version 2) for HLabels and GLabels

This commit is contained in:
jean-pierre charras 2018-09-03 19:51:17 +02:00
parent 1d9c9cd10d
commit 202b35bc90
1 changed files with 9 additions and 5 deletions

View File

@ -1366,13 +1366,17 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( FILE_LINE_READER& aReader )
int thickness = 0;
// The following tokens do not exist in version 1 schematic files.
// The following tokens do not exist in version 1 schematic files,
// and not always in version 2 for HLabels and GLabels
if( m_version > 1 )
{
if( strCompare( "Italic", line, &line ) )
text->SetItalic( true );
else if( !strCompare( "~", line, &line ) )
SCH_PARSE_ERROR( _( "expected 'Italics' or '~'" ), aReader, line );
if( m_version > 2 || *line >= ' ' )
{
if( strCompare( "Italic", line, &line ) )
text->SetItalic( true );
else if( !strCompare( "~", line, &line ) )
SCH_PARSE_ERROR( _( "expected 'Italics' or '~'" ), aReader, line );
}
// The thickness token does not exist in older versions of the schematic file format
// so calling parseInt will be made only if the EOL is not reached.