0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2025-01-06 23:00:55 -05:00
penpot-exporter-figma-plugin/plugin-src/translators/text/properties/translateFontWeight.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

39 lines
881 B
TypeScript

export const translateFontWeight = (fontName: FontName): string => {
switch (fontName.style) {
case 'Thin':
case 'Thin Italic':
return '100';
case 'Extra Light':
case 'ExtraLight':
case 'Extra Light Italic':
case 'ExtraLight Italic':
return '200';
case 'Light':
case 'Light Italic':
return '300';
case 'Regular':
case 'Italic':
return '400';
case 'Medium':
case 'Medium Italic':
return '500';
case 'Semi Bold':
case 'SemiBold':
case 'Semi Bold Italic':
case 'SemiBold Italic':
return '600';
case 'Bold':
case 'Bold Italic':
return '700';
case 'ExtraBold':
case 'Extra Bold':
case 'ExtraBold Italic':
case 'Extra Bold Italic':
return '800';
case 'Black':
case 'Black Italic':
return '900';
default:
return '400';
}
};