more work
This commit is contained in:
41
src/fonthelper.ts
Normal file
41
src/fonthelper.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import font from "npm:css-font";
|
||||
|
||||
export type FontInfo = {
|
||||
style: "normal" | "italic" | "oblique";
|
||||
variant: "normal" | "small-caps";
|
||||
weight:
|
||||
| "normal"
|
||||
| "bold"
|
||||
| "lighter"
|
||||
| "bolder"
|
||||
| "100"
|
||||
| "200"
|
||||
| "300"
|
||||
| "400"
|
||||
| "500"
|
||||
| "600"
|
||||
| "700"
|
||||
| "800"
|
||||
| "900";
|
||||
stretch:
|
||||
| "normal"
|
||||
| "condensed"
|
||||
| "semi-condensed"
|
||||
| "extra-condensed"
|
||||
| "ultra-condensed"
|
||||
| "expanded"
|
||||
| "semi-expanded"
|
||||
| "extra-expanded"
|
||||
| "ultra-expanded";
|
||||
lineHeight: "normal" | number | string;
|
||||
size: number | string;
|
||||
family: string[];
|
||||
};
|
||||
|
||||
export const parseFont = (fontString: string): FontInfo => {
|
||||
return { ...font.parse(fontString) };
|
||||
};
|
||||
|
||||
export const stringifyFont = (fontInfo: FontInfo): string => {
|
||||
return font.stringify(fontInfo);
|
||||
};
|
Reference in New Issue
Block a user