0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 13:43:03 -05:00
penpot-exporter-figma-plugin/plugin-src/translators/text/properties/translateLetterSpacing.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

12 lines
372 B
TypeScript

export const translateLetterSpacing = (
segment: Pick<StyledTextSegment, 'letterSpacing' | 'fontSize'>
): string => {
switch (segment.letterSpacing.unit) {
case 'PIXELS':
return segment.letterSpacing.value.toString();
case 'PERCENT':
return ((segment.fontSize * segment.letterSpacing.value) / 100).toString();
default:
return '0';
}
};