Handle special cases for ending overbar text.

Fixes https://gitlab.com/kicad/code/kicad/issues/6695
This commit is contained in:
Jeff Young 2020-12-10 18:38:06 +00:00
parent 98330098ac
commit 5888d376a7
3 changed files with 23 additions and 2 deletions

View File

@ -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 )
{

View File

@ -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 - ' ';

View File

@ -1034,6 +1034,10 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
overlining = !overlining;
}
}
else if( ch == ' ' || ch == '}' || ch == ')' )
{
overlining = false;
}
putc( ch, m_outputFile );
}