Go Down

Topic: U8glib: Graphics Lib for LCDs and OLEDs (Read 226411 times) previous topic - next topic

olikraus

You have to use one of the internal fonts or convert the font with bdf2u8g.

Oliver

ali2526

Hi

how I can mirror the screen(flip canvas horizontal)?

I want to use the LCD for HUD.

thanks.

olikraus

Hi

how I can mirror the screen(flip canvas horizontal)?

I want to use the LCD for HUD.

thanks.
There is no such feature in U8glib or U8g2, however for some controllers (such as SSD1306) this can be done by the controller itself. In such a case only the init sequence has to be modified.

Oliver

shakeNbake

#378
Oct 19, 2016, 12:37 pm Last Edit: Oct 20, 2016, 08:45 am by shakeNbake
Hi Oli

I am trying to convert a font for the U8g2 lib using the bdf2u8g_101.exe. When I have tried convert my .bdf file it only converts to a U8g lib format. What argument in the command line do I need to use to convert it to work with U8g2?

I have also tried using the bdfconv.exe but had no luck in getting that to work as below,

cmd input: bdfconv.exe -v -f 1 -m '32-255' myfont.bdf -o myfont.c -n myfont -d myfont.bdf

The output i get in the myfont.c file is:

/*
  Fontname: myfont
  Copyright:
  Glyphs: 1/256
  BBX Build Mode: 0
*/
const uint8_t myfont[30] U8G2_FONT_SECTION("myfont") =
  "\1\0\2\2\0\0\1\1\4\0\0\0\0\7\376\10\377\0\0\0\0\0\5\0\3;\0\0\0";

This looks too short to be a whole font

Any help is appreciated

Michael

olikraus

Hi Michael

The font formats for u8g2 and u8glib are different. You must use bdfconv for u8g2 and bdf2u8g for u8glib.
The commandline options look correct, are you sure that there are more than one glyphs in your bdf file?
I probably need to see the bdf file.

Oliver

shakeNbake

#380
Oct 31, 2016, 03:28 pm Last Edit: Nov 02, 2016, 02:35 pm by shakeNbake Reason: Attaching File
Hi Oliver

Thanks for the reply.

I have tried again with bdfconv.exe. I have checked the .bdf file I created and it has 11 glyphs (I only need numbers 1-10 and a degree symbol which I replaced glyph 47 with)

The code I put into the command line:

Code: [Select]
bdfconv.exe -v -b 2 -f 1 -m '47-57' myfont12.bdf -o myfont12.c -n myfont12 -d myfont12.bdf

It then output the following log:

Code: [Select]
Parse File myfont12.bdf: 11 glyph(s) found
Map: map_cmd_list=''47-57''
Map: exclude=0 from=0 to=0 map=0
Reduce: Start
Reduce: End
CalculateMaxBBX: x=1095254868, y=726999122, w=173162824, h=1380013139
CalculateMaxBBX: Encodings x=0, y=0, w=0, h=0
bf_CalculateMinMaxDWidth: dx_min=32767, dx_max=-32767
bf_CalculateMinMaxDWidth: x_min=32767, x_max=-32767
bf_CalculateMaxBitFieldSize: bbx.x=0, bbx.y=0, bbx.w=0, bbx.h=0, dwidth=0
RLE Compress: best zero bits 2, one bits 2, total bit size 0
RLE Compress: Font code generation, selected glyphs=0, total glyphs=11
RLE Compress: 'A' pos = 0, 'a' pos = 0
RLE Compress: Font size 27
Monospace Statistics: Max width extention 0, average width extention 0.0
bf_WriteU8G2CByFilename: Write file 'myfont12.c'


Opening the myfont12.c file doesn't seem to have found any glyphs:

Code: [Select]
/*
  Fontname: myfont
  Copyright: Michael
  Glyphs: 0/11
  BBX Build Mode: 2
*/
const uint8_t myfont12[27] U8G2_FONT_SECTION("myfont12") =
  "\0\2\2\2\0\0\0\0\0HSTR\14\0\14\0\0\0\0\0\0\2\0\0\0";


I have attached the myfont12.bdf as a .txt for you too. Please let me know where I have gone wrong

Thanks

Michael

olikraus

Hi
This is acutally a u8g2 problem (while this thread is for u8glib).
I have created an issue here: https://github.com/olikraus/u8g2/issues/81
Let us discuss the problem on github instead.

Thanks,
Oliver

pyksdys

Hi all. Ive connected LCD RG12864C-BIW-V to my Arduino DUE via voltage coverters 74LVX3245MTC and i have problem with software. Im sure that wrote right GPIO pins in class contructor from this library (using DB0..DB7, CS1,CS2,RS,RW,DI,E), but theres no LCD reaction. (I did everything what was wrote here: https://github.com/olikraus/u8glib/wiki/thelloworld). I've used constructor U8GLIB_KS0108_128. On my board theres 1 way communication so im not checking LCD's busy flag, wanted deal with it using delays, but i can't find any delays in this library. Any ideas?

pyksdys

Problem solved, after checking everything 20th time found that i mixed CS1 with CS2 so position 0,22 was out of display. :) rly nice library, ty.

RSDieskau

Hallo,
ich möchte auf dem Nokia1510 mit dem "U8glib" font fub11 " °C" mit dem Befehl
 
u8g.drawStr(60, 15, " °C");
 
anzeigen lassen.
Es wird aber " Ä°C" angezeigt.
Was mache ich falsch?

Reinhard

MAS3

Hallo und willkommen.
Dies ist ein Englischsprachiges Thema.

You are telling the library to put a character number, followed by degrees Celsius on the screen.
The character is number 196 in that font (click !).
You should tell it to put your value to the screen instead of a character.
Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

olikraus

@Reinhard: You need to enter the correct hex code of the glyph into the string in the form " \xXYC" where XY should be the correct hex code of the symbol.
The problem is caused by the mismatch of the string encoding. Arduino IDE supports UTF-8 which is not supported by u8glib. The new version of u8glib (u8g2) supports UTF-8. So this problem will not appear any more with u8g2.

Oliver

RSDieskau

Hello Oliver and MAS3,
thanks for your very quick answer.

Reinhard

pevecg

#388
Mar 03, 2017, 12:00 am Last Edit: Mar 03, 2017, 12:06 am by pevecg
Hello Oliver,

I am wondering if you could help me out with a problem. I have ARM STM32f4Discovery  (STM32f407 if we are exact) I followed some guide and example code from the internet and while he had a working lcd mine is glitched. The square that you can see on the bottom right is something that I wanted to draw, everything else I didn't.

I am using the following SPI u8g_dev_st7920_128x64_hw_spi

Any suggestions? Also the screen is working normally on the u8g2 library on Arduino but I need to get it working on the STM

olikraus

You should slow down the STM specific code.

Oliver

Go Up