remove unused characters from u8glib?

Hi.

I think its a newbie question but I actually need to get this working...So, I need help..

I'm using te the u8glib for 126X64 display from https://code.google.com/p/u8glib/

To free some space.. I need to remove a lot of characters I'm not gonna use..

Searching in the library I found the "source" of the font I'm using...

u8g.setFont(u8g_font_helvR08);

Could anyone explain me how to only left the characters that I Want?

I apreciate it very much.

/*
  Fontname: -Adobe-Helvetica-Medium-R-Normal--11-80-100-100-P-56-ISO10646-1
  Copyright: Copyright (c) 1984, 1987 Adobe Systems Incorporated. All Rights Reserved. Copyright (c) 1988, 1991 Digital Equipment Corporation. All Rights Reserved.
  Capital A Height: 8, '1' Height: 8
  Calculated Max Values w=10 h=11 x= 1 y= 7 dx=11 dy= 0 ascent=11 len=18
  Font Bounding box     w=13 h=18 x=-2 y=-4
  Calculated Min Values           x=-1 y=-2 dx= 0 dy= 0
  Pure Font   ascent = 8 descent=-2
  X Font      ascent = 8 descent=-2
  Max Font    ascent =11 descent=-2
*/
const u8g_fntpgm_uint8_t u8g_font_helvR08[2687] U8G_FONT_SECTION("u8g_font_helvR08") = {
  0,13,18,254,252,8,1,178,3,111,32,255,254,11,254,8,
  254,0,0,0,3,0,1,1,8,8,3,1,0,128,128,128,
  128,128,128,0,128,3,2,2,4,1,6,160,160,6,7,7,
  6,0,0,40,40,124,40,248,80,80,5,10,10,6,0,255,
  32,112,168,160,112,40,40,168,112,32,8,8,8,9,0,0,
  100,148,104,8,16,22,41,38,6,8,8,8,1,0,96,144,
  144,96,148,136,152,100,1,2,2,2,0,6,128,128,3,10,
  10,4,0,254,32,64,64,128,128,128,128,64,64,32,3,10,
  10,4,1,254,128,64,64,32,32,32,32,64,64,128,3,3,
  3,4,0,5,160,64,160,5,5,5,6,0,1,32,32,248,
  32,32,2,3,3,3,0,254,64,64,128,3,1,1,4,0,
  3,224,1,1,1,3,1,0,128,3,8,8,3,0,0,32,
  32,64,64,64,64,128,128,5,8,8,6,0,0,112,136,136,
  136,136,136,136,112,2,8,8,6,1,0,64,192,64,64,64,
  64,64,64,5,8,8,6,0,0,112,136,8,8,48,64,128,
  248,5,8,8,6,0,0,112,136,8,48,8,8,136,112,5,
  8,8,6,0,0,16,48,80,80,144,248,16,16,5,8,8,
  6,0,0,120,64,64,112,8,8,136,112,5,8,8,6,0,
  0,112,136,128,240,136,136,136,112,5,8,8,6,0,0,248,
  8,16,32,32,64,64,64,5,8,8,6,0,0,112,136,136,
  112,136,136,136,112,5,8,8,6,0,0,112,136,136,136,120,
  8,136,112,1,6,6,3,1,0,128,0,0,0,0,128,2,
  8,8,3,0,254,64,0,0,0,0,64,64,128,3,5,5,
  6,1,1,32,64,128,64,32,4,3,3,5,0,2,240,0,
  240,3,5,5,6,1,1,128,64,32,64,128,4,8,8,6,
  1,0,96,144,16,32,64,64,0,64,10,9,18,11,0,255,
  31,0,32,128,77,64,146,64,162,64,164,128,155,0,64,0,
  62,0,7,8,8,7,0,0,16,16,40,40,68,124,130,130,
  5,8,8,7,1,0,240,136,136,240,136,136,136,240,6,8,
  8,8,1,0,120,132,128,128,128,128,132,120,6,8,8,8,
  1,0,240,136,132,132,132,132,136,240,5,8,8,7,1,0,
  248,128,128,248,128,128,128,248,5,8,8,6,1,0,248,128,
  128,240,128,128,128,128,6,8,8,8,1,0,120,132,128,128,
  140,132,132,124,6,8,8,8,1,0,132,132,132,252,132,132,
  132,132,1,8,8,3,1,0,128,128,128,128,128,128,128,128,
  4,8,8,5,0,0,16,16,16,16,16,16,144,96,5,8,
  8,7,1,0,136,144,160,224,144,144,136,136,4,8,8,6,
  1,0,128,128,128,128,128,128,128,240,7,8,8,9,1,0,
  130,198,198,170,170,146,146,146,6,8,8,8,1,0,196,196,
  164,164,148,148,140,140,6,8,8,8,1,0,120,132,132,132,
  132,132,132,120,5,8,8,7,1,0,240,136,136,240,128,128,
  128,128,7,9,9,8,1,255,120,132,132,132,132,148,140,124,
  2,5,8,8,7,1,0,240,136,136,240,136,136,136,136,5,
  8,8,7,1,0,112,136,128,112,8,136,136,112,5,8,8,
  5,0,0,248,32,32,32,32,32,32,32,6,8,8,8,1,
  0,132,132,132,132,132,132,132,120,7,8,8,7,0,0,130,
  130,68,68,68,40,40,16,9,8,16,9,0,0,136,128,136,
  128,73,0,73,0,85,0,34,0,34,0,34,0,5,8,8,
  7,1,0,136,136,80,32,80,80,136,136,7,8,8,7,0,
  0,130,68,68,40,40,16,16,16,5,8,8,7,1,0,248,
  8,16,32,32,64,128,248,2,10,10,3,1,254,192,128,128,
  128,128,128,128,128,128,192,3,8,8,3,0,0,128,128,64,
  64,64,64,32,32,2,10,10,3,0,254,192,64,64,64,64,
  64,64,64,64,192,5,5,5,6,0,3,32,32,80,80,136,
  6,1,1,6,0,254,252,2,2,2,3,0,7,128,64,5,
  6,6,5,0,0,224,16,112,144,144,104,5,8,8,6,0,
  0,128,128,176,200,136,136,200,176,4,6,6,5,0,0,96,
  144,128,128,144,96,5,8,8,6,0,0,8,8,104,152,136,
  136,152,104,4,6,6,5,0,0,96,144,240,128,144,96,4,
  8,8,4,0,0,48,64,224,64,64,64,64,64,5,8,8,
  6,0,254,104,152,136,136,152,104,8,112,5,8,8,6,0,
  0,128,128,176,200,136,136,136,136,1,8,8,2,0,0,128,
  0,128,128,128,128,128,128,2,10,10,2,255,254,64,0,64,
  64,64,64,64,64,64,128,4,8,8,5,0,0,128,128,144,
  160,192,160,144,144,1,8,8,2,0,0,128,128,128,128,128,
  128,128,128,7,6,6,8,0,0,236,146,146,146,146,146,5,
  6,6,6,0,0,176,200,136,136,136,136,5,6,6,6,0,
  0,112,136,136,136,136,112,5,8,8,6,0,254,176,200,136,
  136,200,176,128,128,5,8,8,6,0,254,104,152,136,136,152,
  104,8,8,3,6,6,4,0,0,160,192,128,128,128,128,4,
  6,6,5,0,0,96,144,96,16,144,96,3,8,8,4,0,
  0,64,64,224,64,64,64,64,96,4,6,6,5,0,0,144,
  144,144,144,144,112,5,6,6,6,0,0,136,136,80,80,32,
  32,7,6,6,8,0,0,146,146,84,84,40,40,5,6,6,
  6,0,0,136,80,32,80,136,136,5,8,8,5,255,254,72,
  72,80,80,48,32,32,192,4,6,6,5,0,0,240,16,32,
  64,128,240,3,10,10,3,0,254,32,64,64,64,128,64,64,
  64,64,32,1,10,10,3,1,254,128,128,128,128,128,128,128,
  128,128,128,3,10,10,3,0,254,128,64,64,64,32,64,64,
  64,64,128,6,2,2,7,0,3,100,152,255,255,255,255,255,
  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
  255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,3,
  0,1,1,8,8,3,1,254,128,0,128,128,128,128,128,128,
  5,8,8,6,1,255,16,112,168,160,160,168,112,64,5,8,
  8,6,0,0,48,72,64,224,64,64,72,176,4,6,6,5,
  0,1,144,96,144,144,96,144,5,8,8,6,0,0,136,136,
  136,80,248,32,248,32,1,10,10,3,1,254,128,128,128,128,
  0,0,128,128,128,128,5,10,10,6,0,254,112,136,192,112,
  152,200,112,24,136,112,3,1,1,3,0,7,160,7,7,7,
  9,1,0,56,68,154,162,154,68,56,3,5,5,4,0,3,
  224,32,160,0,224,5,5,5,6,0,0,40,80,160,80,40,
  5,3,3,7,1,2,248,8,8,3,1,1,4,0,3,224,
  7,7,7,9,1,0,56,68,186,178,170,68,56,3,1,1,
  3,0,7,224,4,4,4,4,0,4,96,144,144,96,5,7,
  7,6,0,0,32,32,248,32,32,0,248,3,4,4,3,0,
};

Here's the font details.

https://code.google.com/p/u8glib/wiki/fontgroupadobex11#helvR

I expect the font-array has every char at a known offset so removing chars not needed will break the calling code. Fixing that implies you have to need to add a lookup function/table, which costs extra again, at least in complexity.

So Its gonna be really hard? Do you have an idea about how to draw my own characters?

I REALLY appreciate if you help me on this.

Tks!

Sorry, I'm not familiar with the inner details of this library

ok. thank you so much!

Hi

Well, yes it is not so easy to modify the binary font format for u8glib. You need to work in the original font file and then do the conversion to the u8glib internal format.

First, maybe

u8g.setFont(u8g_font_helvR08r);

instead of

u8g.setFont(u8g_font_helvR08);

might at least save some flash memory.

All fonts should be available with "r" and "n" postifx, which use lesser glyphs.

The original source file for helvR08 is here https://code.google.com/p/u8glib/source/browse/tools/font/bdf/helvR08.bdf

It is a plain text file. You can remove single glyphs from that file and recreate the binary format for u8glib.

Oliver