Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add fn gen qrcode svg #74

Open
iugo opened this issue Jul 5, 2024 · 1 comment
Open

feat: add fn gen qrcode svg #74

iugo opened this issue Jul 5, 2024 · 1 comment

Comments

@iugo
Copy link
Member

iugo commented Jul 5, 2024

有人在 deno 提供兼容: https://github.com/lowlighter/libs/blob/7e138809c4d645f7ed2411f32744b53c3ecde5b5/qrcode/mod.ts

还有一些更常见的, 但没有测试 deno 兼容性: https://github.com/papnkukn/qrcode-svg/blob/47d56ec28fcd0a3aabbb5f11a34167a02a80c54e/lib/qrcode.js

其实自己写一个都行:

  1. 编码字符数据为字节数据 string => Uint8Array.
  2. 编码字节数据为一个二维数组 boolean[][].
  3. 补充定位图案的固定格式.
  4. 将编码渲染为 SVG.
  5. 优化 SVG, 减小体积 (可以被继承到上一步).

目前最新的二维码规范为: https://www.iso.org/standard/62021.html (下载收费, 但可以通过标准名找到 PDF 版本)

@iugo
Copy link
Member Author

iugo commented Jul 10, 2024

目前的这个库有个问题, 不支持更复杂的编码, 比如三字节的 emoji.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant