jeromeetienne / jquery-qrcode

qrcode generation standalone (doesn't depend on external services)
http://blog.jetienne.com/blog/2011/04/07/jquery-qrcode/
MIT License
4.84k stars 2.5k forks source link

Table QR codes need Math.floor on width and height values to avoid invalid codes #42

Closed fastfrwrd closed 8 years ago

fastfrwrd commented 11 years ago

Table-based QR codes weren't being calculated with Math.floor to round down their widths and heights, and were frequently being drawn as invalid, "squeezed" QR codes. this fix uses this. This rounds those down as well as the full qr code itself to avoid other issues. One problem is that this approach doesn't necessarily spit back a QR code of the exact width and height that you asked for, but it at least is always valid, and since it rounds down, it'll avoid layout problems pretty handily.

If a valid QR code with the exact width provided needs to be generated, you realistically would need a canvas.