I want to use the library with the shield from NUelectronics.
When I use the menu I need to invert the chosen menu. Is this possible with the U8glib ?
The command i'm searching for is something like "highlight".
It probably makes sense to put the last part into a procedure:
void draw_boxed_string(u8g_uint_t x, u8g_uint_t y, const char *s)
{
// precondition: setFontRefHeightExtendedText(), setFontPosTop
u8g_uint_t h, w;
h = u8g.getFontAscent(u8g)-u8g.getFontDescent(u8g); // get height of the string
w = u8g.getStrWidth(u8g, s); // width of the string
u8g.setColorIndex(1); // black pixel
u8g.drawBox(u8g, x-1, y, w+2, h+2) ; / draw a black box, larger than the string
u8g.setColorIndex(0); // use white pixel
u8g.drawStr(u8g, x, y, "(AgI)"); // draw white pixel on the black box
u8g.setColorIndex(1); // restore black pixel
}
This solution works. Thank you very much.
I appreciate the many different font choises.
The upside down function and the universal principle for a lot of different LCD type's.
In the other library's I only have a "reverse" command. Do you think this is gonna be an option for the future in your library?
draw_boxed_string(u8g_uint_t x, u8g_uint_t y, const char *s)
could be extended like this:
my_string_draw(u8g_uint_t x, u8g_uint_t y, const char *s, is_inverted)
{
if ( is_inverted )
draw_boxed_string(x,y,s);
else
u8g.drawStr(u8g, x, y, s);
}
It is a little bit difficult to make a general procedure out of this, which can be added to the
library. There are two points: First, the concept of the u8glib is to draw with one current color.
Indeed, when using u8g.drawStr on a pattern, the pattern "shines" trough the glyphs.
To be flexible for all displays I would need a background and a foreground color, which are
not available at the moment.
The second problem is to define the height of the background. Is it ascent + descent? or is it
the line spaceing? Or should u8g examine the hight of the provided string.
I think it is easy to implement your own definition, but difficult to find a generic procedure for that.