zakamik / u8glib

Automatically exported from code.google.com/p/u8glib
Other
0 stars 0 forks source link

u8g.setFontPosTop() doesn't #270

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

Use setFontPosTop in a version of Hello World with font helvR08 to position top 
of text at top of screen i.e. y =0 .

What is the expected output? What do you see instead?

I'd expect the text to be written at the top of the screen .  The text is 
actually written above the top of the screen.  Investigation shows that 
PosBaseline is being used  and PosTop has no effect. 

What version of the product are you using? On what operating system?

v 1.15  Arduino linux

I2c 128x64 OLED display

Original issue reported on code.google.com by nottle...@gmail.com on 26 Jun 2014 at 7:13

GoogleCodeExporter commented 8 years ago
thanks for reporting this.
Can you attach the code for this? Thanks.

Original comment by olikr...@gmail.com on 26 Jun 2014 at 7:39

GoogleCodeExporter commented 8 years ago
It's slightly more complicated than I reported.  It depends on following lines. 
 When I add another font the original line changes position.

Original comment by nottle...@gmail.com on 26 Jun 2014 at 7:55

GoogleCodeExporter commented 8 years ago
Hmmm... the attached example does not contain setFontPosTop().
Can you attach an example which actually demonstrates the problem?

Original comment by olikr...@gmail.com on 26 Jun 2014 at 8:01

GoogleCodeExporter commented 8 years ago
Sorry about that - dunno what went wrong.  Try this ...

Original comment by nottle...@gmail.com on 26 Jun 2014 at 8:03

Attachments:

GoogleCodeExporter commented 8 years ago
ok, i have this:
void draw(void) {
  // graphic commands to redraw the complete screen should be placed here  
  u8g.setFontPosTop();
  u8g.setFont(u8g_font_helvR08);

  u8g.drawStr( 0, 0, "Hello World!");

  // Try with/ without below lines

  u8g.setFontPosTop();
  u8g.setFont(u8g_font_profont11);
  u8g.drawStr( 32, 25, "see yah!");
}

so the second drawStr is not working, right?

Original comment by olikr...@gmail.com on 26 Jun 2014 at 8:24

GoogleCodeExporter commented 8 years ago
No, it's the first one.  If you comment out the 3 lines at the bottom then
"hello world" is printed at the top.  If you then add the last 2 or three
lines (the second PosTop has no effect) the "hello world" disappears off the
top and you're just left with the "see yah!" line.

What happening is the reference position is moving back from top to baseline.

Original comment by nottle...@gmail.com on 26 Jun 2014 at 8:31

GoogleCodeExporter commented 8 years ago
ah, i see the problem. setFontPosTop must be used only after setting the font.

void draw(void) {
  // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_helvR08);
  u8g.setFontPosTop();

  u8g.drawStr( 0, 0, "Hello World!");

  // Try with/ without below lines

  u8g.setFont(u8g_font_profont11);
  u8g.setFontPosTop();
  u8g.drawStr( 32, 25, "see yah!");
}

Maybe i should be more clear in the documentation about this.

Original comment by olikr...@gmail.com on 26 Jun 2014 at 8:33

GoogleCodeExporter commented 8 years ago
I thought I'd tried that but you're right.

You probably need to fix this then:

http://code.google.com/p/u8glib/wiki/tstring

as that's what I was following.

At least someone's reading your guide ;-)

Original comment by nottle...@gmail.com on 26 Jun 2014 at 8:43

GoogleCodeExporter commented 8 years ago
oh, indeed. Excellent point. Fixed this.
Thanks a lot again for reporting this.

Original comment by olikr...@gmail.com on 26 Jun 2014 at 8:56

GoogleCodeExporter commented 8 years ago
also updated the documentation for the reference manual

Original comment by olikr...@gmail.com on 28 Jun 2014 at 9:04