add sort glyf

This commit is contained in:
kekee000
2015-08-09 18:32:47 +08:00
parent 5d71ec5e05
commit c9b11848b6
22 changed files with 88 additions and 15 deletions

View File

@@ -20,6 +20,7 @@ module.exports = exports = {
gen_glyph_name: 'Generate Glyph Name',
clear_glyph_name: 'Clear Glyph Name',
optimize_glyph: 'Optimize Glyph',
sort_glyf: 'Sort Glyph by Unicode',
compound2simple: 'Composite Glyph to Simple Glyph',
preview: 'Preview',
preview_ttf: 'ttf Font',

View File

@@ -20,6 +20,7 @@ module.exports = exports = {
gen_glyph_name: '生成字形名称',
clear_glyph_name: '清除字形名称',
optimize_glyph: '优化字体',
sort_glyf: '按代码点进行排序',
compound2simple: '复合字形转简单字形',
preview: '预览',
preview_ttf: 'ttf字体',

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -50,6 +50,7 @@
<li><a data-action="setting-glyf-name">${lang.gen_glyph_name}</a></li>
<li><a data-action="setting-glyf-clearname">${lang.clear_glyph_name}</a></li>
<li><a data-action="setting-optimize">${lang.optimize_glyph}</a></li>
<li><a data-action="setting-sort">${lang.sort_glyf}</a></li>
<li><a data-action="setting-compound2simple">${lang.compound2simple}</a></li>
</ul>
</div>

View File

@@ -268,6 +268,15 @@ define(
}
},
'setting-sort': function () {
if (program.ttfManager.get()) {
var result = program.ttfManager.sortGlyf();
if (true !== result) {
alert(result.message);
}
}
},
'setting-compound2simple': function () {
if (program.ttfManager.get()) {
program.ttfManager.compound2simple(program.viewer.getSelected());

View File

@@ -33,7 +33,8 @@ define(
msg_no_related_glhph: 'Find no related glyph!',
msg_error_open_proj: 'Open project error, do you want to delete this project?',
msg_error_del_proj: 'Delete project error, please refresh this page and try delete again!',
msg_no_sort_glyf: 'No glyph to sort!',
msg_has_compound_glyf_sort: 'Can\'t sort glyphs while contains compound glyph.',
preview_title: 'Preview {%=fontFormat%} Format Font',
preview_first_step: 'Step 1: Use `{%=fontFamily%}` as font-face.',

View File

@@ -33,6 +33,8 @@ define(
msg_no_related_glhph: '未找到相关字形!',
msg_error_open_proj: '打开项目失败,是否删除项目?',
msg_error_del_proj: '删除项目失败,请刷新页面后删除!',
msg_no_sort_glyf: '没有要排序的字形!',
msg_has_compound_glyf_sort: '包含复合字形,无法进行排序',
preview_title: '预览{%=fontFormat%}格式字体',

View File

@@ -440,6 +440,35 @@ define(
};
};
/**
* 对字形按照unicode编码排序
*
* @return {true|Object} 优化成功,或者错误信息
*/
Manager.prototype.sortGlyf = function () {
var result = this.ttf.sortGlyf();
if (result === -1) {
return {
message: i18n.lang.msg_no_sort_glyf
};
}
else if (result === -2) {
return {
message: i18n.lang.msg_has_compound_glyf_sort
};
}
if (result.length) {
result.forEach(function (g) {
g.modify = 'edit';
});
this.fireChange(true);
}
return true;
};
/**
* 复合字形转简单字形
* @param {Array=} indexList 选中的字形索引

View File

@@ -440,6 +440,35 @@ define(
};
};
/**
* 对字形按照unicode编码排序
*
* @return {true|Object} 优化成功,或者错误信息
*/
Manager.prototype.sortGlyf = function () {
var result = this.ttf.sortGlyf();
if (result === -1) {
return {
message: i18n.lang.msg_no_sort_glyf
};
}
else if (result === -2) {
return {
message: i18n.lang.msg_has_compound_glyf_sort
};
}
if (result.length) {
result.forEach(function (g) {
g.modify = 'edit';
});
this.fireChange(true);
}
return true;
};
/**
* 复合字形转简单字形
* @param {Array=} indexList 选中的字形索引

View File

@@ -5,6 +5,6 @@
define(
function (require) {
return require('fonteditor-core/graphics/computeBoundingBox');;
return require('fonteditor-core/graphics/computeBoundingBox');
}
);

View File

@@ -4,6 +4,6 @@
*/
define(
function (require) {
return require('fonteditor-core/graphics/pathAdjust');;
return require('fonteditor-core/graphics/pathAdjust');
}
);

View File

@@ -5,6 +5,6 @@
define(
function (require) {
return require('fonteditor-core/graphics/pathCeil');;
return require('fonteditor-core/graphics/pathCeil');
}
);

View File

@@ -5,6 +5,6 @@
define(
function (require) {
return require('fonteditor-core/graphics/pathIterator');;
return require('fonteditor-core/graphics/pathIterator');
}
);

View File

@@ -5,6 +5,6 @@
define(
function (require) {
return require('fonteditor-core/graphics/pathRotate');;
return require('fonteditor-core/graphics/pathRotate');
}
);

View File

@@ -5,6 +5,6 @@
define(
function (require) {
return require('fonteditor-core/graphics/pathSkew');;
return require('fonteditor-core/graphics/pathSkew');
}
);

View File

@@ -15,6 +15,6 @@
define(
function (require) {
return require('fonteditor-core/graphics/pathTransform');;
return require('fonteditor-core/graphics/pathTransform');
}
);

View File

@@ -5,6 +5,6 @@
define(
function (require) {
return require('fonteditor-core/graphics/pathUtil');;
return require('fonteditor-core/graphics/pathUtil');
}
);

View File

@@ -5,6 +5,6 @@
define(
function (require) {
return require('fonteditor-core/graphics/pathsUtil');;
return require('fonteditor-core/graphics/pathsUtil');
}
);

View File

@@ -5,6 +5,6 @@
define(
function (require) {
return require('fonteditor-core/graphics/reducePath');;
return require('fonteditor-core/graphics/reducePath');
}
);

View File

@@ -5,6 +5,6 @@
define(
function (require) {
return require('fonteditor-core/graphics/util');;
return require('fonteditor-core/graphics/util');
}
);

View File

@@ -5,6 +5,6 @@
define(
function (require) {
return require('fonteditor-core/math/bezierCubic2Q2');;
return require('fonteditor-core/math/bezierCubic2Q2');
}
);