Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix middle-anchoring for lines of multiple TSpans #1206

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mjmasn
Copy link

@mjmasn mjmasn commented Nov 28, 2019

Summary

Fixes #1205

Not really intended as the final fix for this issue, I only dabble in Java so I'm sure there is probably a better way to do it. Happy to make changes as required :)

Test Plan

Check that lines comprising multiple <TSpan>s are centred correctly as in the 'after' screenshot:

Before After

What's required for testing (prerequisites)?

Clone the repo here: https://github.com/mjmasn/TSpanIssue
Install react-native-svg from git branch / yarn link etc.

What are the steps to reproduce (after prerequisites)?

Run the app before and after installing this patch.

Compatibility

OS Implemented
iOS n/a (issue not tested on iOS)
Android

Checklist

  • I have tested this on a device
  • and a simulator
  • I added the documentation in README.md
  • I mentioned this change in CHANGELOG.md
  • I updated the typed files (TS and Flow)
  • I added a sample use of the API in the example project (example/App.js)

@mjmasn
Copy link
Author

mjmasn commented Nov 29, 2019

Hmm, so this doesn't actually work if the spans have different fontSizes. Can't seem to work out how to get the font for each span from getSubtreeTextChunksTotalAdvance of another span.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Text anchoring is not calculated correctly if the line contains multiple TSpans
2 participants