mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
17 lines
439 B
JavaScript
17 lines
439 B
JavaScript
|
|
module.exports = {
|
|
setFontToNode: function(fontAsset, node) {
|
|
if (fontAsset) {
|
|
var config = {type:'font', name: fontAsset.fontFamily, id:fontAsset.url, srcs:[fontAsset.url]};
|
|
cc.loader.load(config, function (err, result) {
|
|
if (err) throw err;
|
|
|
|
node.fontName = config.name;
|
|
});
|
|
}
|
|
else {
|
|
node.fontName = 'Arial';
|
|
}
|
|
}
|
|
};
|