Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The glyph has no Unicode value #16

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions src/core/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ class Annotation {
this.setColor(dict.getArray("C"));
this.setBorderStyle(dict);
this.setAppearance(dict);
this.initAppearancePos = this.appearance?.pos;
this.setOptionalContent(dict);

const MK = dict.get("MK");
Expand Down Expand Up @@ -921,8 +922,10 @@ class Annotation {
isUsingOwnCanvas,
]);

await evaluator.getOperatorList({
const [MCIDBBoxes, opPos, noMCIDBBoxes] = await evaluator.getOperatorList({
initStreamPos: this.initAppearancePos,
stream: appearance,
intent,
task,
resources,
operatorList: opList,
Expand All @@ -934,7 +937,15 @@ class Annotation {
opList.addOp(OPS.endMarkedContent, []);
}
this.reset();
return { opList, separateForm: false, separateCanvas: isUsingOwnCanvas };
return {
opList,
separateForm: false,
separateCanvas: isUsingOwnCanvas,
annotBBoxesAndOpPos: {
operationPosition: opPos,
boundingBoxes: [MCIDBBoxes, noMCIDBBoxes],
},
};
}

async save(evaluator, task, annotationStorage) {
Expand Down Expand Up @@ -1743,7 +1754,8 @@ class WidgetAnnotation extends Annotation {
]);

const stream = new StringStream(content);
await evaluator.getOperatorList({
const [MCIDBBoxes, opPos, noMCIDBBoxes] = await evaluator.getOperatorList({
intent,
stream,
task,
resources: this._fieldResources.mergedResources,
Expand All @@ -1754,7 +1766,15 @@ class WidgetAnnotation extends Annotation {
if (optionalContent !== undefined) {
opList.addOp(OPS.endMarkedContent, []);
}
return { opList, separateForm: false, separateCanvas: false };
return {
opList,
separateForm: false,
separateCanvas: false,
annotBBoxesAndOpPos: {
operationPosition: opPos,
boundingBoxes: [MCIDBBoxes, noMCIDBBoxes],
},
};
}

_getMKDict(rotation) {
Expand Down
12 changes: 11 additions & 1 deletion src/core/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ class Page {
intent & RenderingIntentFlag.ANNOTATIONS_DISABLE
) {
if (intent & RenderingIntentFlag.OPLIST) {
pageOpList.addOp(OPS.annotBBoxesAndOpPos, []);
pageOpList.addOp(OPS.operationPosition, positionByOperationIndex);
pageOpList.addOp(OPS.boundingBoxes, [MCIDBoundingBoxes, noMCIDBoundingBoxes]);
}
Expand Down Expand Up @@ -507,7 +508,8 @@ class Page {
let form = false,
canvas = false;

for (const { opList, separateForm, separateCanvas } of opLists) {
const annotationsBBoxesAndOperationPosition = [];
for (const { opList, separateForm, separateCanvas, annotBBoxesAndOpPos } of opLists) {
pageOpList.addOpList(opList);

if (separateForm) {
Expand All @@ -516,8 +518,16 @@ class Page {
if (separateCanvas) {
canvas = separateCanvas;
}

annotationsBBoxesAndOperationPosition.push(
annotBBoxesAndOpPos ? [
annotBBoxesAndOpPos.operationPosition,
annotBBoxesAndOpPos.boundingBoxes,
] : []
);
}
if (intent & RenderingIntentFlag.OPLIST) {
pageOpList.addOp(OPS.annotBBoxesAndOpPos, annotationsBBoxesAndOperationPosition);
pageOpList.addOp(OPS.operationPosition, positionByOperationIndex);
pageOpList.addOp(OPS.boundingBoxes, [
MCIDBoundingBoxes,
Expand Down
5 changes: 5 additions & 0 deletions src/core/evaluator.js
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,7 @@ class PartialEvaluator {
}

getOperatorList({
initStreamPos,
stream,
task,
resources,
Expand All @@ -1657,6 +1658,8 @@ class PartialEvaluator {
var self = this;
var xref = this.xref;
let parsingText = false;
let prevStreamPos;
if (initStreamPos != null) stream.pos = initStreamPos;
const localImageCache = new LocalImageCache();
const localColorSpaceCache = new LocalColorSpaceCache();
const localGStateCache = new LocalGStateCache();
Expand Down Expand Up @@ -1691,6 +1694,7 @@ class PartialEvaluator {
const operation = {};
let stop, i, ii, cs, name, isValidName;
while (!(stop = timeSlotManager.check())) {
if (prevStreamPos) stream.pos = prevStreamPos;
// The arguments parsed by read() are used beyond this loop, so we
// cannot reuse the same array on each iteration. Therefore we pass
// in |null| as the initial value (see the comment on
Expand All @@ -1703,6 +1707,7 @@ class PartialEvaluator {
let fn = operation.fn;
boundingBoxCalculator.incrementOperation(fn);

prevStreamPos = stream.pos;
switch (fn | 0) {
case OPS.paintXObject:
// eagerly compile XForm objects
Expand Down
3 changes: 2 additions & 1 deletion src/shared/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ const OPS = {
paintSolidColorImageMask: 90,
constructPath: 91,
boundingBoxes: 100,
operationPosition: 101
operationPosition: 101,
annotBBoxesAndOpPos: 102,
};

const UNSUPPORTED_FEATURES = {
Expand Down
Loading