0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2025-02-13 02:28:27 -05:00
penpot-exporter-figma-plugin/plugin-src/translators/text/font/translateFontName.ts

20 lines
640 B
TypeScript
Raw Normal View History

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)
);
};