examples/modules/text.js
// textwidth returns the width of a text string at the specified font and size.
textwidth returns the width of a text string at the specified font and size.
textwidth returns the width of a text string at the specified font and size .
function textWidth(s, f, size) {
  let tw = 0.0;
  for (let i = 0; i < s.length; i++) {
    const character = s.charCodeAt(i);
    const glyph = f.characterMap[character];
    if (glyph == -1) {
      continue; 
    }
    tw += size * f.glyphAdvances[glyph] / 65536.0;
  }
  return tw;
}
function textWidth ( s , f , size ) { let tw = 0.0 ; for ( let i = 0 ; i < s . length ; i ++ ) { const character = s . charCodeAt ( i ) ; const glyph = f . characterMap [ character ] ; if ( glyph == - 1 ) { continue ; } tw += size * f . glyphAdvances [ glyph ] / 65536.0 ; } return tw ; }
textwidth returns the width of a text string at the specified font and size.
textwidth returns the width of a text string at the specified font and size .
//glyph is undefined