增加提示框

This commit is contained in:
mkwiser 2014-10-16 23:44:25 +08:00
parent ef61db9cbd
commit 01b4c8f0d9
4 changed files with 20 additions and 12 deletions

View File

@ -38,8 +38,10 @@ define(
},
// 导出
'export': function() {
'export': function(e) {
if (!e.target.getAttribute('download')) {
e.preventDefault();
}
},
// 导出文件
@ -49,6 +51,7 @@ define(
program.exporter['export'](program.ttfManager.get(), {
type: target.attr('data-type'),
target: target,
originEvent: e,
error: function() {
e.preventDefault();
}

View File

@ -54,6 +54,7 @@ define(
options.success && options.success(base64Str);
}
catch(e) {
$(options.target).removeAttr('download');
alert(e.message);
options.error && options.error(e);
}

View File

@ -56,7 +56,6 @@ define(
fontData = ttf2base64(buffer);
}
// 过滤不显示的字形
var filtered = ttf.glyf.filter(function(g) {
return g.name != '.notdef' && g.name != '.null' && g.name != 'nonmarkingreturn'
@ -99,14 +98,19 @@ define(
* @param {string} fontFormat 字体类型
*/
load: function(ttf, fontFormat) {
var html = generatePreviewHTML(ttf, fontFormat);
var win = window.open('./empty.html');
win.onload = function() {
win.document.body.innerHTML = html;
win.focus();
win = null;
html = null;
};
try {
var html = generatePreviewHTML(ttf, fontFormat);
var win = window.open('./empty.html');
win.onload = function() {
win.document.body.innerHTML = html;
win.focus();
win = null;
html = null;
};
}
catch (exp) {
alert(exp.message);
}
}
};

View File

@ -14,9 +14,9 @@ define(
var Directory = require('./table/directory');
var supportTables = require('./table/support');
var checkSum = require('./util/checkSum');
var error = require('./error');
var reduceGlyf = require('./util/reduceGlyf');
var pathCeil = require('graphics/pathCeil');
// 支持写的表, 注意表顺序