SVG importer does not apply root viewBox scaling to stroke widths
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- rust
- Domain
- computer-graphics
Research direction
Start at the SVG importer entry point and reproduce the issue with the minimal SVG example from the report, comparing the line stroke with the rectangle height. Trace how root width/height and viewBox scaling is applied, then verify that both objects render with the same 20-unit thickness when the scale factor is 0.25.
Written by the indexing model from the issue text.
Description
When the document width/height is different from the viewBox, geometry is scaled accordingly but not stroke widths (even when the aspect ratio is the same for both). Here's a minimal working (or in this case, failing?) example:
<svg xmlns="http://www.w3.org/2000/svg" width="240" height="120" viewBox="0 0 960 480">
<line x1="120" y1="140" x2="840" y2="140"
stroke="#d62828" stroke-width="80" stroke-linecap="butt"/>
<rect x="120" y="300" width="720" height="80" fill="#1565c0"/>
</svg>
These two objects should have the same visual thickness: one is a line with stroke width of 80, another is a rectangle with height 80, no stroke.
Opening this file directly in Safari shows the intended result (also reproduced with macOS Preview, Inkscape, Firefox and Chrome):
But importing this in Graphite gives this:
I reproduced this issue on:
- RC6 macOS desktop app
- Graphite web app
- https://dev.graphite.art with the following About this release info:
Release Series: Alpha 5
Branch: master
Commit: e725f550
2026-09-07 02:57 Eastern Time
The issue is that the viewport is 240 × 120 while the viewBox is 960 × 480, giving a scale factor of 0.25. Both the 80-unit stroke width and the 80-unit rectangle height should render as 20 units/pixels thick. A workaround for now is simply to use the same values for width/height as for the viewBox.
Possibly related: PR #3942, issue #2435.
- Dominant language
- Rust
- Stars
- 27.3k
- Forks
- 1.3k
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 64
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GraphiteEditor/Graphite
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
GraphiteEditor/Graphite#4396 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
GraphiteEditor/Graphite#4311 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
GraphiteEditor/Graphite#4275 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
GraphiteEditor/Graphite#3939 · 2 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
GraphiteEditor/Graphite#4572 · 3 comments ·
All issues in GraphiteEditor/Graphite
Similar issues
-
bug CLI custom-model
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
rust-bitcoin/rust-bitcoin#6930 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
fulcrumgenomics/ferro-hgvs#2251 ·
-
A-allocators A-docs C-enhancement T-libs
Difficulty 2/5 1-3 hours Newbie friendliness 75/100