-
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
pic: initial support #65
Conversation
ℹ️ The generated output is compatible to what has been proposed to libqrencode in |
README.md
Outdated
|
||
Generates PIC output that renders as follows: | ||
|
||
[![Output](examples/encode_pic.png)](examples/encode_pic.png) |
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.
You should link to the text output of the PIC code, instead of the rendered PNG.
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.
It would be possible to have all the call to the p(…)
macro on a single line separated by ;
, would you prefer 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.
It would be possible to have all the call to the
p(…)
macro on a single line separated by;
, would you prefer that?
if it is all in one line, there is no improvement in terms of readability or file size, so no.
Thanks for the review and the helpful comments, @kennytm, very much appreciated! I've responded to your comments and will address all of them in a future change to this PR, once all comments have been resolved 🙂 |
9acd1fd
to
cb26cf2
Compare
Kindly requesting re-review, @kennytm. The current state of this PR and the PIC code it generates offers to most compatible output according to my tests. Hopefully I've addressed all of your other comments properly, if not please let me know 🙂 |
50b46f7
to
63d9a6a
Compare
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.
Rest LGTM
src/render/pic.rs
Outdated
#[doc(hidden)] | ||
pub struct Canvas { | ||
pic: String, | ||
marker: PhantomData<Color>, |
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.
marker: PhantomData<Color>, |
no need to include the PhantomData since it no longer needs to capture the unused generic argument.
and please fix the |
Thank you for your patience and helpful advice on this, @kennytm, very much appreciated! 🙏 I've addressed your comments in the latest force-push to this PR. |
README.md
Outdated
fn main() { | ||
let code = QrCode::new(b"01234567").unwrap(); | ||
let image = code | ||
.render() |
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.
.render() | |
.render::<pic::Color>() |
src/render/pic.rs
Outdated
r#"define p {{ box wid $3 ht $4 fill 1 with .nw at $1,-$2 }}"#, | ||
"\n", | ||
r#"box wid maxpswid ht maxpsht with .nw at 0,0"#, | ||
"\n", |
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.
r#"define p {{ box wid $3 ht $4 fill 1 with .nw at $1,-$2 }}"#, | |
"\n", | |
r#"box wid maxpswid ht maxpsht with .nw at 0,0"#, | |
"\n", | |
"define p {{ box wid $3 ht $4 fill 1 with .nw at $1,-$2 }}\n", | |
"box wid maxpswid ht maxpsht with .nw at 0,0\n", |
Thanks for taking another scrutinising look, suggesting helpful changes, and already approving this PR. I've updated this PR to include your suggestions 🙂 |
Thanks for your patience, guidance and help on getting this merged, kennytm, very much appreciated! 😃 For this new functionality to be useful for me a new release would be helpful, so that the Are there any plans for a new release any time soon(ish) by any chance? |
This PR adds initial support for rendering a QR-Code as PIC, so that the QR-Code can be included in documents typeset using roff (only tested with GNU roff 1.23.0 so far).
The newly added code in
src/renders/pic.rs
is based onsrc/renders/svg.rs
and was adapted as needed.The example for pic includes additional files to show a full example including roff source. Within those files example commands are given to show a complete pipeline.
I'm not too familiar with Rust and hence kindly request a scrutinizing review. 😅