From d587bd5bcaf63ef3ceaa99b755075de7382fa0ba Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 9 Jan 2020 18:07:37 +0100 Subject: [PATCH] SVG plotter: fix an issue with mirrored texts. Mirrored texts have a size < 0. Of course, the actual value for the plotter is the absolute value. --- common/plotters/SVG_plotter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/plotters/SVG_plotter.cpp b/common/plotters/SVG_plotter.cpp index 3ae2a38092..8f56a71d6b 100644 --- a/common/plotters/SVG_plotter.cpp +++ b/common/plotters/SVG_plotter.cpp @@ -804,8 +804,10 @@ void SVG_PLOTTER::Text( const wxPoint& aPos, } wxSize text_size; - text_size.x = GraphicTextWidth( aText, aSize, aItalic, width ); - text_size.y = aSize.x * 4/3; // Hershey font height to em size conversion + // aSize.x or aSize.y is < 0 for mirrored texts. + // The actual text size value is the absolue value + text_size.x = std::abs( GraphicTextWidth( aText, aSize, aItalic, width ) ); + text_size.y = std::abs( aSize.x * 4/3 ); // Hershey font height to em size conversion DPOINT anchor_pos_dev = userToDeviceCoordinates( aPos ); DPOINT text_pos_dev = userToDeviceCoordinates( text_pos ); DPOINT sz_dev = userToDeviceSize( text_size );