Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[help] update vgfont/font.c to be compatible with utf-8 #896

Closed
nagualcode opened this issue Oct 29, 2017 · 5 comments
Closed

[help] update vgfont/font.c to be compatible with utf-8 #896

nagualcode opened this issue Oct 29, 2017 · 5 comments

Comments

@nagualcode
Copy link

I am trying to render fonts on the framebuffer, and I would ask for some help with the path to make vgfont/font.c compatible with utf-8.

@paolosabatino
Copy link

it's not part of openvg beingcompatible with utf-8, openvg deals only with the rendering of the glyphs and provides a simple indexing of the path glyphs, but the decoding of the text string is not the purpose of the library

@rodizio1
Copy link

rodizio1 commented Feb 26, 2018

I think this is not Raspberry firmware related.

You might want to check out Paeryn's fork of ajstark's OpenVG library.
The latest branch is the "windowsave" branch: https://github.com/paeryn/openvg/tree/windowsave

There is a test program included that displays every character found in a font, it also mentions UTF-8. You need to set locales in your system and inside your program accordingly.
https://github.com/paeryn/openvg/blob/windowsave/client/chars.c

@nagualcode
Copy link
Author

nagualcode commented Mar 9, 2018

On https://github.com/raspberrypi/firmware/blob/master/opt/vc/src/hello_pi/libs/vgfont/font.c
There is:
line48 # * This API doesn't support unicode at all at present, nor UTF-8.

hello_font example wont render latin characters.

@popcornmix

@paolosabatino
Copy link

@nagualcode no need to importunate popcornmix for this, that example is not part of OpenVG: it is an example that uses OpenVG.
As an exercise you may want to implement your own utf-8 decoder and apply it to that example

@nagualcode
Copy link
Author

nagualcode commented Mar 12, 2018

Agree...
Well thanks.
I am closing the issue.
It is beyond my knowledge to code my own utf8 decoder.
If anyone reading this in the future is able to, I got this help from Paeryn:

"the original libshapes.c has a routine that converts a character at a time from a utf-8 string into the individual 32-bit integers needed (next_utf8_char()).

For the branches from newfonts upwards I changed it to use the standard mbsrtowcs() function (multi-byte string to wide-char string) so whatever format the current C_locale is set to is used (utf-8, utf-16, etc.).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants