From f5bbf240470b98bb7a28cb1dab64f53b2bdc2639 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 18 May 2020 13:37:05 +0100 Subject: [PATCH] Cleanup unused code that was masking earlier stroking bug. --- common/plotters/PDF_plotter.cpp | 14 +++----- common/plotters/PS_plotter.cpp | 64 ++------------------------------- 2 files changed, 6 insertions(+), 72 deletions(-) diff --git a/common/plotters/PDF_plotter.cpp b/common/plotters/PDF_plotter.cpp index c3da3a944d..5c68eee21e 100644 --- a/common/plotters/PDF_plotter.cpp +++ b/common/plotters/PDF_plotter.cpp @@ -28,14 +28,12 @@ */ #include -#include #include #include #include #include #include #include -#include #include #include #include // for KiROUND @@ -817,16 +815,12 @@ void PDF_PLOTTER::Text( const wxPoint& aPos, if( aSize.x == 0 || aSize.y == 0 ) return; - // Fix me: see how to use PDF text mode for multiline texts - if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) ) - aMultilineAllowed = false; // the text has only one line. - // Render phantom text (which will be searchable) behind the stroke font. This won't // be pixel-accurate, but it doesn't matter for searching. int render_mode = 3; // invisible - const char *fontname = aItalic ? (aBold ? "/KicadFontBI" : "/KicadFontI") - : (aBold ? "/KicadFontB" : "/KicadFont"); + const char *fontname = aItalic ? ( aBold ? "/KicadFontBI" : "/KicadFontI" ) + : ( aBold ? "/KicadFontB" : "/KicadFont" ); // Compute the copious transformation parameters of the Curent Transform Matrix double ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f; @@ -845,8 +839,8 @@ void PDF_PLOTTER::Text( const wxPoint& aPos, for the trig part of the matrix to avoid %g going in exponential format (which is not supported) */ fprintf( workFile, "q %f %f %f %f %g %g cm BT %s %g Tf %d Tr %g Tz ", - ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f, - fontname, heightFactor, render_mode, wideningFactor * 100 ); + ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f, + fontname, heightFactor, render_mode, wideningFactor * 100 ); // The text must be escaped correctly fputsPostscriptString( workFile, aText ); diff --git a/common/plotters/PS_plotter.cpp b/common/plotters/PS_plotter.cpp index 963631306d..81f6146ee4 100644 --- a/common/plotters/PS_plotter.cpp +++ b/common/plotters/PS_plotter.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include // for KiROUND @@ -989,61 +988,6 @@ void PS_PLOTTER::Text( const wxPoint& aPos, SetCurrentLineWidth( aWidth ); SetColor( aColor ); - // Fix me: see how to use PS text mode for multiline texts - if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) ) - aMultilineAllowed = false; // the text has only one line. - - bool processSuperSub = aText.Contains( wxT( "^{" ) ) || aText.Contains( wxT( "_{" ) ); - - // Draw the native postscript text (if requested) - // Currently: does not work: disable it - bool use_native = false; // = m_textMode == PLOT_TEXT_MODE::NATIVE - // && !aMultilineAllowed && !processSuperSub; - - if( use_native ) - { - const char *fontname = aItalic ? (aBold ? "/KicadFont-BoldOblique" - : "/KicadFont-Oblique") - : (aBold ? "/KicadFont-Bold" - : "/KicadFont"); - - // Compute the copious transformation parameters - double ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f; - double wideningFactor, heightFactor; - computeTextParameters( aPos, aText, aOrient, aSize, m_plotMirror, aH_justify, - aV_justify, aWidth, aItalic, aBold, - &wideningFactor, &ctm_a, &ctm_b, &ctm_c, - &ctm_d, &ctm_e, &ctm_f, &heightFactor ); - - - // The text must be escaped correctly, the others are the various - // parameters. The CTM is formatted with %f since sin/cos tends - // to make %g use exponential notation (which is not supported) - fputsPostscriptString( outputFile, aText ); - fprintf( outputFile, " %g [%f %f %f %f %f %f] %g %s textshow\n", - wideningFactor, ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f, - heightFactor, fontname ); - - /* The textshow operator retained the coordinate system, we use it - * to plot the overbars. See the PDF sister function for more - * details */ - - std::vector pos_pairs; - postscriptOverlinePositions( aText, aSize.x, aItalic, aBold, &pos_pairs ); - int overbar_y = KiROUND( aSize.y * 1.1 ); - - for( unsigned i = 0; i < pos_pairs.size(); i += 2) - { - DPOINT dev_from = userToDeviceSize( wxSize( pos_pairs[i], overbar_y ) ); - DPOINT dev_to = userToDeviceSize( wxSize( pos_pairs[i + 1], overbar_y ) ); - fprintf( outputFile, "%g %g %g %g line ", - dev_from.x, dev_from.y, dev_to.x, dev_to.y ); - } - - // Restore the CTM - fputs( "grestore\n", outputFile ); - } - // Draw the hidden postscript text (if requested) if( m_textMode == PLOT_TEXT_MODE::PHANTOM ) { @@ -1052,12 +996,8 @@ void PS_PLOTTER::Text( const wxPoint& aPos, fprintf( outputFile, " %g %g phantomshow\n", pos_dev.x, pos_dev.y ); } - // Draw the stroked text (if requested) - if( !use_native ) - { - PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, - aWidth, aItalic, aBold, aMultilineAllowed ); - } + PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, + aItalic, aBold, aMultilineAllowed ); }