altium: parse text properties (bold, italic, inverted)

This commit is contained in:
Thomas Pointhuber 2020-05-10 18:51:38 +02:00 committed by Jon Evans
parent 96da60d119
commit 5c02c951a9
4 changed files with 27 additions and 7 deletions

View File

@ -436,7 +436,7 @@ types:
- size: 1
- id: rotation
type: f8
- id: mirrored
- id: is_mirrored
type: u1
enum: boolean
- id: strokewidth
@ -447,12 +447,21 @@ types:
- id: is_designator
type: u1
enum: boolean
- size: 4
- size: 2
- id: is_bold
type: u1
enum: boolean
- id: is_italic
type: u1
enum: boolean
- id: font_name
size: 64
type: str # TODO: terminates with [0, 0]
encoding: UTF-16
- size: 22
- id: is_inverted
type: u1
enum: boolean
- size: 21
- id: position
type: u1
enum: text_position

View File

@ -885,11 +885,16 @@ ATEXT6::ATEXT6( ALTIUM_PARSER& aReader )
height = aReader.ReadKicadUnit();
aReader.Skip( 2 );
rotation = aReader.Read<double>();
mirrored = aReader.Read<uint8_t>() != 0;
isMirrored = aReader.Read<uint8_t>() != 0;
strokewidth = aReader.ReadKicadUnit();
isComment = aReader.Read<uint8_t>() != 0;
isDesignator = aReader.Read<uint8_t>() != 0;
aReader.Skip( 90 );
aReader.Skip( 2 );
isBold = aReader.Read<uint8_t>() != 0;
isItalic = aReader.Read<uint8_t>() != 0;
aReader.Skip( 64 ); // font_name
isInverted = aReader.Read<uint8_t>() != 0;
aReader.Skip( 21 );
textposition = static_cast<ALTIUM_TEXT_POSITION>( aReader.Read<uint8_t>() );
/**
* In Altium 14 (subrecord1 == 230) only left bottom is valid? I think there is a bit missing.

View File

@ -630,7 +630,11 @@ struct ATEXT6
double rotation;
uint32_t strokewidth;
ALTIUM_TEXT_POSITION textposition;
bool mirrored;
bool isBold;
bool isItalic;
bool isMirrored;
bool isInverted;
bool isComment;
bool isDesignator;

View File

@ -2316,7 +2316,9 @@ void ALTIUM_PCB::ParseTexts6Data(
tx->SetTextSize( wxSize( elem.height, elem.height ) ); // TODO: parse text width
}
tx->SetTextThickness( elem.strokewidth );
tx->SetMirrored( elem.mirrored );
tx->SetBold( elem.isBold );
tx->SetItalic( elem.isItalic );
tx->SetMirrored( elem.isMirrored );
if( elem.isDesignator || elem.isComment ) // That's just a bold assumption
{
tx->SetHorizJustify( EDA_TEXT_HJUSTIFY_T::GR_TEXT_HJUSTIFY_LEFT );