Kozea / Kozea/CairoSVG

"inherit" doesn’t work for "overflow"

Open
#300 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
951
Forks
166
PR merge metrics
No merged PRs in 30d

Description

I'm trying to render [this file](https://github.com/Kozea/CairoSVG/files/5500296/0183.svg.zip) with cairosvg, but unfortunately the image it produces is unusable, because almost all objects are cropped in the upper half like this. Any ideas why this is happening?

![0183](https://user-images.githubusercontent.com/594497/98349128-e8fb8100-2019-11eb-9480-b7115c902a73.png)

My code is simply

```python
from cairosvg import svg2png
with open(input_svg, mode="r") as input_file:
svg_stream = input_file.read()
output_png = os.path.join(output_directory, os.path.basename(input_svg).replace("svg", "png"))
svg2png(bytestring=svg_stream, dpi=900, background_color="white", scale=30.0, write_to=output_png, output_width=2480, output_height=3508)
```
Interestingly, the same happens when converting svg to pdf:

[0183.pdf](https://github.com/Kozea/CairoSVG/files/5500302/0183.pdf)

For reference, this is how it should look like:
![beethoven_polonaise_op89_p0183_0184_001](https://user-images.githubusercontent.com/594497/100079804-652cfb80-2e45-11eb-937f-2df91c87e269.png)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the rendering with the attached 0183.svg file and the Python svg2png snippet, then compare the PNG and PDF output with the expected image. Trace how inherited overflow is handled during SVG rendering; done means the objects are no longer cropped and both output formats match the reference.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.