Thursday, June 24, 2010

I've always had a fascination for the BBC schools diamond. In case you are not familiar with it, the BBC schools diamond was a mechanical model devised by Murray Andrew for use in the last two minutes of intervals before BBC programmes for schools and colleges.

I am ancient enough not only to remember it, but to have watched it as nature intended at primary school every week before a programme. I was always mesmerised by it, but my unimpressed teachers used to complain that it wasn't as easy to understand as ITV's schools clock.

Regular readers of this blog will no doubt have been bored witless by my endless posts about the creation of a TrueType font based on the output produced by the BBC analogue character generation system Anchor.

Although I was very happy with the end result, I was aware that when compared to one famous example - the BBC's coverage of the General Election of 1970 - it didn't look quite right.

Here is an example image taken from this video - apologies in advance, as the quality is appalling:

Anchor used in anger, 1970

The characters looked fatter - squarer - than they did on my version. I was curious to know why.

"The addition of the lower-case facility has involved a change in the format of the display from 14 rows of 25 characters to 12 rows of 32 characters. This has been necessary to accommodate the descenders of such characters as 'y' and 'g' whilst preserving the appearance of the character set." BBC Engineering Design Information - 10168(1).JAN73.ECG.

So, here is how Anchor would look before January 1973:

Anchor, pre January 1973

And here is how it would look after January 1973:

Anchor, post Jan 73

And here is a gratuitous picture of Cliff Michelmore as, personally, I think you can't have too much Cliff Michelmore on your blog:

Click to enlarge

So, imagine you are doing something with Anchor.ttf on a 720 x 576 image that is supposed to be from pre-1973. In that case use Anchor at 41pt, stretched horizontally by 128% with 85% line spacing. And you mustn't use any lower case!

If you are doing something with Anchor.ttf on a 720 x 576 image that is supposed to be from post-1973 then simply use it at 41pt with 100% line spacing.

Wednesday, June 16, 2010

These days, if at all possible, I like to use Inkscape for creating vector artwork. At one time I used Macromedia Flash 8 for all my vector illustration work. But these days, if I have to create artwork in Flash it makes me feel like I'm being forced to write with my left hand.

There are also a number of things I can achieve easily in Inkscape that are harder to do in Flash. One recent example was when I was working on the animated menu for Simon Buckley's new website. I was given a signed off design as a bitmap illustration and was asked to turn the design into a vector animation in Macromedia Flash format.

Most of the design was very straightforward to achieve, but there was one part that was more fiddly. The name of the website was written in a font called Chalkdust, and it was fringed with a thick black outline. This is one of those things that looks simple to do until you actually try and do it in Flash.

The way I tackled getting an attractive vector outline for the Chalkdust text was to enter the Chalkdust text into Inkscape, turn the text into vector outlines and then use the Inkscape "Linked Offset" option to enable me to expand the text outline to the desired extent.

Cleaning up Chalkdust in Inkscape

Chalkdust, like most typefaces, has very messy vector outlines with large amount of redundant nodes. This meant that the resulting expanded outline needed a lot of cleaning up and simplification - a job I could do very quickly with the node tool in Inkscape.

It's always worth making your vector outlines as clean as possible. In the old days of dial-up modems this was because you hand to shave every last byte off of download times - I used to hand optimise everything I did in Flash to get Flash animations within bandwidth quotas set by customers. However these days it's because the more elegant your outline the better it looks (due to the vagaries of anti-aliasing routines) and the better it animates.

Cleaned up outline

The finished outline was soon cleaned up and ready for transferring from Inkscape 0.47 to Flash 8.

After some experimenting, I found that my favoured method of transferring vector Inkscape artwork into Macromedia Flash 8 is the Encapsulated Postscript or EPS format.

There is one important thing to be aware of when transferring between the two programs using this format. Take this Inkscape vector drawing as an example - it's 400 by 400 pixels in size.

400 x 400 pixel Inkscape drawing...

When imported into Macromedia Flash as an EPS it arrives as a vector drawing 320 by 320 pixels in size.

...becomes 320 x 320 pixel Flash drawing.

There is absolutely no way around this - Flash thinks EPS files should be 72dpi, Inkscape thinks EPS files should be 90dpi and neither program lets you do anything about it.

However, it's simple enough to use the Flash 8 Transform panel to scale all the EPS files you import into it by 125% to make up for the difference in dpi between the two packages.

Doing this becomes automatic after a while!

One final point to bear in mind with EPS transfers between Inkscape and Flash 8 - avoid gradient fills. These always seem to be imported as bitmaps in Flash 8. You will have to recreate any Inkscape fills again from scratch in Macromedia Flash so I never bother creating them in Inkscape in the first place.

The finished animated menu can be seen here. I've also written a blog post about my preferred method of getting my vector drawings from Flash 8 into Inkscape here.

Tuesday, June 15, 2010

Twelve years ago, when the internet was all shiny and new and I hadn't even heard of GNU/Linux, one of my favourite websites was the Microsoft typography website. One of the things I remember reading about on the site was a tool called WEFT (Web Embedding Fonts Tool). WEFT allowed you to embed fonts on your websites. This meant they were not restricted to using the fonts someone had installed on their computer, but could use any font you wanted. As someone who suffers from projectile vomiting at the merest glance of Comic Sans I immediately put trying out WEFT on my to-do list. And then forgot all about it.

Over a decade later I was reading the press release for Mozilla Firefox 3.6 and noticed that font embedding was about to re-enter the limelight. Mozilla Firefox 3.6 includes a support for a very similar system to WEFT for embedding fonts on web pages. It's called WOFF. So, being as curious and nosey as ever I thought I would investigate using WOFF.

But where to start? It turned out that from deciding to create a web-page using WOFF to the finished article took me the best part of a day of messing around, browsing, compiling tarballs and experimenting.

I decided I'd create a very simple web-page using one of my own fonts, Anchor. This is because there are a number of irritating legal issues around font embedding for web pages. In order to be able to embed a font on a website you have to have a licence to do this. The issues are explained very well in this article by Armand Niculescu.

Once I'd decided on a font, the next job was to create a WOFF file from Anchor. There are many reasons that you would want to use a WOFF file for font embedding rather than have your web-page link to your original font file. For instance a WOFF file is compressed, which saves download time. In addition, a WOFF file can contain only a subset of the characters or glyphs in a font that you actually use on your site which again can save a lot of download time on a site that uses several fonts.

Sadly, the simplest way to do this on GNU/Linux was download a windows binary file (an .exe file) and run it via WINE. WINE is a compatibility layer that allows you to run binary files intended for use on Microsoft Windows on GNU/Linux.

The tool I needed to run to convert font files to WOFF files is called sfnt2woff and I found some very good instructions on how to run and use this tool on Federico Moretti's blog. After creating my WOFF file, I could then incorporate it into a web page using the CSS@font-face declaration. All seemed to work well in Firefox 3.6 when I tested the resulting .html file from my local drive.

Success - my .woff works locally

However, when I was looking at Armand's Niculescu's blog entry again I realised that was not enough to ensure compatibility with most browsers. However, if I included a few more formats alongside my WOFF file, I could get the embedded fonts on my page working for 92% of browsers - which sounded good to me.

In order to make my web page work on the majority of web browsers I would also need to add a @font-face declaration that linked to a copy of my original TrueType font (.ttf) file for older versions of Firefox and the Opera, Safari and Chrome browsers.

In addition, to be on the safe side, I really needed to include an SVG font version of the font for use with the Safari and Chrome browsers. Creating an SVG version was simplicity itself. As I created the most recent version of the Anchor font in the free software tool FontForge, all I needed to do was use FontForge to export an .svg version of the Anchor font.

FontForge 2.0 File Export Dialogue box

SVG font created sucessfully there was one more format I needed to create - a Microsoft EOT file. An EOT file does exactly the same job as a WOFF file on Microsoft browsers. As WOFF is only going to be supported in Microsoft Internet Explorer 9 and later, for a site to work on Microsoft Internet Explorer 4-8 I'd need to create a EOT file.

My initial thought for creating a EOT file was to download WEFT from the Microsoft website and use that via WINE. However this failed miserably. But, as a consolation, I found that even Windows users found Microsoft's WEFT tool elderly, unintuitive and almost impossible to use.

Fortunately I found another tool on the internet - it was called ttf2eot and it claimed to do exactly what its name suggests. The bad news (simply because I'm lazy) was that the tool was a piece of C++ source code. That meant I had to download the build-essentials package and compile a binary myself. It took all of two minutes - such hardship!

Anyway, the file compiled beautifully and the tool worked first time. One line in the terminal (the tool needs the angle brackets around the source font filename):

./ttf2eot <Anchor.ttf> Anchor.eot

Was enough to create an eot file. The only thing that I found rather odd was my finished EOT file was bigger than the original TrueType font file!

So, I added all the formats into my @font-face declaration, tested the file locally and it worked. So triumphantly I uploaded my finished html file, along with my ttf, svg, woff and eot to my webspace using gFTP. And it failed miserably.

I couldn't understand why it failed - I thought I'd done everything correctly. But fortunately I had come across an excellent article by Paul Irish that explained exactly where I was going wrong. There are a whole host of gotchas with font embedding, and the order of statements in the CSS declaration is critical:

And then... And then... ...I found out that I needn't of bothered. A website called Font Squirrel has a nice tool that does everything for you plus more. In particular, it creates subsets of fonts for you so you can cut down on your file sizes and download times. You just need to specify the glyphs (characters) in your .ttf, .eot, .woff and .svg files that you actually use.

Font Squirrel also have loads of fonts that you can legally embed, and are hand-picked to ensure they are all good quality type faces.

Another good source of information is Milton Bayer's site, which explains about the CSS and XHTML needed to get WOFF working for those that may be unfamiliar with it.

Anyway, it was fun and I learnt a lot. The end result can be seen for real in the comfort of your own browser here:

Monday, June 14, 2010

Google recently got a lot of criticism for "copying Microsoft's search engine Bing" in changing the background of their home page. But, if I remember correctly, they did this as an experiment once before long before Bing came along to showcase loads of Google commissioned "modern art". Although, that time, they didn't enforce a random work of "art" on you by default.

The pictures that Google offered up were so gaudy and obvious I thought I'd use one of my own, taken from an animated Granada Television close-down sequence that I produced using Inkscape:

Good Night

Google's homepage is so resolutely minimalist that it reminds me of Granada Television's ident throughout the 70s and 80s; the two were obviously made for each other.

Sunday, June 13, 2010

I've finally made my blog feel a little more personal. I call this theme "70s Regional News". It's not the world's most beautiful design, but it's not supposed to be. I wanted a shabby, tatty beige horror to remind me of shabbier, tattier beiger times.

There are Nutty bars and Spangles in the corner and if you're very good I'll let you have a Cadbury's Moose...