typst / typst/typst

Support converting text to paths for SVG images in SVG export

Open
#7,791 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request svg
Dominant language
Rust
Stars
56.1k
Forks
1.7k
Avg merge
3d 10h
Merged PRs (30d)
22

Description

Description

Hello,

When Typst renders a document as SVG, all text is converted to path elements. That’s exactly what I need. However, when I embed an SVG image with text elements into the Typst file, the resulting SVG still contains the text elements. Would it be possible with Typst to also convert text in embedded SVGs to paths?

In this example "test_font.svg" contains text elements

#set page(width: 100mm, height: 100mm, margin: 1mm)
#set text(size: 48pt, font: ("Liberation Sans"), fallback: false)

1234ABCDE
#image("test_font.svg")

As far as I could see in the deep wiki, this is the current behavior of typst
https://deepwiki.com/search/if-imageasvg-contains-a-text-w_efe8f632-82a0-4899-910c-996b66a6f489?mode=fast

Would it be possible to add an option to convert the text elements in embedded SVG images to paths. That would be great.

Thank you

Use Case

The reason for this request is to get a highly portable SVG image.

Contributor guide

Open the contributing guide

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 SVG export with the provided Typst example and test_font.svg, then trace the SVG export handling for embedded image text. Done means text elements in embedded SVG images are converted to path elements, producing a portable SVG output.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.