modern-text 2.0.9 → 2.1.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/deformations/index.d.cts +2 -2
- package/dist/deformations/index.d.mts +2 -2
- package/dist/deformations/index.d.ts +2 -2
- package/dist/index.cjs +2 -3
- package/dist/index.d.cts +20 -21
- package/dist/index.d.mts +20 -21
- package/dist/index.d.ts +20 -21
- package/dist/index.js +4 -4
- package/dist/index.mjs +2 -2
- package/dist/shared/{modern-text.CKFvdNej.cjs → modern-text.BBDyCm63.cjs} +505 -494
- package/dist/shared/{modern-text.CwEJ2EZq.d.ts → modern-text.CGZmjNV0.d.ts} +1 -1
- package/dist/shared/{modern-text.DPlppHEM.d.mts → modern-text.DG27jpKj.d.cts} +111 -125
- package/dist/shared/{modern-text.DPlppHEM.d.ts → modern-text.DG27jpKj.d.mts} +111 -125
- package/dist/shared/{modern-text.DPlppHEM.d.cts → modern-text.DG27jpKj.d.ts} +111 -125
- package/dist/shared/{modern-text.BzOupiZm.d.mts → modern-text.DNXfZmiT.d.mts} +1 -1
- package/dist/shared/{modern-text.rc-b3qK8.mjs → modern-text.DNvXuVjw.mjs} +505 -493
- package/dist/shared/{modern-text.Dmjryk8u.d.cts → modern-text.DzBaDwbG.d.cts} +1 -1
- package/dist/web-components/index.cjs +1 -1
- package/dist/web-components/index.d.cts +1 -1
- package/dist/web-components/index.d.mts +1 -1
- package/dist/web-components/index.d.ts +1 -1
- package/dist/web-components/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as DeformationPreset } from '../shared/modern-text.
|
|
1
|
+
import { c as DeformationPreset } from '../shared/modern-text.DzBaDwbG.cjs';
|
|
2
2
|
import 'modern-path2d';
|
|
3
|
-
import '../shared/modern-text.
|
|
3
|
+
import '../shared/modern-text.DG27jpKj.cjs';
|
|
4
4
|
import 'modern-idoc';
|
|
5
5
|
import 'modern-font';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as DeformationPreset } from '../shared/modern-text.
|
|
1
|
+
import { c as DeformationPreset } from '../shared/modern-text.DNXfZmiT.mjs';
|
|
2
2
|
import 'modern-path2d';
|
|
3
|
-
import '../shared/modern-text.
|
|
3
|
+
import '../shared/modern-text.DG27jpKj.mjs';
|
|
4
4
|
import 'modern-idoc';
|
|
5
5
|
import 'modern-font';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as DeformationPreset } from '../shared/modern-text.
|
|
1
|
+
import { c as DeformationPreset } from '../shared/modern-text.CGZmjNV0.js';
|
|
2
2
|
import 'modern-path2d';
|
|
3
|
-
import '../shared/modern-text.
|
|
3
|
+
import '../shared/modern-text.DG27jpKj.js';
|
|
4
4
|
import 'modern-idoc';
|
|
5
5
|
import 'modern-font';
|
|
6
6
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const Text = require('./shared/modern-text.
|
|
3
|
+
const Text = require('./shared/modern-text.BBDyCm63.cjs');
|
|
4
4
|
const deformation = require('./shared/modern-text.DQWdaYoZ.cjs');
|
|
5
5
|
const curves = require('./shared/modern-text.MC5bIC9E.cjs');
|
|
6
6
|
require('modern-font');
|
|
@@ -29,9 +29,8 @@ function renderText(options, load) {
|
|
|
29
29
|
|
|
30
30
|
exports.Canvas2DRenderer = Text.Canvas2DRenderer;
|
|
31
31
|
exports.Character = Text.Character;
|
|
32
|
-
exports.DomMeasurer = Text.DomMeasurer;
|
|
33
|
-
exports.FontMeasurer = Text.FontMeasurer;
|
|
34
32
|
exports.Fragment = Text.Fragment;
|
|
33
|
+
exports.Measurer = Text.Measurer;
|
|
35
34
|
exports.Paragraph = Text.Paragraph;
|
|
36
35
|
exports.Text = Text.Text;
|
|
37
36
|
exports.backgroundPlugin = Text.backgroundPlugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { C as Canvas2DRenderer, D as
|
|
1
|
+
import { c as Plugin, e as TextMeasurer, P as Paragraph, b as MeasurerResult, a as Character, O as Options, M as MeasureResult, R as RenderOptions, T as Text } from './shared/modern-text.DG27jpKj.cjs';
|
|
2
|
+
export { C as Canvas2DRenderer, D as DrawShapePathsOptions, F as Fragment, d as TextEvents, t as textDefaultStyle } from './shared/modern-text.DG27jpKj.cjs';
|
|
3
3
|
import { Fonts } from 'modern-font';
|
|
4
4
|
import { FullStyle, NormalizedStyle, NormalizedHighlight, NormalizedEffect } from 'modern-idoc';
|
|
5
5
|
import { BoundingBox, Vector2, Path2DSet, Transform2D } from 'modern-path2d';
|
|
6
|
-
import { c as DeformationPreset } from './shared/modern-text.
|
|
7
|
-
export { B as BendContext, a as BendPreset, C as CurvePreset, D as DeformationCharInfo, b as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.
|
|
6
|
+
import { c as DeformationPreset } from './shared/modern-text.DzBaDwbG.cjs';
|
|
7
|
+
export { B as BendContext, a as BendPreset, C as CurvePreset, D as DeformationCharInfo, b as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.DzBaDwbG.cjs';
|
|
8
8
|
|
|
9
9
|
declare function definePlugin(options: Plugin): Plugin;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* The pure-JS, DOM-free text measurer (the only built-in backend).
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
16
|
-
* (
|
|
17
|
-
*
|
|
18
|
-
* measure → glyph → plugin pipeline is unchanged and it runs in Node/SSR/Worker.
|
|
14
|
+
* It computes the four-level boxes (`character.inlineBox`/`lineBox`, `fragment.inlineBox`,
|
|
15
|
+
* `paragraph.lineBox`) directly from `modern-font` glyph advances + kerning — no DOM, so it
|
|
16
|
+
* runs in Node/SSR/Worker and measures the *exact* font that is rendered (advances come from
|
|
17
|
+
* the same SFNT the glyph paths do, so layout and rendering are pixel-consistent by construction).
|
|
19
18
|
*
|
|
20
19
|
* ## Scope
|
|
21
20
|
* - `horizontal-tb` (LTR) and `vertical-rl` (columns right-to-left, glyphs top↓)
|
|
@@ -23,37 +22,36 @@ declare function definePlugin(options: Plugin): Plugin;
|
|
|
23
22
|
* - per-line `text-align` (start/left/center/end/right), `text-indent` (first line)
|
|
24
23
|
* - box model: root + paragraph `padding`/`margin` (horizontal), `letter-spacing`,
|
|
25
24
|
* `line-height`; block `vertical-align` (top/middle/bottom) at fixed height
|
|
25
|
+
* - pair kerning (GPOS `kern` feature / legacy `kern` table) folded into break + positioning
|
|
26
26
|
*
|
|
27
27
|
* ## Not yet implemented (TODO)
|
|
28
28
|
* - UAX#14 `word-break: normal` + 避头尾/kinsoku (`line-break`)
|
|
29
29
|
* - BiDi, per-fragment inline `vertical-align`, borders
|
|
30
30
|
* - vertical: per-paragraph margin/padding and block alignment
|
|
31
|
-
* -
|
|
31
|
+
* - ligatures (GSUB) — fine for CJK and most UI Latin
|
|
32
32
|
*
|
|
33
|
-
* Coordinates are relative to the root border-box top-left
|
|
34
|
-
* measurer, whose rects are taken relative to `section.getBoundingClientRect()`).
|
|
33
|
+
* Coordinates are relative to the root border-box top-left.
|
|
35
34
|
*/
|
|
36
|
-
declare class
|
|
37
|
-
measure(paragraphs: Paragraph[], rootStyle: FullStyle, _dom?: HTMLElement, fonts?: Fonts):
|
|
35
|
+
declare class Measurer implements TextMeasurer {
|
|
36
|
+
measure(paragraphs: Paragraph[], rootStyle: FullStyle, _dom?: HTMLElement, fonts?: Fonts): MeasurerResult;
|
|
38
37
|
protected _rootPadding(rootStyle: FullStyle): {
|
|
39
38
|
top: number;
|
|
40
39
|
right: number;
|
|
41
40
|
bottom: number;
|
|
42
41
|
left: number;
|
|
43
42
|
};
|
|
44
|
-
protected _measureHorizontal(paragraphs: Paragraph[], rootStyle: FullStyle):
|
|
43
|
+
protected _measureHorizontal(paragraphs: Paragraph[], rootStyle: FullStyle): MeasurerResult;
|
|
45
44
|
/**
|
|
46
45
|
* Vertical writing-mode (`vertical-rl`): columns stack right-to-left, glyphs
|
|
47
46
|
* flow top→bottom. It is the horizontal layout with the inline and block axes
|
|
48
47
|
* swapped — the inline (down-column) advance is `advanceWidth` (CJK upright = em;
|
|
49
48
|
* Latin is rotated, so its advance ≈ its width), the cross-axis content box is
|
|
50
|
-
* `advanceHeight`, and the column thickness is `fontHeight`. The lineBox
|
|
51
|
-
*
|
|
52
|
-
* stays accurate even though inlineBox carries the content-box rounding residual.
|
|
49
|
+
* `advanceHeight`, and the column thickness is `fontHeight`. The lineBox stays
|
|
50
|
+
* accurate even though inlineBox carries the content-box rounding residual.
|
|
53
51
|
*
|
|
54
52
|
* v1: `vertical-rl` only; no per-paragraph margin/padding or block alignment.
|
|
55
53
|
*/
|
|
56
|
-
protected _measureVertical(paragraphs: Paragraph[], rootStyle: FullStyle):
|
|
54
|
+
protected _measureVertical(paragraphs: Paragraph[], rootStyle: FullStyle): MeasurerResult;
|
|
57
55
|
/** Advance step including CSS letter-spacing (px). */
|
|
58
56
|
protected _advance(character: Character): number;
|
|
59
57
|
/**
|
|
@@ -62,6 +60,7 @@ declare class FontMeasurer implements TextMeasurer {
|
|
|
62
60
|
* plus explicit `\n`/`\r` hard breaks. The newline itself occupies no line box.
|
|
63
61
|
*/
|
|
64
62
|
protected _breakLines(paragraph: Paragraph, avail: number): Character[][];
|
|
63
|
+
protected _applyKerning(paragraphs: Paragraph[]): void;
|
|
65
64
|
protected _unionInto(target: BoundingBox, boxes: BoundingBox[]): void;
|
|
66
65
|
protected _shiftAll(paragraphs: Paragraph[], dy: number): void;
|
|
67
66
|
dispose(): void;
|
|
@@ -240,5 +239,5 @@ declare function parseColormap(colormap: 'none' | Record<string, string>): Recor
|
|
|
240
239
|
declare function isEqualObject(obj1: Record<string, any>, obj2: Record<string, any>): boolean;
|
|
241
240
|
declare function isEqualValue(val1: any, val2: any): boolean;
|
|
242
241
|
|
|
243
|
-
export { Character, CircleCurve, DeformationPreset, EllipseCurve,
|
|
242
|
+
export { Character, CircleCurve, DeformationPreset, EllipseCurve, HeartCurve, MeasureResult, Measurer, MeasurerResult, Options, Paragraph, Plugin, PolygonCurve, RectangularCurve, RenderOptions, Text, TextMeasurer, backgroundPlugin, createSvgLoader, createSvgParser, defineDeformation, definePlugin, deformationPlugin, getDeformationNames, getEffectTransform2D, getHighlightStyle, highlightPlugin, isEqualObject, isEqualValue, listStylePlugin, measureText, outlinePlugin, parseColormap, parseTransformOrigin, parseValueNumber, removeDeformation, renderPlugin, renderText, textDecorationPlugin };
|
|
244
243
|
export type { RenderTextOptions, SvgLoader, SvgParser };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { C as Canvas2DRenderer, D as
|
|
1
|
+
import { c as Plugin, e as TextMeasurer, P as Paragraph, b as MeasurerResult, a as Character, O as Options, M as MeasureResult, R as RenderOptions, T as Text } from './shared/modern-text.DG27jpKj.mjs';
|
|
2
|
+
export { C as Canvas2DRenderer, D as DrawShapePathsOptions, F as Fragment, d as TextEvents, t as textDefaultStyle } from './shared/modern-text.DG27jpKj.mjs';
|
|
3
3
|
import { Fonts } from 'modern-font';
|
|
4
4
|
import { FullStyle, NormalizedStyle, NormalizedHighlight, NormalizedEffect } from 'modern-idoc';
|
|
5
5
|
import { BoundingBox, Vector2, Path2DSet, Transform2D } from 'modern-path2d';
|
|
6
|
-
import { c as DeformationPreset } from './shared/modern-text.
|
|
7
|
-
export { B as BendContext, a as BendPreset, C as CurvePreset, D as DeformationCharInfo, b as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.
|
|
6
|
+
import { c as DeformationPreset } from './shared/modern-text.DNXfZmiT.mjs';
|
|
7
|
+
export { B as BendContext, a as BendPreset, C as CurvePreset, D as DeformationCharInfo, b as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.DNXfZmiT.mjs';
|
|
8
8
|
|
|
9
9
|
declare function definePlugin(options: Plugin): Plugin;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* The pure-JS, DOM-free text measurer (the only built-in backend).
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
16
|
-
* (
|
|
17
|
-
*
|
|
18
|
-
* measure → glyph → plugin pipeline is unchanged and it runs in Node/SSR/Worker.
|
|
14
|
+
* It computes the four-level boxes (`character.inlineBox`/`lineBox`, `fragment.inlineBox`,
|
|
15
|
+
* `paragraph.lineBox`) directly from `modern-font` glyph advances + kerning — no DOM, so it
|
|
16
|
+
* runs in Node/SSR/Worker and measures the *exact* font that is rendered (advances come from
|
|
17
|
+
* the same SFNT the glyph paths do, so layout and rendering are pixel-consistent by construction).
|
|
19
18
|
*
|
|
20
19
|
* ## Scope
|
|
21
20
|
* - `horizontal-tb` (LTR) and `vertical-rl` (columns right-to-left, glyphs top↓)
|
|
@@ -23,37 +22,36 @@ declare function definePlugin(options: Plugin): Plugin;
|
|
|
23
22
|
* - per-line `text-align` (start/left/center/end/right), `text-indent` (first line)
|
|
24
23
|
* - box model: root + paragraph `padding`/`margin` (horizontal), `letter-spacing`,
|
|
25
24
|
* `line-height`; block `vertical-align` (top/middle/bottom) at fixed height
|
|
25
|
+
* - pair kerning (GPOS `kern` feature / legacy `kern` table) folded into break + positioning
|
|
26
26
|
*
|
|
27
27
|
* ## Not yet implemented (TODO)
|
|
28
28
|
* - UAX#14 `word-break: normal` + 避头尾/kinsoku (`line-break`)
|
|
29
29
|
* - BiDi, per-fragment inline `vertical-align`, borders
|
|
30
30
|
* - vertical: per-paragraph margin/padding and block alignment
|
|
31
|
-
* -
|
|
31
|
+
* - ligatures (GSUB) — fine for CJK and most UI Latin
|
|
32
32
|
*
|
|
33
|
-
* Coordinates are relative to the root border-box top-left
|
|
34
|
-
* measurer, whose rects are taken relative to `section.getBoundingClientRect()`).
|
|
33
|
+
* Coordinates are relative to the root border-box top-left.
|
|
35
34
|
*/
|
|
36
|
-
declare class
|
|
37
|
-
measure(paragraphs: Paragraph[], rootStyle: FullStyle, _dom?: HTMLElement, fonts?: Fonts):
|
|
35
|
+
declare class Measurer implements TextMeasurer {
|
|
36
|
+
measure(paragraphs: Paragraph[], rootStyle: FullStyle, _dom?: HTMLElement, fonts?: Fonts): MeasurerResult;
|
|
38
37
|
protected _rootPadding(rootStyle: FullStyle): {
|
|
39
38
|
top: number;
|
|
40
39
|
right: number;
|
|
41
40
|
bottom: number;
|
|
42
41
|
left: number;
|
|
43
42
|
};
|
|
44
|
-
protected _measureHorizontal(paragraphs: Paragraph[], rootStyle: FullStyle):
|
|
43
|
+
protected _measureHorizontal(paragraphs: Paragraph[], rootStyle: FullStyle): MeasurerResult;
|
|
45
44
|
/**
|
|
46
45
|
* Vertical writing-mode (`vertical-rl`): columns stack right-to-left, glyphs
|
|
47
46
|
* flow top→bottom. It is the horizontal layout with the inline and block axes
|
|
48
47
|
* swapped — the inline (down-column) advance is `advanceWidth` (CJK upright = em;
|
|
49
48
|
* Latin is rotated, so its advance ≈ its width), the cross-axis content box is
|
|
50
|
-
* `advanceHeight`, and the column thickness is `fontHeight`. The lineBox
|
|
51
|
-
*
|
|
52
|
-
* stays accurate even though inlineBox carries the content-box rounding residual.
|
|
49
|
+
* `advanceHeight`, and the column thickness is `fontHeight`. The lineBox stays
|
|
50
|
+
* accurate even though inlineBox carries the content-box rounding residual.
|
|
53
51
|
*
|
|
54
52
|
* v1: `vertical-rl` only; no per-paragraph margin/padding or block alignment.
|
|
55
53
|
*/
|
|
56
|
-
protected _measureVertical(paragraphs: Paragraph[], rootStyle: FullStyle):
|
|
54
|
+
protected _measureVertical(paragraphs: Paragraph[], rootStyle: FullStyle): MeasurerResult;
|
|
57
55
|
/** Advance step including CSS letter-spacing (px). */
|
|
58
56
|
protected _advance(character: Character): number;
|
|
59
57
|
/**
|
|
@@ -62,6 +60,7 @@ declare class FontMeasurer implements TextMeasurer {
|
|
|
62
60
|
* plus explicit `\n`/`\r` hard breaks. The newline itself occupies no line box.
|
|
63
61
|
*/
|
|
64
62
|
protected _breakLines(paragraph: Paragraph, avail: number): Character[][];
|
|
63
|
+
protected _applyKerning(paragraphs: Paragraph[]): void;
|
|
65
64
|
protected _unionInto(target: BoundingBox, boxes: BoundingBox[]): void;
|
|
66
65
|
protected _shiftAll(paragraphs: Paragraph[], dy: number): void;
|
|
67
66
|
dispose(): void;
|
|
@@ -240,5 +239,5 @@ declare function parseColormap(colormap: 'none' | Record<string, string>): Recor
|
|
|
240
239
|
declare function isEqualObject(obj1: Record<string, any>, obj2: Record<string, any>): boolean;
|
|
241
240
|
declare function isEqualValue(val1: any, val2: any): boolean;
|
|
242
241
|
|
|
243
|
-
export { Character, CircleCurve, DeformationPreset, EllipseCurve,
|
|
242
|
+
export { Character, CircleCurve, DeformationPreset, EllipseCurve, HeartCurve, MeasureResult, Measurer, MeasurerResult, Options, Paragraph, Plugin, PolygonCurve, RectangularCurve, RenderOptions, Text, TextMeasurer, backgroundPlugin, createSvgLoader, createSvgParser, defineDeformation, definePlugin, deformationPlugin, getDeformationNames, getEffectTransform2D, getHighlightStyle, highlightPlugin, isEqualObject, isEqualValue, listStylePlugin, measureText, outlinePlugin, parseColormap, parseTransformOrigin, parseValueNumber, removeDeformation, renderPlugin, renderText, textDecorationPlugin };
|
|
244
243
|
export type { RenderTextOptions, SvgLoader, SvgParser };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { C as Canvas2DRenderer, D as
|
|
1
|
+
import { c as Plugin, e as TextMeasurer, P as Paragraph, b as MeasurerResult, a as Character, O as Options, M as MeasureResult, R as RenderOptions, T as Text } from './shared/modern-text.DG27jpKj.js';
|
|
2
|
+
export { C as Canvas2DRenderer, D as DrawShapePathsOptions, F as Fragment, d as TextEvents, t as textDefaultStyle } from './shared/modern-text.DG27jpKj.js';
|
|
3
3
|
import { Fonts } from 'modern-font';
|
|
4
4
|
import { FullStyle, NormalizedStyle, NormalizedHighlight, NormalizedEffect } from 'modern-idoc';
|
|
5
5
|
import { BoundingBox, Vector2, Path2DSet, Transform2D } from 'modern-path2d';
|
|
6
|
-
import { c as DeformationPreset } from './shared/modern-text.
|
|
7
|
-
export { B as BendContext, a as BendPreset, C as CurvePreset, D as DeformationCharInfo, b as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.
|
|
6
|
+
import { c as DeformationPreset } from './shared/modern-text.CGZmjNV0.js';
|
|
7
|
+
export { B as BendContext, a as BendPreset, C as CurvePreset, D as DeformationCharInfo, b as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.CGZmjNV0.js';
|
|
8
8
|
|
|
9
9
|
declare function definePlugin(options: Plugin): Plugin;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* The pure-JS, DOM-free text measurer (the only built-in backend).
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
16
|
-
* (
|
|
17
|
-
*
|
|
18
|
-
* measure → glyph → plugin pipeline is unchanged and it runs in Node/SSR/Worker.
|
|
14
|
+
* It computes the four-level boxes (`character.inlineBox`/`lineBox`, `fragment.inlineBox`,
|
|
15
|
+
* `paragraph.lineBox`) directly from `modern-font` glyph advances + kerning — no DOM, so it
|
|
16
|
+
* runs in Node/SSR/Worker and measures the *exact* font that is rendered (advances come from
|
|
17
|
+
* the same SFNT the glyph paths do, so layout and rendering are pixel-consistent by construction).
|
|
19
18
|
*
|
|
20
19
|
* ## Scope
|
|
21
20
|
* - `horizontal-tb` (LTR) and `vertical-rl` (columns right-to-left, glyphs top↓)
|
|
@@ -23,37 +22,36 @@ declare function definePlugin(options: Plugin): Plugin;
|
|
|
23
22
|
* - per-line `text-align` (start/left/center/end/right), `text-indent` (first line)
|
|
24
23
|
* - box model: root + paragraph `padding`/`margin` (horizontal), `letter-spacing`,
|
|
25
24
|
* `line-height`; block `vertical-align` (top/middle/bottom) at fixed height
|
|
25
|
+
* - pair kerning (GPOS `kern` feature / legacy `kern` table) folded into break + positioning
|
|
26
26
|
*
|
|
27
27
|
* ## Not yet implemented (TODO)
|
|
28
28
|
* - UAX#14 `word-break: normal` + 避头尾/kinsoku (`line-break`)
|
|
29
29
|
* - BiDi, per-fragment inline `vertical-align`, borders
|
|
30
30
|
* - vertical: per-paragraph margin/padding and block alignment
|
|
31
|
-
* -
|
|
31
|
+
* - ligatures (GSUB) — fine for CJK and most UI Latin
|
|
32
32
|
*
|
|
33
|
-
* Coordinates are relative to the root border-box top-left
|
|
34
|
-
* measurer, whose rects are taken relative to `section.getBoundingClientRect()`).
|
|
33
|
+
* Coordinates are relative to the root border-box top-left.
|
|
35
34
|
*/
|
|
36
|
-
declare class
|
|
37
|
-
measure(paragraphs: Paragraph[], rootStyle: FullStyle, _dom?: HTMLElement, fonts?: Fonts):
|
|
35
|
+
declare class Measurer implements TextMeasurer {
|
|
36
|
+
measure(paragraphs: Paragraph[], rootStyle: FullStyle, _dom?: HTMLElement, fonts?: Fonts): MeasurerResult;
|
|
38
37
|
protected _rootPadding(rootStyle: FullStyle): {
|
|
39
38
|
top: number;
|
|
40
39
|
right: number;
|
|
41
40
|
bottom: number;
|
|
42
41
|
left: number;
|
|
43
42
|
};
|
|
44
|
-
protected _measureHorizontal(paragraphs: Paragraph[], rootStyle: FullStyle):
|
|
43
|
+
protected _measureHorizontal(paragraphs: Paragraph[], rootStyle: FullStyle): MeasurerResult;
|
|
45
44
|
/**
|
|
46
45
|
* Vertical writing-mode (`vertical-rl`): columns stack right-to-left, glyphs
|
|
47
46
|
* flow top→bottom. It is the horizontal layout with the inline and block axes
|
|
48
47
|
* swapped — the inline (down-column) advance is `advanceWidth` (CJK upright = em;
|
|
49
48
|
* Latin is rotated, so its advance ≈ its width), the cross-axis content box is
|
|
50
|
-
* `advanceHeight`, and the column thickness is `fontHeight`. The lineBox
|
|
51
|
-
*
|
|
52
|
-
* stays accurate even though inlineBox carries the content-box rounding residual.
|
|
49
|
+
* `advanceHeight`, and the column thickness is `fontHeight`. The lineBox stays
|
|
50
|
+
* accurate even though inlineBox carries the content-box rounding residual.
|
|
53
51
|
*
|
|
54
52
|
* v1: `vertical-rl` only; no per-paragraph margin/padding or block alignment.
|
|
55
53
|
*/
|
|
56
|
-
protected _measureVertical(paragraphs: Paragraph[], rootStyle: FullStyle):
|
|
54
|
+
protected _measureVertical(paragraphs: Paragraph[], rootStyle: FullStyle): MeasurerResult;
|
|
57
55
|
/** Advance step including CSS letter-spacing (px). */
|
|
58
56
|
protected _advance(character: Character): number;
|
|
59
57
|
/**
|
|
@@ -62,6 +60,7 @@ declare class FontMeasurer implements TextMeasurer {
|
|
|
62
60
|
* plus explicit `\n`/`\r` hard breaks. The newline itself occupies no line box.
|
|
63
61
|
*/
|
|
64
62
|
protected _breakLines(paragraph: Paragraph, avail: number): Character[][];
|
|
63
|
+
protected _applyKerning(paragraphs: Paragraph[]): void;
|
|
65
64
|
protected _unionInto(target: BoundingBox, boxes: BoundingBox[]): void;
|
|
66
65
|
protected _shiftAll(paragraphs: Paragraph[], dy: number): void;
|
|
67
66
|
dispose(): void;
|
|
@@ -240,5 +239,5 @@ declare function parseColormap(colormap: 'none' | Record<string, string>): Recor
|
|
|
240
239
|
declare function isEqualObject(obj1: Record<string, any>, obj2: Record<string, any>): boolean;
|
|
241
240
|
declare function isEqualValue(val1: any, val2: any): boolean;
|
|
242
241
|
|
|
243
|
-
export { Character, CircleCurve, DeformationPreset, EllipseCurve,
|
|
242
|
+
export { Character, CircleCurve, DeformationPreset, EllipseCurve, HeartCurve, MeasureResult, Measurer, MeasurerResult, Options, Paragraph, Plugin, PolygonCurve, RectangularCurve, RenderOptions, Text, TextMeasurer, backgroundPlugin, createSvgLoader, createSvgParser, defineDeformation, definePlugin, deformationPlugin, getDeformationNames, getEffectTransform2D, getHighlightStyle, highlightPlugin, isEqualObject, isEqualValue, listStylePlugin, measureText, outlinePlugin, parseColormap, parseTransformOrigin, parseValueNumber, removeDeformation, renderPlugin, renderText, textDecorationPlugin };
|
|
244
243
|
export type { RenderTextOptions, SvgLoader, SvgParser };
|