Fix vertical offset for multiline text in VRML exporter.

This commit is contained in:
Nick Østergaard 2014-04-19 18:05:58 +02:00 committed by jean-pierre charras
parent 5f65d0da93
commit ee3e97e6ca
1 changed files with 19 additions and 21 deletions

View File

@ -600,33 +600,31 @@ static void export_vrml_pcbtext( MODEL_VRML& aModel, TEXTE_PCB* text )
if( text->IsMirrored() ) if( text->IsMirrored() )
NEGATE( size.x ); NEGATE( size.x );
EDA_COLOR_T color = BLACK; // not actually used, but needed by DrawGraphicText
if( text->IsMultilineAllowed() ) if( text->IsMultilineAllowed() )
{ {
wxPoint pos = text->GetTextPosition();
wxArrayString* list = wxStringSplit( text->GetText(), '\n' ); wxArrayString* list = wxStringSplit( text->GetText(), '\n' );
wxPoint offset; std::vector<wxPoint> positions;
positions.reserve( list->Count() );
text->GetPositionsOfLinesOfMultilineText( positions, list->Count() );
offset.y = text->GetInterline(); for( unsigned ii = 0; ii < list->Count(); ii++ )
RotatePoint( &offset, text->GetOrientation() );
for( unsigned i = 0; i<list->Count(); i++ )
{ {
wxString txt = list->Item( i ); wxString txt = list->Item( ii );
DrawGraphicText( NULL, NULL, pos, BLACK, DrawGraphicText( NULL, NULL, positions[ii], color,
txt, text->GetOrientation(), size, txt, text->GetOrientation(), size,
text->GetHorizJustify(), text->GetVertJustify(), text->GetHorizJustify(), text->GetVertJustify(),
text->GetThickness(), text->IsItalic(), text->GetThickness(), text->IsItalic(),
true, true,
vrml_text_callback ); vrml_text_callback );
pos += offset;
} }
delete (list); delete (list);
} }
else else
{ {
DrawGraphicText( NULL, NULL, text->GetTextPosition(), BLACK, DrawGraphicText( NULL, NULL, text->GetTextPosition(), color,
text->GetText(), text->GetOrientation(), size, text->GetText(), text->GetOrientation(), size,
text->GetHorizJustify(), text->GetVertJustify(), text->GetHorizJustify(), text->GetVertJustify(),
text->GetThickness(), text->IsItalic(), text->GetThickness(), text->IsItalic(),