Skip to content

create a new function to combine getSVG and getMetrics - #57

Open
omkelderman wants to merge 2 commits into
shrhdk:masterfrom
omkelderman:get-svg-and-metrics
Open

create a new function to combine getSVG and getMetrics#57
omkelderman wants to merge 2 commits into
shrhdk:masterfrom
omkelderman:get-svg-and-metrics

Conversation

@omkelderman

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Author

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

Copy link
Copy Markdown

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants