add save glyf command

This commit is contained in:
kekee000 2014-12-26 00:26:14 +08:00
parent beb760ff1c
commit 5671713e54
6 changed files with 29 additions and 6 deletions

View File

@ -46,6 +46,9 @@ define(
else if (e.command == 'showgrid') { else if (e.command == 'showgrid') {
this.execCommand('showgrid', !e.args.selected); this.execCommand('showgrid', !e.args.selected);
} }
else if (e.command == 'save') {
this.fire('save');
}
else { else {
this.execCommand(e.command, e); this.execCommand(e.command, e);
} }
@ -187,9 +190,7 @@ define(
// 保存 // 保存
if (e.keyCode == 83 && e.ctrlKey) { if (e.keyCode == 83 && e.ctrlKey) {
me.fire('save', { me.fire('save');
font: me.getFont()
});
} }
// 粘贴 // 粘贴
else if (e.keyCode == 86 && e.ctrlKey) { else if (e.keyCode == 86 && e.ctrlKey) {

View File

@ -98,6 +98,10 @@ define(
{ {
name: 'fontsetting', name: 'fontsetting',
title: '字形信息' title: '字形信息'
},
{
name: 'save',
title: '保存'
} }
]; ];
} }

View File

@ -336,8 +336,8 @@ define(
program.on('save', function(e) { program.on('save', function(e) {
// 保存项目 // 保存项目
if (program.ttfManager.get()) { if (program.ttfManager.get()) {
var type = e.type;
if (program.editor.isEditing()) { if (type === 'editor' || program.editor.isEditing()) {
// 如果是正在编辑的 // 如果是正在编辑的
var editingIndex = program.viewer.getEditing(); var editingIndex = program.viewer.getEditing();

View File

@ -70,6 +70,12 @@ define(
}); });
}); });
editor.on('save', function() {
program.fire('save', {
type: 'editor'
});
});
var commandMenu = this.commandMenu; var commandMenu = this.commandMenu;
if (commandMenu) { if (commandMenu) {
@ -96,6 +102,13 @@ define(
var args = e.args; var args = e.args;
var shapes; var shapes;
if (command === 'save') {
program.fire('save', {
type: 'editor'
});
return;
}
if (command === 'splitshapes') { if (command === 'splitshapes') {
editor.setMode('split'); editor.setMode('split');
return; return;

View File

@ -27,6 +27,11 @@ define(
quickKey: 'D', quickKey: 'D',
disabled: true disabled: true
}, },
{
name: 'save',
title: '保存',
quickKey: 'S'
},
{ {
type: 'split' type: 'split'
}, },

View File

@ -123,7 +123,7 @@ define(
tableList.forEach(function(tableName) { tableList.forEach(function(tableName) {
var offset = ttfSize; var offset = ttfSize;
var tableSize = new supportTables[tableName]().size(ttf); // 原始的表大小 var tableSize = new supportTables[tableName]().size(ttf); // 原始的表大小
var size = tableSize; // 对齐后的表大小 var size = tableSize; // 对齐后的表大小
if (tableName == 'head') { if (tableName == 'head') {
ttfHeadOffset = offset; ttfHeadOffset = offset;