GraphiteEditor / GraphiteEditor/Graphite

SVG importer does not apply root viewBox scaling to stroke widths

Open
#4,515 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
27.2k
Forks
1.3k
Avg merge
20h 5m
Merged PRs (30d)
57

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

```
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:
- RC6 macOS desktop app
- Graphite web app
- https://dev.graphite.art with the following _About this release_ info:
```text
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.

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.