Plots function: fix a bug about virtual PLOTTER::Text, which was not virtual for derived classes due to a missing parameter in ::Text in these classes. Noticeable only in SVG plot.
SVG plot, fix a missing reinitialization in plot lines, which could define a filled polyline, instead of a simple polyline (these fixes solve Bug #1313084 )
This commit is contained in:
parent
a990c9f047
commit
7b843ecac8
|
@ -570,12 +570,21 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
|
||||||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold )
|
bool aBold,
|
||||||
|
bool aMultilineAllowed )
|
||||||
{
|
{
|
||||||
if( textAsLines || containsNonAsciiChars( aText ) )
|
// Fix me: see how to use DXF text mode for multiline texts
|
||||||
/* output text as graphics */
|
if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) )
|
||||||
|
aMultilineAllowed = false; // the text has only one line.
|
||||||
|
|
||||||
|
if( textAsLines || containsNonAsciiChars( aText ) || aMultilineAllowed )
|
||||||
|
{
|
||||||
|
// output text as graphics.
|
||||||
|
// Perhaps miltiline texts could be handled as DXF text entity
|
||||||
|
// but I do not want spend time about this (JPC)
|
||||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
||||||
aWidth, aItalic, aBold );
|
aWidth, aItalic, aBold, aMultilineAllowed );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Emit text as a text entity. This loses formatting and shape but it's
|
/* Emit text as a text entity. This loses formatting and shape but it's
|
||||||
|
|
|
@ -741,10 +741,15 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
|
||||||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold )
|
bool aBold,
|
||||||
|
bool aMultilineAllowed )
|
||||||
{
|
{
|
||||||
|
// 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.
|
||||||
|
|
||||||
// Emit native PDF text (if requested)
|
// Emit native PDF text (if requested)
|
||||||
if( m_textMode != PLOTTEXTMODE_STROKE )
|
if( m_textMode != PLOTTEXTMODE_STROKE && !aMultilineAllowed )
|
||||||
{
|
{
|
||||||
const char *fontname = aItalic ? (aBold ? "/KicadFontBI" : "/KicadFontI")
|
const char *fontname = aItalic ? (aBold ? "/KicadFontBI" : "/KicadFontI")
|
||||||
: (aBold ? "/KicadFontB" : "/KicadFont");
|
: (aBold ? "/KicadFontB" : "/KicadFont");
|
||||||
|
@ -800,10 +805,10 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plot the stroked text (if requested)
|
// Plot the stroked text (if requested)
|
||||||
if( m_textMode != PLOTTEXTMODE_NATIVE )
|
if( m_textMode != PLOTTEXTMODE_NATIVE || aMultilineAllowed )
|
||||||
{
|
{
|
||||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
||||||
aWidth, aItalic, aBold );
|
aWidth, aItalic, aBold, aMultilineAllowed );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -812,27 +812,32 @@ bool PS_PLOTTER::EndPlot()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PS_PLOTTER::Text( const wxPoint& aPos,
|
void PS_PLOTTER::Text( const wxPoint& aPos,
|
||||||
enum EDA_COLOR_T aColor,
|
enum EDA_COLOR_T aColor,
|
||||||
const wxString& aText,
|
const wxString& aText,
|
||||||
double aOrient,
|
double aOrient,
|
||||||
const wxSize& aSize,
|
const wxSize& aSize,
|
||||||
enum EDA_TEXT_HJUSTIFY_T aH_justify,
|
enum EDA_TEXT_HJUSTIFY_T aH_justify,
|
||||||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold )
|
bool aBold,
|
||||||
|
bool aMultilineAllowed )
|
||||||
{
|
{
|
||||||
SetCurrentLineWidth( aWidth );
|
SetCurrentLineWidth( aWidth );
|
||||||
SetColor( aColor );
|
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.
|
||||||
|
|
||||||
// Draw the native postscript text (if requested)
|
// Draw the native postscript text (if requested)
|
||||||
if( m_textMode == PLOTTEXTMODE_NATIVE )
|
if( m_textMode == PLOTTEXTMODE_NATIVE && !aMultilineAllowed )
|
||||||
{
|
{
|
||||||
const char *fontname = aItalic ? (aBold ? "/KicadFont-BoldOblique"
|
const char *fontname = aItalic ? (aBold ? "/KicadFont-BoldOblique"
|
||||||
: "/KicadFont-Oblique")
|
: "/KicadFont-Oblique")
|
||||||
: (aBold ? "/KicadFont-Bold"
|
: (aBold ? "/KicadFont-Bold"
|
||||||
: "/KicadFont");
|
: "/KicadFont");
|
||||||
|
|
||||||
// Compute the copious tranformation parameters
|
// Compute the copious tranformation parameters
|
||||||
double ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f;
|
double ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f;
|
||||||
|
@ -874,16 +879,16 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
|
||||||
if( m_textMode == PLOTTEXTMODE_PHANTOM )
|
if( m_textMode == PLOTTEXTMODE_PHANTOM )
|
||||||
{
|
{
|
||||||
fputsPostscriptString( outputFile, aText );
|
fputsPostscriptString( outputFile, aText );
|
||||||
DPOINT pos_dev = userToDeviceCoordinates( aPos );
|
DPOINT pos_dev = userToDeviceCoordinates( aPos );
|
||||||
fprintf( outputFile, " %g %g phantomshow\n",
|
fprintf( outputFile, " %g %g phantomshow\n",
|
||||||
pos_dev.x, pos_dev.y );
|
pos_dev.x, pos_dev.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the stroked text (if requested)
|
// Draw the stroked text (if requested)
|
||||||
if( m_textMode != PLOTTEXTMODE_NATIVE )
|
if( m_textMode != PLOTTEXTMODE_NATIVE || aMultilineAllowed )
|
||||||
{
|
{
|
||||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
||||||
aWidth, aItalic, aBold );
|
aWidth, aItalic, aBold, aMultilineAllowed );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -478,6 +478,15 @@ void SVG_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
||||||
if( penState == 'Z' ) // here plume = 'D' or 'U'
|
if( penState == 'Z' ) // here plume = 'D' or 'U'
|
||||||
{
|
{
|
||||||
DPOINT pos_dev = userToDeviceCoordinates( pos );
|
DPOINT pos_dev = userToDeviceCoordinates( pos );
|
||||||
|
|
||||||
|
// Ensure we do not use a fill mode when moving tne pen,
|
||||||
|
// in SVG mode (i;e. we are plotting only basic lines, not a filled area
|
||||||
|
if( m_fillMode != NO_FILL )
|
||||||
|
{
|
||||||
|
setFillMode( NO_FILL );
|
||||||
|
setSVGPlotStyle();
|
||||||
|
}
|
||||||
|
|
||||||
fprintf( outputFile, "<path d=\"M%d %d\n",
|
fprintf( outputFile, "<path d=\"M%d %d\n",
|
||||||
(int) pos_dev.x, (int) pos_dev.y );
|
(int) pos_dev.x, (int) pos_dev.y );
|
||||||
}
|
}
|
||||||
|
@ -572,7 +581,8 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
|
||||||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold )
|
bool aBold,
|
||||||
|
bool aMultilineAllowed )
|
||||||
{
|
{
|
||||||
setFillMode( NO_FILL );
|
setFillMode( NO_FILL );
|
||||||
SetColor( aColor );
|
SetColor( aColor );
|
||||||
|
@ -581,5 +591,5 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
|
||||||
// TODO: see if the postscript native text code can be used in SVG plotter
|
// TODO: see if the postscript native text code can be used in SVG plotter
|
||||||
|
|
||||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
||||||
aWidth, aItalic, aBold );
|
aWidth, aItalic, aBold, aMultilineAllowed );
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,13 +27,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
//#include <gr_basic.h>
|
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <wxEeschemaStruct.h>
|
#include <wxEeschemaStruct.h>
|
||||||
#include <base_units.h>
|
#include <base_units.h>
|
||||||
|
|
||||||
//#include <general.h>
|
|
||||||
#include <sch_sheet.h>
|
#include <sch_sheet.h>
|
||||||
|
|
||||||
#include <dialogs/dialog_sch_sheet_props.h>
|
#include <dialogs/dialog_sch_sheet_props.h>
|
||||||
|
|
|
@ -568,7 +568,8 @@ public:
|
||||||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold );
|
bool aBold,
|
||||||
|
bool aMultilineAllowed = false );
|
||||||
protected:
|
protected:
|
||||||
virtual void emitSetRGBColor( double r, double g, double b );
|
virtual void emitSetRGBColor( double r, double g, double b );
|
||||||
};
|
};
|
||||||
|
@ -633,7 +634,8 @@ public:
|
||||||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold );
|
bool aBold,
|
||||||
|
bool aMultilineAllowed = false );
|
||||||
|
|
||||||
virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
|
virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
|
||||||
double aScaleFactor );
|
double aScaleFactor );
|
||||||
|
@ -702,7 +704,8 @@ public:
|
||||||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold );
|
bool aBold,
|
||||||
|
bool aMultilineAllowed = false );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FILL_T m_fillMode; // true if the current contour
|
FILL_T m_fillMode; // true if the current contour
|
||||||
|
@ -904,7 +907,8 @@ public:
|
||||||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold );
|
bool aBold,
|
||||||
|
bool aMultilineAllowed = false );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool textAsLines;
|
bool textAsLines;
|
||||||
|
|
Loading…
Reference in New Issue