Index: tools/convbdf.c =================================================================== --- tools/convbdf.c (revision 30753) +++ tools/convbdf.c (working copy) @@ -1401,6 +1401,8 @@ " %d, /* defaultchar */\n" " %d, /* bits_size */\n" " -1, /* font fd */\n" + " -1, /* font width fd */\n" + " -1, /* font offset fd */\n" " 0, /* buffer start */\n" " 0, /* ^ position */\n" " 0, /* ^ end */\n" Index: apps/recorder/pcm_record.c =================================================================== --- apps/recorder/pcm_record.c (revision 30753) +++ apps/recorder/pcm_record.c (working copy) @@ -39,6 +39,7 @@ #ifdef HAVE_SPDIF_IN #include "spdif.h" #endif +#undef DEBUG /***************************************************************************/ Index: firmware/export/font.h =================================================================== --- firmware/export/font.h (revision 30753) +++ firmware/export/font.h (working copy) @@ -100,6 +100,8 @@ /* file, buffer and cache management */ int fd; /* fd for the font file. >= 0 if cached */ + int fd_width; /* fd for the width data in file */ + int fd_offset; /* fd for the offset data in file */ unsigned char *buffer_start; /* buffer to store the font in */ unsigned char *buffer_position; /* position in the buffer */ unsigned char *buffer_end; /* end of the buffer */ Index: firmware/font.c =================================================================== --- firmware/font.c (revision 30753) +++ firmware/font.c (working copy) @@ -387,7 +387,17 @@ return false; } + /* cheat to get sector cache for different * + * parts of font file when preloading glyphs */ + pf->fd_width = open(path, O_RDONLY|O_BINARY); + pf->fd_offset = open(path, O_RDONLY|O_BINARY); glyph_cache_load(pf); + if(pf->fd_width >= 0) + close(pf->fd_width); + pf->fd_width = -1; + if(pf->fd_offset >= 0) + close(pf->fd_offset); + pf->fd_offset = -1; } else { @@ -395,6 +405,8 @@ pf->buffer_end = pf->buffer_position + size; close(pf->fd); pf->fd = -1; + pf->fd_width = -1; + pf->fd_offset = -1; if (!font_load_header(pf)) { @@ -444,6 +456,8 @@ pdata->refcount = 1; pf->buffer_position = pf->buffer_start = buffer_from_handle(handle); pf->buffer_size = size; + pf->fd_width = -1; + pf->fd_offset = -1; return handle; } @@ -615,14 +629,19 @@ int handle = pf_to_handle(pf); unsigned short char_code = p->_char_code; unsigned char tmp[2]; + int fd; if (handle > 0) lock_font_handle(handle, true); if (pf->file_width_offset) { int width_offset = pf->file_width_offset + char_code; - lseek(pf->fd, width_offset, SEEK_SET); - read(pf->fd, &(p->width), 1); + if(pf->fd_width >=0 ) + fd = pf->fd_width; + else + fd = pf->fd; + lseek(fd, width_offset, SEEK_SET); + read(fd, &(p->width), 1); } else { @@ -634,11 +653,15 @@ if (pf->file_offset_offset) { int32_t offset = pf->file_offset_offset + char_code * (pf->long_offset ? sizeof(int32_t) : sizeof(int16_t)); - lseek(pf->fd, offset, SEEK_SET); - read (pf->fd, tmp, 2); + if(pf->fd_offset >=0 ) + fd = pf->fd_offset; + else + fd = pf->fd; + lseek(fd, offset, SEEK_SET); + read (fd, tmp, 2); bitmap_offset = tmp[0] | (tmp[1] << 8); if (pf->long_offset) { - read (pf->fd, tmp, 2); + read (fd, tmp, 2); bitmap_offset |= (tmp[0] << 16) | (tmp[1] << 24); } }