Skip to content

Commit

Permalink
Fix broken symbol-rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Alhadis committed May 29, 2019
1 parent 4515bb4 commit c2bee4c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
23 changes: 18 additions & 5 deletions lib/postproc/phototypesetter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ export default class Phototypesetter {
case "pdf":
this.deviceName = deviceMode;
this.resolution = [72000, 1, 1, 1000];
this.fonts = ["TR", "TI", "TB", "TBI"];
this.fonts = ["TR", "TI", "TB", "S"];
this.glyphNames["−"] = "\\-";
delete this.glyphNames["="];
for(const glyph of '"+=@\\^_`|')
delete this.glyphNames[glyph];
break;

// Invalid/unrecognised emulation mode
Expand Down Expand Up @@ -195,14 +196,23 @@ export default class Phototypesetter {
code &= 0x3F;
if(code <= 0)
return console.error("Bad character code: " + code);
if(this.fontHalf)
code += 64;
if(this.fontHalf) code += 64;
if(4 === this.font) code += 128;
const char = charCodes[code];
if(!char)
return console.error("Unknown character: " + code);

let fontSwitched = true;
if(4 === this.font && -1 !== '@"\\^`′§‡'.indexOf(char))
this.output += `f${this.prevFont}\n`;
else if("☜" === char) this.output += "x font 6 ZDR\nf6\n";
else if("☞" === char) this.output += "x font 5 ZD\nf5\n";
else fontSwitched = false;
this.output += char in this.glyphNames
? `C${this.glyphNames[char]}\nw`
: `c${char}\nw`;
if(fontSwitched)
this.output += `f${this.font}\n`;
if(this.debug)
this.output += "\n";
}
Expand Down Expand Up @@ -276,8 +286,10 @@ export default class Phototypesetter {
? this.rail ? 4 : 3
: this.rail ? 2 : 1;

if(font !== +this.font)
if(font !== +this.font){
this.prevFont = this.font;
this.output += `f${this.font = font}\n`;
}
}
}

Expand All @@ -294,6 +306,7 @@ Object.assign(Phototypesetter.prototype, {
isCAT8: false,
page: 1,
pointSize: 0,
prevFont: 1,
x: 0,
y: 0,

Expand Down
2 changes: 1 addition & 1 deletion lib/postproc/tables/cat-codes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export default {
160: "_",
161: "\\",
162: "Ψ",
163: "", // Bell Labs logo
163: "?", // Bell Labs logo
164: "∞",
165: "γ",
166: "⊇",
Expand Down

0 comments on commit c2bee4c

Please sign in to comment.