summaryrefslogtreecommitdiff
path: root/tools/convbdf.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/convbdf.c')
-rw-r--r--tools/convbdf.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/tools/convbdf.c b/tools/convbdf.c
index 141b46f55f..be746c6683 100644
--- a/tools/convbdf.c
+++ b/tools/convbdf.c
@@ -42,13 +42,13 @@ struct font {
42 int firstchar; /* first character in bitmap*/ 42 int firstchar; /* first character in bitmap*/
43 int size; /* font size in glyphs*/ 43 int size; /* font size in glyphs*/
44 bitmap_t* bits; /* 16-bit right-padded bitmap data*/ 44 bitmap_t* bits; /* 16-bit right-padded bitmap data*/
45 unsigned long* offset; /* offsets into bitmap data*/ 45 unsigned int* offset; /* offsets into bitmap data*/
46 unsigned char* width; /* character widths or NULL if fixed*/ 46 unsigned char* width; /* character widths or NULL if fixed*/
47 int defaultchar; /* default char (not glyph index)*/ 47 int defaultchar; /* default char (not glyph index)*/
48 long bits_size; /* # words of bitmap_t bits*/ 48 int bits_size; /* # words of bitmap_t bits*/
49 49
50 /* unused by runtime system, read in by convbdf*/ 50 /* unused by runtime system, read in by convbdf*/
51 unsigned long* offrot; /* offsets into rotated bitmap data*/ 51 unsigned int* offrot; /* offsets into rotated bitmap data*/
52 char * name; /* font name*/ 52 char * name; /* font name*/
53 char * facename; /* facename of font*/ 53 char * facename; /* facename of font*/
54 char * copyright; /* copyright info for loadable fonts*/ 54 char * copyright; /* copyright info for loadable fonts*/
@@ -435,8 +435,8 @@ int bdf_read_header(FILE *fp, struct font* pf)
435 435
436 /* allocate bits, offset, and width arrays*/ 436 /* allocate bits, offset, and width arrays*/
437 pf->bits = (bitmap_t *)malloc(pf->bits_size * sizeof(bitmap_t) + EXTRA); 437 pf->bits = (bitmap_t *)malloc(pf->bits_size * sizeof(bitmap_t) + EXTRA);
438 pf->offset = (unsigned long *)malloc(pf->size * sizeof(unsigned long)); 438 pf->offset = (unsigned int *)malloc(pf->size * sizeof(unsigned int));
439 pf->offrot = (unsigned long *)malloc(pf->size * sizeof(unsigned long)); 439 pf->offrot = (unsigned int *)malloc(pf->size * sizeof(unsigned int));
440 pf->width = (unsigned char *)malloc(pf->size * sizeof(unsigned char)); 440 pf->width = (unsigned char *)malloc(pf->size * sizeof(unsigned char));
441 441
442 if (!pf->bits || !pf->offset || !pf->offrot || !pf->width) { 442 if (!pf->bits || !pf->offset || !pf->offrot || !pf->width) {
@@ -451,14 +451,14 @@ int bdf_read_header(FILE *fp, struct font* pf)
451/* read bdf font bitmaps, return 0 on error*/ 451/* read bdf font bitmaps, return 0 on error*/
452int bdf_read_bitmaps(FILE *fp, struct font* pf) 452int bdf_read_bitmaps(FILE *fp, struct font* pf)
453{ 453{
454 long ofs = 0; 454 int ofs = 0;
455 long ofr = 0; 455 int ofr = 0;
456 int maxwidth = 0; 456 int maxwidth = 0;
457 int i, k, encoding, width; 457 int i, k, encoding, width;
458 int bbw, bbh, bbx, bby; 458 int bbw, bbh, bbx, bby;
459 int proportional = 0; 459 int proportional = 0;
460 int encodetable = 0; 460 int encodetable = 0;
461 long l; 461 int l;
462 char buf[256]; 462 char buf[256];
463 463
464 /* reset file pointer*/ 464 /* reset file pointer*/
@@ -511,7 +511,7 @@ int bdf_read_bitmaps(FILE *fp, struct font* pf)
511 continue; 511 continue;
512 512
513 /* set bits offset in encode map*/ 513 /* set bits offset in encode map*/
514 if (pf->offset[encoding-pf->firstchar] != (unsigned long)-1) { 514 if (pf->offset[encoding-pf->firstchar] != (unsigned int)-1) {
515 fprintf(stderr, "Error: duplicate encoding for character %d (0x%02x), ignoring duplicate\n", 515 fprintf(stderr, "Error: duplicate encoding for character %d (0x%02x), ignoring duplicate\n",
516 encoding, encoding); 516 encoding, encoding);
517 continue; 517 continue;
@@ -589,7 +589,7 @@ int bdf_read_bitmaps(FILE *fp, struct font* pf)
589 for (i=0; i<pf->size; ++i) { 589 for (i=0; i<pf->size; ++i) {
590 int defchar = pf->defaultchar - pf->firstchar; 590 int defchar = pf->defaultchar - pf->firstchar;
591 591
592 if (pf->offset[i] == (unsigned long)-1) { 592 if (pf->offset[i] == (unsigned int)-1) {
593 pf->offset[i] = pf->offset[defchar]; 593 pf->offset[i] = pf->offset[defchar];
594 pf->offrot[i] = pf->offrot[defchar]; 594 pf->offrot[i] = pf->offrot[defchar];
595 pf->width[i] = pf->width[defchar]; 595 pf->width[i] = pf->width[defchar];
@@ -983,7 +983,7 @@ static int writeshort(FILE *fp, unsigned short s)
983 return putc(s>>8, fp) != EOF; 983 return putc(s>>8, fp) != EOF;
984} 984}
985 985
986static int writelong(FILE *fp, unsigned long l) 986static int writeint(FILE *fp, unsigned int l)
987{ 987{
988 putc(l, fp); 988 putc(l, fp);
989 putc(l>>8, fp); 989 putc(l>>8, fp);
@@ -1041,14 +1041,14 @@ int gen_fnt_file(struct font* pf, char *path)
1041 writeshort(ofp, pf->height); 1041 writeshort(ofp, pf->height);
1042 writeshort(ofp, pf->ascent); 1042 writeshort(ofp, pf->ascent);
1043 writeshort(ofp, 0); 1043 writeshort(ofp, 0);
1044 writelong(ofp, pf->firstchar); 1044 writeint(ofp, pf->firstchar);
1045 writelong(ofp, pf->defaultchar); 1045 writeint(ofp, pf->defaultchar);
1046 writelong(ofp, pf->size); 1046 writeint(ofp, pf->size);
1047 1047
1048 /* variable font data sizes*/ 1048 /* variable font data sizes*/
1049 writelong(ofp, pf->bits_size); /* # words of bitmap_t*/ 1049 writeint(ofp, pf->bits_size); /* # words of bitmap_t*/
1050 writelong(ofp, pf->offset? pf->size: 0); /* # longs of offset*/ 1050 writeint(ofp, pf->offset? pf->size: 0); /* # ints of offset*/
1051 writelong(ofp, pf->width? pf->size: 0); /* # bytes of width*/ 1051 writeint(ofp, pf->width? pf->size: 0); /* # bytes of width*/
1052 /* variable font data*/ 1052 /* variable font data*/
1053#ifdef ROTATE 1053#ifdef ROTATE
1054 for (i=0; i<pf->size; ++i) 1054 for (i=0; i<pf->size; ++i)
@@ -1083,7 +1083,7 @@ int gen_fnt_file(struct font* pf, char *path)
1083 } 1083 }
1084 else 1084 else
1085 { 1085 {
1086 /* bitmap offset is large then 64K, use unsigned long for offset */ 1086 /* bitmap offset is large then 64K, use unsigned int for offset */
1087 while (ftell(ofp) & 3) 1087 while (ftell(ofp) & 3)
1088 writebyte(ofp, 0); /* pad to 32-bit boundary*/ 1088 writebyte(ofp, 0); /* pad to 32-bit boundary*/
1089 } 1089 }
@@ -1095,7 +1095,7 @@ int gen_fnt_file(struct font* pf, char *path)
1095 if ( pf->bits_size < 0xFFDB ) 1095 if ( pf->bits_size < 0xFFDB )
1096 writeshort(ofp, pf->offrot[i]); 1096 writeshort(ofp, pf->offrot[i]);
1097 else 1097 else
1098 writelong(ofp, pf->offrot[i]); 1098 writeint(ofp, pf->offrot[i]);
1099 } 1099 }
1100 } 1100 }
1101 1101
@@ -1110,7 +1110,7 @@ int gen_fnt_file(struct font* pf, char *path)
1110 1110
1111 if (pf->offset) 1111 if (pf->offset)
1112 for (i=0; i<pf->size; ++i) 1112 for (i=0; i<pf->size; ++i)
1113 writelong(ofp, pf->offset[i]); 1113 writeint(ofp, pf->offset[i]);
1114 1114
1115 if (pf->width) 1115 if (pf->width)
1116 for (i=0; i<pf->size; ++i) 1116 for (i=0; i<pf->size; ++i)