linebender / linebender/resvg

usvg panics on text with diacritics

Open
#732 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
4.1k
Forks
348
Avg merge
1d 14h
Merged PRs (30d)
3

Description

`usvg@0.41.0` panics here when rendering a text having diacritics using a custom font:

```
removal index (is 2) should be < len (is 2)
```

https://github.com/RazrFalcon/resvg/blob/fb7e28513f561ed847acbf4a6fb8b743474837a0/crates/usvg/src/text/layout.rs#L823

I'm using a non-system font that **does not** include diacritics. Relevant SVG:

```html

```

Perhaps we can check if the glyph exists at the index before removing it, but I'm not certain if it's the right way to handle this.

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 in crates/usvg/src/text/layout.rs around line 823 and reproduce the panic with the provided SVG, a custom font without diacritics, and the y̆ text. Trace the glyph-removal path and verify that rendering the example completes without the removal-index panic; add or update coverage if the repository provides a relevant test location.

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
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.