mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-07-10 13:29:52 -04:00
convbdf: Make explicit when the "default" glyph is used
When a font doesn't have a glpyh for a given codepoint, the convertor points it at the "default glyph". The plan is to replace this pointer with a canary value so that rockbox genuinely knows this glpyh does not exist, allowing a fallback path to be implemented. (The plan is for the fallback path to attempt to compose a glpyh from its decomposed codepoints, but this would make it be possible to implement a true fallback/subsitute font mechanism) Change-Id: If6fea29f5393a6d4b9d5747c911a36fdc8dda5ae
This commit is contained in:
parent
e1534d8065
commit
8e5efb6850
1 changed files with 10 additions and 8 deletions
|
|
@ -884,7 +884,6 @@ int bdf_read_bitmaps(FILE *fp, struct font* pf)
|
|||
/* change unused width values to default char values */
|
||||
for (i=0; i<pf->size; ++i) {
|
||||
int defchar = pf->defaultchar - pf->firstchar;
|
||||
|
||||
if (pf->offset[i] == -1)
|
||||
pf->width[i] = pf->width[defchar];
|
||||
}
|
||||
|
|
@ -1224,9 +1223,9 @@ int gen_c_source(struct font* pf, char *path)
|
|||
" ascent: %d\n"
|
||||
" descent: %d\n"
|
||||
" depth: %d\n"
|
||||
" first char: %d (0x%02x)\n"
|
||||
" last char: %d (0x%02x)\n"
|
||||
" default char: %d (0x%02x)\n"
|
||||
" first char: %d (U+%06x)\n"
|
||||
" last char: %d (U+%06x)\n"
|
||||
" default char: %d (U+%06x)\n"
|
||||
" proportional: %s\n"
|
||||
" %s\n"
|
||||
"*/\n"
|
||||
|
|
@ -1234,6 +1233,7 @@ int gen_c_source(struct font* pf, char *path)
|
|||
"/* Font character bitmap data. */\n"
|
||||
"static const unsigned char _font_bits[] = {\n"
|
||||
};
|
||||
int defchar = pf->defaultchar - pf->firstchar;
|
||||
|
||||
ofp = fopen(path, "w");
|
||||
if (!ofp) {
|
||||
|
|
@ -1354,8 +1354,8 @@ int gen_c_source(struct font* pf, char *path)
|
|||
int offset = pf->offset[i];
|
||||
int offrot = pf->offrot[i];
|
||||
if (offset == -1) {
|
||||
offset = pf->offset[pf->defaultchar - pf->firstchar];
|
||||
offrot = pf->offrot[pf->defaultchar - pf->firstchar];
|
||||
offset = pf->offset[defchar];
|
||||
offrot = pf->offrot[defchar];
|
||||
}
|
||||
fprintf(ofp, " %d,\t/* (0x%02x) */\n",
|
||||
#ifdef ROTATE
|
||||
|
|
@ -1538,6 +1538,8 @@ int gen_fnt_file(struct font* pf, char *path)
|
|||
int ofr = 0;
|
||||
#endif
|
||||
|
||||
int defchar = pf->defaultchar - pf->firstchar;
|
||||
|
||||
ofp = fopen(path, "wb");
|
||||
if (!ofp) {
|
||||
print_error("Can't create %s\n", path);
|
||||
|
|
@ -1612,7 +1614,7 @@ int gen_fnt_file(struct font* pf, char *path)
|
|||
{
|
||||
int offrot = pf->offrot[i];
|
||||
if (pf->offset[i] == -1) {
|
||||
offrot = pf->offrot[pf->defaultchar - pf->firstchar];
|
||||
offrot = pf->offrot[defchar];
|
||||
}
|
||||
if ( pf->bits_size < MAX_FONTSIZE_FOR_16_BIT_OFFSETS )
|
||||
writeshort(ofp, offrot);
|
||||
|
|
@ -1634,7 +1636,7 @@ int gen_fnt_file(struct font* pf, char *path)
|
|||
for (i=0; i<pf->size; ++i) {
|
||||
int offset = pf->offset[i];
|
||||
if (offset == -1) {
|
||||
offset = pf->offset[pf->defaultchar - pf->firstchar];
|
||||
offset = pf->offset[defchar];
|
||||
}
|
||||
writeint(ofp, offset);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue