Loading common/gal/stroke_font.cpp +9 −8 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <gal/stroke_font.h> #include <gal/stroke_font.h> #include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h> #include <wx/string.h> using namespace KIGFX; using namespace KIGFX; Loading Loading @@ -142,7 +143,7 @@ BOX2D STROKE_FONT::computeBoundingBox( const GLYPH& aGLYPH, const VECTOR2D& aGLY } } void STROKE_FONT::Draw( std::wstring aText, const VECTOR2D& aPosition, double aRotationAngle ) void STROKE_FONT::Draw( wxString aText, const VECTOR2D& aPosition, double aRotationAngle ) { { // By default overbar is turned off // By default overbar is turned off m_overbar = false; m_overbar = false; Loading @@ -154,14 +155,14 @@ void STROKE_FONT::Draw( std::wstring aText, const VECTOR2D& aPosition, double aR m_gal->Rotate( -aRotationAngle ); m_gal->Rotate( -aRotationAngle ); // Split multiline strings into separate ones and draw them line by line // Split multiline strings into separate ones and draw them line by line size_t newlinePos = aText.find( '\n' ); int newlinePos = aText.Find( '\n' ); if( newlinePos != std::wstring::npos ) if( newlinePos != wxNOT_FOUND ) { { VECTOR2D nextlinePosition = VECTOR2D( 0.0, m_glyphSize.y * LINE_HEIGHT_RATIO ); VECTOR2D nextlinePosition = VECTOR2D( 0.0, m_glyphSize.y * LINE_HEIGHT_RATIO ); Draw( aText.substr( newlinePos + 1 ), nextlinePosition, 0.0 ); Draw( aText.Mid( newlinePos + 1 ), nextlinePosition, 0.0 ); aText = aText.substr( 0, newlinePos ); aText = aText.Mid( 0, newlinePos ); } } // Compute the text size // Compute the text size Loading Loading @@ -233,7 +234,7 @@ void STROKE_FONT::Draw( std::wstring aText, const VECTOR2D& aPosition, double aR m_gal->SetLineWidth( m_gal->GetLineWidth() * 1.3 ); m_gal->SetLineWidth( m_gal->GetLineWidth() * 1.3 ); } } for( std::wstring::const_iterator chIt = aText.begin(); chIt != aText.end(); chIt++ ) for( wxString::const_iterator chIt = aText.begin(); chIt != aText.end(); chIt++ ) { { if( *chIt == '~' ) if( *chIt == '~' ) { { Loading Loading @@ -292,11 +293,11 @@ void STROKE_FONT::Draw( std::wstring aText, const VECTOR2D& aPosition, double aR } } VECTOR2D STROKE_FONT::computeTextSize( const std::wstring& aText ) const VECTOR2D STROKE_FONT::computeTextSize( const wxString& aText ) const { { VECTOR2D result = VECTOR2D( 0.0, m_glyphSize.y ); VECTOR2D result = VECTOR2D( 0.0, m_glyphSize.y ); for( std::wstring::const_iterator chIt = aText.begin(); chIt != aText.end(); chIt++ ) for( wxString::const_iterator chIt = aText.begin(); chIt != aText.end(); chIt++ ) { { if( *chIt == '~' ) if( *chIt == '~' ) continue; continue; Loading include/gal/graphics_abstraction_layer.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -277,7 +277,7 @@ public: * @param aPosition is the text position in world coordinates. * @param aPosition is the text position in world coordinates. * @param aRotationAngle is the text rotation angle. * @param aRotationAngle is the text rotation angle. */ */ inline virtual void StrokeText( const std::wstring& aText, const VECTOR2D& aPosition, inline virtual void StrokeText( const wxString& aText, const VECTOR2D& aPosition, double aRotationAngle ) double aRotationAngle ) { { strokeFont.Draw( aText, aPosition, aRotationAngle ); strokeFont.Draw( aText, aPosition, aRotationAngle ); Loading include/gal/stroke_font.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -73,7 +73,7 @@ public: * @param aPosition is the text position in world coordinates. * @param aPosition is the text position in world coordinates. * @param aRotationAngle is the text rotation angle. * @param aRotationAngle is the text rotation angle. */ */ void Draw( std::wstring aText, const VECTOR2D& aPosition, double aRotationAngle ); void Draw( wxString aText, const VECTOR2D& aPosition, double aRotationAngle ); /** /** * @brief Set the scale factor of the font for the glyph size. * @brief Set the scale factor of the font for the glyph size. Loading Loading @@ -180,7 +180,7 @@ private: * @param aText is the text string. * @param aText is the text string. * @return is the text size. * @return is the text size. */ */ VECTOR2D computeTextSize( const std::wstring& aText ) const; VECTOR2D computeTextSize( const wxString& aText ) const; static const double LINE_HEIGHT_RATIO; static const double LINE_HEIGHT_RATIO; }; }; Loading pcbnew/pcb_painter.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -719,7 +719,7 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer ) m_gal->SetStrokeColor( strokeColor ); m_gal->SetStrokeColor( strokeColor ); m_gal->SetLineWidth( aText->GetThickness() ); m_gal->SetLineWidth( aText->GetThickness() ); m_gal->SetTextAttributes( aText ); m_gal->SetTextAttributes( aText ); m_gal->StrokeText( std::wstring( aText->GetText().wc_str() ), position, orientation ); m_gal->StrokeText( aText->GetText(), position, orientation ); } } Loading @@ -735,7 +735,7 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer ) m_gal->SetStrokeColor( strokeColor ); m_gal->SetStrokeColor( strokeColor ); m_gal->SetLineWidth( aText->GetThickness() ); m_gal->SetLineWidth( aText->GetThickness() ); m_gal->SetTextAttributes( aText ); m_gal->SetTextAttributes( aText ); m_gal->StrokeText( std::wstring( aText->GetText().wc_str() ), position, orientation ); m_gal->StrokeText( aText->GetText(), position, orientation ); } } Loading Loading
common/gal/stroke_font.cpp +9 −8 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <gal/stroke_font.h> #include <gal/stroke_font.h> #include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h> #include <wx/string.h> using namespace KIGFX; using namespace KIGFX; Loading Loading @@ -142,7 +143,7 @@ BOX2D STROKE_FONT::computeBoundingBox( const GLYPH& aGLYPH, const VECTOR2D& aGLY } } void STROKE_FONT::Draw( std::wstring aText, const VECTOR2D& aPosition, double aRotationAngle ) void STROKE_FONT::Draw( wxString aText, const VECTOR2D& aPosition, double aRotationAngle ) { { // By default overbar is turned off // By default overbar is turned off m_overbar = false; m_overbar = false; Loading @@ -154,14 +155,14 @@ void STROKE_FONT::Draw( std::wstring aText, const VECTOR2D& aPosition, double aR m_gal->Rotate( -aRotationAngle ); m_gal->Rotate( -aRotationAngle ); // Split multiline strings into separate ones and draw them line by line // Split multiline strings into separate ones and draw them line by line size_t newlinePos = aText.find( '\n' ); int newlinePos = aText.Find( '\n' ); if( newlinePos != std::wstring::npos ) if( newlinePos != wxNOT_FOUND ) { { VECTOR2D nextlinePosition = VECTOR2D( 0.0, m_glyphSize.y * LINE_HEIGHT_RATIO ); VECTOR2D nextlinePosition = VECTOR2D( 0.0, m_glyphSize.y * LINE_HEIGHT_RATIO ); Draw( aText.substr( newlinePos + 1 ), nextlinePosition, 0.0 ); Draw( aText.Mid( newlinePos + 1 ), nextlinePosition, 0.0 ); aText = aText.substr( 0, newlinePos ); aText = aText.Mid( 0, newlinePos ); } } // Compute the text size // Compute the text size Loading Loading @@ -233,7 +234,7 @@ void STROKE_FONT::Draw( std::wstring aText, const VECTOR2D& aPosition, double aR m_gal->SetLineWidth( m_gal->GetLineWidth() * 1.3 ); m_gal->SetLineWidth( m_gal->GetLineWidth() * 1.3 ); } } for( std::wstring::const_iterator chIt = aText.begin(); chIt != aText.end(); chIt++ ) for( wxString::const_iterator chIt = aText.begin(); chIt != aText.end(); chIt++ ) { { if( *chIt == '~' ) if( *chIt == '~' ) { { Loading Loading @@ -292,11 +293,11 @@ void STROKE_FONT::Draw( std::wstring aText, const VECTOR2D& aPosition, double aR } } VECTOR2D STROKE_FONT::computeTextSize( const std::wstring& aText ) const VECTOR2D STROKE_FONT::computeTextSize( const wxString& aText ) const { { VECTOR2D result = VECTOR2D( 0.0, m_glyphSize.y ); VECTOR2D result = VECTOR2D( 0.0, m_glyphSize.y ); for( std::wstring::const_iterator chIt = aText.begin(); chIt != aText.end(); chIt++ ) for( wxString::const_iterator chIt = aText.begin(); chIt != aText.end(); chIt++ ) { { if( *chIt == '~' ) if( *chIt == '~' ) continue; continue; Loading
include/gal/graphics_abstraction_layer.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -277,7 +277,7 @@ public: * @param aPosition is the text position in world coordinates. * @param aPosition is the text position in world coordinates. * @param aRotationAngle is the text rotation angle. * @param aRotationAngle is the text rotation angle. */ */ inline virtual void StrokeText( const std::wstring& aText, const VECTOR2D& aPosition, inline virtual void StrokeText( const wxString& aText, const VECTOR2D& aPosition, double aRotationAngle ) double aRotationAngle ) { { strokeFont.Draw( aText, aPosition, aRotationAngle ); strokeFont.Draw( aText, aPosition, aRotationAngle ); Loading
include/gal/stroke_font.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -73,7 +73,7 @@ public: * @param aPosition is the text position in world coordinates. * @param aPosition is the text position in world coordinates. * @param aRotationAngle is the text rotation angle. * @param aRotationAngle is the text rotation angle. */ */ void Draw( std::wstring aText, const VECTOR2D& aPosition, double aRotationAngle ); void Draw( wxString aText, const VECTOR2D& aPosition, double aRotationAngle ); /** /** * @brief Set the scale factor of the font for the glyph size. * @brief Set the scale factor of the font for the glyph size. Loading Loading @@ -180,7 +180,7 @@ private: * @param aText is the text string. * @param aText is the text string. * @return is the text size. * @return is the text size. */ */ VECTOR2D computeTextSize( const std::wstring& aText ) const; VECTOR2D computeTextSize( const wxString& aText ) const; static const double LINE_HEIGHT_RATIO; static const double LINE_HEIGHT_RATIO; }; }; Loading
pcbnew/pcb_painter.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -719,7 +719,7 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer ) m_gal->SetStrokeColor( strokeColor ); m_gal->SetStrokeColor( strokeColor ); m_gal->SetLineWidth( aText->GetThickness() ); m_gal->SetLineWidth( aText->GetThickness() ); m_gal->SetTextAttributes( aText ); m_gal->SetTextAttributes( aText ); m_gal->StrokeText( std::wstring( aText->GetText().wc_str() ), position, orientation ); m_gal->StrokeText( aText->GetText(), position, orientation ); } } Loading @@ -735,7 +735,7 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer ) m_gal->SetStrokeColor( strokeColor ); m_gal->SetStrokeColor( strokeColor ); m_gal->SetLineWidth( aText->GetThickness() ); m_gal->SetLineWidth( aText->GetThickness() ); m_gal->SetTextAttributes( aText ); m_gal->SetTextAttributes( aText ); m_gal->StrokeText( std::wstring( aText->GetText().wc_str() ), position, orientation ); m_gal->StrokeText( aText->GetText(), position, orientation ); } } Loading