private void btnLoadTRFont_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "请选择输入TRFont点阵字库路径"; ofd.Filter = "bin files (*.bin)|*.bin"; if (ofd.ShowDialog() != DialogResult.OK) { return; } try { ushort fontHeight = getFontHeight(ofd.FileName); CXFontInfo info = new CXFontInfo(fontHeight); info.loadFile(ofd.FileName); pxFont = info.ToPixelFont(); pxFont.saveFile(Path.Combine(Application.StartupPath, "pxfont.bin")); } catch (TRFontException) { MessageBox.Show(this, "加载字体文件失败"); return; } }
private void btnTest_Click(object sender, EventArgs e) { CXFontInfo fi = new CXFontInfo(12); fi.loadFile(@"D:\cocos2d-x-2.2.6\projects\trgame\globalres\fonts\font_song_12.bin"); fi.saveFile(@"D:\cocos2d-x-2.2.6\projects\trgame\globalres\fonts\font_kai_12_bak.bin"); }