UNPKG

sketch-json-parse

Version:

sketch-json解析

15 lines (14 loc) 803 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * 获取字体大小, 文字字体, 字体粗细 */ const getFontWeight_1 = require("./getFontWeight"); exports.default = (fontStyle, size = 1) => { var _a, _b, _c, _d; return ({ fontSize: ((_a = fontStyle.attributes) === null || _a === void 0 ? void 0 : _a.size) * size, fontFamily: (_c = (_b = fontStyle.attributes) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.replace(/PingFang-SC|PingFang SC/, 'PingFangSC'), // 1.PingFang-SCPingFang SC 针对PingFang-SC和PingFang SC在web端不生效的问题,进行修正处理 fontWeight: (0, getFontWeight_1.default)((_d = fontStyle.attributes) === null || _d === void 0 ? void 0 : _d.name) }); };