summaryrefslogtreecommitdiff
path: root/firmware/font.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/font.c')
-rw-r--r--firmware/font.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/firmware/font.c b/firmware/font.c
index 943f2e2d06..6a9a68357f 100644
--- a/firmware/font.c
+++ b/firmware/font.c
@@ -124,6 +124,14 @@ static void lock_font_handle(int handle, bool lock)
124 alloc->handle_locks--; 124 alloc->handle_locks--;
125} 125}
126 126
127void font_lock(int font_id, bool lock)
128{
129 if( font_id == FONT_SYSFIXED )
130 return;
131 if( buflib_allocations[font_id] >= 0 )
132 lock_font_handle(buflib_allocations[font_id], lock);
133}
134
127static struct buflib_callbacks buflibops = {buflibmove_callback, NULL }; 135static struct buflib_callbacks buflibops = {buflibmove_callback, NULL };
128 136
129static inline struct font *pf_from_handle(int handle) 137static inline struct font *pf_from_handle(int handle)
@@ -1007,6 +1015,7 @@ int font_getstringsize(const unsigned char *str, int *w, int *h, int fontnumber)
1007 unsigned short ch; 1015 unsigned short ch;
1008 int width = 0; 1016 int width = 0;
1009 1017
1018 font_lock( fontnumber, true );
1010 for (str = utf8decode(str, &ch); ch != 0 ; str = utf8decode(str, &ch)) 1019 for (str = utf8decode(str, &ch); ch != 0 ; str = utf8decode(str, &ch))
1011 { 1020 {
1012 if (is_diacritic(ch, NULL)) 1021 if (is_diacritic(ch, NULL))
@@ -1019,6 +1028,7 @@ int font_getstringsize(const unsigned char *str, int *w, int *h, int fontnumber)
1019 *w = width; 1028 *w = width;
1020 if ( h ) 1029 if ( h )
1021 *h = pf->height; 1030 *h = pf->height;
1031 font_lock( fontnumber, false );
1022 return width; 1032 return width;
1023} 1033}
1024 1034