| 729 | |
| 730 | |
| 731 | bool PS_PLOTTER::StartPlot( const wxString& aPageNumber ) |
| 732 | { |
| 733 | wxASSERT( m_outputFile ); |
| 734 | |
| 735 | std::string PSMacro = |
| 736 | "%%BeginProlog\n" |
| 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" |
| 756 | |
| 757 | // This is for 'hidden' text (search anchors for PDF) |
| 758 | "/phantomshow { moveto\n" |
| 759 | " /KicadFont findfont 0.000001 scalefont setfont\n" |
| 760 | " show } bind def\n" |
| 761 | |
| 762 | // This is for regular postscript text |
| 763 | "/textshow { gsave\n" |
| 764 | " findfont exch scalefont setfont concat 1 scale 0 0 moveto show\n" |
| 765 | " } bind def\n" |
| 766 | |
| 767 | // Utility for getting Latin1 encoded fonts |
| 768 | "/reencodefont {\n" |
| 769 | " findfont dup length dict begin\n" |
| 770 | " { 1 index /FID ne\n" |
| 771 | " { def }\n" |
| 772 | " { pop pop } ifelse\n" |
| 773 | " } forall\n" |
| 774 | " /Encoding ISOLatin1Encoding def\n" |
| 775 | " currentdict\n" |
| 776 | " end } bind def\n" |
| 777 | |
| 778 | // Remap AdobeStandard fonts to Latin1 |
| 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" |
| 783 | "%%EndProlog\n"; |
| 784 | |
| 785 | time_t time1970 = time( nullptr ); |
| 786 | |
| 787 | fmt::print( m_outputFile, "%!PS-Adobe-3.0\n" ); // Print header |
| 788 | |