BigBadaboom / androidsvg

SVG rendering library for Android
http://bigbadaboom.github.io/androidsvg/
Apache License 2.0
1.18k stars 226 forks source link

Text rendering rewrite #256

Open BigBadaboom opened 1 year ago

BigBadaboom commented 1 year ago

The rendering of text is being completely rewritten. Among the improvements:

Not yet confirmed:

theojarrus commented 4 months ago

Hey! Any updates here? First of all, thanks for the work, incredible library, it even supports parsing nested svgs, which even standalone utilities, including android studio, cannot do. I'm writing a multi-platform library for chord images runtime generation and I really need a feature with text aligment (dominant-baseline etc). Is there any plans for this in the near future?

BigBadaboom commented 2 months ago

Proper *-baseline support is awkward, because Android doesn't provide access to that sort of font metadata. I have been trying to keep AndroidSVG as minimal as possible. So I am reluctant to add font file parsing to the code, just to access the font's BASE table. Probably the best solution I could achieve would be to use heuristics to estimate the values, as the CSS spec suggests..

theojarrus commented 1 month ago

Found a workaround for text vertical centering, maybe it will be useful for someone else, so I'll leave it here. Just add dy=".35em" to text element