kopia lustrzana https://github.com/badgen/badgen
chore: slightly increase width for unicode & "@"
rodzic
72f879e605
commit
081fdf9eae
|
@ -4,7 +4,7 @@ const astralRegex = require('unicode-astral-regex')
|
|||
function calcWidth (charWidthTable) {
|
||||
const SCALE = 10 // Prevent results like 60.599999999999994
|
||||
const widthTable = charWidthTable.map(w => Math.round(w * SCALE))
|
||||
widthTable[64] = widthTable[64] + 4 // Slightly increase width of "@" by 0.4px
|
||||
widthTable[64] = widthTable[64] + 6 // Slightly increase width of "@" by 0.6px
|
||||
|
||||
return function (text, astral) {
|
||||
if (astral) text = text.match(astralRegex)
|
||||
|
|
|
@ -10,9 +10,9 @@ exports[`test/calc-text-width.spec.js TAP calc width for "npm" > result is corre
|
|||
`
|
||||
|
||||
exports[`test/calc-text-width.spec.js TAP calc width for unicode > result is correct 1`] = `
|
||||
57
|
||||
58
|
||||
`
|
||||
|
||||
exports[`test/calc-text-width.spec.js TAP calc width for emojis > result is correct 1`] = `
|
||||
34.2
|
||||
34.8
|
||||
`
|
||||
|
|
Ładowanie…
Reference in New Issue