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

[FEATURE] Add caching in DrawShapedText #3032

Open
1 task done
MichaelRumpler opened this issue Oct 8, 2024 · 0 comments · May be fixed by #3033
Open
1 task done

[FEATURE] Add caching in DrawShapedText #3032

MichaelRumpler opened this issue Oct 8, 2024 · 0 comments · May be fixed by #3033

Comments

@MichaelRumpler
Copy link

Is your feature request related to a problem?

The DrawShapedText method is meant to be an easy replacement for DrawText which adds text shaping via HarfBuzz but otherwise uses the same parameters as DrawText. It creates and disposes a SKShaper at every call which is very slow.

Describe the solution you would like

The SKShaper should not be created and disposed at every call. It should be cached and reused instead.

Furthermore also the result of the text shaping should be cached. This would improve the performance even more.

Describe alternatives you have considered

There is an overload of DrawShapedText which takes a SKShaper and does not create/dispose it at every call, but people need to have more insider knowledge of HarfBuzzSharp to use it. Also the caching of the results is something which everybody has to do to use HarfBuzz efficiently. It would be better if it was built in.

Additional context

I wrote a blog post about this problem. It also includes benchmarks which show the possible improvement.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@MichaelRumpler MichaelRumpler linked a pull request Oct 8, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant