The texts for the function information are truncated to fit their flame rectangles. Currently, the hard-coded average width of characters is used for the text width estimation.
However, I plan to make the font and font size customizable in a fix for issue #8. Therefore, the average character width cannot be known in advance. Moreover, the current estimation method is not so accurate with proportional fonts.
SVG has the ability to clip shapes with clipping paths, but this technique has the problem of growing the DOM tree.
There is also an API to get the bounding box of the text, but this is expensive. In particular, even if we find that the text overflows by calculating its bounding box, we don't know how many characters to be truncated.
I would like to implement a slightly better statistical estimation method.
The texts for the function information are truncated to fit their flame rectangles. Currently, the hard-coded average width of characters is used for the text width estimation.
https://github.com/kimikage/ProfileSVG.jl/blob/6df38434586f521db33fcdfc80a0fdc1a078c417/src/viewer.js#L44 https://github.com/kimikage/ProfileSVG.jl/blob/6df38434586f521db33fcdfc80a0fdc1a078c417/src/viewer.js#L51-L59
However, I plan to make the font and font size customizable in a fix for issue #8. Therefore, the average character width cannot be known in advance. Moreover, the current estimation method is not so accurate with proportional fonts.
SVG has the ability to clip shapes with clipping paths, but this technique has the problem of growing the DOM tree.
There is also an API to get the bounding box of the text, but this is expensive. In particular, even if we find that the text overflows by calculating its bounding box, we don't know how many characters to be truncated.
I would like to implement a slightly better statistical estimation method.