Appcelerator:SDK 5.2 无法识别字体。0.GA
Appcelerator : Fonts are not recognized from SDK 5.2.0.GA
我的应用程序不再识别 SDK >= 5.2.0.GA 的字体文件。
使用 SDK <= 5.1.2.GA 没问题
阅读文档我没有找到与此问题相关的任何内容,或者我错了吗?
TiApp.xml
<ios>
<plist>
<dict>
<key>UIAppFonts</key>
<array>
<string>/fonts/icons.ttf</string>
</array>
....
</dict>
</plist>
</ios>
字体目录
图标示例
var IconicFont = require('/icon/IconicFont');
var Icons = new IconicFont({
font : '/icon/ListIcons'
});
var myBtn = Ti.UI.createButton({
height : 50,
width : 50,
color : 'white',
font : {
fontSize : 30,
fontFamily : Icons.fontfamily
},
title : Icons.icon("nameicon"),
textAlign : Ti.UI.TEXT_ALIGNMENT_CENTER,
verticalAlign : Ti.UI.TEXT_VERTICAL_ALIGNMENT_CENTER
});
IconicFont.js
function IconicFont(params) {
params = params || {};
this._font = require(params.font);
}
Object.defineProperties(IconicFont.prototype, {
font: {
set: function(param){
this._font = require(param);
},
get: function(){
return this._font;
}
},
fontfamily: {
get: function(){
return this._font.fontfamily;
}
}
});
IconicFont.prototype.icon = function(param){
var result = [];
if (!Array.isArray(param)) {
param = [param];
}
for (var i = 0; i < param.length; i++) {
result.push(String.fromCharCode(this._font.charcode[param[i]]));
}
return result.join('');
};
module.exports = IconicFont;
ListIcons.js
exports.fontfamily = 'FontName';
exports.charcode = {
'image':0xf11a,
'.....':......
};
/platform/iphone/fonts 是一个很奇怪的地方,appcelerator docs 告诉你把它们放在 /app/assets/[android][iphone]/fonts , 试着把它们放在这里。
我的应用程序不再识别 SDK >= 5.2.0.GA 的字体文件。
使用 SDK <= 5.1.2.GA 没问题
阅读文档我没有找到与此问题相关的任何内容,或者我错了吗?
TiApp.xml
<ios>
<plist>
<dict>
<key>UIAppFonts</key>
<array>
<string>/fonts/icons.ttf</string>
</array>
....
</dict>
</plist>
</ios>
字体目录
图标示例
var IconicFont = require('/icon/IconicFont');
var Icons = new IconicFont({
font : '/icon/ListIcons'
});
var myBtn = Ti.UI.createButton({
height : 50,
width : 50,
color : 'white',
font : {
fontSize : 30,
fontFamily : Icons.fontfamily
},
title : Icons.icon("nameicon"),
textAlign : Ti.UI.TEXT_ALIGNMENT_CENTER,
verticalAlign : Ti.UI.TEXT_VERTICAL_ALIGNMENT_CENTER
});
IconicFont.js
function IconicFont(params) {
params = params || {};
this._font = require(params.font);
}
Object.defineProperties(IconicFont.prototype, {
font: {
set: function(param){
this._font = require(param);
},
get: function(){
return this._font;
}
},
fontfamily: {
get: function(){
return this._font.fontfamily;
}
}
});
IconicFont.prototype.icon = function(param){
var result = [];
if (!Array.isArray(param)) {
param = [param];
}
for (var i = 0; i < param.length; i++) {
result.push(String.fromCharCode(this._font.charcode[param[i]]));
}
return result.join('');
};
module.exports = IconicFont;
ListIcons.js
exports.fontfamily = 'FontName';
exports.charcode = {
'image':0xf11a,
'.....':......
};
/platform/iphone/fonts 是一个很奇怪的地方,appcelerator docs 告诉你把它们放在 /app/assets/[android][iphone]/fonts , 试着把它们放在这里。