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

Method toUnicodeWithLength

src/fontbox/cmap/cmap.ts:116–125  ·  view source on GitHub ↗

* Map a character code to Unicode with explicit length. * @param code Character code value * @param length Original byte length of the code * @returns Unicode string, or undefined if not mapped

(code: number, length: number)

Source from the content-addressed store, hash-verified

114 * @returns Unicode string, or undefined if not mapped
115 */
116 toUnicodeWithLength(code: number, length: number): string | undefined {
117 switch (length) {
118 case 1:
119 return this.charToUnicodeOneByte.get(code);
120 case 2:
121 return this.charToUnicodeTwoBytes.get(code);
122 default:
123 return this.charToUnicodeMoreBytes.get(code);
124 }
125 }
126
127 /**
128 * Map character code bytes to Unicode.

Callers 3

toUnicodeMethod · 0.95
toUnicodeBytesMethod · 0.95
parser.test.tsFile · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected