summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-08-23 21:38:26 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-08-23 21:38:26 +0000
commit2d2b1e7cd569c2b6e1b5fc97bb60a7ad2aae0e4d (patch)
treed6e5af173e7b38865606f1387f255fb485db2c70
parent984712f291273acd117662be03fc524babb751f7 (diff)
downloadrockbox-2d2b1e7cd569c2b6e1b5fc97bb60a7ad2aae0e4d.tar.gz
rockbox-2d2b1e7cd569c2b6e1b5fc97bb60a7ad2aae0e4d.zip
patch #1267220 by Frank - phaedrus961
Currently convbdf will sort the bits order in the order of the encoding when creating the .c or .fnt file, but it doesn't update the offsets. This patch makes sure the offsets are updated along with the bits, so that fonts with out of order glyphs display properly. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7392 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--tools/convbdf.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/tools/convbdf.c b/tools/convbdf.c
index d38790b285..002fb6f513 100644
--- a/tools/convbdf.c
+++ b/tools/convbdf.c
@@ -767,7 +767,7 @@ int rotleft(unsigned char *dst, bitmap_t *src, unsigned int width,
int gen_c_source(struct font* pf, char *path)
{
FILE *ofp;
- int i;
+ int i, ofr = 0;
int did_defaultchar = 0;
int did_syncmsg = 0;
time_t t = time(0);
@@ -834,8 +834,10 @@ int gen_c_source(struct font* pf, char *path)
*/
if (pf->offset &&
(pf->offset[i] == pf->offset[pf->defaultchar-pf->firstchar])) {
- if (did_defaultchar)
+ if (did_defaultchar) {
+ pf->offrot[i] = pf->offrot[pf->defaultchar-pf->firstchar];
continue;
+ }
did_defaultchar = 1;
}
@@ -881,7 +883,7 @@ int gen_c_source(struct font* pf, char *path)
unsigned char bytemap[256];
int y8, ix=0;
- rotleft(bytemap, bits, width, pf->height);
+ int size = rotleft(bytemap, bits, width, pf->height);
for (y8=0; y8<pf->height; y8+=8) /* column rows */
{
for (x=0; x<width; x++) {
@@ -890,6 +892,11 @@ int gen_c_source(struct font* pf, char *path)
}
fprintf(ofp, "\n");
}
+
+ /* update offrot since bits are now in sorted order */
+ pf->offrot[i] = ofr;
+ ofr += size;
+
}
#else
for (x=BITMAP_WORDS(width)*pf->height; x>0; --x) {
@@ -1040,6 +1047,7 @@ int gen_fnt_file(struct font* pf, char *path)
writelong(ofp, pf->width? pf->size: 0); /* # bytes of width*/
/* variable font data*/
#ifdef ROTATE
+ int ofr = 0;
for (i=0; i<pf->size; ++i)
{
bitmap_t* bits = pf->bits + (pf->offset? pf->offset[i]: (pf->height * i));
@@ -1049,13 +1057,19 @@ int gen_fnt_file(struct font* pf, char *path)
if (pf->offset &&
(pf->offset[i] == pf->offset[pf->defaultchar-pf->firstchar])) {
- if (did_defaultchar)
+ if (did_defaultchar) {
+ pf->offrot[i] = pf->offrot[pf->defaultchar-pf->firstchar];
continue;
+ }
did_defaultchar = 1;
}
size = rotleft(bytemap, bits, width, pf->height);
- writestr(ofp, bytemap, size);
+ writestr(ofp, (char *)bytemap, size);
+
+ /* update offrot since bits are now in sorted order */
+ pf->offrot[i] = ofr;
+ ofr += size;
}
if (ftell(ofp) & 1)