Skip to content

Commit 39f3df7

Browse files
Update pdf.js
1 parent a6360fc commit 39f3df7

File tree

8 files changed

+5244
-5284
lines changed

8 files changed

+5244
-5284
lines changed

build/pdf.js

Lines changed: 2911 additions & 3002 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/pdf.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/pdf.sandbox.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/pdf.sandbox.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/pdf.worker.js

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,6 @@ exports.isSameOrigin = isSameOrigin;
735735
exports.isString = isString;
736736
exports.objectFromMap = objectFromMap;
737737
exports.objectSize = objectSize;
738-
exports.removeNullCharacters = removeNullCharacters;
739738
exports.setVerbosityLevel = setVerbosityLevel;
740739
exports.shadow = shadow;
741740
exports.string32 = string32;
@@ -1282,21 +1281,6 @@ class AbortException extends BaseException {
12821281
}
12831282

12841283
exports.AbortException = AbortException;
1285-
const NullCharactersRegExp = /\x00+/g;
1286-
const InvisibleCharactersRegExp = /[\x01-\x1F]/g;
1287-
1288-
function removeNullCharacters(str, replaceInvisible = false) {
1289-
if (typeof str !== "string") {
1290-
warn("The argument for removeNullCharacters must be a string.");
1291-
return str;
1292-
}
1293-
1294-
if (replaceInvisible) {
1295-
str = str.replace(InvisibleCharactersRegExp, " ");
1296-
}
1297-
1298-
return str.replace(NullCharactersRegExp, "");
1299-
}
13001284

13011285
function bytesToString(bytes) {
13021286
assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
@@ -23799,8 +23783,8 @@ class PartialEvaluator {
2379923783
return {
2380023784
str,
2380123785
dir: bidiResult.dir,
23802-
width: textChunk.totalWidth,
23803-
height: textChunk.totalHeight,
23786+
width: Math.abs(textChunk.totalWidth),
23787+
height: Math.abs(textChunk.totalHeight),
2380423788
transform: textChunk.transform,
2380523789
fontName: textChunk.fontName,
2380623790
hasEOL: textChunk.hasEOL
@@ -23866,8 +23850,9 @@ class PartialEvaluator {
2386623850
if (textState.font.vertical) {
2386723851
const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
2386823852
const advanceX = posX - lastPosX;
23853+
const textOrientation = Math.sign(textContentItem.height);
2386923854

23870-
if (advanceY < textContentItem.negativeSpaceMax) {
23855+
if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
2387123856
if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
2387223857
appendEOL();
2387323858
return;
@@ -23882,15 +23867,15 @@ class PartialEvaluator {
2388223867
return;
2388323868
}
2388423869

23885-
if (advanceY <= textContentItem.trackingSpaceMin) {
23870+
if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
2388623871
textContentItem.height += advanceY;
23887-
} else if (!addFakeSpaces(advanceY, textContentItem.prevTransform)) {
23872+
} else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
2388823873
if (textContentItem.str.length === 0) {
2388923874
textContent.items.push({
2389023875
str: " ",
2389123876
dir: "ltr",
2389223877
width: 0,
23893-
height: advanceY,
23878+
height: Math.abs(advanceY),
2389423879
transform: textContentItem.prevTransform,
2389523880
fontName: textContentItem.fontName,
2389623881
hasEOL: false
@@ -23905,8 +23890,9 @@ class PartialEvaluator {
2390523890

2390623891
const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
2390723892
const advanceY = posY - lastPosY;
23893+
const textOrientation = Math.sign(textContentItem.width);
2390823894

23909-
if (advanceX < textContentItem.negativeSpaceMax) {
23895+
if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
2391023896
if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
2391123897
appendEOL();
2391223898
return;
@@ -23921,14 +23907,14 @@ class PartialEvaluator {
2392123907
return;
2392223908
}
2392323909

23924-
if (advanceX <= textContentItem.trackingSpaceMin) {
23910+
if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
2392523911
textContentItem.width += advanceX;
23926-
} else if (!addFakeSpaces(advanceX, textContentItem.prevTransform)) {
23912+
} else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
2392723913
if (textContentItem.str.length === 0) {
2392823914
textContent.items.push({
2392923915
str: " ",
2393023916
dir: "ltr",
23931-
width: advanceX,
23917+
width: Math.abs(advanceX),
2393223918
height: 0,
2393323919
transform: textContentItem.prevTransform,
2393423920
fontName: textContentItem.fontName,
@@ -24039,8 +24025,8 @@ class PartialEvaluator {
2403924025
}
2404024026
}
2404124027

24042-
function addFakeSpaces(width, transf) {
24043-
if (textContentItem.spaceInFlowMin <= width && width <= textContentItem.spaceInFlowMax) {
24028+
function addFakeSpaces(width, transf, textOrientation) {
24029+
if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
2404424030
if (textContentItem.initialized) {
2404524031
textContentItem.str.push(" ");
2404624032
}
@@ -24060,8 +24046,8 @@ class PartialEvaluator {
2406024046
textContent.items.push({
2406124047
str: " ",
2406224048
dir: "ltr",
24063-
width,
24064-
height,
24049+
width: Math.abs(width),
24050+
height: Math.abs(height),
2406524051
transform: transf || getCurrentTextTransform(),
2406624052
fontName,
2406724053
hasEOL: false
@@ -73560,7 +73546,7 @@ Object.defineProperty(exports, "WorkerMessageHandler", ({
7356073546
var _worker = __w_pdfjs_require__(1);
7356173547

7356273548
const pdfjsVersion = '2.13.0';
73563-
const pdfjsBuild = 'f287c5f';
73549+
const pdfjsBuild = '8ac0ccc';
7356473550
})();
7356573551

7356673552
/******/ return __webpack_exports__;

build/pdf.worker.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)