GraphiteEditor / GraphiteEditor/Graphite

SVG importer does not apply root viewBox scaling to stroke widths

Ouverte
#4,515 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Rust
Étoiles
27.2k
Forks
1.3k
Merge moyen
20 h 5 min
PR mergées (30 j)
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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
rust
Domaine
computer-graphics
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
Active
Clarté
Plutôt claire
Accessibilité débutants
68/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.