@overpunch/vf-clamp 2.3.0 → 2.4.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/README.md +10 -9
- package/dist/index.cjs +410 -141
- package/dist/index.d.ts +28 -1
- package/dist/index.js +527 -363
- package/dist/naming.cjs +1 -0
- package/dist/naming.d.ts +149 -0
- package/dist/naming.js +121 -0
- package/package.json +6 -1
package/dist/index.d.ts
CHANGED
|
@@ -120,6 +120,8 @@ export declare interface FontInstancesResult {
|
|
|
120
120
|
instances: FontInstance[];
|
|
121
121
|
/** The font's family name (typographic family, nameID 16, else nameID 1); used to name outputs that set no name */
|
|
122
122
|
family?: string;
|
|
123
|
+
/** STAT names by axis tag and value key (numberKey), e.g. { wdth: { '100': 'Normal' } }; used for default names */
|
|
124
|
+
labels?: Record<string, Record<string, string>>;
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
/**
|
|
@@ -132,6 +134,9 @@ export declare interface FontInstancesResult {
|
|
|
132
134
|
*/
|
|
133
135
|
export declare function getInstances(input: ArrayBuffer | Uint8Array | Buffer): Promise<FontInstancesResult>;
|
|
134
136
|
|
|
137
|
+
/** Stable text key for an axis value, identical to number_key() in Python ('100', '87.5'). */
|
|
138
|
+
export declare function numberKey(value: number): string;
|
|
139
|
+
|
|
135
140
|
/**
|
|
136
141
|
* One output variant to produce from the source variable font.
|
|
137
142
|
* Specify instances, axes, or both — instances set the hull, axes override individual tags.
|
|
@@ -169,7 +174,7 @@ export declare type PinnedAxis = number;
|
|
|
169
174
|
*
|
|
170
175
|
* Selections merge into one output only when their combined range holds no unselected named
|
|
171
176
|
* instance: Regular + Medium + SemiBold + Bold → one output; Regular + Bold alone → two outputs
|
|
172
|
-
* (each pinned to its own instance). Output names come from
|
|
177
|
+
* (each pinned to its own instance). Output names come from rangeName() (one range per axis), optionally prefixed
|
|
173
178
|
* with `family`.
|
|
174
179
|
*
|
|
175
180
|
* @param font - The font's axes and named instances, from getInstances()
|
|
@@ -180,6 +185,28 @@ export declare type PinnedAxis = number;
|
|
|
180
185
|
*/
|
|
181
186
|
export declare function planOutputs(font: FontInstancesResult, selected: string[], family?: string): OutputConfig[];
|
|
182
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Default name for a selection of named instances: one range per axis, in the font's own style words
|
|
190
|
+
* ("SemiCondensed-Normal Thin-Light"). TypeScript twin of range_name() in
|
|
191
|
+
* shared/plugin-views/vfclamp_naming.py; both are checked against shared/naming-cases.json, so change
|
|
192
|
+
* them together.
|
|
193
|
+
*
|
|
194
|
+
* Each word is attributed to the one axis that is constant wherever the word appears and varies across
|
|
195
|
+
* the font. An axis that varies in the selection becomes "low-high"; one that doesn't shows its word
|
|
196
|
+
* once, or nothing when that value has no word. A value with no word takes its STAT label, else a
|
|
197
|
+
* default word, else "<tag><value>". Parts follow the order the font's names use; words shared by every
|
|
198
|
+
* selected name and owned by no axis stay before or after them.
|
|
199
|
+
*
|
|
200
|
+
* @param selected - The selected named instances
|
|
201
|
+
* @param instances - Every named instance of the font
|
|
202
|
+
* @param axes - The font's axes (tag and default)
|
|
203
|
+
* @param labels - STAT names by axis tag and numberKey(value), e.g. { wdth: { '100': 'Normal' } }
|
|
204
|
+
*/
|
|
205
|
+
export declare function rangeName(selected: FontInstance[], instances: FontInstance[], axes: Array<{
|
|
206
|
+
tag: string;
|
|
207
|
+
default: number;
|
|
208
|
+
}>, labels?: Record<string, Record<string, string>>): string;
|
|
209
|
+
|
|
183
210
|
/** @deprecated Use OutputConfig instead */
|
|
184
211
|
export declare type SubfamilyConfig = OutputConfig;
|
|
185
212
|
|