Skip to content

Commit d2c8d1e

Browse files
authored
🤖 Merge PR DefinitelyTyped#72314 Add missing types to @types/fontkit by @delucis
1 parent 08cdf29 commit d2c8d1e

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

types/fontkit/fontkit-tests.ts

+13
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ openV2.then(font => {
1919
if (!isCollection(font)) {
2020
const { xAvgCharWidth, fsSelection } = font["OS/2"];
2121
const isNegative = fsSelection.negative;
22+
fsSelection.bold; // $ExpectType boolean
23+
}
24+
});
25+
26+
// -----------------------
27+
// API: Font.variationAxes
28+
// -----------------------
29+
openV2.then(font => {
30+
if (!isCollection(font)) {
31+
font.variationAxes.wght?.name; // $ExpectType string | undefined
32+
font.variationAxes.wght?.min; // $ExpectType number | undefined
33+
font.variationAxes.wght?.default; // $ExpectType number | undefined
34+
font.variationAxes.wght?.max; // $ExpectType number | undefined
2235
}
2336
});
2437

types/fontkit/index.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ export interface Font {
4646
/** an array of all OpenType feature tags (or mapped AAT tags) supported by the font */
4747
availableFeatures: string[];
4848

49+
/** An object describing the available axes in a variable font. Keys are 4 letter axis tags. */
50+
variationAxes: Partial<Record<string, { name: string; min: number; default: number; max: number }>>;
51+
4952
/**
5053
* Returns an array of strings that map to the given glyph id.
5154
*/
@@ -314,6 +317,9 @@ export interface Os2Table {
314317
underscore: boolean;
315318
useTypoMetrics: boolean;
316319
wws: boolean;
320+
bold: boolean;
321+
regular: boolean;
322+
oblique: boolean;
317323
};
318324
fsType: {
319325
bitmapOnly: boolean;

0 commit comments

Comments
 (0)