Thanks. Actually, that's very helpful, and I have now solved both my issues.
As it happens, I have the OTF files for the desktop and webfont packs for both v5.15.4 and v6.5.2, so I did a little digging.
Following your post, I produced some test code to retrieve further information about the fonts.
I discovered that v5.15.4 of FontAwesome contains distinct glyphs for lowercase and uppercase letters (a simple retrieval of the glyph index shows different values), while 6.5.2 doesn't. Since v6 doesn't add anything that I am using, I can use the v5 files.
It is important to note that the webfonts package doesn't have any glyphs except for symbols, no regular letters at all, so I use the desktop package.
That fixes my second issue.
When I create the strings which will contain the extended characters, I use something like this:
const char* mail_label = "\uf003 Mail";
With g++, this produces a byte sequence of 0xef, 0x80, 0x83, 0x20 0x4d, 0x61 0x69 0x6c.
Obviously, treating this as an 'old-school' string won't work too well, so I use iconv to convert from UTF-8 to UTF-32 (although in this case, UTF-16 would be OK too).
This yields the sequence 0xfeff, 0xf003, 0x020,0x4d,0x61,0x69,0x6c as a series of 32-bit values (or 16, if I went the UTF-16 route).
Note that there is a BOM of 0xfeff which can be ignored in all cases.
So, this is the sequence of characters.
It turns out that although the documentation says thatrenders the glyph as well as loading it, this isn't alwaystrue, so I changed the code toAt this point, f->glyph->bitmap contains useful stuff, and my rebdering code produces proper output.
So, both my issues are solved.
When all this is done, I should have a small (hopefully reasonably fast) library for making a GUI for PiOS lite, without the requirements of a general purpose desktop environment, allowing me to produce "embedded" style apps. As long as I get it finished before the framebuffer interface is obsoleted, it should be fine!
As it happens, I have the OTF files for the desktop and webfont packs for both v5.15.4 and v6.5.2, so I did a little digging.
Following your post, I produced some test code to retrieve further information about the fonts.
I discovered that v5.15.4 of FontAwesome contains distinct glyphs for lowercase and uppercase letters (a simple retrieval of the glyph index shows different values), while 6.5.2 doesn't. Since v6 doesn't add anything that I am using, I can use the v5 files.
It is important to note that the webfonts package doesn't have any glyphs except for symbols, no regular letters at all, so I use the desktop package.
That fixes my second issue.
When I create the strings which will contain the extended characters, I use something like this:
const char* mail_label = "\uf003 Mail";
With g++, this produces a byte sequence of 0xef, 0x80, 0x83, 0x20 0x4d, 0x61 0x69 0x6c.
Obviously, treating this as an 'old-school' string won't work too well, so I use iconv to convert from UTF-8 to UTF-32 (although in this case, UTF-16 would be OK too).
This yields the sequence 0xfeff, 0xf003, 0x020,0x4d,0x61,0x69,0x6c as a series of 32-bit values (or 16, if I went the UTF-16 route).
Note that there is a BOM of 0xfeff which can be ignored in all cases.
So, this is the sequence of characters.
It turns out that although the documentation says that
Code:
FT_Load_Glyph( f, idx, FT_LOAD_TARGET_MONO|FT_LOAD_RENDER);
Code:
FT_Load_Glyph(f, idx, FT_LOAD_TARGET_MONO);FT_Render_Glyph(f->glyph, FT_RENDER_MODE_MONO);
So, both my issues are solved.
When all this is done, I should have a small (hopefully reasonably fast) library for making a GUI for PiOS lite, without the requirements of a general purpose desktop environment, allowing me to produce "embedded" style apps. As long as I get it finished before the framebuffer interface is obsoleted, it should be fine!
Statistics: Posted by SteveSpencer — Sun Jul 14, 2024 12:57 pm