30#include <wx/filename.h>
31#include <wx/mstream.h>
32#include <wx/zstream.h>
33#include <wx/wfstream.h>
34#include <wx/datstrm.h>
35#include <wx/tokenzr.h>
48#include <fmt/format.h>
49#include <fmt/chrono.h>
50#include <fmt/ranges.h>
61#define GLM_ENABLE_EXPERIMENTAL
63#include <glm/gtx/euler_angles.hpp>
74 bool is_ascii7 =
true;
76 for(
size_t ii = 0; ii < aText.Len(); ii++ )
78 if( aText[ii] >= 0x7F )
89 for(
unsigned ii = 0; ii < aText.Len(); ii++ )
91 unsigned int code = aText[ii];
114 for(
size_t ii = 0; ii < aText.Len(); ii++ )
116 unsigned int code = aText[ii];
117 result += fmt::format(
"{:04X}", code);
130 result.reserve( aBytes.size() * 4 + 2 );
133 for(
unsigned char byte : aBytes )
135 if(
byte ==
'(' ||
byte ==
')' ||
byte ==
'\\' )
138 result.push_back(
static_cast<char>(
byte ) );
140 else if( byte < 32 || byte > 126 )
142 fmt::format_to( std::back_inserter(
result ),
"\\{:03o}",
byte );
146 result.push_back(
static_cast<char>(
byte ) );
172 double aScale,
bool aMirror )
199 wxASSERT_MSG( aWidth > 0,
"Plotter called to set negative pen width" );
216 r = ( r * a ) + ( 1 - a );
217 g = ( g * a ) + ( 1 - a );
218 b = ( b * a ) + ( 1 - a );
221 fmt::println(
m_workFile,
"{:g} {:g} {:g} rg {:g} {:g} {:g} RG", r, g, b, r, g, b );
244 fmt::println(
m_workFile,
"[{} {} {} {}] 0 d",
252 fmt::println(
m_workFile,
"[{} {} {} {} {} {}] 0 d",
277 if( aCornerRadius > 0 )
289 if( size.
x == 0 && size.
y == 0 )
301 std::vector<VECTOR2I> cornerList;
303 cornerList.emplace_back( p1.
x, p1.
y );
304 cornerList.emplace_back( p2.
x, p1.
y );
305 cornerList.emplace_back( p2.
x, p2.
y );
306 cornerList.emplace_back( p1.
x, p2.
y );
307 cornerList.emplace_back( p1.
x, p1.
y );
309 PlotPoly( cornerList, fill, width,
nullptr );
322 paintOp = width > 0 ?
'B' :
'f';
324 fmt::println(
m_workFile,
"{:g} {:g} {:g} {:g} re {}",
358 double magic =
radius * 0.551784;
363 "{:g} {:g} {:g} {:g} {:g} {:g} c "
364 "{:g} {:g} {:g} {:g} {:g} {:g} c "
365 "{:g} {:g} {:g} {:g} {:g} {:g} c "
366 "{:g} {:g} {:g} {:g} {:g} {:g} c {}",
369 pos_dev.
x -
radius, pos_dev.
y + magic,
370 pos_dev.
x - magic, pos_dev.
y +
radius,
373 pos_dev.
x + magic, pos_dev.
y +
radius,
374 pos_dev.
x +
radius, pos_dev.
y + magic,
377 pos_dev.
x +
radius, pos_dev.
y - magic,
378 pos_dev.
x + magic, pos_dev.
y -
radius,
381 pos_dev.
x - magic, pos_dev.
y -
radius,
382 pos_dev.
x -
radius, pos_dev.
y - magic,
407 EDA_ANGLE endAngle = startAngle - aAngle;
412 if( startAngle > endAngle )
413 std::swap( startAngle, endAngle );
416 start.
x =
KiROUND( aCenter.
x + aRadius * ( -startAngle ).Cos() );
417 start.
y =
KiROUND( aCenter.
y + aRadius * ( -startAngle ).Sin() );
419 fmt::print(
m_workFile,
"{:g} {:g} m ", pos_dev.
x, pos_dev.
y );
423 end.x =
KiROUND( aCenter.
x + aRadius * ( -ii ).Cos() );
424 end.y =
KiROUND( aCenter.
y + aRadius * ( -ii ).Sin() );
426 fmt::print(
m_workFile,
"{:g} {:g} l ", pos_dev.
x, pos_dev.
y );
429 end.x =
KiROUND( aCenter.
x + aRadius * ( -endAngle ).Cos() );
430 end.y =
KiROUND( aCenter.
y + aRadius * ( -endAngle ).Sin() );
432 fmt::print(
m_workFile,
"{:g} {:g} l ", pos_dev.
x, pos_dev.
y );
443 fmt::println(
m_workFile,
"{:g} {:g} l b", pos_dev.
x, pos_dev.
y );
453 if( aCornerList.size() <= 1 )
462 fmt::println(
m_workFile,
"{:f} {:f} m", pos.
x, pos.
y );
464 for(
unsigned ii = 1; ii < aCornerList.size(); ii++ )
467 fmt::println(
m_workFile,
"{:f} {:f} l", pos.
x, pos.
y );
473 else if( aWidth == 0 )
483 std::vector<VECTOR2I> cornerList;
484 cornerList.reserve( aCornerList.
PointCount() );
486 for(
int ii = 0; ii < aCornerList.
PointCount(); ii++ )
487 cornerList.emplace_back( aCornerList.
CPoint( ii ) );
489 if( aCornerList.
IsClosed() && cornerList.front() != cornerList.back() )
490 cornerList.emplace_back( aCornerList.
CPoint( 0 ) );
492 PlotPoly( cornerList, aFill, aWidth, aData );
519 plume ==
'D' ?
'l' :
'm' );
530 VECTOR2I pix_size( aImage.GetWidth(), aImage.GetHeight() );
533 VECTOR2D drawsize( aScaleFactor * pix_size.
x, aScaleFactor * pix_size.
y );
536 VECTOR2I start( aPos.
x - drawsize.
x / 2, aPos.
y + drawsize.
y / 2 );
540 auto findHandleForImage = [&](
const wxImage& aCurrImage ) ->
int
544 if(
image.IsSameAs( aCurrImage ) )
547 if(
image.GetWidth() != aCurrImage.GetWidth() )
550 if(
image.GetHeight() != aCurrImage.GetHeight() )
553 if(
image.GetType() != aCurrImage.GetType() )
556 if(
image.HasAlpha() != aCurrImage.HasAlpha() )
559 if(
image.HasMask() != aCurrImage.HasMask()
560 ||
image.GetMaskRed() != aCurrImage.GetMaskRed()
561 ||
image.GetMaskGreen() != aCurrImage.GetMaskGreen()
562 ||
image.GetMaskBlue() != aCurrImage.GetMaskBlue() )
565 int pixCount =
image.GetWidth() *
image.GetHeight();
567 if( memcmp(
image.GetData(), aCurrImage.GetData(), pixCount * 3 ) != 0 )
570 if(
image.HasAlpha() && memcmp(
image.GetAlpha(), aCurrImage.GetAlpha(), pixCount ) != 0 )
579 int imgHandle = findHandleForImage( aImage );
581 if( imgHandle == -1 )
597 fmt::println(
m_workFile,
"q {:g} 0 0 {:g} {:g} {:g} cm",
603 fmt::println(
m_workFile,
"/Im{} Do", imgHandle );
650 "<< /Length {} 0 R >>\nstream\n",
656 "<< /Length {} 0 R /Filter /FlateDecode >>\nstream\n",
682 unsigned char *inbuf =
new unsigned char[stream_len];
684 int rc = fread( inbuf, 1, stream_len,
m_workFile );
685 wxASSERT( rc == stream_len );
697 out_count = stream_len;
703 wxMemoryOutputStream memos(
nullptr, std::max( 2000l, stream_len ) ) ;
713 wxZlibOutputStream zos( memos, wxZ_BEST_COMPRESSION, wxZLIB_ZLIB );
715 zos.Write( inbuf, stream_len );
718 wxStreamBuffer* sb = memos.GetOutputStreamBuffer();
720 out_count = sb->Tell();
721 fwrite( sb->GetBufferStart(), 1, out_count,
m_outputFile );
736 const wxString& aParentPageNumber,
const wxString& aParentPageName )
742 m_pageName = aPageName.IsEmpty() ? wxString::Format(
_(
"Page %s" ),
744 : wxString::Format(
_(
"%s (Page %s)" ),
749 : wxString::Format(
_(
"%s (Page %s)" ),
772 "{:g} 0 0 {:g} 0 0 cm 1 J 1 j 0 0 0 rg 0 0 0 RG {:g} w",
779void WriteImageStream(
const wxImage& aImage, wxDataOutputStream& aOut, wxColor bg,
bool colorMode )
781 int w = aImage.GetWidth();
782 int h = aImage.GetHeight();
784 for(
int y = 0; y < h; y++ )
786 for(
int x = 0; x < w; x++ )
788 unsigned char r = aImage.GetRed( x, y ) & 0xFF;
789 unsigned char g = aImage.GetGreen( x, y ) & 0xFF;
790 unsigned char b = aImage.GetBlue( x, y ) & 0xFF;
792 if( aImage.HasMask() )
794 if( r == aImage.GetMaskRed() && g == aImage.GetMaskGreen()
795 && b == aImage.GetMaskBlue() )
812 unsigned char grey =
KiROUND( r * 0.2126 + g * 0.7152 + b * 0.0722 );
823 int w = aImage.GetWidth();
824 int h = aImage.GetHeight();
826 if( aImage.HasMask() )
828 for(
int y = 0; y < h; y++ )
830 for(
int x = 0; x < w; x++ )
832 unsigned char a = 255;
833 unsigned char r = aImage.GetRed( x, y );
834 unsigned char g = aImage.GetGreen( x, y );
835 unsigned char b = aImage.GetBlue( x, y );
837 if( r == aImage.GetMaskRed() && g == aImage.GetMaskGreen()
838 && b == aImage.GetMaskBlue() )
847 else if( aImage.HasAlpha() )
850 aOut.Write8( aImage.GetAlpha(), size );
869 const double PTsPERMIL = 0.072;
872 auto iuToPdfUserSpace =
885 retval.
x = ( psPaperSize.
x - pos.
x );
894 std::vector<int> annotHandles;
900 const BOX2I& box = linkPair.first;
901 const wxString& url = linkPair.second;
908 userSpaceBox.
SetEnd( topRight );
917 const BOX2I& box = menuPair.first;
918 const std::vector<wxString>& urls = menuPair.second;
925 userSpaceBox.
SetEnd( topRight );
932 int annot3DHandle = -1;
937 annotHandles.push_back( annot3DHandle );
941 int annotArrayHandle = -1;
944 if( annotHandles.size() > 0 )
951 for(
int handle : annotHandles )
974 " /ProcSet [/PDF /Text /ImageC /ImageB]\n"
976 " /XObject {} 0 R >>\n"
977 "/MediaBox [0 0 {:g} {:g}]\n",
987 if( annotHandles.size() > 0 )
988 fmt::print(
m_outputFile,
"/Annots {} 0 R", annotArrayHandle );
1001 "/Rect [0 0 {:g} {:g}]\n"
1002 "/NM (3D Annotation)\n"
1005 "/3DA<</A/PO/D/PC/TB true/NP true>>\n"
1023 std::stack<OUTLINE_NODE*> nodes;
1026 while( !nodes.empty() )
1040 nodes.push( child );
1052 for(
const std::pair<BOX2I, wxString>& bookmarkPair : groupVector )
1054 const BOX2I& box = bookmarkPair.first;
1055 const wxString& ref = bookmarkPair.second;
1060 actionHandle =
emitGoToAction( pageHandle, bottomLeft, topRight );
1065 std::sort( groupOutlineNode->
children.begin(), groupOutlineNode->
children.end(),
1068 return a->title < b->title;
1081 return StartPlot( aPageNumber, wxEmptyString );
1114 fmt::print(
m_outputFile,
"%PDF-1.5\n%\200\201\202\203\n" );
1142 "<</S /GoTo /D [{} 0 R /FitR {} {} {} {}]\n"
1152 return actionHandle;
1162 "<</S /GoTo /D [{} 0 R /Fit]\n"
1168 return actionHandle;
1176 int prevHandle = -1;
1177 int nextHandle = -1;
1179 for( std::vector<OUTLINE_NODE*>::iterator it = node->
children.begin();
1182 if( it >= node->
children.end() - 1 )
1188 nextHandle = ( *( it + 1 ) )->entryHandle;
1193 prevHandle = ( *it )->entryHandle;
1197 if( parentHandle != -1 )
1210 fmt::println(
m_outputFile,
"/Next {} 0 R", nextNode );
1215 fmt::println(
m_outputFile,
"/Prev {} 0 R", prevNode );
1220 int32_t count = -1 *
static_cast<int32_t
>( node->
children.size() );
1238 const wxString& aTitle )
1259 "<< /Type /Outlines\n"
1298 if( !glyph.m_stream.empty() )
1299 fmt::print(
m_workFile,
"{}\n", glyph.m_stream );
1302 glyph.m_charProcHandle = charProcHandle;
1309 fmt::println(
m_outputFile,
" /{} {} 0 R", glyph.m_name, glyph.m_charProcHandle );
1324 double fontMatrixScale = 1.0 / subset.
UnitsPerEm();
1332 "<<\n/Type /Font\n/Subtype /Type3\n/Name {}\n/FontBBox [ {:g} {:g} {:g} {:g} ]\n",
1339 "/FontMatrix [ {:g} 0 0 {:g} 0 0 ]\n/CharProcs {} 0 R\n",
1344 "/Encoding << /Type /Encoding /Differences {} >>\n",
1347 "/FirstChar {}\n/LastChar {}\n/Widths {}\n",
1352 "/ToUnicode {} 0 R\n/Resources << /ProcSet [/PDF /Text] >>\n>>\n",
1367 if( !subsetPtr || !subsetPtr->HasGlyphs() )
1370 const std::vector<uint8_t>& fontData = subsetPtr->FontFileData();
1372 if( fontData.empty() )
1376 subsetPtr->SetFontFileHandle( fontFileHandle );
1378 if( !fontData.empty() )
1379 fwrite( fontData.data(), fontData.size(), 1,
m_workFile );
1383 std::string cidMap = subsetPtr->BuildCIDToGIDStream();
1385 subsetPtr->SetCIDMapHandle( cidMapHandle );
1387 if( !cidMap.empty() )
1388 fwrite( cidMap.data(), cidMap.size(), 1,
m_workFile );
1392 std::string toUnicode = subsetPtr->BuildToUnicodeCMap();
1394 subsetPtr->SetToUnicodeHandle( toUnicodeHandle );
1396 if( !toUnicode.empty() )
1402 subsetPtr->SetFontDescriptorHandle( descriptorHandle );
1405 "<<\n/Type /FontDescriptor\n/FontName /{}\n/Flags {}\n/ItalicAngle {:g}\n/Ascent {:g}\n/Descent {:g}\n"
1406 "/CapHeight {:g}\n/StemV {:g}\n/FontBBox [ {:g} {:g} {:g} {:g} ]\n/FontFile2 {} 0 R\n>>\n",
1407 subsetPtr->BaseFontName(),
1409 subsetPtr->ItalicAngle(),
1410 subsetPtr->Ascent(),
1411 subsetPtr->Descent(),
1412 subsetPtr->CapHeight(),
1414 subsetPtr->BBoxMinX(),
1415 subsetPtr->BBoxMinY(),
1416 subsetPtr->BBoxMaxX(),
1417 subsetPtr->BBoxMaxY(),
1418 subsetPtr->FontFileHandle() );
1422 subsetPtr->SetCIDFontHandle( cidFontHandle );
1424 std::string widths = subsetPtr->BuildWidthsArray();
1427 "<<\n/Type /Font\n/Subtype /CIDFontType2\n/BaseFont /{}\n"
1428 "/CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >>\n"
1429 "/FontDescriptor {} 0 R\n/W {}\n/CIDToGIDMap {} 0 R\n>>\n",
1430 subsetPtr->BaseFontName(),
1431 subsetPtr->FontDescriptorHandle(),
1433 subsetPtr->CIDMapHandle() );
1437 subsetPtr->SetFontHandle( fontHandle );
1440 "<<\n/Type /Font\n/Subtype /Type0\n/BaseFont /{}\n/Encoding /Identity-H\n"
1441 "/DescendantFonts [ {} 0 R ]\n/ToUnicode {} 0 R\n>>\n",
1442 subsetPtr->BaseFontName(),
1443 subsetPtr->CIDFontHandle(),
1444 subsetPtr->ToUnicodeHandle() );
1462 if( subsetPtr && subsetPtr->FontHandle() >= 0 )
1463 fmt::println(
m_outputFile,
" {} {} 0 R", subsetPtr->ResourceName(), subsetPtr->FontHandle() );
1486 fmt::print(
m_outputFile,
" /Im{} {} 0 R\n", imgHandle, imgHandle );
1507 "/BitsPerComponent 8\n"
1511 "/Filter /FlateDecode\n"
1518 if( smaskHandle != -1 )
1519 fmt::println(
m_outputFile,
"/SMask {} 0 R", smaskHandle );
1527 wxFFileOutputStream ffos( outputFFile );
1528 wxZlibOutputStream zos( ffos, wxZ_BEST_COMPRESSION, wxZLIB_ZLIB );
1529 wxDataOutputStream dos( zos );
1535 long imgStreamSize = ftell(
m_outputFile ) - imgStreamStart;
1544 if( smaskHandle != -1 )
1554 "/BitsPerComponent 8\n"
1555 "/ColorSpace /DeviceGray\n"
1559 "/Filter /FlateDecode\n"
1570 wxFFileOutputStream ffos( outputFFile );
1571 wxZlibOutputStream zos( ffos, wxZ_BEST_COMPRESSION, wxZLIB_ZLIB );
1572 wxDataOutputStream dos( zos );
1577 long smaskStreamSize = ftell(
m_outputFile ) - smaskStreamStart;
1583 fmt::println(
m_outputFile,
"{}", (
unsigned) smaskStreamSize );
1587 outputFFile.Detach();
1592 BOX2D box = linkPair.first;
1593 wxString url = linkPair.second;
1601 "/Rect [{:g} {:g} {:g} {:g}]\n"
1602 "/Border [16 16 0]\n",
1608 wxString pageNumber;
1609 bool pageFound =
false;
1618 "/Dest [{} 0 R /FitB]\n"
1630 fmt::print(
m_outputFile,
"/A << /Type /Action /S /NOP >>\n"
1640 "/A << /Type /Action /S /URI /URI {} >>\n"
1650 const BOX2D& box = menuPair.first;
1651 const std::vector<wxString>& urls = menuPair.second;
1652 wxString js = wxT(
"ShM([\n" );
1654 for(
const wxString& url : urls )
1656 if( url.StartsWith(
"!" ) )
1658 wxString
property = url.AfterFirst(
'!' );
1660 if( property.Find(
"http:" ) >= 0 )
1662 wxString href =
property.substr( property.Find(
"http:" ) );
1667 js += wxString::Format( wxT(
"[\"%s\", \"%s\"],\n" ),
1671 else if( property.Find(
"https:" ) >= 0 )
1673 wxString href =
property.substr( property.Find(
"https:" ) );
1678 js += wxString::Format( wxT(
"[\"%s\", \"%s\"],\n" ),
1682 else if( property.Find(
"file:" ) >= 0 )
1684 wxString href =
property.substr( property.Find(
"file:" ) );
1691 js += wxString::Format( wxT(
"[\"%s\", \"%s\"],\n" ),
1697 js += wxString::Format( wxT(
"[\"%s\"],\n" ),
1701 else if( url.StartsWith(
"#" ) )
1703 wxString pageNumber = url.AfterFirst(
'#' );
1709 wxString menuText = wxString::Format(
_(
"Show Page %s" ), pageNumber );
1711 js += wxString::Format( wxT(
"[\"%s\", \"#%d\"],\n" ),
1713 static_cast<int>( ii ) );
1718 else if( url.StartsWith(
"http:" ) || url.StartsWith(
"https:" )
1719 || url.StartsWith(
"file:" ) )
1721 wxString href = url;
1726 if( url.StartsWith(
"file:" ) )
1729 wxString menuText = wxString::Format(
_(
"Open %s" ), href );
1731 js += wxString::Format( wxT(
"[\"%s\", \"%s\"],\n" ),
1745 "/Rect [{:g} {:g} {:g} {:g}]\n"
1746 "/Border [16 16 0]\n",
1750 "/A << /Type /Action /S /JavaScript /JS {} >>\n"
1761function ShM(aEntries) {
1763 for (var i in aEntries) {
1765 cName: aEntries[i][0],
1766 cReturn: aEntries[i][1]
1770 var cChoice = app.popUpMenuEx.apply(app, aParams);
1771 if (cChoice != null && cChoice.substring(0, 1) == '#') this.pageNum = parseInt(cChoice.slice(1));
1772 else if (cChoice != null && cChoice.substring(0, 4) == 'http') app.launchURL(cChoice);
1773 else if (cChoice != null && cChoice.substring(0, 4) == 'file') app.openDoc(cChoice.substring(7));
1780 " [ (JSInit) << /Type /Action /S /JavaScript /JS {} >> ]\n"
1823 std::string dt = fmt::format(
"D:{:%Y:%m:%d:%H:%M:%S}", fmt::localtime( std::time(
nullptr ) ) );
1834 "/Producer (KiCad PDF)\n"
1835 "/CreationDate ({})\n"
1850 int outlineHandle = -1;
1859 if( outlineHandle > 0 )
1866 "/PageMode /UseOutlines\n"
1867 "/Outlines {} 0 R\n"
1869 "/PageLayout /SinglePage\n"
1882 "/PageMode /UseNone\n"
1883 "/PageLayout /SinglePage\n"
1897 "0000000000 65535 f \n",
1900 for(
unsigned i = 1; i <
m_xrefTable.size(); i++ )
1908 "<< /Size {} /Root {} 0 R /Info {} 0 R >>\n"
1934 const wxString& aText,
1942 bool aMultilineAllowed,
1948 if( aSize.
x == 0 || aSize.
y == 0 )
1951 wxString
text( aText );
1953 if(
text.Contains( wxS(
"@{" ) ) )
1966 bool textMirrored = aSize.
x < 0;
1974 std::unique_ptr<MARKUP::NODE> markupTree( markupParser.
Parse() );
1978 wxLogTrace(
tracePdfPlotter,
"PDF_PLOTTER::Text: Markup parsing failed, falling back to plain text." );
1980 wxStringTokenizer str_tok(
text,
" ", wxTOKEN_RET_DELIMS );
1983 while( str_tok.HasMoreTokens() )
1985 wxString word = str_tok.GetNextToken();
1986 pos =
renderWord( word, pos, t_size, aOrient, textMirrored, aWidth, aBold, aItalic, aFont,
1987 aFontMetrics, aV_justify, 0 );
2016 std::vector<OverbarInfo> overbars;
2017 renderMarkupNode( markupTree.get(), pos, t_size, aOrient, textMirrored, aWidth,
2018 aBold, aItalic, aFont, aFontMetrics, aV_justify, 0, overbars );
2027 bool aTextMirrored,
int aWidth,
bool aBold,
bool aItalic,
2031 if( wxGetEnv(
"KICAD_DEBUG_SYN_STYLE",
nullptr ) )
2036 wxLogTrace(
tracePdfPlotter,
"renderWord enter word='%s' bold=%d italic=%d textStyle=%u styleFlags=%d",
TO_UTF8( aWord ), (
int) aBold, (
int) aItalic, (
unsigned) aTextStyle, styleFlags );
2044 if( aWord == wxT(
" ") )
2052 VECTOR2I rotatedSpaceBox = spaceBox;
2054 return aPosition + rotatedSpaceBox;
2058 double ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f;
2059 double wideningFactor, heightFactor;
2063 &ctm_a, &ctm_b, &ctm_c, &ctm_d, &ctm_e, &ctm_f, &heightFactor );
2072 VECTOR2I nextPos = aPosition + bbox;
2079 double factor = aFont->
IsOutline() ? 0.050 : 0.030;
2080 VECTOR2I offset( 0,
static_cast<int>( std::lround( aSize.
y * factor ) ) );
2091 offset.
y =
static_cast<int>( std::lround( aSize.
y * 0.01 ) );
2101 std::vector<PDF_OUTLINE_FONT_RUN> outlineRuns;
2111 if( !outlineRuns.empty() )
2114 double baseline_factor = 0.17;
2115 double alignment_multiplier = 1.0;
2118 alignment_multiplier = 2.0;
2120 alignment_multiplier = 4.0;
2123 double baseline_adjustment = font_size_dev.
y * baseline_factor * alignment_multiplier;
2125 double adjusted_ctm_e = ctm_e;
2126 double adjusted_ctm_f = ctm_f;
2129 double cos_angle = cos( angle_rad );
2130 double sin_angle = sin( angle_rad );
2132 adjusted_ctm_e = ctm_e - baseline_adjustment * sin_angle;
2133 adjusted_ctm_f = ctm_f + baseline_adjustment * cos_angle;
2135 double adj_c = ctm_c;
2136 double adj_d = ctm_d;
2139 bool syntheticItalicApplied =
false;
2140 double appliedTilt = 0.0;
2141 double syn_c = adj_c;
2142 double syn_d = adj_d;
2143 double syn_a = ctm_a;
2144 double syn_b = ctm_b;
2147 if( std::getenv(
"KICAD_FORCE_SYN_ITALIC" ) )
2151 bool fontIsItalic = aFont->
IsItalic();
2152 bool fontIsBold = aFont->
IsBold();
2160 bool forceSynItalic =
false;
2161 double overrideTilt = 0.0;
2163 if(
const char* envForce = std::getenv(
"KICAD_FORCE_SYN_ITALIC" ) )
2165 if( *envForce !=
'\0' && *envForce !=
'0' )
2166 forceSynItalic =
true;
2169 if(
const char* envTilt = std::getenv(
"KICAD_SYN_ITALIC_TILT" ) )
2171 std::string tiltStr( envTilt );
2175 if( tiltStr.find(
"deg" ) != std::string::npos )
2177 double deg = std::stod( tiltStr );
2178 overrideTilt = tan( deg *
M_PI / 180.0 );
2182 overrideTilt = std::stod( tiltStr );
2193 "Outline path word='%s' runs=%zu wantItalic=%d fontIsItalic=%d fontIsFakeItalic=%d wantBold=%d fontIsBold=%d fontIsFakeBold=%d forceSyn=%d",
2194 TO_UTF8( aWord ), outlineRuns.size(), (
int) wantItalic, (
int) fontIsItalic,
2195 (
int) fontIsFakeItalic, (
int) wantBold, (
int) fontIsBold, (
int) fontIsFakeBold,
2196 (
int) forceSynItalic );
2202 bool realItalicFace = fontIsItalic && !fontIsFakeItalic;
2204 if( wantItalic && ( forceSynItalic || !realItalicFace ) )
2215 double tilt = ( overrideTilt != 0.0 ) ? overrideTilt :
ITALIC_TILT;
2217 if( wideningFactor < 0 )
2220 syn_c = adj_c + tilt * syn_a;
2221 syn_d = adj_d + tilt * syn_b;
2223 syntheticItalicApplied =
true;
2225 wxLogTrace(
tracePdfPlotter,
"Synthetic italic shear applied: tilt=%f a=%f b=%f c->%f d->%f",
2226 tilt, syn_a, syn_b, syn_c, syn_d );
2229 if( wantBold && !fontIsBold )
2236 if( syntheticItalicApplied )
2239 fmt::print(
m_workFile,
"% syn-italic tilt={} a={} b={} c={} d={}\n",
2240 appliedTilt, syn_a, syn_b, syn_c, syn_d );
2243 fmt::print(
m_workFile,
"q {:f} {:f} {:f} {:f} {:f} {:f} cm BT {} Tr {:g} Tz ",
2244 syn_a, syn_b, syn_c, syn_d, adjusted_ctm_e, adjusted_ctm_f,
2246 wideningFactor * 100 );
2250 fmt::print(
m_workFile,
"{} {:g} Tf <", run.m_subset->ResourceName(), heightFactor );
2255 static_cast<unsigned char>( ( glyph.
cid >> 8 ) & 0xFF ),
2256 static_cast<unsigned char>( glyph.
cid & 0xFF ) );
2272 wxLogTrace(
tracePdfPlotter,
"Stroke path word='%s' wantItalic=%d aItalic=%d aBold=%d",
2275 std::vector<PDF_STROKE_FONT_RUN> runs;
2281 double fontSize = dev_size.
y;
2283 double adj_c = ctm_c;
2284 double adj_d = ctm_d;
2286 if( aItalic && ( !aFont || !aFont->
IsOutline() ) )
2290 if( wideningFactor < 0 )
2293 adj_c -= ctm_a * tilt;
2294 adj_d -= ctm_b * tilt;
2297 fmt::print(
m_workFile,
"q {:f} {:f} {:f} {:f} {:f} {:f} cm BT {} Tr {:g} Tz ",
2298 ctm_a, ctm_b, adj_c, adj_d, ctm_e, ctm_f,
2300 wideningFactor * 100 );
2305 run.m_subset->ResourceName(),
2321 bool aTextMirrored,
int aWidth,
bool aBaseBold,
2326 std::vector<OverbarInfo>& aOverbars )
2331 return nextPosition;
2335 bool drawOverbar =
false;
2338 if( !aNode->is_root() )
2344 currentSize =
VECTOR2I( aBaseSize.
x * 0.5, aBaseSize.
y * 0.6 );
2350 currentSize =
VECTOR2I( aBaseSize.
x * 0.5, aBaseSize.
y * 0.6 );
2360 if( aNode->has_content() )
2365 wxStringTokenizer str_tok( nodeText,
" ", wxTOKEN_RET_DELIMS );
2367 while( str_tok.HasMoreTokens() )
2369 wxString word = str_tok.GetNextToken();
2370 nextPosition =
renderWord( word, nextPosition, currentSize, aOrient, aTextMirrored,
2373 aFont, aFontMetrics, aV_justify, currentStyle );
2379 for(
const std::unique_ptr<MARKUP::NODE>& child : aNode->children )
2383 nextPosition =
renderMarkupNode( child.get(), nextPosition, currentSize, aOrient,
2384 aTextMirrored, aWidth, aBaseBold, aBaseItalic,
2385 aFont, aFontMetrics, aV_justify, currentStyle, aOverbars );
2391 aOverbars.push_back( { startPos, endPos, currentSize, aFont->
IsOutline(), aV_justify } );
2395 return nextPosition;
2405 VECTOR2D dir( overbar.endPos.x - overbar.startPos.x,
2406 overbar.endPos.y - overbar.startPos.y );
2408 double len = hypot( dir.
x, dir.
y );
2428 if( overbar.isOutline )
2429 barOffset += overbar.fontSize.y * 0.25;
2434 double alignMult = 1.0;
2436 switch( overbar.vAlign )
2440 default: alignMult = 1.0;
break;
2443 if( alignMult > 1.0 )
2446 double baseline_factor = 0.17;
2447 barOffset += ( alignMult - 1.0 ) * ( baseline_factor * overbar.fontSize.y );
2451 double barTrim = overbar.fontSize.x * 0.1;
2454 VECTOR2D startPt( overbar.startPos.x, overbar.startPos.y );
2455 VECTOR2D endPt( overbar.endPos.x, overbar.endPos.y );
2459 VECTOR2D offVec( -barOffset * nrm.
x, -barOffset * nrm.
y );
2461 startPt.
x += dir.
x * barTrim + offVec.
x;
2462 startPt.
y += dir.
y * barTrim + offVec.
y;
2463 endPt.
x -= dir.
x * barTrim - offVec.
x;
2464 endPt.
y -= dir.
y * barTrim - offVec.
y;
2478 const wxString& aText,
2487 if( size.
x == 0 || size.
y == 0 )
2512 const wxString &aGroupName )
2515 m_bookmarksInPage[aGroupName].push_back( std::make_pair( aLocation, aSymbolReference ) );
2520 const std::vector<PDF_3D_VIEW>& a3DViews )
2522 std::map<float, int> m_fovMap;
2523 std::vector<int> m_viewHandles;
2528 wxASSERT( view.m_cameraMatrix.size() == 12 );
2531 if( !m_fovMap.contains( view.m_fov ) )
2534 m_fovMap[view.m_fov] = fovHandle;
2548 fovHandle = m_fovMap[view.m_fov];
2560 "/C2W [{:f} {:f} {:f} {:f} {:f} {:f} {:f} {:f} {:f} {:f} {:f} {:f}]\n"
2567 "/C [1.000000 1.000000 1.000000]>>\n"
2570 "/Type /3DLightingScheme\n"
2573 view.m_name, view.m_name, view.m_cameraMatrix[0],
2574 view.m_cameraMatrix[1],
2575 view.m_cameraMatrix[2], view.m_cameraMatrix[3], view.m_cameraMatrix[4],
2576 view.m_cameraMatrix[5], view.m_cameraMatrix[6], view.m_cameraMatrix[7],
2577 view.m_cameraMatrix[8], view.m_cameraMatrix[9], view.m_cameraMatrix[10],
2578 view.m_cameraMatrix[11],
2579 view.m_cameraCenter,
2584 m_viewHandles.push_back( viewHandle );
2599 for(
int viewHandle : m_viewHandles )
2607 "/Filter /FlateDecode\n"
2618 size_t model_stored_size = 0;
2620 wxFFileOutputStream ffos( outputFFile );
2621 wxZlibOutputStream zos( ffos, wxZ_BEST_COMPRESSION, wxZLIB_ZLIB );
2623 wxFFileInputStream fileStream( aSourcePath );
2624 if( !fileStream.IsOk() )
2626 wxLogError(
_(
"Failed to open 3D model file: %s" ), aSourcePath );
2629 zos.Write( fileStream );
2633 model_stored_size -= imgStreamStart;
2639 fmt::println(
m_outputFile,
"{}", (
unsigned) model_stored_size );
2642 outputFFile.Detach();
2647 float aCameraDistance,
2649 float aPitchDegrees,
2650 float aRollDegrees )
2652 float yRadians = glm::radians( aYawDegrees );
2653 float xRadians = glm::radians( aPitchDegrees );
2654 float zRadians = glm::radians( aRollDegrees );
2657 glm::mat4 rotationMatrix = glm::eulerAngleYXZ( yRadians, xRadians, zRadians );
2661 glm::vec4 cameraOffset = glm::vec4( 0.0f, 0.0f, aCameraDistance, 1.0f );
2664 cameraOffset = rotationMatrix * cameraOffset;
2667 glm::vec3 cameraPosition = glm::vec3(aTargetPosition.
x, aTargetPosition.
y, aTargetPosition.
z)
2668 - glm::vec3( cameraOffset );
2670 std::vector<float>
result( 12 );
2674 for(
int col = 0; col < 3; ++col )
2676 for(
int row = 0; row < 3; ++row )
2678 result[index++] =
static_cast<float>( rotationMatrix[col][row] );
2683 result[9] =
static_cast<float>( cameraPosition.x );
2684 result[10] =
static_cast<float>( cameraPosition.y );
2685 result[11] =
static_cast<float>( cameraPosition.z );
void WriteImageSMaskStream(const wxImage &aImage, wxDataOutputStream &aOut)
void WriteImageStream(const wxImage &aImage, wxDataOutputStream &aOut, wxColor bg, bool colorMode)
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
constexpr const Vec & GetPosition() const
constexpr const Vec GetEnd() const
constexpr void SetOrigin(const Vec &pos)
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
constexpr coord_type GetLeft() const
constexpr coord_type GetRight() const
constexpr void SetEnd(coord_type x, coord_type y)
constexpr coord_type GetTop() const
constexpr coord_type GetBottom() const
static bool IsGotoPageHref(const wxString &aHref, wxString *aDestination=nullptr)
Check if aHref is a valid internal hyperlink.
High-level wrapper for evaluating mathematical and string expressions in wxString format.
wxString Evaluate(const wxString &aInput)
Main evaluation function - processes input string and evaluates all} expressions.
FONT is an abstract base class for both outline and stroke fonts.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
virtual bool IsStroke() const
virtual bool IsItalic() const
virtual bool IsBold() const
virtual bool IsOutline() const
VECTOR2I StringBoundaryLimits(const wxString &aText, const VECTOR2I &aSize, int aThickness, bool aBold, bool aItalic, const METRICS &aFontMetrics) const
Compute the boundary limits of aText (the bounding box of all shapes).
double GetOverbarVerticalPosition(double aGlyphHeight) const
Compute the vertical position of an overbar.
Class OUTLINE_FONT implements outline font drawing.
A color representation with 4 components: red, green, blue, alpha.
std::unique_ptr< NODE > Parse()
std::vector< int > m_pageHandles
Handles to the page objects.
FILE * m_workFile
Temporary file to construct the stream before zipping.
wxString m_parentPageName
virtual void ClosePage()
Close the current page in the PDF document (and emit its compressed stream).
void emitOutlineNode(OUTLINE_NODE *aNode, int aParentHandle, int aNextNode, int aPrevNode)
Emits a outline item object and recurses into any children.
std::map< int, wxImage > m_imageHandles
int emitOutline()
Starts emitting the outline object.
virtual bool EndPlot() override
int startPdfObject(int aHandle=-1)
Open a new PDF object and returns the handle if the parameter is -1.
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr) override
Polygon plotting for PDF.
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width) override
Circle drawing for PDF.
virtual void SetCurrentLineWidth(int width, void *aData=nullptr) override
Pen width setting for PDF.
int m_streamLengthHandle
Handle to the deferred stream length.
VECTOR2I renderMarkupNode(const MARKUP::NODE *aNode, const VECTOR2I &aPosition, const VECTOR2I &aBaseSize, const EDA_ANGLE &aOrient, bool aTextMirrored, int aWidth, bool aBaseBold, bool aBaseItalic, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, enum GR_TEXT_V_ALIGN_T aV_justify, TEXT_STYLE_FLAGS aTextStyle, std::vector< OverbarInfo > &aOverbars)
Recursively render markup nodes with appropriate styling.
void PlotImage(const wxImage &aImage, const VECTOR2I &aPos, double aScaleFactor) override
PDF images are handles as inline, not XObject streams...
int m_jsNamesHandle
Handle for Names dictionary with JS.
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle) override
PDF supports dashed lines.
void HyperlinkMenu(const BOX2I &aBox, const std::vector< wxString > &aDestURLs) override
Create a clickable hyperlink menu with a rectangular click area.
virtual bool OpenFile(const wxString &aFullFilename) override
Open or create the plot file aFullFilename.
int m_fontResDictHandle
Font resource dictionary.
virtual void emitSetRGBColor(double r, double g, double b, double a) override
PDF supports colors fully.
std::map< int, std::pair< BOX2D, wxString > > m_hyperlinkHandles
Handles for all the hyperlink objects that will be deferred.
int m_pageTreeHandle
Handle to the root of the page tree object.
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.
int emitGoToAction(int aPageHandle, const VECTOR2I &aBottomLeft, const VECTOR2I &aTopRight)
Emit an action object that instructs a goto coordinates on a page.
void closePdfStream()
Finish the current PDF stream (writes the deferred length, too).
void Bookmark(const BOX2I &aBox, const wxString &aName, const wxString &aGroupName=wxEmptyString) override
Create a bookmark to a symbol.
std::vector< long > m_xrefTable
The PDF xref offset table.
void endPlotEmitResources()
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width, int aCornerRadius=0) override
Rectangles in PDF.
int startPdfStream(int aHandle=-1)
Start a PDF stream (for the page).
virtual void Arc(const VECTOR2D &aCenter, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle, double aRadius, FILL_T aFill, int aWidth) override
The PDF engine can't directly plot arcs so we use polygonization.
void HyperlinkBox(const BOX2I &aBox, const wxString &aDestinationURL) override
Create a clickable hyperlink with a rectangular click area.
virtual void PenTo(const VECTOR2I &pos, char plume) override
Moveto/lineto primitive, moves the 'pen' to the specified direction.
std::map< wxString, std::vector< std::pair< BOX2I, wxString > > > m_bookmarksInPage
virtual bool StartPlot(const wxString &aPageNumber) override
The PDF engine supports multiple pages; the first one is opened 'for free' the following are to be cl...
virtual void StartPage(const wxString &aPageNumber, const wxString &aPageName=wxEmptyString, const wxString &aParentPageNumber=wxEmptyString, const wxString &aParentPageName=wxEmptyString)
Start a new page in the PDF document.
void drawOverbars(const std::vector< OverbarInfo > &aOverbars, const EDA_ANGLE &aOrient, const KIFONT::METRICS &aFontMetrics)
Draw overbar lines above text.
std::unique_ptr< PDF_OUTLINE_FONT_MANAGER > m_outlineFontManager
OUTLINE_NODE * addOutlineNode(OUTLINE_NODE *aParent, int aActionHandle, const wxString &aTitle)
Add a new outline node entry.
int m_imgResDictHandle
Image resource dictionary.
std::string encodeStringForPlotter(const wxString &aUnicode) override
convert a wxString unicode string to a char string compatible with the accepted string PDF format (co...
std::unique_ptr< PDF_STROKE_FONT_MANAGER > m_strokeFontManager
void Plot3DModel(const wxString &aSourcePath, const std::vector< PDF_3D_VIEW > &a3DViews)
std::vector< wxString > m_pageNumbers
List of user-space page numbers for resolving internal hyperlinks.
int allocPdfObject()
Allocate a new handle in the table of the PDF object.
VECTOR2I renderWord(const wxString &aWord, const VECTOR2I &aPosition, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, bool aTextMirrored, int aWidth, bool aBold, bool aItalic, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, enum GR_TEXT_V_ALIGN_T aV_justify, TEXT_STYLE_FLAGS aTextStyle)
Render a single word with the given style parameters.
std::string encodeByteString(const std::string &aBytes)
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
PDF can have multiple pages, so SetPageSettings can be called with the outputFile open (but not insid...
std::map< int, std::pair< BOX2D, std::vector< wxString > > > m_hyperlinkMenuHandles
int m_pageStreamHandle
Handle of the page content object.
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
static std::vector< float > CreateC2WMatrixFromAngles(const VECTOR3D &aTargetPosition, float aCameraDistance, float aYawDegrees, float aPitchDegrees, float aRollDegrees)
Generates the camera to world matrix for use with a 3D View.
std::vector< std::pair< BOX2I, wxString > > m_hyperlinksInPage
List of loaded hyperlinks in current page.
std::unique_ptr< OUTLINE_NODE > m_outlineRoot
Root outline node.
std::vector< std::pair< BOX2I, std::vector< wxString > > > m_hyperlinkMenusInPage
void closePdfObject()
Close the current PDF object.
int m_totalOutlineNodes
Total number of outline nodes.
const std::string & ResourceName() const
std::string BuildDifferencesArray() const
double FontBBoxMaxY() const
double FontBBoxMinY() const
double UnitsPerEm() const
double FontBBoxMinX() const
void SetToUnicodeHandle(int aHandle)
int CharProcsHandle() const
std::string BuildWidthsArray() const
double FontBBoxMaxX() const
void SetFontHandle(int aHandle)
int ToUnicodeHandle() const
void SetCharProcsHandle(int aHandle)
std::string BuildToUnicodeCMap() const
std::vector< GLYPH > & Glyphs()
double GetDotMarkLenIU(int aLineWidth) const
double GetDashGapLenIU(int aLineWidth) const
const PROJECT * m_project
bool m_mirrorIsHorizontal
static const int USE_DEFAULT_LINE_WIDTH
void MoveTo(const VECTOR2I &pos)
void FinishTo(const VECTOR2I &pos)
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).
double m_plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
FILE * m_outputFile
Output file.
void LineTo(const VECTOR2I &pos)
static const int DO_NOT_SET_LINE_WIDTH
RENDER_SETTINGS * m_renderSettings
virtual int GetCurrentLineWidth() const
double GetDashMarkLenIU(int aLineWidth) const
virtual void SetColor(const COLOR4D &color) override
The SetColor implementation is split with the subclasses: the PSLIKE computes the rgb values,...
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.
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.
const SHAPE_LINE_CHAIN Outline() const
void SetRadius(int aRadius)
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
std::string substr(size_t pos=0, size_t len=npos) const
const wxString ResolveUriByEnvVars(const wxString &aUri, const PROJECT *aProject)
Replace any environment and/or text variables in URIs.
@ FILLED_SHAPE
Fill with object color.
unsigned int TEXT_STYLE_FLAGS
static constexpr double ITALIC_TILT
Tilt factor for italic style (this is the scaling factor on dY relative coordinates to give a tilted ...
const wxChar *const tracePdfPlotter
Flag to enable PDF plotter debug tracing.
void ignore_unused(const T &)
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)
wxString NormalizeFileUri(const wxString &aFileUri)
Normalize file path aFileUri to URI convention.
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
LINE_STYLE
Dashed line types.
bool isSuperscript() const
wxString asWxString() const
wxString title
Title of outline node.
std::vector< OUTLINE_NODE * > children
Ordered list of children.
int entryHandle
Allocated handle for this outline entry.
OUTLINE_NODE * AddChild(int aActionHandle, const wxString &aTitle, int aEntryHandle)
int actionHandle
Handle to action.
wxString result
Test unit parsing edge cases and error handling.
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
wxLogTrace helper definitions.
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
VECTOR3< double > VECTOR3D