-
Notifications
You must be signed in to change notification settings - Fork 78
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
Units px and pt are wrong #386
Comments
Thank you for raising your first issue! Your help to improve svglib is much appreciated! |
Thanks for this report! Just to confirm I'm seeing the same effect for reportlab 3.5.68, svglib 1.4.1, and Python 3.10.6 on macOS 13.5.1. Might be a simple conversion buglet. Will check... |
It's embarrassing, but the pt unit in these tests is off by a factor of 1.25, and 1 px should be 1.3333333333333 pt. Will be fixed in Svg2RlgAttributeConverter.convertLength()... |
@13thirteen This feature branch should fix your issue: https://github.com/deeplook/svglib/tree/fix_units_pt_px. Can you please verify and give premission to add your SVG sample to the test cases? |
Fixed as reported as solved in #386.
Something is wrong with units
px
(pixels) andpt
(points).The following SVG file contains text and red bars of the same size in different units:
From MDN: Absolute Length Units:
Which gives
96px
=2.54cm
=25.4mm
=1in
=6pc
=72pt
All text should have the same font size.
All bars should have the same length.
The following are screenshots of the SVG and the PDF generated by svglib opened in Firefox:
The SVG looks correct:
The generated PDF looks wrong, the first and last units
px
andpt
seem too big:Tested with svglib 1.5.1, reportlab 4.0.5, Python 3.11.5, Windows 10
The text was updated successfully, but these errors were encountered: