code: function glyphDataSize(glyph) {
    // Ignore glyphs without outlines. These will get a length of zero in the “loca” table
    if (!glyph.contours.length) {
      return 0;
    }
  
    var result = 12; //glyph fixed properties
  
    result += glyph.contours.length * 2; //add contours
  
    _.forEach(glyph.ttf_x, function (x) {
      //add 1 or 2 bytes for each coordinate depending of its size
      result += ((-0xFF <= x && x <= 0xFF)) ? 1 : 2;
    });
  
    _.forEach(glyph.ttf_y, function (y) {
      //add 1 or 2 bytes for each coordinate depending of its size
      result += ((-0xFF <= y && y <= 0xFF)) ? 1 : 2;
    });
  
    // Add flags length to glyph size.
    result += glyph.ttf_flags.length;
  
    if (result % 4 !== 0) { // glyph size must be divisible by 4.
      result += 4 - result % 4;
    }
    return result;
  }
docs: calculates length of glyph data in GLYF table