1

I am about to import SVG - Fonts with Javascript to be able to animate even single letters. Thereby i am storing the glyphs in an Javascript Object, where the Unicode-value of the glyph defines the key and the glyph itself becomes the value. So when i create text from a given string i use the each character from the string to get the suitable glyph for it. And here comes my question:

The unicode-value of the glyphs unicode attribute (specified here) can be an XML character reference in hexadecimal (unicode="ffl") or decimal (unicode="ffl") notation. For the hkern- and vkern-elements (representing the kerning table) the characters given as Unicode Range (specified here and here). Is there any Library which could do the conversion from all these possible variations? Does anybody know a resource where i can find further information which could help me solving this problem?

The overall problem is to convert all possible variations of Input into a consistent list of unicode values i can use as Key for the glyph map.

Phrogz
  • 296,393
  • 112
  • 651
  • 745
philipp
  • 15,947
  • 15
  • 61
  • 106

1 Answers1

0

Perhaps you could create a hidden element with automatic width (css width:auto), place your string into it, and then measure (perhaps with Mootools) the width of that element?

Lee Goddard
  • 10,680
  • 4
  • 46
  • 63
  • I just tried this, and it works perfectly - remember to set the font attributes correctly, or copy them from the element which is the final destination of the text being measured. – Lee Goddard Jul 09 '12 at 12:54