Pages: [1]   Go Down
Author Topic: Variable width font on a nokia 3310 LCD  (Read 904 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

I just arrived in the Arduino world, I played around a bit to get used to it and now here I'm with my first post.

I'm trying to do some stuff with a nokia 3310 LCD screen I've got from ebay. I got the screen running just a few hours after I got it thanx to some sample code. http://www.arduino.cc/playground/Code/PCD8544

Now, since I want to display a lot of text on the screen, I want to use variable with fonts... I've been looking for ages for some simple effective code to do so, but I can't find any. For more than a month now, I'm trying to write my own code, but I can't create something useful.

Is there someone who can help me with this?

Thanks a lot!
Logged

Germany
Offline Offline
Edison Member
*
Karma: 137
Posts: 1548
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You mean, fonts like these?  http://code.google.com/p/u8glib/wiki/fontsize
Most of them have variable character width.

And: U8glib supports PCD8544  smiley-wink

Oliver


Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks!

Do you maybe know if it's possible to start at a new line when the text has reached the right end of the screen?

Jeroen
Logged

Germany
Offline Offline
Edison Member
*
Karma: 137
Posts: 1548
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

For sure this is possible, but there is no predefined algorithm to do this.

If I understand you correctly, then you want to solve the following problem.
Assume there is a long sentence:
"This is a very long text."
With a given font, only the substring
"This is a very long t"
fits to your screen.
Then you would like to break the string at the last blank and
put the missing part on the next line:
"This is a very long"
"text."

The only thing U8glib supports you, is to return the pixel width for a string with a specified font.
u8g.getStrWidth("This is a very long text.") might return a value, which is larger than your screen width
u8g.getStrWidth("This is a very long") might return a value, which is smaller than your screen width and
you will know that this fits to your screen (if you start drawing at the beginning of the screen).

So i think, "yes" it is possible and you will get all necessary information from u8glib.

Oliver
« Last Edit: October 04, 2012, 03:19:34 pm by olikraus » Logged

Pages: [1]   Go Up
Jump to: