Go Down

Topic: Variable width font on a nokia 3310 LCD (Read 1 time) previous topic - next topic



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!


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

And: U8glib supports PCD8544  ;)




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?



Oct 04, 2012, 10:06 pm Last Edit: Oct 04, 2012, 10:19 pm by olikraus Reason: 1
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"

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.


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131