Graphite
Graphite copied to clipboard
Exporting with auto bounds doesn't account for outer stroke
When exporting an SVG with transperancy, the bounding box doesn't seem to include the outer stroke weight. So if you export a square with a stroke width of 8 px, the exported image will have the outer stroke cut off.
This is also the case in the dev deployment.
The exported svg: (notice how the borders are visibly cut off)
The project file (renamed to have .txt so github lets me upload it):
Spelling bee cell.graphite.txt
Changing the SVG viewbox, width, height, and remoxing the transformation to restore the boundaries to those present in the project (1000px^2 for me) fixed the issue completely.
Duplicate of #2113.
I'm actually going to make #2113 a duplicate of this, even though this is more recent, because it more clearly describes the problem.
Apologies for the duplicate, I tried looking for SVG errors, not realizing the issue applied to other formats too (as described by #2113) It's really not that big of a deal for me, but I figured you could decide if it's worth fixing.
In renderer.rs, we have
fn bounding_box(&self, transform: DAffine2, include_stroke: bool) -> Option<[DVec2; 2]>;
The include_stroke option can potentially let us acquire the bounding box with the stroke factored into the calculation. But I'm suspicious that our current usages of that are somewhat flawed and potentially buggy. There might also be another way to measure bounding boxes in use at the moment in other places. So this might not be trivial to implement, but in the best case, it could just be a matter of using true instead of false in the correct location. But other fixes are probably necessary, and certainly thorough testing (including cases where strokes are pre- and post-transformed).