Is possible to show greek letters in menu system.
I' m using m2tk and u8glib.
For example in M2_LABEL
Yes, this is possible. However, you need to create one font (254 chars maximum), which contains all glyphs which are required for your menus. Which are the unicode ranges, which are required for you? 0x0380 to 0x03ff?
Once this is known, we can create a new u8glib font with bdf2u8g.
Oliver
I need some help with greek characters.
The steps i follow first with the u8glib.
1)With the utility and the follow command, i create the c file
bdf2u8g_101.exe -b 32 -e 254 etl14-greek.bdf etl14 etl14.c
2)copy the c file to utility folder
3)upload the follow sketch
#include "U8glib.h"
#include "utility/etl14.c"
U8GLIB_KS0108_128 u8g(22, 23, 24, 25, 26, 27, 28, 29, 37, 33, 34, 36, 35);
void draw(void) {
// graphic commands to redraw the complete screen should be placed here
u8g.setFont(etl14);
u8g.drawStr( 0, 22, "???????");
}
void setup(void) {
// assign default color value
if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
u8g.setColorIndex(255); // white
}
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
u8g.setColorIndex(3); // max intensity
}
else if ( u8g.getMode() == U8G_MODE_BW ) {
u8g.setColorIndex(1); // pixel on
}
else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
u8g.setHiColorByRGB(255,255,255);
}
}
void loop(void) {
// picture loop
u8g.firstPage();
do {
draw();
} while( u8g.nextPage() );
// rebuild the picture after some delay
delay(500);
}
But no greek characters, only chineze
What i did wrong?
I attach the code of c file
etl14.c (8.87 KB)
Maybe you can attach the .bdf file. I think you have to select the correct unicode page with "-l" and "-u".
Oliver
ok here is the file.
I checked with a viewer and has 254 characters only.
etl14-greek.bdf (25.7 KB)
Hi
I have tested your font and everything is fine here. Maybe your test string is wrong. You should start with something more simpler. For example the small greek letter alpha.
In you BDF file it has the encoding 225, which is 341 octal.
Instead of
u8g.drawStr( 0, 22, "???????");
try
u8g.drawStr( 0, 22, "\341");
to print just the small alpha. The problem might be the Arduino IDE which converts none-ascii chars to UTF-8 code.
Another note: Instead of including the c file you should either copy the font directly into your .ino file or just add the prototype of your font in your .ino file:
Replace
#include "utility/etl14.c"
with
const u8g_fntpgm_uint8_t etl14[] U8G_FONT_SECTION("etl14");
Oliver
Ok, your advices almost solve the problem.
The problem is with arduino ide and none-ascii chars.
I also try atmel Studio, again the same issue.
Is there any way to write greek characters directly from keyboard instead of convert and insert encoding numbers in octal ?
I think most modern editors are using UTF-8. So any greek character will appear as multi byte sequence in the c-file.
Maybe you can define some macros and assign them to, say Alt-a to print the octal mumber of the small alpha char.
Oliver
Ok thanks, topic Solved.
Is there any way to convert fonts to bdf format or find fonts with that format?
Editors: fontforge, Fony (fony); gbdfed http://www.math.nmsu.edu/~mleisher/Software/gbdfed/
ttf to bdf: fontforge, otf2bdf
web: http://unifoundry.com/unifont.html
Oliver
olikraus:
Editors: fontforge, Fony (fony); gbdfed http://www.math.nmsu.edu/~mleisher/Software/gbdfed/
ttf to bdf: fontforge, otf2bdf
web: http://unifoundry.com/unifont.htmlOliver
THANKS