Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

SVG importer does not apply root viewBox scaling to stroke widths

Open
#4,515 1 comment 0 reactions 0 assignees View on GitHub

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

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):
Image

But importing this in Graphite gives this:
Image

I reproduced this issue on:

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GraphiteEditor/Graphite

All issues in GraphiteEditor/Graphite

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.