mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2025-01-18 13:32:28 -05:00
2920ac297b
* wip * implement bullet points * needs more ifs * refactor * revert * refactor * fix and refactor * refactor * refactor * refactor * add ordered class * wip * wip * fixes * package.json * little refactors * base list * fixes * abstract baselist * refactors * refactor * changeset * fix eslint issue * fix * fixes * fixes --------- Co-authored-by: Alex Sánchez <sion333@gmail.com>
24 lines
773 B
TypeScript
24 lines
773 B
TypeScript
import { LocalFont, translateFontVariantId } from '@plugin/translators/text/font/local';
|
|
|
|
import { FontId } from '@ui/lib/types/shapes/textShape';
|
|
|
|
import { items as localFonts } from './localFonts.json';
|
|
|
|
export const translateLocalFont = (fontName: FontName, fontWeight: number): FontId | undefined => {
|
|
const localFont = getLocalFont(fontName);
|
|
|
|
if (localFont === undefined) return;
|
|
|
|
return {
|
|
fontId: localFont.id,
|
|
fontVariantId: translateFontVariantId(localFont, fontName, fontWeight)
|
|
};
|
|
};
|
|
|
|
export const isLocalFont = (fontName: FontName): boolean => {
|
|
return getLocalFont(fontName) !== undefined;
|
|
};
|
|
|
|
const getLocalFont = (fontName: FontName): LocalFont | undefined => {
|
|
return localFonts.find(localFont => localFont.name === fontName.family);
|
|
};
|