Date: Fri, 26 Nov 1999 18:19:00 +0000 From: Mark Ovens <mark@ukug.uk.freebsd.org> To: Vladimir Terziev <vlady@school.digsys.bg> Cc: freebsd-questions@freebsd.org Subject: Re: Problem Message-ID: <19991126181900.B318@marder-1> In-Reply-To: <199911261343.PAA05048@school.digsys.bg> References: <199911261343.PAA05048@school.digsys.bg>
next in thread | previous in thread | raw e-mail | index | archive | help
--TakKZr9L6Hm6aLOc Content-Type: text/plain; charset=us-ascii On Fri, Nov 26, 1999 at 03:43:43PM +0200, Vladimir Terziev wrote: > > Hi All, > > I have FreeBSD 3.x > I am from Bulgaria and I want to be able to write in bulgarian > cyrillic on virtual consoles. > There is no cp1251 fonts in /usr/share/syscons/fonts, but there > is koi8-r fonts. I want to change the character map in that fonts > and convert it to cp1251. But I don't know the *.fnt structure! > > If anybody knows something about *.fnt font structure, pleace mail at: > This was posted a while back. I've attached the 2 programs mentioned: Evren Yurtesen wrote: > I want to have turkish characters on my freebsd box console > but the problem is I could not find any character set with iso-8859-9 > or any font. > how can I create them? Create a font file under /usr/share/syscons/fonts. The format is very simple; one bit per screen pixel. So, since all fonts are 8 pixels wide, one byte == one line, with varying numbers of lines per character (8, 14 or 16). I actually wrote a couple of *very* rough programs for editing syscons fonts, though there may be better ones available. fontdump will dump a font file to a human readable form, and fontmake reads the human readable format after you've edited it, and write it as a font file. Both read from the file specified by argv[1], write to standard output. Note that the files under /usr/share/syscons/fonts are uuencoded, you'll need to uudecode it before running fontdump on it, and you may as well uuencode your new font before putting it in /usr/share/syscons/fonts. Run something like, $ cp /usr/share/syscons/fonts/iso-8859-2-8x16.fnt . $ uudecode iso-8859-2-8x16.fnt $ fontdump iso-8859-2-8x16 > newfont $ (edit newfont as needed, it should be obvious what the format is.) $ fontmake newfont > iso-8859-9-8x16 Then just copy your iso-8859-9-8x16 file to /usr/share/syscons/fonts and tell the system to use it with vidcontrol. Of course, it may well be that someone has already created the font you need. It may also be worth send-pr'ing your font so it can be included with FreeBSD for other Turkish users. > vlady@school.digsys.bg > > > Vladimir > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message -- PERL has been described as "the duct tape of the Internet" and "the Unix Swiss Army chainsaw" - Computer Shopper 12/99 ________________________________________________________________ FreeBSD - The Power To Serve http://www.freebsd.org My Webpage http://ukug.uk.freebsd.org/~mark/ mailto:mark@ukug.uk.freebsd.org http://www.radan.com --TakKZr9L6Hm6aLOc Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="fontdump.c" #include <sys/types.h> #include <sys/stat.h> #include <ctype.h> #include <err.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> void usage(); void font_dump(FILE *, int); int main(int argc, char **argv) { FILE *fp; struct stat sb; int size; if (getopt(argc, argv, "") != -1) usage(); argc -= optind; argv += optind; if (argc != 1) usage(); if ((fp = fopen(*argv, "r")) == NULL) err(1, "%s", *argv); if (fstat(fileno(fp), &sb) < 0) err(1, "fstat"); if (sb.st_size == 16 * 256) size = 16; else if (sb.st_size == 14 * 256) size = 14; else if (sb.st_size == 8 * 256) size = 8; else errx(1, "unknown font size"); font_dump(fp, size); return (0); } void font_dump(FILE *fp, int size) { int ch, li, d, bit; for (ch = 0; ch < 256; ch++) { printf("- %c ----\n", isprint(ch) ? ch : ' '); for (li = 0; li < size; li++) { d = getc(fp); if (d == EOF) errx(1, "unexpected EOF"); for (bit = 7; bit >= 0; bit--) if (d & (1 << bit)) printf("#"); else printf(" "); printf("\n"); } printf("--------\n"); } } void usage() { fprintf(stderr, "usage: fontedit font\n"); exit(1); } --TakKZr9L6Hm6aLOc Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="fontmake.c" #include <sys/types.h> #include <sys/stat.h> #include <ctype.h> #include <err.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> void usage(); void font_make(FILE *); int main(int argc, char **argv) { FILE *fp; if (getopt(argc, argv, "") != -1) usage(); argc -= optind; argv += optind; if (argc != 1) usage(); if ((fp = fopen(*argv, "r")) == NULL) err(1, "%s", *argv); font_make(fp); return (0); } void font_make(FILE *fp) { char line[20]; int byte, bit, size; size = 0; while (fgets(line, sizeof line, fp) != NULL) { if (strlen(line) > 4 && strcmp(line + 4, "----\n") == 0) { if (size != 0 && size != 8 && size != 14 && size != 16) errx(1, "bad file format, wrong size"); else { size = 0; continue; } } size++; byte = 0; for (bit = 0; bit < 8; bit++) if (line[bit] == '\n') /* end of line, assume all spaces */ break; else if (line[bit] == '#') byte |= 1 << (7 - bit); else if (line[bit] != ' ') errx(1, "bad file format, " "bad character %c (%x)", line[bit], line[bit]); putc(byte, stdout); } if (size != 0 && size != 8 && size != 14 && size != 16) errx(1, "bad file format, wrong size %d (at end)", size); } void usage() { fprintf(stderr, "usage: fontedit font\n"); exit(1); } --TakKZr9L6Hm6aLOc-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991126181900.B318>