linebender / resvg

An SVG rendering library.
Mozilla Public License 2.0
2.79k stars 225 forks source link

Substitute to `convert_text_to_path` #809

Closed Ultraxime closed 1 month ago

Ultraxime commented 1 month ago

Hello,

I'm using usvg in version 0.39 and wanted to update to a newer version (0.43). But it appears that the function convert_text_to_path disappeared. Sadly, I was using it because some of my texts are using custom font and I did not want to install them on the user computer.

So is there any substitute to this function ? Or am I obliged to install the font in order for the user to visualize the SVG outside the program.

LaurenzV commented 1 month ago

You need to provide a fontdb that can be used, but you are free to populate it with your own fonts instead of loading system fonts, so that should not be an issue.

Then, you can simply use the flattened method to iterate over the outlines, as in the past.

Ultraxime commented 1 month ago

I already populated my fontdb with my custom fonts.

So before saving, I just need to cross the tree to flatten every text node ?

LaurenzV commented 1 month ago

In theory, yes. Text should be flattened automatically, IIRC.

LaurenzV commented 1 month ago

@RazrFalcon I think this can be closed then..