emf-converter 1.4.2 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +10 -4
- package/dist/index.mjs +10 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3893,7 +3893,13 @@ function replayWmfRecords(view, ctx, header, canvasW, canvasH) {
|
|
|
3893
3893
|
const windowExt = { cx: logicalW, cy: logicalH };
|
|
3894
3894
|
const coord = createWmfCoord(windowOrg, windowExt, canvasW, canvasH);
|
|
3895
3895
|
const objectTable = /* @__PURE__ */ new Map();
|
|
3896
|
-
|
|
3896
|
+
const allocObjectSlot = () => {
|
|
3897
|
+
let slot = 0;
|
|
3898
|
+
while (objectTable.has(slot)) {
|
|
3899
|
+
slot++;
|
|
3900
|
+
}
|
|
3901
|
+
return slot;
|
|
3902
|
+
};
|
|
3897
3903
|
const state = defaultState();
|
|
3898
3904
|
const stateStack = [];
|
|
3899
3905
|
const wCtx = { view, ctx, state, coord };
|
|
@@ -3969,7 +3975,7 @@ function replayWmfRecords(view, ctx, header, canvasW, canvasH) {
|
|
|
3969
3975
|
break;
|
|
3970
3976
|
case META_CREATEPENINDIRECT:
|
|
3971
3977
|
if (recSize >= 16) {
|
|
3972
|
-
const slot =
|
|
3978
|
+
const slot = allocObjectSlot();
|
|
3973
3979
|
objectTable.set(slot, {
|
|
3974
3980
|
kind: "pen",
|
|
3975
3981
|
style: view.getUint16(dataOff, true) & 255,
|
|
@@ -3980,7 +3986,7 @@ function replayWmfRecords(view, ctx, header, canvasW, canvasH) {
|
|
|
3980
3986
|
break;
|
|
3981
3987
|
case META_CREATEBRUSHINDIRECT:
|
|
3982
3988
|
if (recSize >= 14) {
|
|
3983
|
-
const slot =
|
|
3989
|
+
const slot = allocObjectSlot();
|
|
3984
3990
|
objectTable.set(slot, {
|
|
3985
3991
|
kind: "brush",
|
|
3986
3992
|
style: view.getUint16(dataOff, true),
|
|
@@ -3998,7 +4004,7 @@ function replayWmfRecords(view, ctx, header, canvasW, canvasH) {
|
|
|
3998
4004
|
}
|
|
3999
4005
|
family += String.fromCharCode(ch);
|
|
4000
4006
|
}
|
|
4001
|
-
const slot =
|
|
4007
|
+
const slot = allocObjectSlot();
|
|
4002
4008
|
objectTable.set(slot, {
|
|
4003
4009
|
kind: "font",
|
|
4004
4010
|
height: Math.abs(view.getInt16(dataOff, true)),
|
package/dist/index.mjs
CHANGED
|
@@ -3891,7 +3891,13 @@ function replayWmfRecords(view, ctx, header, canvasW, canvasH) {
|
|
|
3891
3891
|
const windowExt = { cx: logicalW, cy: logicalH };
|
|
3892
3892
|
const coord = createWmfCoord(windowOrg, windowExt, canvasW, canvasH);
|
|
3893
3893
|
const objectTable = /* @__PURE__ */ new Map();
|
|
3894
|
-
|
|
3894
|
+
const allocObjectSlot = () => {
|
|
3895
|
+
let slot = 0;
|
|
3896
|
+
while (objectTable.has(slot)) {
|
|
3897
|
+
slot++;
|
|
3898
|
+
}
|
|
3899
|
+
return slot;
|
|
3900
|
+
};
|
|
3895
3901
|
const state = defaultState();
|
|
3896
3902
|
const stateStack = [];
|
|
3897
3903
|
const wCtx = { view, ctx, state, coord };
|
|
@@ -3967,7 +3973,7 @@ function replayWmfRecords(view, ctx, header, canvasW, canvasH) {
|
|
|
3967
3973
|
break;
|
|
3968
3974
|
case META_CREATEPENINDIRECT:
|
|
3969
3975
|
if (recSize >= 16) {
|
|
3970
|
-
const slot =
|
|
3976
|
+
const slot = allocObjectSlot();
|
|
3971
3977
|
objectTable.set(slot, {
|
|
3972
3978
|
kind: "pen",
|
|
3973
3979
|
style: view.getUint16(dataOff, true) & 255,
|
|
@@ -3978,7 +3984,7 @@ function replayWmfRecords(view, ctx, header, canvasW, canvasH) {
|
|
|
3978
3984
|
break;
|
|
3979
3985
|
case META_CREATEBRUSHINDIRECT:
|
|
3980
3986
|
if (recSize >= 14) {
|
|
3981
|
-
const slot =
|
|
3987
|
+
const slot = allocObjectSlot();
|
|
3982
3988
|
objectTable.set(slot, {
|
|
3983
3989
|
kind: "brush",
|
|
3984
3990
|
style: view.getUint16(dataOff, true),
|
|
@@ -3996,7 +4002,7 @@ function replayWmfRecords(view, ctx, header, canvasW, canvasH) {
|
|
|
3996
4002
|
}
|
|
3997
4003
|
family += String.fromCharCode(ch);
|
|
3998
4004
|
}
|
|
3999
|
-
const slot =
|
|
4005
|
+
const slot = allocObjectSlot();
|
|
4000
4006
|
objectTable.set(slot, {
|
|
4001
4007
|
kind: "font",
|
|
4002
4008
|
height: Math.abs(view.getInt16(dataOff, true)),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "emf-converter",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "Convert EMF/WMF metafile binaries to PNG data URLs using Canvas",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"canvas",
|
|
@@ -47,6 +47,6 @@
|
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"tsup": "^8.5.1",
|
|
49
49
|
"typescript": "^6.0.3",
|
|
50
|
-
"vitest": "^4.1.
|
|
50
|
+
"vitest": "^4.1.9"
|
|
51
51
|
}
|
|
52
52
|
}
|