2014-10-19 20:20:16 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2017-11-16 11:45:53 +00:00
|
|
|
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2020-10-15 13:24:26 +00:00
|
|
|
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2014-10-19 20:20:16 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
/**
|
2018-01-28 18:12:26 +00:00
|
|
|
* @file PS_plotter.cpp
|
|
|
|
* @brief Kicad: specialized plotter for PS files format
|
2011-09-30 18:15:37 +00:00
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-01-29 15:39:40 +00:00
|
|
|
#include <eda_base_frame.h>
|
2016-02-10 16:02:40 +00:00
|
|
|
#include <convert_basic_shapes_to_polygon.h>
|
2020-10-24 14:45:37 +00:00
|
|
|
#include <macros.h>
|
2020-01-07 17:12:59 +00:00
|
|
|
#include <math/util.h> // for KiROUND
|
2020-10-14 11:29:36 +00:00
|
|
|
#include <render_settings.h>
|
2020-10-14 03:37:48 +00:00
|
|
|
#include <trigo.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2020-09-23 18:58:13 +00:00
|
|
|
#include "plotters_pslike.h"
|
|
|
|
|
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
/* Forward declaration of the font width metrics
|
|
|
|
(yes extern! this is the way to forward declare variables */
|
|
|
|
extern const double hv_widths[256];
|
|
|
|
extern const double hvb_widths[256];
|
|
|
|
extern const double hvo_widths[256];
|
|
|
|
extern const double hvbo_widths[256];
|
2007-08-20 13:28:34 +00:00
|
|
|
|
2012-09-20 13:54:35 +00:00
|
|
|
const double PSLIKE_PLOTTER::postscriptTextAscent = 0.718;
|
|
|
|
|
2020-10-15 13:24:26 +00:00
|
|
|
// return a id used to select a ps macro (see StartPlot() ) from a FILL_TYPE
|
|
|
|
// fill mode, for arc, rect, circle and poly draw primitives
|
|
|
|
static int getFillId( FILL_TYPE aFill )
|
|
|
|
{
|
|
|
|
if( aFill == FILL_TYPE::NO_FILL )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if( aFill == FILL_TYPE::FILLED_SHAPE )
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2012-09-20 13:54:35 +00:00
|
|
|
|
2020-10-20 20:09:13 +00:00
|
|
|
// Common routines for PostScript-like plotting engines
|
2012-05-03 18:37:56 +00:00
|
|
|
|
2017-02-20 16:57:41 +00:00
|
|
|
void PSLIKE_PLOTTER::SetColor( COLOR4D color )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2020-11-16 00:04:55 +00:00
|
|
|
if( m_colorMode )
|
2012-05-03 18:37:56 +00:00
|
|
|
{
|
2020-11-16 00:04:55 +00:00
|
|
|
if( m_negativeMode )
|
2017-02-20 16:57:41 +00:00
|
|
|
emitSetRGBColor( 1 - color.r, 1 - color.g, 1 - color.b );
|
2012-05-03 18:37:56 +00:00
|
|
|
else
|
2017-02-20 16:57:41 +00:00
|
|
|
emitSetRGBColor( color.r, color.g, color.b );
|
2012-05-03 18:37:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* B/W Mode - Use BLACK or WHITE for all items
|
|
|
|
* note the 2 colors are used in B&W mode, mainly by Pcbnew to draw
|
|
|
|
* holes in white on pads in black
|
|
|
|
*/
|
|
|
|
double k = 1; // White
|
2017-02-20 17:48:27 +00:00
|
|
|
if( color != COLOR4D::WHITE )
|
2012-05-03 18:37:56 +00:00
|
|
|
k = 0;
|
2020-11-16 00:04:55 +00:00
|
|
|
if( m_negativeMode )
|
2012-05-03 18:37:56 +00:00
|
|
|
emitSetRGBColor( 1 - k, 1 - k, 1 - k );
|
|
|
|
else
|
|
|
|
emitSetRGBColor( k, k, k );
|
|
|
|
}
|
2007-05-28 18:09:49 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 13:28:34 +00:00
|
|
|
|
2015-05-21 09:04:47 +00:00
|
|
|
void PSLIKE_PLOTTER::FlashPadOval( const wxPoint& aPadPos, const wxSize& aSize,
|
2020-10-15 23:33:18 +00:00
|
|
|
double aPadOrient, OUTLINE_MODE aTraceMode, void* aData )
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
2020-11-16 00:04:55 +00:00
|
|
|
wxASSERT( m_outputFile );
|
2012-05-03 18:37:56 +00:00
|
|
|
int x0, y0, x1, y1, delta;
|
|
|
|
wxSize size( aSize );
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
// The pad is reduced to an oval by dy > dx
|
|
|
|
if( size.x > size.y )
|
|
|
|
{
|
2015-06-26 13:41:56 +00:00
|
|
|
std::swap( size.x, size.y );
|
2015-05-21 09:04:47 +00:00
|
|
|
aPadOrient = AddAngles( aPadOrient, 900 );
|
2012-05-03 18:37:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
delta = size.y - size.x;
|
|
|
|
x0 = 0;
|
|
|
|
y0 = -delta / 2;
|
|
|
|
x1 = 0;
|
|
|
|
y1 = delta / 2;
|
2015-05-21 09:04:47 +00:00
|
|
|
RotatePoint( &x0, &y0, aPadOrient );
|
|
|
|
RotatePoint( &x1, &y1, aPadOrient );
|
2012-05-03 18:37:56 +00:00
|
|
|
|
2015-05-21 09:04:47 +00:00
|
|
|
if( aTraceMode == FILLED )
|
|
|
|
ThickSegment( wxPoint( aPadPos.x + x0, aPadPos.y + y0 ),
|
2016-09-19 11:01:36 +00:00
|
|
|
wxPoint( aPadPos.x + x1, aPadPos.y + y1 ), size.x, aTraceMode, NULL );
|
2008-03-22 05:55:06 +00:00
|
|
|
else
|
2015-05-21 09:04:47 +00:00
|
|
|
sketchOval( aPadPos, size, aPadOrient, -1 );
|
2012-05-03 18:37:56 +00:00
|
|
|
}
|
2007-08-20 13:28:34 +00:00
|
|
|
|
|
|
|
|
2015-05-21 09:04:47 +00:00
|
|
|
void PSLIKE_PLOTTER::FlashPadCircle( const wxPoint& aPadPos, int aDiameter,
|
2020-10-15 23:33:18 +00:00
|
|
|
OUTLINE_MODE aTraceMode, void* aData )
|
2012-05-03 18:37:56 +00:00
|
|
|
{
|
2015-05-21 09:04:47 +00:00
|
|
|
if( aTraceMode == FILLED )
|
2020-10-15 01:45:20 +00:00
|
|
|
Circle( aPadPos, aDiameter, FILL_TYPE::FILLED_SHAPE, 0 );
|
2015-05-21 09:04:47 +00:00
|
|
|
else // Plot a ring:
|
|
|
|
{
|
|
|
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
|
|
|
int linewidth = GetCurrentLineWidth();
|
2012-05-03 18:37:56 +00:00
|
|
|
|
2015-05-21 09:04:47 +00:00
|
|
|
// avoid aDiameter <= 1 )
|
|
|
|
if( linewidth > aDiameter-2 )
|
|
|
|
linewidth = aDiameter-2;
|
2012-05-03 18:37:56 +00:00
|
|
|
|
2020-10-15 01:45:20 +00:00
|
|
|
Circle( aPadPos, aDiameter - linewidth, FILL_TYPE::NO_FILL, linewidth );
|
2015-05-21 09:04:47 +00:00
|
|
|
}
|
2012-05-03 18:37:56 +00:00
|
|
|
|
2015-05-21 09:04:47 +00:00
|
|
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 13:28:34 +00:00
|
|
|
|
2015-05-21 09:04:47 +00:00
|
|
|
void PSLIKE_PLOTTER::FlashPadRect( const wxPoint& aPadPos, const wxSize& aSize,
|
2020-10-15 23:33:18 +00:00
|
|
|
double aPadOrient, OUTLINE_MODE aTraceMode, void* aData )
|
2012-05-03 18:37:56 +00:00
|
|
|
{
|
|
|
|
static std::vector< wxPoint > cornerList;
|
|
|
|
wxSize size( aSize );
|
|
|
|
cornerList.clear();
|
|
|
|
|
2015-05-21 09:04:47 +00:00
|
|
|
if( aTraceMode == FILLED )
|
|
|
|
SetCurrentLineWidth( 0 );
|
|
|
|
else
|
|
|
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
|
|
|
|
|
|
|
size.x -= GetCurrentLineWidth();
|
|
|
|
size.y -= GetCurrentLineWidth();
|
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
if( size.x < 1 )
|
|
|
|
size.x = 1;
|
2015-05-21 09:04:47 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
if( size.y < 1 )
|
|
|
|
size.y = 1;
|
|
|
|
|
|
|
|
int dx = size.x / 2;
|
|
|
|
int dy = size.y / 2;
|
|
|
|
|
|
|
|
wxPoint corner;
|
2015-05-21 09:04:47 +00:00
|
|
|
corner.x = aPadPos.x - dx;
|
|
|
|
corner.y = aPadPos.y + dy;
|
2012-05-03 18:37:56 +00:00
|
|
|
cornerList.push_back( corner );
|
2015-05-21 09:04:47 +00:00
|
|
|
corner.x = aPadPos.x - dx;
|
|
|
|
corner.y = aPadPos.y - dy;
|
2012-05-03 18:37:56 +00:00
|
|
|
cornerList.push_back( corner );
|
2015-05-21 09:04:47 +00:00
|
|
|
corner.x = aPadPos.x + dx;
|
|
|
|
corner.y = aPadPos.y - dy;
|
2012-05-03 18:37:56 +00:00
|
|
|
cornerList.push_back( corner );
|
2015-05-21 09:04:47 +00:00
|
|
|
corner.x = aPadPos.x + dx;
|
|
|
|
corner.y = aPadPos.y + dy,
|
2012-05-03 18:37:56 +00:00
|
|
|
cornerList.push_back( corner );
|
|
|
|
|
|
|
|
for( unsigned ii = 0; ii < cornerList.size(); ii++ )
|
|
|
|
{
|
2015-05-21 09:04:47 +00:00
|
|
|
RotatePoint( &cornerList[ii], aPadPos, aPadOrient );
|
2012-05-03 18:37:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cornerList.push_back( cornerList[0] );
|
|
|
|
|
2020-10-15 01:45:20 +00:00
|
|
|
PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILL_TYPE::FILLED_SHAPE : FILL_TYPE::NO_FILL,
|
2015-05-21 09:04:47 +00:00
|
|
|
GetCurrentLineWidth() );
|
2012-05-03 18:37:56 +00:00
|
|
|
}
|
|
|
|
|
2016-02-10 16:02:40 +00:00
|
|
|
void PSLIKE_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSize,
|
|
|
|
int aCornerRadius, double aOrient,
|
2020-10-15 23:33:18 +00:00
|
|
|
OUTLINE_MODE aTraceMode, void* aData )
|
2016-02-10 16:02:40 +00:00
|
|
|
{
|
|
|
|
wxSize size( aSize );
|
|
|
|
|
|
|
|
if( aTraceMode == FILLED )
|
|
|
|
SetCurrentLineWidth( 0 );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
|
|
|
size.x -= GetCurrentLineWidth();
|
|
|
|
size.y -= GetCurrentLineWidth();
|
|
|
|
aCornerRadius -= GetCurrentLineWidth()/2;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SHAPE_POLY_SET outline;
|
2020-10-13 10:55:24 +00:00
|
|
|
TransformRoundChamferedRectToPolygon( outline, aPadPos, size, aOrient, aCornerRadius,
|
|
|
|
0.0, 0, GetPlotterArcHighDef(), ERROR_INSIDE );
|
2016-02-10 16:02:40 +00:00
|
|
|
|
|
|
|
std::vector< wxPoint > cornerList;
|
|
|
|
// TransformRoundRectToPolygon creates only one convex polygon
|
|
|
|
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
|
2019-12-05 15:20:59 +00:00
|
|
|
cornerList.reserve( poly.PointCount() );
|
2016-02-10 16:02:40 +00:00
|
|
|
|
|
|
|
for( int ii = 0; ii < poly.PointCount(); ++ii )
|
2019-03-23 18:26:44 +00:00
|
|
|
cornerList.emplace_back( poly.CPoint( ii ).x, poly.CPoint( ii ).y );
|
2016-02-10 16:02:40 +00:00
|
|
|
|
|
|
|
// Close polygon
|
|
|
|
cornerList.push_back( cornerList[0] );
|
|
|
|
|
2020-10-15 01:45:20 +00:00
|
|
|
PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILL_TYPE::FILLED_SHAPE : FILL_TYPE::NO_FILL,
|
2016-02-10 16:02:40 +00:00
|
|
|
GetCurrentLineWidth() );
|
|
|
|
}
|
|
|
|
|
|
|
|
void PSLIKE_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
|
|
|
|
SHAPE_POLY_SET* aPolygons,
|
2020-10-15 23:33:18 +00:00
|
|
|
OUTLINE_MODE aTraceMode, void* aData )
|
2016-02-10 16:02:40 +00:00
|
|
|
{
|
|
|
|
wxSize size( aSize );
|
|
|
|
|
|
|
|
if( aTraceMode == FILLED )
|
|
|
|
SetCurrentLineWidth( 0 );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
|
|
|
size.x -= GetCurrentLineWidth();
|
|
|
|
size.y -= GetCurrentLineWidth();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::vector< wxPoint > cornerList;
|
|
|
|
|
|
|
|
for( int cnt = 0; cnt < aPolygons->OutlineCount(); ++cnt )
|
|
|
|
{
|
|
|
|
SHAPE_LINE_CHAIN& poly = aPolygons->Outline( cnt );
|
|
|
|
cornerList.clear();
|
|
|
|
|
|
|
|
for( int ii = 0; ii < poly.PointCount(); ++ii )
|
2019-03-23 18:26:44 +00:00
|
|
|
cornerList.emplace_back( poly.CPoint( ii ).x, poly.CPoint( ii ).y );
|
2016-02-10 16:02:40 +00:00
|
|
|
|
|
|
|
// Close polygon
|
|
|
|
cornerList.push_back( cornerList[0] );
|
|
|
|
|
2020-10-15 01:45:20 +00:00
|
|
|
PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILL_TYPE::FILLED_SHAPE : FILL_TYPE::NO_FILL,
|
2016-02-10 16:02:40 +00:00
|
|
|
GetCurrentLineWidth() );
|
|
|
|
}
|
|
|
|
}
|
2012-05-03 18:37:56 +00:00
|
|
|
|
|
|
|
void PSLIKE_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
|
2020-10-15 23:33:18 +00:00
|
|
|
double aPadOrient, OUTLINE_MODE aTraceMode, void* aData )
|
2012-05-03 18:37:56 +00:00
|
|
|
{
|
|
|
|
static std::vector< wxPoint > cornerList;
|
|
|
|
cornerList.clear();
|
|
|
|
|
|
|
|
for( int ii = 0; ii < 4; ii++ )
|
|
|
|
cornerList.push_back( aCorners[ii] );
|
|
|
|
|
2015-05-21 09:04:47 +00:00
|
|
|
if( aTraceMode == FILLED )
|
2012-05-03 18:37:56 +00:00
|
|
|
{
|
|
|
|
SetCurrentLineWidth( 0 );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-05-21 09:04:47 +00:00
|
|
|
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
|
|
|
int w = GetCurrentLineWidth();
|
2012-05-03 18:37:56 +00:00
|
|
|
// offset polygon by w
|
|
|
|
// coord[0] is assumed the lower left
|
|
|
|
// coord[1] is assumed the upper left
|
|
|
|
// coord[2] is assumed the upper right
|
|
|
|
// coord[3] is assumed the lower right
|
|
|
|
|
|
|
|
/* Trace the outline. */
|
|
|
|
cornerList[0].x += w;
|
|
|
|
cornerList[0].y -= w;
|
|
|
|
cornerList[1].x += w;
|
|
|
|
cornerList[1].y += w;
|
|
|
|
cornerList[2].x -= w;
|
|
|
|
cornerList[2].y += w;
|
|
|
|
cornerList[3].x -= w;
|
|
|
|
cornerList[3].y -= w;
|
|
|
|
}
|
|
|
|
|
|
|
|
for( int ii = 0; ii < 4; ii++ )
|
|
|
|
{
|
|
|
|
RotatePoint( &cornerList[ii], aPadOrient );
|
|
|
|
cornerList[ii] += aPadPos;
|
|
|
|
}
|
|
|
|
|
|
|
|
cornerList.push_back( cornerList[0] );
|
2020-10-15 01:45:20 +00:00
|
|
|
PlotPoly( cornerList, ( aTraceMode == FILLED ) ? FILL_TYPE::FILLED_SHAPE : FILL_TYPE::NO_FILL,
|
2015-05-21 09:04:47 +00:00
|
|
|
GetCurrentLineWidth() );
|
2012-05-03 18:37:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-10-02 15:16:27 +00:00
|
|
|
void PSLIKE_PLOTTER::FlashRegularPolygon( const wxPoint& aShapePos,
|
|
|
|
int aRadius, int aCornerCount,
|
2020-10-15 23:33:18 +00:00
|
|
|
double aOrient, OUTLINE_MODE aTraceMode, void* aData )
|
2019-10-02 15:16:27 +00:00
|
|
|
{
|
|
|
|
// Do nothing
|
|
|
|
wxASSERT( 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-26 13:57:07 +00:00
|
|
|
std::string PSLIKE_PLOTTER::encodeStringForPlotter( const wxString& aUnicode )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2020-07-26 13:57:07 +00:00
|
|
|
// Write on a std::string a string escaped for postscript/PDF
|
|
|
|
std::string converted;
|
|
|
|
|
|
|
|
converted += '(';
|
|
|
|
|
|
|
|
for( unsigned i = 0; i < aUnicode.Len(); i++ )
|
2012-05-03 18:37:56 +00:00
|
|
|
{
|
2014-10-19 20:20:16 +00:00
|
|
|
// Lazyness made me use stdio buffering yet another time...
|
2020-07-26 13:57:07 +00:00
|
|
|
wchar_t ch = aUnicode[i];
|
2014-10-19 20:20:16 +00:00
|
|
|
|
|
|
|
if( ch < 256 )
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
{
|
2014-10-19 20:20:16 +00:00
|
|
|
switch (ch)
|
|
|
|
{
|
|
|
|
// The ~ shouldn't reach the outside
|
|
|
|
case '~':
|
|
|
|
break;
|
|
|
|
// These characters must be escaped
|
|
|
|
case '(':
|
|
|
|
case ')':
|
|
|
|
case '\\':
|
2020-07-26 13:57:07 +00:00
|
|
|
converted += '\\';
|
2020-04-24 23:44:09 +00:00
|
|
|
KI_FALLTHROUGH;
|
2014-10-19 20:20:16 +00:00
|
|
|
|
|
|
|
default:
|
2020-07-26 13:57:07 +00:00
|
|
|
converted += ch;
|
2014-10-19 20:20:16 +00:00
|
|
|
break;
|
|
|
|
}
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
}
|
|
|
|
}
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2020-07-26 13:57:07 +00:00
|
|
|
converted += ')';
|
|
|
|
|
|
|
|
return converted;
|
2012-05-03 18:37:56 +00:00
|
|
|
}
|
2009-08-21 19:13:55 +00:00
|
|
|
|
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
/**
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
* Sister function for the GraphicTextWidth in drawtxt.cpp
|
2012-05-03 18:37:56 +00:00
|
|
|
* Does the same processing (i.e. calculates a text string width) but
|
|
|
|
* using postscript metrics for the Helvetica font (optionally used for
|
|
|
|
* PS and PDF plotting
|
|
|
|
*/
|
|
|
|
int PSLIKE_PLOTTER::returnPostscriptTextWidth( const wxString& aText, int aXSize,
|
|
|
|
bool aItalic, bool aBold )
|
|
|
|
{
|
|
|
|
const double *width_table = aBold ? ( aItalic ? hvbo_widths : hvb_widths )
|
|
|
|
: ( aItalic ? hvo_widths : hv_widths );
|
|
|
|
double tally = 0;
|
|
|
|
|
|
|
|
for( unsigned i = 0; i < aText.length(); i++ )
|
2009-08-21 19:13:55 +00:00
|
|
|
{
|
2012-05-03 18:37:56 +00:00
|
|
|
wchar_t AsciiCode = aText[i];
|
|
|
|
// Skip the negation marks and untabled points
|
|
|
|
if( AsciiCode != '~' && AsciiCode < 256 )
|
2009-11-23 15:16:50 +00:00
|
|
|
{
|
2012-05-03 18:37:56 +00:00
|
|
|
tally += width_table[AsciiCode];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Widths are proportional to height, but height is enlarged by a
|
|
|
|
// scaling factor
|
|
|
|
return KiROUND( aXSize * tally / postscriptTextAscent );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Computes the x coordinates for the overlining in a string of text.
|
|
|
|
* Fills the passed vector with couples of (start, stop) values to be
|
|
|
|
* used in the text coordinate system (use computeTextParameters to
|
2019-08-20 17:22:30 +00:00
|
|
|
* obtain the parameters to establish such a system)
|
2012-05-03 18:37:56 +00:00
|
|
|
*/
|
|
|
|
void PSLIKE_PLOTTER::postscriptOverlinePositions( const wxString& aText, int aXSize,
|
|
|
|
bool aItalic, bool aBold,
|
|
|
|
std::vector<int> *pos_pairs )
|
|
|
|
{
|
|
|
|
/* XXX This function is *too* similar to returnPostscriptTextWidth.
|
|
|
|
Consider merging them... */
|
|
|
|
const double *width_table = aBold ? ( aItalic ? hvbo_widths : hvb_widths )
|
|
|
|
: ( aItalic ? hvo_widths : hv_widths );
|
|
|
|
double tally = 0;
|
|
|
|
|
|
|
|
for( unsigned i = 0; i < aText.length(); i++ )
|
|
|
|
{
|
|
|
|
wchar_t AsciiCode = aText[i];
|
|
|
|
// Skip the negation marks and untabled points
|
|
|
|
if( AsciiCode != '~' && AsciiCode < 256 )
|
|
|
|
{
|
|
|
|
tally += width_table[AsciiCode];
|
2009-11-23 15:16:50 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-05-03 18:37:56 +00:00
|
|
|
if( AsciiCode == '~' )
|
|
|
|
pos_pairs->push_back( KiROUND( aXSize * tally / postscriptTextAscent ) );
|
2009-11-23 15:16:50 +00:00
|
|
|
}
|
2009-08-21 19:13:55 +00:00
|
|
|
}
|
2012-05-03 18:37:56 +00:00
|
|
|
|
|
|
|
// Special rule: we have to complete the last bar if the ~ aren't matched
|
|
|
|
if( pos_pairs->size() % 2 == 1 )
|
|
|
|
pos_pairs->push_back( KiROUND( aXSize * tally / postscriptTextAscent ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
void PS_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
double aScale, bool aMirror )
|
2012-05-03 18:37:56 +00:00
|
|
|
{
|
2020-11-16 00:04:55 +00:00
|
|
|
wxASSERT( !m_outputFile );
|
2013-12-06 18:31:15 +00:00
|
|
|
m_plotMirror = aMirror;
|
2020-11-16 00:04:55 +00:00
|
|
|
m_plotOffset = aOffset;
|
|
|
|
m_plotScale = aScale;
|
2012-08-29 20:13:47 +00:00
|
|
|
m_IUsPerDecimil = aIusPerDecimil;
|
2020-11-16 00:04:55 +00:00
|
|
|
m_iuPerDeviceUnit = 1.0 / aIusPerDecimil;
|
2012-05-03 18:37:56 +00:00
|
|
|
/* Compute the paper size in IUs */
|
2020-11-16 00:04:55 +00:00
|
|
|
m_paperSize = m_pageInfo.GetSizeMils();
|
|
|
|
m_paperSize.x *= 10.0 * aIusPerDecimil;
|
|
|
|
m_paperSize.y *= 10.0 * aIusPerDecimil;
|
2012-05-03 18:37:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** This is the core for postscript/PDF text alignment
|
|
|
|
* It computes the transformation matrix to generate a user space
|
|
|
|
* system aligned with the text. Even the PS uses the concat
|
|
|
|
* operator to simplify PDF generation (concat is everything PDF
|
|
|
|
* has to modify the CTM. Lots of parameters, both in and out.
|
|
|
|
*/
|
|
|
|
void PSLIKE_PLOTTER::computeTextParameters( const wxPoint& aPos,
|
|
|
|
const wxString& aText,
|
|
|
|
int aOrient,
|
|
|
|
const wxSize& aSize,
|
2017-08-15 13:52:46 +00:00
|
|
|
bool aMirror,
|
2012-05-03 18:37:56 +00:00
|
|
|
enum EDA_TEXT_HJUSTIFY_T aH_justify,
|
|
|
|
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
|
|
|
int aWidth,
|
|
|
|
bool aItalic,
|
|
|
|
bool aBold,
|
|
|
|
double *wideningFactor,
|
|
|
|
double *ctm_a,
|
|
|
|
double *ctm_b,
|
|
|
|
double *ctm_c,
|
|
|
|
double *ctm_d,
|
|
|
|
double *ctm_e,
|
|
|
|
double *ctm_f,
|
|
|
|
double *heightFactor )
|
|
|
|
{
|
|
|
|
// Compute the starting position (compensated for alignment)
|
|
|
|
wxPoint start_pos = aPos;
|
|
|
|
|
|
|
|
// This is an approximation of the text bounds (in IUs)
|
|
|
|
int tw = returnPostscriptTextWidth( aText, aSize.x, aItalic, aWidth );
|
|
|
|
int th = aSize.y;
|
|
|
|
int dx, dy;
|
|
|
|
|
|
|
|
switch( aH_justify )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
2012-05-03 18:37:56 +00:00
|
|
|
case GR_TEXT_HJUSTIFY_CENTER:
|
2014-10-19 20:20:16 +00:00
|
|
|
dx = -tw / 2;
|
|
|
|
break;
|
2012-05-03 18:37:56 +00:00
|
|
|
|
|
|
|
case GR_TEXT_HJUSTIFY_RIGHT:
|
2014-10-19 20:20:16 +00:00
|
|
|
dx = -tw;
|
|
|
|
break;
|
2012-05-03 18:37:56 +00:00
|
|
|
|
|
|
|
case GR_TEXT_HJUSTIFY_LEFT:
|
2014-10-19 20:20:16 +00:00
|
|
|
dx = 0;
|
|
|
|
break;
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
2012-05-03 18:37:56 +00:00
|
|
|
|
|
|
|
switch( aV_justify )
|
|
|
|
{
|
|
|
|
case GR_TEXT_VJUSTIFY_CENTER:
|
2014-10-19 20:20:16 +00:00
|
|
|
dy = th / 2;
|
|
|
|
break;
|
2012-05-03 18:37:56 +00:00
|
|
|
|
|
|
|
case GR_TEXT_VJUSTIFY_TOP:
|
|
|
|
dy = th;
|
2014-10-19 20:20:16 +00:00
|
|
|
break;
|
2012-05-03 18:37:56 +00:00
|
|
|
|
|
|
|
case GR_TEXT_VJUSTIFY_BOTTOM:
|
2014-10-19 20:20:16 +00:00
|
|
|
dy = 0;
|
|
|
|
break;
|
2012-05-03 18:37:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RotatePoint( &dx, &dy, aOrient );
|
|
|
|
RotatePoint( &tw, &th, aOrient );
|
|
|
|
start_pos.x += dx;
|
|
|
|
start_pos.y += dy;
|
|
|
|
DPOINT pos_dev = userToDeviceCoordinates( start_pos );
|
|
|
|
DPOINT sz_dev = userToDeviceSize( aSize );
|
|
|
|
|
|
|
|
// Now returns the final values... the widening factor
|
2017-08-15 13:52:46 +00:00
|
|
|
*wideningFactor = sz_dev.x / sz_dev.y;
|
|
|
|
|
|
|
|
// Mirrored texts must be plotted as mirrored!
|
|
|
|
if( m_plotMirror )
|
|
|
|
{
|
|
|
|
*wideningFactor = -*wideningFactor;
|
|
|
|
aOrient = -aOrient;
|
|
|
|
}
|
2012-05-03 18:37:56 +00:00
|
|
|
|
|
|
|
// The CTM transformation matrix
|
2013-05-02 18:06:58 +00:00
|
|
|
double alpha = DECIDEG2RAD( aOrient );
|
|
|
|
double sinalpha = sin( alpha );
|
|
|
|
double cosalpha = cos( alpha );
|
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
*ctm_a = cosalpha;
|
|
|
|
*ctm_b = sinalpha;
|
|
|
|
*ctm_c = -sinalpha;
|
|
|
|
*ctm_d = cosalpha;
|
|
|
|
*ctm_e = pos_dev.x;
|
|
|
|
*ctm_f = pos_dev.y;
|
|
|
|
|
|
|
|
// This is because the letters are less than 1 unit high
|
|
|
|
*heightFactor = sz_dev.y / postscriptTextAscent;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
/* Set the current line width (in IUs) for the next plot
|
|
|
|
*/
|
2020-04-14 12:25:00 +00:00
|
|
|
void PS_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2020-11-16 00:04:55 +00:00
|
|
|
wxASSERT( m_outputFile );
|
2012-05-03 18:37:56 +00:00
|
|
|
|
2020-05-13 16:44:21 +00:00
|
|
|
if( aWidth == DO_NOT_SET_LINE_WIDTH )
|
|
|
|
return;
|
|
|
|
else if( aWidth == USE_DEFAULT_LINE_WIDTH )
|
|
|
|
aWidth = m_renderSettings->GetDefaultPenWidth();
|
|
|
|
else if( aWidth == 0 )
|
|
|
|
aWidth = 1;
|
|
|
|
|
|
|
|
wxASSERT_MSG( aWidth > 0, "Plotter called to set negative pen width" );
|
|
|
|
|
2020-04-14 12:25:00 +00:00
|
|
|
if( aWidth != GetCurrentLineWidth() )
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%g setlinewidth\n", userToDeviceSize( aWidth ) );
|
2012-05-03 18:37:56 +00:00
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
m_currentPenWidth = aWidth;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
void PS_PLOTTER::emitSetRGBColor( double r, double g, double b )
|
2008-06-30 13:47:55 +00:00
|
|
|
{
|
2020-11-16 00:04:55 +00:00
|
|
|
wxASSERT( m_outputFile );
|
2008-06-30 13:47:55 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
// XXX why %.3g ? shouldn't %g suffice? who cares...
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%.3g %.3g %.3g setrgbcolor\n", r, g, b );
|
2012-05-03 18:37:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2020-10-20 20:09:13 +00:00
|
|
|
* PostScript supports dashed lines
|
2012-05-03 18:37:56 +00:00
|
|
|
*/
|
2019-12-28 00:55:11 +00:00
|
|
|
void PS_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
|
2012-05-03 18:37:56 +00:00
|
|
|
{
|
2017-11-13 03:53:27 +00:00
|
|
|
switch( dashed )
|
|
|
|
{
|
2019-12-28 00:55:11 +00:00
|
|
|
case PLOT_DASH_TYPE::DASH:
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "[%d %d] 0 setdash\n",
|
|
|
|
(int) GetDashMarkLenIU(), (int) GetDashGapLenIU() );
|
2017-11-13 03:53:27 +00:00
|
|
|
break;
|
2019-12-28 00:55:11 +00:00
|
|
|
case PLOT_DASH_TYPE::DOT:
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "[%d %d] 0 setdash\n",
|
|
|
|
(int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
|
2017-11-13 03:53:27 +00:00
|
|
|
break;
|
2019-12-28 00:55:11 +00:00
|
|
|
case PLOT_DASH_TYPE::DASHDOT:
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "[%d %d %d %d] 0 setdash\n",
|
|
|
|
(int) GetDashMarkLenIU(), (int) GetDashGapLenIU(),
|
|
|
|
(int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
|
2017-11-13 03:53:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
2020-11-16 00:04:55 +00:00
|
|
|
fputs( "solidline\n", m_outputFile );
|
2017-11-13 03:53:27 +00:00
|
|
|
}
|
2008-06-30 13:47:55 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
|
2020-10-15 01:45:20 +00:00
|
|
|
void PS_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_TYPE fill, int width )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2012-05-03 18:37:56 +00:00
|
|
|
DPOINT p1_dev = userToDeviceCoordinates( p1 );
|
|
|
|
DPOINT p2_dev = userToDeviceCoordinates( p2 );
|
|
|
|
|
|
|
|
SetCurrentLineWidth( width );
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%g %g %g %g rect%d\n", p1_dev.x, p1_dev.y,
|
2020-10-15 13:24:26 +00:00
|
|
|
p2_dev.x - p1_dev.x, p2_dev.y - p1_dev.y, getFillId( fill ) );
|
2012-05-03 18:37:56 +00:00
|
|
|
}
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2020-10-15 01:45:20 +00:00
|
|
|
void PS_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_TYPE fill, int width )
|
2012-05-03 18:37:56 +00:00
|
|
|
{
|
2020-11-16 00:04:55 +00:00
|
|
|
wxASSERT( m_outputFile );
|
2012-05-03 18:37:56 +00:00
|
|
|
DPOINT pos_dev = userToDeviceCoordinates( pos );
|
|
|
|
double radius = userToDeviceSize( diametre / 2.0 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
SetCurrentLineWidth( width );
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%g %g %g cir%d\n", pos_dev.x, pos_dev.y, radius, getFillId( fill ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-06 18:31:15 +00:00
|
|
|
void PS_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle,
|
2020-10-15 01:45:20 +00:00
|
|
|
int radius, FILL_TYPE fill, int width )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2020-11-16 00:04:55 +00:00
|
|
|
wxASSERT( m_outputFile );
|
2020-10-15 13:24:26 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
if( radius <= 0 )
|
2008-03-22 05:55:06 +00:00
|
|
|
return;
|
|
|
|
|
2012-02-24 17:17:03 +00:00
|
|
|
if( StAngle > EndAngle )
|
2015-06-26 13:41:56 +00:00
|
|
|
std::swap( StAngle, EndAngle );
|
2012-02-24 17:17:03 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
SetCurrentLineWidth( width );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
// Calculate start point.
|
2012-05-03 18:37:56 +00:00
|
|
|
DPOINT centre_dev = userToDeviceCoordinates( centre );
|
|
|
|
double radius_dev = userToDeviceSize( radius );
|
2013-12-06 18:31:15 +00:00
|
|
|
|
|
|
|
if( m_plotMirror )
|
|
|
|
{
|
|
|
|
if( m_mirrorIsHorizontal )
|
|
|
|
{
|
|
|
|
StAngle = 1800.0 -StAngle;
|
|
|
|
EndAngle = 1800.0 -EndAngle;
|
2015-06-26 13:41:56 +00:00
|
|
|
std::swap( StAngle, EndAngle );
|
2013-12-06 18:31:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
StAngle = -StAngle;
|
|
|
|
EndAngle = -EndAngle;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%g %g %g %g %g arc%d\n", centre_dev.x, centre_dev.y,
|
2020-10-15 13:24:26 +00:00
|
|
|
radius_dev, StAngle / 10.0, EndAngle / 10.0, getFillId( fill ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
void PS_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
|
2020-10-15 01:45:20 +00:00
|
|
|
FILL_TYPE aFill, int aWidth, void * aData )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-04-20 08:13:21 +00:00
|
|
|
if( aCornerList.size() <= 1 )
|
2008-03-22 05:55:06 +00:00
|
|
|
return;
|
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
SetCurrentLineWidth( aWidth );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
DPOINT pos = userToDeviceCoordinates( aCornerList[0] );
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "newpath\n%g %g moveto\n", pos.x, pos.y );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2011-04-20 08:13:21 +00:00
|
|
|
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
|
2008-03-22 05:55:06 +00:00
|
|
|
{
|
2012-05-03 18:37:56 +00:00
|
|
|
pos = userToDeviceCoordinates( aCornerList[ii] );
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%g %g lineto\n", pos.x, pos.y );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
// Close/(fill) the path
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "poly%d\n", getFillId( aFill ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
|
|
|
|
/**
|
2020-10-20 20:09:13 +00:00
|
|
|
* PostScript-likes at the moment are the only plot engines supporting bitmaps...
|
2011-08-31 14:59:20 +00:00
|
|
|
*/
|
2012-05-03 18:37:56 +00:00
|
|
|
void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
|
|
|
|
double aScaleFactor )
|
2011-08-31 14:59:20 +00:00
|
|
|
{
|
|
|
|
wxSize pix_size; // size of the bitmap in pixels
|
|
|
|
pix_size.x = aImage.GetWidth();
|
|
|
|
pix_size.y = aImage.GetHeight();
|
2012-05-03 18:37:56 +00:00
|
|
|
DPOINT drawsize( aScaleFactor * pix_size.x,
|
|
|
|
aScaleFactor * pix_size.y ); // requested size of image
|
2011-08-31 14:59:20 +00:00
|
|
|
|
|
|
|
// calculate the bottom left corner position of bitmap
|
|
|
|
wxPoint start = aPos;
|
|
|
|
start.x -= drawsize.x / 2; // left
|
|
|
|
start.y += drawsize.y / 2; // bottom (Y axis reversed)
|
|
|
|
|
|
|
|
// calculate the top right corner position of bitmap
|
|
|
|
wxPoint end;
|
|
|
|
end.x = start.x + drawsize.x;
|
|
|
|
end.y = start.y - drawsize.y;
|
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "/origstate save def\n" );
|
|
|
|
fprintf( m_outputFile, "/pix %d string def\n", pix_size.x );
|
2011-08-31 14:59:20 +00:00
|
|
|
|
|
|
|
// Locate lower-left corner of image
|
2012-05-03 18:37:56 +00:00
|
|
|
DPOINT start_dev = userToDeviceCoordinates( start );
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%g %g translate\n", start_dev.x, start_dev.y );
|
2011-08-31 14:59:20 +00:00
|
|
|
// Map image size to device
|
2012-05-03 18:37:56 +00:00
|
|
|
DPOINT end_dev = userToDeviceCoordinates( end );
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%g %g scale\n",
|
2014-10-19 20:20:16 +00:00
|
|
|
std::abs(end_dev.x - start_dev.x), std::abs(end_dev.y - start_dev.y));
|
2011-08-31 14:59:20 +00:00
|
|
|
|
|
|
|
// Dimensions of source image (in pixels
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%d %d 8", pix_size.x, pix_size.y );
|
2011-08-31 14:59:20 +00:00
|
|
|
// Map unit square to source
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, " [%d 0 0 %d 0 %d]\n", pix_size.x, -pix_size.y , pix_size.y);
|
2011-08-31 14:59:20 +00:00
|
|
|
// include image data in ps file
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "{currentfile pix readhexstring pop}\n" );
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
if( m_colorMode )
|
|
|
|
fputs( "false 3 colorimage\n", m_outputFile );
|
2012-05-03 18:37:56 +00:00
|
|
|
else
|
2020-11-16 00:04:55 +00:00
|
|
|
fputs( "image\n", m_outputFile );
|
2011-08-31 14:59:20 +00:00
|
|
|
// Single data source, 3 colors, Output RGB data (hexadecimal)
|
2012-05-03 18:37:56 +00:00
|
|
|
// (or the same downscaled to gray)
|
2011-08-31 14:59:20 +00:00
|
|
|
int jj = 0;
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2011-08-31 14:59:20 +00:00
|
|
|
for( int yy = 0; yy < pix_size.y; yy ++ )
|
|
|
|
{
|
|
|
|
for( int xx = 0; xx < pix_size.x; xx++, jj++ )
|
|
|
|
{
|
|
|
|
if( jj >= 16 )
|
|
|
|
{
|
|
|
|
jj = 0;
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "\n");
|
2011-08-31 14:59:20 +00:00
|
|
|
}
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2011-08-31 14:59:20 +00:00
|
|
|
int red, green, blue;
|
|
|
|
red = aImage.GetRed( xx, yy) & 0xFF;
|
|
|
|
green = aImage.GetGreen( xx, yy) & 0xFF;
|
|
|
|
blue = aImage.GetBlue( xx, yy) & 0xFF;
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2019-05-27 16:35:05 +00:00
|
|
|
// PS doesn't support alpha, so premultiply against white background
|
|
|
|
if( aImage.HasAlpha() )
|
|
|
|
{
|
|
|
|
unsigned char alpha = aImage.GetAlpha( xx, yy ) & 0xFF;
|
|
|
|
|
|
|
|
if( alpha < 0xFF )
|
|
|
|
{
|
|
|
|
float a = 1.0 - ( (float) alpha / 255.0 );
|
|
|
|
red = ( int )( red + ( a * 0xFF ) ) & 0xFF;
|
|
|
|
green = ( int )( green + ( a * 0xFF ) ) & 0xFF;
|
|
|
|
blue = ( int )( blue + ( a * 0xFF ) ) & 0xFF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-16 20:27:58 +00:00
|
|
|
if( aImage.HasMask() )
|
|
|
|
{
|
|
|
|
if( red == aImage.GetMaskRed() && green == aImage.GetMaskGreen()
|
|
|
|
&& blue == aImage.GetMaskBlue() )
|
|
|
|
{
|
|
|
|
red = 0xFF;
|
|
|
|
green = 0xFF;
|
|
|
|
blue = 0xFF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
if( m_colorMode )
|
|
|
|
{
|
|
|
|
fprintf( m_outputFile, "%2.2X%2.2X%2.2X", red, green, blue );
|
|
|
|
}
|
2012-05-03 18:37:56 +00:00
|
|
|
else
|
2019-06-18 01:35:41 +00:00
|
|
|
{
|
|
|
|
// Greyscale conversion (CIE 1931)
|
|
|
|
unsigned char grey = KiROUND( red * 0.2126 + green * 0.7152 + blue * 0.0722 );
|
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%2.2X", grey );
|
2019-06-18 01:35:41 +00:00
|
|
|
}
|
2011-08-31 14:59:20 +00:00
|
|
|
}
|
|
|
|
}
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "\n");
|
|
|
|
fprintf( m_outputFile, "origstate restore\n" );
|
2011-08-31 14:59:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
void PS_PLOTTER::PenTo( const wxPoint& pos, char plume )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2020-11-16 00:04:55 +00:00
|
|
|
wxASSERT( m_outputFile );
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
if( plume == 'Z' )
|
|
|
|
{
|
2020-11-16 00:04:55 +00:00
|
|
|
if( m_penState != 'Z' )
|
2009-11-23 15:16:50 +00:00
|
|
|
{
|
2020-11-16 00:04:55 +00:00
|
|
|
fputs( "stroke\n", m_outputFile );
|
|
|
|
m_penState = 'Z';
|
|
|
|
m_penLastpos.x = -1;
|
|
|
|
m_penLastpos.y = -1;
|
2009-11-23 15:16:50 +00:00
|
|
|
}
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2008-03-22 05:55:06 +00:00
|
|
|
return;
|
2009-05-28 17:39:40 +00:00
|
|
|
}
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
if( m_penState == 'Z' )
|
2009-11-23 15:16:50 +00:00
|
|
|
{
|
2020-11-16 00:04:55 +00:00
|
|
|
fputs( "newpath\n", m_outputFile );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
if( m_penState != plume || pos != m_penLastpos )
|
2012-05-03 18:37:56 +00:00
|
|
|
{
|
2014-10-19 20:20:16 +00:00
|
|
|
DPOINT pos_dev = userToDeviceCoordinates( pos );
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%g %g %sto\n",
|
2012-05-03 18:37:56 +00:00
|
|
|
pos_dev.x, pos_dev.y,
|
2009-11-23 15:16:50 +00:00
|
|
|
( plume=='D' ) ? "line" : "move" );
|
2012-05-03 18:37:56 +00:00
|
|
|
}
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
m_penState = plume;
|
|
|
|
m_penLastpos = pos;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
/**
|
|
|
|
* The code within this function (and the CloseFilePS function)
|
2007-08-20 13:28:34 +00:00
|
|
|
* creates postscript files whose contents comply with Adobe's
|
|
|
|
* Document Structuring Convention, as documented by assorted
|
|
|
|
* details described within the following URLs:
|
2008-03-22 05:55:06 +00:00
|
|
|
*
|
2007-08-20 13:28:34 +00:00
|
|
|
* http://en.wikipedia.org/wiki/Document_Structuring_Conventions
|
|
|
|
* http://partners.adobe.com/public/developer/en/ps/5001.DSC_Spec.pdf
|
2008-03-22 05:55:06 +00:00
|
|
|
*
|
|
|
|
*
|
2007-08-20 13:28:34 +00:00
|
|
|
* BBox is the boundary box (position and size of the "client rectangle"
|
|
|
|
* for drawings (page - margins) in mils (0.001 inch)
|
|
|
|
*/
|
2012-10-13 18:54:33 +00:00
|
|
|
bool PS_PLOTTER::StartPlot()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2020-11-16 00:04:55 +00:00
|
|
|
wxASSERT( m_outputFile );
|
2009-11-23 15:16:50 +00:00
|
|
|
wxString msg;
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
static const char* PSMacro[] =
|
|
|
|
{
|
2015-05-21 09:04:47 +00:00
|
|
|
"%%BeginProlog\n",
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
"/line { newpath moveto lineto stroke } bind def\n",
|
|
|
|
"/cir0 { newpath 0 360 arc stroke } bind def\n",
|
|
|
|
"/cir1 { newpath 0 360 arc gsave fill grestore stroke } bind def\n",
|
|
|
|
"/cir2 { newpath 0 360 arc gsave fill grestore stroke } bind def\n",
|
|
|
|
"/arc0 { newpath arc stroke } bind def\n",
|
|
|
|
"/arc1 { newpath 4 index 4 index moveto arc closepath gsave fill\n",
|
|
|
|
" grestore stroke } bind def\n",
|
|
|
|
"/arc2 { newpath 4 index 4 index moveto arc closepath gsave fill\n",
|
|
|
|
" grestore stroke } bind def\n",
|
|
|
|
"/poly0 { stroke } bind def\n",
|
|
|
|
"/poly1 { closepath gsave fill grestore stroke } bind def\n",
|
|
|
|
"/poly2 { closepath gsave fill grestore stroke } bind def\n",
|
|
|
|
"/rect0 { rectstroke } bind def\n",
|
|
|
|
"/rect1 { rectfill } bind def\n",
|
|
|
|
"/rect2 { rectfill } bind def\n",
|
|
|
|
"/linemode0 { 0 setlinecap 0 setlinejoin 0 setlinewidth } bind def\n",
|
|
|
|
"/linemode1 { 1 setlinecap 1 setlinejoin } bind def\n",
|
|
|
|
"/dashedline { [200] 100 setdash } bind def\n",
|
|
|
|
"/solidline { [] 0 setdash } bind def\n",
|
|
|
|
|
|
|
|
// This is for 'hidden' text (search anchors for PDF)
|
2015-05-21 09:04:47 +00:00
|
|
|
"/phantomshow { moveto\n",
|
|
|
|
" /KicadFont findfont 0.000001 scalefont setfont\n",
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
" show } bind def\n",
|
2012-05-03 18:37:56 +00:00
|
|
|
|
2015-05-21 09:04:47 +00:00
|
|
|
// This is for regular postscript text
|
|
|
|
"/textshow { gsave\n",
|
|
|
|
" findfont exch scalefont setfont concat 1 scale 0 0 moveto show\n",
|
|
|
|
" } bind def\n",
|
2012-05-03 18:37:56 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// Utility for getting Latin1 encoded fonts
|
|
|
|
"/reencodefont {\n",
|
2015-05-21 09:04:47 +00:00
|
|
|
" findfont dup length dict begin\n",
|
|
|
|
" { 1 index /FID ne\n",
|
|
|
|
" { def }\n",
|
|
|
|
" { pop pop } ifelse\n",
|
|
|
|
" } forall\n",
|
|
|
|
" /Encoding ISOLatin1Encoding def\n",
|
|
|
|
" currentdict\n",
|
|
|
|
" end } bind def\n"
|
2012-05-03 18:37:56 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// Remap AdobeStandard fonts to Latin1
|
|
|
|
"/KicadFont /Helvetica reencodefont definefont pop\n",
|
|
|
|
"/KicadFont-Bold /Helvetica-Bold reencodefont definefont pop\n",
|
|
|
|
"/KicadFont-Oblique /Helvetica-Oblique reencodefont definefont pop\n",
|
|
|
|
"/KicadFont-BoldOblique /Helvetica-BoldOblique reencodefont definefont pop\n",
|
|
|
|
"%%EndProlog\n",
|
|
|
|
NULL
|
2008-03-22 05:55:06 +00:00
|
|
|
};
|
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
time_t time1970 = time( NULL );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
fputs( "%!PS-Adobe-3.0\n", m_outputFile ); // Print header
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%%%%Creator: %s\n", TO_UTF8( m_creator ) );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
/* A "newline" character ("\n") is not included in the following string,
|
|
|
|
because it is provided by the ctime() function. */
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%%%%CreationDate: %s", ctime( &time1970 ) );
|
|
|
|
fprintf( m_outputFile, "%%%%Title: %s\n", encodeStringForPlotter( m_title ).c_str() );
|
|
|
|
fprintf( m_outputFile, "%%%%Pages: 1\n" );
|
|
|
|
fprintf( m_outputFile, "%%%%PageOrder: Ascend\n" );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
// Print boundary box in 1/72 pixels per inch, box is in mils
|
|
|
|
const double BIGPTsPERMIL = 0.072;
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
/* The coordinates of the lower left corner of the boundary
|
|
|
|
box need to be "rounded down", but the coordinates of its
|
|
|
|
upper right corner need to be "rounded up" instead. */
|
2020-11-16 00:04:55 +00:00
|
|
|
wxSize psPaperSize = m_pageInfo.GetSizeMils();
|
2012-04-08 23:37:26 +00:00
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
if( !m_pageInfo.IsPortrait() )
|
|
|
|
psPaperSize.Set( m_pageInfo.GetHeightMils(), m_pageInfo.GetWidthMils() );
|
2012-04-08 23:37:26 +00:00
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%%%%BoundingBox: 0 0 %d %d\n",
|
|
|
|
(int) ceil( psPaperSize.x * BIGPTsPERMIL ),
|
|
|
|
(int) ceil( psPaperSize.y * BIGPTsPERMIL ) );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
|
|
|
// Specify the size of the sheet and the name associated with that size.
|
|
|
|
// (If the "User size" option has been selected for the sheet size,
|
|
|
|
// identify the sheet size as "Custom" (rather than as "User"), but
|
|
|
|
// otherwise use the name assigned by KiCad for each sheet size.)
|
|
|
|
//
|
|
|
|
// (The Document Structuring Convention also supports sheet weight,
|
2009-11-23 15:16:50 +00:00
|
|
|
// sheet color, and sheet type properties being specified within a
|
2008-03-22 05:55:06 +00:00
|
|
|
// %%DocumentMedia comment, but they are not being specified here;
|
|
|
|
// a zero and two null strings are subsequently provided instead.)
|
|
|
|
//
|
|
|
|
// (NOTE: m_Size.y is *supposed* to be listed before m_Size.x;
|
|
|
|
// the order in which they are specified is not wrong!)
|
2011-12-22 21:57:50 +00:00
|
|
|
// Also note pageSize is given in mils, not in internal units and must be
|
|
|
|
// converted to internal units.
|
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
if( m_pageInfo.IsCustom() )
|
|
|
|
{
|
|
|
|
fprintf( m_outputFile, "%%%%DocumentMedia: Custom %d %d 0 () ()\n",
|
2012-05-03 18:37:56 +00:00
|
|
|
KiROUND( psPaperSize.x * BIGPTsPERMIL ),
|
|
|
|
KiROUND( psPaperSize.y * BIGPTsPERMIL ) );
|
2020-11-16 00:04:55 +00:00
|
|
|
}
|
2012-01-16 05:17:23 +00:00
|
|
|
else // a standard paper size
|
2020-11-16 00:04:55 +00:00
|
|
|
{
|
|
|
|
fprintf( m_outputFile, "%%%%DocumentMedia: %s %d %d 0 () ()\n",
|
|
|
|
TO_UTF8( m_pageInfo.GetType() ),
|
2012-05-03 18:37:56 +00:00
|
|
|
KiROUND( psPaperSize.x * BIGPTsPERMIL ),
|
|
|
|
KiROUND( psPaperSize.y * BIGPTsPERMIL ) );
|
2020-11-16 00:04:55 +00:00
|
|
|
}
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
if( m_pageInfo.IsPortrait() )
|
|
|
|
fprintf( m_outputFile, "%%%%Orientation: Portrait\n" );
|
2012-04-08 23:37:26 +00:00
|
|
|
else
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%%%%Orientation: Landscape\n" );
|
2009-06-28 16:50:42 +00:00
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%%%%EndComments\n" );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
|
|
|
// Now specify various other details.
|
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
for( int ii = 0; PSMacro[ii] != NULL; ii++ )
|
|
|
|
{
|
2020-11-16 00:04:55 +00:00
|
|
|
fputs( PSMacro[ii], m_outputFile );
|
2012-05-03 18:37:56 +00:00
|
|
|
}
|
|
|
|
|
2008-03-22 05:55:06 +00:00
|
|
|
// The following string has been specified here (rather than within
|
|
|
|
// PSMacro[]) to highlight that it has been provided to ensure that the
|
|
|
|
// contents of the postscript file comply with the details specified
|
|
|
|
// within the Document Structuring Convention.
|
2012-05-03 18:37:56 +00:00
|
|
|
fputs( "%%Page: 1 1\n"
|
|
|
|
"%%BeginPageSetup\n"
|
2020-04-14 12:25:00 +00:00
|
|
|
"gsave\n"
|
|
|
|
"0.0072 0.0072 scale\n" // Configure postscript for decimils coordinates
|
2020-11-16 00:04:55 +00:00
|
|
|
"linemode1\n", m_outputFile );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
// Rototranslate the coordinate to achieve the landscape layout
|
2020-11-16 00:04:55 +00:00
|
|
|
if( !m_pageInfo.IsPortrait() )
|
|
|
|
fprintf( m_outputFile, "%d 0 translate 90 rotate\n", 10 * psPaperSize.x );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
// Apply the user fine scale adjustments
|
|
|
|
if( plotScaleAdjX != 1.0 || plotScaleAdjY != 1.0 )
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%g %g scale\n", plotScaleAdjX, plotScaleAdjY );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
// Set default line width
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%g setlinewidth\n",
|
2020-04-14 12:25:00 +00:00
|
|
|
userToDeviceSize( m_renderSettings->GetDefaultPenWidth() ) );
|
2020-11-16 00:04:55 +00:00
|
|
|
fputs( "%%EndPageSetup\n", m_outputFile );
|
2010-03-31 16:59:32 +00:00
|
|
|
|
|
|
|
return true;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
bool PS_PLOTTER::EndPlot()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2020-11-16 00:04:55 +00:00
|
|
|
wxASSERT( m_outputFile );
|
2012-05-03 18:37:56 +00:00
|
|
|
fputs( "showpage\n"
|
|
|
|
"grestore\n"
|
2020-11-16 00:04:55 +00:00
|
|
|
"%%EOF\n", m_outputFile );
|
|
|
|
fclose( m_outputFile );
|
|
|
|
m_outputFile = NULL;
|
2010-03-31 16:59:32 +00:00
|
|
|
|
|
|
|
return true;
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-04-28 16:13:18 +00:00
|
|
|
void PS_PLOTTER::Text( const wxPoint& aPos,
|
2017-02-20 16:57:41 +00:00
|
|
|
const COLOR4D aColor,
|
2014-04-28 16:13:18 +00:00
|
|
|
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,
|
2016-09-19 11:01:36 +00:00
|
|
|
bool aMultilineAllowed,
|
|
|
|
void* aData )
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
2012-05-03 18:37:56 +00:00
|
|
|
SetCurrentLineWidth( aWidth );
|
|
|
|
SetColor( aColor );
|
2011-04-20 08:13:21 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
// Draw the hidden postscript text (if requested)
|
2019-12-28 00:55:11 +00:00
|
|
|
if( m_textMode == PLOT_TEXT_MODE::PHANTOM )
|
2012-05-03 18:37:56 +00:00
|
|
|
{
|
2020-07-26 13:57:07 +00:00
|
|
|
std::string ps_test = encodeStringForPlotter( aText );
|
2014-04-28 16:13:18 +00:00
|
|
|
DPOINT pos_dev = userToDeviceCoordinates( aPos );
|
2020-11-16 00:04:55 +00:00
|
|
|
fprintf( m_outputFile, "%s %g %g phantomshow\n", ps_test.c_str(), pos_dev.x, pos_dev.y );
|
2010-09-13 11:51:09 +00:00
|
|
|
}
|
2009-06-28 16:50:42 +00:00
|
|
|
|
2020-05-18 12:37:05 +00:00
|
|
|
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth,
|
|
|
|
aItalic, aBold, aMultilineAllowed );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
2012-03-26 21:45:05 +00:00
|
|
|
|
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
/**
|
|
|
|
* Character widths for Helvetica
|
|
|
|
*/
|
|
|
|
const double hv_widths[256] = {
|
|
|
|
0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.278, 0.355, 0.556, 0.556, 0.889, 0.667, 0.191,
|
|
|
|
0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
|
|
|
|
0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
|
|
|
|
0.556, 0.556, 0.278, 0.278, 0.584, 0.584, 0.584, 0.556,
|
|
|
|
1.015, 0.667, 0.667, 0.722, 0.722, 0.667, 0.611, 0.778,
|
|
|
|
0.722, 0.278, 0.500, 0.667, 0.556, 0.833, 0.722, 0.778,
|
|
|
|
0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
|
|
|
|
0.667, 0.667, 0.611, 0.278, 0.278, 0.278, 0.469, 0.556,
|
|
|
|
0.333, 0.556, 0.556, 0.500, 0.556, 0.556, 0.278, 0.556,
|
|
|
|
0.556, 0.222, 0.222, 0.500, 0.222, 0.833, 0.556, 0.556,
|
|
|
|
0.556, 0.556, 0.333, 0.500, 0.278, 0.556, 0.500, 0.722,
|
|
|
|
0.500, 0.500, 0.500, 0.334, 0.260, 0.334, 0.584, 0.278,
|
|
|
|
0.278, 0.278, 0.222, 0.556, 0.333, 1.000, 0.556, 0.556,
|
|
|
|
0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.222, 0.222, 0.333, 0.333, 0.350, 0.556, 1.000,
|
|
|
|
0.333, 1.000, 0.500, 0.333, 0.944, 0.278, 0.278, 0.667,
|
|
|
|
0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.260, 0.556,
|
|
|
|
0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
|
|
|
|
0.400, 0.584, 0.333, 0.333, 0.333, 0.556, 0.537, 0.278,
|
|
|
|
0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
|
|
|
|
0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 1.000, 0.722,
|
|
|
|
0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
|
|
|
|
0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
|
|
|
|
0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.500,
|
|
|
|
0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.584,
|
|
|
|
0.611, 0.556, 0.556, 0.556, 0.556, 0.500, 0.556, 0.500
|
|
|
|
};
|
2012-03-26 21:45:05 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
/**
|
|
|
|
* Character widths for Helvetica-Bold
|
|
|
|
*/
|
|
|
|
const double hvb_widths[256] = {
|
|
|
|
0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.333, 0.474, 0.556, 0.556, 0.889, 0.722, 0.238,
|
|
|
|
0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
|
|
|
|
0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
|
|
|
|
0.556, 0.556, 0.333, 0.333, 0.584, 0.584, 0.584, 0.611,
|
|
|
|
0.975, 0.722, 0.722, 0.722, 0.722, 0.667, 0.611, 0.778,
|
|
|
|
0.722, 0.278, 0.556, 0.722, 0.611, 0.833, 0.722, 0.778,
|
|
|
|
0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
|
|
|
|
0.667, 0.667, 0.611, 0.333, 0.278, 0.333, 0.584, 0.556,
|
|
|
|
0.333, 0.556, 0.611, 0.556, 0.611, 0.556, 0.333, 0.611,
|
|
|
|
0.611, 0.278, 0.278, 0.556, 0.278, 0.889, 0.611, 0.611,
|
|
|
|
0.611, 0.611, 0.389, 0.556, 0.333, 0.611, 0.556, 0.778,
|
|
|
|
0.556, 0.556, 0.500, 0.389, 0.280, 0.389, 0.584, 0.278,
|
|
|
|
0.278, 0.278, 0.278, 0.556, 0.500, 1.000, 0.556, 0.556,
|
|
|
|
0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.278, 0.278, 0.500, 0.500, 0.350, 0.556, 1.000,
|
|
|
|
0.333, 1.000, 0.556, 0.333, 0.944, 0.278, 0.278, 0.667,
|
|
|
|
0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.280, 0.556,
|
|
|
|
0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
|
|
|
|
0.400, 0.584, 0.333, 0.333, 0.333, 0.611, 0.556, 0.278,
|
|
|
|
0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
|
|
|
|
0.722, 0.722, 0.722, 0.722, 0.722, 0.722, 1.000, 0.722,
|
|
|
|
0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
|
|
|
|
0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
|
|
|
|
0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.556,
|
|
|
|
0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.584,
|
|
|
|
0.611, 0.611, 0.611, 0.611, 0.611, 0.556, 0.611, 0.556
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Character widths for Helvetica-Oblique
|
|
|
|
*/
|
|
|
|
const double hvo_widths[256] = {
|
|
|
|
0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.278, 0.355, 0.556, 0.556, 0.889, 0.667, 0.191,
|
|
|
|
0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
|
|
|
|
0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
|
|
|
|
0.556, 0.556, 0.278, 0.278, 0.584, 0.584, 0.584, 0.556,
|
|
|
|
1.015, 0.667, 0.667, 0.722, 0.722, 0.667, 0.611, 0.778,
|
|
|
|
0.722, 0.278, 0.500, 0.667, 0.556, 0.833, 0.722, 0.778,
|
|
|
|
0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
|
|
|
|
0.667, 0.667, 0.611, 0.278, 0.278, 0.278, 0.469, 0.556,
|
|
|
|
0.333, 0.556, 0.556, 0.500, 0.556, 0.556, 0.278, 0.556,
|
|
|
|
0.556, 0.222, 0.222, 0.500, 0.222, 0.833, 0.556, 0.556,
|
|
|
|
0.556, 0.556, 0.333, 0.500, 0.278, 0.556, 0.500, 0.722,
|
|
|
|
0.500, 0.500, 0.500, 0.334, 0.260, 0.334, 0.584, 0.278,
|
|
|
|
0.278, 0.278, 0.222, 0.556, 0.333, 1.000, 0.556, 0.556,
|
|
|
|
0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.222, 0.222, 0.333, 0.333, 0.350, 0.556, 1.000,
|
|
|
|
0.333, 1.000, 0.500, 0.333, 0.944, 0.278, 0.278, 0.667,
|
|
|
|
0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.260, 0.556,
|
|
|
|
0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
|
|
|
|
0.400, 0.584, 0.333, 0.333, 0.333, 0.556, 0.537, 0.278,
|
|
|
|
0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
|
|
|
|
0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 1.000, 0.722,
|
|
|
|
0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
|
|
|
|
0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
|
|
|
|
0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.500,
|
|
|
|
0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.584,
|
|
|
|
0.611, 0.556, 0.556, 0.556, 0.556, 0.500, 0.556, 0.500
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Character widths for Helvetica-BoldOblique
|
|
|
|
*/
|
|
|
|
const double hvbo_widths[256] = {
|
|
|
|
0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.333, 0.474, 0.556, 0.556, 0.889, 0.722, 0.238,
|
|
|
|
0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
|
|
|
|
0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
|
|
|
|
0.556, 0.556, 0.333, 0.333, 0.584, 0.584, 0.584, 0.611,
|
|
|
|
0.975, 0.722, 0.722, 0.722, 0.722, 0.667, 0.611, 0.778,
|
|
|
|
0.722, 0.278, 0.556, 0.722, 0.611, 0.833, 0.722, 0.778,
|
|
|
|
0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
|
|
|
|
0.667, 0.667, 0.611, 0.333, 0.278, 0.333, 0.584, 0.556,
|
|
|
|
0.333, 0.556, 0.611, 0.556, 0.611, 0.556, 0.333, 0.611,
|
|
|
|
0.611, 0.278, 0.278, 0.556, 0.278, 0.889, 0.611, 0.611,
|
|
|
|
0.611, 0.611, 0.389, 0.556, 0.333, 0.611, 0.556, 0.778,
|
|
|
|
0.556, 0.556, 0.500, 0.389, 0.280, 0.389, 0.584, 0.278,
|
|
|
|
0.278, 0.278, 0.278, 0.556, 0.500, 1.000, 0.556, 0.556,
|
|
|
|
0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
|
|
|
|
0.278, 0.278, 0.278, 0.500, 0.500, 0.350, 0.556, 1.000,
|
|
|
|
0.333, 1.000, 0.556, 0.333, 0.944, 0.278, 0.278, 0.667,
|
|
|
|
0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.280, 0.556,
|
|
|
|
0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
|
|
|
|
0.400, 0.584, 0.333, 0.333, 0.333, 0.611, 0.556, 0.278,
|
|
|
|
0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
|
|
|
|
0.722, 0.722, 0.722, 0.722, 0.722, 0.722, 1.000, 0.722,
|
|
|
|
0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
|
|
|
|
0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
|
|
|
|
0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.556,
|
|
|
|
0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
|
|
|
|
0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.584,
|
|
|
|
0.611, 0.611, 0.611, 0.611, 0.611, 0.556, 0.611, 0.556
|
|
|
|
};
|