@emasoft/svg-matrix 1.2.0 → 1.3.0
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 +75 -0
- package/bin/svgfonts.js +1412 -0
- package/bin/svgm.js +1 -1
- package/dist/svg-matrix.global.min.js +8 -0
- package/dist/svg-matrix.min.js +2 -1
- package/dist/svg-toolbox.global.min.js +493 -0
- package/dist/svg-toolbox.min.js +16 -15
- package/dist/svgm.min.js +60 -59
- package/dist/version.json +44 -16
- package/package.json +11 -3
- package/src/bezier-intersections.js +1 -1
- package/src/browser-verify.js +0 -1
- package/src/clip-path-resolver.js +3 -1
- package/src/font-manager.js +1013 -0
- package/src/index.js +2 -2
- package/src/inkscape-support.js +2 -2
- package/src/mask-resolver.js +14 -6
- package/src/mesh-gradient.js +0 -2
- package/src/off-canvas-detection.js +14 -22
- package/src/svg-boolean-ops.js +0 -5
- package/src/svg-collections.js +11 -0
- package/src/svg-matrix-lib.js +2 -2
- package/src/svg-parser.js +0 -24
- package/src/svg-rendering-context.js +2 -4
- package/src/svg-toolbox-lib.js +2 -2
- package/src/svgm-lib.js +2 -2
- package/src/transform-optimization.js +93 -142
- package/src/verification.js +0 -2
- package/templates/svgm_replacement_map.yml +53 -0
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
<a href="#part-1-core-math-library">Core Math</a> •
|
|
14
14
|
<a href="#part-2-svg-toolbox">SVG Toolbox</a> •
|
|
15
15
|
<a href="#svgm---svgo-compatible-optimizer-drop-in-replacement">svgm (SVGO replacement)</a> •
|
|
16
|
+
<a href="#svgfonts---font-management-cli">svgfonts</a> •
|
|
16
17
|
<a href="#installation">Install</a> •
|
|
17
18
|
<a href="API.md">API Reference</a>
|
|
18
19
|
</p>
|
|
@@ -458,6 +459,80 @@ See [full svglinter documentation](docs/SVGLINTER.md).
|
|
|
458
459
|
|
|
459
460
|
---
|
|
460
461
|
|
|
462
|
+
### `svgfonts` - Font Management CLI
|
|
463
|
+
|
|
464
|
+
Dedicated tool for SVG font operations: embedding, extraction, replacement, and analysis.
|
|
465
|
+
|
|
466
|
+
```bash
|
|
467
|
+
# List all fonts used in an SVG
|
|
468
|
+
svgfonts list icon.svg
|
|
469
|
+
|
|
470
|
+
# Embed external fonts as base64 data URIs
|
|
471
|
+
svgfonts embed icon.svg -o icon-embedded.svg
|
|
472
|
+
|
|
473
|
+
# Embed with character subsetting (smaller file size)
|
|
474
|
+
svgfonts embed --subset icon.svg -o icon-embedded.svg
|
|
475
|
+
|
|
476
|
+
# Apply font replacement map
|
|
477
|
+
svgfonts replace --map fonts.yml icons/*.svg
|
|
478
|
+
|
|
479
|
+
# Interactive font management mode
|
|
480
|
+
svgfonts interactive document.svg
|
|
481
|
+
|
|
482
|
+
# Generate YAML replacement map template
|
|
483
|
+
svgfonts template > svgm_replacement_map.yml
|
|
484
|
+
|
|
485
|
+
# Extract embedded fonts to files
|
|
486
|
+
svgfonts extract --extract-dir ./fonts/ document.svg
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
**Commands:**
|
|
490
|
+
|
|
491
|
+
| Command | Description |
|
|
492
|
+
|---------|-------------|
|
|
493
|
+
| `list` | List fonts in SVG (family, type, size, used characters) |
|
|
494
|
+
| `embed` | Embed external fonts as base64 data URIs |
|
|
495
|
+
| `extract` | Extract embedded fonts to files |
|
|
496
|
+
| `replace` | Apply font replacement map from YAML |
|
|
497
|
+
| `interactive` | Interactive font management mode |
|
|
498
|
+
| `template` | Generate YAML replacement map template |
|
|
499
|
+
|
|
500
|
+
**Options:**
|
|
501
|
+
|
|
502
|
+
| Option | Description |
|
|
503
|
+
|--------|-------------|
|
|
504
|
+
| `-o, --output <file>` | Output file (default: overwrite input) |
|
|
505
|
+
| `-r, --recursive` | Process directories recursively |
|
|
506
|
+
| `--subset` | Only embed glyphs used in SVG (default) |
|
|
507
|
+
| `--full` | Embed complete font files |
|
|
508
|
+
| `--map <file>` | Path to replacement YAML |
|
|
509
|
+
| `--extract-dir <dir>` | Directory for extracted fonts |
|
|
510
|
+
| `--no-backup` | Skip backup creation |
|
|
511
|
+
| `--validate` | Validate SVG after operations |
|
|
512
|
+
| `--dry-run` | Preview changes without writing |
|
|
513
|
+
|
|
514
|
+
**Font Replacement Map (YAML):**
|
|
515
|
+
|
|
516
|
+
```yaml
|
|
517
|
+
# svgm_replacement_map.yml
|
|
518
|
+
replacements:
|
|
519
|
+
"Arial": "Inter"
|
|
520
|
+
"Times New Roman": "Noto Serif"
|
|
521
|
+
"Courier New": "Fira Code"
|
|
522
|
+
|
|
523
|
+
options:
|
|
524
|
+
default_embed: true
|
|
525
|
+
default_subset: true
|
|
526
|
+
fallback_source: "google"
|
|
527
|
+
auto_download: true
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
Use environment variable `SVGM_REPLACEMENT_MAP` to set default map path.
|
|
531
|
+
|
|
532
|
+
Run `svgfonts --help` for all options.
|
|
533
|
+
|
|
534
|
+
---
|
|
535
|
+
|
|
461
536
|
<!-- Geometric divider: Triangle construction -->
|
|
462
537
|
<p align="center">
|
|
463
538
|
<img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='20' viewBox='0 0 400 20'%3E%3Cg stroke='%23ccc' stroke-width='0.5' fill='none'%3E%3Cline x1='0' y1='10' x2='150' y2='10'/%3E%3Cpolygon points='175,5 200,15 175,15'/%3E%3Cline x1='175' y1='5' x2='187.5' y2='10' stroke-dasharray='2,2'/%3E%3Cpolygon points='210,15 235,5 235,15'/%3E%3Cline x1='235' y1='5' x2='222.5' y2='10' stroke-dasharray='2,2'/%3E%3Cline x1='250' y1='10' x2='400' y2='10'/%3E%3C/g%3E%3C/svg%3E" alt=""/>
|