Today I ran into a similar problem. Duopixel is correct that getBBox () may return a metric, which may be unexpected because the external font has not yet been loaded, and a standard font is used instead.
The problem with WebKit (tested in the Chrome 24.0.1312.52 and 26.0.1389.0 canaries) is that the browser delays loading the external font until it is used efficiently anywhere on the page. Therefore, even if you expect that onreadystatechange will become "complete", you are not guaranteed that font metrics will be displayed when you call getBBox () - you can still display the text in style with an external font, inserting it into the document and immediately calling getBBox () on it (my case).
My workaround instead of calling mySVGInitCode () directly:
$("body").append( $("<div/>") .attr("class", "force-external-font-loading") .attr("style", "font-family: \"xkcd\";visibility:hidden;position:absolute") .text("x") ); setTimeout(function(){ mySVGInitCode() }, 100);
As you can see, I dynamically insert an absolutely positioned stylized piece of text to force external fonts to be loaded (visibility: hidden is important here instead of showing: none). Then I wait a while before I execute my SVG code, which can potentially do something, and then immediately request metrics.
source share