linebender / linebender/vello

`Cap::Butt` is rendered wrong

Open
#1,063 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-research I-Servo
Dominant language
Rust
Stars
4.3k
Forks
300
Avg merge
2d 13h
Merged PRs (30d)
61

Description

```rust
let stroke = Stroke {
width: 50.0,
join: vello::kurbo::Join::Miter,
miter_limit: 10.,
start_cap: vello::kurbo::Cap::Butt,
end_cap: vello::kurbo::Cap::Butt,
..Default::default()
};
let mut path = BezPath::new();
path.move_to(Point::new(110., 50.));
path.line_to(Point::new(110., 60.));
path.line_to(Point::new(100., 60.));
scene.stroke(&stroke, Affine::IDENTITY, Color::WHITE, None, &path);
```
makes this:

![Image](https://github.com/user-attachments/assets/fb90b84a-aa8a-4423-89fa-08cde206f72a)

but html 2d canvas:

![Image](https://github.com/user-attachments/assets/991de85d-befd-4016-99fb-ce367f391bc2)

using this code

```html


const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
ctx.fillStyle = '#000';
ctx.fillRect(0, 0, 500, 300);

ctx.lineWidth = 50;
//ctx.lineJoin = 'bevel';
//ctx.lineCap = "round";

ctx.strokeStyle = '#fff';
ctx.beginPath();
ctx.moveTo(110, 50);
ctx.lineTo(110, 60);
ctx.lineTo(100, 60);
ctx.stroke();

```

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.

Research direction

Start by reproducing the issue with the Rust Stroke and BezPath snippet, then compare its Cap::Butt output with the HTML canvas example. Trace the scene.stroke path and stroke-cap handling to find where the rendered geometry diverges. Done means the same path renders with butt caps matching the canvas result.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.