function layout(dim, dimImageInfos, cellImageInfos) {
                var dimLength = dim.length; // the number of slices in this dimension
                var dimImageInfo = dimImageInfos.findImage(dimLength);
                var dimOffset = dimImageInfo.index;
                // calculate the total number of stroke indices in this dimension
                var totalStrokes = 0;
                for (var id = 0; id < dimLength; ++id) {
                  totalStrokes += dim[id].length;
                }

                // allocate space for the stroke indices
                var cellImageInfo = cellImageInfos.findImage(totalStrokes);

                // for each slice in the glyph
                for (var _i2 = 0; _i2 < dimLength; ++_i2) {
                  var strokeIndices = dim[_i2];
                  var _strokeCount = strokeIndices.length;
                  var cellLineIndex = cellImageInfo.index;

                  // write the offset and count into the glyph slice image
                  setPixel(
                    dimImageInfo,
                    cellLineIndex >> 7,
                    cellLineIndex & 0x7f,
                    _strokeCount >> 7,
                    _strokeCount & 0x7f
                  );

                  // for each stroke index in that slice
                  for (var iil = 0; iil < _strokeCount; ++iil) {
                    // write the stroke index into the slice's image
                    var strokeIndex = strokeIndices[iil] + strokeOffset;
                    setPixel(cellImageInfo, strokeIndex >> 7, strokeIndex & 0x7f, 0, 0);
                  }
                }

                return {
                  cellImageInfo: cellImageInfo,
                  dimOffset: dimOffset,
                  dimImageInfo: dimImageInfo
                };
              }
@function layout
@param {Number[][]} dim
@param {ImageInfo[]} dimImageInfos
@param {ImageInfo[]} cellImageInfos
@return {Object}

lays out the curves in a dimension (row or col) into two
images, one for the indices of the curves themselves, and
one containing the offset and length of those index spans.