summaryrefslogtreecommitdiff
path: root/firmware/export/font.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export/font.h')
-rw-r--r--firmware/export/font.h35
1 files changed, 31 insertions, 4 deletions
diff --git a/firmware/export/font.h b/firmware/export/font.h
index 0fe6c30f2c..e9bf086423 100644
--- a/firmware/export/font.h
+++ b/firmware/export/font.h
@@ -30,6 +30,7 @@
30 30
31#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR) 31#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)
32#ifndef __PCTOOL__ 32#ifndef __PCTOOL__
33#include "font_cache.h"
33#include "sysfont.h" 34#include "sysfont.h"
34#endif 35#endif
35 36
@@ -47,9 +48,14 @@
47enum { 48enum {
48 FONT_SYSFIXED, /* system fixed pitch font*/ 49 FONT_SYSFIXED, /* system fixed pitch font*/
49 FONT_UI, /* system porportional font*/ 50 FONT_UI, /* system porportional font*/
50 MAXFONTS 51#ifdef HAVE_REMOTE_LCD
52 FONT_UI_REMOTE, /* UI font for remote LCD */
53#endif
54 SYSTEMFONTCOUNT /* Number of fonts reserved for the system and ui */
51}; 55};
52 56
57#define MAXFONTS 10
58
53/* 59/*
54 * .fnt loadable font file format definition 60 * .fnt loadable font file format definition
55 * 61 *
@@ -89,17 +95,38 @@ struct font {
89 const unsigned char *width; /* character widths or NULL if fixed*/ 95 const unsigned char *width; /* character widths or NULL if fixed*/
90 int defaultchar; /* default char (not glyph index)*/ 96 int defaultchar; /* default char (not glyph index)*/
91 int32_t bits_size; /* # bytes of glyph bits*/ 97 int32_t bits_size; /* # bytes of glyph bits*/
98
99 /* file, buffer and cache management */
100 int fd; /* fd for the font file. >= 0 if cached */
101 unsigned char *buffer_start; /* buffer to store the font in */
102 unsigned char *buffer_position; /* position in the buffer */
103 unsigned char *buffer_end; /* end of the buffer */
104 int buffer_size; /* size of the buffer in bytes */
105#ifndef __PCTOOL__
106 struct font_cache cache;
107 uint32_t file_width_offset; /* offset to file width data */
108 uint32_t file_offset_offset; /* offset to file offset data */
109 int long_offset;
110#endif
111
92}; 112};
93 113
94/* font routines*/ 114/* font routines*/
95void font_init(void); 115void font_init(void);
96struct font* font_load(const char *path); 116#ifdef HAVE_REMOTE_LCD
117/* Load a font into the special remote ui font slot */
118int font_load_remoteui(const char* path);
119#endif
120int font_load(struct font* pf, const char *path);
121void font_unload(int font_id);
122
97struct font* font_get(int font); 123struct font* font_get(int font);
98void font_reset(void); 124
125void font_reset(struct font *pf);
99int font_getstringsize(const unsigned char *str, int *w, int *h, int fontnumber); 126int font_getstringsize(const unsigned char *str, int *w, int *h, int fontnumber);
100int font_get_width(struct font* ft, unsigned short ch); 127int font_get_width(struct font* ft, unsigned short ch);
101const unsigned char * font_get_bits(struct font* ft, unsigned short ch); 128const unsigned char * font_get_bits(struct font* ft, unsigned short ch);
102void glyph_cache_save(void); 129void glyph_cache_save(struct font* pf);
103 130
104#else /* HAVE_LCD_BITMAP */ 131#else /* HAVE_LCD_BITMAP */
105 132