shrhdk / text-to-svg

Convert text to SVG path without native dependence.
Other
978 stars 132 forks source link

create a new function to combine getSVG and getMetrics #57

Open omkelderman opened 4 years ago

omkelderman commented 4 years ago

I had a need to get both the metrics and the SVG string at the same time. Now I could have just called getSVG and getMetrics in my code and be done with it, but I noticed that getSVG actually used getMetrics internally so then it would be called twice.

So I thought why not expose a function to get them both at the same time in an efficient manner. This change is entirely backwards compatible.

omkelderman commented 4 years ago

hmm, I actually now just realized that the same can be done for getD and getPath, which also means that the current implementation of getSVG already calls getMetrics twice: once in getSVG itself and once in getD which gets called in getPath

This should be able to be optimised even more

cmloegcmluin commented 3 years ago

Great idea @omkelderman. I would certainly benefit from having this option.