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

Method parseLiteralName

src/fontbox/cmap/parser.ts:97–189  ·  view source on GitHub ↗
(literal: LiteralName, result: CMap)

Source from the content-addressed store, hash-verified

95 }
96
97 private parseLiteralName(literal: LiteralName, result: CMap): void {
98 switch (literal.name) {
99 case "WMode": {
100 const next = this.parseNextToken();
101
102 if (typeof next === "number") {
103 result.wmode = next;
104 }
105
106 break;
107 }
108 case "CMapName": {
109 const next = this.parseNextToken();
110
111 if (isName(next)) {
112 result.name = next.name;
113 }
114
115 break;
116 }
117 case "CMapVersion": {
118 const next = this.parseNextToken();
119
120 if (typeof next === "number" || typeof next === "string") {
121 result.version = String(next);
122 }
123
124 break;
125 }
126 case "CMapType": {
127 const next = this.parseNextToken();
128
129 if (typeof next === "number") {
130 result.type = next;
131 }
132
133 break;
134 }
135 case "CIDSystemInfo": {
136 // CIDSystemInfo is followed by a dictionary with Registry, Ordering, Supplement
137 const next = this.parseNextToken();
138
139 if (next instanceof Map) {
140 const registry = next.get("Registry");
141
142 if (typeof registry === "string") {
143 result.registry = registry;
144 }
145
146 const ordering = next.get("Ordering");
147
148 if (typeof ordering === "string") {
149 result.ordering = ordering;
150 }
151
152 const supplement = next.get("Supplement");
153
154 if (typeof supplement === "number") {

Callers 1

parseMethod · 0.95

Calls 3

parseNextTokenMethod · 0.95
isNameFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected