mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Add more info for showText operator in stepper.
Adds a table that shows original char code, font char code, and unicode.
This commit is contained in:
parent
9165dc0659
commit
17f1857556
3 changed files with 43 additions and 13 deletions
|
@ -357,27 +357,38 @@ const Stepper = (function StepperClosure() {
|
|||
let decArgs = args;
|
||||
if (fn === "showText") {
|
||||
const glyphs = args[0];
|
||||
const newArgs = [];
|
||||
let str = [];
|
||||
const charCodeRow = c("tr");
|
||||
const fontCharRow = c("tr");
|
||||
const unicodeRow = c("tr");
|
||||
for (let j = 0; j < glyphs.length; j++) {
|
||||
const glyph = glyphs[j];
|
||||
if (typeof glyph === "object" && glyph !== null) {
|
||||
str.push(glyph.fontChar);
|
||||
charCodeRow.appendChild(c("td", glyph.originalCharCode));
|
||||
fontCharRow.appendChild(c("td", glyph.fontChar));
|
||||
unicodeRow.appendChild(c("td", glyph.unicode));
|
||||
} else {
|
||||
if (str.length > 0) {
|
||||
newArgs.push(str.join(""));
|
||||
str = [];
|
||||
}
|
||||
newArgs.push(glyph); // null or number
|
||||
// null or number
|
||||
const advanceEl = c("td", glyph);
|
||||
advanceEl.classList.add("advance");
|
||||
charCodeRow.appendChild(advanceEl);
|
||||
fontCharRow.appendChild(c("td"));
|
||||
unicodeRow.appendChild(c("td"));
|
||||
}
|
||||
}
|
||||
if (str.length > 0) {
|
||||
newArgs.push(str.join(""));
|
||||
}
|
||||
decArgs = [newArgs];
|
||||
decArgs = c("td");
|
||||
const table = c("table");
|
||||
table.classList.add("showText");
|
||||
decArgs.appendChild(table);
|
||||
table.appendChild(charCodeRow);
|
||||
table.appendChild(fontCharRow);
|
||||
table.appendChild(unicodeRow);
|
||||
}
|
||||
line.appendChild(c("td", fn));
|
||||
line.appendChild(c("td", JSON.stringify(simplifyArgs(decArgs))));
|
||||
if (decArgs instanceof HTMLElement) {
|
||||
line.appendChild(decArgs);
|
||||
} else {
|
||||
line.appendChild(c("td", JSON.stringify(simplifyArgs(decArgs))));
|
||||
}
|
||||
}
|
||||
if (operatorsToDisplay < operatorList.fnArray.length) {
|
||||
const lastCell = c("td", "...");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue