pa_font 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/USAGE.md +294 -0
- package/dist/paFont.cjs +453 -108
- package/dist/paFont.cjs.map +1 -1
- package/dist/paFont.js +453 -108
- package/dist/paFont.js.map +1 -1
- package/paFont.d.ts +36 -2
- package/package.json +3 -2
package/paFont.d.ts
CHANGED
|
@@ -34,14 +34,41 @@ export interface PointOptions extends ShapeOptions {
|
|
|
34
34
|
includeHoles?: boolean;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
export interface BoxSpacing {
|
|
38
|
+
x?: number;
|
|
39
|
+
y?: number;
|
|
40
|
+
top?: number;
|
|
41
|
+
right?: number;
|
|
42
|
+
bottom?: number;
|
|
43
|
+
left?: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type ParagraphWrap = "word" | "char" | "keep";
|
|
47
|
+
|
|
48
|
+
export type BoxSpacingValue =
|
|
49
|
+
| number
|
|
50
|
+
| string
|
|
51
|
+
| [number]
|
|
52
|
+
| [number, number]
|
|
53
|
+
| [number, number, number]
|
|
54
|
+
| [number, number, number, number]
|
|
55
|
+
| BoxSpacing;
|
|
56
|
+
|
|
37
57
|
export interface ParagraphOptions extends TextOptions {
|
|
38
|
-
|
|
58
|
+
wrap?: ParagraphWrap;
|
|
59
|
+
width?: number;
|
|
60
|
+
height?: number;
|
|
39
61
|
lineHeight?: number;
|
|
40
62
|
align?: "left" | "center" | "right" | "justify";
|
|
41
63
|
whiteSpace?: "normal" | "pre-wrap" | "nowrap";
|
|
42
64
|
overflowWrap?: "normal" | "break-word" | "anywhere";
|
|
65
|
+
wordBreak?: "normal" | "break-all" | "keep-all";
|
|
66
|
+
overflow?: "visible" | "hidden";
|
|
67
|
+
textOverflow?: "clip" | "ellipsis";
|
|
43
68
|
maxLines?: number;
|
|
44
69
|
ellipsis?: string | false;
|
|
70
|
+
margin?: BoxSpacingValue;
|
|
71
|
+
padding?: BoxSpacingValue;
|
|
45
72
|
fontFamily?: string;
|
|
46
73
|
fontWeight?: string | number;
|
|
47
74
|
fontStyle?: "normal" | "italic" | "oblique";
|
|
@@ -98,6 +125,10 @@ export interface ParagraphMetrics {
|
|
|
98
125
|
height: number;
|
|
99
126
|
lineCount: number;
|
|
100
127
|
bbox: Rect;
|
|
128
|
+
contentBox?: Rect;
|
|
129
|
+
paddingBox?: Rect;
|
|
130
|
+
marginBox?: Rect;
|
|
131
|
+
clipBox?: Rect;
|
|
101
132
|
}
|
|
102
133
|
|
|
103
134
|
export interface ParagraphShapeOptions extends ShapeOptions {
|
|
@@ -138,6 +169,7 @@ export class paParagraph {
|
|
|
138
169
|
lines: ParagraphLine[];
|
|
139
170
|
metrics: ParagraphMetrics;
|
|
140
171
|
options: ParagraphOptions;
|
|
172
|
+
layoutEngine: "pretext" | "native";
|
|
141
173
|
|
|
142
174
|
relayout(next?: Partial<ParagraphOptions>): paParagraph;
|
|
143
175
|
line(index: number): ParagraphLine | undefined;
|
|
@@ -152,6 +184,8 @@ export class paFont {
|
|
|
152
184
|
|
|
153
185
|
font: unknown;
|
|
154
186
|
unitsPerEm: number;
|
|
187
|
+
family: string;
|
|
188
|
+
canvasFamily: string;
|
|
155
189
|
|
|
156
190
|
static load(
|
|
157
191
|
source: string | URL | ArrayBuffer | ArrayBufferView,
|
|
@@ -161,7 +195,7 @@ export class paFont {
|
|
|
161
195
|
text(value: string, options?: TextOptions): PAShape;
|
|
162
196
|
glyph(value: string, options?: TextOptions): PAShape;
|
|
163
197
|
metrics(value: string, options?: TextOptions): Metrics;
|
|
164
|
-
paragraph(value: string, options
|
|
198
|
+
paragraph(value: string, options?: ParagraphOptions): paParagraph;
|
|
165
199
|
}
|
|
166
200
|
|
|
167
201
|
export default paFont;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pa_font",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Generate polygon and point geometry from OpenType fonts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"font",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"dist",
|
|
28
28
|
"paFont.d.ts",
|
|
29
|
-
"README.md"
|
|
29
|
+
"README.md",
|
|
30
|
+
"USAGE.md"
|
|
30
31
|
],
|
|
31
32
|
"publishConfig": {
|
|
32
33
|
"access": "public"
|