Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

SVG importer does not apply root viewBox scaling to stroke widths

Đang mở
#4,515 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
computer-graphics

Hướng nghiên cứu

Bắt đầu từ điểm vào của trình nhập SVG và tái hiện vấn đề bằng ví dụ SVG tối thiểu trong báo cáo, so sánh độ dày nét của đường với chiều cao của hình chữ nhật. Theo dõi cách root width/height và việc thu phóng viewBox được áp dụng, sau đó xác minh rằng cả hai đối tượng đều được kết xuất với cùng độ dày 20 đơn vị khi hệ số thu phóng là 0.25.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Rust
Star
27.3k
Fork
1.3k
Merge trung bình
20 giờ 1 phút
Pull request đã merge (30 ngày)
64

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của GraphiteEditor/Graphite

Tất cả issue của GraphiteEditor/Graphite

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.