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