-
Notifications
You must be signed in to change notification settings - Fork 67
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
utf-8: initial support #42
Conversation
I am not sure whether it's okay to use u8 as a pixel. It may create confusion. |
@cab404 Thanks for the PR
Perhaps create a new type to reduce confusion (e.g. |
✔️ |
This way it would actually be easier to add 2x3, if it exists. |
Not sure how to fix nighly fails :| @kennytm? |
Co-Authored-By: kennytm <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add a test case for dark-on-light output.
Rest LGTM.
src/render/utf8.rs
Outdated
|
||
|
||
fn new(width: u32, height: u32, dark_pixel: Unicode1x2, light_pixel: Unicode1x2) -> Self { | ||
let a = vec![light_pixel.value(); (width * height) as usize]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an assert!
that (width+1)/2 == height
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why? It works on non-rectangle canvas just fine :| I can make test cases for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other non-text canvas, the width
and height
can be independently scaled and result in rectangular modules. This is not the case for 1x2 since the width:height ration is fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, and also my implementation doesn't store it on per-symbol basis :|
This adds support for rendering QR codes with Unicode symbols "▄▀█" (just like qrencode), greatly reducing size of qr codes in terminal, and providing better aspect ratio than current string renderer.