Filter:

,

and

Most common tags
By artist
Cupid Spaz Ming Agent -t- Imperator Pandafox Daniel Guldkrans Redzone Sense Zone mOdmate Samurai Tanis Carnera Le Sergeant Xerud Compyx Nitrofurano Krazy Rex Speed Demon Facet Flex Jade Shadowmaster Frederic Cambus Jou-Nan Chen Moondog Magnum Ice Sim1 Scott Fial Helrizer Antor Made Hammerfist ES Duel Fade One Dim Roy Crit Speedlight Desire Shine xIII Sparta ST Survivor Elf Ozymandias Tom Copper Aleksi Eeben Red Flotsam Blaze dmf Marc Rosocha Pursy Spiral Ollie Deekay J.O.L Manikin zscs Gasara Mark Coleman Blagger Tyrem John Cumming Monte Carlos Viznut Mic Lord Igor Matt Dominion WTE Exocet Ludug FAA Jacky Lowlife Senser Cliff Bleszinski Walt Homeboy Angeldawn Biz-Kid Vic Peachy Stigels Daniel Cook Sceptic Xytar Ray Larabie Nobody Zaratustra Christ Michael Grohe Dr.Satan Transformer MacDos Grazey phygorax Airwalk Lancelot Ccr Fresh Jerom Procyon Buch Jimmy! Joe Baggio Cheveron Slime Miguel Hernandez Chris Sawyer Dark Groo Axilla Original Gangster Mick Uno North Star Source Turbo Lanch Mat Sneap Equinox THUG Inc. Codex 2005 Tuf Quetzalcoatl Vip Iceman Twoflower Xenon Scrap Thomas Heinrich Sonix Tom Hall Rufferto Ramjet Yoga Premium Motion Blade Master Matt Sephton Magus Axelsoft Charon Jono Owl Viper Valentine Montaner Jovis Cyclone Kim Buker Chansler Rack Richard William Mueller Connor Wayne Geir Straume Wacek Slaxx Smiley Mo Fieserwolf Chrome Skywalker Black Sky TRS Pippin Denthor Ace Ratman Offset TPD Pix3M Yolan MoN dw817 Bimber Jugi Shaja Herrbdog Cheepicus Error Easley Scanner Chester Emily Huo Nik Cougar Mo Warden Woz MC Laser dynaCore Raist Marvel Bingo Vixen Slaine Raven Furyo Rudi Dr.Jar Xenit Navy Zebra Time Thrust MeatBall Stingray JSF Bridgeclaw Polux Seen Epsilon Cobra Groxy Anders Ekstrom Zaborak Spike Goldevil Focus Kwon Terbert Random Tox Typhoon Jaggerboy Technoimage Cheesy Silco Oli Bubis Golmo Spy Reward Frodo Monopoly Sector 9 Slash Renker Hof Mad Butcher A.D. Zappy Johnny Turbo Phan Alta Manar Nick23 Deus Triatian Sonic JMS Bugbear Rick Oxar Bod Paranoid Clasch Dan Striper Dust Israel Prrak PMA Agro Zin Rock Lobster Lucifer Fraxion Bizox Panic Apollyon Deflector Cmr Designer Daryl Orcslayer Violence Defcon 5 Galdor Darry Booper Human Double Trouble Uncle Evil Stick The Master Dieu Mad Ioda MR40 Megadeth Diesel Nic Headhunter Aces Dr. Death Zanac Griff Carmera Ice Cube
By year
Show fonts begining with…
0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

The format

BMF version 1.1

offset size meaning
04magic header (0xE1E6D51A)
41version (0x11)
51lineHeight – measure from lowest to highest reach
(0…255) should be equal to or greater than sizeUnder – sizeOver
61sizeOver (–128…127)
measure from baseline to top of capital letters, in pixels; should be negative
71sizeUnder (–128…127)
measure from baseline to lowest extends (of letters like "y", "g"), in pixels; should be positive or zero
81addSpace after each char (–128…127)
how many pixels to add after plotting each character l2r
91sizeInner (height of small letters) (–128…127)
measure from baseline to top of small letters (e.g. "m"); should be negative
101usedColors – count of used colors
111highest used color attribute
124reserved (0)
161number of colors in palette, not counting color #0 (P)
17P*3font palette (array of RGB triplets, 6 bits/0…63 per component)
17+P*31title length (T)
18+P*3Ttitle or description of the font (string)
19+P*3+T2numChars – number of characters in font i.e. having non-zero size or shift (N)
20+P*3+T?bitmap definitions

N * (which character (its ASCII code 0…255), followed by its tablo entry)
E.g. "A", <tablo entry for "A">, "B", <tablo entry for "B">, "C", <tablo entry for "C">, …

Tablo entry has the following structure:

offsetsizemeaning
01character width (W)
11character height (H)
21relX – X offset from cursor position (–128…127)
31relY – Y offset from cursor position (–128…127)
41shift – horizontal cursor shift after drawing the character
5W * Hcharacter bitmap (uncompressed, row-major, 8 bits per pixel)

Each character with its width * height and shift equal to zero is considered empty (unused) and as such its entry is not stored. Characters with empty bitmaps but non-zero shift are valid, i.e. its tablo entry follows. Bitmap of 0×0 pixels = empty string. For example, space usually has no bitmap but its shift parameter is important to store within the font.

BMF version 1.2

Quick overview of changes from version 1.1:

  • Unicode support
  • alpha channel option
  • multiple palettes
  • kerning pairs

Basic backward compatibility maintained.

offsetsizemeaning
04magic header (0xE1E6D51A Little-Endian)
41version (0x12)
51lineHeight – measure from lowest to highest reach
(0…255) should be equal to or greater than size-under – size-over
61sizeOver (–128…127)
measure from baseline to top of capital letters, in pixels; should be negative
71sizeUnder (–128…127)
measure from baseline to lowest extends (of letters like "y", "g"), in pixels; should be positive or zero
81addSpace after each char (–128…127)
how many pixels to add after plotting each character
91sizeInner (height of small letters) (–128…127)
measure from baseline to top of small letters (e.g. "m"); should be negative
101usedColors – count of used colors
111highest used color attribute
121alphaBits – how many bits of each bitmap byte the alpha channel occupy? (0…8)
131extraPalettes – how many additional palettes there are (all palettes must fit into the 255-entry field)
142reserved (0)
161number of colors in palette, not counting color #0 (P)
17P*3font palette (array of RGB triplets, 6 bits/0…63 per component)
17+P*31title length (T)
18+P*3Ttitle or description of the font (string)
19+P*3+T2asciiChars – number of characters in font of codes under 128 (N)
20+P*3+T?bitmap definitions

N * (which character (its ASCII code 0…127), followed by its tablo entry)
E.g. "A", <tablo entry for "A">, "B", <tablo entry for "B">, "C", <tablo entry for "C">, …

Tablo entry has the following structure:

offsetsizemeaning
01character width (W)
11character height (H)
21relX – X offset from cursor position (–128…127)
31relY – Y offset from cursor position (–128…127)
41shift – horizontal cursor shift after drawing the character
5W * Hcharacter bitmap (uncompressed, row-major, 8 bits per pixel)
after that follows
sizemeaning
4unicodeChars (32-bit unsigned int) – how many characters of Unicode code greater than 255 follow (U)

U * (which character (32-bit unsigned int), followed by its tablo entry (same format as above)

after that follows
sizemeaning
4kerningPairs (32-bit unsigned int) – how many kerning pairs are defined (K)

K * kerning pair definition

offsetsizemeaning
04first character (its Unicode code, 32-bit unsigned int)
44second character
82correction (16-bit signed int), positive=shift right, negative=shift left

Example #1: Inside BMF

Hex dump of a BMF
Raw view of a small font, here only with characters A,B, and C.

Example #2: tablo attributes

For this example, let addSpace = 1, sizeOver = –8. The initial [x, y] of the layout is not the top-left corner of the first char's bitmap, it lies on the baseline. It should be the layout routine to add (usually negative) font's sizeOver to the y-coordinate. In the picture, the blue line is the base line, the blue cursor is the initial position to plot the text, the red cursor, being sizeOver pixels down from the base line, indicate cursor position before outputing each character of the text. Finally, to get to the actual top-left corners of each bitmap, we need to add the (relX, relY) vector from each character's tablo.

Example: tablo attributes
Fj:Q
width4418
height8949
relX0–210
relY0220
shift4238

Working with the format

Pseudocode for loading a font

filename = "font.bmf";
file = fopen(filename, "rb");
buffer = fread(file, 17);
version = buffer[4];
if (substr(buffer, 0, 4) != "\xE1\xE6\xD5\x1A" || (version != 0x11 && version != 0x12)) {
  exit('Not a BMF, version 1.1 or 1.2');
}
lineHeight = buffer[5];
sizeOver = buffer[6];
sizeUnder = buffer[7];
addSpace = buffer[8];
sizeInner = buffer[9];
usedColors = buffer[10];
highestColor = buffer[11];
alphaBits = buffer[12];
extraPalettes = buffer[13];
reserved = buffer[14];
numColors = buffer[16];
palette = fread(file, numColors * 3);
for (i = 1; i <= numColors * 3; i++) {
  palette[i] *= 4; // stretch 0..63 values to 0..255
}
titleLength = fread(file, 1);
title = fread(file, titleLength);
asciiChars = fread(file, 2);
for (i = 0; i < asciiChars; i++) {
  whichChar = fread(file, 1);
  tablo[whichChar] = fread(file, 5);
  if (bitmapSize = tablo[whichChar][0] * tablo[whichChar][1]) {
    tablo[whichChar][5] = fread(file, bitmapSize);
  }
}
if (version >= 0x12) { // next goes for version 1.2+ only
  unicodeChars = fread(file, 4);
  for (i = 0; i < unicodeChars; i++) {
    whichChar = fread(file, 4);
    tablo[whichChar] = fread(file, 5);
    if (bitmapSize = tablo[whichChar][0] * tablo[whichChar][1]) {
      tablo[whichChar][5] = fread(file, bitmapSize);
    }
  }
  numKerningPairs = fread(file, 4);
  kerningPairs = [];
  for (i = 0; i < numKerningPairs; i++) {
    fread(file, kerningPair, 10);
    kerningPairs []= kerningPair;
  }
}
fclose(file);

Pseudocode for layout/output

text = "EXAMPLE ABC";
originalX = cursorX = 30;
cursorY = 20;
lineBreaksEnabled = true;
for (index = 0; index < strlen(text); index++) { // for each character..
  whichChar = ord(text[index]);
  if (lineBreaksEnabled && (whichChar == 13)) { // line break
    cursorY += font.lineHeight;
    cursorX = originalX;
    continue;
  }
  charWidth = font.tablo[whichChar][0];
  charHeight = font.tablo[whichChar][1];
  charRelX = font.tablo[whichChar][2];
  charRelY = font.tablo[whichChar][3];
  charShift = font.tablo[whichChar][4];
  charBitmap = font.tablo[whichChar][5];
  for (bitmapY = 0; bitmapY < charHeight; bitmapY++) { // for each bitmap row..
    for (bitmapX = 0; bitmapX < charWidth; bitmapX++) { // for each bitmap column..
      colorAttribute = charBitmap[bitmapY * charWidth + bitmapX];
      if (colorAttribute) { // leave color attribute 0 as transparent
        setPixel(
          cursorX + charRelX + bitmapX, // x
          cursorY + font.sizeOver + charRelY + bitmapY, // y
          font.palette[colorAttribute]
        );
      }
    }
  }
  cursorX += charShift + font.addSpace; // update cursor position
  if (version >= 0x12 && index < strlen(text) - 1) {
    cursorX += font.kerningPairs[whichChar, ord(text[index + 1])];
  }
}