resvg-napi 0.2.0 → 0.3.1

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/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
+
3
4
  /** Read-only handle on a `usvg::ClipPath`. */
4
5
  export declare class ClipPath {
5
6
  /**
@@ -44,6 +45,11 @@ export declare class Font {
44
45
  get stretch(): FontStretch
45
46
  get weight(): number
46
47
  get variations(): Array<FontVariation>
48
+ /**
49
+ * Families this span asked for, in order. Never empty: usvg appends
50
+ * `RenderOptions.fontFamily` as the last resort.
51
+ */
52
+ get families(): Array<string>
47
53
  }
48
54
 
49
55
  /** Opaque wrapper over `fontdb::Database` (memory-mapped faces, no JSON form). */
@@ -360,6 +366,23 @@ export declare class Resvg {
360
366
  * `FontDatabase` and re-parse to fix the output.
361
367
  */
362
368
  pendingFonts(): Array<string>
369
+ /**
370
+ * The face that actually drew a glyph, from the database this
371
+ * document was parsed with.
372
+ *
373
+ * `pendingFonts()` names the families that were missing; this names
374
+ * what was used instead, glyph by glyph, which is the half a
375
+ * document-wide list cannot answer. A fallback that renders is the
376
+ * failure nobody sees.
377
+ *
378
+ * The lookup lives here rather than on `FontDatabase` because
379
+ * `PositionedGlyph.font` is a `fontdb::ID` -- a slotmap key with no
380
+ * public numeric form, and meaningless against any other database.
381
+ * The glyph carries it the way `FontFace` carries one for
382
+ * `FontDatabase.face`, and `null` means exactly that: a glyph from
383
+ * another document.
384
+ */
385
+ faceOf(glyph: PositionedGlyph): FontFace | null
363
386
  /**
364
387
  * Supplies one image and re-parses the document.
365
388
  *
@@ -690,18 +713,7 @@ export declare class TextSpan {
690
713
  }
691
714
 
692
715
  /** An alignment baseline property. */
693
- export type AlignmentBaseline = 'auto'|
694
- 'baseline'|
695
- 'beforeEdge'|
696
- 'textBeforeEdge'|
697
- 'middle'|
698
- 'central'|
699
- 'afterEdge'|
700
- 'textAfterEdge'|
701
- 'ideographic'|
702
- 'alphabetic'|
703
- 'hanging'|
704
- 'mathematical';
716
+ export type AlignmentBaseline = 'auto' | 'baseline' | 'beforeEdge' | 'textBeforeEdge' | 'middle' | 'central' | 'afterEdge' | 'textAfterEdge' | 'ideographic' | 'alphabetic' | 'hanging' | 'mathematical'
705
717
 
706
718
  /** `BaselineShift::Number`. */
707
719
  export interface BaselineShiftNumber {
@@ -736,22 +748,7 @@ export interface Blend {
736
748
  *
737
749
  * `mix-blend-mode` attribute in the SVG.
738
750
  */
739
- export type BlendMode = 'normal'|
740
- 'multiply'|
741
- 'screen'|
742
- 'overlay'|
743
- 'darken'|
744
- 'lighten'|
745
- 'colorDodge'|
746
- 'colorBurn'|
747
- 'hardLight'|
748
- 'softLight'|
749
- 'difference'|
750
- 'exclusion'|
751
- 'hue'|
752
- 'saturation'|
753
- 'color'|
754
- 'luminosity';
751
+ export type BlendMode = 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'colorDodge' | 'colorBurn' | 'hardLight' | 'softLight' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity'
755
752
 
756
753
  /** Plain view of a `Color`. */
757
754
  export interface Color {
@@ -761,18 +758,14 @@ export interface Color {
761
758
  }
762
759
 
763
760
  /** A color channel. */
764
- export type ColorChannel = 'r'|
765
- 'g'|
766
- 'b'|
767
- 'a';
761
+ export type ColorChannel = 'r' | 'g' | 'b' | 'a'
768
762
 
769
763
  /**
770
764
  * A color interpolation mode.
771
765
  *
772
766
  * The default is `ColorInterpolation::LinearRGB`.
773
767
  */
774
- export type ColorInterpolation = 'srgb'|
775
- 'linearRgb';
768
+ export type ColorInterpolation = 'srgb' | 'linearRgb'
776
769
 
777
770
  /** Plain view of a `ColorMatrix`. */
778
771
  export interface ColorMatrix {
@@ -889,18 +882,7 @@ export interface DistantLight {
889
882
  }
890
883
 
891
884
  /** A dominant baseline property. */
892
- export type DominantBaseline = 'auto'|
893
- 'useScript'|
894
- 'noChange'|
895
- 'resetSize'|
896
- 'ideographic'|
897
- 'alphabetic'|
898
- 'hanging'|
899
- 'mathematical'|
900
- 'central'|
901
- 'middle'|
902
- 'textAfterEdge'|
903
- 'textBeforeEdge';
885
+ export type DominantBaseline = 'auto' | 'useScript' | 'noChange' | 'resetSize' | 'ideographic' | 'alphabetic' | 'hanging' | 'mathematical' | 'central' | 'middle' | 'textAfterEdge' | 'textBeforeEdge'
904
886
 
905
887
  /** Plain view of a `DropShadow`. */
906
888
  export interface DropShadow {
@@ -914,9 +896,7 @@ export interface DropShadow {
914
896
  }
915
897
 
916
898
  /** An edges processing mode. */
917
- export type EdgeMode = 'none'|
918
- 'duplicate'|
919
- 'wrap';
899
+ export type EdgeMode = 'none' | 'duplicate' | 'wrap'
920
900
 
921
901
  /** Plain view of a `Fill`. */
922
902
  export interface Fill {
@@ -930,8 +910,7 @@ export interface Fill {
930
910
  *
931
911
  * `fill-rule` attribute in the SVG.
932
912
  */
933
- export type FillRule = 'nonZero'|
934
- 'evenOdd';
913
+ export type FillRule = 'nonZero' | 'evenOdd'
935
914
 
936
915
  /** Plain view of a `Flood`. */
937
916
  export interface Flood {
@@ -940,9 +919,7 @@ export interface Flood {
940
919
  }
941
920
 
942
921
  /** Allows italic or oblique faces to be selected. */
943
- export type FontFaceStyle = 'normal'|
944
- 'italic'|
945
- 'oblique';
922
+ export type FontFaceStyle = 'normal' | 'italic' | 'oblique'
946
923
 
947
924
  /**
948
925
  * A font optical sizing property.
@@ -950,24 +927,13 @@ export type FontFaceStyle = 'normal'|
950
927
  * Controls automatic adjustment of the `opsz` axis in variable fonts
951
928
  * based on font size. Matches CSS `font-optical-sizing`.
952
929
  */
953
- export type FontOpticalSizing = 'auto'|
954
- 'none';
930
+ export type FontOpticalSizing = 'auto' | 'none'
955
931
 
956
932
  /** A font stretch property. */
957
- export type FontStretch = 'ultraCondensed'|
958
- 'extraCondensed'|
959
- 'condensed'|
960
- 'semiCondensed'|
961
- 'normal'|
962
- 'semiExpanded'|
963
- 'expanded'|
964
- 'extraExpanded'|
965
- 'ultraExpanded';
933
+ export type FontStretch = 'ultraCondensed' | 'extraCondensed' | 'condensed' | 'semiCondensed' | 'normal' | 'semiExpanded' | 'expanded' | 'extraExpanded' | 'ultraExpanded'
966
934
 
967
935
  /** A font style property. */
968
- export type FontStyle = 'normal'|
969
- 'italic'|
970
- 'oblique';
936
+ export type FontStyle = 'normal' | 'italic' | 'oblique'
971
937
 
972
938
  /** Plain view of a `FontVariation`. */
973
939
  export interface FontVariation {
@@ -993,12 +959,7 @@ export interface ImageKindSvg {
993
959
  *
994
960
  * `image-rendering` attribute in the SVG.
995
961
  */
996
- export type ImageRendering = 'optimizeQuality'|
997
- 'optimizeSpeed'|
998
- 'smooth'|
999
- 'highQuality'|
1000
- 'crispEdges'|
1001
- 'pixelated';
962
+ export type ImageRendering = 'optimizeQuality' | 'optimizeSpeed' | 'smooth' | 'highQuality' | 'crispEdges' | 'pixelated'
1002
963
 
1003
964
  /** The payload-free variants of `Input`. */
1004
965
  export interface InputPlain {
@@ -1132,8 +1093,7 @@ export interface KindTurbulence {
1132
1093
  }
1133
1094
 
1134
1095
  /** A length adjust property. */
1135
- export type LengthAdjust = 'spacing'|
1136
- 'spacingAndGlyphs';
1096
+ export type LengthAdjust = 'spacing' | 'spacingAndGlyphs'
1137
1097
 
1138
1098
  /** `LightSource::DistantLight`. */
1139
1099
  export interface LightSourceDistantLight {
@@ -1161,23 +1121,17 @@ export interface LightSourceSpotLight {
1161
1121
  *
1162
1122
  * `stroke-linecap` attribute in the SVG.
1163
1123
  */
1164
- export type LineCap = 'butt'|
1165
- 'round'|
1166
- 'square';
1124
+ export type LineCap = 'butt' | 'round' | 'square'
1167
1125
 
1168
1126
  /**
1169
1127
  * A line join.
1170
1128
  *
1171
1129
  * `stroke-linejoin` attribute in the SVG.
1172
1130
  */
1173
- export type LineJoin = 'miter'|
1174
- 'miterClip'|
1175
- 'round'|
1176
- 'bevel';
1131
+ export type LineJoin = 'miter' | 'miterClip' | 'round' | 'bevel'
1177
1132
 
1178
1133
  /** A mask type. */
1179
- export type MaskType = 'luminance'|
1180
- 'alpha';
1134
+ export type MaskType = 'luminance' | 'alpha'
1181
1135
 
1182
1136
  /**
1183
1137
  * An affine transform. Field names and order are tiny-skia's.
@@ -1212,14 +1166,10 @@ export interface Morphology {
1212
1166
  }
1213
1167
 
1214
1168
  /** A morphology operation. */
1215
- export type MorphologyOperator = 'erode'|
1216
- 'dilate';
1169
+ export type MorphologyOperator = 'erode' | 'dilate'
1217
1170
 
1218
1171
  /** Which flavour of node this is. */
1219
- export type NodeKind = 'group'|
1220
- 'path'|
1221
- 'image'|
1222
- 'text';
1172
+ export type NodeKind = 'group' | 'path' | 'image' | 'text'
1223
1173
 
1224
1174
  /** Plain view of a `Offset`. */
1225
1175
  export interface Offset {
@@ -1250,8 +1200,7 @@ export interface PaintLinearGradient {
1250
1200
  *
1251
1201
  * [`paint-order`]: https://www.w3.org/TR/SVG2/painting.html#PaintOrder
1252
1202
  */
1253
- export type PaintOrder = 'fillAndStroke'|
1254
- 'strokeAndFill';
1203
+ export type PaintOrder = 'fillAndStroke' | 'strokeAndFill'
1255
1204
 
1256
1205
  /** `Paint::Pattern`. */
1257
1206
  export interface PaintPattern {
@@ -1457,9 +1406,7 @@ export declare function setLogLevel(level: 'off' | 'error' | 'warn' | 'info' | '
1457
1406
  *
1458
1407
  * `shape-rendering` attribute in the SVG.
1459
1408
  */
1460
- export type ShapeRendering = 'optimizeSpeed'|
1461
- 'crispEdges'|
1462
- 'geometricPrecision';
1409
+ export type ShapeRendering = 'optimizeSpeed' | 'crispEdges' | 'geometricPrecision'
1463
1410
 
1464
1411
  /** Plain view of a `SpecularLighting`. */
1465
1412
  export interface SpecularLighting {
@@ -1488,9 +1435,7 @@ export interface SpotLight {
1488
1435
  *
1489
1436
  * `spreadMethod` attribute in the SVG.
1490
1437
  */
1491
- export type SpreadMethod = 'pad'|
1492
- 'reflect'|
1493
- 'repeat';
1438
+ export type SpreadMethod = 'pad' | 'reflect' | 'repeat'
1494
1439
 
1495
1440
  /** Plain view of a `Stop`. */
1496
1441
  export interface Stop {
@@ -1515,9 +1460,7 @@ export interface Stroke {
1515
1460
  export declare function takeLogs(): Array<string>
1516
1461
 
1517
1462
  /** A text chunk anchor property. */
1518
- export type TextAnchor = 'start'|
1519
- 'middle'|
1520
- 'end';
1463
+ export type TextAnchor = 'start' | 'middle' | 'end'
1521
1464
 
1522
1465
  /** Plain view of a `TextDecoration`. */
1523
1466
  export interface TextDecoration {
@@ -1550,9 +1493,7 @@ export interface TextFlowPlain {
1550
1493
  *
1551
1494
  * `text-rendering` attribute in the SVG.
1552
1495
  */
1553
- export type TextRendering = 'optimizeSpeed'|
1554
- 'optimizeLegibility'|
1555
- 'geometricPrecision';
1496
+ export type TextRendering = 'optimizeSpeed' | 'optimizeLegibility' | 'geometricPrecision'
1556
1497
 
1557
1498
  /** Plain view of a `Tile`. */
1558
1499
  export interface Tile {
@@ -1607,8 +1548,7 @@ export interface Turbulence {
1607
1548
  }
1608
1549
 
1609
1550
  /** A turbulence kind for the `feTurbulence` filter. */
1610
- export type TurbulenceKind = 'fractalNoise'|
1611
- 'turbulence';
1551
+ export type TurbulenceKind = 'fractalNoise' | 'turbulence'
1612
1552
 
1613
1553
  /**
1614
1554
  * Mirror of `usvg::WriteOptions`, for `Resvg.toString()`. Every field is
@@ -1662,5 +1602,4 @@ export interface WriteOptions {
1662
1602
  }
1663
1603
 
1664
1604
  /** A writing mode. */
1665
- export type WritingMode = 'leftToRight'|
1666
- 'topToBottom';
1605
+ export type WritingMode = 'leftToRight' | 'topToBottom'