MCPcopy Create free account
hub / github.com/LibPDF-js/core / parseComposite

Method parseComposite

src/fontbox/afm/parser.ts:458–489  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

456 }
457
458 private parseComposite(): Composite {
459 const partData = this.readLine();
460 const tokens = this.tokenize(partData);
461
462 let i = 0;
463
464 const cc = tokens[i++];
465
466 if (cc !== CC) {
467 throw new Error(`Expected '${CC}' actual='${cc}'`);
468 }
469
470 const name = tokens[i++];
471 const composite = createComposite(name);
472 const partCount = this.parseInt(tokens[i++]);
473
474 for (let j = 0; j < partCount; j++) {
475 const pcc = tokens[i++];
476
477 if (pcc !== PCC) {
478 throw new Error(`Expected '${PCC}' actual='${pcc}'`);
479 }
480
481 const partName = tokens[i++];
482 const x = this.parseInt(tokens[i++]);
483 const y = this.parseInt(tokens[i++]);
484
485 composite.parts.push(createCompositePart(partName, x, y));
486 }
487
488 return { name: composite.name, parts: composite.parts };
489 }
490
491 // Low-level parsing methods
492

Callers 1

parseCompositesMethod · 0.95

Calls 6

readLineMethod · 0.95
tokenizeMethod · 0.95
parseIntMethod · 0.95
createCompositeFunction · 0.90
createCompositePartFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected