| 3024 | // Convert the entries returned by `parseDict` to a proper dictionary. |
| 3025 | // If a value is a list of one, it is unpacked. |
| 3026 | function entriesToObject(entries) { |
| 3027 | var o = {}; |
| 3028 | for (var i = 0; i < entries.length; i += 1) { |
| 3029 | var key = entries[i][0]; |
| 3030 | var values = entries[i][1]; |
| 3031 | var value; |
| 3032 | if (values.length === 1) { |
| 3033 | value = values[0]; |
| 3034 | } else { |
| 3035 | value = values; |
| 3036 | } |
| 3037 | |
| 3038 | if (o.hasOwnProperty(key)) { |
| 3039 | throw new Error('Object ' + o + ' already has key ' + key); |
| 3040 | } |
| 3041 | |
| 3042 | o[key] = value; |
| 3043 | } |
| 3044 | |
| 3045 | return o; |
| 3046 | } |
| 3047 | |
| 3048 | // Parse a `CFF` DICT object. |
| 3049 | // A dictionary contains key-value pairs in a compact tokenized format. |