HOME | DD

caHarkness — 8x8 Font Tileset in ASCII Order

#font #pixelart #retro #tileset
Published: 2018-11-20 12:33:07 +0000 UTC; Views: 556; Favourites: 12; Downloads: 4
Redirect to original
Description I designed this tileset for a few projects I am working on and figured I should share it with the world if it could save somebody some time when making their own games.

It features most, if not all, characters that can be reproduced by an American QWERTY keyboard. Each 8x8 tile is arranged in ASCII order so characters can easily be mapped to their ordinal value. I also chose to make this tileset 256 pixels wide in order to keep it base-2 friendly and keep all 26 letters on a single line.

Among the few variants of this tileset I have, I decided to upload the "metallic" version of this so that the color can be changed even in the simplest of photo manipulation software. If you dislike the "metallic" effect, all you would need to do is increase the contrast until the gray color becomes solid white. The black drop shadow can also easily be adjusted or removed altogether.

For those struggling with how to use this font, here are a few programming tips to help you achieve drawing ASCII strings using this tileset:

1. You need a method that takes a single character in and returns a coordinate pair back out. Here's an example of that written in Lua, although the concept remains the same throughout all programming languages:

function tileForLetter(chr)
   local x = 0
   local y = 0

   if not chr then return 0, 0 end

   local b = string.byte(chr)

   if b > 31
   then
       local adj = b - 32

       while adj > 31
       do
           adj = adj - 32
           y = y + 1
       end

       x = adj

       return x, y
   end
end

What this is doing is checking for a character with an ordinal value of 32 (which is the first non-control character in ASCII), subtracting 32 to get a character's tile's position relative to the beginning of the tileset. It enters a while loop to add 1 to Y for every occurrence of the adjusted value being over 32. This is what handles the "wrapping" effect. The final output is the coordinate pair of the top, left pixel of the character you are looking for, but divided by 8.

If I find that any questions about implementing this tileset warrants an explanation, I shall do so and continue this numbered list. You do not need to give me credit, but if this helped you learn something, consider sharing it with a friend. Thank you!
Related content
Comments: 0