0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2025-01-07 23:50:05 -05:00
penpot-exporter-figma-plugin/plugin-src/translators/text/properties/translateLineHeight.ts

13 lines
359 B
TypeScript
Raw Normal View History

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