linebender / linebender/resvg

Trying to render a subscript ends up with bold font

Open
#609 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Using a file like
```

```

and `./resvg --sans-serif-family "Liberation Sans" simple_subscript_bold.svg simple_subscript_bold.png` gives a warning "Warning (in usvg_text_layout:1398): Fallback from Liberation Sans to Noto Sans Mono." and result like
![image](https://user-images.githubusercontent.com/119247/230412245-bd425b3c-f1ba-4158-8d8b-43a3b00a9b9a.png)

However specifying `./resvg --sans-serif-family "Noto Sans Mono" simple_subscript_bold.svg simple_subscript_bold.png` doesn't give any warnings and also doesn't render the text in bold:
![image](https://user-images.githubusercontent.com/119247/230412522-eaae1f93-b2f6-42db-b233-3ebd777d95bb.png)

I suppose the problem is that Liberation Sans doesn't have the codepoint 2083 (subscript 2) available: `fc-query --format='%{charset}\n' /usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf` ⇒ `… 207f 20a3-20a4 …` and Noto does (`2074-208e`). But I would expect then that a regular weight fallback would be used, and preferably a warning why the fallback was used when the requested font does exist.

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

Reproduce the issue with the supplied SVG and the two resvg commands, then start at the usvg_text_layout warning path mentioned in the report. Trace how missing glyphs select a fallback font and how its weight is chosen. Done means Liberation Sans fallback renders the subscript without unintended bold styling and the fallback behavior is explained by an appropriate warning.

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.