MCPcopy Create free account
hub / github.com/Code-Bullet/Jump-King / parseCFFIndex

Function parseCFFIndex

libraries/p5.js:2922–2955  ·  view source on GitHub ↗
(data, start, conversionFn)

Source from the content-addressed store, hash-verified

2920// Parse a `CFF` INDEX array.
2921// An index array consists of a list of offsets, then a list of objects at those offsets.
2922function parseCFFIndex(data, start, conversionFn) {
2923 //var i, objectOffset, endOffset;
2924 var offsets = [];
2925 var objects = [];
2926 var count = parse.getCard16(data, start);
2927 var i;
2928 var objectOffset;
2929 var endOffset;
2930 if (count !== 0) {
2931 var offsetSize = parse.getByte(data, start + 2);
2932 objectOffset = start + ((count + 1) * offsetSize) + 2;
2933 var pos = start + 3;
2934 for (i = 0; i < count + 1; i += 1) {
2935 offsets.push(parse.getOffset(data, pos, offsetSize));
2936 pos += offsetSize;
2937 }
2938
2939 // The total size of the index array is 4 header bytes + the value of the last offset.
2940 endOffset = objectOffset + offsets[count];
2941 } else {
2942 endOffset = start + 2;
2943 }
2944
2945 for (i = 0; i < offsets.length - 1; i += 1) {
2946 var value = parse.getBytes(data, objectOffset + offsets[i], objectOffset + offsets[i + 1]);
2947 if (conversionFn) {
2948 value = conversionFn(value);
2949 }
2950
2951 objects.push(value);
2952 }
2953
2954 return {objects: objects, startOffset: start, endOffset: endOffset};
2955}
2956
2957// Parse a `CFF` DICT real value.
2958function parseFloatOperand(parser) {

Callers 1

parseCFFTableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected