141 Commits

Author SHA1 Message Date
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 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
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
Seth Hillbrand 8acf5c1a25 ADDED: Rounded Rectangles
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4742
2025-08-29 17:37:30 -07: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
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
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 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
Seth Hillbrand 4a3b33df4e Map a full hierarchy during PDF plotting
Re-create the schematic hierarchy in PDF plots to ease navigation
relative to the on screen schematic

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12154
2025-03-05 13:28:01 -08:00
Jeff Young a9ddcf4287 Fix positions of popup menus when plotting in mirrored mode.
[Resolve conflicts with JP's fix to same.  I'm not sure if we support !m_mirrorIsHorizontal, but
it was in other code, so I left it in just to be
safe....]

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19717
2025-01-23 10:55:11 +00:00
jean-pierre charras e9269e59f7 Pcbnew, PDF plot: fix property popup locations when plotting mirrored.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19717
2025-01-23 09:48:08 +01:00
Wayne Stambaugh f161d94521 Common folder housekeeping part 2. 2025-01-14 15:25:05 -05:00
Seth Hillbrand 0b2d4d4879 Revise Copyright statement to align with TLF
Recommendation is to avoid using the year nomenclature as this
information is already encoded in the git repo.  Avoids needing to
repeatly update.

Also updates AUTHORS.txt from current repo with contributor names
2025-01-01 14:12:04 -08:00
Wayne Stambaugh 930407fac8 Fix PDF plotter URI issues.
Add 'file:' URI JavaScript handlers.

Properly convert Windows file paths to valid URI syntax.

Use expanded variables for URI menu names.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14250
2024-11-04 20:05:42 -05:00
Seth Hillbrand 88df35654e Prevent attempt at plotting invalid sheets
If the number does not exist in the schematic, don't attempt plotting

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19039
2024-11-01 10:55:54 -07:00
Wayne Stambaugh 43c3cd57eb Substitute variables in PDF plotter URI links and add file:// URI handler.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14250
2024-10-24 08:06:28 -04:00
Dhinesh 8851cd77ab Fix missing text and graphics in PDFs generated by "Plot to PDF"
The "Plot to PDF" function was producing PDF files that lacked text and
graphic items in viewers like Adobe and Foxit. This issue was caused by
the use of the %g format specifier for floating-point numbers defined in
the PDF specification when writing text and drawing shapes in the PDF.
This incorrect format led to a "Too Few Operands" error during rendering.
To resolve this issue, all floating-point numbers must be specified in
fixed-point format according to the PDF specification wherever the issue
was generated.

Fixes #16465
2024-10-11 18:55:46 +00:00
Alex Shvartzkop 16e3692e71 Build time optimizations. 2024-04-27 23:49:13 +03:00
Jeff Young e30b6398b7 ADDED: optional PDF metadata from AUTHOR and SUBJECT variables.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17289
2024-03-14 17:40:04 +00:00
Alex Shvartzkop 4d66a8ebdb Fix rendering/plotting of arcs with tiny angle and huge radius.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17343
2024-03-09 02:07:24 +03:00
Alex Shvartzkop 82a0227c20 Don't plot polygon borders when they are disabled. 2024-01-15 22:35:35 +03:00
Jeff Young df83e24eb7 Cleanup.
It's been a long time since line style was specific to plotting.
2023-11-25 13:12:45 +00:00
Alex Shvartzkop dc9df9517d PDF plot: match mirror state between hidden and plotted text.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16066

(cherry-picked from commit 31e79ef54f)
2023-11-12 01:28:03 +03:00
Alex Shvartzkop b0f4adf052 Improve borderless items logic in schematic plotting. 2023-10-12 08:40:37 +03:00
Alex Shvartzkop 843bd4f79c PDF plotting: fix zero-sized or too thick rectangles.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15862
2023-10-12 06:11:11 +03:00
Alex Shvartzkop 10e2e4a12d Another try at fixing arcs.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15471
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15469
2023-08-22 16:10:58 +03:00