OpenVG UTF8/unicode caracter

92 Views Asked by At

I wouldike to print some text on my screen, I really need to use hello_font ( it has to be printed above omxplayer video, it's working right now). Im displaying RSS feed trhough this, but the function to draw caracter does not work with spécial Caracter ( UTF8 ).

I'm French and our alphabet contain a lot of them, so i wouldlike to know if there is any solution to this problem.

I am using the simple main.c in /opt/vc/src/hello_pi/hello_font/main.c

I think the problem is here :

/*****************************************************************************/
int32_t graphics_resource_render_text_ext( GRAPHICS_RESOURCE_HANDLE res,
                                           const int32_t x,
                                           const int32_t y,
                                           const uint32_t width,
                                           const uint32_t height,
                                           const uint32_t fg_colour,
                                           const uint32_t bg_colour,
                                           const char *text,
                                           const uint32_t text_length,
                                           const uint32_t text_size )
{

   /*
   * FIXME: Not at all optimal - re-renders each time.
   * FIXME: Not UTF-8 safe
   * FIXME: much better caching (or any caching)
   */
   VCOS_STATUS_T rc = gx_priv_render_text(
      &display, res, 
      x, res->height-y-text_size, width, height, fg_colour, bg_colour,
      text, text_length, text_size);

   return (rc == VCOS_SUCCESS) ? 0 : -1;
}

All files are here : https://github.com/adafruit/rpi-firmware/blob/master/vc/sdk/opt/vc/src/hello_pi/libs/

gx_priv_render_text function is in font.c file .

Maybe by creating a custom TTF font with the principals used caracters (é:à:ç:è).

Thank

1

There are 1 best solutions below

0
On

Ok so i just created a custom TTF font , i changed some unused caracters on the [0:127] ascii range, for exemple 'é' replace '{' , and then i made a script that replace every 'é' by '{' in my rss feed.

This solution only work for few caracters, because i had to remove other ones