dist/melonjs.js
function measureTextWidth(font, text) {
       var characters = text.split("");
       var width = 0;
       var lastGlyph = null;

       for (var i = 0; i < characters.length; i++) {
         var ch = characters[i].charCodeAt(0);
         var glyph = font.fontData.glyphs[ch];
         var kerning = lastGlyph && lastGlyph.kerning ? lastGlyph.getKerning(ch) : 0;
         width += (glyph.xadvance + kerning) * font.fontScale.x;
         lastGlyph = glyph;
       }

       return width;
     }
function measureTextWidth(font, text) {
       var characters = text.split("");
       var width = 0;
       var lastGlyph = null;

       for (var i = 0; i < characters.length; i++) {
         var ch = characters[i].charCodeAt(0);
         var glyph = font.fontData.glyphs[ch];
         var kerning = lastGlyph && lastGlyph.kerning ? lastGlyph.getKerning(ch) : 0;
         width += (glyph.xadvance + kerning) * font.fontScale.x;
         lastGlyph = glyph;
       }

       return width;
     }
function measureTextWidth ( font , text ) { var characters = text . split ( "" ) ; var width = 0 ; var lastGlyph = null ; for ( var i = 0 ; i < characters . length ; i ++ ) { var ch = characters [ i ] . charCodeAt ( 0 ) ; var glyph = font . fontData . glyphs [ ch ] ; var kerning = lastGlyph && lastGlyph . kerning ? lastGlyph . getKerning ( ch ) : 0 ; width += ( glyph . xadvance + kerning ) * font . fontScale . x ; lastGlyph = glyph ; } return width ; }
Measures the width of a single line of text, does not account for \n
@ignore
Measures the width of a single line of text does not account for \ n