diff -uNr kbd-0.99.orig/po/cat-id-tbl.c kbd-0.99.build/po/cat-id-tbl.c --- kbd-0.99.orig/po/cat-id-tbl.c Sun Mar 14 20:50:46 1999 +++ kbd-0.99.build/po/cat-id-tbl.c Fri Jul 21 01:59:44 2000 @@ -192,7 +192,7 @@ {"Error reading input font", 114}, {"\ Setfont is so naive as to believe that font files\n\ -have a size of at most 32kB. Unfortunately it seems\n\ +have a size of at most 64kB. Unfortunately it seems\n\ that you encountered an exception. If this really is\n\ a font file, (i) recompile setfont, (ii) tell aeb@cwi.nl .\n", 115}, {"Unsupported psf file mode\n", 116}, diff -uNr kbd-0.99.orig/src/kdfontop.c kbd-0.99.build/src/kdfontop.c --- kbd-0.99.orig/src/kdfontop.c Mon Mar 8 17:13:59 1999 +++ kbd-0.99.build/src/kdfontop.c Fri Jul 21 03:38:35 2000 @@ -124,7 +124,7 @@ int -getfont(int fd, char *buf, int *count) { +getfont(int fd, char *buf, int *count, int *width, int *height) { struct consolefontdesc cfd; struct console_font_op cfo; int i; @@ -132,12 +132,17 @@ /* First attempt: KDFONTOP */ cfo.op = KD_FONT_OP_GET; cfo.flags = 0; - cfo.width = cfo.height = 0; + /* 4 * 32 * 512 == MAXSIZE */ + cfo.width = 32; cfo.height = 32; cfo.charcount = *count; cfo.data = buf; i = ioctl(fd, KDFONTOP, &cfo); if (i == 0) { *count = cfo.charcount; + *width = cfo.width; + *height = cfo.height; +/* printf ("Got font w/ KDFONTOP: %i chars à %ix%i\n", + cfo.charcount, cfo.width, cfo.height); */ return 0; } if (errno != ENOSYS && errno != EINVAL) { @@ -152,6 +157,7 @@ i = ioctl(fd, GIO_FONTX, &cfd); if (i == 0) { *count = cfd.charcount; + *height = cfd.charheight; return 0; } if (errno != ENOSYS && errno != EINVAL) { @@ -174,18 +180,19 @@ } int -putfont(int fd, char *buf, int count, int height) { +putfont(int fd, char *buf, int count, int width, int height, int hwunit) { struct consolefontdesc cfd; struct console_font_op cfo; int i; - if (!height) - height = font_charheight(buf, count); + if (!hwunit) + hwunit = font_charheight(buf, count); + if (!width) width = 8; /* First attempt: KDFONTOP */ cfo.op = KD_FONT_OP_SET; cfo.flags = 0; - cfo.width = 8; + cfo.width = width; cfo.height = height; cfo.charcount = count; cfo.data = buf; diff -uNr kbd-0.99.orig/src/ksyms.c kbd-0.99.build/src/ksyms.c --- kbd-0.99.orig/src/ksyms.c Fri Jul 21 00:41:59 2000 +++ kbd-0.99.build/src/ksyms.c Fri Jul 21 04:44:15 2000 @@ -469,6 +469,22 @@ "", "", "", "", "", "dotlessi", "scedilla", "" }; +static char *iso_8859_15_syms[] = { /* latin-15 */ + /* Similar to latin-1, 0xa0 -- 0xbf */ + "", "", "", "", "euro", "", "Scaron", "", /* 0xa0 -- 0xa7 */ + "scaron", "", "", "", "", "", "", "", + "", "", "", "", "Zcaron", "", "", "", /* 0xb0 -- 0xb7 */ + "zcaron", "", "", "", "OE", "oe", "Ydiaresis", "", + "", "", "", "", "", "", "", "", /* 0xc0 */ + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", /* 0xd0 */ + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", /* 0xe0 */ + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", /* 0xf0 */ + "", "", "", "", "", "", "", "" +}; + #include "cyrillic.syms.h" #include "ethiopic.syms.h" @@ -830,6 +846,7 @@ { "iso-8859-7", iso_8859_7_syms, 160 }, { "iso-8859-8", iso_8859_8_syms, 160 }, { "iso-8859-9", iso_8859_9_syms, 208 }, + { "iso-8859-15", iso_8859_15_syms, 192 }, { "koi8-r", koi8_r_syms, 160 }, { "koi8-u", koi8_u_syms, 160 }, { "iso-10646-18", iso_10646_18_syms, 159 }, /* ethiopic */ diff -uNr kbd-0.99.orig/src/psf.h kbd-0.99.build/src/psf.h --- kbd-0.99.orig/src/psf.h Thu Nov 13 14:22:52 1997 +++ kbd-0.99.build/src/psf.h Fri Jul 21 02:57:54 2000 @@ -3,7 +3,11 @@ #define PSF_MODE512 0x01 #define PSF_MODEHASTAB 0x02 -#define PSF_MAXMODE 0x03 +#define PSF_WIDTH_MASK 0x3c /* width = 8 + ((mode & PSF_WIDTH_MASK) >> 2); */ + /* if (width > 32) width = 40 - width; */ + /* 0<<2: 8, 1<<2: 9, ..., 24<<2: 32; + * 25<<2: 7, 26<<2: 6, .... 31<<2: 1; */ +#define PSF_MAXMODE 0x1f #define PSF_SEPARATOR 0xFFFF struct psf_header diff -uNr kbd-0.99.orig/src/setfont.c kbd-0.99.build/src/setfont.c --- kbd-0.99.orig/src/setfont.c Mon Mar 8 22:35:11 1999 +++ kbd-0.99.build/src/setfont.c Fri Jul 21 04:02:59 2000 @@ -39,14 +39,16 @@ extern void appendunicodemap(int fd, FILE *fp, int ct); extern void activatemap(void); extern int getfd(void); -extern int getfont(int fd, char *buf, int *count); -extern int putfont(int fd, char *buf, int count, int height); +extern int getfont(int fd, char *buf, int *count, int *width, int *height); +extern int putfont(int fd, char *buf, int count, int width, int height, int hwunit); extern int font_charheight(char *buf, int count); extern char *malloc(); int verbose = 0; int force = 0; +#define MAXSIZE 65536 + /* search for the font in these directories (with trailing /) */ char *fontdirpath[] = { "", DATADIR "/" FONTDIR "/", 0 }; char *fontsuffixes[] = { "", ".psfu", ".psf", ".cp", ".fnt", 0 }; @@ -73,6 +75,7 @@ "Explicitly (with -m or -u) or implicitly (in the fontfile) given mappings will\n" "be loaded and, in the case of consolemaps, activated.\n" " -h (no space) Override font height.\n" +" -w (no space) Override font width.\n" " -m none Suppress loading and activation of a mapping table.\n" " -u none Suppress loading of a unicode map.\n" " -v Be verbose.\n" @@ -86,7 +89,7 @@ main(int argc, char *argv[]) { char *ifil, *mfil, *ufil, *Ofil, *ofil, *omfil, *oufil; - int fd, i, iunit, hwunit, no_m, no_u; + int fd, i, iunit, hwunit, hwwidth, no_m, no_u; int restore = 0; progname = argv[0]; @@ -98,7 +101,7 @@ fd = getfd(); ifil = mfil = ufil = Ofil = ofil = omfil = oufil = 0; - iunit = hwunit = 0; + iunit = hwunit = 0; hwwidth = 8; no_m = no_u = 0; for (i = 1; i < argc; i++) { @@ -145,6 +148,10 @@ hwunit = atoi(argv[i]+2); if (hwunit <= 0 || hwunit > 32) usage(); + } else if (!strncmp(argv[i], "-w", 2)) { + hwwidth = atoi(argv[i]+2); + if (hwwidth <= 0 || hwwidth > 16) + usage(); } else if (argv[i][0] == '-') { iunit = atoi(argv[i]+1); if(iunit <= 0 || iunit > 32) @@ -211,28 +218,29 @@ } static void -do_loadfont(int fd, char *inbuf, int unit, int hwunit, int fontsize) { - char buf[16384]; +do_loadfont(int fd, char *inbuf, int height, int hwunit, int width, int fontsize) { + char buf[MAXSIZE]; int i; + int bpl = (width + 7) / 8; memset(buf,0,sizeof(buf)); - if (unit < 1 || unit > 32) { - fprintf(stderr, _("Bad character size %d\n"), unit); + if (height < 1 || height > 32) { + fprintf(stderr, _("Bad character size %d\n"), height); exit(1); } if (!hwunit) - hwunit = unit; + hwunit = (height > 32? 64: (height > 16? 32: (height > 8? 16: 8))); for (i = 0; i < fontsize; i++) - memcpy(buf+(32*i), inbuf+(unit*i), unit); + memcpy(buf+(32*i*bpl), inbuf+(hwunit*i*bpl), hwunit*bpl); if (verbose) - printf(_("Loading %d-char 8x%d font from file %s\n"), - fontsize, unit, pathname); + printf(_("Loading %d-char %dx%d (%d) font from file %s\n"), + fontsize, width, height, hwunit, pathname); - if (putfont(fd, buf, fontsize, hwunit)) + if (putfont(fd, buf, fontsize, width, height, hwunit)) exit(1); } @@ -301,7 +309,7 @@ FILE *fpi; char defname[20]; int unit; - char inbuf[32768]; /* primitive */ + char inbuf[MAXSIZE]; /* primitive */ int inputlth, offset; if (!*ifil) { @@ -349,7 +357,7 @@ if (!feof(fpi)) { fprintf(stderr, _( "Setfont is so naive as to believe that font files\n" -"have a size of at most 32kB. Unfortunately it seems\n" +"have a size of at most 64kB. Unfortunately it seems\n" "that you encountered an exception. If this really is\n" "a font file, (i) recompile setfont, (ii) tell aeb@cwi.nl .\n" )); @@ -362,6 +370,7 @@ struct psf_header psfhdr; int fontsize; int hastable; + int width, height; int head0, head; if (inputlth < sizeof(struct psf_header)) @@ -378,14 +387,21 @@ } fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256); hastable = (psfhdr.mode & PSF_MODEHASTAB); - unit = psfhdr.charsize; + width = 8 + ((psfhdr.mode & PSF_WIDTH_MASK) >> 2); + if (width > 32) width = 40 - width; + height = psfhdr.charsize; + if (!hwunit) + hwunit = (height > 32? 64: (height > 16? 32: (height > 8? 16: 8))); + + if (verbose) printf ("Loaded %d char font %ix%i (%i)\n", + fontsize, width, height, hwunit); head0 = sizeof(struct psf_header); - head = head0 + fontsize*unit; + head = head0 + fontsize*hwunit*((width + 7)/8); if (head > inputlth || (!hastable && head != inputlth)) { fprintf(stderr, _("Input file: bad length\n")); exit(1); } - do_loadfont(fd, inbuf + head0, unit, hwunit, fontsize); + do_loadfont(fd, inbuf + head0, height, hwunit, width, fontsize); if (hastable && !no_u) do_loadtable(fd, inbuf + head, inputlth-head, fontsize); return; @@ -405,7 +421,7 @@ offset = 0; unit = inputlth/256; } - do_loadfont(fd, inbuf+offset, unit, hwunit, 256); + do_loadfont(fd, inbuf+offset, unit, hwunit, 8, 256); } static int @@ -443,20 +459,27 @@ static void do_saveoldfont(int fd, char *ofil, FILE *fpo, int unimap_follows, int *count) { int i, unit, ct; - char buf[16384]; + int width, height, bpl; + char buf[MAXSIZE]; - ct = sizeof(buf)/32; - if (getfont(fd, buf, &ct)) + height = 0; width = 8; + ct = sizeof(buf)/(4*32); + if (getfont(fd, buf, &ct, &width, &height)) exit(1); /* save as efficiently as possible */ - unit = font_charheight(buf, ct); + if (width == 8) unit = font_charheight(buf, ct); + else unit = (height > 32? 64: (height > 16? 32: (height > 8? 16: 8))); + if (verbose) + printf ("Character set loaded: %i chars, %ix%i (%i)\n", ct, width, height, unit); + bpl = (width+7)/8; /* Do we need a psf header? */ /* Yes if ct=512 - otherwise we cannot distinguish - a 512-char 8x8 and a 256-char 8x16 font. */ + a 512-char 8x8 and a 256-char 8x16 font. + also for unimap and non-std. widths */ - if (ct != 256 || unimap_follows) { + if (ct != 256 || unimap_follows || width != 8) { struct psf_header psfhdr; psfhdr.magic1 = PSF_MAGIC1; @@ -466,7 +489,11 @@ psfhdr.mode |= PSF_MODE512; if (unimap_follows) psfhdr.mode |= PSF_MODEHASTAB; - psfhdr.charsize = unit; + if (width >= 8) + psfhdr.mode |= (width - 8) << 2; + else + psfhdr.mode |= (32 - width) << 2; + psfhdr.charsize = height; if (fwrite(&psfhdr, sizeof(struct psf_header), 1, fpo) != 1) { fprintf(stderr, _("Cannot write font file header")); exit(1); @@ -477,12 +504,12 @@ fprintf(stderr, _("Found nothing to save\n")); else { for (i = 0; i < ct; i++) - if (fwrite(buf+(32*i), unit, 1, fpo) != 1) { + if (fwrite(buf+(32*i*bpl), unit*bpl, 1, fpo) != 1) { fprintf(stderr, _("Cannot write font file")); exit(1); } if (verbose) - printf(_("Saved %d-char 8x%d font file on %s\n"), ct, unit, ofil); + printf(_("Saved %d-char %dx%d (%d) font file on %s\n"), ct, width, height, unit, ofil); } if (count)