diff options
Diffstat (limited to 'tools/convbdf.c')
-rw-r--r-- | tools/convbdf.c | 24 |
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, | |||
767 | int gen_c_source(struct font* pf, char *path) | 767 | int gen_c_source(struct font* pf, char *path) |
768 | { | 768 | { |
769 | FILE *ofp; | 769 | FILE *ofp; |
770 | int i; | 770 | int i, ofr = 0; |
771 | int did_defaultchar = 0; | 771 | int did_defaultchar = 0; |
772 | int did_syncmsg = 0; | 772 | int did_syncmsg = 0; |
773 | time_t t = time(0); | 773 | time_t t = time(0); |
@@ -834,8 +834,10 @@ int gen_c_source(struct font* pf, char *path) | |||
834 | */ | 834 | */ |
835 | if (pf->offset && | 835 | if (pf->offset && |
836 | (pf->offset[i] == pf->offset[pf->defaultchar-pf->firstchar])) { | 836 | (pf->offset[i] == pf->offset[pf->defaultchar-pf->firstchar])) { |
837 | if (did_defaultchar) | 837 | if (did_defaultchar) { |
838 | pf->offrot[i] = pf->offrot[pf->defaultchar-pf->firstchar]; | ||
838 | continue; | 839 | continue; |
840 | } | ||
839 | did_defaultchar = 1; | 841 | did_defaultchar = 1; |
840 | } | 842 | } |
841 | 843 | ||
@@ -881,7 +883,7 @@ int gen_c_source(struct font* pf, char *path) | |||
881 | unsigned char bytemap[256]; | 883 | unsigned char bytemap[256]; |
882 | int y8, ix=0; | 884 | int y8, ix=0; |
883 | 885 | ||
884 | rotleft(bytemap, bits, width, pf->height); | 886 | int size = rotleft(bytemap, bits, width, pf->height); |
885 | for (y8=0; y8<pf->height; y8+=8) /* column rows */ | 887 | for (y8=0; y8<pf->height; y8+=8) /* column rows */ |
886 | { | 888 | { |
887 | for (x=0; x<width; x++) { | 889 | for (x=0; x<width; x++) { |
@@ -890,6 +892,11 @@ int gen_c_source(struct font* pf, char *path) | |||
890 | } | 892 | } |
891 | fprintf(ofp, "\n"); | 893 | fprintf(ofp, "\n"); |
892 | } | 894 | } |
895 | |||
896 | /* update offrot since bits are now in sorted order */ | ||
897 | pf->offrot[i] = ofr; | ||
898 | ofr += size; | ||
899 | |||
893 | } | 900 | } |
894 | #else | 901 | #else |
895 | for (x=BITMAP_WORDS(width)*pf->height; x>0; --x) { | 902 | for (x=BITMAP_WORDS(width)*pf->height; x>0; --x) { |
@@ -1040,6 +1047,7 @@ int gen_fnt_file(struct font* pf, char *path) | |||
1040 | writelong(ofp, pf->width? pf->size: 0); /* # bytes of width*/ | 1047 | writelong(ofp, pf->width? pf->size: 0); /* # bytes of width*/ |
1041 | /* variable font data*/ | 1048 | /* variable font data*/ |
1042 | #ifdef ROTATE | 1049 | #ifdef ROTATE |
1050 | int ofr = 0; | ||
1043 | for (i=0; i<pf->size; ++i) | 1051 | for (i=0; i<pf->size; ++i) |
1044 | { | 1052 | { |
1045 | bitmap_t* bits = pf->bits + (pf->offset? pf->offset[i]: (pf->height * i)); | 1053 | 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) | |||
1049 | 1057 | ||
1050 | if (pf->offset && | 1058 | if (pf->offset && |
1051 | (pf->offset[i] == pf->offset[pf->defaultchar-pf->firstchar])) { | 1059 | (pf->offset[i] == pf->offset[pf->defaultchar-pf->firstchar])) { |
1052 | if (did_defaultchar) | 1060 | if (did_defaultchar) { |
1061 | pf->offrot[i] = pf->offrot[pf->defaultchar-pf->firstchar]; | ||
1053 | continue; | 1062 | continue; |
1063 | } | ||
1054 | did_defaultchar = 1; | 1064 | did_defaultchar = 1; |
1055 | } | 1065 | } |
1056 | 1066 | ||
1057 | size = rotleft(bytemap, bits, width, pf->height); | 1067 | size = rotleft(bytemap, bits, width, pf->height); |
1058 | writestr(ofp, bytemap, size); | 1068 | writestr(ofp, (char *)bytemap, size); |
1069 | |||
1070 | /* update offrot since bits are now in sorted order */ | ||
1071 | pf->offrot[i] = ofr; | ||
1072 | ofr += size; | ||
1059 | } | 1073 | } |
1060 | 1074 | ||
1061 | if (ftell(ofp) & 1) | 1075 | if (ftell(ofp) & 1) |