diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 9ee476a4d5..06d0bcbac1 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -1297,6 +1297,10 @@ void OPENGL_GAL::BitmapText( const wxString& aText, const VECTOR2D& aPosition, overbar = !overbar; } } + else if( c == ' ' || c == '}' || c == ')' ) + { + overbar = false; + } if( wasOverbar && !overbar ) { diff --git a/common/gal/stroke_font.cpp b/common/gal/stroke_font.cpp index dc4f265c16..9ec77961da 100644 --- a/common/gal/stroke_font.cpp +++ b/common/gal/stroke_font.cpp @@ -356,6 +356,9 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText ) glyphSize = baseGlyphSize; yOffset = 0; + + // Tab ends an overbar + in_overbar = false; } else if( *chIt == '~' ) { @@ -410,6 +413,11 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText ) yOffset = 0; continue; } + // Overbar syntax is less precise so we have to have some special cases + else if( in_overbar && ( *chIt == ' ' || *chIt == '}' || *chIt == ')' ) ) + { + in_overbar = false; + } // Index into bounding boxes table int dd = (signed) *chIt - ' '; @@ -550,8 +558,8 @@ VECTOR2D STROKE_FONT::ComputeStringBoundaryLimits( const UTF8& aText, const VECT // Add the remaining space (between 0 and 3 spaces) curX += addlSpace; - // Tab ends a super- or subscript - curScale = 1.0; + // Tab ends an overbar + in_overbar = false; } else if( *it == '~' ) { @@ -591,6 +599,11 @@ VECTOR2D STROKE_FONT::ComputeStringBoundaryLimits( const UTF8& aText, const VECT curScale = 1.0; continue; } + // Overbar syntax is less precise so we have to have some special cases + else if( in_overbar && ( *it == ' ' || *it == '}' || *it == ')' ) ) + { + in_overbar = false; + } // Index in the bounding boxes table int dd = (signed) *it - ' '; diff --git a/common/plotters/DXF_plotter.cpp b/common/plotters/DXF_plotter.cpp index b03b5a4315..f1334f2d8b 100644 --- a/common/plotters/DXF_plotter.cpp +++ b/common/plotters/DXF_plotter.cpp @@ -1034,6 +1034,10 @@ void DXF_PLOTTER::Text( const wxPoint& aPos, overlining = !overlining; } } + else if( ch == ' ' || ch == '}' || ch == ')' ) + { + overlining = false; + } putc( ch, m_outputFile ); }