Anchor but, er…

After shamelessly plugging my ANCHOR typeface on the web forum of The Mausoleum Club, I was delighted that it sparked off a very interesting conversation.

However one user going by the name of Boblet commented, quite correctly:

Dave…hang on, isn’t there supposed to be a rectangular block as one of the characters? How am I supposed to recreate Mentalis’ countdown sequence from The Armageddon Factor now? 🙂 Retrieved 29 September 2009

The problem was that I hadn’t seen the BBC Engineering Monograph 84 that shows a selection of ANCHOR characters when I originally created the font back in 2006, so I didn’t know I needed to add a block character.

With blocks you can do thrilling things like this!

As I thought it was only going to be a five minute job (if only I’d have known…) I thought I’d add one. What I needed to do should have been very simple: add a solid black rectangle to the Unicode character position known as “U+2588 FULL BLOCK”.

I originally created the font in Fontographer, but I’m using FontForge these days – I don’t even have my copy of Fontographer in the country! I had my .fog file from when I originally created the font in Fontgrapher, but FontForge can’t do anything with these. Luckily I could load in my .ttf into FontForge and answer angelically in the affirmative when it asked me very sternly if I really had permission to play with the typeface.

However, whenever I scrolled down to alter FULL BLOCK FontForge crashed every time. It simply disappeared in a puff of smoke without any warning or error whatsoever. My version of FontForge from the Ubuntu repository was well nearly 18 months old, which is an age for a program under constant development. Font Forge is worked on so much its version numbers are given as dates and times.

So I decided to so something quite drastic – I’d download a source tarball of FontForge from Sourceforge and compile and build the very latest version from the source. As I am using Ubuntu Linux this sort of thing is very easy. In theory, anyway…

Because I use IDLE and Python regularly I had all the odds and ends installed that I needed to compile something from source. According to the instructions, I just needed to type four commands on the command line and I’d be finished.

Stunningly, it all worked beautifully and I now have a shiny new latest model version of FontForge – a mere baby at only six days old when I downloaded it.

Fresh as a daisy – only six days old

And, as an added bonus, the user interface now looks like it was created in 2003 instead of 1986. Although still rather black and white, it is all anti-aliased and looking very pretty.

The interface is looking much more modern

Adding the block character to Anchor took ten blissful crash-free seconds and I have now uploaded the latest version of the font, version 4, to here.

Using my Python GIMP plug-ins on Microsoft Windows

I was recently asked how to install my VHS and PAL filter plug-ins for The GIMP on a computer running Microsoft Windows.

There are lots of ways to do this. In my view the best way is to download and burn a CD of Ubuntu Linux and install it on your computer – for those not wanting to do scary sounding things like repartitioning their hard drives you can use a lovely little thing on the CD called Wubi which can put the whole of Ubuntu Linux in just one file on your computer. This means that if you don’t like it you can get rid of it completely very easily. It runs very nicely and won’t interfere with Microsoft Windows at all. Ubuntu is a good choice as both The GIMP and Python are installed by default and ready to use from the moment you see the desktop.

Sadly, not everyone wants to try this, and for them I managed to find a good explanation of what you need to do here. I’ve summarised the important bit below:

What do I need to do to get Python scripts to work?

You have to install Python (as of GIMP 2.6.4, both Python 2.5 and 2.6 are supported), PyCairo, PyGObject and PyGTK.

If you haven’t installed The GIMP yet, install these files first.

If you installed GIMP before installing Python, PyCairo, PyGObject and
PyGTK, run the GIMP installer again to install the GIMP Python components.

After you have installed The GIMP with the other other bits and pieces, to install a Python plug-in on The GIMP:

  1. Shut down The GIMP
  2. Copy the plug-in files to ~/.gimp2.6/plug-ins (where ~ is %USERPROFILE% – probably in My Documents somewhere – do a search for a folder called gimp2.6)
  3. Restart The GIMP

On a GNU/Linux computer all you need to do is copy the files to the plug-ins folder as all other gubbins are installed and ready by default.

After Anchors away…

A couple of days ago I posted about the Anchor Character generator used for subtitling on BBC television programmes such as “News Review” in the 1970s.

After publishing it, I stumbled on a excellent web-page about the system that replaced it, TKST, here.

The next Frances Coverdale and Moira Stuart?

To be honest, I never liked this system as much. Perhaps it wasn’t quirky enough for me. Or maybe I was just growing up!

Repton typeface

When I was writing my blog post about doing the cover art for Repton: The Lost Realms, I wanted to refer to the font used for the “REPTON” namestyle.

Worringly my mind went a complete blank and I couldn’t remember the name of the face! My cheap supermarket CD-ROM version of it is called “Devendra”, which I could remember, but I couldn’t remember the typeface’s original name.

As usual, when I’m doing something else completely different there’s an article with information about the typeface and its the designer right in front of me – it’s called “Baby Teeth”, and it was designed by the American graphic designer Milton Glaser in 1968. Apparently the design is based on a hand painted sign he saw on a trip to Mexico.

The version I did for the Repton: The Lost Realms cover was traced from the advertisement for the original Repton game in Inkscape:

My Inkscape Repton logo

It is modified from the original font and I think it’s very pleasingly proportioned.

It may be rubbish, but at least it’s British rubbish…

My one stop shop for all your stupid rubbish download needs is now open here.

So now, for the first time everyone can:

And all in the comfort of your own home. How can you resist? I just hope Google’s servers are load balanced…

ANCHOR character generation

Our Sunday evening routine was always the same – my four siblings and me having their hair washed by Mum on a production line, with Dad on hair-drier duty. You’d regularly smell burning as he’d be distracted by something on “The Money Programme” or “News Review”. If you could smell pork there must have been something really interesting on the news…

Whenever I was able to put the the ever present risk of third degree burns out of my mind, there were two things that fascinated me about “News Review”. One was the bags under Peter Woods’ eyes. The other was the subtitling for the deaf and hard of hearing. It was in a strange but fascinating style of writing you only ever saw on the BBC.

The best thing about News Review was the subtitles

Adding to the mystique, there was also a huge illuminated transparency (about a meter by a meter and a half) of Jan Leeming from “News Review” with this subtitling below the charts in my opticians in Crewkerne that was used for testing people’s distance vision.

The subtitling was created by a system developed in-house by the BBC called ANCHOR. The BBC used Anchor for everything from General Elections to “computer readouts” on episodes of Doctor Who to superimposing “MERRY CHRISTMAS FROM BBC-2” on the test card.

Perhaps the reason I remember ANCHOR with such affection was that it heralded cricket being rained off, which freed up our family’s only television for programmes aimed at human beings with some concept of boredom.

Richard Russell, a BBC engineer and BBC Microcomputer legend remembered the ANCHOR system as follows:

ANCHOR was a largely *analogue* character generator, developed before digital technology was capable of such things, and as such was pretty remarkable. An attempt was made to develop a proportional-spaced ANCHOR – I remember seeing it being worked on – but I think it never got beyond the laboratory stage because it was so complex.
Richard Russell – retrieved 14 July 2008

However, Bob Richardson, one of the BBC’s graphic designers at the time remembered it less than fondly:

ANCHOR was a truly dreadful piece of kit. It was “free” to BBC productions (no internal charge was made for it) but nobody wanted it. Only Pres used it on occasions to give close-of-play cricket scores. Pres had one ANCHOR machine in the main BBC1/BBC2 editorial area on the 4th floor at TVC and the other sat in Vision Maintenance on the 2nd floor under a dustsheet. It didn’t get out much. ANCHOR used a monospaced face and had an 82 character set. It… …had been around since the Moon Landing in 1969. The keying was also pretty crap.
Bob Richardson – retrieved 14 July 2008

I’d always wanted to create an ANCHOR typeface for myself so when, in early 2006, my friend Rory Clark managed to recover a complete edition of “News Review” with Peter Woods and a BBC 2 News summary with Joan Bakewell from a Philips N1500 cassette I was in luck. Both programmes had used ANCHOR to produce subtitles for the deaf and hard of hearing. I took screenshots of every page of ANCHOR text and luckily managed to get every character between those two programmes.

Nowadays, instead of going to all that trouble, I could have simply downloaded BBC Engineering Monograph 84 off of the internet!

I created each character in Macromedia Flash and then imported them into Macromedia Fontographer. This was quite an exciting project at the time as it was the first font I’d ever created.

The end result (a truetype font file) worked rather well, and I’m glad to say it was put to good use by the late Simon Luxton who produced some rather interesting applications of ANCHOR that he remembered seeing as a child. Here is a picture I made for Simon – click to enlarge:

Peter Woods with that bloke off the Nationwide pantos

If you use the font at 41 points on a screen that’s 788 x 576 pixels in height then you’ll get an end result identical in size to the size seen on screen.

I’ve now licensed my ANCHOR font under CC-BY-SA and it’s available to download from here.

Filter tips (no Alistair)

I was bored of repeatedly applying my PAL and VHS effects to images by hand. It was a several stage process and rather fiddly: I desperately wanted to automate it. I knew it was possible to extend The GIMP by writing your own features in Python, so I decided to have a go and see how I got on.

The documentation for writing plug-ins in Python for The GIMP was pretty well hidden, but eventually I found it here. It was well written, very easy to follow, but it looked very old. For safety’s sake I felt I needed to have a hunt around and see if there were any more recent examples of filters for the GIMP in Python I could find just in case anything had changed. The tutorial seemed to have been written for The GIMP 1.5 but on my computer I’m currently using The GIMP 2.6.

Although I did try Google, the best example of Python filters for the latest version of Python were installed with The GIMP itself and sitting in:


Sure enough, the filters in there that shipped with The GIMP 2.6 had a much better way of preserving The GIMP’s state before and after the filter is applied and help undo to work and also contained the gettext function that ensures your filter can be translated into other languages. There is also a slightly changed way of specifying which menu the plug-ins show up in in The GIMP.

Writing the plug-in itself was very easy indeed. No stretching, no unpleasant bending and the gedit text editor that comes with the GNOME desktop on Ubuntu GNU/Linux was all the equipment I needed.

Writing filter in gedit

I found using the Browse… button on the Python-Fu console in The GIMP was extremely handy. It brings up a Procedure Browser which I used for finding the functions I wanted to call and their syntax. It also showed me the constants I could use, which greatly reduced the number of “magic numbers” in my code.

Procedure Browser from Python-Fu console

The basic idea is that anything you can do in The GIMP with a mouse has a matching pdb (procedure database) function, so it’s really easy to write a macro-style filters – you just find the right function using Browse.. from the Python-Fu console and string them together. But as that because Python is a ridiculously easy language, it’s possible to do so much more than that. One thing I didn’t expect is that pdb functions sometimes have extra parameters that you can’t normally access using The GIMP itself.

The second part of your filter is a call to a function called “register” in which you specify the interface for your filter, its description and where you want it to appear in the application.

A filter’s interface is specified in its register function

The main problem I had was not writing the filters themselves but getting them to show up in The GIMP’s menu of filters. Firstly I needed to work out where to put the filters – with Ubuntu Linux the best place is in your home directory under .gimp-2.6/plug-ins.

But putting it in the right place wasn’t enough – there were two other issues. First, if you don’t set your Python scripts to “Allow executing file as program” they won’t show up in The GIMP. No warning, no nothing – if you forget to do that you just won’t see them.

Don’t forget to allow your filter to execute as a program

Secondly, you have to prefix your filter name with “python-fu-“, or again it will silently refuse to show up.

Once I did get the filter to appear and, better than that, it worked, it was an amazing feeling of achievement. It’s tremendously satisfying to customise a program to do some special things that you want it to do.

Success at last – click to enlarge

I’ve released both filters under the GPL v3, and they’re available to download from here.

Tapeheads Revisited

I was happily applying my “fake” VHS or fake PAL effects to a range of pictures thinking how clever I’d been when something started to bother me.

Most images looked fine, but some looked completely wrong. For instance, the “Colour Production” text on Yorkshire Television production captions looked awful. I needed to find out what was wrong.

It shouldn’t actually look this bad…

I went back to Alan Pemberton’s website and after reading this page again I realised what was wrong. A PAL colour picture is composed of a high definition black and white image (which contains the luminance or Y) and a low definition colour image (or chrominance). The luminance image and chrominance images are added together to make a colour image.

However, with the colour turned down, the luminance image looks like a normal black and white picture – complete with all the detail viewers in black and white would expect. Whereas my technique for faking PAL or VHS was chucking away far too much detail, and if I turned down the colour I would certainly not see an acceptable black and white image.

In particular, I was binning far to much information for red and blue, which was the reason that things like the blueish red “Colour Production” on the Yorkshire Television caption looked far to low resolution.

I could quite easily create a PAL luminance image, like this:

A PAL luminance image

And I tried to create a chrominance image, like this one:

PAL chrominance image, but you’ll have to imagine the negative colours…

However, when I tried to combine them, something was wrong.

Lightspots can be too light

The answer was that for my chrominance image to work, the PNG format would need to hold negative colour values. The chrominance image is what’s called a difference image and therefore contains negative as well as positive values. Alan Pemberton explains why this is much better than I could on his site.

So, I couldn’t be completely accurate in the way I created PAL images, but I thought I could do a better job than I had been. So I fired up The GIMP and came up with this.

I load my source image and create two layers. I call the bottom one Luminance, the other Chrominance. I make the Chrominance layer’s blend mode Addition.

For my Luminance layer I adjust the Red channel output level to 76, the Green channel output level to 150 and the Blue channel output level to 29.

Setting the Red channel level to 76

For the chrominance layer I adjust the Red channel output level to 179, the Green channel output level to 105 and the Blue channel output level to 226.

You may notice that each pair of numbers adds up to 255. The Luminance (Y) layer values were worked out using:

Y = 0.299R + 0.587G + 0.114B with R = G = B = 255

Then depending on what I am doing (PAL VHS or just PAL), I scale the Luminance and Chrominance layers horizontally and then scale them back to full size. For a nice PAL effect I found that scaling the Luminance layer by two thirds width and then back again and the Chrominance layer to a third width and back again gave a good effect.

For VHS I found scaling the Luminance layer by 32% and the Chrominance layer by 16% looked OK.

As a comparison, here’s a Yorkshire television caption done using the revised technique.

How We Used To Live – with lossy old VHS tapes

The next job is to turn my method into plug-in filters for The GIMP. Time to dig out my Python book!

Reliving my misspent youth…

Whereas my BBC Micro and Master 128 are as reliable as ever (whenever I get the chance to go to the UK to use them) my A3000 has long since given up the ghost. It’s a real shame as I loved it just as much as my Beeb at the time.

However, thanks to a job I’m about to do for Retro Software I tried to fire up Tom Walker’s Windows binary of Arculator on Ubuntu Linux under WINE. I had simply assumed before that it wouldn’t work – how wrong can you be, it works beautifully:

It’s an odd feeling to use this desktop again after so long

I have just as much old stuff languishing on 3.5″ floppy for the Archimedes as I have for the BBC Micro – Repton 3 screen designs, test cards and bits of presentation in !Draw format, programs including a rather nice version of Minesweeper I wrote in BBC Basic, some programs I wrote in ARM assembler and so on.

I am also now longing to play the original Archimedes version of Repton 2 again. Hopefully when I get back to the UK I’ll be able to transfer some of these discs over so I can use them on Arculator.

Filthy tapes and dirty pictures

Recently I’ve been trying to work out how to recreate the PAL/VHS look in The GIMP. One article I read said that the colour (or chrominance, as they put it) signal on VHS recordings was very noisy. You can clearly see this on screen grabs taken from real VHS tapes.

The blotches here are due to genuine VHS/PAL chrominance noise

I tried to simulate this by adding RGB or HSV noise to the red, green and blue images I was creating. The results looked totally wrong. The trouble was that the noise was too even, with all the little blobs of noise being the same size. Click on the image below to enlarge it.

My unsuccessful attempt to simulate it using HSV noise

What I needed was some more realistic VHS noise, in which the blobs of noise were different sizes. Chrominance noise is rather like film grain in this respect, so after Googling “film grain gimp” I came up trumps with a very good article by Eric Kidd about film grain in The GIMP documentation which gave me the solution.

So, here is how I made my nice clean chrominance channels dirty:

  • I opened a real screen grab taken from a PAL VHS tape in The GIMP.
  • I duplicated the image onto a new layer so I had two layers in the same file containing the same image.
  • I blurred it the upper layer with Gaussian Blur until there was no noise visible.
  • I set the blend mode of the blurred layer to Grain Extract.
  • I flattened the image.

What you should end up with is an image that looks like this (click on it to enlarge it):

The grey areas are pure PAL/VHS chrominance noise

The grey areas contain the noise – which is what we are after. The next thing you need to do is choose a portion of the noise that looks best, and make it into a new image. After that you should make you noise image into a seemless tile the Make Seamless Map filter. This allows you to fill large areas with noise.

Here is the sample of real VHS noise I ended up with – it doesn’t look like much, but it works a treat!

This small PNG image was all I found that I needed

Now we can use the noise image to help us make a fake “PAL VHS” image. You apply it when you have scaled your red, green and blue images down to their “small” size – that’s before you restore them to 720 x 576 and composite them together.

First, I copied my noise image in The GIMP so it was on the clipboard. Then I used a Fill with the “Pattern Fill” fill type with “Clipboard” as the fill source. I also set the affected area to “Whole Selection” and the mode to “Grain Merge”. The bottom of your toolbox panel should look like this:

Here’s the recipe for those playing along at home

So all I am doing is blending my real VHS chrominance noise image over each of my colour channel images. Here’s my scaled green channel just after I applied the real chrominance noise.

The noise causes the slight blotchiness of the background

Here is an example of a finished “fake VHS” image with the real chrominance noise added (click to enlarge):

Very happy with the way this turned out

And here’s the Granada International example from earlier, but this time with real chrominance noise applied as a comparison (click to enlarge):

I think we just missed something dull and northern

That wraps it up for PAL and VHS – sorry I went on about it so much!