Previous: , Up: fontopia: the console font editor   [Contents][Index]


1.9 Frequently Asked Questions

Why is fontopia not able to open my raw font file?

As mentioned in the See Raw fonts section above, fontopia looks at the file size and file name to decide if it is a potential raw font file.

If fontopia fails to open the file, it is probably because the file size is not recognized. Fontopia recognizes the following file sizes for raw fonts: 1536, 2048, 2560, 3072, 3584, 4096, 6144, 7168 and 8192 bytes.

Fontopia opens my raw font, but glyphs are of the wrong width or height?

As mentioned above, it is very difficult to guess a raw font’s glyph size, and fontopia does its best to find this out, but this does not work all the time.

If you know the font’s width and height, you can tell fontopia by passing the -i and -w commandline options:

$ fontopia myfont -i 16 -w 12

This example tells fontopia that myfont is a raw font file and that the glyphs are 12 pixels wide and 16 pixels high. Note if you use these options, you will have to pass both options to fontopia, one will not work without the other.

Why is fontopia not able to open my BDF font file?

BDF fonts are text files that usually start with a line similar to STARTFONT 2.1, but this is not always the case, and the fonts do not otherwise have a file signature. The only way fontopia recognizes a BDF font is if it has a .bdf extension. If your BDF font does not have this extension, this is the likely cause of your problem.

Why is fontopia not able to open my Code Page (CP) font file?

Same issue as for BDF fonts. Save your font with a .cp extension, and everything should work as expected.

How can I export the text representation of my font’s glyphs?

Open the font in fontopia, then press W. The glyph data will be written to a file with the same name as the font file but with a .glyph extension.

I want to embed my font in a C project. Can fontopia help?

Yes it can!

Open the font in fontopia, then press CTRL-W. The glyph data will be written to a file with the same name as the font file but with a .c extension.

The font data is export as a uint8_t array that you can use in your C project. The array looks like:

uint8_t fontdata[] =
{
    /* glyph #1 */ 0xff, 0xff, ...
    /* glyph #2 */ 0xff, 0xff, ...
    ...
}

The exported file also contains some helpful macros that define the glyph width, height and size (in bytes). Glyphs are stored sequentially in the array, and you can get a particular glyph knowing its index:

uint8_t *glyph = fontdata + (index * CHAR_BYTES);

Where CHAR_BYTES is one of the macros fontopia automatically defines in the exported file.


Previous: Raw fonts, Up: fontopia: the console font editor   [Contents][Index]