0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 21:53:27 -05:00
penpot-exporter-figma-plugin/plugin-src/translators/text/font/translateFontName.ts
Alex Sánchez d3c144e5e9
Text libraries (#185)
* color library

* fixes

* wip

* wip

* wip

* wip

* working

* improvements

* changeset

* changeset

* changeset & cleaning

* changeset & cleaning

* improvements

* fixes

* rebase
2024-06-25 16:08:59 +02:00

19 lines
640 B
TypeScript

import { translateFontWeight } from '@plugin/translators/text/properties';
import { TextTypography } from '@ui/lib/types/shapes/textShape';
import { translateCustomFont } from './custom';
import { translateGoogleFont } from './gfonts';
import { translateLocalFont } from './local';
export const translateFontName = (
fontName: FontName
): Pick<TextTypography, 'fontId' | 'fontVariantId' | 'fontWeight'> | undefined => {
const fontWeight = translateFontWeight(fontName);
return (
translateGoogleFont(fontName, fontWeight) ??
translateLocalFont(fontName, fontWeight) ??
translateCustomFont(fontName, fontWeight)
);
};