|
|
|
@ -30,6 +30,8 @@ module.exports = async (captchaOptions) => { |
|
|
|
|
|
|
|
|
|
//divide the space by grid size, accounting for padding
|
|
|
|
|
const spaceSize = (width-padding)/size; |
|
|
|
|
const fontMinSize = Math.floor(width*0.16); |
|
|
|
|
const fontMaxSize = Math.floor(width*0.25); |
|
|
|
|
for(let j = 0; j < size; j++) { //for each row
|
|
|
|
|
|
|
|
|
|
//x offset for whole row (not per character or it gets way too difficult to solve)
|
|
|
|
@ -44,7 +46,7 @@ module.exports = async (captchaOptions) => { |
|
|
|
|
} else { |
|
|
|
|
character = falses[(await randomRange(0, falses.length))]; |
|
|
|
|
} |
|
|
|
|
captcha.fontSize((await randomRange(20, 30))); |
|
|
|
|
captcha.fontSize((await randomRange(fontMinSize, fontMaxSize))); |
|
|
|
|
captcha.drawText( |
|
|
|
|
(spaceSize * i) + cxOffset, |
|
|
|
|
(spaceSize * (j + 1)) + cyOffset, |
|
|
|
|