cocos2dx android 字体的设置

cocos2d-x 的优点之一:就是跨平台

我们知道 ios 自带的字体 和 android 自带的字体不同

为了使我们开发的游戏中的字体统一 我们就需要自己的字体(包括从mac 拷贝出来的 字体)

从 mac 中 copy 出 Thonburi.ttf 文件 这个字体在我的 win8 下打不开 但是 android 可以识别 (这字体还分系统吗?求指教)

CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Arial", 24);

第二个 参数是设置字体的 如果不加 .ttf 后缀 默认使用 系统中自带的 字体 , 如果字体名有错误 则默认使用 手机设置的 字体

如果在后面加上.ttf 就是使用 资源文件中的 字体

CCLabelTTF* pLabel2 = CCLabelTTF::labelWithString("About", "fonts/Thonburi.ttf", 24);

CCLabelTTF* pLabel3 = CCLabelTTF::labelWithString("About", "fonts/Marker Felt.ttf", 24);

详细原理可以参考http://www.2cto.com/kf/201210/163229.html

(PS:不知道是不是 源地址 )

原文地址:https://www.cnblogs.com/jaoye/p/2913246.html