<svg width="330pt" height="290pt" viewBox = "0 0 330 290" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
where the values for 330 and 290 depend on the size of the figure.
The problem is that the width and height values are in points, and the viewbox values are in pixels, so this causes the figure to be scaled with something other than 1:1. As a result, the rendered figure comes out larger than intended, and fonts are not in the requested size.
Removing the "pt" specifier from the width and height attributes seems
to correct the problem.
It looks like this is quite generic and any input will cause this bug.
It looks to me that just removing the "pt" specification from the code that generates the "svg" element will fix this bug.