我目前正在为 NekoVM 开发一个库,以创建与 Freetype 2. 它是用纯 c 编写的,一切都工作得非常好,除了当用户输入一些 unicode 字符,如“ü”、“Ä”或“ ß" 它们将被转变成一些丑陋的方形字母。
当我从 NekoVM 收到数据时,您使用 val_string
返回一个char*
。函数 (FT_Load_Char
) 将数据推入 freetype 时需要使用 unsigned long 作为 char 代码。 (每个字母都会单独处理。)
如何才能正确呈现字符?在将它们提交到 C 编写的库之前,我还可以选择将它们转换为任何 ISO-8859-XX 代码页。
I currently working on a library for the NekoVM to create a binding to Freetype 2. It is written in plain c and it all works really nice, except when the user enters some unicode chars like "ü", "Ä" or "ß" they will be transformed into to some ugly square-like letters.
When I recieve the data from the NekoVM you use val_string
which returns a char*
. The function (FT_Load_Char
) where you push the data into freetype expects a unsigned long as char code. (Every letter is processed on its own.)
What to do get the characters rendered correctly? I also have the option to convert them into any ISO-8859-XX code page before submitting them into the c written library.
发布评论
评论(2)
小方框意味着您的字符不包含在字体中。这可能意味着两件事:
使用包含这些字符的字体
使用正确的编码。请参阅 FT_CharMap 和 FT_Encoding。
A little square box means that your character isn't contained in the font. That can mean two things:
Use a font which contains these characters
Use the correct encoding. See FT_CharMap and FT_Encoding.
解决方案非常简单:
这使得 freetype 自己处理所有“编码内容”。
The solution was quite simple:
This makes freetype handle all the "encoding-stuff" at it own.