Index: apps/gui/skin_engine/skin_fonts.h
===================================================================
--- apps/gui/skin_engine/skin_fonts.h	(revision 27864)
+++ apps/gui/skin_engine/skin_fonts.h	(working copy)
@@ -36,6 +36,7 @@
 #else
 #define SKIN_FONT_SIZE (1024*3)
 #endif
+#define GLYPHS_TO_CACHE 256
 
 void skin_font_init(void);
 
Index: apps/gui/skin_engine/skin_fonts.c
===================================================================
--- apps/gui/skin_engine/skin_fonts.c	(revision 27864)
+++ apps/gui/skin_engine/skin_fonts.c	(working copy)
@@ -60,6 +60,7 @@
 int skin_font_load(char* font_name)
 {
     int i;
+    int skin_font_size;
     struct font *pf;
     struct skin_font_info *font = NULL;
     char filename[MAX_PATH];
@@ -92,7 +93,12 @@
     pf = &font->font;
     if (!font->buffer)
     {
-        pf->buffer_start = (char*)skin_buffer_alloc(SKIN_FONT_SIZE);
+        skin_font_size = GLYPHS_TO_CACHE * get_glyph_size(filename);
+        if ( !skin_font_size )
+        {
+            skin_font_size = SKIN_FONT_SIZE;
+        }
+        pf->buffer_start = (char*)skin_buffer_alloc(skin_font_size);
         if (!pf->buffer_start)
             return -1;
         font->buffer = pf->buffer_start;
@@ -101,7 +107,7 @@
     {
         pf->buffer_start = font->buffer;
     }
-    pf->buffer_size = SKIN_FONT_SIZE;
+    pf->buffer_size = skin_font_size;
     
     pf->fd = -1;
     font->font_id = font_load(pf, filename);
Index: firmware/export/font.h
===================================================================
--- firmware/export/font.h	(revision 27864)
+++ firmware/export/font.h	(working copy)
@@ -121,6 +121,7 @@
 int font_load_remoteui(const char* path);
 #endif
 int font_load(struct font* pf, const char *path);
+int get_glyph_size(const char *path);
 void font_unload(int font_id);
 
 struct font* font_get(int font);
Index: firmware/font.c
===================================================================
--- firmware/font.c	(revision 27864)
+++ firmware/font.c	(working copy)
@@ -628,6 +628,35 @@
     return;
 }
 
+int get_glyph_size(const char *path)
+{
+    struct font f;
+    int overhead;
+    char buf[FONT_HEADER_SIZE];
+    
+    f.buffer_start = buf;
+    f.buffer_size = sizeof(buf);
+    f.buffer_position = buf;    
+    
+    f.fd = open(path, O_RDONLY|O_BINARY);
+    if(f.fd < 0)
+        return 0;
+    
+    read(f.fd, f.buffer_position, FONT_HEADER_SIZE);
+    f.buffer_end = f.buffer_position + FONT_HEADER_SIZE;
+    
+    if( !font_load_header(&f) )
+    {
+        close(f.fd);
+        return 0;
+    }
+    close(f.fd);
+    
+    overhead = LRU_SLOT_OVERHEAD + sizeof(struct font_cache_entry) + 
+        sizeof( unsigned short);
+    return overhead + (f.maxwidth * ((f.height + 7) / 8));
+}
+
 static int ushortcmp(const void *a, const void *b)
 {
     return ((int)(*(unsigned short*)a - *(unsigned short*)b));
