You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem?
The
DrawShapedText
method is meant to be an easy replacement forDrawText
which adds text shaping via HarfBuzz but otherwise uses the same parameters asDrawText
. It creates and disposes aSKShaper
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 aSKShaper
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
The text was updated successfully, but these errors were encountered: