master.ttf

on-topic Acorn-related news and discussions not covered by the other forums
Post Reply
User avatar
ctr
Posts: 182
Joined: Wed Jul 16, 2014 2:53 pm
Contact:

master.ttf

Post by ctr » Wed Aug 29, 2018 8:07 pm

I was looking for a beeb true-type font but I couldn't find one with the original spacing so I made one.

Oddly, the Master font in the Welcome Guide is different from the font in the MOS 3.20 ROM in beebem. The former has an obvious error in Æ (and several other glitches) so I used the latter. The attached picture shows the differences.

The ttf contains all the Master characters and uses a Unicode encoding. This does mean that "ascii" text copied from a beeb will have a slightly unexpected appearance unless it is translated:
  • The character at 0x60 is the backtick `, not the £
  • The character at 0x7C is the vertical line |, not the broken line ¦
The font does retain the beeb's distinctive apostrophe at 0x27. The Master's straight apostrophe from 0xBA is mapped to U+2032 PRIME.

It also includes mappings for left and right single quotes, and I added some ugly left and right double quotes.

9pt text on a 96dpi screen is exactly 8x8 pixels.

A pdf sample is attached.

I've only tested this on Windows so I'd be interested to know if the font works on other platforms.

Edit: I've added mastermodes.zip with versions for the different screen modes. It is described further below.
Attachments
mastermodes.zip
(28.88 KiB) Downloaded 3 times
master.ttf.zip
(5.6 KiB) Downloaded 16 times
master.pdf
(9.54 KiB) Downloaded 11 times
difference.png
Last edited by ctr on Mon Nov 05, 2018 4:16 pm, edited 2 times in total.

scruss
Posts: 58
Joined: Sun Jul 01, 2018 3:12 pm
Location: Toronto
Contact:

Re: master.ttf

Post by scruss » Wed Aug 29, 2018 10:03 pm

Nice work!

Fontforge whinged mightily over the unusual Em-size (24; typically 1000 for PFB and OTF, 1024 for TTF) but I haven't seen any rendering problems yet.

User avatar
flaxcottage
Posts: 3300
Joined: Thu Dec 13, 2012 8:46 pm
Location: Derbyshire
Contact:

Re: master.ttf

Post by flaxcottage » Thu Aug 30, 2018 7:58 am

Coolio. =D> =D>
- John
Image

User avatar
ctr
Posts: 182
Joined: Wed Jul 16, 2014 2:53 pm
Contact:

Re: master.ttf

Post by ctr » Thu Aug 30, 2018 10:34 am

Cheers. 12 would have been a more natural em-size but true-type won't go below 16.

User avatar
Richard Russell
Posts: 526
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: master.ttf

Post by Richard Russell » Thu Aug 30, 2018 11:50 am

ctr wrote:
Wed Aug 29, 2018 8:07 pm
9pt text on a 96dpi screen is exactly 8x8 pixels.
I can't quite see how that works out. 9pt is 1/8" (72 points to an inch), so at 96dpi shouldn't that be 12 pixels? I appreciate that there may be an adjustment for leading.

tom_seddon
Posts: 216
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

Re: master.ttf

Post by tom_seddon » Thu Aug 30, 2018 4:55 pm

There's some slight fringing in OS X Emacs, I assume because of anti-aliasing.
Untitled.png
The font I normally use in Emacs (a version of the traditional 6x13 xterm font) is pixel-perfect, but I think it might be a bitmap one...

--Tom

User avatar
ctr
Posts: 182
Joined: Wed Jul 16, 2014 2:53 pm
Contact:

Re: master.ttf

Post by ctr » Thu Aug 30, 2018 5:00 pm

Richard Russell wrote:
Thu Aug 30, 2018 11:50 am
ctr wrote:
Wed Aug 29, 2018 8:07 pm
9pt text on a 96dpi screen is exactly 8x8 pixels.
I can't quite see how that works out. 9pt is 1/8" (72 points to an inch), so at 96dpi shouldn't that be 12 pixels? I appreciate that there may be an adjustment for leading.
Truetype scales the "em square" according to your calculation, but the glyphs can occupy any proportion of that square. I'm using an em square of 24 units and the outlines are 16 units square so the height is 16/24*12 pixels=8 pixels. It's all rather arbitrary. I chose this size because it roughly matches Courier New. I could have filled the em square, but the characters would look huge compared to anything else at the same point size.

The font doesn't have any leading. Descenders on one row meet capitals on the next to reproduce the beeb look.

User avatar
Richard Russell
Posts: 526
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: master.ttf

Post by Richard Russell » Thu Aug 30, 2018 5:58 pm

ctr wrote:
Thu Aug 30, 2018 5:00 pm
the glyphs can occupy any proportion of that square.
True, although a traditional typographer (and I was brought up with metal type) might raise an eyebrow!
The font doesn't have any leading. Descenders on one row meet capitals on the next to reproduce the beeb look.
I would have preferred it to reproduce the 'Beeb look' in MODEs 3 and 6 (the 'text' modes), in which the 'character cell' is 8 pixels wide by 10 pixels high.

User avatar
ctr
Posts: 182
Joined: Wed Jul 16, 2014 2:53 pm
Contact:

Re: master.ttf

Post by ctr » Thu Aug 30, 2018 6:01 pm

tom_seddon wrote:
Thu Aug 30, 2018 4:55 pm
There's some slight fringing in OS X Emacs, I assume because of anti-aliasing.
On Windows, horizontal fringing seems unavoidable in apps that use sub-pixel anti-aliasing, but it's perfect with regular anti-aliasing. The horizontal fringing is not as rough as your OS X example though.

What point size are you using? Assuming Mac's still use 72dpi (they did thirty years ago!), I think it should work best with 9*96/72=12pt text.
Attachments
aliasing.png

User avatar
ctr
Posts: 182
Joined: Wed Jul 16, 2014 2:53 pm
Contact:

Re: master.ttf

Post by ctr » Thu Aug 30, 2018 11:39 pm

Richard Russell wrote:
Thu Aug 30, 2018 5:58 pm
ctr wrote:
Thu Aug 30, 2018 5:00 pm
the glyphs can occupy any proportion of that square.
True, although a traditional typographer (and I was brought up with metal type) might raise an eyebrow!
The font doesn't have any leading. Descenders on one row meet capitals on the next to reproduce the beeb look.
I would have preferred it to reproduce the 'Beeb look' in MODEs 3 and 6 (the 'text' modes), in which the 'character cell' is 8 pixels wide by 10 pixels high.
I agree, that would look better in a text editor, but it would make it impossible to use the font to reproduce MODE 4, say. It is much easier to add leading to a row than to file it off the type!

Having said that, it looks like OpenType font variations would allow both options to exist within a single font. You could even have a single font with built-in styles for "MODE 0" through "MODE 6". But this doesn't seem to be widely supported at the moment.

So I created a new font called "Master Mode 6", which is the same except for the vertical spacing. Apart from the name I only had to change a couple of metrics.
Attachments
master6.ttf.zip
(5.61 KiB) Downloaded 10 times

User avatar
Richard Russell
Posts: 526
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: master.ttf

Post by Richard Russell » Fri Aug 31, 2018 8:45 am

ctr wrote:
Thu Aug 30, 2018 11:39 pm
I agree, that would look better in a text editor, but it would make it impossible to use the font to reproduce MODE 4, say. It is much easier to add leading to a row than to file it off the type!
In 'my' BBC BASICs (BB4W and BBCSDL) it's possible to override the font's normal row-spacing, indeed I have to do that when emulating the standard MODEs precisely because of the wider spacing in MODEs 3 and 6. So whereas I would normally space the rows according to the height value returned by GetTextMetrics (in Windows) or TTF_SizeUNICODE (in SDL2) I simply set it to the appropriate value for the mode.
So I created a new font called "Master Mode 6", which is the same except for the vertical spacing.
An excellent workaround, thank you! =D>

User avatar
jgharston
Posts: 3243
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: master.ttf

Post by jgharston » Fri Aug 31, 2018 12:59 pm

Could do with a narrow and wide variant. Changing the character size in only one direction doesn't change the aspect ratio (demo in MSWord):
BBCfont.gif

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
Richard Russell
Posts: 526
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: master.ttf

Post by Richard Russell » Fri Aug 31, 2018 2:17 pm

jgharston wrote:
Fri Aug 31, 2018 12:59 pm
Changing the character size in only one direction doesn't change the aspect ratio
I don't think I'd want it to; it is emulating a bitmapped font after all. Rendering at different point sizes in BBCSDL gives rise to some scaling anomalies with non-integer ratios (most obviously on the 'S'), as you would expect:

Code: Select all

      FOR n% = 9 TO 36 STEP 3
        OSCLI "font """ + @lib$ + "../master.ttf"", " + STR$n%
        PRINT "MASTER ";n%
      NEXT
masterbbcsdl.gif

User avatar
jgharston
Posts: 3243
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: master.ttf

Post by jgharston » Fri Aug 31, 2018 5:53 pm

Richard Russell wrote:
Fri Aug 31, 2018 2:17 pm
jgharston wrote:
Fri Aug 31, 2018 12:59 pm
Changing the character size in only one direction doesn't change the aspect ratio
I don't think I'd want it to; it is emulating a bitmapped font after all. Rendering at different point sizes in BBCSDL gives rise to some scaling anomalies with non-integer ratios (most obviously on the 'S'), as you would expect:
But on the Beeb you do get different aspect ratios, "thin" for MODE 0 and MODE 3, "normal" for MODE 1, MODE 4 and MODE 6 and "wide" for MODE 2 and MODE 5. CTR mentioned mocking up text screenshots, which with the "normal" font is only possible for 1x1 aspect MODEs.

This is possible:
Image

but not this:
Image

(sorry, can't get the img width= height= syntax working)

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
Richard Russell
Posts: 526
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: master.ttf

Post by Richard Russell » Fri Aug 31, 2018 7:55 pm

jgharston wrote:
Fri Aug 31, 2018 5:53 pm
But on the Beeb you do get different aspect ratios, "thin" for MODE 0 and MODE 3, "normal" for MODE 1, MODE 4 and MODE 6 and "wide" for MODE 2 and MODE 5.
Of course, but it's the pixels themselves that change their shape; the characters remain 8x8 pixels in every case. If you are wanting to reproduce the effect of the changing pixel shape, but on a display with fixed (e.g. square) pixels, then one way would be to stretch or compress the characters; but to me that's rather different from the 'narrow' and 'extended' variants of a typical TrueType font.

User avatar
ctr
Posts: 182
Joined: Wed Jul 16, 2014 2:53 pm
Contact:

Re: master.ttf

Post by ctr » Sat Sep 01, 2018 4:36 pm

jgharston wrote:
Fri Aug 31, 2018 12:59 pm
Could do with a narrow and wide variant.
You're right. I was thinking (from a programmer's point of view) that it is very easy to stretch the text when you render it, but that's not much use if a particular application doesn't have that feature.

So it needs variants for modes 0, 1, 2, 3 and 6. At the moment the creation of the outlines and the character map is automated, but there's some manual editing of metrics. If I do this three more times I'll probably make a mistake, so I'll look at automating the whole thing.

User avatar
jgharston
Posts: 3243
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: master.ttf

Post by jgharston » Sun Sep 02, 2018 11:59 am

ctr wrote:
Sat Sep 01, 2018 4:36 pm
jgharston wrote:
Fri Aug 31, 2018 12:59 pm
Could do with a narrow and wide variant.
...
So it needs variants for modes 0, 1, 2, 3 and 6. At the moment the creation of the outlines and the character map is automated, but there's some manual editing of metrics. If I do this three more times I'll probably make a mistake, so I'll look at automating the whole thing.
Do you need variants for zebra mode characters? Surely you just need to adjust the line spacing, nothing to do with the characters themselves:
Image1.gif
Image1.gif (3.47 KiB) Viewed 373 times
So, just narrow, normal, and wide.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
Richard Russell
Posts: 526
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: master.ttf

Post by Richard Russell » Sun Sep 02, 2018 1:38 pm

jgharston wrote:
Sun Sep 02, 2018 11:59 am
Surely you just need to adjust the line spacing, nothing to do with the characters themselves
But who's to say you can adjust the line spacing? It all depends on the program doing the rendering and what capabilities it has. If that program has control of both the line spacing and the horizontal scaling (which would be the case with low-level code using, say, SDL) then the font file doesn't need any variants - everything you need can be achieved at the rendering stage. If the program can adjust the line spacing but cannot adjust the scaling (which seems to be the assumption you are making) then the font needs only different width options. But if the program has no control of either parameter, which might be the case for a standard text editor like Emacs or Notepad, the font file has to provide all the options.

User avatar
jgharston
Posts: 3243
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: master.ttf

Post by jgharston » Sun Sep 02, 2018 3:08 pm

Richard Russell wrote:
Sun Sep 02, 2018 1:38 pm
jgharston wrote:
Sun Sep 02, 2018 11:59 am
Surely you just need to adjust the line spacing, nothing to do with the characters themselves
But who's to say you can adjust the line spacing? It all depends on the program doing the rendering and what capabilities it has. If that program has control of both the line spacing and the horizontal scaling (which would be the case with low-level code using, say, SDL) then the font file doesn't need any variants - everything you need can be achieved at the rendering stage. If the program can adjust the line spacing but cannot adjust the scaling (which seems to be the assumption you are making) then the font needs only different width options. But if the program has no control of either parameter, which might be the case for a standard text editor like Emacs or Notepad, the font file has to provide all the options.
Good point. In that case, I'd recommend a more generic naming scheme, something like Master4x8, Master4x10, Master8x8, Master8x10, Master16x8, Master16x10, rather than something like MasterMODEn as several MODEn's are the same, eg MODE 0=MODE8, MODE1=MODE4, MODE2=MODE5, etc.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
ctr
Posts: 182
Joined: Wed Jul 16, 2014 2:53 pm
Contact:

Re: master.ttf

Post by ctr » Mon Nov 05, 2018 4:17 pm

I finally got round to doing all the mode variants. They are in mastermodes.zip, attached to the top post.

There are five fonts, "Master Mode 0", "Master Mode 1", "Master Mode 2", "Master Mode 3" and "Master Mode 6".

The only major change is that "Master Mode 1" replaces "Master".

There have been a few minor changes compared to the previous versions, but nothing visible I hope. The em-square is increased to 96 units because the documented minimum for Mac is 64 (as compared to 16 on Windows). I also noticed a couple of truetype flags I should have set. And version numbers and dates.

"Master Mode 1" also serves for mode 4 and "Master Mode 2" for mode 5. I didn't name them Master4x8, etc. because I couldn't imagine the person who is interested in this font yet unfamiliar with the modes. And I like the mode names better.

Post Reply