emf-converter 4.18.1 → 4.18.2
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/README.md +5 -0
- package/dist/browser.js +31 -7
- package/dist/browser.mjs +31 -7
- package/dist/index.d.mts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +31 -7
- package/dist/index.mjs +31 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -144,6 +144,11 @@ Without `fonts`, text is drawn by the host's canvas font engine (supply `fontFam
|
|
|
144
144
|
|
|
145
145
|
#### `EmfConvertOptions`
|
|
146
146
|
|
|
147
|
+
`wmfAnsiCodePage` sets the known ANSI code page of a WMF playback device
|
|
148
|
+
(for example, `936` from Windows `GetACP()`). It applies to ANSI/DEFAULT text
|
|
149
|
+
and ANSI font face names. Its default is `1252`; explicit text charsets and
|
|
150
|
+
EMF text are unchanged. See the [API reference](docs/api.md) for supported values.
|
|
151
|
+
|
|
147
152
|
| Field | Type | Default | Description |
|
|
148
153
|
| -------------------- | ------------------------------------- | ----------------- | ----------- |
|
|
149
154
|
| `maxWidth` | `number` | None | Maximum output width in pixels (aspect ratio preserved) |
|
package/dist/browser.js
CHANGED
|
@@ -36223,7 +36223,25 @@ var CHARSET_ENCODING = {
|
|
|
36223
36223
|
238: "windows-1250",
|
|
36224
36224
|
255: "ibm437"
|
|
36225
36225
|
};
|
|
36226
|
-
|
|
36226
|
+
var ANSI_CODE_PAGE_ENCODING = {
|
|
36227
|
+
874: "windows-874",
|
|
36228
|
+
932: "shift_jis",
|
|
36229
|
+
936: "gbk",
|
|
36230
|
+
949: "euc-kr",
|
|
36231
|
+
950: "big5",
|
|
36232
|
+
1250: "windows-1250",
|
|
36233
|
+
1251: "windows-1251",
|
|
36234
|
+
1252: "windows-1252",
|
|
36235
|
+
1253: "windows-1253",
|
|
36236
|
+
1254: "windows-1254",
|
|
36237
|
+
1255: "windows-1255",
|
|
36238
|
+
1256: "windows-1256",
|
|
36239
|
+
1257: "windows-1257",
|
|
36240
|
+
1258: "windows-1258",
|
|
36241
|
+
54936: "gb18030",
|
|
36242
|
+
65001: "utf-8"
|
|
36243
|
+
};
|
|
36244
|
+
function decodeAnsiRecord(bytes, charSet, ansiCodePage) {
|
|
36227
36245
|
if (charSet === 2) {
|
|
36228
36246
|
return { codes: [...bytes], byteLengths: bytes.map(() => 1) };
|
|
36229
36247
|
}
|
|
@@ -36244,10 +36262,13 @@ function decodeAnsiRecord(bytes, charSet) {
|
|
|
36244
36262
|
}
|
|
36245
36263
|
return { codes, byteLengths };
|
|
36246
36264
|
}
|
|
36247
|
-
const label = CHARSET_ENCODING[charSet] ?? "windows-1252";
|
|
36265
|
+
const label = (charSet === 0 || charSet === 1) && ansiCodePage !== void 0 ? ANSI_CODE_PAGE_ENCODING[ansiCodePage] ?? "windows-1252" : CHARSET_ENCODING[charSet] ?? "windows-1252";
|
|
36266
|
+
if (label === "windows-1252") {
|
|
36267
|
+
return { codes: bytes.map((b) => ansiToCode(b, charSet)), byteLengths: bytes.map(() => 1) };
|
|
36268
|
+
}
|
|
36248
36269
|
try {
|
|
36249
|
-
const decoder = new TextDecoder(label, { fatal: true });
|
|
36250
|
-
const replacementDecoder = new TextDecoder(label);
|
|
36270
|
+
const decoder = new TextDecoder(label, { fatal: true, ignoreBOM: true });
|
|
36271
|
+
const replacementDecoder = new TextDecoder(label, { ignoreBOM: true });
|
|
36251
36272
|
const source = new Uint8Array(bytes);
|
|
36252
36273
|
const codes = [];
|
|
36253
36274
|
const byteLengths = [];
|
|
@@ -41506,14 +41527,15 @@ function createFont(p, dataOff, recSize, recEnd) {
|
|
|
41506
41527
|
addObject(p, { kind: "other" });
|
|
41507
41528
|
return;
|
|
41508
41529
|
}
|
|
41509
|
-
|
|
41530
|
+
const faceBytes = [];
|
|
41510
41531
|
for (let i = 0; i < 32 && dataOff + 18 + i < recEnd; i++) {
|
|
41511
41532
|
const ch = view.getUint8(dataOff + 18 + i);
|
|
41512
41533
|
if (ch === 0) {
|
|
41513
41534
|
break;
|
|
41514
41535
|
}
|
|
41515
|
-
|
|
41536
|
+
faceBytes.push(ch);
|
|
41516
41537
|
}
|
|
41538
|
+
const family = String.fromCharCode(...decodeAnsiRecord(faceBytes, 1, p.ansiCodePage).codes);
|
|
41517
41539
|
const font = {
|
|
41518
41540
|
kind: "font",
|
|
41519
41541
|
// Sign kept: resolveFontPixelHeight() tells cell from character height by it.
|
|
@@ -42540,7 +42562,7 @@ function drawWithFontEngine2(p, call, codes, dx) {
|
|
|
42540
42562
|
}
|
|
42541
42563
|
function playText(p, call) {
|
|
42542
42564
|
const charSet = p.rCtx.state.fontDetails?.charSet ?? 1;
|
|
42543
|
-
const { codes, byteLengths } = decodeAnsiRecord(call.bytes, charSet);
|
|
42565
|
+
const { codes, byteLengths } = decodeAnsiRecord(call.bytes, charSet, p.ansiCodePage);
|
|
42544
42566
|
const n = codes.length;
|
|
42545
42567
|
if (n === 0) {
|
|
42546
42568
|
return;
|
|
@@ -42672,6 +42694,7 @@ function createWmfPlayer(view, ctx, header, canvasW, canvasH, replayOptions = {}
|
|
|
42672
42694
|
};
|
|
42673
42695
|
const p = {
|
|
42674
42696
|
rCtx,
|
|
42697
|
+
ansiCodePage: replayOptions.wmfAnsiCodePage,
|
|
42675
42698
|
view,
|
|
42676
42699
|
kx,
|
|
42677
42700
|
ky,
|
|
@@ -43203,6 +43226,7 @@ async function replayMetafile(buffer, options2, createSurface) {
|
|
|
43203
43226
|
surface.ctx.save();
|
|
43204
43227
|
replayWmfRecords(view, surface.ctx, header, surface.width, surface.height, {
|
|
43205
43228
|
wmfReferenceDpi: opts.wmfReferenceDpi,
|
|
43229
|
+
wmfAnsiCodePage: opts.wmfAnsiCodePage,
|
|
43206
43230
|
maxRecords: opts.maxRecords,
|
|
43207
43231
|
fontFamilyMap: opts.fontFamilyMap,
|
|
43208
43232
|
gdiAntialias: opts.gdiAntialias,
|
package/dist/browser.mjs
CHANGED
|
@@ -36221,7 +36221,25 @@ var CHARSET_ENCODING = {
|
|
|
36221
36221
|
238: "windows-1250",
|
|
36222
36222
|
255: "ibm437"
|
|
36223
36223
|
};
|
|
36224
|
-
|
|
36224
|
+
var ANSI_CODE_PAGE_ENCODING = {
|
|
36225
|
+
874: "windows-874",
|
|
36226
|
+
932: "shift_jis",
|
|
36227
|
+
936: "gbk",
|
|
36228
|
+
949: "euc-kr",
|
|
36229
|
+
950: "big5",
|
|
36230
|
+
1250: "windows-1250",
|
|
36231
|
+
1251: "windows-1251",
|
|
36232
|
+
1252: "windows-1252",
|
|
36233
|
+
1253: "windows-1253",
|
|
36234
|
+
1254: "windows-1254",
|
|
36235
|
+
1255: "windows-1255",
|
|
36236
|
+
1256: "windows-1256",
|
|
36237
|
+
1257: "windows-1257",
|
|
36238
|
+
1258: "windows-1258",
|
|
36239
|
+
54936: "gb18030",
|
|
36240
|
+
65001: "utf-8"
|
|
36241
|
+
};
|
|
36242
|
+
function decodeAnsiRecord(bytes, charSet, ansiCodePage) {
|
|
36225
36243
|
if (charSet === 2) {
|
|
36226
36244
|
return { codes: [...bytes], byteLengths: bytes.map(() => 1) };
|
|
36227
36245
|
}
|
|
@@ -36242,10 +36260,13 @@ function decodeAnsiRecord(bytes, charSet) {
|
|
|
36242
36260
|
}
|
|
36243
36261
|
return { codes, byteLengths };
|
|
36244
36262
|
}
|
|
36245
|
-
const label = CHARSET_ENCODING[charSet] ?? "windows-1252";
|
|
36263
|
+
const label = (charSet === 0 || charSet === 1) && ansiCodePage !== void 0 ? ANSI_CODE_PAGE_ENCODING[ansiCodePage] ?? "windows-1252" : CHARSET_ENCODING[charSet] ?? "windows-1252";
|
|
36264
|
+
if (label === "windows-1252") {
|
|
36265
|
+
return { codes: bytes.map((b) => ansiToCode(b, charSet)), byteLengths: bytes.map(() => 1) };
|
|
36266
|
+
}
|
|
36246
36267
|
try {
|
|
36247
|
-
const decoder = new TextDecoder(label, { fatal: true });
|
|
36248
|
-
const replacementDecoder = new TextDecoder(label);
|
|
36268
|
+
const decoder = new TextDecoder(label, { fatal: true, ignoreBOM: true });
|
|
36269
|
+
const replacementDecoder = new TextDecoder(label, { ignoreBOM: true });
|
|
36249
36270
|
const source = new Uint8Array(bytes);
|
|
36250
36271
|
const codes = [];
|
|
36251
36272
|
const byteLengths = [];
|
|
@@ -41504,14 +41525,15 @@ function createFont(p, dataOff, recSize, recEnd) {
|
|
|
41504
41525
|
addObject(p, { kind: "other" });
|
|
41505
41526
|
return;
|
|
41506
41527
|
}
|
|
41507
|
-
|
|
41528
|
+
const faceBytes = [];
|
|
41508
41529
|
for (let i = 0; i < 32 && dataOff + 18 + i < recEnd; i++) {
|
|
41509
41530
|
const ch = view.getUint8(dataOff + 18 + i);
|
|
41510
41531
|
if (ch === 0) {
|
|
41511
41532
|
break;
|
|
41512
41533
|
}
|
|
41513
|
-
|
|
41534
|
+
faceBytes.push(ch);
|
|
41514
41535
|
}
|
|
41536
|
+
const family = String.fromCharCode(...decodeAnsiRecord(faceBytes, 1, p.ansiCodePage).codes);
|
|
41515
41537
|
const font = {
|
|
41516
41538
|
kind: "font",
|
|
41517
41539
|
// Sign kept: resolveFontPixelHeight() tells cell from character height by it.
|
|
@@ -42538,7 +42560,7 @@ function drawWithFontEngine2(p, call, codes, dx) {
|
|
|
42538
42560
|
}
|
|
42539
42561
|
function playText(p, call) {
|
|
42540
42562
|
const charSet = p.rCtx.state.fontDetails?.charSet ?? 1;
|
|
42541
|
-
const { codes, byteLengths } = decodeAnsiRecord(call.bytes, charSet);
|
|
42563
|
+
const { codes, byteLengths } = decodeAnsiRecord(call.bytes, charSet, p.ansiCodePage);
|
|
42542
42564
|
const n = codes.length;
|
|
42543
42565
|
if (n === 0) {
|
|
42544
42566
|
return;
|
|
@@ -42670,6 +42692,7 @@ function createWmfPlayer(view, ctx, header, canvasW, canvasH, replayOptions = {}
|
|
|
42670
42692
|
};
|
|
42671
42693
|
const p = {
|
|
42672
42694
|
rCtx,
|
|
42695
|
+
ansiCodePage: replayOptions.wmfAnsiCodePage,
|
|
42673
42696
|
view,
|
|
42674
42697
|
kx,
|
|
42675
42698
|
ky,
|
|
@@ -43201,6 +43224,7 @@ async function replayMetafile(buffer, options2, createSurface) {
|
|
|
43201
43224
|
surface.ctx.save();
|
|
43202
43225
|
replayWmfRecords(view, surface.ctx, header, surface.width, surface.height, {
|
|
43203
43226
|
wmfReferenceDpi: opts.wmfReferenceDpi,
|
|
43227
|
+
wmfAnsiCodePage: opts.wmfAnsiCodePage,
|
|
43204
43228
|
maxRecords: opts.maxRecords,
|
|
43205
43229
|
fontFamilyMap: opts.fontFamilyMap,
|
|
43206
43230
|
gdiAntialias: opts.gdiAntialias,
|
package/dist/index.d.mts
CHANGED
|
@@ -113,6 +113,14 @@ interface EmfConvertOptions {
|
|
|
113
113
|
x: number;
|
|
114
114
|
y: number;
|
|
115
115
|
};
|
|
116
|
+
/**
|
|
117
|
+
* ANSI code page of the WMF playback device. Used for ANSI/DEFAULT
|
|
118
|
+
* charset text and LOGFONT face names. Defaults to 1252; supply the
|
|
119
|
+
* original Windows device's GetACP() value when known. Supported values:
|
|
120
|
+
* 874, 932, 936, 949, 950, 1250..1258, 54936 and 65001. Other values
|
|
121
|
+
* fall back to 1252. Explicit text charsets and EMF text are unchanged.
|
|
122
|
+
*/
|
|
123
|
+
wmfAnsiCodePage?: number;
|
|
116
124
|
/** Maximum output width in pixels. */
|
|
117
125
|
maxWidth?: number;
|
|
118
126
|
/** Maximum output height in pixels. */
|
package/dist/index.d.ts
CHANGED
|
@@ -113,6 +113,14 @@ interface EmfConvertOptions {
|
|
|
113
113
|
x: number;
|
|
114
114
|
y: number;
|
|
115
115
|
};
|
|
116
|
+
/**
|
|
117
|
+
* ANSI code page of the WMF playback device. Used for ANSI/DEFAULT
|
|
118
|
+
* charset text and LOGFONT face names. Defaults to 1252; supply the
|
|
119
|
+
* original Windows device's GetACP() value when known. Supported values:
|
|
120
|
+
* 874, 932, 936, 949, 950, 1250..1258, 54936 and 65001. Other values
|
|
121
|
+
* fall back to 1252. Explicit text charsets and EMF text are unchanged.
|
|
122
|
+
*/
|
|
123
|
+
wmfAnsiCodePage?: number;
|
|
116
124
|
/** Maximum output width in pixels. */
|
|
117
125
|
maxWidth?: number;
|
|
118
126
|
/** Maximum output height in pixels. */
|
package/dist/index.js
CHANGED
|
@@ -36224,7 +36224,25 @@ var CHARSET_ENCODING = {
|
|
|
36224
36224
|
238: "windows-1250",
|
|
36225
36225
|
255: "ibm437"
|
|
36226
36226
|
};
|
|
36227
|
-
|
|
36227
|
+
var ANSI_CODE_PAGE_ENCODING = {
|
|
36228
|
+
874: "windows-874",
|
|
36229
|
+
932: "shift_jis",
|
|
36230
|
+
936: "gbk",
|
|
36231
|
+
949: "euc-kr",
|
|
36232
|
+
950: "big5",
|
|
36233
|
+
1250: "windows-1250",
|
|
36234
|
+
1251: "windows-1251",
|
|
36235
|
+
1252: "windows-1252",
|
|
36236
|
+
1253: "windows-1253",
|
|
36237
|
+
1254: "windows-1254",
|
|
36238
|
+
1255: "windows-1255",
|
|
36239
|
+
1256: "windows-1256",
|
|
36240
|
+
1257: "windows-1257",
|
|
36241
|
+
1258: "windows-1258",
|
|
36242
|
+
54936: "gb18030",
|
|
36243
|
+
65001: "utf-8"
|
|
36244
|
+
};
|
|
36245
|
+
function decodeAnsiRecord(bytes, charSet, ansiCodePage) {
|
|
36228
36246
|
if (charSet === 2) {
|
|
36229
36247
|
return { codes: [...bytes], byteLengths: bytes.map(() => 1) };
|
|
36230
36248
|
}
|
|
@@ -36245,10 +36263,13 @@ function decodeAnsiRecord(bytes, charSet) {
|
|
|
36245
36263
|
}
|
|
36246
36264
|
return { codes, byteLengths };
|
|
36247
36265
|
}
|
|
36248
|
-
const label = CHARSET_ENCODING[charSet] ?? "windows-1252";
|
|
36266
|
+
const label = (charSet === 0 || charSet === 1) && ansiCodePage !== void 0 ? ANSI_CODE_PAGE_ENCODING[ansiCodePage] ?? "windows-1252" : CHARSET_ENCODING[charSet] ?? "windows-1252";
|
|
36267
|
+
if (label === "windows-1252") {
|
|
36268
|
+
return { codes: bytes.map((b) => ansiToCode(b, charSet)), byteLengths: bytes.map(() => 1) };
|
|
36269
|
+
}
|
|
36249
36270
|
try {
|
|
36250
|
-
const decoder = new TextDecoder(label, { fatal: true });
|
|
36251
|
-
const replacementDecoder = new TextDecoder(label);
|
|
36271
|
+
const decoder = new TextDecoder(label, { fatal: true, ignoreBOM: true });
|
|
36272
|
+
const replacementDecoder = new TextDecoder(label, { ignoreBOM: true });
|
|
36252
36273
|
const source = new Uint8Array(bytes);
|
|
36253
36274
|
const codes = [];
|
|
36254
36275
|
const byteLengths = [];
|
|
@@ -41507,14 +41528,15 @@ function createFont(p, dataOff, recSize, recEnd) {
|
|
|
41507
41528
|
addObject(p, { kind: "other" });
|
|
41508
41529
|
return;
|
|
41509
41530
|
}
|
|
41510
|
-
|
|
41531
|
+
const faceBytes = [];
|
|
41511
41532
|
for (let i = 0; i < 32 && dataOff + 18 + i < recEnd; i++) {
|
|
41512
41533
|
const ch = view.getUint8(dataOff + 18 + i);
|
|
41513
41534
|
if (ch === 0) {
|
|
41514
41535
|
break;
|
|
41515
41536
|
}
|
|
41516
|
-
|
|
41537
|
+
faceBytes.push(ch);
|
|
41517
41538
|
}
|
|
41539
|
+
const family = String.fromCharCode(...decodeAnsiRecord(faceBytes, 1, p.ansiCodePage).codes);
|
|
41518
41540
|
const font = {
|
|
41519
41541
|
kind: "font",
|
|
41520
41542
|
// Sign kept: resolveFontPixelHeight() tells cell from character height by it.
|
|
@@ -42541,7 +42563,7 @@ function drawWithFontEngine2(p, call, codes, dx) {
|
|
|
42541
42563
|
}
|
|
42542
42564
|
function playText(p, call) {
|
|
42543
42565
|
const charSet = p.rCtx.state.fontDetails?.charSet ?? 1;
|
|
42544
|
-
const { codes, byteLengths } = decodeAnsiRecord(call.bytes, charSet);
|
|
42566
|
+
const { codes, byteLengths } = decodeAnsiRecord(call.bytes, charSet, p.ansiCodePage);
|
|
42545
42567
|
const n = codes.length;
|
|
42546
42568
|
if (n === 0) {
|
|
42547
42569
|
return;
|
|
@@ -42673,6 +42695,7 @@ function createWmfPlayer(view, ctx, header, canvasW, canvasH, replayOptions = {}
|
|
|
42673
42695
|
};
|
|
42674
42696
|
const p = {
|
|
42675
42697
|
rCtx,
|
|
42698
|
+
ansiCodePage: replayOptions.wmfAnsiCodePage,
|
|
42676
42699
|
view,
|
|
42677
42700
|
kx,
|
|
42678
42701
|
ky,
|
|
@@ -43204,6 +43227,7 @@ async function replayMetafile(buffer, options2, createSurface) {
|
|
|
43204
43227
|
surface.ctx.save();
|
|
43205
43228
|
replayWmfRecords(view, surface.ctx, header, surface.width, surface.height, {
|
|
43206
43229
|
wmfReferenceDpi: opts.wmfReferenceDpi,
|
|
43230
|
+
wmfAnsiCodePage: opts.wmfAnsiCodePage,
|
|
43207
43231
|
maxRecords: opts.maxRecords,
|
|
43208
43232
|
fontFamilyMap: opts.fontFamilyMap,
|
|
43209
43233
|
gdiAntialias: opts.gdiAntialias,
|
package/dist/index.mjs
CHANGED
|
@@ -36222,7 +36222,25 @@ var CHARSET_ENCODING = {
|
|
|
36222
36222
|
238: "windows-1250",
|
|
36223
36223
|
255: "ibm437"
|
|
36224
36224
|
};
|
|
36225
|
-
|
|
36225
|
+
var ANSI_CODE_PAGE_ENCODING = {
|
|
36226
|
+
874: "windows-874",
|
|
36227
|
+
932: "shift_jis",
|
|
36228
|
+
936: "gbk",
|
|
36229
|
+
949: "euc-kr",
|
|
36230
|
+
950: "big5",
|
|
36231
|
+
1250: "windows-1250",
|
|
36232
|
+
1251: "windows-1251",
|
|
36233
|
+
1252: "windows-1252",
|
|
36234
|
+
1253: "windows-1253",
|
|
36235
|
+
1254: "windows-1254",
|
|
36236
|
+
1255: "windows-1255",
|
|
36237
|
+
1256: "windows-1256",
|
|
36238
|
+
1257: "windows-1257",
|
|
36239
|
+
1258: "windows-1258",
|
|
36240
|
+
54936: "gb18030",
|
|
36241
|
+
65001: "utf-8"
|
|
36242
|
+
};
|
|
36243
|
+
function decodeAnsiRecord(bytes, charSet, ansiCodePage) {
|
|
36226
36244
|
if (charSet === 2) {
|
|
36227
36245
|
return { codes: [...bytes], byteLengths: bytes.map(() => 1) };
|
|
36228
36246
|
}
|
|
@@ -36243,10 +36261,13 @@ function decodeAnsiRecord(bytes, charSet) {
|
|
|
36243
36261
|
}
|
|
36244
36262
|
return { codes, byteLengths };
|
|
36245
36263
|
}
|
|
36246
|
-
const label = CHARSET_ENCODING[charSet] ?? "windows-1252";
|
|
36264
|
+
const label = (charSet === 0 || charSet === 1) && ansiCodePage !== void 0 ? ANSI_CODE_PAGE_ENCODING[ansiCodePage] ?? "windows-1252" : CHARSET_ENCODING[charSet] ?? "windows-1252";
|
|
36265
|
+
if (label === "windows-1252") {
|
|
36266
|
+
return { codes: bytes.map((b) => ansiToCode(b, charSet)), byteLengths: bytes.map(() => 1) };
|
|
36267
|
+
}
|
|
36247
36268
|
try {
|
|
36248
|
-
const decoder = new TextDecoder(label, { fatal: true });
|
|
36249
|
-
const replacementDecoder = new TextDecoder(label);
|
|
36269
|
+
const decoder = new TextDecoder(label, { fatal: true, ignoreBOM: true });
|
|
36270
|
+
const replacementDecoder = new TextDecoder(label, { ignoreBOM: true });
|
|
36250
36271
|
const source = new Uint8Array(bytes);
|
|
36251
36272
|
const codes = [];
|
|
36252
36273
|
const byteLengths = [];
|
|
@@ -41505,14 +41526,15 @@ function createFont(p, dataOff, recSize, recEnd) {
|
|
|
41505
41526
|
addObject(p, { kind: "other" });
|
|
41506
41527
|
return;
|
|
41507
41528
|
}
|
|
41508
|
-
|
|
41529
|
+
const faceBytes = [];
|
|
41509
41530
|
for (let i = 0; i < 32 && dataOff + 18 + i < recEnd; i++) {
|
|
41510
41531
|
const ch = view.getUint8(dataOff + 18 + i);
|
|
41511
41532
|
if (ch === 0) {
|
|
41512
41533
|
break;
|
|
41513
41534
|
}
|
|
41514
|
-
|
|
41535
|
+
faceBytes.push(ch);
|
|
41515
41536
|
}
|
|
41537
|
+
const family = String.fromCharCode(...decodeAnsiRecord(faceBytes, 1, p.ansiCodePage).codes);
|
|
41516
41538
|
const font = {
|
|
41517
41539
|
kind: "font",
|
|
41518
41540
|
// Sign kept: resolveFontPixelHeight() tells cell from character height by it.
|
|
@@ -42539,7 +42561,7 @@ function drawWithFontEngine2(p, call, codes, dx) {
|
|
|
42539
42561
|
}
|
|
42540
42562
|
function playText(p, call) {
|
|
42541
42563
|
const charSet = p.rCtx.state.fontDetails?.charSet ?? 1;
|
|
42542
|
-
const { codes, byteLengths } = decodeAnsiRecord(call.bytes, charSet);
|
|
42564
|
+
const { codes, byteLengths } = decodeAnsiRecord(call.bytes, charSet, p.ansiCodePage);
|
|
42543
42565
|
const n = codes.length;
|
|
42544
42566
|
if (n === 0) {
|
|
42545
42567
|
return;
|
|
@@ -42671,6 +42693,7 @@ function createWmfPlayer(view, ctx, header, canvasW, canvasH, replayOptions = {}
|
|
|
42671
42693
|
};
|
|
42672
42694
|
const p = {
|
|
42673
42695
|
rCtx,
|
|
42696
|
+
ansiCodePage: replayOptions.wmfAnsiCodePage,
|
|
42674
42697
|
view,
|
|
42675
42698
|
kx,
|
|
42676
42699
|
ky,
|
|
@@ -43202,6 +43225,7 @@ async function replayMetafile(buffer, options2, createSurface) {
|
|
|
43202
43225
|
surface.ctx.save();
|
|
43203
43226
|
replayWmfRecords(view, surface.ctx, header, surface.width, surface.height, {
|
|
43204
43227
|
wmfReferenceDpi: opts.wmfReferenceDpi,
|
|
43228
|
+
wmfAnsiCodePage: opts.wmfAnsiCodePage,
|
|
43205
43229
|
maxRecords: opts.maxRecords,
|
|
43206
43230
|
fontFamilyMap: opts.fontFamilyMap,
|
|
43207
43231
|
gdiAntialias: opts.gdiAntialias,
|