UNPKG

sketch-json-parse

Version:

sketch-json解析

29 lines (28 loc) 950 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const const_1 = require("../../common/const"); /** * 处理段落 */ exports.default = (paragraphStyle, fontStyle, size = 1) => { var _a; const textStyle = {}; if (paragraphStyle) { switch (paragraphStyle.alignment) { case 2: textStyle.textAlign = 'center'; break; case 1: textStyle.textAlign = 'right'; break; case 0: textStyle.textAlign = 'left'; break; case 3: //两边对齐 textStyle.textAlign = 'justify'; break; } textStyle.lineHeight = paragraphStyle.maximumLineHeight ? paragraphStyle.maximumLineHeight : const_1.fontSizeLineHeightMap[((_a = fontStyle.attributes) === null || _a === void 0 ? void 0 : _a.size) * size]; } return textStyle; };