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,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold )
|
||||
bool aBold,
|
||||
bool aMultilineAllowed )
|
||||
{
|
||||
if( textAsLines || containsNonAsciiChars( aText ) )
|
||||
/* output text as graphics */
|
||||
// Fix me: see how to use DXF text mode for multiline texts
|
||||
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,
|
||||
aWidth, aItalic, aBold );
|
||||
aWidth, aItalic, aBold, aMultilineAllowed );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 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,
|
||||
int aWidth,
|
||||
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)
|
||||
if( m_textMode != PLOTTEXTMODE_STROKE )
|
||||
if( m_textMode != PLOTTEXTMODE_STROKE && !aMultilineAllowed )
|
||||
{
|
||||
const char *fontname = aItalic ? (aBold ? "/KicadFontBI" : "/KicadFontI")
|
||||
: (aBold ? "/KicadFontB" : "/KicadFont");
|
||||
|
@ -800,10 +805,10 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
|
|||
}
|
||||
|
||||
// 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,
|
||||
aWidth, aItalic, aBold );
|
||||
aWidth, aItalic, aBold, aMultilineAllowed );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -812,27 +812,32 @@ bool PS_PLOTTER::EndPlot()
|
|||
|
||||
|
||||
|
||||
void PS_PLOTTER::Text( const wxPoint& aPos,
|
||||
enum EDA_COLOR_T aColor,
|
||||
const wxString& aText,
|
||||
double aOrient,
|
||||
const wxSize& aSize,
|
||||
enum EDA_TEXT_HJUSTIFY_T aH_justify,
|
||||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold )
|
||||
void PS_PLOTTER::Text( const wxPoint& aPos,
|
||||
enum EDA_COLOR_T aColor,
|
||||
const wxString& aText,
|
||||
double aOrient,
|
||||
const wxSize& aSize,
|
||||
enum EDA_TEXT_HJUSTIFY_T aH_justify,
|
||||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold,
|
||||
bool aMultilineAllowed )
|
||||
{
|
||||
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.
|
||||
|
||||
// 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"
|
||||
: "/KicadFont-Oblique")
|
||||
: (aBold ? "/KicadFont-Bold"
|
||||
: "/KicadFont");
|
||||
: (aBold ? "/KicadFont-Bold"
|
||||
: "/KicadFont");
|
||||
|
||||
// Compute the copious tranformation parameters
|
||||
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 )
|
||||
{
|
||||
fputsPostscriptString( outputFile, aText );
|
||||
DPOINT pos_dev = userToDeviceCoordinates( aPos );
|
||||
DPOINT pos_dev = userToDeviceCoordinates( aPos );
|
||||
fprintf( outputFile, " %g %g phantomshow\n",
|
||||
pos_dev.x, pos_dev.y );
|
||||
}
|
||||
|
||||
// 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,
|
||||
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'
|
||||
{
|
||||
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",
|
||||
(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,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold )
|
||||
bool aBold,
|
||||
bool aMultilineAllowed )
|
||||
{
|
||||
setFillMode( NO_FILL );
|
||||
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
|
||||
|
||||
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 <gr_basic.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <confirm.h>
|
||||
#include <wxEeschemaStruct.h>
|
||||
#include <base_units.h>
|
||||
|
||||
//#include <general.h>
|
||||
#include <sch_sheet.h>
|
||||
|
||||
#include <dialogs/dialog_sch_sheet_props.h>
|
||||
|
|
|
@ -568,7 +568,8 @@ public:
|
|||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold );
|
||||
bool aBold,
|
||||
bool aMultilineAllowed = false );
|
||||
protected:
|
||||
virtual void emitSetRGBColor( double r, double g, double b );
|
||||
};
|
||||
|
@ -633,7 +634,8 @@ public:
|
|||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold );
|
||||
bool aBold,
|
||||
bool aMultilineAllowed = false );
|
||||
|
||||
virtual void PlotImage( const wxImage& aImage, const wxPoint& aPos,
|
||||
double aScaleFactor );
|
||||
|
@ -702,7 +704,8 @@ public:
|
|||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold );
|
||||
bool aBold,
|
||||
bool aMultilineAllowed = false );
|
||||
|
||||
protected:
|
||||
FILL_T m_fillMode; // true if the current contour
|
||||
|
@ -904,7 +907,8 @@ public:
|
|||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||
int aWidth,
|
||||
bool aItalic,
|
||||
bool aBold );
|
||||
bool aBold,
|
||||
bool aMultilineAllowed = false );
|
||||
|
||||
protected:
|
||||
bool textAsLines;
|
||||
|
|
Loading…
Reference in New Issue