Are the monospace fonts monospace?

Post Reply
User avatar
StephenHorn
Posts: 565
Joined: Tue Apr 28, 2020 12:00 am
Contact:

Are the monospace fonts monospace?

Post by StephenHorn »

A few tables:

Normal
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
| 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
| A | B | C | D | E | F | G | H | I | J |
| KLM | NOP | QRS | TUV | WXY | `Z' | zyx | wvu | tsr | qpo |
| n | m | l | k | j | i | h | g | f | e |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+

Code

Code: Select all

+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|   9   |   8   |   7   |   6   |   5   |   4   |   3   |   2   |   1   |   0   |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|   A   |   B   |   C   |   D   |   E   |   F   |   G   |   H   |   I   |   J   |
|  KLM  |  NOP  |  QRS  |  TUV  |  WXY  |  `Z'  |  zyx  |  wvu  |  tsr  |  qpo  |
|   n   |   m   |   l   |   k   |   j   |   i   |   h   |   g   |   f   |   e   |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
C64
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|   9   |   8   |   7   |   6   |   5   |   4   |   3   |   2   |   1   |   0   |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|   A   |   B   |   C   |   D   |   E   |   F   |   G   |   H   |   I   |   J   |
|  KLM  |  NOP  |  QRS  |  TUV  |  WXY  |  `Z'  |  zyx  |  wvu  |  tsr  |  qpo  |
|   n   |   m   |   l   |   k   |   j   |   i   |   h   |   g   |   f   |   e   |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+

X16
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|   9   |   8   |   7   |   6   |   5   |   4   |   3   |   2   |   1   |   0   |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|   A   |   B   |   C   |   D   |   E   |   F   |   G   |   H   |   I   |   J   |
|  KLM  |  NOP  |  QRS  |  TUV  |  WXY  |  `Z'  |  zyx  |  wvu  |  tsr  |  qpo  |
|   n   |   m   |   l   |   k   |   j   |   i   |   h   |   g   |   f   |   e   |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+

Mono

+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
| 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
| A | B | C | D | E | F | G | H | I | J |
| KLM | NOP | QRS | TUV | WXY | `Z' | zyx | wvu | tsr | qpo |
| n | m | l | k | j | i | h | g | f | e |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+



Unfortunately, it seems like the C64 and X16 fonts are not quite actually monospace. Kind of a bummer! Mono seems to eat extra whitespaces, but I don't see that as a real problem at the moment since it still seems good for inlined code-like examples.

If I found the same C64 font resource as the website is using, then it looks like they have a separate monospace font in addition to the one the website uses. For inlined text, I suppose I'd prefer the proportional font, but since it's a separate text block, it seems like it would be nice to use the monospace variant.
Developer for Box16, the other X16 emulator. (Box16 on GitHub)
I also accept pull requests for x16emu, the official X16 emulator. (x16-emulator on GitHub)
TomXP411
Posts: 1788
Joined: Tue May 19, 2020 8:49 pm

Re: Are the monospace fonts monospace?

Post by TomXP411 »

Huh. I'll have to review which font I used. I was pretty sure I picked the C64 Mono Pro, but it's possible I picked the other one.

As to the MONO tag... that's an issue, isn't it? Even though the font is monospaced, HTML still ignores additional whitespace, condensing it all down to one space. There should be a CSS style that will force the renderer to treat multiple spaces as multiple spaces.

Let me play with the styles a bit this weekend. If your tables suddenly line up like you expect, then it worked.
TomXP411
Posts: 1788
Joined: Tue May 19, 2020 8:49 pm

Re: Are the monospace fonts monospace?

Post by TomXP411 »

So MONO is a non-starter for tables, because the forum software adds a hard return and a <br/> on each newline in the post text. So I added the PRE tag. Let's test that.
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|   9   |   8   |   7   |   6   |   5   |   4   |   3   |   2   |   1   |   0   |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|   A   |   B   |   C   |   D   |   E   |   F   |   G   |   H   |   I   |   J   |
|  KLM  |  NOP  |  QRS  |  TUV  |  WXY  |  `Z'  |  zyx  |  wvu  |  tsr  |  qpo  |
|   n   |   m   |   l   |   k   |   j   |   i   |   h   |   g   |   f   |   e   |
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
The only issue with PRE is that you can't use it for
inline examples
, which is why I have the MONO tag - which uses <span> instead of <pre>
Post Reply