The cell pixmap was round(scale x step) pixels and repeated, but the cell was drawn, and the paint transform mapped back, at the unrounded scale. So the pixmap repeated a fraction of a pixel too far at every step (31 px for a 30.56 px step at 110 dpi), and cells drifted further from their place with every step from the pattern's origin. Vendored hayro patch (25), `tiling_cell_pixels`: the cell is drawn at round(scale x step) / step, so one step is exactly the pixmap's side, and the paint transform uses that same scale. The side stays within 1 and the existing 3000 px cap; a non-finite product keeps the scale and a bounded side. Tests: crates/render/tests/it/tiling_cell_placement.rs (fill, turned and scaled matrix, stroke, all at 110 dpi far from the origin; the helper's bounds). Claude-Session: https://claude.ai/code/session_0175FWj4xFhMhSH3UpMU8DSC Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
hayro
A crate for rendering PDF files.
This crate allows you to render pages of a PDF file into bitmaps. It is supposed to be relatively lightweight, since we do not have any dependencies on the GPU. All the rendering happens on the CPU.
The ultimate goal of this crate is to be a feature-complete and performant PDF rasterizer.
With that said, we are currently still very far away from reaching that goal: So far, no effort
has been put into performance optimizations, as we are still working on implementing missing features.
However, this crate is currently the most comprehensive and feature-complete
implementation of a PDF rasterizer in pure Rust. This claim is supported by the fact that we currently
include over 1000 PDF files in our regression test suite. The majority of those have been scraped
from the pdf.js and PDFBOX test suites and therefore represent a very large and diverse sample
of PDF files.
As mentioned, there are still some serious limitations, including lack of support for encrypted/password-protected PDF files, blending and isolation, knockout groups as well as a range of smaller features such as color key masking. But you should be able to render the vast majority of PDF files without too many issues.
Safety
This crate forbids unsafe code via a crate-level attribute.
Examples
For usage examples, see the example in the GitHub repository.
Cargo features
This crate has one optional feature:
embed-fonts: See the description ofhayro-interpretfor more information.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.