iced icon indicating copy to clipboard operation
iced copied to clipboard

Invisible text in svgs after updating to 0.3.0

Open PotatoSquid opened this issue 3 years ago • 1 comments

An svg in iced 0.2.0:

svg in iced 0 2 0

The same svg in iced 0.3.0:

svg in iced 0 3 0

Code:

iced_svg_test.zip

PotatoSquid avatar May 07 '21 09:05 PotatoSquid

I think this is caused by resvg switching its renderer to tiny-skia, which does not support text (yet?).

hecrj avatar May 17 '21 13:05 hecrj

I believe this is happening because resvg needs the convert_text method to be called on trees before they are rendered. But that requires a fontdb::Database loaded with fonts. I have a draft PR up (#1908) that shows doing that by naively loading all system fonts, the same way resvg's command line tool does it. And that works for my test case but it seems like the wrong approach given that iced already has a text system with a fontdb::Database in the iced_tiny_skia/iced_wgpu::text::Pipeline structs.

Since I'm brand new to this code base it's not obvious to me how the font database should be shared between the text pipeline and the svg pipeline, but it seems like it should. I'll poke around some more and see if I can work it out but I'd love guidance if anyone has some.

alec-deason avatar Jun 10 '23 21:06 alec-deason

I updated the PR with a possible approach to sharing the font database across systems. It feels like it has some ugliness in how the database references get passed around but it works. I'd still love anyone's thoughts on how best to handle this.

alec-deason avatar Jun 10 '23 22:06 alec-deason