mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-23 06:04:01 -05:00
13 lines
346 B
TypeScript
13 lines
346 B
TypeScript
|
export const translateLetterSpacing = (
|
||
|
segment: Pick<StyledTextSegment, 'letterSpacing' | 'fontSize'>
|
||
|
): number => {
|
||
|
switch (segment.letterSpacing.unit) {
|
||
|
case 'PIXELS':
|
||
|
return segment.letterSpacing.value;
|
||
|
case 'PERCENT':
|
||
|
return (segment.fontSize * segment.letterSpacing.value) / 100;
|
||
|
default:
|
||
|
return 0;
|
||
|
}
|
||
|
};
|