How to render ANSI properly

Recently I received a question on Discord about how to determine which is the proper font to use to make sure it looks exactly as the creator perceived it at the time. The answer was lengthy and since I received a few responses that the information should be safeguarded I’m creating a post here. Feel free to continue the conversation here.

quite likely there is no easy answer to your question and to understand this you might need a little history on the topic. You also need to know that ANSI escape sequences are not limited to a certain platform, they are sequences created for textmode consoles, vendors may have left out some parts of the standard or slightly modified it. whatever is preserved in artpacks on 16c is mainly created on IBM PC using the Microsoft ANSI.SYS driver for MS-DOS or for the Commodore Amiga which also uses the ASCII set but looks different. Both platforms have their own limitations and specifics and next to them ANSI is also being used elsewhere on Linux terminals using custom 24-bit color sequences for example.

so in the beginning the hardware was defining factor for how characters were displayed, and if you’d call an Amiga BBS from a MS-DOS terminal, you’d obviously see the textmode art they created in the IBM PC codepage and not in the Amiga version. More often than you’d think PC users were thinking this how it was supposed to perceived :slight_smile:

Nowadays a textconsoles are mostly graphical, but back in the day the text console was implemented in hardware, directly in the display adapter, as the system needed to be able to show output directly from bootup. One big different with CRT monitors and the LCD’s introduced in the early 2000’s are the shape of the pixels. The CRT monitors had rectangular pixels and were about 35% taller than the pixels you’re used to see in this day and age. This means we need to stretch artwork output vertically when displaying artwork that was created before approximately 2000. We can’t be sure who started using Windows and LCD monitors at what point exactly but 2000 is year 16c uses as a limit where to stop using legacy aspect ratio for output. everything created before 2000 uses aspect ratio and everything afterwards assumes modern aspect ratio. 16c allows manual override for any of the display settings, so individual corrections are possible.

But to make the aspect ratio story even more complicated, during the nineties artgroups started creating viewers and editors (notably ACiDdraw) that offered a VGA preview mode which did not account for the stretching in the hardware text console. So artists would look and even create their artwork in textmode, but use the VGA preview mode to check for proportionsfor example, it became increasingly more important for artwork to look good in VGA mode too from 1994 onwards. this is why 16c assumes legacy aspect for the atwork prior to 2000 for the ‘main image’ but uses modern aspect ratio for the thumbnail and previews as this is how it as perceived in viewers and editors at the time.

Another item that affects display of the PC ANSI is the letter spacing. Characters where 16 pixel tall and 8 pixels wide, but a 9th pixel was added to allow spacing in between characters. This was done in hardware and the hardware also knew which characters had to connect horizontally (like line characters) and would generate the pixels accordingly in the right places so that the lines wouldn’t not get interrupted in between characters. As this letter spacing was done in the display adapter, it would only appear on a hardware text console. These text consoles became also mostly out of use around 2000. From there onwards, character width in for example a Windows DOS prompt would be 8 pixels wide. And displaying older artwork would change proportions. Again 16c assumes 9px for artwork created prior to 2000 and 8px for 2000 onwards. This is where we’ve drawn the line, but we can’t always be sure if the user was using a text console or a graphical user interface on the turnover of the millenium.

Apart from the displaying paramters, it’s also noteworthy that the extended ASCII set exists in several codepages created by IBM which allowed for character localization. The most common one being codepage 437 as used in the USA or codepage 850 as used in Western Europe. Viewing artwork created in one codepage would display differently in another codepage, although when talking about ANSI art, the effects will be minimal as this was usually for the alphabetical characters, which were typically not used to create art, but there are exceptions like ‘newschool ascii’ art. Also, Microsoft decided to get rid of the certical halfblocks (replaced by a pipe) starting from Windows XP iirc. You needed to load another driver if you wanted them to displayed properly on the DOS prompt.

The SAUCE metadata systems exists since 1994, but the support for font specification was added in 2012. While not so much ANSI art was created in 2000 and 2012 we’re mostly uncertain in what way the artist created the artwork. Some even mention it directly in the artwork, others are sometimes careless or assumed that the viewer would be aware it would need to be displayed in a certain font.

If you want a single answer on what font should be used for which artwork, the answer is not very straightforward, it depends on when it was created, in which resolution you would be viewing and even then you need to make assumptions as metadata is not always available. 16c has strived to make display historically correct and for now I think we succeeded as the criticism on this part for former web galleries seems to have faded over the last years.

If your intention is to display legacy ANSI artwork in a Unicode terminal, you might be out of luck. You’ll always be fighting with character dimensions (eg the 35% vertical stretch) and the letter spacing, which are items you have no real control over, a users really decided himself on the specifics of a terminal in a graphical environment. And that is also the most important reason for 16c to display ANSI art in PNG format as it allows to display it as close to the creation as possible.

Some additional backgorund information (and illustrations) about Legacy Aspect and Letter Spacing can be found here: 16colo.rs

2 Likes

Thank you for all of this incredible info! I was an ANSI artist back in the day, and I just found out about 16colo.rs. Since reading this post, I’ve been researching a bit more about how to properly emulate the legacy ANSI viewing experience, and I thought I’d share what I’ve found.

The amazing news for Windows users is that the latest release candidate of DOSBox Staging (0.81.0-RC), which only recently became available, seems to now handle all of the issues you mentioned pretty flawlessly, out of the box, with no special configuration needed. They’ve overhauled their CRT monitor emulation and VGA graphics code, so their text mode now includes by default:

  • 80x25 character display
  • Font with 9x16 pixel characters
  • Properly aspected pixels for VGA text mode (35% taller)
  • 720x400 display resolution
  • 4:3 display aspect ratio
  • Accurate RGB color values
  • Simulated CRT look (e.g. scanlines)

You get all of this upscaled automatically to your monitor’s display resolution, with support including up to 4K.

You can find the latest DOSBox Staging releases here: Windows - DOSBox Staging

You can read more details about the changes in 0.81.0-RC here: 0.81.0-RC - DOSBox Staging

However, by the time you’re reading this, 0.81.0 or later may have already been officially released, in which case you can find it instead on the official DOSBox web site here: https://www.dosbox.com/

One optional setting you might want to configure is to start up in fullscreen, since DOSBox defaults to a window. You can simply edit your DOSBox Staging configuration file, located at %USERPROFILE%\AppData\Local\DOSBox\dosbox-staging.conf, in any Windows text editor, and change the value for “fullscreen” from “= false” to “= true”. Alternatively, if you don’t touch this, and DOSBox starts up in a window, you can just use the Alt+Enter hotkey to toggle fullscreen on/off.

Then, you just need to create a Windows folder and “mount” it as your DOSBox C: drive by adding the following lines to the end of the above-mentioned conf file, under the “[autoexec]” section, replacing “<path>” with the full path to the Windows folder you created (e.g. C:\DOSBox):

[autoexec]
# Lines in this section will be run at startup.
# You can put your MOUNT lines here.
mount C <path>
C:

I’ve tested a couple old DOS ANSI editors and viewers, like TheDraw and PyroView, and they look and work great! You just need to install those somewhere onto your DOSBox C: drive, unzip your favorite artpacks, and view them all just like we used to.

Also, with just a tiny bit more configuration (set “serial1” in the DOSBox conf file to “= modem listenport:23” and install a terminal program like Telemate or Terminate onto your DOSBox C: drive), you can telnet into some still-running BBSs and see the ANSIs there, just like the old days.

For example, from your terminal of choice, try this command to telnet into Hawk Hubbard’s Acid Underworld BBS:

atdt blackflag.acid.org:31337

You can find more telnet BBSs to try at the Telnet BBS Guide web site here: https://www.telnetbbsguide.com/

Hope this helps! :heart: