androidsvg icon indicating copy to clipboard operation
androidsvg copied to clipboard

Text rendering rewrite

Open BigBadaboom opened this issue 3 years ago • 3 comments

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

  • Correct handling of nested layout with differing text properties (includes fix for #241 etc)
  • Proper text shaping. At least for non-txtPath elements
  • Correct handling for RTL text
  • Support for writing-mode and vertical text (see #151)
  • etc

Not yet confirmed:

  • Support multi-value text geometry attributes feature request (#248)
  • Support alignment-baseline and dominant-baseline feature request (#247)
  • textLength attribute is not used feature request (#216)
  • support @font-face (#206)

BigBadaboom avatar Jul 31 '22 08:07 BigBadaboom

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?

theojarrus avatar Feb 23 '24 15:02 theojarrus

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..

BigBadaboom avatar Apr 21 '24 23:04 BigBadaboom

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

theojarrus avatar May 21 '24 17:05 theojarrus