自定义字体:使用浏览器调试可用,用模拟器和打包都没用

var res = {
fonts_slime:{
type:“font”,
name:“slime”,
srcs:“res/font/msyh.ttf”]
},
fonts_number:{
type:“font”,
name:“num”,
srcs:“res/font/whitestone.ttf”]
}
};

var fontRes = ];

var g_resources = ];
for (var i in res) {
g_resources.push(res*);
}

在资源里加载了2个字体文件,使用chrome调试都能见。但用IDE的模拟器调试就没有自定义字体了,打包到apk安装也没有。*

js用的3.3 IDE用的1.2

api有bug 可以试试下面两种方式
1.var titleLable = new cc.LabelTTF(“Hello world123”, “Schwarzwald-Regular”, 38);
titleLable.setFontName(“Schwarzwald-Regular”);//自定义只在web有效

2.var titleLable = new ccui.TextField(“hello”, “Schwarzwald-Regular” , 38);

titleLable.setFontName(“res/Schwarzwald-Regular.ttf”);//自定义字体只在native(android已测试)有效,填写字体文件的全路径