Media Molecule PMoly

Some of you might have noticed some rather nice fonts on the new Media Molecule website. Well, I suppose that might depend on whether or not you like them and if you’re using a half decent web browser.

Anyway, yes - those tasty fonts use CSS3’s @font-face rule. Not all browsers support it, but some additional file formats leave you with support in working in IE4+, Firefox 3.5+ Opera 10+, Safari 3.1+ and Chrome 4.0+. You upload the relevant licensed-for-web-use font files to your webserver, telling your web browser where to download the various files from. You can of course read our stylesheet, but for our title font, Museo (from Jos Buivenga’s exljbris Font Foundry) it looks a little something like this:

@font-face {
	font-family: 'Museo500';
	src: url('/images/assets/fonts/Museo500-Regular.eot');
	src: local('Museo 500'), local('Museo-500'), url('/images/assets/fonts/Museo500-Regular.woff') 	format('woff'), url('/images/assets/fonts/Museo500-Regular.otf') format('opentype'), url('/images/assets/fonts/Museo500-Regular.svg#Museo-500') format('svg');

So - .ttf and .otf font files for standards compliant browsers, and .eot files for Internet Explorer 4+, .woff files for Firefox 3.6+ and even an .svg format for iPhone (ain’t that kind!)

Anyway, chances are if you’re not using @font-face already, you soon will be - so at this point I’d recommend - a great resource for 100% free for commercial use fonts, complete with a growing collection of “@font-face kits” and incredibly, a free @font-face generator that will let you convert license free fonts for use on the web.

If you’re looking for a wider range of fonts for use on the web, check out TypeKit and Clearleft’s upcoming Fontdeck.

Posted by: Tom

Categories: Web
Tags: css fonts html

The Middle Lane: A Guide

2010February 3rd


Posted by: Jim

Categories: Art
Tags: jim unwin road rage

Earth stood hard as iron

2010February 3rd

I spend most days brain-deep in Popit code, but in my spare time I like to exercise my other, other brain and write short stories. If you like reading (the activity, not the town) then make a cup of tea, pull up a biscuit and Are You Sitting Comfortably? Below is an excerpt from Part 1 of a story I’m serialising as I go called “Earth stood hard as iron”.

The dull swirling of Gordon’s frozen breath is the only sign of life in the tiny apartment; Choirboys’ voices lilt softly through the still air from the radio in the kitchen, cutting sweetly through the silence. Gordon sits still as a stone, wrapped in blankets whilst Cal, his small mongrel terrier, keeps his feet warm. The room is cold, barely above freezing, a single bar of the electric fire struggling against the bitter winter. It’s cheaper that way.

Gordon blinks as if waking from a dream, moves to stretch his frozen joints, and flexes his numb lips.

“Come on Cal,” he says quietly, “It’s time to go for a walk.”

They shuffle down the hall to the door, and Cal looks on as Gordon agonises over putting on his coat, scarf, gloves and boots. The laces are hard to do. Finally, Cal’s lead is clipped onto his collar.

“Let’s go.”

The rest is on the other side of this link, so please read on! I hope you enjoy it, feedback is always most welcome.

Posted by: Jonny

Categories: Words

lately I’ve been experimenting with a trick to save space on 64 bit architectures: rather than using pointers (which take 8 bytes of memory! 8! bytes! omg!), I’m using 32 bit indices into a single, gigantic 32 gig block I allocate at startup. as in:

u64 *bigblock=malloc(32*1024*1024*1024); // at startup. or choose a number smaller than 32 :)

struct foo { int x, y, whatever, whatever; };

// later…

u32 myfoo=MyAllocatorForBigBlock(sizeof(foo)); // using a custom allocator of your choice…



with some macro goodness, or in C++, a template class that looks a bit like a smart pointer but is in fact not smart, those casts I made explicit above go away it can be made to look really neat:

P<foo> myfoo=P<foo>::Alloc(); // P<foo> is really a 32 bit index just like before.

myfoo->x=100;myfoo->y=200; // the overloaded -> operator does the bigalloc+index thing for us

The indices in my case assume an 8 byte stride, ie all allocations happen on 8 byte boundaries (that’s why bigblock is a u64*), so you can address 4*8=32 gigs with 32 bit indices. For an in-memory database (my use case, as it happens), that’s plenty. I don’t want it swapping anyway, and 32 gig machines are reasonable these days. The compiler seems to do the right thing and generate quite efficient code (eg it keeps bigblock in a register (ecx), puts indices in say edx and does things like mov [ecx+edx*8+4],200)

another cute side benefit is that all the pointers in your system, now that they’re indices from a base address, are sort of ‘position independent’… you can mmap() or fwrite() the entire bigblock to and from disk, and next time you boot, it doesn’t matter if the base address moves, it all just works. no need for pointer fixups or anything like that.  win!

kinda makes 64 bit linux/windows feel a bit more like a nice embedded system with a predictable memory map and nice small 4 byte pointers. lovely!

Posted by: Alex

Categories: Code
Tags: 32 bit 64 bit indicies

Untitled Document Syndrome

2010January 28th

this post is pretty on the money - but it goes further. how many times have you been forced to name a project before you can start? too many. littlebigplanet, the multi-million-selling-product, still has the project name ‘ps3test1’ - yes, it really can trace its roots back to the first code we ever wrote on ps3. at the time I named that, I had *no* idea that it would grow into the final thing. oh, and the executable filename? pc.exe (windows) and pc.self (ps3). confusing!

on the other hand, when I start projects and choose a cool sounding name, oh I dunno, like “RoboEngine”, you can pretty much guaruntee that it will fail. it seems that the less well considered the filename, the more successful the content. at least for me…

Posted by: Alex

Categories: Code

At siggraph 2009, Natasha Tatarchuk invited several games industry graphics types to give a course on ‘advances in real-time rendernig in 3d graphics and games’. Follow the link for lots of lovely stuff, including a set of slides about graphics techniques used in LBP.

Posted by: Alex

Categories: Code
Tags: rendering siggraph

c trick

2010January 27th

I love indexing constant strings, I’m sad like that.

for example,

char c=”0123456789abcdef”[b&15];

converts the low nybble of byte b into its hex character.

oldie, but goldie.

Posted by: Alex

Categories: Code
Tags: c tips

Quote of the moment

2010January 26th

“goto considered harmful? rubbish - it’s fine”

— Anton Kirczenow

Posted by: Alex

Categories: Code

Luscious luscious fluids

2010January 26th

MMM so tasty!

Posted by: Anton

Categories: Code

warning signs

2010January 25th

when I’m coding, sometimes I get warning signs that I haven’t understood the problem fully. Normally, they take the form of gross looking code - ‘-1’ or ‘+1’ hanging round in loop limits, even worse, seemingly arbitrary constants, large amounts of unavoidable pointer dereferencing,…

nearlly always this is a sign that either I’m doing it wrong, or I got the data structure wrong. It is ALWAYS better to stop and rethink.

as I’ve got more experienced coding, I’ve continually lowered my tolerance to these warning signs, and it always helps. even if I find myself doing something fairly innocuous, like a nested loop, or if I find an unexpected number of edge cases I need to ‘code around’, I now stop and rethink. I don’t always get the right answer… but I’ve never regretted that mental check.

tl;dr version: develop your spidey coder sense for anything gross, and listen to it. it’s like the human form of -Wall, and it’s always worth it.