@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 CHANGED
@@ -13,6 +13,7 @@
13
13
  <a href="#part-1-core-math-library">Core Math</a> &#8226;
14
14
  <a href="#part-2-svg-toolbox">SVG Toolbox</a> &#8226;
15
15
  <a href="#svgm---svgo-compatible-optimizer-drop-in-replacement">svgm (SVGO replacement)</a> &#8226;
16
+ <a href="#svgfonts---font-management-cli">svgfonts</a> &#8226;
16
17
  <a href="#installation">Install</a> &#8226;
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=""/>