Proper handling for single and double byte characters

This commit is contained in:
Tom Z?hner
2020-01-11 09:30:47 +01:00
parent 8412bf8071
commit 7082413a3d
11 changed files with 5849 additions and 31 deletions
Generated Vendored
+16 -12
View File
@@ -669,18 +669,6 @@ var Parser = /** @class */ (function () {
result += value.text;
}
else if (value instanceof _Containers__WEBPACK_IMPORTED_MODULE_4__["HexText"]) {
var hex = value.hex;
if (this.parser.state.pap.charactertype === _Helper__WEBPACK_IMPORTED_MODULE_1__["Helper"].CHARACTER_TYPE.DOUBLE
|| (this.parser.state.pap.charactertype == null && hex >= 0x80)) {
// A reference check is sufficient for the chp instances,
// as they have to be the same if they belong to one character
if (i + 1 < text.length
&& text[i + 1] instanceof _Containers__WEBPACK_IMPORTED_MODULE_4__["HexText"] && text[i + 1].chp === value.chp) {
hex = hex * 0x100 + text[i + 1].hex;
// Don't process the following hex character twice
i++;
}
}
// Looking for current fonttbl charset
var codepage = this.parser.codepage;
if (value.chp.hasOwnProperty("fontfamily")) {
@@ -691,6 +679,22 @@ var Parser = /** @class */ (function () {
codepage = this.inst._fonts[idx].charset;
}
}
var hex = value.hex;
if (this.parser.state.pap.charactertype === _Helper__WEBPACK_IMPORTED_MODULE_1__["Helper"].CHARACTER_TYPE.DOUBLE
|| (this.parser.state.pap.charactertype == null && hex >= 0x80)) {
// A reference check is sufficient for the chp instances,
// as they have to be the same if they belong to one character
if (i + 1 < text.length
&& text[i + 1] instanceof _Containers__WEBPACK_IMPORTED_MODULE_4__["HexText"] && text[i + 1].chp === value.chp) {
var doubleByteCharacterHex = hex * 0x100 + text[i + 1].hex;
// Verify the double byte character is valid for this code page
if (codepage__WEBPACK_IMPORTED_MODULE_0___default.a[codepage].dec[doubleByteCharacterHex] !== undefined) {
hex = doubleByteCharacterHex;
// Don't process the following hex character twice
i++;
}
}
}
result += codepage__WEBPACK_IMPORTED_MODULE_0___default.a[codepage].dec[hex];
}
}
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+17 -13
View File
@@ -126,19 +126,6 @@ export class Parser {
if (value instanceof PlainText) {
result += value.text;
} else if (value instanceof HexText) {
let hex = value.hex;
if (this.parser.state.pap.charactertype === Helper.CHARACTER_TYPE.DOUBLE
|| (this.parser.state.pap.charactertype == null && hex >= 0x80)) {
// A reference check is sufficient for the chp instances,
// as they have to be the same if they belong to one character
if (i + 1 < text.length
&& text[i + 1] instanceof HexText && (text[i + 1] as HexText).chp === value.chp) {
hex = hex * 0x100 + (text[i + 1] as HexText).hex;
// Don't process the following hex character twice
i++;
}
}
// Looking for current fonttbl charset
let codepage = this.parser.codepage;
if (value.chp.hasOwnProperty("fontfamily")) {
@@ -150,6 +137,23 @@ export class Parser {
}
}
let hex = value.hex;
if (this.parser.state.pap.charactertype === Helper.CHARACTER_TYPE.DOUBLE
|| (this.parser.state.pap.charactertype == null && hex >= 0x80)) {
// A reference check is sufficient for the chp instances,
// as they have to be the same if they belong to one character
if (i + 1 < text.length
&& text[i + 1] instanceof HexText && (text[i + 1] as HexText).chp === value.chp) {
const doubleByteCharacterHex = hex * 0x100 + (text[i + 1] as HexText).hex;
// Verify the double byte character is valid for this code page
if (cptable[codepage].dec[doubleByteCharacterHex] !== undefined) {
hex = doubleByteCharacterHex;
// Don't process the following hex character twice
i++;
}
}
}
result += cptable[codepage].dec[hex];
}
}
@@ -0,0 +1,8 @@
{
"title": "Changing Keyboard language layout",
"author": "Shuji Hisaeda",
"operator": "Super Shuji",
"creatim": "1998-03-12T03:33:00.000Z",
"revtim": "1998-03-12T05:37:00.000Z",
"printim": "1998-03-12T04:17:00.000Z"
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff