From 5d1074c110d24878e312d8ed610aa2cf5c0ec9db Mon Sep 17 00:00:00 2001 From: Jani Pehkonen Date: Tue, 19 Sep 2017 23:43:23 +0300 Subject: [PATCH] Fix JBIG2 symbol offsets in text regions --- src/core/jbig2.js | 5 +++-- test/pdfs/.gitignore | 1 + test/pdfs/jbig2_symbol_offset.pdf | Bin 0 -> 1157 bytes test/test_manifest.json | 6 ++++++ 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 test/pdfs/jbig2_symbol_offset.pdf diff --git a/src/core/jbig2.js b/src/core/jbig2.js index 94b101260..b30bfb15c 100644 --- a/src/core/jbig2.js +++ b/src/core/jbig2.js @@ -552,8 +552,9 @@ var Jbig2Image = (function Jbig2ImageClosure() { (rdh >> 1) + rdy, false, refinementAt, decodingContext); } - var offsetT = t - ((referenceCorner & 1) ? 0 : symbolHeight); - var offsetS = currentS - ((referenceCorner & 2) ? symbolWidth : 0); + var offsetT = t - ((referenceCorner & 1) ? 0 : (symbolHeight - 1)); + var offsetS = currentS - + ((referenceCorner & 2) ? (symbolWidth - 1) : 0); var s2, t2, symbolRow; if (transposed) { // Place Symbol Bitmap from T1,S1 diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 080a6f510..2aeb08919 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -199,6 +199,7 @@ !issue6387.pdf !issue6410.pdf !issue8586.pdf +!jbig2_symbol_offset.pdf !gradientfill.pdf !bug903856.pdf !bug850854.pdf diff --git a/test/pdfs/jbig2_symbol_offset.pdf b/test/pdfs/jbig2_symbol_offset.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e653b42a7916d6c1024da3b0f8cb312db67e3174 GIT binary patch literal 1157 zcmZ`(&1(}u6i+bg5QNY^?Dt_xCf&KT9$z1nYf0UqFtc@ z#3iOGJw2*IJvWS_DzSY+=D8=(t2{j+!W1%*jzGo^sMG-&pw$^Fm}4W_=Q-SEUIoYq z^Lo92Z2|46Wd3&cAu|k;<(-Zg| zfVo*XxlCPVXZS3PYKWLAGa9qZ1SAbTnoOpWvQs4*@M+({Zpjt{3JEJtr}3hL>{baR zp-^?TFfm0Pfwn*fYdR!$sHM?v=8{H>Igm@#tB6T35@EDJ_|&ec%1s&A)U>E386wAc zREuk1B*8Q_aL@t?$xJz}Dp$feZn^#&sbtaKp%zoDaC@qQHQWjWMwp94^mq*K1C&)J zaSph0B*R2dq<)sy>fDokmD9=cD)-BE+riDt(HZ8@e&3!$MV?g!^??j!2K!?MLO_#49{IWNAQFq!3e54k@F?3nw{rZc z{`%!cVQkSF8@HbPn15b=Z=7f@VC>FA5av6B_g!ovkpl=F{<`w`*W2~`b^BH7_fm7= zKaHRD>2+1nz{1D2K*BWRCP+m~bPK{8c-xpR=PhLi7Ss0H#jL%Uk-&v-^EDGY>{Lbg pHmg!!{x^V>*)1w5k`m`QR9u$LjShtEi_H>JhWzJr_Z9N0@)xNzET8}Y literal 0 HcmV?d00001 diff --git a/test/test_manifest.json b/test/test_manifest.json index af3d64516..2823742f8 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -818,6 +818,12 @@ "type": "eq", "forms": true }, + { "id": "jbig2_symbol_offset", + "file": "pdfs/jbig2_symbol_offset.pdf", + "md5": "6b22a0f838008fa4d8cb5b40ba095c48", + "rounds": 1, + "type": "eq" + }, { "id": "bug1046314", "file": "pdfs/bug1046314.pdf", "md5": "fc658439f44cd2dd27c8bee7e7a8344e",