0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 13:43:03 -05:00
penpot-exporter-figma-plugin/plugin-src/translators/styles/translateTextStyle.ts
Jordi Sala Morales b0670b875e
more fixes (#196)
2024-06-28 08:45:02 +02:00

32 lines
1.1 KiB
TypeScript

import { translateFontName } from '@plugin/translators/text/font';
import {
translateFontStyle,
translateLetterSpacing,
translateLineHeight,
translateTextDecoration,
translateTextTransform
} from '@plugin/translators/text/properties';
import { TypographyStyle } from '@ui/lib/types/shapes/textShape';
import { translateStyleName, translateStylePath } from '.';
export const translateTextStyle = (figmaStyle: TextStyle): TypographyStyle => {
return {
name: translateStyleName(figmaStyle),
textStyle: {
...translateFontName(figmaStyle.fontName),
fontFamily: figmaStyle.fontName.family,
fontSize: figmaStyle.fontSize.toString(),
fontStyle: translateFontStyle(figmaStyle.fontName.style),
textDecoration: translateTextDecoration(figmaStyle),
letterSpacing: translateLetterSpacing(figmaStyle),
textTransform: translateTextTransform(figmaStyle),
lineHeight: translateLineHeight(figmaStyle)
},
typography: {
path: translateStylePath(figmaStyle),
name: translateStyleName(figmaStyle)
}
};
};