Tuesday, March 20, 2012

Fonts of Wisdom

Previous versions of Solitaire Till Dawn have always used carefully-drawn bitmap images to display the indices (the rank and suit of the card, shown in the upper-left corner). I did this because in the old days (you know, when we all used steam-powered computers), pixels were large and screen space was limited. I needed to know exactly where each numeral or letter would be placed, how tall it would be, how wide it would be, and how it aligned vertically and horizontally. I couldn't leave that to the vagaries of a computerized typesetter; if I did, all kinds of things wouldn't be right. The 10's would be absurdly wide; the suit symbols wouldn't line up vertically in columns; the letterforms wouldn't be thick and black enough for instant recognition; the fonts wouldn't look good at tiny sizes... you get the picture.

But it's a new age, people. I may be slow in realizing it, but I get there eventually. Bitmap images are a bad idea these days, precisely because they don't scale well as screens get larger and pixels get smaller. Using the system's text-display features takes care of that. And it turns out that the Mac's (and for future reference, iOS's) font tools are really flexible. This evening I finished substituting genuine font-drawn letters and numbers for my old bitmap images, and they look great.

To get the pixel-perfection I demand, I had to do some strange things. These included building tables that yielded the exact font size and baseline height needed for each separate card size; calculating string widths carefully for precise horizontal positioning and then adding offset adjustments for certain characters; and squeezing or widening some characters so their widths wouldn't differ so much. I even played with kerning to adjust the distance between the 1 and the 0 in "10", though in the end I found that I didn't need to do that.

I'm pleased with the results. The new letters and numbers almost precisely fill the space of the old ones, and are much better-looking. I think you'll like them.

I haven't done the suits yet. That comes next.

10 comments:

a2dmusic said...

Isn't it all fun -- learning the new tools, and the new possibilities?

I find it fascinating. Anyway, cheers - and pleased to hear that progress continues!

Peter N said...

Got a new MacBook Air a few weeks ago, completed the migration last week – and then realized that STDX does not work with 10.7. Sadness! I had hung on to 10.4.11 for a long time, but when I had problems with my tax software on ye olde MacBook last year I knew it would be time to move on soon. (I do love the new laptop.) If I complete my taxes without issue under the "roaring lion" and get a refund I will gladly pay for (the new) STDX all over again! Good luck finishing your undertaking.

Unknown said...

STD was always my favorite time-waster, and since I "Lionized," I've found no adequate substitute. Keep up the pressure, Rick. Your admiring fans are waiting...

Jean said...

Wow. Who knew? Fascinating.

GraGoose said...

Many of us have not bought new laptops because Lion won't run STD. Have you asked Apple for a grant to help you finish? I'll bet the increase in sales would be awesome. (I returned my MacBook Air when I found it wouldn't run STD.)

Krista said...

I loved this game. You are awesome!

Artie Kay said...

Rick,

Thank you for blogging your progress reports on STD. I, too am addicted to this game. I put off moving to Lion as long as I could because I did not want to give up STD. But, I had to make the move. I am considering resurrecting one of my other Macs or getting a second macbook just for STD. In the meantime, I appreciate all your efforts in bringing out an updated version of STD. I can't wait to try it.

Rick King

Margot said...

I've only been using Lion for a day and I'm going through withdrawal. Will keep on checking in to check your progress but in the meantime thanks for all your hard work. Solitaire Till Dawn is a real gem!

DanK said...

Hi Rick,

How about a July update? We are all curious as to how STD is progressing

singinsooie said...

Thank you for keeping on! I look forward to playing again with OS X Mountain Lion.. Yours is the best solitaire out there....and easiest on the eyes.