Forum Discussion

ciack404's avatar
ciack404
Visitor
10 years ago

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.

4 Replies

  • 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
  • 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)
  • Ok solved.

    I was using GetFont() in a wrong way.

    Thanks for the help.