ooxml-core 1.29.0 → 1.30.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/dist/{PptxHandler-CZG6ISCZ.cjs → PptxHandler-3OLZT5YW.cjs} +3 -3
- package/dist/{PptxHandler-QIHYALOV.mjs → PptxHandler-FJHKJEZU.mjs} +2 -2
- package/dist/PptxHandler-LOFY2PRO.mjs +4 -0
- package/dist/{PresentationBuilder-UAINQZA2.mjs → PresentationBuilder-23M6WQK3.mjs} +2 -2
- package/dist/{PresentationBuilder-66EU3N3O.cjs → PresentationBuilder-LVIVJZIL.cjs} +5 -5
- package/dist/{PresentationBuilder-5YM2L7DA.mjs → PresentationBuilder-W5VRPFLM.mjs} +2 -2
- package/dist/automation/index.cjs +4250 -3145
- package/dist/automation/index.mjs +4250 -3145
- package/dist/chart/box-distribution.d.ts +10 -0
- package/dist/chart/box-distribution.d.ts.map +1 -0
- package/dist/chart/data-table-layout.d.ts +8 -0
- package/dist/chart/data-table-layout.d.ts.map +1 -0
- package/dist/chart/date-axis.d.ts +3 -0
- package/dist/chart/date-axis.d.ts.map +1 -0
- package/dist/chart/date-format.d.ts +39 -0
- package/dist/chart/date-format.d.ts.map +1 -0
- package/dist/chart/edit/chartex-action.d.ts.map +1 -1
- package/dist/chart/edit/chartex-axis.d.ts.map +1 -1
- package/dist/chart/edit/chartex-structure.d.ts.map +1 -1
- package/dist/chart/edit/chartex.d.ts +3 -1
- package/dist/chart/edit/chartex.d.ts.map +1 -1
- package/dist/chart/edit/draft.d.ts.map +1 -1
- package/dist/chart/funnel-geometry.d.ts +15 -0
- package/dist/chart/funnel-geometry.d.ts.map +1 -0
- package/dist/chart/index.cjs +1392 -404
- package/dist/chart/index.d.ts +6 -0
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart/index.mjs +1379 -405
- package/dist/chart/line-path.d.ts +30 -0
- package/dist/chart/line-path.d.ts.map +1 -0
- package/dist/chart/manual-layout.d.ts +15 -0
- package/dist/chart/manual-layout.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-analysis.d.ts +2 -0
- package/dist/chart/render/chart-svg-analysis.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-bars.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-box.d.ts +5 -0
- package/dist/chart/render/chart-svg-box.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-cartesian.d.ts +3 -1
- package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-data-table.d.ts +11 -0
- package/dist/chart/render/chart-svg-data-table.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-date-axis.d.ts +9 -0
- package/dist/chart/render/chart-svg-date-axis.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-funnel.d.ts +4 -0
- package/dist/chart/render/chart-svg-funnel.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-labels.d.ts +16 -16
- package/dist/chart/render/chart-svg-labels.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-line.d.ts +5 -0
- package/dist/chart/render/chart-svg-line.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-plot-layout.d.ts +6 -0
- package/dist/chart/render/chart-svg-plot-layout.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-plots.d.ts +2 -1
- package/dist/chart/render/chart-svg-plots.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-radial.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-slice-labels.d.ts +18 -0
- package/dist/chart/render/chart-svg-slice-labels.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-xy.d.ts +2 -1
- package/dist/chart/render/chart-svg-xy.d.ts.map +1 -1
- package/dist/chart/render/chart-svg.d.ts.map +1 -1
- package/dist/chart/render/chart-title-text.d.ts +3 -1
- package/dist/chart/render/chart-title-text.d.ts.map +1 -1
- package/dist/chart/render/chart-view-analysis.d.ts +2 -1
- package/dist/chart/render/chart-view-analysis.d.ts.map +1 -1
- package/dist/chart/render/chart-view-data-table.d.ts +13 -0
- package/dist/chart/render/chart-view-data-table.d.ts.map +1 -0
- package/dist/chart/render/chart-view-labels.d.ts +6 -1
- package/dist/chart/render/chart-view-labels.d.ts.map +1 -1
- package/dist/chart/render/chart-view-series.d.ts.map +1 -1
- package/dist/chart/render/chart-view.d.ts +13 -0
- package/dist/chart/render/chart-view.d.ts.map +1 -1
- package/dist/chart/render/render-space.d.ts.map +1 -1
- package/dist/chart/render/summary-ex-series.d.ts +5 -0
- package/dist/chart/render/summary-ex-series.d.ts.map +1 -0
- package/dist/chart/render/summary-from-chartex.d.ts.map +1 -1
- package/dist/chart/render/summary-from-space.d.ts +1 -1
- package/dist/chart/render/summary-from-space.d.ts.map +1 -1
- package/dist/chart/render/summary-labels.d.ts.map +1 -1
- package/dist/chart/render/summary.d.ts +14 -1
- package/dist/chart/render/summary.d.ts.map +1 -1
- package/dist/{chunk-BBK3UB7M.mjs → chunk-5YZFO55V.mjs} +4 -4
- package/dist/{chunk-T7HBA3CW.cjs → chunk-7T3SJQA6.cjs} +11 -9
- package/dist/{chunk-XROY25LN.cjs → chunk-7XYVFUB3.cjs} +4 -0
- package/dist/{chunk-GUNTIFGT.cjs → chunk-CZXM4ZJH.cjs} +158 -26
- package/dist/{chunk-RYOJHYA3.mjs → chunk-DJ3CDTMX.mjs} +157 -27
- package/dist/{chunk-KBER3RAP.mjs → chunk-HDHUJM5M.mjs} +229 -227
- package/dist/{chunk-XCRDAVFN.mjs → chunk-HK7DVTEF.mjs} +237 -95
- package/dist/{chunk-6C4NLBLB.mjs → chunk-JZ64GVIB.mjs} +1 -1
- package/dist/{chunk-3UMDVJRN.mjs → chunk-NBMXEVHL.mjs} +4 -1
- package/dist/{chunk-TVJL7QIG.cjs → chunk-OGEL4Z4S.cjs} +8 -1
- package/dist/{chunk-HRU3KOE5.mjs → chunk-OORQCSVA.mjs} +5 -3
- package/dist/{chunk-7RJYOVQU.mjs → chunk-R7NS42KQ.mjs} +5 -2
- package/dist/{chunk-I2CGNAP2.cjs → chunk-SCK5U362.cjs} +1390 -1388
- package/dist/{chunk-DWEQWFQU.mjs → chunk-SCTM27HK.mjs} +229 -227
- package/dist/{chunk-PDZ4GQLI.mjs → chunk-UVYWAI4M.mjs} +1 -1
- package/dist/{chunk-DXOBT2JE.mjs → chunk-UZWV2HAJ.mjs} +8 -2
- package/dist/{chunk-IETFPVLN.cjs → chunk-XTUX5RMG.cjs} +15 -12
- package/dist/diagram/drawing.d.ts.map +1 -1
- package/dist/diagram/index.cjs +1218 -592
- package/dist/diagram/index.mjs +1218 -592
- package/dist/diagram/load.d.ts.map +1 -1
- package/dist/diagram/relationships.d.ts +1 -0
- package/dist/diagram/relationships.d.ts.map +1 -1
- package/dist/diagram/types.d.ts +2 -0
- package/dist/diagram/types.d.ts.map +1 -1
- package/dist/docx/diagram.d.ts.map +1 -1
- package/dist/docx/drawing.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +1850 -1138
- package/dist/docx/embedded.mjs +1850 -1138
- package/dist/docx/index.cjs +3312 -1713
- package/dist/docx/index.mjs +3312 -1713
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/fonts.d.ts +1 -1
- package/dist/docx/layout/fonts.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +1933 -518
- package/dist/docx/layout/index.mjs +1933 -518
- package/dist/docx/layout/script-fonts.d.ts +6 -0
- package/dist/docx/layout/script-fonts.d.ts.map +1 -0
- package/dist/docx/load/index.cjs +1853 -1141
- package/dist/docx/load/index.mjs +1853 -1141
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/shape-model.d.ts +2 -0
- package/dist/docx/shape-model.d.ts.map +1 -1
- package/dist/docx/shape-parse.d.ts.map +1 -1
- package/dist/docx/shape-svg.d.ts.map +1 -1
- package/dist/docx/ui/index.cjs +1763 -593
- package/dist/docx/ui/index.mjs +1763 -593
- package/dist/docx/write-shape.d.ts.map +1 -1
- package/dist/drawingml/custom-geometry.d.ts +5 -0
- package/dist/drawingml/custom-geometry.d.ts.map +1 -0
- package/dist/drawingml/drawing-fill.d.ts.map +1 -1
- package/dist/drawingml/drawing-geometry.d.ts.map +1 -1
- package/dist/drawingml/image-content-type.d.ts +2 -0
- package/dist/drawingml/image-content-type.d.ts.map +1 -0
- package/dist/drawingml/index.cjs +1128 -179
- package/dist/drawingml/index.d.ts +9 -0
- package/dist/drawingml/index.d.ts.map +1 -1
- package/dist/drawingml/index.mjs +1110 -180
- package/dist/drawingml/path-data.d.ts +4 -0
- package/dist/drawingml/path-data.d.ts.map +1 -0
- package/dist/drawingml/picture-crop.d.ts +8 -0
- package/dist/drawingml/picture-crop.d.ts.map +1 -0
- package/dist/drawingml/picture-effects.d.ts +37 -0
- package/dist/drawingml/picture-effects.d.ts.map +1 -0
- package/dist/drawingml/picture-fill.d.ts +7 -0
- package/dist/drawingml/picture-fill.d.ts.map +1 -0
- package/dist/drawingml/read-3d-values.d.ts +8 -0
- package/dist/drawingml/read-3d-values.d.ts.map +1 -0
- package/dist/drawingml/read-text-3d.d.ts +8 -0
- package/dist/drawingml/read-text-3d.d.ts.map +1 -0
- package/dist/drawingml/read-text-body.d.ts.map +1 -1
- package/dist/drawingml/scene3d-coordinate.d.ts +45 -0
- package/dist/drawingml/scene3d-coordinate.d.ts.map +1 -0
- package/dist/drawingml/scene3d-presets.d.ts +12 -0
- package/dist/drawingml/scene3d-presets.d.ts.map +1 -0
- package/dist/drawingml/text-3d-model.d.ts +71 -0
- package/dist/drawingml/text-3d-model.d.ts.map +1 -0
- package/dist/drawingml/text-model.d.ts +3 -0
- package/dist/drawingml/text-model.d.ts.map +1 -1
- package/dist/drawingml/types.d.ts +3 -0
- package/dist/drawingml/types.d.ts.map +1 -1
- package/dist/drawingml/write-pattern-picture.d.ts.map +1 -1
- package/dist/drawingml/write-text-3d.d.ts +6 -0
- package/dist/drawingml/write-text-3d.d.ts.map +1 -0
- package/dist/drawingml/write-text-body.d.ts.map +1 -1
- package/dist/geometry/element-transform.d.ts +3 -0
- package/dist/geometry/element-transform.d.ts.map +1 -1
- package/dist/geometry/index.cjs +69 -4
- package/dist/geometry/index.d.ts +2 -0
- package/dist/geometry/index.d.ts.map +1 -1
- package/dist/geometry/index.mjs +66 -5
- package/dist/geometry/picture-crop.d.ts +21 -0
- package/dist/geometry/picture-crop.d.ts.map +1 -0
- package/dist/geometry/resize-aspect.d.ts +12 -0
- package/dist/geometry/resize-aspect.d.ts.map +1 -0
- package/dist/index.cjs +4201 -2058
- package/dist/index.mjs +4201 -2058
- package/dist/opc/index.cjs +9 -6
- package/dist/opc/index.mjs +9 -6
- package/dist/opc/safe-href.d.ts +10 -3
- package/dist/opc/safe-href.d.ts.map +1 -1
- package/dist/pptx/automation/index.cjs +615 -360
- package/dist/pptx/automation/index.d.ts +6 -6
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{elements-CCEghtE_.d.ts → elements-mSCZ84Tc.d.ts} +4 -4
- package/dist/pptx/chunks/elements-mSCZ84Tc.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-D90lhgiE.d.ts → index-BQDcu_0a.d.ts} +19 -111
- package/dist/pptx/chunks/index-BQDcu_0a.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CmnbpSCL.d.ts → index-CBV1oHN7.d.ts} +5 -5
- package/dist/pptx/chunks/{index-CmnbpSCL.d.ts.map → index-CBV1oHN7.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-DJIPX0Ge.d.ts → index-PdM5zpmu.d.ts} +5 -5
- package/dist/pptx/chunks/{index-DJIPX0Ge.d.ts.map → index-PdM5zpmu.d.ts.map} +1 -1
- package/dist/pptx/chunks/{smart-art-BLBSej3J.d.ts → smart-art-DLumQo90.d.ts} +135 -103
- package/dist/pptx/chunks/smart-art-DLumQo90.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-D49FKllA.d.ts → text-P9xVnXXf.d.ts} +49 -60
- package/dist/pptx/chunks/text-P9xVnXXf.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-DZ1IgDJN.d.ts → text-operations-hyPODwIQ.d.ts} +4 -4
- package/dist/pptx/chunks/{text-operations-DZ1IgDJN.d.ts.map → text-operations-hyPODwIQ.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +611 -356
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +102 -67
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/collaboration-assets.cjs +15 -11
- package/dist/pptx/editor/render/collaboration-assets.d.ts +2 -2
- package/dist/pptx/editor/render/collaboration-assets.mjs +1 -1
- package/dist/pptx/editor/render/collaboration-live-patch-target.cjs +5 -5
- package/dist/pptx/editor/render/collaboration-live-patch-target.mjs +3 -3
- package/dist/pptx/editor/render/collaboration-reconcile.cjs +9 -9
- package/dist/pptx/editor/render/collaboration-reconcile.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-reconcile.mjs +3 -3
- package/dist/pptx/editor/render/collaboration-sync.cjs +29 -25
- package/dist/pptx/editor/render/collaboration-sync.d.ts +7 -0
- package/dist/pptx/editor/render/collaboration-sync.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-sync.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.cjs +14 -14
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +1 -1
- package/dist/pptx/editor/render/font-family-update.d.ts +1 -1
- package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +8 -8
- package/dist/pptx/editor/render/slide-operations.mjs +2 -2
- package/dist/pptx/editor/render/table-cell-edit.cjs +8 -4
- package/dist/pptx/editor/render/table-cell-edit.d.ts +5 -0
- package/dist/pptx/editor/render/table-cell-edit.d.ts.map +1 -1
- package/dist/pptx/editor/render/table-cell-edit.mjs +1 -1
- package/dist/pptx/editor/render/table-cell-merge.cjs +3 -3
- package/dist/pptx/editor/render/table-cell-merge.mjs +1 -1
- package/dist/pptx/editor/render/table-data-grid-ops.cjs +2 -2
- package/dist/pptx/editor/render/table-data-grid-ops.mjs +1 -1
- package/dist/pptx/editor/render/table-merge.cjs +5 -5
- package/dist/pptx/editor/render/table-merge.mjs +1 -1
- package/dist/pptx/editor/render/text-content-style.d.ts +1 -1
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +2 -2
- package/dist/pptx/editor/render/text-style-scope.d.ts +2 -2
- package/dist/pptx/editor/render/update-text-segment-style.d.ts +1 -1
- package/dist/pptx/index.cjs +677 -418
- package/dist/pptx/index.d.ts +8 -8
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/pptx/smartart-layouts/index.d.ts +1 -1
- package/dist/teams/index.cjs +1816 -1049
- package/dist/teams/index.mjs +1816 -1049
- package/dist/text/font-style-name.d.ts +11 -0
- package/dist/text/font-style-name.d.ts.map +1 -0
- package/dist/text/font-substitution-map.d.ts +3 -0
- package/dist/text/font-substitution-map.d.ts.map +1 -0
- package/dist/text/font-substitution.d.ts +34 -0
- package/dist/text/font-substitution.d.ts.map +1 -0
- package/dist/text/index.cjs +460 -0
- package/dist/text/index.d.ts +3 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.mjs +443 -1
- package/dist/text/metric-font-family.d.ts +7 -0
- package/dist/text/metric-font-family.d.ts.map +1 -0
- package/dist/text/panose.d.ts +55 -0
- package/dist/text/panose.d.ts.map +1 -0
- package/dist/text/script-fonts.d.ts +26 -0
- package/dist/text/script-fonts.d.ts.map +1 -0
- package/dist/visio/edit-geometry-admission.d.ts +1 -1
- package/dist/visio/edit-geometry-admission.d.ts.map +1 -1
- package/dist/visio/edit-group-resize.d.ts +26 -0
- package/dist/visio/edit-group-resize.d.ts.map +1 -0
- package/dist/visio/edit-recalculate-index.d.ts +2 -0
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-resize-anchor.d.ts.map +1 -1
- package/dist/visio/edit-resize-plan.d.ts +14 -0
- package/dist/visio/edit-resize-plan.d.ts.map +1 -0
- package/dist/visio/edit-scope.d.ts.map +1 -1
- package/dist/visio/index.cjs +1326 -389
- package/dist/visio/index.mjs +1326 -389
- package/dist/visio/ui/geometry-expectation.d.ts +17 -0
- package/dist/visio/ui/geometry-expectation.d.ts.map +1 -0
- package/dist/visio/ui/guides.d.ts +2 -0
- package/dist/visio/ui/guides.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +1582 -411
- package/dist/visio/ui/index.d.ts +2 -0
- package/dist/visio/ui/index.d.ts.map +1 -1
- package/dist/visio/ui/index.mjs +1579 -412
- package/dist/visio/ui/selection-resize.d.ts +19 -0
- package/dist/visio/ui/selection-resize.d.ts.map +1 -0
- package/dist/visio/ui/shape-move.d.ts +1 -1
- package/dist/visio/ui/shape-move.d.ts.map +1 -1
- package/dist/visio/ui/shape-resize.d.ts.map +1 -1
- package/dist/xlsx/edit/drawings.d.ts +5 -0
- package/dist/xlsx/edit/drawings.d.ts.map +1 -1
- package/dist/xlsx/edit/session.d.ts.map +1 -1
- package/dist/xlsx/edit/types.d.ts +4 -0
- package/dist/xlsx/edit/types.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +3908 -2256
- package/dist/xlsx/index.mjs +3908 -2256
- package/dist/xlsx/layout/chart-view.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +2003 -1239
- package/dist/xlsx/load/index.mjs +2003 -1239
- package/dist/xlsx/model.d.ts +4 -0
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/read/chart.d.ts.map +1 -1
- package/dist/xlsx/read/drawing.d.ts.map +1 -1
- package/dist/xlsx/read/smart-art.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +3880 -2228
- package/dist/xlsx/ui/index.mjs +3880 -2228
- package/dist/xlsx/write/drawing.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/PptxHandler-DSXSXMEG.mjs +0 -4
- package/dist/pptx/chunks/elements-CCEghtE_.d.ts.map +0 -1
- package/dist/pptx/chunks/index-D90lhgiE.d.ts.map +0 -1
- package/dist/pptx/chunks/smart-art-BLBSej3J.d.ts.map +0 -1
- package/dist/pptx/chunks/text-D49FKllA.d.ts.map +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The family name with trailing weight/style tokens removed (up to two,
|
|
3
|
+
* e.g. "Semibold Italic", plus the prefix of a spaced weight such as
|
|
4
|
+
* "Semi Bold"), or `undefined` when nothing was stripped.
|
|
5
|
+
*
|
|
6
|
+
* The full name always stays FIRST in any font chain; the stripped base
|
|
7
|
+
* is only an additional candidate, so genuine families that end in a
|
|
8
|
+
* weight word ("Arial Black") still win when installed.
|
|
9
|
+
*/
|
|
10
|
+
export declare function stripFontStyleSuffix(fontName: string): string | undefined;
|
|
11
|
+
//# sourceMappingURL=font-style-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-style-name.d.ts","sourceRoot":"","sources":["../../text/font-style-name.ts"],"names":[],"mappings":"AAoCA;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA2BzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-substitution-map.d.ts","sourceRoot":"","sources":["../../text/font-substitution-map.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAmKnE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export { FONT_SUBSTITUTION_MAP } from './font-substitution-map.js';
|
|
2
|
+
export { stripFontStyleSuffix } from './font-style-name.js';
|
|
3
|
+
export * from './panose.js';
|
|
4
|
+
export declare function getSubstituteFontFamily(fontName: string, panose?: number[]): string;
|
|
5
|
+
/**
|
|
6
|
+
* Get only the fallback fonts for a given font name (without the
|
|
7
|
+
* original font name itself). Useful when building font-family chains
|
|
8
|
+
* where the primary font is already included.
|
|
9
|
+
*
|
|
10
|
+
* @param fontName The font family name as referenced in the PPTX.
|
|
11
|
+
* @param panose Optional PANOSE classification array (10 bytes).
|
|
12
|
+
* @returns Array of fallback font names (may include generic CSS families).
|
|
13
|
+
*/
|
|
14
|
+
export declare function getSubstituteFonts(fontName: string, panose?: number[]): readonly string[];
|
|
15
|
+
/**
|
|
16
|
+
* Check whether a font name has a known direct substitution.
|
|
17
|
+
*
|
|
18
|
+
* @param fontName The font family name.
|
|
19
|
+
* @returns `true` if the font is in the direct substitution map.
|
|
20
|
+
*/
|
|
21
|
+
export declare function hasDirectSubstitution(fontName: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Build a CSS `font-family` value string from a primary font name
|
|
24
|
+
* and an ordered list of fallback fonts.
|
|
25
|
+
*
|
|
26
|
+
* Generic CSS family keywords (serif, sans-serif, etc.) are not quoted.
|
|
27
|
+
* All other font names are wrapped in double quotes.
|
|
28
|
+
*
|
|
29
|
+
* @param primary The primary font family name.
|
|
30
|
+
* @param fallbacks Ordered array of fallback font names / generic families.
|
|
31
|
+
* @returns A properly formatted CSS font-family string.
|
|
32
|
+
*/
|
|
33
|
+
export declare function buildFontFamilyString(primary: string, fallbacks: readonly string[]): string;
|
|
34
|
+
//# sourceMappingURL=font-substitution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-substitution.d.ts","sourceRoot":"","sources":["../../text/font-substitution.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,cAAc,UAAU,CAAC;AAgBzB,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAMnF;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,CA8BzF;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE/D;AAuBD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAU3F"}
|
package/dist/text/index.cjs
CHANGED
|
@@ -511,10 +511,460 @@ function realignOrCollapseRuns(runs, text) {
|
|
|
511
511
|
return distributed ? runs.map((run, index) => ({ ...run, text: distributed[index] ?? "" })) : [{ ...first, text }];
|
|
512
512
|
}
|
|
513
513
|
|
|
514
|
+
// text/font-substitution-map.ts
|
|
515
|
+
var FONT_SUBSTITUTION_MAP = {
|
|
516
|
+
// Microsoft Office default fonts. The Aptos family became the Office
|
|
517
|
+
// default and its metrics were drawn to sit close to Calibri, so falling
|
|
518
|
+
// back through Calibri keeps authored line counts; the generic sans-serif
|
|
519
|
+
// chain is wider and re-wraps one-line titles.
|
|
520
|
+
Aptos: ["Calibri", "Carlito", "Liberation Sans", "Arial", "sans-serif"],
|
|
521
|
+
"Aptos Display": ["Calibri Light", "Calibri", "Carlito", "Arial", "sans-serif"],
|
|
522
|
+
"Aptos Narrow": ["Calibri", "Liberation Sans Narrow", "Arial", "sans-serif"],
|
|
523
|
+
"Aptos Serif": ["Cambria", "Caladea", "Liberation Serif", "Times New Roman", "serif"],
|
|
524
|
+
"Aptos Mono": ["Consolas", "Liberation Mono", "Courier New", "monospace"],
|
|
525
|
+
Calibri: ["Carlito", "Liberation Sans", "Arial", "sans-serif"],
|
|
526
|
+
"Calibri Light": ["Carlito", "Liberation Sans", "Arial", "sans-serif"],
|
|
527
|
+
Cambria: ["Caladea", "Liberation Serif", "Times New Roman", "serif"],
|
|
528
|
+
"Cambria Math": ["STIX Two Math", "Latin Modern Math", "Times New Roman", "serif"],
|
|
529
|
+
Consolas: ["Liberation Mono", "Courier New", "monospace"],
|
|
530
|
+
// Selawik is Microsoft's own metric-compatible open substitute for Segoe
|
|
531
|
+
// UI (github.com/microsoft/Selawik); it is not on Google Fonts, so the
|
|
532
|
+
// webfont loader (google-webfonts.ts) cannot fetch it automatically, but
|
|
533
|
+
// listing it first still wins for a reader who has it installed or a
|
|
534
|
+
// deployment that self-hosts it.
|
|
535
|
+
"Segoe UI": ["Selawik", "Liberation Sans", "Arimo", "Helvetica Neue", "Arial", "sans-serif"],
|
|
536
|
+
"Segoe UI Light": [
|
|
537
|
+
"Selawik Light",
|
|
538
|
+
"Liberation Sans",
|
|
539
|
+
"Arimo",
|
|
540
|
+
"Helvetica Neue",
|
|
541
|
+
"Arial",
|
|
542
|
+
"sans-serif"
|
|
543
|
+
],
|
|
544
|
+
"Segoe UI Semibold": [
|
|
545
|
+
"Selawik Semibold",
|
|
546
|
+
"Liberation Sans",
|
|
547
|
+
"Arimo",
|
|
548
|
+
"Helvetica Neue",
|
|
549
|
+
"Arial",
|
|
550
|
+
"sans-serif"
|
|
551
|
+
],
|
|
552
|
+
// Classic Windows fonts → cross-platform equivalents. Arimo/Tinos/Cousine
|
|
553
|
+
// are Google's metric-compatible clones of Arial/Times New Roman/Courier
|
|
554
|
+
// New (the same project that produced Carlito/Caladea) and, unlike
|
|
555
|
+
// Liberation Sans/Serif/Mono, are served by Google Fonts, so listing them
|
|
556
|
+
// is what lets the webfont loader actually fetch a matching face when the
|
|
557
|
+
// reader's system has neither the original nor the Liberation family.
|
|
558
|
+
"Times New Roman": ["Liberation Serif", "Tinos", "Times", "serif"],
|
|
559
|
+
Arial: ["Liberation Sans", "Arimo", "Helvetica", "sans-serif"],
|
|
560
|
+
"Arial Black": ["Liberation Sans", "Arimo", "Helvetica", "sans-serif"],
|
|
561
|
+
"Arial Narrow": ["Liberation Sans Narrow", "Arimo", "Helvetica Neue", "sans-serif"],
|
|
562
|
+
Helvetica: ["Liberation Sans", "Arimo", "Arial", "sans-serif"],
|
|
563
|
+
"Helvetica Neue": ["Liberation Sans", "Arimo", "Arial", "sans-serif"],
|
|
564
|
+
"Courier New": ["Liberation Mono", "Cousine", "Courier", "monospace"],
|
|
565
|
+
Verdana: ["DejaVu Sans", "Bitstream Vera Sans", "sans-serif"],
|
|
566
|
+
// Gelasio is Google's metric-compatible clone of Georgia (built the same
|
|
567
|
+
// way as Carlito/Caladea from Georgia's own hmtx table); Liberation Serif
|
|
568
|
+
// is not metrically close to Georgia and stays only as a further fallback.
|
|
569
|
+
Georgia: ["Gelasio", "Liberation Serif", "Times New Roman", "serif"],
|
|
570
|
+
Tahoma: ["DejaVu Sans", "Liberation Sans", "sans-serif"],
|
|
571
|
+
Trebuchet: ["Liberation Sans", "sans-serif"],
|
|
572
|
+
"Trebuchet MS": ["Liberation Sans", "sans-serif"],
|
|
573
|
+
"Comic Sans MS": ["Comic Neue", "cursive"],
|
|
574
|
+
Impact: ["Charcoal", "sans-serif"],
|
|
575
|
+
"Lucida Console": ["Liberation Mono", "monospace"],
|
|
576
|
+
"Lucida Sans Unicode": ["Lucida Grande", "Liberation Sans", "sans-serif"],
|
|
577
|
+
Palatino: ["Palatino Linotype", "Book Antiqua", "serif"],
|
|
578
|
+
"Palatino Linotype": ["Palatino", "Book Antiqua", "serif"],
|
|
579
|
+
"Book Antiqua": ["Palatino Linotype", "Palatino", "serif"],
|
|
580
|
+
// CJK fonts
|
|
581
|
+
"MS PGothic": ["Noto Sans CJK JP", "Hiragino Sans", "Yu Gothic", "sans-serif"],
|
|
582
|
+
"MS PMincho": ["Noto Serif CJK JP", "Hiragino Mincho ProN", "Yu Mincho", "serif"],
|
|
583
|
+
"MS Gothic": ["Noto Sans CJK JP", "Hiragino Sans", "Yu Gothic", "sans-serif"],
|
|
584
|
+
"MS Mincho": ["Noto Serif CJK JP", "Hiragino Mincho ProN", "Yu Mincho", "serif"],
|
|
585
|
+
SimSun: ["Noto Serif CJK SC", "STSong", "serif"],
|
|
586
|
+
SimHei: ["Noto Sans CJK SC", "STHeiti", "sans-serif"],
|
|
587
|
+
"Microsoft YaHei": ["Noto Sans CJK SC", "PingFang SC", "sans-serif"],
|
|
588
|
+
NSimSun: ["Noto Serif CJK SC", "STSong", "serif"],
|
|
589
|
+
FangSong: ["Noto Serif CJK SC", "STFangsong", "serif"],
|
|
590
|
+
KaiTi: ["Noto Serif CJK SC", "STKaiti", "serif"],
|
|
591
|
+
DengXian: ["Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "sans-serif"],
|
|
592
|
+
\u7B49\u7EBF: ["DengXian", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "sans-serif"],
|
|
593
|
+
\u5B8B\u4F53: ["SimSun", "Songti SC", "STSong", "Noto Serif CJK SC", "serif"],
|
|
594
|
+
\u65B0\u5B8B\u4F53: ["NSimSun", "Songti SC", "STSong", "Noto Serif CJK SC", "serif"],
|
|
595
|
+
\u9ED1\u4F53: ["SimHei", "Heiti SC", "STHeiti", "PingFang SC", "Noto Sans CJK SC", "sans-serif"],
|
|
596
|
+
\u4EFF\u5B8B: ["FangSong", "STFangsong", "Songti SC", "Noto Serif CJK SC", "serif"],
|
|
597
|
+
\u6977\u4F53: ["KaiTi", "Kaiti SC", "STKaiti", "Noto Serif CJK SC", "serif"],
|
|
598
|
+
Batang: ["Noto Serif CJK KR", "AppleMyungjo", "serif"],
|
|
599
|
+
Dotum: ["Noto Sans CJK KR", "AppleGothic", "sans-serif"],
|
|
600
|
+
Gulim: ["Noto Sans CJK KR", "AppleGothic", "sans-serif"],
|
|
601
|
+
Malgun: ["Noto Sans CJK KR", "Apple SD Gothic Neo", "sans-serif"],
|
|
602
|
+
"Malgun Gothic": ["Noto Sans CJK KR", "Apple SD Gothic Neo", "sans-serif"],
|
|
603
|
+
// Source Han Sans (Adobe/Google) ships the same glyphs as Noto Sans CJK;
|
|
604
|
+
// the zh-CN name 思源黑体 is how decks authored in Chinese reference it.
|
|
605
|
+
"\u601D\u6E90\u9ED1\u4F53 CN": [
|
|
606
|
+
"Source Han Sans CN",
|
|
607
|
+
"Noto Sans CJK SC",
|
|
608
|
+
"Noto Sans SC",
|
|
609
|
+
"Microsoft YaHei",
|
|
610
|
+
"sans-serif"
|
|
611
|
+
],
|
|
612
|
+
\u601D\u6E90\u9ED1\u4F53: [
|
|
613
|
+
"Source Han Sans SC",
|
|
614
|
+
"Noto Sans CJK SC",
|
|
615
|
+
"Noto Sans SC",
|
|
616
|
+
"Microsoft YaHei",
|
|
617
|
+
"sans-serif"
|
|
618
|
+
],
|
|
619
|
+
"Source Han Sans CN": [
|
|
620
|
+
"\u601D\u6E90\u9ED1\u4F53 CN",
|
|
621
|
+
"Noto Sans CJK SC",
|
|
622
|
+
"Noto Sans SC",
|
|
623
|
+
"Microsoft YaHei",
|
|
624
|
+
"sans-serif"
|
|
625
|
+
],
|
|
626
|
+
\u5FAE\u8F6F\u96C5\u9ED1: ["Microsoft YaHei", "Noto Sans CJK SC", "PingFang SC", "sans-serif"],
|
|
627
|
+
// Complex script fonts
|
|
628
|
+
"Arabic Typesetting": ["Noto Naskh Arabic", "serif"],
|
|
629
|
+
"Simplified Arabic": ["Noto Sans Arabic", "sans-serif"],
|
|
630
|
+
"Traditional Arabic": ["Noto Naskh Arabic", "serif"],
|
|
631
|
+
Mangal: ["Noto Sans Devanagari", "sans-serif"],
|
|
632
|
+
Vrinda: ["Noto Sans Bengali", "sans-serif"],
|
|
633
|
+
Raavi: ["Noto Sans Gurmukhi", "sans-serif"],
|
|
634
|
+
Shruti: ["Noto Sans Gujarati", "sans-serif"],
|
|
635
|
+
Tunga: ["Noto Sans Kannada", "sans-serif"],
|
|
636
|
+
Kartika: ["Noto Sans Malayalam", "sans-serif"],
|
|
637
|
+
Iskoola: ["Noto Sans Sinhala", "sans-serif"],
|
|
638
|
+
"Iskoola Pota": ["Noto Sans Sinhala", "sans-serif"],
|
|
639
|
+
Leelawadee: ["Noto Sans Thai", "sans-serif"],
|
|
640
|
+
"Leelawadee UI": ["Noto Sans Thai", "sans-serif"],
|
|
641
|
+
"Cordia New": ["Noto Sans Thai", "sans-serif"],
|
|
642
|
+
DokChampa: ["Noto Sans Lao", "sans-serif"],
|
|
643
|
+
Nyala: ["Noto Sans Ethiopic", "sans-serif"],
|
|
644
|
+
MoolBoran: ["Noto Sans Khmer", "sans-serif"],
|
|
645
|
+
// Decorative / Display
|
|
646
|
+
// Condensed display faces: decks often reference the FULL style name
|
|
647
|
+
// ("Bebas Neue Regular"); the suffix-stripped base resolves here. The
|
|
648
|
+
// fallbacks must stay condensed, or short numeric labels sized to the
|
|
649
|
+
// narrow face overflow their text boxes and wrap (issue #132, "77%").
|
|
650
|
+
"Bebas Neue": ["Oswald", "Arial Narrow", "Impact", "sans-serif"],
|
|
651
|
+
// Office stores named Source Sans weights as separate family names (e.g. a
|
|
652
|
+
// theme authored with "Source Sans Pro ExtraLight" as its own face), while
|
|
653
|
+
// Google Fonts and most local installs expose the base family with a
|
|
654
|
+
// weight axis instead. Keep the authored face first for a browser that
|
|
655
|
+
// does have it installed under that exact name, then fall back to the
|
|
656
|
+
// metrically compatible base family before generic sans-serif.
|
|
657
|
+
"Source Sans Pro ExtraLight": [
|
|
658
|
+
"Source Sans Pro",
|
|
659
|
+
"Calibri Light",
|
|
660
|
+
"Segoe UI Light",
|
|
661
|
+
"Arial",
|
|
662
|
+
"sans-serif"
|
|
663
|
+
],
|
|
664
|
+
"Century Gothic": ["URW Gothic", "Futura", "sans-serif"],
|
|
665
|
+
Oswald: ["Agency FB", "Arial Narrow", "sans-serif"],
|
|
666
|
+
"Franklin Gothic": ["Liberation Sans", "Helvetica Neue", "sans-serif"],
|
|
667
|
+
"Franklin Gothic Medium": ["Liberation Sans", "Helvetica Neue", "sans-serif"],
|
|
668
|
+
Garamond: ["EB Garamond", "Cormorant Garamond", "serif"],
|
|
669
|
+
"Tw Cen MT": ["Century Gothic", "Futura", "sans-serif"],
|
|
670
|
+
Rockwell: ["Roboto Slab", "Rockwell", "serif"],
|
|
671
|
+
Candara: ["Liberation Sans", "Optima", "sans-serif"],
|
|
672
|
+
Constantia: ["Liberation Serif", "Palatino", "serif"],
|
|
673
|
+
Corbel: ["Liberation Sans", "Lucida Grande", "sans-serif"]
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
// text/font-style-name.ts
|
|
677
|
+
var FONT_STYLE_SUFFIX_TOKENS = /* @__PURE__ */ new Set([
|
|
678
|
+
"regular",
|
|
679
|
+
"normal",
|
|
680
|
+
"book",
|
|
681
|
+
"roman",
|
|
682
|
+
"thin",
|
|
683
|
+
"hairline",
|
|
684
|
+
"extralight",
|
|
685
|
+
"ultralight",
|
|
686
|
+
"demilight",
|
|
687
|
+
"semilight",
|
|
688
|
+
"light",
|
|
689
|
+
"medium",
|
|
690
|
+
"demibold",
|
|
691
|
+
"semibold",
|
|
692
|
+
"bold",
|
|
693
|
+
"extrabold",
|
|
694
|
+
"ultrabold",
|
|
695
|
+
"heavy",
|
|
696
|
+
"black",
|
|
697
|
+
"extrablack",
|
|
698
|
+
"ultra",
|
|
699
|
+
"italic",
|
|
700
|
+
"oblique"
|
|
701
|
+
]);
|
|
702
|
+
var FONT_WEIGHT_PREFIX_TOKENS = /* @__PURE__ */ new Set(["semi", "demi", "extra", "ultra"]);
|
|
703
|
+
var FONT_PREFIXED_WEIGHT_TOKENS = /* @__PURE__ */ new Set(["bold", "light", "black"]);
|
|
704
|
+
function stripFontStyleSuffix(fontName) {
|
|
705
|
+
let name = fontName.trim();
|
|
706
|
+
let stripped = false;
|
|
707
|
+
let previous = "";
|
|
708
|
+
let tokens = 0;
|
|
709
|
+
for (; ; ) {
|
|
710
|
+
const idx = name.lastIndexOf(" ");
|
|
711
|
+
if (idx <= 0) {
|
|
712
|
+
break;
|
|
713
|
+
}
|
|
714
|
+
const token = name.slice(idx + 1).toLowerCase().replace(/-/g, "");
|
|
715
|
+
const prefix = FONT_WEIGHT_PREFIX_TOKENS.has(token) && FONT_PREFIXED_WEIGHT_TOKENS.has(previous);
|
|
716
|
+
if (!prefix && (tokens >= 2 || !FONT_STYLE_SUFFIX_TOKENS.has(token))) {
|
|
717
|
+
break;
|
|
718
|
+
}
|
|
719
|
+
name = name.slice(0, idx).trim();
|
|
720
|
+
stripped = true;
|
|
721
|
+
previous = prefix ? "" : token;
|
|
722
|
+
if (!prefix) {
|
|
723
|
+
tokens++;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
return stripped && name.length > 0 ? name : void 0;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
// text/panose.ts
|
|
730
|
+
var PANOSE_FAMILY_MAP = {
|
|
731
|
+
0: "sans-serif",
|
|
732
|
+
// Any - default to sans-serif
|
|
733
|
+
1: "sans-serif",
|
|
734
|
+
// No Fit - default to sans-serif
|
|
735
|
+
2: "serif",
|
|
736
|
+
// Latin Text (most serif fonts)
|
|
737
|
+
3: "cursive",
|
|
738
|
+
// Latin Hand Written
|
|
739
|
+
4: "fantasy",
|
|
740
|
+
// Latin Decorative
|
|
741
|
+
5: "sans-serif"
|
|
742
|
+
// Latin Symbol (approximation)
|
|
743
|
+
};
|
|
744
|
+
var PANOSE_SANS_SERIF_STYLES = /* @__PURE__ */ new Set([
|
|
745
|
+
11,
|
|
746
|
+
// Normal Sans
|
|
747
|
+
12,
|
|
748
|
+
// Obtuse Sans
|
|
749
|
+
13
|
|
750
|
+
// Perpendicular Sans
|
|
751
|
+
// Also note: some fonts use these values for sans-serif
|
|
752
|
+
// 14+ are rarely used and vendor-specific
|
|
753
|
+
]);
|
|
754
|
+
var PANOSE_MONOSPACE_PROPORTION = 9;
|
|
755
|
+
var PANOSE_WEIGHT_MAP = {
|
|
756
|
+
1: 100,
|
|
757
|
+
// Very Light
|
|
758
|
+
2: 100,
|
|
759
|
+
// Light
|
|
760
|
+
3: 200,
|
|
761
|
+
// Thin
|
|
762
|
+
4: 300,
|
|
763
|
+
// Book / Light
|
|
764
|
+
5: 400,
|
|
765
|
+
// Medium / Regular
|
|
766
|
+
6: 500,
|
|
767
|
+
// Demi / Medium
|
|
768
|
+
7: 600,
|
|
769
|
+
// Semi-Bold
|
|
770
|
+
8: 700,
|
|
771
|
+
// Bold
|
|
772
|
+
9: 800,
|
|
773
|
+
// Heavy / Extra-Bold
|
|
774
|
+
10: 900,
|
|
775
|
+
// Black
|
|
776
|
+
11: 900
|
|
777
|
+
// Extra Black / Nord
|
|
778
|
+
};
|
|
779
|
+
function parsePanoseString(panoseStr) {
|
|
780
|
+
if (!panoseStr) {
|
|
781
|
+
return void 0;
|
|
782
|
+
}
|
|
783
|
+
const cleaned = panoseStr.trim();
|
|
784
|
+
if (cleaned.length !== 20) {
|
|
785
|
+
return void 0;
|
|
786
|
+
}
|
|
787
|
+
if (!/^[0-9a-fA-F]{20}$/.test(cleaned)) {
|
|
788
|
+
return void 0;
|
|
789
|
+
}
|
|
790
|
+
const bytes = [];
|
|
791
|
+
for (let i = 0; i < 20; i += 2) {
|
|
792
|
+
bytes.push(parseInt(cleaned.substring(i, i + 2), 16));
|
|
793
|
+
}
|
|
794
|
+
return bytes;
|
|
795
|
+
}
|
|
796
|
+
function parsePanoseBytes(data) {
|
|
797
|
+
if (!data || data.length !== 10) {
|
|
798
|
+
return void 0;
|
|
799
|
+
}
|
|
800
|
+
return Array.from(data);
|
|
801
|
+
}
|
|
802
|
+
function classifyPanose(panose) {
|
|
803
|
+
if (!panose || panose.length < 4) {
|
|
804
|
+
return "sans-serif";
|
|
805
|
+
}
|
|
806
|
+
const familyType = panose[0] ?? 0;
|
|
807
|
+
const serifStyle = panose[1] ?? 0;
|
|
808
|
+
const proportion = panose[3];
|
|
809
|
+
if (proportion === PANOSE_MONOSPACE_PROPORTION) {
|
|
810
|
+
return "monospace";
|
|
811
|
+
}
|
|
812
|
+
const family = PANOSE_FAMILY_MAP[familyType];
|
|
813
|
+
if (familyType === 2) {
|
|
814
|
+
if (PANOSE_SANS_SERIF_STYLES.has(serifStyle)) {
|
|
815
|
+
return "sans-serif";
|
|
816
|
+
}
|
|
817
|
+
return "serif";
|
|
818
|
+
}
|
|
819
|
+
return family ?? "sans-serif";
|
|
820
|
+
}
|
|
821
|
+
function getPanoseWeight(panose) {
|
|
822
|
+
if (!panose || panose.length < 3) {
|
|
823
|
+
return void 0;
|
|
824
|
+
}
|
|
825
|
+
const weight = panose[2];
|
|
826
|
+
return weight === void 0 ? void 0 : PANOSE_WEIGHT_MAP[weight];
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
// text/font-substitution.ts
|
|
830
|
+
var canonicalSubstitutes = new Map(
|
|
831
|
+
Object.entries(FONT_SUBSTITUTION_MAP).map(([name, fonts]) => [name.toLowerCase(), fonts])
|
|
832
|
+
);
|
|
833
|
+
function lookupFontSubstitutes(name) {
|
|
834
|
+
return canonicalSubstitutes.get(name.trim().toLowerCase());
|
|
835
|
+
}
|
|
836
|
+
var GENERIC_FAMILY_CONCRETE_FONTS = {
|
|
837
|
+
serif: ["Times New Roman", "Georgia", "serif"],
|
|
838
|
+
"sans-serif": ["Arial", "Helvetica", "sans-serif"],
|
|
839
|
+
monospace: ["Courier New", "Consolas", "monospace"],
|
|
840
|
+
cursive: ["Comic Sans MS", "cursive"],
|
|
841
|
+
fantasy: ["Impact", "fantasy"]
|
|
842
|
+
};
|
|
843
|
+
function getSubstituteFontFamily(fontName, panose) {
|
|
844
|
+
const trimmed = fontName.trim();
|
|
845
|
+
if (!trimmed) {
|
|
846
|
+
return "sans-serif";
|
|
847
|
+
}
|
|
848
|
+
return buildFontFamilyString(trimmed, getSubstituteFonts(trimmed, panose));
|
|
849
|
+
}
|
|
850
|
+
function getSubstituteFonts(fontName, panose) {
|
|
851
|
+
const trimmed = fontName.trim();
|
|
852
|
+
if (!trimmed) {
|
|
853
|
+
return ["sans-serif"];
|
|
854
|
+
}
|
|
855
|
+
const baseName = stripFontStyleSuffix(trimmed);
|
|
856
|
+
const basePrefix = baseName ? [baseName] : [];
|
|
857
|
+
const directSubs = lookupFontSubstitutes(trimmed) ?? (baseName ? lookupFontSubstitutes(baseName) : void 0);
|
|
858
|
+
if (directSubs) {
|
|
859
|
+
return [...basePrefix, ...directSubs];
|
|
860
|
+
}
|
|
861
|
+
if (panose && panose.length >= 4) {
|
|
862
|
+
const genericFamily = classifyPanose(panose);
|
|
863
|
+
const concreteFonts = GENERIC_FAMILY_CONCRETE_FONTS[genericFamily];
|
|
864
|
+
if (concreteFonts) {
|
|
865
|
+
return [...basePrefix, ...concreteFonts];
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
return [...basePrefix, "sans-serif"];
|
|
869
|
+
}
|
|
870
|
+
function hasDirectSubstitution(fontName) {
|
|
871
|
+
return lookupFontSubstitutes(fontName) !== void 0;
|
|
872
|
+
}
|
|
873
|
+
var CSS_GENERIC_FAMILIES = /* @__PURE__ */ new Set([
|
|
874
|
+
"serif",
|
|
875
|
+
"sans-serif",
|
|
876
|
+
"monospace",
|
|
877
|
+
"cursive",
|
|
878
|
+
"fantasy",
|
|
879
|
+
"system-ui",
|
|
880
|
+
"ui-serif",
|
|
881
|
+
"ui-sans-serif",
|
|
882
|
+
"ui-monospace",
|
|
883
|
+
"ui-rounded",
|
|
884
|
+
"math",
|
|
885
|
+
"emoji",
|
|
886
|
+
"fangsong"
|
|
887
|
+
]);
|
|
888
|
+
function buildFontFamilyString(primary, fallbacks) {
|
|
889
|
+
const parts = [quoteFontName(primary)];
|
|
890
|
+
for (const fb of fallbacks) {
|
|
891
|
+
const quoted = quoteFontName(fb);
|
|
892
|
+
if (!parts.includes(quoted)) {
|
|
893
|
+
parts.push(quoted);
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
return parts.join(", ");
|
|
897
|
+
}
|
|
898
|
+
function quoteFontName(name) {
|
|
899
|
+
const trimmed = name.trim();
|
|
900
|
+
if (CSS_GENERIC_FAMILIES.has(trimmed.toLowerCase())) {
|
|
901
|
+
return trimmed;
|
|
902
|
+
}
|
|
903
|
+
return `"${trimmed.replace(/["\\\r\n\f]/g, "")}"`;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
// text/metric-font-family.ts
|
|
907
|
+
var METRIC_FONT_SUBSTITUTES = {
|
|
908
|
+
calibri: { fallbacks: ["Carlito"], generic: "sans-serif" },
|
|
909
|
+
"calibri light": { fallbacks: ["Carlito"], generic: "sans-serif" },
|
|
910
|
+
cambria: { fallbacks: ["Caladea"], generic: "serif" },
|
|
911
|
+
arial: { fallbacks: ["Arimo", "Liberation Sans"], generic: "sans-serif" },
|
|
912
|
+
helvetica: { fallbacks: ["Arimo", "Liberation Sans"], generic: "sans-serif" },
|
|
913
|
+
"times new roman": { fallbacks: ["Tinos", "Liberation Serif"], generic: "serif" },
|
|
914
|
+
times: { fallbacks: ["Tinos", "Liberation Serif"], generic: "serif" },
|
|
915
|
+
"courier new": { fallbacks: ["Cousine", "Liberation Mono"], generic: "monospace" },
|
|
916
|
+
courier: { fallbacks: ["Cousine", "Liberation Mono"], generic: "monospace" },
|
|
917
|
+
georgia: { fallbacks: ["Gelasio"], generic: "serif" },
|
|
918
|
+
consolas: { fallbacks: ["Inconsolata"], generic: "monospace" }
|
|
919
|
+
};
|
|
920
|
+
function metricFontFamily(name) {
|
|
921
|
+
const key = name.trim();
|
|
922
|
+
const known = Object.hasOwn(METRIC_FONT_SUBSTITUTES, key.toLowerCase()) ? METRIC_FONT_SUBSTITUTES[key.toLowerCase()] : void 0;
|
|
923
|
+
return buildFontFamilyString(key, [...known?.fallbacks ?? [], known?.generic ?? "sans-serif"]);
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
// text/script-fonts.ts
|
|
927
|
+
function resolveScriptFontSet(run, body, baseFontFamily) {
|
|
928
|
+
const resolve = (name, panose) => name ? getSubstituteFontFamily(name, parsePanoseString(panose)) : baseFontFamily;
|
|
929
|
+
return {
|
|
930
|
+
latin: baseFontFamily,
|
|
931
|
+
eastAsia: resolve(
|
|
932
|
+
run?.eastAsiaFont || body?.eastAsiaFont,
|
|
933
|
+
run?.eastAsiaFontPanose ?? body?.eastAsiaFontPanose
|
|
934
|
+
),
|
|
935
|
+
complexScript: resolve(
|
|
936
|
+
run?.complexScriptFont || body?.complexScriptFont,
|
|
937
|
+
run?.complexScriptFontPanose ?? body?.complexScriptFontPanose
|
|
938
|
+
),
|
|
939
|
+
symbol: resolve(
|
|
940
|
+
run?.symbolFont || body?.symbolFont,
|
|
941
|
+
run?.symbolFontPanose ?? body?.symbolFontPanose
|
|
942
|
+
)
|
|
943
|
+
};
|
|
944
|
+
}
|
|
945
|
+
function segmentByFont(text, fonts) {
|
|
946
|
+
const result = [];
|
|
947
|
+
for (const run of segmentByScript(text)) {
|
|
948
|
+
const fontFamily = resolveFontForScript(run.script, fonts) ?? fonts.latin;
|
|
949
|
+
const previous = result.at(-1);
|
|
950
|
+
if (previous?.fontFamily === fontFamily) previous.text += run.text;
|
|
951
|
+
else result.push({ text: run.text, startIndex: run.startIndex, fontFamily });
|
|
952
|
+
}
|
|
953
|
+
return result;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
exports.FONT_SUBSTITUTION_MAP = FONT_SUBSTITUTION_MAP;
|
|
957
|
+
exports.METRIC_FONT_SUBSTITUTES = METRIC_FONT_SUBSTITUTES;
|
|
958
|
+
exports.PANOSE_FAMILY_MAP = PANOSE_FAMILY_MAP;
|
|
959
|
+
exports.PANOSE_MONOSPACE_PROPORTION = PANOSE_MONOSPACE_PROPORTION;
|
|
960
|
+
exports.PANOSE_SANS_SERIF_STYLES = PANOSE_SANS_SERIF_STYLES;
|
|
961
|
+
exports.PANOSE_WEIGHT_MAP = PANOSE_WEIGHT_MAP;
|
|
514
962
|
exports.TEXT_CASE_MODES = TEXT_CASE_MODES;
|
|
963
|
+
exports.buildFontFamilyString = buildFontFamilyString;
|
|
515
964
|
exports.buildLeaderString = buildLeaderString;
|
|
516
965
|
exports.changeTextCase = changeTextCase;
|
|
517
966
|
exports.changeTextCaseRanges = changeTextCaseRanges;
|
|
967
|
+
exports.classifyPanose = classifyPanose;
|
|
518
968
|
exports.decimalAnchorIndex = decimalAnchorIndex;
|
|
519
969
|
exports.decimalSeparatorForLanguage = decimalSeparatorForLanguage;
|
|
520
970
|
exports.designTextWidthEm = designTextWidthEm;
|
|
@@ -523,12 +973,22 @@ exports.distributeRunsText = distributeRunsText;
|
|
|
523
973
|
exports.formatLocaleNumber = formatLocaleNumber;
|
|
524
974
|
exports.getLeaderCharacter = getLeaderCharacter;
|
|
525
975
|
exports.getLeaderStyles = getLeaderStyles;
|
|
976
|
+
exports.getPanoseWeight = getPanoseWeight;
|
|
977
|
+
exports.getSubstituteFontFamily = getSubstituteFontFamily;
|
|
978
|
+
exports.getSubstituteFonts = getSubstituteFonts;
|
|
526
979
|
exports.hasDesignAdvances = hasDesignAdvances;
|
|
980
|
+
exports.hasDirectSubstitution = hasDirectSubstitution;
|
|
527
981
|
exports.hasDistinctScriptFonts = hasDistinctScriptFonts;
|
|
982
|
+
exports.metricFontFamily = metricFontFamily;
|
|
528
983
|
exports.parseLocaleNumber = parseLocaleNumber;
|
|
984
|
+
exports.parsePanoseBytes = parsePanoseBytes;
|
|
985
|
+
exports.parsePanoseString = parsePanoseString;
|
|
529
986
|
exports.parseTsv = parseTsv;
|
|
530
987
|
exports.realignOrCollapseRuns = realignOrCollapseRuns;
|
|
531
988
|
exports.resolveFontForScript = resolveFontForScript;
|
|
989
|
+
exports.resolveScriptFontSet = resolveScriptFontSet;
|
|
990
|
+
exports.segmentByFont = segmentByFont;
|
|
532
991
|
exports.segmentByScript = segmentByScript;
|
|
992
|
+
exports.stripFontStyleSuffix = stripFontStyleSuffix;
|
|
533
993
|
exports.toTsv = toTsv;
|
|
534
994
|
exports.wrapStyledRuns = wrapStyledRuns;
|
package/dist/text/index.d.ts
CHANGED
|
@@ -8,4 +8,7 @@ export * from './font-metrics/advance-width.js';
|
|
|
8
8
|
export { parseTsv, toTsv } from './tsv.js';
|
|
9
9
|
export * from './locale-number.js';
|
|
10
10
|
export * from './realign-runs.js';
|
|
11
|
+
export * from './font-substitution.js';
|
|
12
|
+
export * from './metric-font-family.js';
|
|
13
|
+
export * from './script-fonts.js';
|
|
11
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/text/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../text/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,OAAO,EACN,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,KAAK,SAAS,GACd,MAAM,4BAA4B,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../text/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,OAAO,EACN,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,KAAK,SAAS,GACd,MAAM,4BAA4B,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC"}
|