mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2025-01-21 15:02:27 -05:00
30 lines
722 B
TypeScript
30 lines
722 B
TypeScript
|
import { translateTextDecoration, translateTextTransform } from '@plugin/translators';
|
||
|
|
||
|
import { TextStyle } from '@ui/lib/types/text/textContent';
|
||
|
|
||
|
export const transformTextStyle = (
|
||
|
node: Pick<
|
||
|
StyledTextSegment,
|
||
|
| 'characters'
|
||
|
| 'start'
|
||
|
| 'end'
|
||
|
| 'fontName'
|
||
|
| 'fontSize'
|
||
|
| 'fontWeight'
|
||
|
| 'lineHeight'
|
||
|
| 'letterSpacing'
|
||
|
| 'textCase'
|
||
|
| 'textDecoration'
|
||
|
| 'fills'
|
||
|
>
|
||
|
): Partial<TextStyle> => {
|
||
|
return {
|
||
|
fontFamily: node.fontName.family,
|
||
|
fontSize: node.fontSize.toString(),
|
||
|
fontStyle: node.fontName.style,
|
||
|
fontWeight: node.fontWeight.toString(),
|
||
|
textDecoration: translateTextDecoration(node),
|
||
|
textTransform: translateTextTransform(node)
|
||
|
};
|
||
|
};
|