Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

SVG importer does not apply root viewBox scaling to stroke widths

未关闭
#4,515 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
rust

调研方向

从 SVG 导入器的入口点开始,使用报告中的最小 SVG 示例重现问题,并比较线条描边与矩形高度。跟踪 root width/height 和 viewBox 缩放的应用方式,然后验证当缩放因子为 0.25 时,两个对象都以相同的 20 单位厚度进行渲染。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Rust
星标
27.3k
派生
1.3k
平均合并
20 小时 1 分钟
30 天内合并 PR
64

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

GraphiteEditor/Graphite 的其他 Issue

查看 GraphiteEditor/Graphite 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。