diff --git a/index.js b/index.js index 94d6662..2c2daad 100644 --- a/index.js +++ b/index.js @@ -1,15 +1,16 @@ -// const calcWidth = require('./libs/calc-text-width.js').Verdana12 +const calcWidth = require('./libs/calc-text-width.js').Arial12 module.exports = function ({subject, status, color = '4C1'}) { - // const sbl = calcWidth(subject) - subject.length - // const stl = calcWidth(status) - status.length - const charWidth = 7.3 + // const charWidth = 7.3 + const calcFactor = 0.4 - const sbTextWidth = subject.length * charWidth + const sbTextWidth = calcWidth(subject) + subject.length * calcFactor + // const sbTextWidth = subject.length * charWidth const sbRectWidth = sbTextWidth + 10 const sbTextCenter = sbRectWidth / 2 - const stTextWidth = status.length * charWidth + const stTextWidth = calcWidth(status) + status.length * calcFactor + // const stTextWidth = status.length * charWidth const stRectWidth = stTextWidth + 12 const stTextCenter = sbRectWidth + stRectWidth / 2 - 1 @@ -26,11 +27,11 @@ module.exports = function ({subject, status, color = '4C1'}) { - - + + ${subject} ${subject} - + ${status} ${status}