Compare commits

..

No commits in common. "34136d7775c56f510728bd95b79ec65c84dff099" and "3da8901f2661a41f4b43688830f73a8a361b4924" have entirely different histories.

6 changed files with 33 additions and 31 deletions

8
package-lock.json generated
View File

@ -11,7 +11,7 @@
"@babel/preset-env": "^7.26.9", "@babel/preset-env": "^7.26.9",
"@babel/runtime": "^7.26.10", "@babel/runtime": "^7.26.10",
"@fluent/bundle": "^0.18.0", "@fluent/bundle": "^0.18.0",
"@fluent/dom": "^0.10.1", "@fluent/dom": "^0.10.0",
"@metalsmith/layouts": "^3.0.0", "@metalsmith/layouts": "^3.0.0",
"@metalsmith/markdown": "^1.10.0", "@metalsmith/markdown": "^1.10.0",
"@napi-rs/canvas": "^0.1.68", "@napi-rs/canvas": "^0.1.68",
@ -1917,9 +1917,9 @@
} }
}, },
"node_modules/@fluent/dom": { "node_modules/@fluent/dom": {
"version": "0.10.1", "version": "0.10.0",
"resolved": "https://registry.npmjs.org/@fluent/dom/-/dom-0.10.1.tgz", "resolved": "https://registry.npmjs.org/@fluent/dom/-/dom-0.10.0.tgz",
"integrity": "sha512-OySXxsR3hEkiE75dPXYXsTOk+rCCJ7u6kuz2oekXSwGPBSuwUaYWL/eWJR3kezjSPSwxvTdVOPj9sCcT8utECg==", "integrity": "sha512-31a+GJRg6Xhpw9IQ8yNiHhegd10g1DvC30TMSO52bFpjJVJqfQHTuLKFSORNR5xI1oyP4RU4lGLho9+HaC/pVQ==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {

View File

@ -6,7 +6,7 @@
"@babel/preset-env": "^7.26.9", "@babel/preset-env": "^7.26.9",
"@babel/runtime": "^7.26.10", "@babel/runtime": "^7.26.10",
"@fluent/bundle": "^0.18.0", "@fluent/bundle": "^0.18.0",
"@fluent/dom": "^0.10.1", "@fluent/dom": "^0.10.0",
"@metalsmith/layouts": "^3.0.0", "@metalsmith/layouts": "^3.0.0",
"@metalsmith/markdown": "^1.10.0", "@metalsmith/markdown": "^1.10.0",
"@napi-rs/canvas": "^0.1.68", "@napi-rs/canvas": "^0.1.68",

View File

@ -308,13 +308,13 @@ function compileType3Glyph(imgData) {
]); ]);
const width1 = width + 1; const width1 = width + 1;
const points = new Uint8Array(width1 * (height + 1)); let points = new Uint8Array(width1 * (height + 1));
let i, j, j0; let i, j, j0;
// decodes bit-packed mask data // decodes bit-packed mask data
const lineSize = (width + 7) & ~7; const lineSize = (width + 7) & ~7;
const data = new Uint8Array(lineSize * height); let data = new Uint8Array(lineSize * height),
let pos = 0; pos = 0;
for (const elem of imgData.data) { for (const elem of imgData.data) {
let mask = 128; let mask = 128;
while (mask > 0) { while (mask > 0) {
@ -406,11 +406,6 @@ function compileType3Glyph(imgData) {
const steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]); const steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]);
const path = new Path2D(); const path = new Path2D();
// the path shall be painted in [0..1]x[0..1] space
const { a, b, c, d, e, f } = new DOMMatrix()
.scaleSelf(1 / width, -1 / height)
.translateSelf(0, -height);
for (i = 0; count && i <= height; i++) { for (i = 0; count && i <= height; i++) {
let p = i * width1; let p = i * width1;
const end = p + width; const end = p + width;
@ -420,9 +415,7 @@ function compileType3Glyph(imgData) {
if (p === end) { if (p === end) {
continue; continue;
} }
let x = p % width1; path.moveTo(p % width1, i);
let y = i;
path.moveTo(a * x + c * y + e, b * x + d * y + f);
const p0 = p; const p0 = p;
let type = points[p]; let type = points[p];
@ -445,9 +438,7 @@ function compileType3Glyph(imgData) {
// set new type for "future hit" // set new type for "future hit"
points[p] &= (type >> 2) | (type << 2); points[p] &= (type >> 2) | (type << 2);
} }
x = p % width1; path.lineTo(p % width1, (p / width1) | 0);
y = (p / width1) | 0;
path.lineTo(a * x + c * y + e, b * x + d * y + f);
if (!points[p]) { if (!points[p]) {
--count; --count;
@ -456,7 +447,21 @@ function compileType3Glyph(imgData) {
--i; --i;
} }
return path; // Immediately release the, potentially large, `Uint8Array`s after parsing.
data = null;
points = null;
const drawOutline = function (c) {
c.save();
// the path shall be painted in [0..1]x[0..1] space
c.scale(1 / width, -1 / height);
c.translate(0, -height);
c.fill(path);
c.beginPath();
c.restore();
};
return drawOutline;
} }
class CanvasExtraState { class CanvasExtraState {
@ -2715,7 +2720,7 @@ class CanvasGraphics {
} }
if (glyph.compiled) { if (glyph.compiled) {
ctx.fill(glyph.compiled); glyph.compiled(ctx);
return; return;
} }
} }

View File

@ -158,6 +158,13 @@ class SignatureEditor extends DrawingEditor {
super.render(); super.render();
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
// TODO: remove this check once
// https://github.com/projectfluent/fluent.js/pull/640
// is merged and released.
this.div.setAttribute("data-l10n-attrs", "aria-description");
}
if (this._drawId === null) { if (this._drawId === null) {
if (this.#signatureData) { if (this.#signatureData) {
const { const {

View File

@ -1 +0,0 @@
https://bugzilla.mozilla.org/attachment.cgi?id=9254990

View File

@ -2834,15 +2834,6 @@
"rounds": 1, "rounds": 1,
"type": "eq" "type": "eq"
}, },
{
"id": "bug810214",
"file": "pdfs/bug810214.pdf",
"md5": "2b7243178f5dd5fd3edc7b6649e4bdf3",
"link": true,
"rounds": 1,
"lastPage": 1,
"type": "eq"
},
{ {
"id": "issue13372", "id": "issue13372",
"file": "pdfs/issue13372.pdf", "file": "pdfs/issue13372.pdf",