0
我试图在我的Marmalade项目中使用IwGxFontDrawText函数显示西里尔字符串。我已经添加TimesNewRoman TTF文件,我的代码:使用IwGxFontDrawText显示西里尔字体
int main()
{
// Initialise Iw2D
Iw2DInit();
// Create the font that is used to display the score
CIwGxFont *Font = IwGxFontCreateTTFont("TNR_B.ttf", 14);
IwGxLightingOn();
IwGxFontSetFont(Font);
IwGxFontSetRect(CIwRect((int16)10, (int16)10, (int16)IwGxGetScreenWidth(), (int16)IwGxGetScreenHeight()));
int scores = 0;
while (!s3eDeviceCheckQuitRequest())
{
// Clear background to blue
Iw2DSurfaceClear(0xff8080);
IwGxFontDrawText("Привет: ");
// Convert the score number to text
char str[32];
snprintf(str, 32, " %d", scores);
IwGxFontDrawText(str);
scores++;
// Flip the surface buffer to screen
Iw2DSurfaceShow();
s3eDeviceYield(0); // Yield to OS
}
Iw2DTerminate();
return 0;
}
当我展示拉丁文本 - 所有的作品,但是当我告诉古斯拉夫语 - 我得到一个错误
我如何可以显示西里尔文本?
正如消息问:你的源代码(因此你的字符串文字)[UTF-8](http://en.wikipedia.org/wiki/UTF-8)编码?许多编辑者使用本机编码,而且Windows上不是UTF-8。 – Csq 2014-09-04 08:26:26
@Csq,我怎样才能将我的字符串文字转换为UTF-8? – daleijn 2014-09-04 08:30:19
你使用哪个编辑器?在其设置中搜索UTF-8编码。大多数编辑能够使用UTF-8。例如,Notepad ++可以保存(甚至转换)UTF-8文件(请参阅其编码菜单)。 – Csq 2014-09-04 08:33:14