kopia lustrzana https://github.com/badgen/badgen
Increase 0.2px width for "@" and unicodes
rodzic
acb7a2fc73
commit
53ca750fb9
|
@ -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] + 2 // Slightly increase width of "@" by 0.2px
|
||||
widthTable[64] = widthTable[64] + 4 // Slightly increase width of "@" by 0.4px
|
||||
|
||||
return function (text, astral) {
|
||||
typeAssert(typeof text === 'string', 'Input must be string')
|
||||
|
|
|
@ -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`] = `
|
||||
56
|
||||
57
|
||||
`
|
||||
|
||||
exports[`test/calc-text-width.spec.js TAP calc width for emojis > result is correct 1`] = `
|
||||
33.6
|
||||
34.2
|
||||
`
|
||||
|
|
Ładowanie…
Reference in New Issue