Apply the overbar fixes from the stroke font to bitmap text.
Fixes: lp:1852037 * https://bugs.launchpad.net/kicad/+bug/1852037
This commit is contained in:
parent
fb52124426
commit
89ace3b0d0
|
@ -1178,14 +1178,28 @@ void OPENGL_GAL::BitmapText( const wxString& aText, const VECTOR2D& aPosition,
|
|||
|
||||
bool wasOverbar = overbar;
|
||||
|
||||
if( *chIt == '~' )
|
||||
if( c == '~' )
|
||||
{
|
||||
if( ++chIt == end )
|
||||
break;
|
||||
|
||||
if( *chIt == '~' )
|
||||
c = *chIt;
|
||||
|
||||
if( c == '~' )
|
||||
{
|
||||
// double ~ is really a ~ so go ahead and process the second one
|
||||
|
||||
// so what's a triple ~? It could be a real ~ followed by an overbar, or
|
||||
// it could be an overbar followed by a real ~. The old algorithm did the
|
||||
// later so we will too....
|
||||
auto tempIt = chIt;
|
||||
|
||||
if( ++tempIt < end && *tempIt == '~' )
|
||||
{
|
||||
// eat the first two, toggle overbar, and then process the third
|
||||
++chIt;
|
||||
overbar = !overbar;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -980,7 +980,9 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
|
|||
*/
|
||||
|
||||
bool overlining = false;
|
||||
|
||||
fputs( " 1\n", outputFile );
|
||||
|
||||
for( unsigned i = 0; i < aText.length(); i++ )
|
||||
{
|
||||
/* Here I do a bad thing: writing the output one byte at a time!
|
||||
|
@ -990,6 +992,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
|
|||
Atleast stdio is *supposed* to do output buffering, so there is
|
||||
hope is not too slow */
|
||||
wchar_t ch = aText[i];
|
||||
|
||||
if( ch > 255 )
|
||||
{
|
||||
// I can't encode this...
|
||||
|
@ -999,14 +1002,35 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
|
|||
{
|
||||
if( ch == '~' )
|
||||
{
|
||||
// Handle the overline toggle
|
||||
fputs( overlining ? "%%o" : "%%O", outputFile );
|
||||
overlining = !overlining;
|
||||
}
|
||||
else
|
||||
{
|
||||
putc( ch, outputFile );
|
||||
if( ++i == aText.length() )
|
||||
break;
|
||||
|
||||
ch = aText[i];
|
||||
|
||||
if( ch == '~' )
|
||||
{
|
||||
// double ~ is really a ~ so go ahead and process the second one
|
||||
|
||||
// so what about a triple ~? It could be a real ~ followed by an
|
||||
// overbar, or it could be an overbar followed by a real ~. The old
|
||||
// eeschema algorithm did the later so we will too....
|
||||
if( i + i < aText.length() && aText[i + 1] == '~' )
|
||||
{
|
||||
// eat the first two and toggle overbar
|
||||
++i;
|
||||
fputs( overlining ? "%%o" : "%%O", outputFile );
|
||||
overlining = !overlining;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Handle the overline toggle
|
||||
fputs( overlining ? "%%o" : "%%O", outputFile );
|
||||
overlining = !overlining;
|
||||
}
|
||||
}
|
||||
|
||||
putc( ch, outputFile );
|
||||
}
|
||||
}
|
||||
putc( '\n', outputFile );
|
||||
|
|
Loading…
Reference in New Issue