From ee3e97e6cabab7de390a3e5cb810cc406302408d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nick=20=C3=98stergaard?= Date: Sat, 19 Apr 2014 18:05:58 +0200 Subject: [PATCH] Fix vertical offset for multiline text in VRML exporter. --- pcbnew/exporters/export_vrml.cpp | 40 +++++++++++++++----------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/pcbnew/exporters/export_vrml.cpp b/pcbnew/exporters/export_vrml.cpp index ae1b37c194..5962ba276b 100644 --- a/pcbnew/exporters/export_vrml.cpp +++ b/pcbnew/exporters/export_vrml.cpp @@ -600,38 +600,36 @@ static void export_vrml_pcbtext( MODEL_VRML& aModel, TEXTE_PCB* text ) if( text->IsMirrored() ) NEGATE( size.x ); + EDA_COLOR_T color = BLACK; // not actually used, but needed by DrawGraphicText + if( text->IsMultilineAllowed() ) { - wxPoint pos = text->GetTextPosition(); wxArrayString* list = wxStringSplit( text->GetText(), '\n' ); - wxPoint offset; + std::vector positions; + positions.reserve( list->Count() ); + text->GetPositionsOfLinesOfMultilineText( positions, list->Count() ); - offset.y = text->GetInterline(); - - RotatePoint( &offset, text->GetOrientation() ); - - for( unsigned i = 0; iCount(); i++ ) + for( unsigned ii = 0; ii < list->Count(); ii++ ) { - wxString txt = list->Item( i ); - DrawGraphicText( NULL, NULL, pos, BLACK, - txt, text->GetOrientation(), size, - text->GetHorizJustify(), text->GetVertJustify(), - text->GetThickness(), text->IsItalic(), - true, - vrml_text_callback ); - pos += offset; + wxString txt = list->Item( ii ); + DrawGraphicText( NULL, NULL, positions[ii], color, + txt, text->GetOrientation(), size, + text->GetHorizJustify(), text->GetVertJustify(), + text->GetThickness(), text->IsItalic(), + true, + vrml_text_callback ); } delete (list); } else { - DrawGraphicText( NULL, NULL, text->GetTextPosition(), BLACK, - text->GetText(), text->GetOrientation(), size, - text->GetHorizJustify(), text->GetVertJustify(), - text->GetThickness(), text->IsItalic(), - true, - vrml_text_callback ); + DrawGraphicText( NULL, NULL, text->GetTextPosition(), color, + text->GetText(), text->GetOrientation(), size, + text->GetHorizJustify(), text->GetVertJustify(), + text->GetThickness(), text->IsItalic(), + true, + vrml_text_callback ); } }