(data, start, size)
| 3048 | // Parse a `CFF` DICT object. |
| 3049 | // A dictionary contains key-value pairs in a compact tokenized format. |
| 3050 | function parseCFFDict(data, start, size) { |
| 3051 | start = start !== undefined ? start : 0; |
| 3052 | var parser = new parse.Parser(data, start); |
| 3053 | var entries = []; |
| 3054 | var operands = []; |
| 3055 | size = size !== undefined ? size : data.length; |
| 3056 | |
| 3057 | while (parser.relativeOffset < size) { |
| 3058 | var op = parser.parseByte(); |
| 3059 | |
| 3060 | // The first byte for each dict item distinguishes between operator (key) and operand (value). |
| 3061 | // Values <= 21 are operators. |
| 3062 | if (op <= 21) { |
| 3063 | // Two-byte operators have an initial escape byte of 12. |
| 3064 | if (op === 12) { |
| 3065 | op = 1200 + parser.parseByte(); |
| 3066 | } |
| 3067 | |
| 3068 | entries.push([op, operands]); |
| 3069 | operands = []; |
| 3070 | } else { |
| 3071 | // Since the operands (values) come before the operators (keys), we store all operands in a list |
| 3072 | // until we encounter an operator. |
| 3073 | operands.push(parseOperand(parser, op)); |
| 3074 | } |
| 3075 | } |
| 3076 | |
| 3077 | return entriesToObject(entries); |
| 3078 | } |
| 3079 | |
| 3080 | // Given a String Index (SID), return the value of the string. |
| 3081 | // Strings below index 392 are standard CFF strings and are not encoded in the font. |
no test coverage detected