Cinder 中文显示二三事
来源:互联网 发布:德意志意识形态 知乎 编辑:程序博客网 时间:2024/05/22 17:49
1. 字符串转换
首先要把 wstring 转换成 utf8-string(cinder在之后又会把utf8转换成utf16)
wstring s = L"是大地的泪点,使她的微笑保持着青春不谢。\nIt is the tears of the earth that keep here smiles in bloom.";
string utf8str = toUtf8(s);
2. 加载字体
//mfont = Font(loadAsset("FZSTK.TTF"), 32);
mfont=Font("STXINGKA",32); // 系统字体用字体文件名
3. 获取字体的shape2d
//Font::Glyph gly = mfont.getGlyphChar(utf8str[0]); // 这种方式不行,wide-utf8之后占了好几位
vector<Font::Glyph>glyphs = mfont.getGlyphs(utf8str); // 所以还是得使用这种方式,获取所有
shape2d s2d = mfont.getGlyphShape(glyphs[0]);
4. 用 TexBox 显示
TextBox tb = TextBox().font(mfont).text(utf8str);
gl::Texture tex = gl::Texture( tb.render() );
- Cinder 中文显示二三事
- Cinder
- 中文显示
- 中文显示
- 显示中文
- 显示中文
- liberty版本openstack按照官方文档安装部署dashboard上不显示cinder模块
- Openstack、Cinder
- cinder error_deleting
- cinder流程图
- 中文输入和中文显示
- 中文用户Xterm中文显示
- Qt 中文显示 QMessageBox按钮中文显示
- Qt 中文显示 QMessageBox按钮中文显示
- Qt 中文显示 QMessageBox按钮中文显示
- jsp中文显示问题
- JBuilderX中显示中文
- cygwin 输入显示中文
- Cocos2d-x开发者指南——目录
- oracle 关于日期格式转换与使用
- 最火前端开源项目
- Oracle 表死锁处理 ora-00054
- MKLocalSearch
- Cinder 中文显示二三事
- centos上配置vsftp,虚拟用户访问
- 颜色代码大全
- 线性代基础理论:矩阵
- WDK 资料整理
- uploadify http error 500
- 解决ECShop transport.js与jQuery冲突
- 使用开源消息推送协议的实现-mosquitto
- Linux Makefile 常用函数