36#include <fmt/format.h> 
   94                                   const EDA_ANGLE& aPadOrient, 
void* aData )
 
  102    if( size.
x > size.
y )
 
  104        std::swap( size.
x, size.
y );
 
 
  126                                   const EDA_ANGLE& aPadOrient, 
void* aData )
 
  128    std::vector<VECTOR2I> cornerList;
 
  130    cornerList.reserve( 4 );
 
  136    corner.
x = aPadPos.
x - dx;
 
  137    corner.
y = aPadPos.
y + dy;
 
  138    cornerList.push_back( corner );
 
  139    corner.
x = aPadPos.
x - dx;
 
  140    corner.
y = aPadPos.
y - dy;
 
  141    cornerList.push_back( corner );
 
  142    corner.
x = aPadPos.
x + dx;
 
  143    corner.
y = aPadPos.
y - dy;
 
  144    cornerList.push_back( corner );
 
  145    corner.
x = aPadPos.
x + dx;
 
  146    corner.
y = aPadPos.
y + dy,
 
  147    cornerList.push_back( corner );
 
  149    for( 
unsigned ii = 0; ii < cornerList.size(); ii++ )
 
  150        RotatePoint( cornerList[ii], aPadPos, aPadOrient );
 
  152    cornerList.push_back( cornerList[0] );
 
 
  159                                        int aCornerRadius, 
const EDA_ANGLE& aOrient, 
void* aData )
 
  165    std::vector<VECTOR2I> cornerList;
 
  171    for( 
int ii = 0; ii < poly.
PointCount(); ++ii )
 
  172        cornerList.emplace_back( poly.
CPoint( ii ).
x, poly.
CPoint( ii ).
y );
 
  175    cornerList.push_back( cornerList[0] );
 
 
  185    std::vector<VECTOR2I> cornerList;
 
  187    for( 
int cnt = 0; cnt < aPolygons->
OutlineCount(); ++cnt )
 
  192        for( 
int ii = 0; ii < poly.
PointCount(); ++ii )
 
  193            cornerList.emplace_back( poly.
CPoint( ii ).
x, poly.
CPoint( ii ).
y );
 
  196        cornerList.push_back( cornerList[0] );
 
 
  204                                     const EDA_ANGLE& aPadOrient, 
void* aData )
 
  206    static std::vector<VECTOR2I> cornerList;
 
  209    for( 
int ii = 0; ii < 4; ii++ )
 
  210        cornerList.push_back( aCorners[ii] );
 
  212    for( 
int ii = 0; ii < 4; ii++ )
 
  215        cornerList[ii] += aPadPos;
 
  218    cornerList.push_back( cornerList[0] );
 
 
  234    std::string converted;
 
  238    for( 
unsigned i = 0; i < aUnicode.Len(); i++ )
 
  241        wchar_t ch = aUnicode[i];
 
 
  268                                               bool aItalic, 
bool aBold )
 
  274    for( 
wchar_t asciiCode : aText)
 
  277        if( asciiCode < 256 )
 
  278            tally += width_table[asciiCode];
 
 
  287                              double aScale, 
bool aMirror )
 
 
  304                                            const wxString&          aText,
 
  313                                            double                   *wideningFactor,
 
  320                                            double                   *heightFactor )
 
  336        wxFAIL_MSG( wxT( 
"Indeterminate state legal only in dialogs." ) );
 
  346        wxFAIL_MSG( wxT( 
"Indeterminate state legal only in dialogs." ) );
 
  358    *wideningFactor = sz_dev.
x / sz_dev.
y;
 
  362        *wideningFactor = -*wideningFactor;
 
  366    double sinalpha = sin( alpha );
 
  367    double cosalpha = cos( alpha );
 
 
  389    else if( aWidth == 0 )
 
  392    wxASSERT_MSG( aWidth > 0, 
"Plotter called to set negative pen width" );
 
 
  411        r = ( r * a ) + ( 1 - a );
 
  412        g = ( g * a ) + ( 1 - a );
 
  413        b = ( b * a ) + ( 1 - a );
 
  417    fmt::print( 
m_outputFile, 
"{:.3g} {:.3g} {:.3g} setrgbcolor\n", r, g, b );
 
 
  446        fmt::print( 
m_outputFile, 
"[{} {} {} {} {} {}] 0 setdash\n",
 
 
  469    if( aCornerRadius > 0 )
 
  482    fmt::print( 
m_outputFile, 
"{:g} {:g} {:g} {:g} rect{}\n",
 
 
  519    VECTOR2D  start( aRadius * aStartAngle.
Cos(), aRadius * aStartAngle.
Sin() );
 
  527    EDA_ANGLE startAngle( start_device - center_device );
 
  528    EDA_ANGLE endAngle( end_device - center_device );
 
  532        std::swap( startAngle, endAngle );
 
  536    fmt::print( 
m_outputFile, 
"{:g} {:g} {:g} {:g} {:g} arc{}\n",
 
 
  554    if( aCornerList.size() <= 1 )
 
  558    fmt::print( 
m_outputFile, 
"newpath\n{:g} {:g} moveto\n", pos.
x, pos.
y );
 
  560    for( 
unsigned ii = 1; ii < aCornerList.size(); ii++ )
 
 
  574    std::vector<VECTOR2I> cornerList;
 
  575    cornerList.reserve( aCornerList.
PointCount() );
 
  577    for( 
int ii = 0; ii < aCornerList.
PointCount(); ii++ )
 
  578        cornerList.emplace_back( aCornerList.
CPoint( ii ) );
 
  580    if( aCornerList.
IsClosed() && cornerList.front() != cornerList.back() )
 
  581        cornerList.emplace_back( aCornerList.
CPoint( 0 ) );
 
  583    PlotPoly( cornerList, aFill, aWidth, aData );
 
 
  590    pix_size.
x = aImage.GetWidth();
 
  591    pix_size.
y = aImage.GetHeight();
 
  592    VECTOR2D drawsize( aScaleFactor * pix_size.
x,
 
  593                       aScaleFactor * pix_size.
y ); 
 
  597    start.
x -= drawsize.
x / 2;    
 
  598    start.
y += drawsize.
y / 2;    
 
  602    end.x = start.
x + drawsize.
x;
 
  603    end.y = start.
y - drawsize.
y;
 
  606    fmt::print( 
m_outputFile, 
"/pix {} string def\n", pix_size.
x );
 
  610    fmt::print( 
m_outputFile, 
"{:g} {:g} translate\n", start_dev.
x, start_dev.
y );
 
  622    fmt::print( 
m_outputFile, 
" [{} 0 0 {} 0 {}]\n", pix_size.
x, -pix_size.
y, pix_size.
y );
 
  625    fmt::print( 
m_outputFile, 
"{{currentfile pix readhexstring pop}}\n" );
 
  636    for( 
int yy = 0; yy < pix_size.
y; yy ++ )
 
  638        for( 
int xx = 0; xx < pix_size.
x; xx++, jj++ )
 
  646            int red, green, blue;
 
  647            red = aImage.GetRed( xx, yy) & 0xFF;
 
  648            green = aImage.GetGreen( xx, yy) & 0xFF;
 
  649            blue = aImage.GetBlue( xx, yy) & 0xFF;
 
  652            if( aImage.HasAlpha() )
 
  654                unsigned char alpha = aImage.GetAlpha( xx, yy ) & 0xFF;
 
  658                    float a = 1.0 - ( (float) alpha / 255.0 );
 
  659                    red =   ( int )( 
red   + ( a * 0xFF ) ) & 0xFF;
 
  660                    green = ( int )( green + ( a * 0xFF ) ) & 0xFF;
 
  661                    blue =  ( int )( blue  + ( a * 0xFF ) ) & 0xFF;
 
  665            if( aImage.HasMask() )
 
  667                if( 
red == aImage.GetMaskRed() && green == aImage.GetMaskGreen()
 
  668                        && blue == aImage.GetMaskBlue() )
 
  683                unsigned char grey = 
KiROUND( 
red * 0.2126 + green * 0.7152 + blue * 0.0722 );
 
 
  723                    ( plume==
'D' ) ? 
"line" : 
"move" );
 
 
  735    std::string PSMacro =
 
  737    "/line { newpath moveto lineto stroke } bind def\n" 
  738    "/cir0 { newpath 0 360 arc stroke } bind def\n" 
  739    "/cir1 { newpath 0 360 arc gsave fill grestore stroke } bind def\n" 
  740    "/cir2 { newpath 0 360 arc gsave fill grestore stroke } bind def\n" 
  741    "/arc0 { newpath arc stroke } bind def\n" 
  742    "/arc1 { newpath 4 index 4 index moveto arc closepath gsave fill\n" 
  743    "    grestore stroke } bind def\n" 
  744    "/arc2 { newpath 4 index 4 index moveto arc closepath gsave fill\n" 
  745    "    grestore stroke } bind def\n" 
  746    "/poly0 { stroke } bind def\n" 
  747    "/poly1 { closepath gsave fill grestore stroke } bind def\n" 
  748    "/poly2 { closepath gsave fill grestore stroke } bind def\n" 
  749    "/rect0 { rectstroke } bind def\n" 
  750    "/rect1 { rectfill } bind def\n" 
  751    "/rect2 { rectfill } bind def\n" 
  752    "/linemode0 { 0 setlinecap 0 setlinejoin 0 setlinewidth } bind def\n" 
  753    "/linemode1 { 1 setlinecap 1 setlinejoin } bind def\n" 
  754    "/dashedline { [200] 100 setdash } bind def\n" 
  755    "/solidline { [] 0 setdash } bind def\n" 
  758    "/phantomshow { moveto\n" 
  759    "    /KicadFont findfont 0.000001 scalefont setfont\n" 
  763    "/textshow { gsave\n" 
  764    "    findfont exch scalefont setfont concat 1 scale 0 0 moveto show\n" 
  769    "  findfont dup length dict begin\n" 
  770    "  { 1 index /FID ne\n" 
  772    "    { pop pop } ifelse\n" 
  774    "  /Encoding ISOLatin1Encoding def\n" 
  779    "/KicadFont /Helvetica reencodefont definefont pop\n" 
  780    "/KicadFont-Bold /Helvetica-Bold reencodefont definefont pop\n" 
  781    "/KicadFont-Oblique /Helvetica-Oblique reencodefont definefont pop\n" 
  782    "/KicadFont-BoldOblique /Helvetica-BoldOblique reencodefont definefont pop\n" 
  785    time_t time1970 = time( 
nullptr );
 
  793    fmt::print( 
m_outputFile, 
"%%CreationDate: {}", ctime( &time1970 ) );
 
  799    const double BIGPTsPERMIL = 0.072;
 
  813                (
int) ceil( psPaperSize.
x * BIGPTsPERMIL ),
 
  814                (
int) ceil( psPaperSize.
y * BIGPTsPERMIL ) );
 
  831    wxString pageType = 
m_pageInfo.GetTypeAsString();
 
  835    fmt::print( 
m_outputFile, 
"%%DocumentMedia: {} {} {} 0 () ()\n",
 
  837                KiROUND( psPaperSize.
x * BIGPTsPERMIL ),
 
  838                KiROUND( psPaperSize.
y * BIGPTsPERMIL ) );
 
  841        fmt::print( 
m_outputFile, 
"%%Orientation: Portrait\n" );
 
  843        fmt::print( 
m_outputFile, 
"%%Orientation: Landscape\n" );
 
  860                "0.0072 0.0072 scale\n"     
  866        fmt::print( 
m_outputFile, 
"{} 0 translate 90 rotate\n", 10 * psPaperSize.
x );
 
 
  897                       const wxString&        aText,
 
  905                       bool                   aMultilineAllowed,
 
  918        fmt::print( 
m_outputFile, 
"{} {:g} {:g} phantomshow\n", ps_test.c_str(), pos_dev.
x, pos_dev.
y );
 
  922                   aItalic, aBold, aMultilineAllowed, aFont, aFontMetrics, aData );
 
 
  928                           const wxString&        aText,
 
  948    PLOTTER::PlotText( aPos, aColor, aText, aAttributes, aFont, aFontMetrics, aData );
 
 
  956    0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
 
  957    0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
 
  958    0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
 
  959    0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
 
  960    0.278, 0.278, 0.355, 0.556, 0.556, 0.889, 0.667, 0.191,
 
  961    0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
 
  962    0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
 
  963    0.556, 0.556, 0.278, 0.278, 0.584, 0.584, 0.584, 0.556,
 
  964    1.015, 0.667, 0.667, 0.722, 0.722, 0.667, 0.611, 0.778,
 
  965    0.722, 0.278, 0.500, 0.667, 0.556, 0.833, 0.722, 0.778,
 
  966    0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
 
  967    0.667, 0.667, 0.611, 0.278, 0.278, 0.278, 0.469, 0.556,
 
  968    0.333, 0.556, 0.556, 0.500, 0.556, 0.556, 0.278, 0.556,
 
  969    0.556, 0.222, 0.222, 0.500, 0.222, 0.833, 0.556, 0.556,
 
  970    0.556, 0.556, 0.333, 0.500, 0.278, 0.556, 0.500, 0.722,
 
  971    0.500, 0.500, 0.500, 0.334, 0.260, 0.334, 0.584, 0.278,
 
  972    0.278, 0.278, 0.222, 0.556, 0.333, 1.000, 0.556, 0.556,
 
  973    0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
 
  974    0.278, 0.222, 0.222, 0.333, 0.333, 0.350, 0.556, 1.000,
 
  975    0.333, 1.000, 0.500, 0.333, 0.944, 0.278, 0.278, 0.667,
 
  976    0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.260, 0.556,
 
  977    0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
 
  978    0.400, 0.584, 0.333, 0.333, 0.333, 0.556, 0.537, 0.278,
 
  979    0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
 
  980    0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 1.000, 0.722,
 
  981    0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
 
  982    0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
 
  983    0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
 
  984    0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.500,
 
  985    0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
 
  986    0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.584,
 
  987    0.611, 0.556, 0.556, 0.556, 0.556, 0.500, 0.556, 0.500
 
 
  995    0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
 
  996    0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
 
  997    0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
 
  998    0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
 
  999    0.278, 0.333, 0.474, 0.556, 0.556, 0.889, 0.722, 0.238,
 
 1000    0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
 
 1001    0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
 
 1002    0.556, 0.556, 0.333, 0.333, 0.584, 0.584, 0.584, 0.611,
 
 1003    0.975, 0.722, 0.722, 0.722, 0.722, 0.667, 0.611, 0.778,
 
 1004    0.722, 0.278, 0.556, 0.722, 0.611, 0.833, 0.722, 0.778,
 
 1005    0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
 
 1006    0.667, 0.667, 0.611, 0.333, 0.278, 0.333, 0.584, 0.556,
 
 1007    0.333, 0.556, 0.611, 0.556, 0.611, 0.556, 0.333, 0.611,
 
 1008    0.611, 0.278, 0.278, 0.556, 0.278, 0.889, 0.611, 0.611,
 
 1009    0.611, 0.611, 0.389, 0.556, 0.333, 0.611, 0.556, 0.778,
 
 1010    0.556, 0.556, 0.500, 0.389, 0.280, 0.389, 0.584, 0.278,
 
 1011    0.278, 0.278, 0.278, 0.556, 0.500, 1.000, 0.556, 0.556,
 
 1012    0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
 
 1013    0.278, 0.278, 0.278, 0.500, 0.500, 0.350, 0.556, 1.000,
 
 1014    0.333, 1.000, 0.556, 0.333, 0.944, 0.278, 0.278, 0.667,
 
 1015    0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.280, 0.556,
 
 1016    0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
 
 1017    0.400, 0.584, 0.333, 0.333, 0.333, 0.611, 0.556, 0.278,
 
 1018    0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
 
 1019    0.722, 0.722, 0.722, 0.722, 0.722, 0.722, 1.000, 0.722,
 
 1020    0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
 
 1021    0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
 
 1022    0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
 
 1023    0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.556,
 
 1024    0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
 
 1025    0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.584,
 
 1026    0.611, 0.611, 0.611, 0.611, 0.611, 0.556, 0.611, 0.556
 
 
 1034    0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
 
 1035    0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
 
 1036    0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
 
 1037    0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
 
 1038    0.278, 0.278, 0.355, 0.556, 0.556, 0.889, 0.667, 0.191,
 
 1039    0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
 
 1040    0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
 
 1041    0.556, 0.556, 0.278, 0.278, 0.584, 0.584, 0.584, 0.556,
 
 1042    1.015, 0.667, 0.667, 0.722, 0.722, 0.667, 0.611, 0.778,
 
 1043    0.722, 0.278, 0.500, 0.667, 0.556, 0.833, 0.722, 0.778,
 
 1044    0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
 
 1045    0.667, 0.667, 0.611, 0.278, 0.278, 0.278, 0.469, 0.556,
 
 1046    0.333, 0.556, 0.556, 0.500, 0.556, 0.556, 0.278, 0.556,
 
 1047    0.556, 0.222, 0.222, 0.500, 0.222, 0.833, 0.556, 0.556,
 
 1048    0.556, 0.556, 0.333, 0.500, 0.278, 0.556, 0.500, 0.722,
 
 1049    0.500, 0.500, 0.500, 0.334, 0.260, 0.334, 0.584, 0.278,
 
 1050    0.278, 0.278, 0.222, 0.556, 0.333, 1.000, 0.556, 0.556,
 
 1051    0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
 
 1052    0.278, 0.222, 0.222, 0.333, 0.333, 0.350, 0.556, 1.000,
 
 1053    0.333, 1.000, 0.500, 0.333, 0.944, 0.278, 0.278, 0.667,
 
 1054    0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.260, 0.556,
 
 1055    0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
 
 1056    0.400, 0.584, 0.333, 0.333, 0.333, 0.556, 0.537, 0.278,
 
 1057    0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
 
 1058    0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 1.000, 0.722,
 
 1059    0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
 
 1060    0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
 
 1061    0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
 
 1062    0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.500,
 
 1063    0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
 
 1064    0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.584,
 
 1065    0.611, 0.556, 0.556, 0.556, 0.556, 0.500, 0.556, 0.500
 
 
 1073    0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
 
 1074    0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
 
 1075    0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
 
 1076    0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
 
 1077    0.278, 0.333, 0.474, 0.556, 0.556, 0.889, 0.722, 0.238,
 
 1078    0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
 
 1079    0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
 
 1080    0.556, 0.556, 0.333, 0.333, 0.584, 0.584, 0.584, 0.611,
 
 1081    0.975, 0.722, 0.722, 0.722, 0.722, 0.667, 0.611, 0.778,
 
 1082    0.722, 0.278, 0.556, 0.722, 0.611, 0.833, 0.722, 0.778,
 
 1083    0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
 
 1084    0.667, 0.667, 0.611, 0.333, 0.278, 0.333, 0.584, 0.556,
 
 1085    0.333, 0.556, 0.611, 0.556, 0.611, 0.556, 0.333, 0.611,
 
 1086    0.611, 0.278, 0.278, 0.556, 0.278, 0.889, 0.611, 0.611,
 
 1087    0.611, 0.611, 0.389, 0.556, 0.333, 0.611, 0.556, 0.778,
 
 1088    0.556, 0.556, 0.500, 0.389, 0.280, 0.389, 0.584, 0.278,
 
 1089    0.278, 0.278, 0.278, 0.556, 0.500, 1.000, 0.556, 0.556,
 
 1090    0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
 
 1091    0.278, 0.278, 0.278, 0.500, 0.500, 0.350, 0.556, 1.000,
 
 1092    0.333, 1.000, 0.556, 0.333, 0.944, 0.278, 0.278, 0.667,
 
 1093    0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.280, 0.556,
 
 1094    0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
 
 1095    0.400, 0.584, 0.333, 0.333, 0.333, 0.611, 0.556, 0.278,
 
 1096    0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
 
 1097    0.722, 0.722, 0.722, 0.722, 0.722, 0.722, 1.000, 0.722,
 
 1098    0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
 
 1099    0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
 
 1100    0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
 
 1101    0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.556,
 
 1102    0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
 
 1103    0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.584,
 
 1104    0.611, 0.611, 0.611, 0.611, 0.611, 0.556, 0.611, 0.556
 
 
const double hvbo_widths[256]
Character widths for Helvetica-BoldOblique.
 
static int getFillId(FILL_T aFill)
 
const double hvb_widths[256]
Character widths for Helvetica-Bold.
 
const double hv_widths[256]
Character widths for Helvetica.
 
const double hvo_widths[256]
Character widths for Helvetica-Oblique.
 
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
 
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
 
static const COLOR4D WHITE
 
FONT is an abstract base class for both outline and stroke fonts.
 
A color representation with 4 components: red, green, blue, alpha.
 
double GetDotMarkLenIU(int aLineWidth) const
 
double GetDashGapLenIU(int aLineWidth) const
 
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width)=0
 
static const int USE_DEFAULT_LINE_WIDTH
 
virtual VECTOR2D userToDeviceCoordinates(const VECTOR2I &aCoordinate)
Modify coordinates according to the orientation, scale factor, and offsets trace.
 
virtual VECTOR2D userToDeviceSize(const VECTOR2I &size)
Modify size according to the plotter scale factors (VECTOR2I version, returns a VECTOR2D).
 
int GetPlotterArcHighDef() const
 
double m_plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
 
FILE * m_outputFile
Output file.
 
static const int DO_NOT_SET_LINE_WIDTH
 
virtual void ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, void *aData)
 
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont=nullptr, const KIFONT::METRICS &aFontMetrics=KIFONT::METRICS::Default(), void *aData=nullptr)
 
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth, void *aData)=0
Draw a polygon ( filled or not ).
 
RENDER_SETTINGS * m_renderSettings
 
virtual void Text(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aPenWidth, bool aItalic, bool aBold, bool aMultilineAllowed, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr)
Draw text with the plotter.
 
virtual int GetCurrentLineWidth() const
 
double GetDashMarkLenIU(int aLineWidth) const
 
static const double postscriptTextAscent
Height of the postscript font (from the AFM)
 
virtual void SetColor(const COLOR4D &color) override
The SetColor implementation is split with the subclasses: the PSLIKE computes the rgb values,...
 
virtual void emitSetRGBColor(double r, double g, double b, double a)=0
Virtual primitive for emitting the setrgbcolor operator.
 
PLOT_TEXT_MODE m_textMode
How to draw text.
 
virtual void FlashRegularPolygon(const VECTOR2I &aShapePos, int aDiameter, int aCornerCount, const EDA_ANGLE &aOrient, void *aData) override
Flash a regular polygon.
 
int returnPostscriptTextWidth(const wxString &aText, int aXSize, bool aItalic, bool aBold)
Sister function for the GRTextWidth in gr_text.cpp Does the same processing (i.e.
 
virtual void FlashPadCircle(const VECTOR2I &aPadPos, int aDiameter, void *aData) override
 
virtual void FlashPadOval(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, void *aData) override
 
virtual void FlashPadRoundRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, int aCornerRadius, const EDA_ANGLE &aOrient, void *aData) override
 
double plotScaleAdjX
Fine user scale adjust ( = 1.0 if no correction)
 
void computeTextParameters(const VECTOR2I &aPos, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, bool aMirror, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_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)
This is the core for postscript/PDF text alignment.
 
virtual std::string encodeStringForPlotter(const wxString &aUnicode)
convert a wxString unicode string to a char string compatible with the accepted string plotter format...
 
virtual void FlashPadCustom(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, SHAPE_POLY_SET *aPolygons, void *aData) override
 
virtual void FlashPadTrapez(const VECTOR2I &aPadPos, const VECTOR2I *aCorners, const EDA_ANGLE &aPadOrient, void *aData) override
Flash a trapezoidal pad.
 
virtual void FlashPadRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, void *aData) override
 
virtual bool EndPlot() override
 
virtual void Text(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr) override
Draw text with the plotter.
 
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width, int aCornerRadius=0) override
 
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr) override
 
virtual void PlotImage(const wxImage &aImage, const VECTOR2I &aPos, double aScaleFactor) override
PostScript-likes at the moment are the only plot engines supporting bitmaps.
 
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
 
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width) override
 
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth, void *aData=nullptr) override
Draw a polygon ( filled or not ).
 
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle) override
PostScript supports dashed lines.
 
virtual void Arc(const VECTOR2D &aCenter, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle, double aRadius, FILL_T aFill, int aWidth) override
 
virtual bool StartPlot(const wxString &aPageNumber) override
The code within this function (and the CloseFilePS function) creates postscript files whose contents ...
 
virtual void emitSetRGBColor(double r, double g, double b, double a) override
Virtual primitive for emitting the setrgbcolor operator.
 
virtual void SetCurrentLineWidth(int width, void *aData=nullptr) override
Set the current line width (in IUs) for the next plot.
 
virtual void PenTo(const VECTOR2I &pos, char plume) override
Moveto/lineto primitive, moves the 'pen' to the specified direction.
 
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
 
bool IsClosed() const override
 
int PointCount() const
Return the number of points (vertices) in this line chain.
 
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
 
Represent a set of closed polygons.
 
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
 
int OutlineCount() const
Return the number of outlines in the set.
 
const SHAPE_LINE_CHAIN Outline() const
 
void SetRadius(int aRadius)
 
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aPosition, const VECTOR2I &aSize, const EDA_ANGLE &aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aInflate, int aError, ERROR_LOC aErrorLoc)
Convert a rectangle with rounded corners and/or chamfered corners to a polygon.
 
static constexpr EDA_ANGLE ANGLE_0
 
static constexpr EDA_ANGLE ANGLE_90
 
@ FILLED_SHAPE
Fill with object color.
 
This file contains miscellaneous commonly used macros and functions.
 
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
 
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
 
Plotting engines similar to ps (PostScript, Gerber, svg)
 
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
 
LINE_STYLE
Dashed line types.
 
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
 
@ GR_TEXT_H_ALIGN_INDETERMINATE
 
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
 
@ GR_TEXT_V_ALIGN_INDETERMINATE
 
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
 
VECTOR2< int32_t > VECTOR2I
 
VECTOR2< double > VECTOR2D