gatherCFFTopDicts function

dynamic gatherCFFTopDicts(
  1. dynamic data,
  2. dynamic start,
  3. dynamic cffIndex,
  4. dynamic strings,
)

Implementation

gatherCFFTopDicts(data, start, cffIndex, strings) {
  var topDictArray = [];
  for (var iTopDict = 0; iTopDict < cffIndex.length; iTopDict += 1) {
    // var topDictData = new DataView(new Uint8Array(cffIndex[iTopDict]).buffer);

    List<int> _list = List<int>.from(cffIndex[iTopDict]);
    var topDictData = ByteData.view(Uint8List.fromList(_list).buffer);

    Map<String, dynamic> topDict = parseCFFTopDict(topDictData, strings);
    topDict["_subrs"] = [];
    topDict["_subrsBias"] = 0;
    topDict["_defaultWidthX"] = 0;
    topDict["_nominalWidthX"] = 0;
    var privateSize = topDict["private"][0];
    var privateOffset = topDict["private"][1];
    if (privateSize != 0 && privateOffset != 0) {
      var privateDict = parseCFFPrivateDict(
          data, privateOffset + start, privateSize, strings);
      topDict["_defaultWidthX"] = privateDict["defaultWidthX"];
      topDict["_nominalWidthX"] = privateDict["nominalWidthX"];
      if (privateDict["subrs"] != 0) {
        var subrOffset = privateOffset + privateDict["subrs"];
        var subrIndex = parseCFFIndex(data, subrOffset + start, null);
        topDict["_subrs"] = subrIndex.objects;
        topDict["_subrsBias"] = calcCFFSubroutineBias(topDict["_subrs"]);
      }
      topDict["_privateDict"] = privateDict;
    }
    topDictArray.add(topDict);
  }
  return topDictArray;
}