@munusshih/p5.export 0.1.0-beta.5 → 0.1.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,7 +9,7 @@ Works with **p5.js 1.x and 2.x**. p5 is brought by you (CDN or bundler); this pa
9
9
  ### Drop-in `<script>`
10
10
 
11
11
  ```html
12
- <script src="https://cdn.jsdelivr.net/npm/p5@2/lib/p5.js"></script>
12
+ <script src="https://cdn.jsdelivr.net/npm/p5@latest/lib/p5.js"></script>
13
13
  <script src="https://cdn.jsdelivr.net/npm/@munusshih/p5.export"></script>
14
14
  <script src="sketch.js"></script>
15
15
  ```
@@ -63,6 +63,7 @@ saveSVG('artwork')
63
63
  saveSVG('artwork', { forceVector: true }) // skip raster-fallback threshold
64
64
  saveSVG('artwork', { raster: true }) // embed canvas PNG inside an SVG
65
65
  saveSVG('artwork', { silent: true }) // skip the fallback confirm dialog
66
+ saveSVG('artwork', { outlineText: false }) // keep text() as editable <text> (default is outlined)
66
67
 
67
68
  savePDF('artwork')
68
69
  savePDF('artwork', { scale: 2 })
@@ -70,6 +71,20 @@ savePDF('artwork', { scale: 2 })
70
71
 
71
72
  `saveSVG()` records every Canvas2D draw call as the sketch runs and replays them onto an SVG context. Trails, fade rects, blend modes, gradients (linear / radial — emitted as native SVG gradients), and `drawingContext.setLineDash` all survive. WebGL renderers can only be embedded as a single raster `<image>`; the function prompts before doing so unless `{ silent: true }` or `{ raster: true }` is passed.
72
73
 
74
+ #### Text and fonts
75
+
76
+ By default `text()` is exported as **vector glyph outlines**, which render identically everywhere with no fonts installed. This is the default because fonts loaded via `loadFont()` are drawn by p5 in a way `canvas2svg` can't capture as `<text>` — they'd otherwise drop out of the SVG entirely. Outlining works for fonts loaded from an uncompressed `.ttf`/`.otf` (p5 can't read glyph data from `.woff2`); system/string fonts have no outline data and fall back to `<text>`.
77
+
78
+ Pass `{ outlineText: false }` to keep text as **editable `<text>`** instead (font-family reference; the font must be available wherever the SVG is opened, or it falls back).
79
+
80
+ ```js
81
+ saveSVG('poster', { outlineText: false }); // per-call, keep editable <text>
82
+ setSVGTextMode('text'); // make editable <text> the default for this sketch
83
+ // also: window.p5ExportConfig = { svgTextOutlines: false } before the sketch loads
84
+ ```
85
+
86
+ In the export GUI, pick **SVG (vector)**; **Outline (vector)** is ticked by default — untick it for editable `<text>`. See `examples/fonts/` for a multi-typeface demo.
87
+
73
88
  For dense sketches whose vector replay would balloon past 2 million ops, the export falls back to raster-in-SVG and asks the user to confirm. To force vector regardless of size, pass `{ forceVector: true }`.
74
89
 
75
90
  #### Hybrid SVG
@@ -160,9 +175,27 @@ npm install
160
175
  npm run build # writes dist/p5.export.js + dist/p5.export.min.js
161
176
  npm run dev # vite dev server at /examples/index.html
162
177
  npm run test:sketches # headless harness over examples/ — exports each format
178
+ npm run test:svg-path2d # p5 2.3+ vector primitive regression
163
179
  npm run test:webp # sanity test for the animated WebP encoder
164
180
  ```
165
181
 
182
+ Every push to `main` finds the highest published `0.1.0-beta.N`, publishes the
183
+ next beta number, and assigns it to npm's `latest` tag. The workflow then reads
184
+ `@munusshih/p5.export@latest` back from npm and fails unless it matches the
185
+ version just published. Publishing uses npm Trusted Publishing (OIDC), with no
186
+ long-lived npm token. Configure the package's trusted publisher on npmjs.com
187
+ with these exact values:
188
+
189
+ - Provider: **GitHub Actions**
190
+ - Organization or user: **munusshih**
191
+ - Repository: **p5.export**
192
+ - Workflow filename: **publish-npm.yml**
193
+ - Environment: leave blank
194
+ - Allowed action: **npm publish**
195
+
196
+ The workflow filename is matched exactly by npm and lives at
197
+ `.github/workflows/publish-npm.yml`.
198
+
166
199
  ## License
167
200
 
168
201
  [MIT](./LICENSE)