Skip to content
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

Improve handling of SVG with missing width and height. #446

Merged
merged 2 commits into from
Apr 2, 2022

Conversation

abey79
Copy link
Owner

@abey79 abey79 commented Apr 2, 2022

Description

When width and height are missing from the tag, or expressed as percent, we now let svgelement use viewBox (if available) or revert to 1000x1000. This happens by default now with read_svg() (and friends). This behaviour can be overridden by passing values for default_width and default_height.

The read command now follows this pattern as well.

Fixes #441

Checklist

  • feature/fix implemented
  • code formatting ok (black and isort)
  • mypy returns no error
  • tests added/updated and pytest succeeds
  • documentation added/updated
    • command docstring and option/argument help
    • README.md updated (Feature Overview)
    • CHANGELOG.md updated
    • added new command to reference.rst
    • RTD doc updated and building with no error (make clean && make html in docs/)

abey79 added 2 commits April 2, 2022 13:34
When width and height are missing from the <svg> tag, or expressed as percent, we now let svgelement use viewBox (if available) or revert to 1000x1000. This happens by default now with `read_svg()` (and friends). This behaviour can be overridden by passing values for `default_width` and `default_height`.

The `read` command now follows this pattern as well.

Fixes #441
- Update CHANGELOG.md
@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 2, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov
Copy link

codecov bot commented Apr 2, 2022

Codecov Report

Merging #446 (05afe38) into master (7076c03) will increase coverage by 0.00%.
The diff coverage is 90.32%.

@@           Coverage Diff           @@
##           master     #446   +/-   ##
=======================================
  Coverage   94.31%   94.32%           
=======================================
  Files          60       60           
  Lines        5313     5339   +26     
  Branches      778      781    +3     
=======================================
+ Hits         5011     5036   +25     
  Misses        185      185           
- Partials      117      118    +1     
Impacted Files Coverage Δ
vpype/io.py 84.57% <ø> (-0.08%) ⬇️
vpype_cli/read.py 96.22% <60.00%> (+0.14%) ⬆️
tests/test_files.py 98.53% <96.15%> (-0.35%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7076c03...05afe38. Read the comment docs.

@abey79 abey79 merged commit 2d50a1d into master Apr 2, 2022
@abey79 abey79 deleted the fix-default-page-size-441 branch April 2, 2022 11:58
abey79 added a commit that referenced this pull request Apr 2, 2022
…#446)

- Fixed missing alpha in __all__
- Updated CHANGELOG.md
abey79 added a commit that referenced this pull request Apr 2, 2022
There was no way to adjust a layer's opacity without providing the base colour, which may have been set already. This PR introduce the `alpha` command, which does exactly that. If no colour is defined for the layer, it is set to black.

Also:
- added `vpype_cli.FloatRangeType`
- fixed typo in `vpype_cli.IntRangeType` docstring
- fixed misnamed `vpype.Color.as_rgb_hex()` member name
- added test for `alpha`
- updated doc and readme
- Fixed error in `test_read_command_page_size()` on Windows introduced in #446
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix default value for %/missing SVG height/width
1 participant