Skip to content

Commit 8e2bfd4

Browse files
committed
Switch to Fira Code font for rendering UI, given that we already ship
it with Remotery and can guarantee the same rendering across platforms.
1 parent 92d246b commit 8e2bfd4

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

vis/Code/WebGLFont.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class glFont
1010
// Describe the font
1111
const font_size = 9;
1212
this.fontWidth = 5;
13-
this.fontHeight = 12;
14-
const font_face = "Consolas";
13+
this.fontHeight = 13;
14+
const font_face = "LocalFiraCode";
1515
const font_desc = font_size + "px " + font_face;
1616

1717
// Ensure the CSS font is loaded before we do any work with it
@@ -58,24 +58,19 @@ class glFont
5858
this.charContext.fillStyle = "black";
5959
this.charContext.clearRect(0, 0, width, height);
6060

61-
// Render the text
62-
this.charContext.font = font;
63-
this.charContext.textAlign = "left";
64-
this.charContext.textBaseline = "top";
65-
6661
// TODO(don): I don't know why this results in the crispest text!
6762
// Every pattern I've checked so far has thrown up no ideas... but it works, so it will do for now
68-
let offset = 0;
69-
if ("#$&0689BCDGHKNOPRSUbdefghknopqstuyz".includes(text))
63+
let offset = 0.25;
64+
if ("AFILMTWijmw4+{};\'#,.?!\"£*()".includes(text))
7065
{
71-
offset = 0.5;
72-
}
73-
else if ("TI".includes(text))
74-
{
75-
offset = 0.25;
66+
offset = 0.0;
7667
}
7768

78-
this.charContext.fillText(text, offset, 0.5);
69+
// Render the text
70+
this.charContext.font = font;
71+
this.charContext.textAlign = "left";
72+
this.charContext.textBaseline = "top";
73+
this.charContext.fillText(text, offset, 2.5);
7974
}
8075
}
8176

0 commit comments

Comments
 (0)