Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to find number of characters to print on one line

How can we find that how many characters of specific string we can print on a single line without wrapping in roImageCanvas? I am getting strings of news feeds from online source and want to print it in just one line and discard extra chracters.

I have looked into documentation of font and font registry but could not find a solution.

Thanks in advance...
0 Kudos
2 REPLIES 2
NewManLiving
Visitor

Re: How to find number of characters to print on one line

Have not tried this but you probably can create a rofontregistry and call its methods to return a default font
To your liking (you do not have to call register for the default font just call the default methods)
And use this font handle as your guide. You would then create the string representation
Of the template font for use in your canvas by calling get with the same font
Description. Use your font handles getonelinewidth to get the information you need
And adjust your string before sending it off to the canvas with the string representation
Of the same font
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
RokuJoel
Binge Watcher

Re: How to find number of characters to print on one line

I would imagine that using ifFont.getoneLineWidth would be accurate for imageCanvas as well as roScreen.

- Joel
0 Kudos