mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2025-01-05 06:10:52 -05:00
e2b5b4a7ea
* structure for fills * structure for fills in text and improvements * fixes * improvements
29 lines
722 B
TypeScript
29 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)
|
|
};
|
|
};
|