Commit 862d9720 authored by 张九刚's avatar 张九刚

文本宽度增大

parent 5feb8774
{ {
"name": "psd-parse-web", "name": "psd-parse-web",
"version": "2.0.0", "version": "2.0.1",
"main": "src/index.js", "main": "src/index.js",
"module": "dist/index.es.js", "module": "dist/index.es.js",
"license": "MIT", "license": "MIT",
......
...@@ -103,9 +103,12 @@ async function compilePsdToJson(psdFile, options) { ...@@ -103,9 +103,12 @@ async function compilePsdToJson(psdFile, options) {
const colors = fontInfo.colors(); const colors = fontInfo.colors();
let fsize = computeFontSize(fontInfo) let fsize = computeFontSize(fontInfo)
properties.style.fontSize = parseInt(fsize);//字体取整 properties.style.fontSize = parseInt(fsize);//字体取整
//字体取整情况下有可能导致宽度不够,默认扩大10像素
viewNode.properties.style.width += 10;
let [r, g, b, a] = colors[0]; let [r, g, b, a] = colors[0];
properties.style.color = `rgba(${r}, ${g}, ${b}, ${a / 255})`; properties.style.color = `rgba(${r}, ${g}, ${b}, ${a / 255})`;
viewNode.nodeType = 'Label'; viewNode.nodeType = 'Label';
dealLater = false; dealLater = false;
} else if (solidColor && layer.vectorMask) { } else if (solidColor && layer.vectorMask) {
let paths = layer.vectorMask().paths; let paths = layer.vectorMask().paths;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment