diff options
author | Eric Linenberg <elinenbe@umich.edu> | 2002-09-16 03:18:49 +0000 |
---|---|---|
committer | Eric Linenberg <elinenbe@umich.edu> | 2002-09-16 03:18:49 +0000 |
commit | 038df5cdc99c53530f52f7c0755bd64c473908b0 (patch) | |
tree | 1e0e408a276d727270a7f0496abbb908b2d76dd9 | |
parent | 8e1a00ccb290aacc5236698ea9159a377c822ec6 (diff) | |
download | rockbox-038df5cdc99c53530f52f7c0755bd64c473908b0.tar.gz rockbox-038df5cdc99c53530f52f7c0755bd64c473908b0.zip |
Daniel,
The following patch makes loadable fonts actually work (finally!).
It took me quite a while, but I finally figured out why the sim
worked and the target didn't: the SH1 processor won't read
longwords from a shortword alignment... I had to rev the .fnt
file to version 1.1 (requires remaking *.fnt files) in order
to fix this. Please apply the following patch completely.
It's diffed against the latest CVS.
I've also attached rockbox-fonts-1.1.tar.gz which includes
known working *.fnt files, including a courB08 system.fnt,
for demonstration.
Now the real work can begin... Although the new
system.fnt will work fine, if you try going to a really
big font (try copying courB14.fnt to system.fnt), then
you will find that it comes up and works in tree mode,
but will crash the system when going into WPS
mode... I'm sure this is because of the low-level
lcd_bitmap not clipping properly when given a too-large
bitmap, which the characters become. I haven't yet
tried to debug the low-level driver. Of course, it all
works on the sim...
So the apps developers will now have to make sure that
all apps screen sizes may vary according to the loaded font.
The font height can be gotten through the lcd_getfontsize API.
Files patched in fonts-6.patch
1. apps/menu.c - LCD_PROPFONTS error (2nd resubmission on this, please checkin)
2. firmware/font.c - fixes and reformatting. Please check this in as is,
my vi editor requires more reformatting changes since I left tabs in the
file, these are removed now (2nd resubmission on this, please checkin)
3. firmware/fonts.h - doc change on .fnt file format, .fnt version
number incremented.
4. firmware/loadfont.c - fixes to load font properly, typedefs
removed.
5. firmware/system.c - lcd_setfont(FONT_SYSFIXED) before
issuing error, otherwise font may not exist.
6. tools/bdf2c - fixes for correct output when filename starts
with a number, as well as when no DEFAULT_CHAR in .bdf
file. (2nd resubmission on this, please checkin)
7. tools/writerbf.c - fixes for bugfixed fontfile format.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2294 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/menu.c | 4 | ||||
-rw-r--r-- | firmware/font.c | 38 | ||||
-rw-r--r-- | firmware/font.h | 7 | ||||
-rw-r--r-- | firmware/loadfont.c | 28 | ||||
-rw-r--r-- | firmware/system.c | 4 | ||||
-rwxr-xr-x | tools/bdf2c | 19 | ||||
-rw-r--r-- | tools/writerbf.c | 5 |
7 files changed, 67 insertions, 38 deletions
diff --git a/apps/menu.c b/apps/menu.c index dd5b9ba1e8..a42929ccf5 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -125,7 +125,7 @@ void put_cursorxy(int x, int y, bool on) | |||
125 | static void menu_draw(int m) | 125 | static void menu_draw(int m) |
126 | { | 126 | { |
127 | int i = 0; | 127 | int i = 0; |
128 | #if LCD_PROPFONTS | 128 | #ifdef HAVE_LCD_BITMAP |
129 | int fw, fh; | 129 | int fw, fh; |
130 | int menu_lines; | 130 | int menu_lines; |
131 | lcd_getfontsize(FONT_UI, &fw, &fh); | 131 | lcd_getfontsize(FONT_UI, &fw, &fh); |
@@ -175,7 +175,7 @@ static void menu_draw(int m) | |||
175 | static void put_cursor(int m, int target) | 175 | static void put_cursor(int m, int target) |
176 | { | 176 | { |
177 | bool do_update = true; | 177 | bool do_update = true; |
178 | #if LCD_PROPFONTS | 178 | #ifdef HAVE_LCD_BITMAP |
179 | int fw, fh; | 179 | int fw, fh; |
180 | int menu_lines; | 180 | int menu_lines; |
181 | lcd_getfontsize(FONT_UI, &fw, &fh); | 181 | lcd_getfontsize(FONT_UI, &fw, &fh); |
diff --git a/firmware/font.c b/firmware/font.c index 5237f7d2aa..e9c70cd64e 100644 --- a/firmware/font.c +++ b/firmware/font.c | |||
@@ -83,6 +83,8 @@ getfont(int font) | |||
83 | { | 83 | { |
84 | PMWCFONT pf; | 84 | PMWCFONT pf; |
85 | 85 | ||
86 | if (font >= MAXFONTS) | ||
87 | font = 0; | ||
86 | while (1) { | 88 | while (1) { |
87 | pf = sysfonts[font].pf; | 89 | pf = sysfonts[font].pf; |
88 | if (pf && pf->height) | 90 | if (pf && pf->height) |
@@ -115,13 +117,13 @@ lcd_getstringsize(unsigned char *str, int font, int *w, int *h) | |||
115 | int width = 0; | 117 | int width = 0; |
116 | 118 | ||
117 | while((ch = *str++)) { | 119 | while((ch = *str++)) { |
118 | /* check input range*/ | 120 | /* check input range*/ |
119 | if (ch < pf->firstchar || ch >= pf->firstchar+pf->size) | 121 | if (ch < pf->firstchar || ch >= pf->firstchar+pf->size) |
120 | ch = pf->defaultchar; | 122 | ch = pf->defaultchar; |
121 | ch -= pf->firstchar; | 123 | ch -= pf->firstchar; |
122 | 124 | ||
123 | /* get proportional width and glyph bits*/ | 125 | /* get proportional width and glyph bits*/ |
124 | width += pf->width? pf->width[ch]: pf->maxwidth; | 126 | width += pf->width? pf->width[ch]: pf->maxwidth; |
125 | } | 127 | } |
126 | *w = width; | 128 | *w = width; |
127 | *h = pf->height; | 129 | *h = pf->height; |
@@ -150,7 +152,11 @@ lcd_putsxy(int x, int y, unsigned char *str, int font) | |||
150 | 152 | ||
151 | /* get proportional width and glyph bits*/ | 153 | /* get proportional width and glyph bits*/ |
152 | width = pf->width? pf->width[ch]: pf->maxwidth; | 154 | width = pf->width? pf->width[ch]: pf->maxwidth; |
153 | if(x + width > LCD_WIDTH) | 155 | if (x + width > LCD_WIDTH) |
156 | break; | ||
157 | |||
158 | /* no partial-height drawing for now...*/ | ||
159 | if (y + pf->height > LCD_HEIGHT) | ||
154 | break; | 160 | break; |
155 | bits = pf->bits + (pf->offset? pf->offset[ch]: (pf->height * ch)); | 161 | bits = pf->bits + (pf->offset? pf->offset[ch]: (pf->height * ch)); |
156 | 162 | ||
@@ -224,29 +230,29 @@ rotleft(unsigned char *dst, MWIMAGEBITS *src, unsigned int width, | |||
224 | MWIMAGEBITS srcmap; /* current src input bit*/ | 230 | MWIMAGEBITS srcmap; /* current src input bit*/ |
225 | MWIMAGEBITS dstmap; /* current dst output bit*/ | 231 | MWIMAGEBITS dstmap; /* current dst output bit*/ |
226 | 232 | ||
227 | /* calc src input bit*/ | 233 | /* calc src input bit*/ |
228 | srcmap = 1 << (sizeof(MWIMAGEBITS)*8-1); | 234 | srcmap = 1 << (sizeof(MWIMAGEBITS)*8-1); |
229 | 235 | ||
230 | /* calc dst output bit*/ | 236 | /* calc dst output bit*/ |
231 | if (i>0 && (i%8==0)) { | 237 | if (i>0 && (i%8==0)) { |
232 | ++dst_col; | 238 | ++dst_col; |
233 | dst_shift = 0; | 239 | dst_shift = 0; |
234 | } | 240 | } |
235 | dstmap = 1 << dst_shift++; | 241 | dstmap = 1 << dst_shift++; |
236 | 242 | ||
237 | /* for each input column...*/ | 243 | /* for each input column...*/ |
238 | for(j=0; j < width; j++) { | 244 | for(j=0; j < width; j++) { |
239 | 245 | ||
240 | /* calc input bitmask*/ | 246 | /* calc input bitmask*/ |
241 | MWIMAGEBITS bit = srcmap >> j; | 247 | MWIMAGEBITS bit = srcmap >> j; |
242 | if (bit==0) { | 248 | if (bit==0) { |
243 | srcmap = 1 << (sizeof(MWIMAGEBITS)*8-1); | 249 | srcmap = 1 << (sizeof(MWIMAGEBITS)*8-1); |
244 | bit = srcmap >> (j % 16); | 250 | bit = srcmap >> (j % 16); |
245 | } | 251 | } |
246 | 252 | ||
247 | /* if set in input, set in rotated output*/ | 253 | /* if set in input, set in rotated output*/ |
248 | if (bit & src[i]) { | 254 | if (bit & src[i]) { |
249 | /* input column j becomes output row*/ | 255 | /* input column j becomes output row*/ |
250 | dst[j*dst_linelen + dst_col] |= dstmap; | 256 | dst[j*dst_linelen + dst_col] |= dstmap; |
251 | } | 257 | } |
252 | /*debugf((bit & src[i])? "*": ".");*/ | 258 | /*debugf((bit & src[i])? "*": ".");*/ |
@@ -259,6 +265,6 @@ rotleft(unsigned char *dst, MWIMAGEBITS *src, unsigned int width, | |||
259 | /* ----------------------------------------------------------------- | 265 | /* ----------------------------------------------------------------- |
260 | * local variables: | 266 | * local variables: |
261 | * eval: (load-file "rockbox-mode.el") | 267 | * eval: (load-file "rockbox-mode.el") |
262 | * vim: et sw=4 ts=4 sts=4 tw=78 | 268 | * vim: et sw=4 ts=8 sts=4 tw=78 |
263 | * end: | 269 | * end: |
264 | */ | 270 | */ |
diff --git a/firmware/font.h b/firmware/font.h index 8535ab216b..645848ee18 100644 --- a/firmware/font.h +++ b/firmware/font.h | |||
@@ -46,7 +46,7 @@ | |||
46 | /* | 46 | /* |
47 | * .fnt (.rbf) loadable font file format definition | 47 | * .fnt (.rbf) loadable font file format definition |
48 | * | 48 | * |
49 | * format len description | 49 | * format len description |
50 | * ------------------------- ---- ------------------------------ | 50 | * ------------------------- ---- ------------------------------ |
51 | * UCHAR version[4] 4 magic number and version bytes | 51 | * UCHAR version[4] 4 magic number and version bytes |
52 | * UCHAR name[64] 64 font name, space padded | 52 | * UCHAR name[64] 64 font name, space padded |
@@ -54,6 +54,7 @@ | |||
54 | * USHORT maxwidth 2 font max width in pixels | 54 | * USHORT maxwidth 2 font max width in pixels |
55 | * USHORT height 2 font height in pixels | 55 | * USHORT height 2 font height in pixels |
56 | * USHORT ascent 2 font ascent (baseline) in pixels | 56 | * USHORT ascent 2 font ascent (baseline) in pixels |
57 | * USHORT pad 2 unused, pad to 32-bit boundary | ||
57 | * ULONG firstchar 4 first character code in font | 58 | * ULONG firstchar 4 first character code in font |
58 | * ULONG defaultchar 4 default character code in font | 59 | * ULONG defaultchar 4 default character code in font |
59 | * ULONG size 4 # characters in font | 60 | * ULONG size 4 # characters in font |
@@ -61,12 +62,13 @@ | |||
61 | * ULONG noffset 4 # longs offset data in file | 62 | * ULONG noffset 4 # longs offset data in file |
62 | * ULONG nwidth 4 # bytes width data in file | 63 | * ULONG nwidth 4 # bytes width data in file |
63 | * MWIMAGEBITS bits nbits*2 image bits variable data | 64 | * MWIMAGEBITS bits nbits*2 image bits variable data |
65 | * [MWIMAGEBITS padded to 32-bit boundary] | ||
64 | * ULONG offset noffset*4 offset variable data | 66 | * ULONG offset noffset*4 offset variable data |
65 | * UCHAR width nwidth*1 width variable data | 67 | * UCHAR width nwidth*1 width variable data |
66 | */ | 68 | */ |
67 | 69 | ||
68 | /* loadable font magic and version #*/ | 70 | /* loadable font magic and version #*/ |
69 | #define VERSION "RB10" | 71 | #define VERSION "RB11" |
70 | 72 | ||
71 | /* MWIMAGEBITS helper macros*/ | 73 | /* MWIMAGEBITS helper macros*/ |
72 | #define MWIMAGE_WORDS(x) (((x)+15)/16) /* image size in words*/ | 74 | #define MWIMAGE_WORDS(x) (((x)+15)/16) /* image size in words*/ |
@@ -122,5 +124,6 @@ void font_init(void); | |||
122 | /* ----------------------------------------------------------------- | 124 | /* ----------------------------------------------------------------- |
123 | * local variables: | 125 | * local variables: |
124 | * eval: (load-file "rockbox-mode.el") | 126 | * eval: (load-file "rockbox-mode.el") |
127 | * vim: et sw=4 ts=8 sts=4 tw=78 | ||
125 | * end: | 128 | * end: |
126 | */ | 129 | */ |
diff --git a/firmware/loadfont.c b/firmware/loadfont.c index 7f572a4841..e78f208b13 100644 --- a/firmware/loadfont.c +++ b/firmware/loadfont.c | |||
@@ -39,9 +39,8 @@ | |||
39 | /* static buffer allocation structures*/ | 39 | /* static buffer allocation structures*/ |
40 | static unsigned char mbuf[MAX_FONT_SIZE]; | 40 | static unsigned char mbuf[MAX_FONT_SIZE]; |
41 | static unsigned char *freeptr = mbuf; | 41 | static unsigned char *freeptr = mbuf; |
42 | typedef unsigned char CFILE; | 42 | static unsigned char *fileptr; |
43 | static CFILE *fileptr; | 43 | static unsigned char *eofptr; |
44 | static CFILE *eofptr; | ||
45 | 44 | ||
46 | static int | 45 | static int |
47 | READSHORT(unsigned short *sp) | 46 | READSHORT(unsigned short *sp) |
@@ -101,9 +100,9 @@ PMWCFONT | |||
101 | rbf_load_font(char *path, PMWCFONT pf) | 100 | rbf_load_font(char *path, PMWCFONT pf) |
102 | { | 101 | { |
103 | int fd, filesize; | 102 | int fd, filesize; |
104 | unsigned short maxwidth, height, ascent; | 103 | unsigned short maxwidth, height, ascent, pad; |
105 | unsigned long firstchar, defaultchar, size; | 104 | unsigned long firstchar, defaultchar, size; |
106 | unsigned long nbits, noffset, nwidth; | 105 | unsigned long i, nbits, noffset, nwidth; |
107 | char version[4+1]; | 106 | char version[4+1]; |
108 | char copyright[256+1]; | 107 | char copyright[256+1]; |
109 | 108 | ||
@@ -115,10 +114,12 @@ rbf_load_font(char *path, PMWCFONT pf) | |||
115 | DEBUGF("Can't open font: %s\n", path); | 114 | DEBUGF("Can't open font: %s\n", path); |
116 | return NULL; | 115 | return NULL; |
117 | } | 116 | } |
117 | freeptr = (unsigned char *)(((int)mbuf + 3) & ~3); | ||
118 | fileptr = freeptr; | 118 | fileptr = freeptr; |
119 | filesize = read(fd, fileptr, MAX_FONT_SIZE); | 119 | filesize = read(fd, fileptr, MAX_FONT_SIZE); |
120 | freeptr += filesize; | ||
121 | eofptr = fileptr + filesize; | 120 | eofptr = fileptr + filesize; |
121 | //freeptr += filesize; | ||
122 | //freeptr = (unsigned char *)(freeptr + 3) & ~3; /* pad freeptr*/ | ||
122 | close(fd); | 123 | close(fd); |
123 | if (filesize == MAX_FONT_SIZE) { | 124 | if (filesize == MAX_FONT_SIZE) { |
124 | DEBUGF("Font %s too large: %d\n", path, filesize); | 125 | DEBUGF("Font %s too large: %d\n", path, filesize); |
@@ -151,6 +152,8 @@ rbf_load_font(char *path, PMWCFONT pf) | |||
151 | if (!READSHORT(&ascent)) | 152 | if (!READSHORT(&ascent)) |
152 | return NULL; | 153 | return NULL; |
153 | pf->ascent = ascent; | 154 | pf->ascent = ascent; |
155 | if (!READSHORT(&pad)) | ||
156 | return NULL; | ||
154 | if (!READLONG(&firstchar)) | 157 | if (!READLONG(&firstchar)) |
155 | return NULL; | 158 | return NULL; |
156 | pf->firstchar = firstchar; | 159 | pf->firstchar = firstchar; |
@@ -177,16 +180,22 @@ rbf_load_font(char *path, PMWCFONT pf) | |||
177 | 180 | ||
178 | /* variable font data*/ | 181 | /* variable font data*/ |
179 | pf->bits = (MWIMAGEBITS *)fileptr; | 182 | pf->bits = (MWIMAGEBITS *)fileptr; |
180 | fileptr += nbits*sizeof(MWIMAGEBITS); | 183 | for (i=0; i<nbits; ++i) |
184 | if (!READSHORT(&pf->bits[i])) | ||
185 | return NULL; | ||
186 | /* pad to longword boundary*/ | ||
187 | fileptr = (unsigned char *)(((int)fileptr + 3) & ~3); | ||
181 | 188 | ||
182 | if (noffset) { | 189 | if (noffset) { |
183 | pf->offset = (unsigned long *)fileptr; | 190 | pf->offset = (unsigned long *)fileptr; |
184 | fileptr += noffset*sizeof(unsigned long); | 191 | for (i=0; i<noffset; ++i) |
192 | if (!READLONG(&pf->offset[i])) | ||
193 | return NULL; | ||
185 | } else pf->offset = NULL; | 194 | } else pf->offset = NULL; |
186 | 195 | ||
187 | if (nwidth) { | 196 | if (nwidth) { |
188 | pf->width = (unsigned char *)fileptr; | 197 | pf->width = (unsigned char *)fileptr; |
189 | fileptr += noffset*sizeof(unsigned char); | 198 | fileptr += nwidth*sizeof(unsigned char); |
190 | } else pf->width = NULL; | 199 | } else pf->width = NULL; |
191 | 200 | ||
192 | if (fileptr > eofptr) | 201 | if (fileptr > eofptr) |
@@ -198,5 +207,6 @@ rbf_load_font(char *path, PMWCFONT pf) | |||
198 | /* ----------------------------------------------------------------- | 207 | /* ----------------------------------------------------------------- |
199 | * local variables: | 208 | * local variables: |
200 | * eval: (load-file "rockbox-mode.el") | 209 | * eval: (load-file "rockbox-mode.el") |
210 | * vim: et sw=4 ts=8 sts=4 tw=78 | ||
201 | * end: | 211 | * end: |
202 | */ | 212 | */ |
diff --git a/firmware/system.c b/firmware/system.c index 74e3fce95d..1dce076093 100644 --- a/firmware/system.c +++ b/firmware/system.c | |||
@@ -19,7 +19,8 @@ | |||
19 | #include <stdio.h> | 19 | #include <stdio.h> |
20 | #include "config.h" | 20 | #include "config.h" |
21 | 21 | ||
22 | #include <lcd.h> | 22 | #include "lcd.h" |
23 | #include "font.h" | ||
23 | #include "led.h" | 24 | #include "led.h" |
24 | #include "system.h" | 25 | #include "system.h" |
25 | 26 | ||
@@ -325,6 +326,7 @@ void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */ | |||
325 | 326 | ||
326 | /* clear screen */ | 327 | /* clear screen */ |
327 | lcd_clear_display (); | 328 | lcd_clear_display (); |
329 | lcd_setfont(FONT_SYSFIXED); | ||
328 | /* output exception */ | 330 | /* output exception */ |
329 | n = (n - (unsigned)UIE0 - 4)>>2; // get exception or interrupt number | 331 | n = (n - (unsigned)UIE0 - 4)>>2; // get exception or interrupt number |
330 | snprintf(str,sizeof(str),"I%02x:%s",n,irqname[n]); | 332 | snprintf(str,sizeof(str),"I%02x:%s",n,irqname[n]); |
diff --git a/tools/bdf2c b/tools/bdf2c index e6b8ee7df7..6832e5ce8f 100755 --- a/tools/bdf2c +++ b/tools/bdf2c | |||
@@ -5,6 +5,7 @@ | |||
5 | # | 5 | # |
6 | # from The Microwindows Project (http://microwindows.org) | 6 | # from The Microwindows Project (http://microwindows.org) |
7 | # | 7 | # |
8 | # modified 09/13/02 correct output when no DEFAULT_CHAR, allow numeric font name | ||
8 | # modified 09/12/02 added -limit <max_encode_hex_value> option | 9 | # modified 09/12/02 added -limit <max_encode_hex_value> option |
9 | # modified on 09/10/02 by G Haerr | 10 | # modified on 09/10/02 by G Haerr |
10 | # - fixed DWIDTH 0 parsing | 11 | # - fixed DWIDTH 0 parsing |
@@ -79,7 +80,7 @@ print " descent: $font_descent\n"; | |||
79 | print "*/\n\n"; | 80 | print "*/\n\n"; |
80 | 81 | ||
81 | print "/* Font character bitmap data. */\n"; | 82 | print "/* Font character bitmap data. */\n"; |
82 | print "static MWIMAGEBITS ${font}_bits[] = {\n"; | 83 | print "static MWIMAGEBITS _${font}_bits[] = {\n"; |
83 | 84 | ||
84 | $ch_height = $font_ascent + $font_descent; | 85 | $ch_height = $font_ascent + $font_descent; |
85 | $ofs = 0; | 86 | $ofs = 0; |
@@ -162,8 +163,10 @@ print "};\n\n"; | |||
162 | 163 | ||
163 | ##print STDERR "Maximum character width=$maxwidth\n"; | 164 | ##print STDERR "Maximum character width=$maxwidth\n"; |
164 | 165 | ||
166 | $default_char = $firstchar if !defined $default_char; | ||
167 | |||
165 | print "/* Character->glyph mapping. */\n"; | 168 | print "/* Character->glyph mapping. */\n"; |
166 | print "static unsigned long ${font}_offset[] = {\n"; | 169 | print "static unsigned long _${font}_offset[] = {\n"; |
167 | for (my $i = $firstchar; $i <= $lastchar; $i++) { | 170 | for (my $i = $firstchar; $i <= $lastchar; $i++) { |
168 | my $char = $i; | 171 | my $char = $i; |
169 | my $ofs = $encoding_tab[$i]; | 172 | my $ofs = $encoding_tab[$i]; |
@@ -177,13 +180,13 @@ $gen_width_table = 0; | |||
177 | for (my $i = $firstchar; $i <= $lastchar; $i++) { | 180 | for (my $i = $firstchar; $i <= $lastchar; $i++) { |
178 | my $char = $i; | 181 | my $char = $i; |
179 | my $width = $width[$i]; | 182 | my $width = $width[$i]; |
180 | $width = $width[$default_char], $char = $default_char if !defined $encoding_tab[$i]; | 183 | $width = $width[$default_char] if !defined $encoding_tab[$i]; |
181 | $gen_width_table = 1 if $width != $maxwidth | 184 | $gen_width_table = 1 if $width != $maxwidth |
182 | } | 185 | } |
183 | 186 | ||
184 | if ($gen_width_table) { | 187 | if ($gen_width_table) { |
185 | print "/* Character width data. */\n"; | 188 | print "/* Character width data. */\n"; |
186 | print "static unsigned char ${font}_width[] = {\n"; | 189 | print "static unsigned char _${font}_width[] = {\n"; |
187 | for (my $i = $firstchar; $i <= $lastchar; $i++) { | 190 | for (my $i = $firstchar; $i <= $lastchar; $i++) { |
188 | my $char = $i; | 191 | my $char = $i; |
189 | my $width = $width[$i]; | 192 | my $width = $width[$i]; |
@@ -204,11 +207,11 @@ print " $ch_height,\n"; | |||
204 | print " $font_ascent,\n"; | 207 | print " $font_ascent,\n"; |
205 | print " $firstchar,\n"; | 208 | print " $firstchar,\n"; |
206 | print " $size,\n"; | 209 | print " $size,\n"; |
207 | print " ${font}_bits,\n"; | 210 | print " _${font}_bits,\n"; |
208 | print " ${font}_offset,\n"; | 211 | print " _${font}_offset,\n"; |
209 | if ($gen_width_table) { | 212 | if ($gen_width_table) { |
210 | print " ${font}_width,\n"; | 213 | print " _${font}_width,\n"; |
211 | } else { print " 0, /* fixed width*/\n"; } | 214 | } else { print " 0, /* fixed width*/\n"; } |
212 | print " $default_char,\n"; | 215 | print " $default_char,\n"; |
213 | print " sizeof(${font}_bits)/sizeof(MWIMAGEBITS),\n"; | 216 | print " sizeof(_${font}_bits)/sizeof(MWIMAGEBITS),\n"; |
214 | print "};\n"; | 217 | print "};\n"; |
diff --git a/tools/writerbf.c b/tools/writerbf.c index b3ba8649ac..3bd55a7c80 100644 --- a/tools/writerbf.c +++ b/tools/writerbf.c | |||
@@ -80,6 +80,7 @@ rbf_write_font(PMWCFONT pf) | |||
80 | WRITESHORT(ofp, pf->maxwidth); | 80 | WRITESHORT(ofp, pf->maxwidth); |
81 | WRITESHORT(ofp, pf->height); | 81 | WRITESHORT(ofp, pf->height); |
82 | WRITESHORT(ofp, pf->ascent); | 82 | WRITESHORT(ofp, pf->ascent); |
83 | WRITESHORT(ofp, 0); | ||
83 | WRITELONG(ofp, pf->firstchar); | 84 | WRITELONG(ofp, pf->firstchar); |
84 | WRITELONG(ofp, pf->defaultchar); | 85 | WRITELONG(ofp, pf->defaultchar); |
85 | WRITELONG(ofp, pf->size); | 86 | WRITELONG(ofp, pf->size); |
@@ -92,9 +93,13 @@ rbf_write_font(PMWCFONT pf) | |||
92 | /* variable font data*/ | 93 | /* variable font data*/ |
93 | for (i=0; i<pf->bits_size; ++i) | 94 | for (i=0; i<pf->bits_size; ++i) |
94 | WRITESHORT(ofp, pf->bits[i]); | 95 | WRITESHORT(ofp, pf->bits[i]); |
96 | if (ftell(ofp) & 2) | ||
97 | WRITESHORT(ofp, 0); /* pad to 32-bit boundary*/ | ||
98 | |||
95 | if (pf->offset) | 99 | if (pf->offset) |
96 | for (i=0; i<pf->size; ++i) | 100 | for (i=0; i<pf->size; ++i) |
97 | WRITELONG(ofp, pf->offset[i]); | 101 | WRITELONG(ofp, pf->offset[i]); |
102 | |||
98 | if (pf->width) | 103 | if (pf->width) |
99 | for (i=0; i<pf->size; ++i) | 104 | for (i=0; i<pf->size; ++i) |
100 | WRITEBYTE(ofp, pf->width[i]); | 105 | WRITEBYTE(ofp, pf->width[i]); |