Forum Discussion

compoundlogic's avatar
12 years ago

Problem rendering font on newer rokus

I am using an open source .ttf font in an app that I developed and tested with an older series roku (e.g. Roku HD)

I am drawing text to a double buffered roScreen. Some of the rendered text is in my special font, other text is in the default system font.

On the older Roku, both fonts (and other simple graphics) work great.

However, when I run it on a newer roku (e.g. Roku 2 XS) the app runs without generating any errors (I see it executing with the expected "print" output on the telnet console), but it does not display anything in my special font. Text is rendered properly in the default font.

I understand that there are some model specific differences that need to be handled in code, but have been unable to identify anything specific for my circumstance.

I am creating the screen and font related objects as indicated here:



screen=CreateObject("roScreen", true, 1280, 720)
frg = CreateObject("roFontRegistry")
frg.Register("pkg:/fonts/Myspecialfont.ttf")
fonts = frg.GetFamilies()
font = frg.GetFont(fonts[0], 75, false, false)


I am drawing the text with commands like this:


screen.DrawText(myrow, ox, oy + (x * 75), color, font)
screen.Finish()
screen.Swapbuffers()


Any help would be appreciated.

2 Replies

  • can you create an example .zip we can side-load, including the font, which demonstrates the issue and PM it to me via DropBox or other file transfer mechanism?

    Thanks

    - Joel
  • Some things to consider

    1 make sure you have a valid font: font <> Invalid
    an invalid value passed to the drawing function will not result in an error, it just will not print anything. At least on roku3
    So test your font return value to ensure it is of type roFont

    2. Make sure your x, y calculations in drawtext are correct and are not drawing off screen

    3. You do not need to call Finish. SwapBuffers calls it for you