postext 1.47.0 → 1.48.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/__tests__/bundle/designOverflowPin.test.js +1 -1
- package/dist/__tests__/bundle/gridBreakRulesPin.test.js +2 -2
- package/dist/__tests__/bundle/shapingLanguagePin.test.js +3 -3
- package/dist/__tests__/bundle/taskBoxPin.test.js +1 -1
- package/dist/__tests__/bundle.test.js +1 -1
- package/dist/__tests__/codeBlocks.test.js +1 -1
- package/dist/__tests__/composed/cardShapes.test.d.ts +2 -0
- package/dist/__tests__/composed/cardShapes.test.d.ts.map +1 -0
- package/dist/__tests__/composed/cardShapes.test.js +82 -0
- package/dist/__tests__/composed/cardShapes.test.js.map +1 -0
- package/dist/__tests__/composed/connectors.test.d.ts +2 -0
- package/dist/__tests__/composed/connectors.test.d.ts.map +1 -0
- package/dist/__tests__/composed/connectors.test.js +349 -0
- package/dist/__tests__/composed/connectors.test.js.map +1 -0
- package/dist/__tests__/composed/decorationSidePoints.test.d.ts +2 -0
- package/dist/__tests__/composed/decorationSidePoints.test.d.ts.map +1 -0
- package/dist/__tests__/composed/decorationSidePoints.test.js +164 -0
- package/dist/__tests__/composed/decorationSidePoints.test.js.map +1 -0
- package/dist/__tests__/composed/fit.test.js +2 -1
- package/dist/__tests__/composed/fit.test.js.map +1 -1
- package/dist/__tests__/composed/fixtures/connectors.d.ts +33 -0
- package/dist/__tests__/composed/fixtures/connectors.d.ts.map +1 -0
- package/dist/__tests__/composed/fixtures/connectors.js +142 -0
- package/dist/__tests__/composed/fixtures/connectors.js.map +1 -0
- package/dist/__tests__/composed/fixtures/grid.d.ts +32 -0
- package/dist/__tests__/composed/fixtures/grid.d.ts.map +1 -0
- package/dist/__tests__/composed/fixtures/grid.js +53 -0
- package/dist/__tests__/composed/fixtures/grid.js.map +1 -0
- package/dist/__tests__/composed/fixtures/legendMap.d.ts +24 -0
- package/dist/__tests__/composed/fixtures/legendMap.d.ts.map +1 -0
- package/dist/__tests__/composed/fixtures/legendMap.js +117 -0
- package/dist/__tests__/composed/fixtures/legendMap.js.map +1 -0
- package/dist/__tests__/composed/fixtures/mapParts.d.ts +58 -0
- package/dist/__tests__/composed/fixtures/mapParts.d.ts.map +1 -0
- package/dist/__tests__/composed/fixtures/mapParts.js +192 -0
- package/dist/__tests__/composed/fixtures/mapParts.js.map +1 -0
- package/dist/__tests__/composed/fixtures/modules.d.ts +55 -0
- package/dist/__tests__/composed/fixtures/modules.d.ts.map +1 -0
- package/dist/__tests__/composed/fixtures/modules.js +123 -0
- package/dist/__tests__/composed/fixtures/modules.js.map +1 -0
- package/dist/__tests__/composed/grid.test.d.ts +2 -0
- package/dist/__tests__/composed/grid.test.d.ts.map +1 -0
- package/dist/__tests__/composed/grid.test.js +357 -0
- package/dist/__tests__/composed/grid.test.js.map +1 -0
- package/dist/__tests__/composed/groups.test.js +6 -3
- package/dist/__tests__/composed/groups.test.js.map +1 -1
- package/dist/__tests__/composed/labelLegend.test.d.ts +2 -0
- package/dist/__tests__/composed/labelLegend.test.d.ts.map +1 -0
- package/dist/__tests__/composed/labelLegend.test.js +268 -0
- package/dist/__tests__/composed/labelLegend.test.js.map +1 -0
- package/dist/__tests__/composed/labelsChecks.test.js.map +1 -1
- package/dist/__tests__/composed/leaders.test.d.ts +2 -0
- package/dist/__tests__/composed/leaders.test.d.ts.map +1 -0
- package/dist/__tests__/composed/leaders.test.js +372 -0
- package/dist/__tests__/composed/leaders.test.js.map +1 -0
- package/dist/__tests__/composed/modules.test.d.ts +2 -0
- package/dist/__tests__/composed/modules.test.d.ts.map +1 -0
- package/dist/__tests__/composed/modules.test.js +352 -0
- package/dist/__tests__/composed/modules.test.js.map +1 -0
- package/dist/__tests__/composed/overConnectors.test.d.ts +2 -0
- package/dist/__tests__/composed/overConnectors.test.d.ts.map +1 -0
- package/dist/__tests__/composed/overConnectors.test.js +232 -0
- package/dist/__tests__/composed/overConnectors.test.js.map +1 -0
- package/dist/__tests__/composed/overlap.test.d.ts +2 -0
- package/dist/__tests__/composed/overlap.test.d.ts.map +1 -0
- package/dist/__tests__/composed/overlap.test.js +339 -0
- package/dist/__tests__/composed/overlap.test.js.map +1 -0
- package/dist/__tests__/composedTemplates.test.js +1 -1
- package/dist/__tests__/design/boxShape.test.d.ts +2 -0
- package/dist/__tests__/design/boxShape.test.d.ts.map +1 -0
- package/dist/__tests__/design/boxShape.test.js +126 -0
- package/dist/__tests__/design/boxShape.test.js.map +1 -0
- package/dist/__tests__/design/boxShapePaint.test.d.ts +2 -0
- package/dist/__tests__/design/boxShapePaint.test.d.ts.map +1 -0
- package/dist/__tests__/design/boxShapePaint.test.js +130 -0
- package/dist/__tests__/design/boxShapePaint.test.js.map +1 -0
- package/dist/__tests__/design/openerBottomAnchor.test.js.map +1 -1
- package/dist/__tests__/design/pathBlock.test.d.ts +2 -0
- package/dist/__tests__/design/pathBlock.test.d.ts.map +1 -0
- package/dist/__tests__/design/pathBlock.test.js +194 -0
- package/dist/__tests__/design/pathBlock.test.js.map +1 -0
- package/dist/__tests__/design/pathElement.test.d.ts +2 -0
- package/dist/__tests__/design/pathElement.test.d.ts.map +1 -0
- package/dist/__tests__/design/pathElement.test.js +257 -0
- package/dist/__tests__/design/pathElement.test.js.map +1 -0
- package/dist/__tests__/design/svgPath.test.d.ts +2 -0
- package/dist/__tests__/design/svgPath.test.d.ts.map +1 -0
- package/dist/__tests__/design/svgPath.test.js +144 -0
- package/dist/__tests__/design/svgPath.test.js.map +1 -0
- package/dist/__tests__/exports.test.js +52 -0
- package/dist/__tests__/exports.test.js.map +1 -1
- package/dist/__tests__/hardBreaks.test.js +1 -1
- package/dist/__tests__/headingInlineMarks.test.js +1 -1
- package/dist/__tests__/labelGlyphPaint.test.d.ts +2 -0
- package/dist/__tests__/labelGlyphPaint.test.d.ts.map +1 -0
- package/dist/__tests__/labelGlyphPaint.test.js +86 -0
- package/dist/__tests__/labelGlyphPaint.test.js.map +1 -0
- package/dist/__tests__/mathSizeMigration.test.js +2 -2
- package/dist/__tests__/migrate/labelsOnPictures.test.js +1 -1
- package/dist/__tests__/migrate/labelsOnPictures.test.js.map +1 -1
- package/dist/__tests__/parse/containers.test.js +1 -1
- package/dist/__tests__/parse/containers.test.js.map +1 -1
- package/dist/__tests__/pipeline/calloutInlineResourceGap.test.js +1 -1
- package/dist/__tests__/pipeline/calloutLabelGlyph.test.d.ts +2 -0
- package/dist/__tests__/pipeline/calloutLabelGlyph.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/calloutLabelGlyph.test.js +198 -0
- package/dist/__tests__/pipeline/calloutLabelGlyph.test.js.map +1 -0
- package/dist/__tests__/pipeline/calloutShapes.test.d.ts +2 -0
- package/dist/__tests__/pipeline/calloutShapes.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/calloutShapes.test.js +159 -0
- package/dist/__tests__/pipeline/calloutShapes.test.js.map +1 -0
- package/dist/__tests__/pipeline/calloutSplitMinLinesChild.test.js +1 -1
- package/dist/__tests__/pipeline/colonListRoom.test.js +1 -1
- package/dist/__tests__/pipeline/compoundBreaks.test.js +1 -1
- package/dist/__tests__/pipeline/dashBreaks.test.js +1 -1
- package/dist/__tests__/pipeline/headingSplitOrphans.test.js +1 -1
- package/dist/__tests__/pipeline/inlineFigureSpace.test.js +1 -1
- package/dist/__tests__/pipeline/paragraphContainerTail.test.js +1 -1
- package/dist/__tests__/pipeline/raggedOptimal.test.js +1 -1
- package/dist/__tests__/verseLines.test.js +1 -1
- package/dist/bundle/configVersion.d.ts +12 -3
- package/dist/bundle/configVersion.d.ts.map +1 -1
- package/dist/bundle/configVersion.js +16 -5
- package/dist/bundle/configVersion.js.map +1 -1
- package/dist/canvas-backend/blockRender.js +3 -3
- package/dist/canvas-backend/blockRender.js.map +1 -1
- package/dist/canvas-backend/composed.d.ts +4 -2
- package/dist/canvas-backend/composed.d.ts.map +1 -1
- package/dist/canvas-backend/composed.js +12 -7
- package/dist/canvas-backend/composed.js.map +1 -1
- package/dist/canvas-backend/headerFooter.d.ts +17 -1
- package/dist/canvas-backend/headerFooter.d.ts.map +1 -1
- package/dist/canvas-backend/headerFooter.js +64 -1
- package/dist/canvas-backend/headerFooter.js.map +1 -1
- package/dist/canvas-backend/index.d.ts.map +1 -1
- package/dist/canvas-backend/index.js +7 -1
- package/dist/canvas-backend/index.js.map +1 -1
- package/dist/canvas-backend/renderResourceBlock.d.ts.map +1 -1
- package/dist/canvas-backend/renderResourceBlock.js +17 -6
- package/dist/canvas-backend/renderResourceBlock.js.map +1 -1
- package/dist/canvas-backend/swatch.d.ts +20 -1
- package/dist/canvas-backend/swatch.d.ts.map +1 -1
- package/dist/canvas-backend/swatch.js +51 -1
- package/dist/canvas-backend/swatch.js.map +1 -1
- package/dist/comics/layoutPage.d.ts.map +1 -1
- package/dist/comics/layoutPage.js +6 -1
- package/dist/comics/layoutPage.js.map +1 -1
- package/dist/composed/continuation.d.ts +10 -2
- package/dist/composed/continuation.d.ts.map +1 -1
- package/dist/composed/continuation.js +10 -2
- package/dist/composed/continuation.js.map +1 -1
- package/dist/composed/document.d.ts +45 -1
- package/dist/composed/document.d.ts.map +1 -1
- package/dist/composed/document.js +76 -17
- package/dist/composed/document.js.map +1 -1
- package/dist/composed/labelText.d.ts +6 -2
- package/dist/composed/labelText.d.ts.map +1 -1
- package/dist/composed/labelText.js +19 -3
- package/dist/composed/labelText.js.map +1 -1
- package/dist/composed/labels.d.ts +57 -3
- package/dist/composed/labels.d.ts.map +1 -1
- package/dist/composed/labels.js +261 -12
- package/dist/composed/labels.js.map +1 -1
- package/dist/composed/modules.d.ts +30 -0
- package/dist/composed/modules.d.ts.map +1 -0
- package/dist/composed/modules.js +194 -0
- package/dist/composed/modules.js.map +1 -0
- package/dist/composed/overlap.d.ts +52 -0
- package/dist/composed/overlap.d.ts.map +1 -0
- package/dist/composed/overlap.js +611 -0
- package/dist/composed/overlap.js.map +1 -0
- package/dist/composed/paint.d.ts +28 -5
- package/dist/composed/paint.d.ts.map +1 -1
- package/dist/composed/paint.js +26 -5
- package/dist/composed/paint.js.map +1 -1
- package/dist/composed/reflowLog.d.ts +6 -1
- package/dist/composed/reflowLog.d.ts.map +1 -1
- package/dist/composed/reflowLog.js +43 -0
- package/dist/composed/reflowLog.js.map +1 -1
- package/dist/composed/repeat.d.ts +66 -0
- package/dist/composed/repeat.d.ts.map +1 -0
- package/dist/composed/repeat.js +217 -0
- package/dist/composed/repeat.js.map +1 -0
- package/dist/composed/slotChecks.d.ts +1 -1
- package/dist/composed/slotChecks.d.ts.map +1 -1
- package/dist/composed/slotChecks.js +114 -8
- package/dist/composed/slotChecks.js.map +1 -1
- package/dist/composed/sourceMap.d.ts.map +1 -1
- package/dist/composed/sourceMap.js +16 -4
- package/dist/composed/sourceMap.js.map +1 -1
- package/dist/composed/spread.d.ts.map +1 -1
- package/dist/composed/spread.js +6 -2
- package/dist/composed/spread.js.map +1 -1
- package/dist/composed/templates.d.ts +22 -2
- package/dist/composed/templates.d.ts.map +1 -1
- package/dist/composed/templates.js +159 -9
- package/dist/composed/templates.js.map +1 -1
- package/dist/composed/types.d.ts +140 -7
- package/dist/composed/types.d.ts.map +1 -1
- package/dist/composed/validate.d.ts +1 -1
- package/dist/composed/validate.d.ts.map +1 -1
- package/dist/composed/validate.js +101 -4
- package/dist/composed/validate.js.map +1 -1
- package/dist/composed/wrap.d.ts.map +1 -1
- package/dist/composed/wrap.js +95 -17
- package/dist/composed/wrap.js.map +1 -1
- package/dist/configWarnings.d.ts +7 -1
- package/dist/configWarnings.d.ts.map +1 -1
- package/dist/configWarnings.js +275 -4
- package/dist/configWarnings.js.map +1 -1
- package/dist/contrast.d.ts.map +1 -1
- package/dist/contrast.js +8 -0
- package/dist/contrast.js.map +1 -1
- package/dist/defaults/calloutStyles.d.ts +10 -1
- package/dist/defaults/calloutStyles.d.ts.map +1 -1
- package/dist/defaults/calloutStyles.js +46 -7
- package/dist/defaults/calloutStyles.js.map +1 -1
- package/dist/defaults/headerFooter.d.ts.map +1 -1
- package/dist/defaults/headerFooter.js +38 -0
- package/dist/defaults/headerFooter.js.map +1 -1
- package/dist/design/boxShape.d.ts +101 -0
- package/dist/design/boxShape.d.ts.map +1 -0
- package/dist/design/boxShape.js +398 -0
- package/dist/design/boxShape.js.map +1 -0
- package/dist/design/connector.d.ts +75 -0
- package/dist/design/connector.d.ts.map +1 -0
- package/dist/design/connector.js +325 -0
- package/dist/design/connector.js.map +1 -0
- package/dist/design/layout.d.ts +56 -3
- package/dist/design/layout.d.ts.map +1 -1
- package/dist/design/layout.js +214 -12
- package/dist/design/layout.js.map +1 -1
- package/dist/design/logicalEdges.d.ts +7 -0
- package/dist/design/logicalEdges.d.ts.map +1 -1
- package/dist/design/logicalEdges.js +28 -0
- package/dist/design/logicalEdges.js.map +1 -1
- package/dist/design/pathBlock.d.ts +69 -0
- package/dist/design/pathBlock.d.ts.map +1 -0
- package/dist/design/pathBlock.js +286 -0
- package/dist/design/pathBlock.js.map +1 -0
- package/dist/design/svgPath.d.ts +48 -0
- package/dist/design/svgPath.d.ts.map +1 -0
- package/dist/design/svgPath.js +402 -0
- package/dist/design/svgPath.js.map +1 -0
- package/dist/fonts/usage.d.ts +5 -0
- package/dist/fonts/usage.d.ts.map +1 -1
- package/dist/fonts/usage.js +36 -3
- package/dist/fonts/usage.js.map +1 -1
- package/dist/html-backend.d.ts.map +1 -1
- package/dist/html-backend.js +127 -22
- package/dist/html-backend.js.map +1 -1
- package/dist/index.d.ts +19 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/dist/measure/cache.js +1 -1
- package/dist/measure/cache.js.map +1 -1
- package/dist/measure/inlineIcon.d.ts +34 -0
- package/dist/measure/inlineIcon.d.ts.map +1 -0
- package/dist/measure/inlineIcon.js +89 -0
- package/dist/measure/inlineIcon.js.map +1 -0
- package/dist/measure/rich.d.ts +2 -1
- package/dist/measure/rich.d.ts.map +1 -1
- package/dist/measure/rich.js +6 -0
- package/dist/measure/rich.js.map +1 -1
- package/dist/migrate/pageDesign.d.ts.map +1 -1
- package/dist/migrate/pageDesign.js +4 -2
- package/dist/migrate/pageDesign.js.map +1 -1
- package/dist/migrate/textToMarkdown.js +2 -0
- package/dist/migrate/textToMarkdown.js.map +1 -1
- package/dist/parse/blockParser.d.ts.map +1 -1
- package/dist/parse/blockParser.js +171 -20
- package/dist/parse/blockParser.js.map +1 -1
- package/dist/parse/index.d.ts +1 -1
- package/dist/parse/index.d.ts.map +1 -1
- package/dist/parse/index.js.map +1 -1
- package/dist/parse/inlineFormatting.d.ts +11 -3
- package/dist/parse/inlineFormatting.d.ts.map +1 -1
- package/dist/parse/inlineFormatting.js +63 -5
- package/dist/parse/inlineFormatting.js.map +1 -1
- package/dist/parse/inlineSnippet.d.ts +2 -1
- package/dist/parse/inlineSnippet.d.ts.map +1 -1
- package/dist/parse/inlineSnippet.js +3 -2
- package/dist/parse/inlineSnippet.js.map +1 -1
- package/dist/parse/sourceMapping.d.ts.map +1 -1
- package/dist/parse/sourceMapping.js +8 -1
- package/dist/parse/sourceMapping.js.map +1 -1
- package/dist/parse/types.d.ts +71 -1
- package/dist/parse/types.d.ts.map +1 -1
- package/dist/pipeline/build.d.ts.map +1 -1
- package/dist/pipeline/build.js +23 -11
- package/dist/pipeline/build.js.map +1 -1
- package/dist/pipeline/buildMeasurement.d.ts.map +1 -1
- package/dist/pipeline/buildMeasurement.js +23 -11
- package/dist/pipeline/buildMeasurement.js.map +1 -1
- package/dist/pipeline/calloutLayout.d.ts.map +1 -1
- package/dist/pipeline/calloutLayout.js +142 -32
- package/dist/pipeline/calloutLayout.js.map +1 -1
- package/dist/pipeline/composedLayout.d.ts +1 -33
- package/dist/pipeline/composedLayout.d.ts.map +1 -1
- package/dist/pipeline/composedLayout.js +526 -36
- package/dist/pipeline/composedLayout.js.map +1 -1
- package/dist/pipeline/contentWarnings.d.ts.map +1 -1
- package/dist/pipeline/contentWarnings.js +46 -1
- package/dist/pipeline/contentWarnings.js.map +1 -1
- package/dist/pipeline/continuation.d.ts.map +1 -1
- package/dist/pipeline/continuation.js +3 -2
- package/dist/pipeline/continuation.js.map +1 -1
- package/dist/pipeline/headerFooter.d.ts +19 -1
- package/dist/pipeline/headerFooter.d.ts.map +1 -1
- package/dist/pipeline/headerFooter.js +145 -5
- package/dist/pipeline/headerFooter.js.map +1 -1
- package/dist/pipeline/partPalette.d.ts.map +1 -1
- package/dist/pipeline/partPalette.js +40 -1
- package/dist/pipeline/partPalette.js.map +1 -1
- package/dist/pipeline/resourceLayout.d.ts +1 -1
- package/dist/pipeline/resourceLayout.d.ts.map +1 -1
- package/dist/pipeline/resourceLayout.js +44 -15
- package/dist/pipeline/resourceLayout.js.map +1 -1
- package/dist/preflight.d.ts.map +1 -1
- package/dist/preflight.js +36 -1
- package/dist/preflight.js.map +1 -1
- package/dist/types.d.ts +305 -22
- package/dist/types.d.ts.map +1 -1
- package/dist/vdt.d.ts +384 -11
- package/dist/vdt.d.ts.map +1 -1
- package/dist/vdt.js.map +1 -1
- package/package.json +1 -1
- package/dist/composed/round2Types.d.ts +0 -185
- package/dist/composed/round2Types.d.ts.map +0 -1
- package/dist/composed/round2Types.js +0 -2
- package/dist/composed/round2Types.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labelText.js","sourceRoot":"","sources":["../../src/composed/labelText.ts"],"names":[],"mappings":"AASA;;wEAEwE;AACxE,MAAM,UAAU,cAAc,CAAC,IAAY;
|
|
1
|
+
{"version":3,"file":"labelText.js","sourceRoot":"","sources":["../../src/composed/labelText.ts"],"names":[],"mappings":"AASA;;wEAEwE;AACxE,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,KAA+B;IAC1E,OAAO,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC7F,CAAC;AAED;;gBAEgB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OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtF,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACzD,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACzC,CAAC"}
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import type { InlineSpan } from '../parse/types';
|
|
22
22
|
import type { FigureLabel } from '../parse/types';
|
|
23
|
-
import type { Resource, ResourceAnchor, ResourceType } from '../types';
|
|
24
|
-
import type { BoundingBox, ContentWarning, ResolvedConfig, ResolvedResourceBlock, VDTBlock, VDTDocument, VDTFigureLabel, VDTFigureLabelLayout, VDTLine } from '../vdt';
|
|
23
|
+
import type { LeaderStyle, Resource, ResourceAnchor, ResourceType } from '../types';
|
|
24
|
+
import type { BoundingBox, ContentWarning, ResolvedConfig, ResolvedResourceBlock, VDTBlock, VDTDesignBoxStyle, VDTDesignPathBlock, VDTDocument, VDTFigureLabel, VDTFigureLabelLayout, VDTPage, VDTLine } from '../vdt';
|
|
25
25
|
import type { MeasurementCache } from '../measure';
|
|
26
26
|
import type { ResourceNumberingMap } from '../pipeline/resourceNumbering';
|
|
27
27
|
/** `[a, b, c, d, e, f]`, canvas `transform` order (y down). */
|
|
@@ -48,6 +48,19 @@ export interface LabelLook {
|
|
|
48
48
|
minScale: number;
|
|
49
49
|
/** Set in vertical writing (the label style's; an anchor's wins). */
|
|
50
50
|
vertical?: boolean;
|
|
51
|
+
/** How the lines line up inside the box (#1058); absent: as the anchor
|
|
52
|
+
* places the box. */
|
|
53
|
+
align?: 'start' | 'center' | 'end';
|
|
54
|
+
/** The plate's outline and corners (#1058). */
|
|
55
|
+
border?: {
|
|
56
|
+
color: string;
|
|
57
|
+
widthPx: number;
|
|
58
|
+
};
|
|
59
|
+
radiusPx?: number;
|
|
60
|
+
/** A map's key (#1058): rows of symbol and text. */
|
|
61
|
+
legend?: boolean;
|
|
62
|
+
/** The style's leader look (#1057), as written. */
|
|
63
|
+
leader?: LeaderStyle;
|
|
51
64
|
}
|
|
52
65
|
/**
|
|
53
66
|
* The look of a label set in style `styleId` (the label's own `style`,
|
|
@@ -81,6 +94,14 @@ export interface FigureLabelContext {
|
|
|
81
94
|
resources?: Resource[];
|
|
82
95
|
cache?: MeasurementCache;
|
|
83
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* The rows of a legend (#1058) with the symbol that opens each row hung in
|
|
99
|
+
* one column: every such symbol's segment widened to the widest of them,
|
|
100
|
+
* the symbol centred in it, so the words after them start at one edge. A
|
|
101
|
+
* row with no symbol first is left as it is. The segments are copies: the
|
|
102
|
+
* measured lines may be shared with a cache.
|
|
103
|
+
*/
|
|
104
|
+
export declare function hangLegendSymbols(lines: readonly VDTLine[]): VDTLine[];
|
|
84
105
|
/**
|
|
85
106
|
* Lay out one label: its lines in its look, wrapped within `widthPx` (none:
|
|
86
107
|
* one line per forced break), set smaller (down to `minScale`) while a
|
|
@@ -104,10 +125,39 @@ export declare function layOutLabel(spans: readonly InlineSpan[], look: LabelLoo
|
|
|
104
125
|
* anchor is unknown is left without a layout.
|
|
105
126
|
*/
|
|
106
127
|
export declare function layOutFigureLabels(labels: readonly VDTFigureLabel[], parsed: readonly Pick<FigureLabel, 'spans'>[] | undefined, rb: ResolvedResourceBlock, ctx: FigureLabelContext): VDTFigureLabel[];
|
|
128
|
+
/**
|
|
129
|
+
* The leader of a drawn label (#1057) as a path in the block's frame, the
|
|
130
|
+
* body's top-left corner at (`bodyX`, `bodyY`), or undefined when it has
|
|
131
|
+
* none or its point lies under the label's box. The line leaves the box
|
|
132
|
+
* (its plate, else its lines' box, `gapPx` out) from the middle of the
|
|
133
|
+
* side facing the point (the side with the wider clear gap to it), in the
|
|
134
|
+
* label's own frame, so it never runs over the label's words, a turned
|
|
135
|
+
* label's included; an elbow leaves that side square and turns once onto
|
|
136
|
+
* the point.
|
|
137
|
+
*/
|
|
138
|
+
export declare function figureLabelLeaderPath(layout: VDTFigureLabelLayout, bodyX: number, bodyY: number): VDTDesignPathBlock | undefined;
|
|
139
|
+
/** The leaders of a figure's drawn labels (#1057) in the block's frame,
|
|
140
|
+
* the body's corner at (`bodyX`, `bodyY`), in the labels' order. */
|
|
141
|
+
export declare function figureLabelLeaderPaths(rb: Pick<ResolvedResourceBlock, 'labels'>, bodyX: number, bodyY: number): VDTDesignPathBlock[];
|
|
142
|
+
/**
|
|
143
|
+
* Where anchor `anchorId` of the picture of `block` (a figure laid on
|
|
144
|
+
* `page`) stands on the page's sheet (#1057), through the picture's crop,
|
|
145
|
+
* safe area and scale as its labels are: undefined when the block is no
|
|
146
|
+
* picture or its resource lacks the anchor. A picture is painted the right
|
|
147
|
+
* way round on a mirrored page and upright on a vertical one, so the point
|
|
148
|
+
* is read on the body's box as the sheet shows it.
|
|
149
|
+
*/
|
|
150
|
+
export declare function figureAnchorPointOnPage(page: Pick<VDTPage, 'flow'>, block: Pick<VDTBlock, 'bbox' | 'resourceBlock'>, anchorId: string): {
|
|
151
|
+
x: number;
|
|
152
|
+
y: number;
|
|
153
|
+
} | undefined;
|
|
107
154
|
/** The matrix that puts a label's frame on the block's frame, the body's
|
|
108
155
|
* top-left corner at (`bodyX`, `bodyY`): `translate(body + point) ·
|
|
109
156
|
* rotate(rotate)`. */
|
|
110
157
|
export declare function figureLabelMatrix(layout: Pick<VDTFigureLabelLayout, 'x' | 'y' | 'rotate'>, bodyX: number, bodyY: number): LabelMatrix;
|
|
158
|
+
/** A label's plate (#1058) as a design box's style, for the painters of
|
|
159
|
+
* boxes: its fill, its outline drawn inside the plate, its corners. */
|
|
160
|
+
export declare function labelPlateBox(plate: NonNullable<VDTFigureLabelLayout['background']>): VDTDesignBoxStyle;
|
|
111
161
|
/** What a label paints in its own frame: its background, else its lines'
|
|
112
162
|
* box. */
|
|
113
163
|
export declare function figureLabelExtent(layout: VDTFigureLabelLayout): BoundingBox;
|
|
@@ -183,8 +233,12 @@ export declare function labelLayoutOnSheet(layout: VDTFigureLabelLayout, bodyWid
|
|
|
183
233
|
/** The labels of a figure that are not drawn as text: what its picture's
|
|
184
234
|
* alternative text still names (`altWithLabels`). */
|
|
185
235
|
export declare function undrawnLabels(labels: readonly VDTFigureLabel[] | undefined): VDTFigureLabel[] | undefined;
|
|
186
|
-
/** A drawn label's words as read, its lines joined by a space
|
|
236
|
+
/** A drawn label's words as read, its lines joined by a space (a legend's
|
|
237
|
+
* rows by a semicolon), each inline symbol read as its alternative text
|
|
238
|
+
* in brackets, or not at all when it has none (#1058). */
|
|
187
239
|
export declare function figureLabelReading(label: VDTFigureLabel): string;
|
|
240
|
+
/** One line of a drawn label as read (see {@link figureLabelReading}). */
|
|
241
|
+
export declare function figureLabelLineReading(line: VDTLine): string;
|
|
188
242
|
type Pt = [number, number];
|
|
189
243
|
/** How far two convex polygons run into each other: the shortest push that
|
|
190
244
|
* frees them (separating axis test), 0 when they do not meet. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/composed/labels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAyB,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAgC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/composed/labels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;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,iBAAiB,CAAC,MAAM,EAAE,SAAS,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CA2BxI;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,EAAE,EACjD,KAAK,EAAE,SAAS,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EACxD,EAAE,EAAE,IAAI,CAAC,qBAAqB,EAAE,UAAU,GAAG,YAAY,CAAC,EAC1D,OAAO,CAAC,EAAE,SAAS,OAAO,EAAE,GAC3B,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAsBvB;AAKD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GAAG,cAAc,EAAE,CA0HrJ"}
|
package/dist/composed/labels.js
CHANGED
|
@@ -25,7 +25,11 @@ import { resolveColorValue } from '../defaults/shared';
|
|
|
25
25
|
import { layoutLabelLines } from '../pipeline/resourceLayout';
|
|
26
26
|
import { uppercasePreservingLength } from '../pipeline/buildBlockKind';
|
|
27
27
|
import { firstStrongDirection } from '../design/bidiText';
|
|
28
|
-
import {
|
|
28
|
+
import { withIconAlts } from './labelText';
|
|
29
|
+
import { BREAK_PLACEHOLDER, SWATCH_PLACEHOLDER } from '../parse/inlineFormatting';
|
|
30
|
+
import { flowRectToPage, flowToPage } from '../vdt';
|
|
31
|
+
import { capEnd, DEFAULT_CAP_SIZE_PER_WIDTH, DEFAULT_CONNECTOR_WIDTH, polylineCommands } from '../design/connector';
|
|
32
|
+
import { pathInkBox } from '../design/pathBlock';
|
|
29
33
|
/** The line pitch of a label, in ems, when no paragraph style lends one. */
|
|
30
34
|
const LABEL_LINE_HEIGHT = 1.15;
|
|
31
35
|
/** Measure of a label with no `width`: as good as unbounded. */
|
|
@@ -61,6 +65,9 @@ export function resolveLabelLook(styleId, resolved) {
|
|
|
61
65
|
? Math.max(0.8, (px(para.lineHeight, dpi, paraPx) ?? paraPx * LABEL_LINE_HEIGHT) / paraPx)
|
|
62
66
|
: LABEL_LINE_HEIGHT;
|
|
63
67
|
const haloWidth = style?.halo ? px(style.halo.width, dpi, fontPx) : undefined;
|
|
68
|
+
const borderWidth = style?.border ? px(style.border.width, dpi, fontPx) : undefined;
|
|
69
|
+
const radius = px(style?.radius, dpi, fontPx);
|
|
70
|
+
const align = style?.align === 'start' || style?.align === 'center' || style?.align === 'end' ? style.align : undefined;
|
|
64
71
|
return {
|
|
65
72
|
...(style ? { styleId: style.id } : {}),
|
|
66
73
|
fontFamily: style?.fontFamily ?? para?.fontFamily ?? body.fontFamily,
|
|
@@ -82,6 +89,13 @@ export function resolveLabelLook(styleId, resolved) {
|
|
|
82
89
|
paddingPx: Math.max(0, px(style?.padding, dpi, fontPx) ?? 0),
|
|
83
90
|
minScale: style ? Math.min(1, Math.max(0.1, style.minScale)) : 0.85,
|
|
84
91
|
...(style?.writingMode === 'vertical-rl' ? { vertical: true } : {}),
|
|
92
|
+
...(align ? { align } : {}),
|
|
93
|
+
...(style?.border && borderWidth !== undefined && borderWidth > 0
|
|
94
|
+
? { border: { color: hexOf(style.border.color, resolved, { hex: '#000000', model: 'hex' }), widthPx: borderWidth } }
|
|
95
|
+
: {}),
|
|
96
|
+
...(radius !== undefined && radius > 0 ? { radiusPx: radius } : {}),
|
|
97
|
+
...(style?.kind === 'legend' ? { legend: true } : {}),
|
|
98
|
+
...(style?.leader && typeof style.leader === 'object' ? { leader: style.leader } : {}),
|
|
85
99
|
};
|
|
86
100
|
}
|
|
87
101
|
/** The place of `label` on `resource`; undefined when it names an anchor
|
|
@@ -116,6 +130,43 @@ const moveLine = (line, dx, dy) => ({
|
|
|
116
130
|
baseline: line.baseline + dy,
|
|
117
131
|
...(line.measure ? { measure: { ...line.measure, x: line.measure.x + dx } } : {}),
|
|
118
132
|
});
|
|
133
|
+
/** The segment index of the inline symbol that opens `line` (its first
|
|
134
|
+
* segment that is not a space), or -1. */
|
|
135
|
+
function openingSymbol(line) {
|
|
136
|
+
const segs = line.segments;
|
|
137
|
+
if (!segs)
|
|
138
|
+
return -1;
|
|
139
|
+
const i = segs.findIndex((s) => s.kind !== 'space');
|
|
140
|
+
return i >= 0 && segs[i].kind === 'swatch' && segs[i].swatch?.icon ? i : -1;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The rows of a legend (#1058) with the symbol that opens each row hung in
|
|
144
|
+
* one column: every such symbol's segment widened to the widest of them,
|
|
145
|
+
* the symbol centred in it, so the words after them start at one edge. A
|
|
146
|
+
* row with no symbol first is left as it is. The segments are copies: the
|
|
147
|
+
* measured lines may be shared with a cache.
|
|
148
|
+
*/
|
|
149
|
+
export function hangLegendSymbols(lines) {
|
|
150
|
+
const at = lines.map(openingSymbol);
|
|
151
|
+
let column = 0;
|
|
152
|
+
lines.forEach((line, k) => {
|
|
153
|
+
if (at[k] >= 0)
|
|
154
|
+
column = Math.max(column, line.segments[at[k]].width);
|
|
155
|
+
});
|
|
156
|
+
return lines.map((line, k) => {
|
|
157
|
+
const i = at[k];
|
|
158
|
+
if (i < 0)
|
|
159
|
+
return line;
|
|
160
|
+
const seg = line.segments[i];
|
|
161
|
+
const extra = column - seg.width;
|
|
162
|
+
if (extra <= 1e-9)
|
|
163
|
+
return line;
|
|
164
|
+
const icon = seg.swatch.icon;
|
|
165
|
+
const segments = line.segments.slice();
|
|
166
|
+
segments[i] = { ...seg, width: column, swatch: { ...seg.swatch, icon: { ...icon, insetPx: (icon.insetPx ?? 0) + extra / 2 } } };
|
|
167
|
+
return { ...line, segments, bbox: { ...line.bbox, width: line.bbox.width + extra } };
|
|
168
|
+
});
|
|
169
|
+
}
|
|
119
170
|
/** A label's spans with each `\\` that ends a word made a forced line
|
|
120
171
|
* break, as in a caption: two characters for two (the break and a space
|
|
121
172
|
* the next line drops), so the source map holds. */
|
|
@@ -150,7 +201,9 @@ export function layOutLabel(spans, look, place, ctx) {
|
|
|
150
201
|
const vertical = place.vertical ?? look.vertical ?? false;
|
|
151
202
|
const region = ctx.resolved.cjk.region;
|
|
152
203
|
const inMode = (fn) => (vertical ? withMeasureWritingMode('vertical-rl', fn, region) : fn());
|
|
153
|
-
|
|
204
|
+
// The placeholder of a swatch or an inline symbol (#1058) that opens a
|
|
205
|
+
// row is no letter: the words after it say the direction.
|
|
206
|
+
const rtl = !vertical && firstStrongDirection(plain.replaceAll(SWATCH_PLACEHOLDER, '')) === 'rtl';
|
|
154
207
|
const widthPx = place.widthPx !== undefined && place.widthPx > 0 ? place.widthPx : undefined;
|
|
155
208
|
const fontsAt = (sizePx) => {
|
|
156
209
|
const w = look.weight === 400 ? 'normal' : String(look.weight);
|
|
@@ -205,23 +258,31 @@ export function layOutLabel(spans, look, place, ctx) {
|
|
|
205
258
|
}
|
|
206
259
|
if (set.lines.length === 0)
|
|
207
260
|
return undefined;
|
|
208
|
-
|
|
261
|
+
// A legend (#1058): the symbol that opens each row hangs in a column as
|
|
262
|
+
// wide as the widest.
|
|
263
|
+
const setLines = look.legend && !vertical ? hangLegendSymbols(set.lines) : set.lines;
|
|
264
|
+
const boxW = setLines === set.lines ? set.widest : setLines.reduce((m, l) => Math.max(m, l.bbox.width), 0);
|
|
209
265
|
const pitch = set.sizePx * look.lineHeight;
|
|
210
|
-
const boxH = Math.max(pitch *
|
|
266
|
+
const boxH = Math.max(pitch * setLines.length, setLines.reduce((m, l) => Math.max(m, l.bbox.y + l.bbox.height), 0));
|
|
211
267
|
const align = place.align ?? 'center';
|
|
212
268
|
// `start` is the label's own start: its left edge, its right edge right
|
|
213
269
|
// to left.
|
|
214
|
-
const
|
|
270
|
+
const sideOf = (a) => (a === 'center' ? 'center' : (a === 'start') !== rtl ? 'left' : 'right');
|
|
271
|
+
const side = sideOf(align);
|
|
272
|
+
// The lines inside the box: the style's `align` (#1058), a legend's rows
|
|
273
|
+
// at their start, else as the box stands at its point.
|
|
274
|
+
const lineSide = look.align ? sideOf(look.align) : look.legend ? sideOf('start') : side;
|
|
215
275
|
const left = side === 'center' ? -boxW / 2 : side === 'left' ? 0 : -boxW;
|
|
216
276
|
const vAlign = place.verticalAlign ?? 'middle';
|
|
217
277
|
const top = vAlign === 'top' ? 0 : vAlign === 'bottom' ? -boxH : -boxH / 2;
|
|
218
|
-
const lines =
|
|
278
|
+
const lines = setLines.map((line) => {
|
|
219
279
|
const slack = Math.max(0, boxW - line.bbox.width);
|
|
220
|
-
const dx =
|
|
280
|
+
const dx = lineSide === 'center' ? slack / 2 : lineSide === 'left' ? 0 : slack;
|
|
221
281
|
return moveLine(line, left + dx - line.bbox.x, top);
|
|
222
282
|
});
|
|
223
283
|
const box = { x: left, y: top, width: boxW, height: boxH };
|
|
224
284
|
const pad = look.paddingPx;
|
|
285
|
+
const plateRect = { x: left - pad, y: top - pad, width: boxW + 2 * pad, height: boxH + 2 * pad };
|
|
225
286
|
// A vertical label's frame is the flow frame of a vertical page: turned
|
|
226
287
|
// a quarter turn clockwise on the picture, and further by `rotate`.
|
|
227
288
|
const turn = (place.rotate !== undefined && Number.isFinite(place.rotate) ? place.rotate : 0) + (vertical ? 90 : 0);
|
|
@@ -239,7 +300,17 @@ export function layOutLabel(spans, look, place, ctx) {
|
|
|
239
300
|
boldItalicFontString: set.fonts[3],
|
|
240
301
|
color: look.color,
|
|
241
302
|
...(look.halo ? { halo: { color: look.halo.color, widthPx: look.halo.widthPx * scale } } : {}),
|
|
242
|
-
...(look.background
|
|
303
|
+
...(look.background || look.border
|
|
304
|
+
? {
|
|
305
|
+
background: {
|
|
306
|
+
...(look.background ? { color: look.background } : {}),
|
|
307
|
+
rect: plateRect,
|
|
308
|
+
...(look.border ? { border: look.border } : {}),
|
|
309
|
+
...(look.radiusPx !== undefined ? { radiusPx: look.radiusPx } : {}),
|
|
310
|
+
},
|
|
311
|
+
}
|
|
312
|
+
: {}),
|
|
313
|
+
...(look.legend && !vertical ? { legend: true } : {}),
|
|
243
314
|
...(scale < 1 - 1e-6 ? { scale } : {}),
|
|
244
315
|
...(set.cut ? { overflow: true } : {}),
|
|
245
316
|
...(look.styleId !== undefined ? { styleId: look.styleId } : {}),
|
|
@@ -288,7 +359,10 @@ export function layOutFigureLabels(labels, parsed, rb, ctx) {
|
|
|
288
359
|
if (!place)
|
|
289
360
|
return label;
|
|
290
361
|
const anchor = place.anchor;
|
|
291
|
-
|
|
362
|
+
// Set away from its point (#1057): the box stands at `labelAt`, the
|
|
363
|
+
// point stays where a leader ends.
|
|
364
|
+
const away = anchor ? validLabelAt(anchor.labelAt) : undefined;
|
|
365
|
+
const at = pictureToBody(rb, away?.x ?? place.x, away?.y ?? place.y);
|
|
292
366
|
const look = resolveLabelLook(label.style ?? anchor?.style, ctx.resolved);
|
|
293
367
|
const spans = parsed?.[i]?.spans ?? [{ text: label.text, bold: false, italic: false }];
|
|
294
368
|
// The anchor's writing mode wins over the style's; a vertical label's
|
|
@@ -303,9 +377,159 @@ export function layOutFigureLabels(labels, parsed, rb, ctx) {
|
|
|
303
377
|
...(anchor?.verticalAlign ? { verticalAlign: anchor.verticalAlign } : {}),
|
|
304
378
|
...(anchor?.rotate !== undefined ? { rotate: anchor.rotate } : {}),
|
|
305
379
|
}, ctx);
|
|
306
|
-
|
|
380
|
+
if (!layout)
|
|
381
|
+
return label;
|
|
382
|
+
const leader = anchor ? labelLeader(label, anchor, away !== undefined, look, layout, pictureToBody(rb, place.x, place.y), ctx.resolved) : undefined;
|
|
383
|
+
return { ...label, layout: leader ? { ...layout, leader } : layout };
|
|
307
384
|
});
|
|
308
385
|
}
|
|
386
|
+
/** `labelAt` when it is a point of the picture (two finite numbers). */
|
|
387
|
+
function validLabelAt(v) {
|
|
388
|
+
if (!v || typeof v !== 'object')
|
|
389
|
+
return undefined;
|
|
390
|
+
const { x, y } = v;
|
|
391
|
+
return typeof x === 'number' && typeof y === 'number' && Number.isFinite(x) && Number.isFinite(y) ? { x, y } : undefined;
|
|
392
|
+
}
|
|
393
|
+
const capOrNone = (v, fallback) => {
|
|
394
|
+
const c = v === 'dot' || v === 'arrow' || v === 'none' ? v : fallback;
|
|
395
|
+
return c === 'none' ? undefined : c;
|
|
396
|
+
};
|
|
397
|
+
/** The share of the label's type size left between its words and its
|
|
398
|
+
* leader, when it has no plate. */
|
|
399
|
+
const LEADER_GAP_EM = 0.25;
|
|
400
|
+
/**
|
|
401
|
+
* The leader of a label set at `anchor` (#1057), or undefined when it has
|
|
402
|
+
* none: the label's own `leader` attribute, else the anchor's `leader`,
|
|
403
|
+
* else a label set away from its point whose style has a leader look. The
|
|
404
|
+
* look is the style's `leader` under the anchor's (an object), field by
|
|
405
|
+
* field; the colour defaults to the label's text colour, the end at the
|
|
406
|
+
* point to a dot.
|
|
407
|
+
*/
|
|
408
|
+
function labelLeader(label, anchor, away, look, layout, point, resolved) {
|
|
409
|
+
const own = anchor.leader;
|
|
410
|
+
const on = label.leader ?? (own === false ? false : own !== undefined && own !== null ? true : away && look.leader !== undefined);
|
|
411
|
+
if (!on)
|
|
412
|
+
return undefined;
|
|
413
|
+
const style = { ...(look.leader ?? {}), ...(own && typeof own === 'object' ? own : {}) };
|
|
414
|
+
const dpi = resolved.page.dpi;
|
|
415
|
+
const widthPx = Math.max(0, px(style.width, dpi, look.fontPx) ?? dimensionToPx(DEFAULT_CONNECTOR_WIDTH, dpi));
|
|
416
|
+
const capSizePx = Math.max(0, px(style.capSize, dpi, look.fontPx) ?? widthPx * DEFAULT_CAP_SIZE_PER_WIDTH);
|
|
417
|
+
const dash = Array.isArray(style.dash) ? style.dash.map((d) => px(d, dpi, look.fontPx)).filter((v) => v !== undefined && v >= 0) : [];
|
|
418
|
+
const color = style.color ? hexOf(style.color, resolved, { hex: look.color, model: 'hex' }) : look.color;
|
|
419
|
+
const startCap = capOrNone(style.startCap, 'none');
|
|
420
|
+
const endCap = capOrNone(style.endCap, 'dot');
|
|
421
|
+
return {
|
|
422
|
+
x: point.x,
|
|
423
|
+
y: point.y,
|
|
424
|
+
routing: style.routing === 'elbow' ? 'elbow' : 'straight',
|
|
425
|
+
stroke: { color, widthPx, ...(dash.length > 0 && dash.some((v) => v > 0) ? { dash } : {}) },
|
|
426
|
+
...(startCap ? { startCap } : {}),
|
|
427
|
+
...(endCap ? { endCap } : {}),
|
|
428
|
+
capSizePx,
|
|
429
|
+
gapPx: layout.background ? 0 : look.fontPx * (layout.scale ?? 1) * LEADER_GAP_EM,
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* The leader of a drawn label (#1057) as a path in the block's frame, the
|
|
434
|
+
* body's top-left corner at (`bodyX`, `bodyY`), or undefined when it has
|
|
435
|
+
* none or its point lies under the label's box. The line leaves the box
|
|
436
|
+
* (its plate, else its lines' box, `gapPx` out) from the middle of the
|
|
437
|
+
* side facing the point (the side with the wider clear gap to it), in the
|
|
438
|
+
* label's own frame, so it never runs over the label's words, a turned
|
|
439
|
+
* label's included; an elbow leaves that side square and turns once onto
|
|
440
|
+
* the point.
|
|
441
|
+
*/
|
|
442
|
+
export function figureLabelLeaderPath(layout, bodyX, bodyY) {
|
|
443
|
+
const leader = layout.leader;
|
|
444
|
+
if (!leader)
|
|
445
|
+
return undefined;
|
|
446
|
+
const m = figureLabelMatrix(layout, bodyX, bodyY);
|
|
447
|
+
const q = pointInLabel(layout, bodyX, bodyY, bodyX + leader.x, bodyY + leader.y);
|
|
448
|
+
const e = figureLabelExtent(layout);
|
|
449
|
+
const g = leader.gapPx;
|
|
450
|
+
const r = { x: e.x - g, y: e.y - g, width: e.width + 2 * g, height: e.height + 2 * g };
|
|
451
|
+
const down = q.y - (r.y + r.height);
|
|
452
|
+
const up = r.y - q.y;
|
|
453
|
+
const right = q.x - (r.x + r.width);
|
|
454
|
+
const left = r.x - q.x;
|
|
455
|
+
const v = Math.max(down, up);
|
|
456
|
+
const h = Math.max(right, left);
|
|
457
|
+
if (v <= 0 && h <= 0)
|
|
458
|
+
return undefined;
|
|
459
|
+
let start;
|
|
460
|
+
let bend;
|
|
461
|
+
if (v >= h) {
|
|
462
|
+
start = { x: r.x + r.width / 2, y: down >= up ? r.y + r.height : r.y };
|
|
463
|
+
bend = { x: start.x, y: q.y };
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
start = { x: right >= left ? r.x + r.width : r.x, y: r.y + r.height / 2 };
|
|
467
|
+
bend = { x: q.x, y: start.y };
|
|
468
|
+
}
|
|
469
|
+
const own = leader.routing === 'elbow' ? [start, bend, { x: q.x, y: q.y }] : [start, { x: q.x, y: q.y }];
|
|
470
|
+
const pts = own.map((p) => ({ x: m[0] * p.x + m[2] * p.y + m[4], y: m[1] * p.x + m[3] * p.y + m[5] }));
|
|
471
|
+
const length = pts.slice(1).reduce((sum, p, i) => sum + Math.hypot(p.x - pts[i].x, p.y - pts[i].y), 0);
|
|
472
|
+
if (length < Math.max(1, leader.capSizePx))
|
|
473
|
+
return undefined;
|
|
474
|
+
const marks = [];
|
|
475
|
+
if (leader.startCap)
|
|
476
|
+
capEnd(pts, 0, leader.startCap, leader.capSizePx, leader.stroke.color, marks);
|
|
477
|
+
if (leader.endCap)
|
|
478
|
+
capEnd(pts, 1, leader.endCap, leader.capSizePx, leader.stroke.color, marks);
|
|
479
|
+
const subpaths = [polylineCommands(pts, 0)].filter((sp) => sp.length > 0);
|
|
480
|
+
const stroke = leader.stroke;
|
|
481
|
+
return {
|
|
482
|
+
kind: 'path',
|
|
483
|
+
bbox: pathInkBox({ subpaths, stroke, markers: marks }),
|
|
484
|
+
subpaths,
|
|
485
|
+
stroke,
|
|
486
|
+
...(marks.length > 0 ? { markers: marks } : {}),
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
/** The leaders of a figure's drawn labels (#1057) in the block's frame,
|
|
490
|
+
* the body's corner at (`bodyX`, `bodyY`), in the labels' order. */
|
|
491
|
+
export function figureLabelLeaderPaths(rb, bodyX, bodyY) {
|
|
492
|
+
const out = [];
|
|
493
|
+
for (const label of rb.labels ?? []) {
|
|
494
|
+
const path = label.layout ? figureLabelLeaderPath(label.layout, bodyX, bodyY) : undefined;
|
|
495
|
+
if (path)
|
|
496
|
+
out.push(path);
|
|
497
|
+
}
|
|
498
|
+
return out;
|
|
499
|
+
}
|
|
500
|
+
/** A leader's point reflected about the body's vertical axis, as the rest
|
|
501
|
+
* of a label's geometry is on a mirrored page. */
|
|
502
|
+
const flipLeader = (leader, bodyWidth) => leader ? { leader: { ...leader, x: bodyWidth - leader.x } } : {};
|
|
503
|
+
/**
|
|
504
|
+
* Where anchor `anchorId` of the picture of `block` (a figure laid on
|
|
505
|
+
* `page`) stands on the page's sheet (#1057), through the picture's crop,
|
|
506
|
+
* safe area and scale as its labels are: undefined when the block is no
|
|
507
|
+
* picture or its resource lacks the anchor. A picture is painted the right
|
|
508
|
+
* way round on a mirrored page and upright on a vertical one, so the point
|
|
509
|
+
* is read on the body's box as the sheet shows it.
|
|
510
|
+
*/
|
|
511
|
+
export function figureAnchorPointOnPage(page, block, anchorId) {
|
|
512
|
+
const rb = block.resourceBlock;
|
|
513
|
+
if (!rb || (rb.kind !== 'bitmap' && rb.kind !== 'svg'))
|
|
514
|
+
return undefined;
|
|
515
|
+
const anchor = rb.resource.anchors?.find((a) => a.id === anchorId);
|
|
516
|
+
if (!anchor || !Number.isFinite(anchor.x) || !Number.isFinite(anchor.y))
|
|
517
|
+
return undefined;
|
|
518
|
+
if (!(rb.bodyRect.width > 0) || !(rb.bodyRect.height > 0))
|
|
519
|
+
return undefined;
|
|
520
|
+
const p = pictureToBody(rb, anchor.x, anchor.y);
|
|
521
|
+
if (rb.rotation) {
|
|
522
|
+
// A quarter-turned block: its body's frame turned onto the block's,
|
|
523
|
+
// which stands in the flow.
|
|
524
|
+
const { bx, by, turn } = bodyFrame(block);
|
|
525
|
+
const [x, y] = turn ? apply(turn, bx + p.x, by + p.y) : [bx + p.x, by + p.y];
|
|
526
|
+
return flowToPage(page, x, y);
|
|
527
|
+
}
|
|
528
|
+
// A picture is painted the right way round on a mirrored page, upright
|
|
529
|
+
// on a vertical one: the point is read on the body's box on the sheet.
|
|
530
|
+
const body = flowRectToPage(page, { x: block.bbox.x + rb.bodyRect.x, y: block.bbox.y + rb.bodyRect.y, width: rb.bodyRect.width, height: rb.bodyRect.height });
|
|
531
|
+
return { x: body.x + (p.x / rb.bodyRect.width) * body.width, y: body.y + (p.y / rb.bodyRect.height) * body.height };
|
|
532
|
+
}
|
|
309
533
|
// ---------------------------------------------------------------------------
|
|
310
534
|
// Painting and hit-testing
|
|
311
535
|
// ---------------------------------------------------------------------------
|
|
@@ -321,6 +545,16 @@ export function figureLabelMatrix(layout, bodyX, bodyY) {
|
|
|
321
545
|
const s = Math.abs(sin) < 1e-12 ? 0 : sin;
|
|
322
546
|
return [c, s, -s, c, bodyX + layout.x, bodyY + layout.y];
|
|
323
547
|
}
|
|
548
|
+
/** A label's plate (#1058) as a design box's style, for the painters of
|
|
549
|
+
* boxes: its fill, its outline drawn inside the plate, its corners. */
|
|
550
|
+
export function labelPlateBox(plate) {
|
|
551
|
+
return {
|
|
552
|
+
...(plate.color ? { backgroundColor: plate.color } : {}),
|
|
553
|
+
...(plate.border ? { borderColor: plate.border.color } : {}),
|
|
554
|
+
borderWidthPx: plate.border?.widthPx ?? 0,
|
|
555
|
+
borderRadiusPx: plate.radiusPx ?? 0,
|
|
556
|
+
};
|
|
557
|
+
}
|
|
324
558
|
/** What a label paints in its own frame: its background, else its lines'
|
|
325
559
|
* box. */
|
|
326
560
|
export function figureLabelExtent(layout) {
|
|
@@ -531,6 +765,7 @@ export function mirrorLabelLayout(layout, bodyWidth, orient) {
|
|
|
531
765
|
box: flipBox(layout.box),
|
|
532
766
|
...(layout.background ? { background: { ...layout.background, rect: flipBox(layout.background.rect) } } : {}),
|
|
533
767
|
...(layout.vertical ? { mirrored: true } : {}),
|
|
768
|
+
...flipLeader(layout.leader, bodyWidth),
|
|
534
769
|
};
|
|
535
770
|
mirrored.add(out);
|
|
536
771
|
return out;
|
|
@@ -560,6 +795,7 @@ export function unmirrorLabelLayout(layout, bodyWidth) {
|
|
|
560
795
|
})),
|
|
561
796
|
box: flipBox(layout.box),
|
|
562
797
|
...(layout.background ? { background: { ...layout.background, rect: flipBox(layout.background.rect) } } : {}),
|
|
798
|
+
...flipLeader(layout.leader, bodyWidth),
|
|
563
799
|
};
|
|
564
800
|
}
|
|
565
801
|
/** The run order of a line of `n` segments turned the other way: the
|
|
@@ -607,6 +843,7 @@ export function labelLayoutOnSheet(layout, bodyWidth) {
|
|
|
607
843
|
}),
|
|
608
844
|
box: flipBox(layout.box),
|
|
609
845
|
...(layout.background ? { background: { ...layout.background, rect: flipBox(layout.background.rect) } } : {}),
|
|
846
|
+
...flipLeader(layout.leader, bodyWidth),
|
|
610
847
|
};
|
|
611
848
|
}
|
|
612
849
|
// ---------------------------------------------------------------------------
|
|
@@ -620,10 +857,22 @@ export function undrawnLabels(labels) {
|
|
|
620
857
|
const out = labels.filter((l) => !l.layout);
|
|
621
858
|
return out.length > 0 ? out : undefined;
|
|
622
859
|
}
|
|
623
|
-
/** A drawn label's words as read, its lines joined by a space
|
|
860
|
+
/** A drawn label's words as read, its lines joined by a space (a legend's
|
|
861
|
+
* rows by a semicolon), each inline symbol read as its alternative text
|
|
862
|
+
* in brackets, or not at all when it has none (#1058). */
|
|
624
863
|
export function figureLabelReading(label) {
|
|
625
864
|
const lines = label.layout?.lines;
|
|
626
|
-
|
|
865
|
+
if (!lines || lines.length === 0)
|
|
866
|
+
return withIconAlts(label.text, label.icons).replace(/[]/g, '').replace(/\s+/g, ' ').trim();
|
|
867
|
+
const rows = lines.map((l) => figureLabelLineReading(l)).filter(Boolean);
|
|
868
|
+
return rows.join(label.layout?.legend ? '; ' : ' ');
|
|
869
|
+
}
|
|
870
|
+
/** One line of a drawn label as read (see {@link figureLabelReading}). */
|
|
871
|
+
export function figureLabelLineReading(line) {
|
|
872
|
+
const segs = line.segments;
|
|
873
|
+
const text = segs?.some((s) => s.swatch?.icon)
|
|
874
|
+
? segs.map((s) => (s.swatch?.icon ? (s.swatch.icon.alt ? `[${s.swatch.icon.alt}]` : '') : s.text)).join('')
|
|
875
|
+
: line.text;
|
|
627
876
|
return text.replace(/[]/g, '').replace(/\s+/g, ' ').trim();
|
|
628
877
|
}
|
|
629
878
|
/** The share of a line box, at its top and at its foot, that holds no ink. */
|