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: 
ciack404
Visitor

Whitespace character

Hi,

I am trying to show a whitespace character in a custom keyboard, using the default fonts

...
fontInstance = createobject("rofontregistry")
useFont = fontInstance.GetDefaultFont()
...
roScreen.drawText("␣", someX, someY, useFont)


While this code works for symbols like @, %, :, ;... it doesn't for ␣

What is involved in order to show that symbol? Should I add it to a custom font or are there other (better) solutions?

Thanks.
0 Kudos
4 REPLIES 4
belltown
Roku Guru

Re: Whitespace character

What character are you using? Have you tried the non-breaking space: http://www.fileformat.info/info/unicode/char/00a0/index.htm?
0 Kudos
RokuMarkn
Visitor

Re: Whitespace character

It looks like you're using U+2423 (OPEN BOX). This character is not in the default font. So you can either use your own font which contains this character, or choose a different character which is in the default font, like _ (underscore).

--Mark
0 Kudos
ciack404
Visitor

Re: Whitespace character

Thanks for the replies.

"RokuMarkn" wrote:
It looks like you're using U+2423 (OPEN BOX). This character is not in the default font. So you can either use your own font which contains this character, or choose a different character which is in the default font, like _ (underscore).

--Mark


I added the character to a custom font, but I still can't see it displayed using .drawText(. How should I reference the new character in my code? Is there an example I can follow? I searched but can't find anything.

I tried:

roScreen.drawText("␣", someX, someY, useFont)


ba = CreateObject("roByteArray")
ba.FromHexString("e290a3")
renderedText = ba.ToAsciiString()
roScreen.drawText(renderedText, someX, someY, useFont)


renderedText = Chr(&H2423)
roScreen.drawText(renderedText, someX, someY, useFont)

but I still can't see anything.
I'm using this font: http://www.fontex.org/download/inconsolata.otf (according to this website it has the open box character http://www.fileformat.info/info/unicode ... upport.htm)
0 Kudos
ciack404
Visitor

Re: Whitespace character

Ok solved.

I was using GetFont() in a wrong way.

Thanks for the help.
0 Kudos