Comment Headings (HTML5)

Overview

Comment Headings is a coding utility to create large ASCII text style headings to add to your source code. The aim was to make it easy to find sections of code as you scrolled around a large document.

Practice

It's a tool that I don't use that much these days as I tend to use decent IDEs across all the languages I write, and especially so now that most functionality is contained in bite-sized classes, but in times of old it was really useful.

It's still useful for such languages as MaxScript where distributing, single, large files of code is the norm, or for languages where there's no decent IDE outliner.

I've included it in my portfolio as a novel cross-pollination of technologies – in this case, using Flash's new (at the time) BitmapData.getPixel() to convert the pixels of rendered bitmap text to ASCII full-block characters.

HTML5 version

Anyway, here's the latest version, using the HTML5 Canvas element.

Surprisingly, it's not as good as the Flash version, due to Canvas's iability to set anti-aliasing levels. Everything is smoothed, so the original pixels JavaScript reads from end up being blurry at small point sizes, so I have to get around that by adding both a alpha threshold parameter, and an option to supersample – that is, render the text 3 times larger than needed and sample pixels from within.

Links

Comments are closed.