0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-31 12:03:58 -05:00
penpot-exporter-figma-plugin/plugin-src/translators/text/properties/translateLineHeight.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
359 B
TypeScript

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