Isn't this a page layout problem? What would you do with the pixel length of the characters that you wouldn't do with a properly designed flowing page in the first place? The user's browser is going to mess with your font character lengths more ways than a swamp has bugs regardless of what method you use to determine the string length and you have absolutely no control over that.