Commit Graph

396 Commits

Author SHA1 Message Date
Seth Hillbrand c0a6a139cf Add $INSUNITS header variable to DXF export
The DXF exporter was missing the $INSUNITS header variable, which tells
CAD software what physical units the drawing coordinates represent. Without
it, other programs have no reliable way to determine the coordinate scale.

Add $INSUNITS to the HEADER section alongside the existing $MEASUREMENT
variable. When exporting in millimeters, $INSUNITS is set to 4; when
exporting in inches, it is set to 1.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23181
2026-02-23 12:14:49 -08:00
Jeff Young 717bec1e39 Formatting. 2026-02-20 22:07:43 +00:00
Mike Williams 5d92b9ba4b pdf: don't emit scientific notation when using floating point
fmt {:g} will sometimes put in scientific notation, e.g. 1.0e6 when we
pass some sizes of numbers. PDF doesn't accept scientific notation for
numbers, so make sure we convert those. Postscript seems to accept these
just fine so limit the fix to PDF.

I don't know that we were hitting these before, but my previous fix for
the background position caused some exponentially formatted numbers.
2026-01-22 10:34:19 -05:00
Mark Roszko dbd91e542f Revert to c-isms because C++ standards arent real standards 2026-01-14 21:48:41 -05:00
Mark Roszko 4de94b0776 update {fmt} to 12.1.0 2026-01-14 20:57:29 -05:00
Seth Hillbrand 5364eeb718 Fix PDF plotting of text containing tab characters
The PDF plotter's renderWord function now properly handles tab characters
within text. Previously, tabs were passed to HarfBuzz or the stroke font
encoder which would render them as zero-width or small-width glyphs,
causing text alignment issues.

The fix splits text at tab boundaries and calculates proper tab stop
positions using the same algorithm as the font rendering code (TAB_WIDTH
= 4 * 0.6 font units), advancing the cursor to the next tab stop for
each tab character encountered.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22606
2026-01-09 18:09:47 -08:00
Seth Hillbrand a4dd0174b9 Add symbol editor clipboard handling
Mirrors handling for schematic editor.  Outputs SVG+PNG+Kicad text to
the clipboard, applications choose which to paste
2025-12-31 14:22:31 -08:00
jean-pierre charras f27a14b424 SVG_PLOTTER: fix incorrect bitmaps position is some cases
Fixes https://gitlab.com/kicad/code/kicad/-/issues/22326
2025-12-14 12:44:21 +01:00
Wayne Stambaugh f4c41e7417 Fix Coverity uninitialized scalar variable issue. 2025-12-08 13:48:04 -05:00
Seth Hillbrand 99fdf2b9be Added: DXF Multilayer plotting
DXF layers and appropriate layer colors added.  Option mimics the PDF
multilayer option

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2526
2025-12-02 11:09:35 -08:00
Seth Hillbrand ae80e30467 Ensure closed polygons for filling
PDF output needs closed polygons to fill objects, so ensure that we
properly close before filling
2025-12-01 17:16:27 -08:00
jean-pierre charras b1f8486345 PlotDrawingSheet(): Handle multiline texts.
PLOTTER::Text() does not work fine for multiline texts for PDF plotter.
So convert it to a set of single lines before plotting drawing sheet texts.
(It was already made for other types of text)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22425
2025-11-29 11:00:00 +01:00
Jeff Young 16ca38ed4a Improve signal-to-noise in the code. 2025-11-14 15:17:35 +00:00
Jeff Young 7d47e4031c Formatting and other cleanup. 2025-10-31 13:22:50 +00:00
Jeff Young 0452a8c409 Add adjustments so PDF print matches screen position of overbars.
This is somewhat disturbing, but I can't figure out
why it's needed.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22172
2025-10-30 17:05:38 +00:00
Jeff Young 27b45e58ab Formatting and delete dead code. 2025-10-30 17:05:38 +00:00
jean-pierre charras 2b5def6dde PDF plotter: fix missing space between 2 items
PDF_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList,
    FILL_T aFill, int aWidth, void* aData )
generated broken PDF files.
2025-10-25 13:58:19 +02:00
Jeff Young 5419839a1d Continue lineStyle patterns between arcs and segments in SHAPE_LINE_CHAIN.
This requires us not resetting PS/PDF's lineStyles
with a "move" instruction.

Also fixes DXF to handle arcs in SHAPE_LINE_CHAINs,
even if it doesn't handle lineStyles.
2025-10-24 22:30:04 +01:00
Jeff Young e6b6200de2 Improve SHAPE_LINE_CHAIN arc plotting.
It still doesn't get it quite right as it restarts
the lineStyle pattern at each segment/arc transition.
2025-10-23 17:43:30 +01:00
Jeff Young 4784d358c1 Remove duplicate condition. 2025-10-05 15:40:12 +01:00
Seth Hillbrand bbf3516611 Fix QA
ToStdString does not work in C locale
2025-09-20 13:27:37 -07:00
Jeff Young 35abc8e33e Nullptr safety & performance tweaks. 2025-09-19 21:08:01 +01:00
Mark Roszko 979947fbbd Fix build on linux 2025-09-17 23:12:29 -04:00
Marek Roszko ad7bdf5b87 ADDED: 3D PDF Export
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/4439
2025-09-17 22:45:35 -04:00
Seth Hillbrand 753afc7f37 ADDED: Plot uses the KiCad font, embedded in PDF
Creates a Type-3 representation of our stroke font, embeds it in the PDF
and then causes text to be represented in that font.

This prevents the need for over-stroking and keeps our PDFs searchable
and accessible
2025-09-17 09:05:15 -07:00
Mark Roszko 1e9025a4dc Move to a fixed enum for page sizes as well as well as holding a list of types accessible in a vector.
Drops some hardcoded size names in places among other bits.

Woooo committed pushed at 36000 feet.
2025-09-13 20:12:53 +02:00
Seth Hillbrand a857ea77d9 ADDED: Text expression evaluation
Arbitrary text strings now support full evaluation with a rich
functional language

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6643
2025-09-04 14:57:16 -07:00
Seth Hillbrand 8acf5c1a25 ADDED: Rounded Rectangles
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4742
2025-08-29 17:37:30 -07:00
Seth Hillbrand b207ec8817 Remove negative index access from CPoint
Callers should be responsible for index count and/or use iterators
2025-08-08 10:46:45 -07:00
Jeff Young 91b7bc0843 Support dash-dot-dot line style in DXF.
Fixes KICAD-TY8.
2025-08-02 22:56:52 +01:00
Jeff Young e230d5164d Honour renderSettings' default font.
This still leaves a few things out in the cold,
such as hit-testing and polygon generation.
But at least it allows us to plot with a default
font.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19031
2025-07-17 09:35:21 +01:00
Jeff Young ff0f6c448b Performance. 2025-06-08 16:33:05 +01:00
Marek Roszko 42ccbe618d Fix menus in pdf broken by 3dpdf changes
woops
2025-05-14 19:48:15 -04:00
jean-pierre charras d3256c3430 PDF plotter: fix missing data that prevent Adobe Acrobat to open these PDF
(The issue is due to a recent change (Commit 0268ed6d) in code)
2025-05-14 17:31:20 +02:00
Jeff Young a64278a12c Honour 0-width strokes on filled shapes. 2025-05-13 18:00:09 +01:00
Jeff Young af4d14b66c 0 width means 0 width when plotting text.
There's no such thing as a default line width
for text.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20916
2025-05-13 17:48:58 +01:00
Marek Roszko e30fdcb500 Write fileinput stream directly to zliboutput stream in Plot3DModel 2025-05-11 14:11:13 -04:00
Marek Roszko 0268ed6d28 Add 3d pdf functions to PDF_PLOTTER to reduce rebasing pain 2025-05-11 11:47:37 -04:00
Jeff Young 34139ae305 Push generalised sketch-mode support down into DXF_PLOTTER. 2025-05-10 17:31:59 +01:00
Jeff Young 3458534fd7 Cleanup plotting APIs. 2025-05-10 17:31:59 +01:00
Jeff Young 225b6aa2e8 Remove sketch-plot-mode support from Gerber and PS.
(It was never enabled for Gerber anyway.)
2025-05-10 17:31:59 +01:00
Jeff Young 88695af364 Move sketched DNP items to plot_brditems_plotter.cpp. 2025-05-10 17:31:59 +01:00
Jeff Young c78ce373fd Move pad-outline plotting to plot_brditems_plotter.cpp. 2025-05-10 17:31:59 +01:00
Jeff Young c452fe9686 REMOVED: HPGL plotting.
Its sketch-mode greatly complicates the plotting
code and it is poorly maintained due to lack of
use.
2025-05-10 17:31:59 +01:00
jean-pierre charras a02f1f2411 PDF plotter: fix a rare pen width issue when plotting many pages in one file.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20805
2025-05-01 19:57:29 +02:00
Jeff Young 3a4ad0fb8b Cleanup. 2025-05-01 17:02:31 +01:00
Jeff Young 1f07c28999 Fix a bunch of errors involving implied line widths in plotters.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20818
2025-05-01 16:37:08 +01:00
Jeff Young 7e046e6c8b Remove '~' == empty_string.
It has long outlived its usefulness (which was
to preserve token sequence in pre-sexpr files).

This will no doubt turn up latent issues....
2025-03-19 17:16:55 +00:00
Jeff Young f4a5404e0a Resolve variables in hrefs.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20340
2025-03-15 19:31:46 +00:00
Marek Roszko ab6ee168cf Convert PDF_PLOTTER to fmtlib 2025-03-08 14:29:20 -05:00