-
Notifications
You must be signed in to change notification settings - Fork 3
Sturdy up the API and add PDF417 #2
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
Conversation
Allow passing options to Zint. Add utility functions for configuration. Document majority of barcode encoders in the manual. Reduce boilerplate in manual. Replace anyhow with thiserror to provide descriptive error messages. Remove some unused derives to speed up compilation. Move simple functions to typst and use composition to reduce code complexity. Mark Symbology as non_exhaustive in bindings as it depends on Zint values. Make Options fields public to allow testing. Make Options default constructible to simplify use from Rust code. Make serde error when unknown fields are passed to Options. Add constants to lib.typ to allow dependants to use named values instead of magic numbers. Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
Add more flexible Color deserialization logic. Cleanup Option3 semantics. Add more flexible Option3 deserialization. Make enums directly store represented data. Use hex crate for faster Color conversion. Add more details to manual. Fix some minor consistency issues. Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
|
looks cool! i'm busy with work these days but i will take a look within a week. thank you for such a big improvement! |
|
You're welcome. Let me know if there's any change you don't like or want more info on when you get at it. |
Enter-tainer
left a comment
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.
LGTM, this is definitely a huge improvement to this packge!
Replace into_zint_symbol with a Symbol constructor. Use bitflags for bitflag options. Add more detailed error messages and better edge-case handling. Improve deserialization of options and move related code from Typst into WASM. Use kebab-case deserialization for typst plugin. Use transparent background color by default. Fully document available options in the manual. Add links to manual. Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
|
thank you! i will publish a new version when i leave work |
I started adding PDF417 utility method, and then did a few other things. One day later:
Optionsto Zint.Optionsvalues.anyhowwiththiserrorto provide descriptive error messages.Optionsdon't needSerializeas they'll never be passed back to typst; Errors almost never requireCloneandCopy, and adding them imposes restrictions that can't be satisfied in a lot of cases; ...Symbologyas#[non_exhaustive]in bindings as it depends on Zint values.Optionsfields public to allow testing andOptionsdefault constructible to simplify use from Rust code.lib.typto allow dependants to use named values instead of magic numbers.DM_ISO_144andULTRA_COMPRESSIONdo so I just left them in case they're needed.copy_from_sliceexpected source and destination buffers to be of same size which caused the library to panic when any of the string options were set.Option3into an union so that it matches Zint better - the actual meaning of the value is determined by theOptionsobject.hexcrate for faster Color conversion.hexwas needed for parsing/deserializing the colors, so I used it for string generation as well as it's faster and generates less code than stdformat!macro.Optionsnames and values to the manual so people can look it up there instead of having to look at the sources.This closes #1.
Future Work