diff options
author | Nils Wallménius <nils@rockbox.org> | 2009-12-13 11:07:40 +0000 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2009-12-13 11:07:40 +0000 |
commit | 559c56905e1208264e87ff3bbc2049eb054f95c8 (patch) | |
tree | 9085ed0f8193d5fd514b6c46d7834341cba37cbf /firmware/export/font.h | |
parent | 5783bef32c792e192ddf0c160cd793971612d0cc (diff) | |
download | rockbox-559c56905e1208264e87ff3bbc2049eb054f95c8.tar.gz rockbox-559c56905e1208264e87ff3bbc2049eb054f95c8.zip |
Font improvements: Fix bug that caused some fonts to be rendered garbled on custom builds with MAX_FONT_SIZE > 64k (closes FS#10844). Simplify version check. Use void pointer and explicit casting for the offsets to make it clearer that they may be of different sizes, add a comment too. Use uint16_t in stead of short in some places for consistency. Replace magic number with meaningful define.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23969 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export/font.h')
-rw-r--r-- | firmware/export/font.h | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/firmware/export/font.h b/firmware/export/font.h index 75b012d722..0fe6c30f2c 100644 --- a/firmware/export/font.h +++ b/firmware/export/font.h | |||
@@ -33,24 +33,6 @@ | |||
33 | #include "sysfont.h" | 33 | #include "sysfont.h" |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | /* max static loadable font buffer size */ | ||
37 | #ifndef MAX_FONT_SIZE | ||
38 | #if LCD_HEIGHT > 64 | ||
39 | #if MEM > 2 | ||
40 | #define MAX_FONT_SIZE 60000 | ||
41 | #else | ||
42 | #define MAX_FONT_SIZE 10000 | ||
43 | #endif | ||
44 | #else | ||
45 | #define MAX_FONT_SIZE 4000 | ||
46 | #endif | ||
47 | #endif | ||
48 | |||
49 | #ifndef FONT_HEADER_SIZE | ||
50 | #define FONT_HEADER_SIZE 36 | ||
51 | #endif | ||
52 | |||
53 | #define GLYPH_CACHE_FILE ROCKBOX_DIR"/.glyphcache" | ||
54 | 36 | ||
55 | /* | 37 | /* |
56 | * Fonts are specified by number, and used for display | 38 | * Fonts are specified by number, and used for display |
@@ -102,7 +84,8 @@ struct font { | |||
102 | int firstchar; /* first character in bitmap*/ | 84 | int firstchar; /* first character in bitmap*/ |
103 | int size; /* font size in glyphs*/ | 85 | int size; /* font size in glyphs*/ |
104 | const unsigned char *bits; /* 8-bit column bitmap data*/ | 86 | const unsigned char *bits; /* 8-bit column bitmap data*/ |
105 | const unsigned short *offset; /* offsets into bitmap data*/ | 87 | const void *offset; /* offsets into bitmap data, |
88 | uint16_t if bits_size < 0xFFDB else uint32_t*/ | ||
106 | const unsigned char *width; /* character widths or NULL if fixed*/ | 89 | const unsigned char *width; /* character widths or NULL if fixed*/ |
107 | int defaultchar; /* default char (not glyph index)*/ | 90 | int defaultchar; /* default char (not glyph index)*/ |
108 | int32_t bits_size; /* # bytes of glyph bits*/ | 91 | int32_t bits_size; /* # bytes of glyph bits*/ |