Skip to content

Commit

Permalink
test: Use absolute size in gerberimporter_tests SVG
Browse files Browse the repository at this point in the history
This allows the rsvg functions to know the size without knowing the viewport.
  • Loading branch information
eyal0 committed Nov 4, 2021
1 parent 82346c6 commit 01e9c98
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gerberimporter_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ string render_svg(const multi_polygon_type_fp& polys, const box_type_fp& boundin
const double svg_width = (svg_bounding_box.max_corner().x() - svg_bounding_box.min_corner().x());
const double svg_height = (svg_bounding_box.max_corner().y() - svg_bounding_box.min_corner().y());
const string svg_dimensions =
str(boost::format("width=\"%1%\" height=\"%2%\" viewBox=\"%3% %4% %5% %6%\"")
% "100%"
% "100%"
str(boost::format("width=\"%1%px\" height=\"%2%px\" viewBox=\"%3% %4% %5% %6%\"")
% (svg_width * dpi)
% (svg_height * dpi)
% ((bounding_box.min_corner().x() - svg_bounding_box.min_corner().x()) * dpi)
// max and not min because the origin is in a different corner for svg vs gbr
% ((svg_bounding_box.max_corner().y() - bounding_box.max_corner().y()) * dpi)
Expand Down

0 comments on commit 01e9c98

Please sign in to comment.