parsePostTable function

dynamic parsePostTable(
  1. dynamic data,
  2. dynamic start
)

Implementation

parsePostTable(data, start) {
    Map<String, dynamic> post = {};
    var p = new Parser(data, start);
    post["version"] = p.parseVersion(null);
    post["italicAngle"] = p.parseFixed();
    post["underlinePosition"] = p.parseShort();
    post["underlineThickness"] = p.parseShort();
    post["isFixedPitch"] = p.parseULong();
    post["minMemType42"] = p.parseULong();
    post["maxMemType42"] = p.parseULong();
    post["minMemType1"] = p.parseULong();
    post["maxMemType1"] = p.parseULong();
    final _version = post["version"];
    if (_version == 1) {
      post["names"] = standardNames.sublist(0);
    } else if(_version == 2) {
      post["numberOfGlyphs"] = p.parseUShort();
      post["glyphNameIndex"] = List<num>.filled(post["numberOfGlyphs"], 0);
      for (var i = 0; i < post["numberOfGlyphs"]; i++) {
          post["glyphNameIndex"][i] = p.parseUShort();
      }

      post["names"] = [];
      for (var i = 0; i < post["numberOfGlyphs"]; i++) {
          if (post["glyphNameIndex"][i] >= standardNames.length) {
              var nameLength = p.parseChar();
              post["names"].add(p.parseString(nameLength));
          }
      }

    } else if(_version == 2.5) {

      post["numberOfGlyphs"] = p.parseUShort();
      post["offset"] = List<num>.filled(post["numberOfGlyphs"], 0);
      for (var i = 0; i < post["numberOfGlyphs"]; i++) {
        post["offset"][i] = p.parseChar();
      }
    }
    return post;
}