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. Arduino Playground - 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.
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.