#include #include #include #include #include #include /* * we supports PSF format in XNIX. * in linux, PSF fonts are in /usr/share/kbd/consolefonts, and they are always compressed. * */ #define PSF_MAGIC 0x864ab572 struct psf_header { __uint32_t magic; /* zero */ __uint32_t version; __uint32_t header_size; /* zero if there's no unicode table */ __uint32_t flags; /* in psf, a font calls glyph */ __uint32_t glyphs_count; /* size of a glyph */ __uint32_t glyph_size; __uint32_t height; __uint32_t width; } psf; int main(int argc, const char **argv) { if (!argv[1]) { printf("fatal error: no input file. \n"); return 1; } int fd = open(argv[1], O_RDONLY); read(fd, (void *) &psf, sizeof(struct psf_header)); printf("magic: %x\n", psf.magic); printf("version: %d\n", psf.version); printf("header size: %d\n", psf.header_size); printf("flags (zero if no unicode table): %d\n", psf.flags); printf("glyphs count: %d\n", psf.glyphs_count); printf("glyph size (byte): %d\n", psf.glyph_size); printf("height: %d, width: %d\n", psf.height, psf.width); close(fd); return 0; }