add sort glyf
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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
@@ -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>
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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.',
|
||||
|
||||
@@ -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%}格式字体',
|
||||
|
||||
@@ -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 选中的字形索引
|
||||
|
||||
@@ -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 选中的字形索引
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
define(
|
||||
function (require) {
|
||||
return require('fonteditor-core/graphics/computeBoundingBox');;
|
||||
return require('fonteditor-core/graphics/computeBoundingBox');
|
||||
}
|
||||
);
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
*/
|
||||
define(
|
||||
function (require) {
|
||||
return require('fonteditor-core/graphics/pathAdjust');;
|
||||
return require('fonteditor-core/graphics/pathAdjust');
|
||||
}
|
||||
);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
define(
|
||||
function (require) {
|
||||
return require('fonteditor-core/graphics/pathCeil');;
|
||||
return require('fonteditor-core/graphics/pathCeil');
|
||||
}
|
||||
);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
define(
|
||||
function (require) {
|
||||
return require('fonteditor-core/graphics/pathIterator');;
|
||||
return require('fonteditor-core/graphics/pathIterator');
|
||||
}
|
||||
);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
define(
|
||||
function (require) {
|
||||
return require('fonteditor-core/graphics/pathRotate');;
|
||||
return require('fonteditor-core/graphics/pathRotate');
|
||||
}
|
||||
);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
define(
|
||||
function (require) {
|
||||
return require('fonteditor-core/graphics/pathSkew');;
|
||||
return require('fonteditor-core/graphics/pathSkew');
|
||||
}
|
||||
);
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
|
||||
define(
|
||||
function (require) {
|
||||
return require('fonteditor-core/graphics/pathTransform');;
|
||||
return require('fonteditor-core/graphics/pathTransform');
|
||||
}
|
||||
);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
define(
|
||||
function (require) {
|
||||
return require('fonteditor-core/graphics/pathUtil');;
|
||||
return require('fonteditor-core/graphics/pathUtil');
|
||||
}
|
||||
);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
define(
|
||||
function (require) {
|
||||
return require('fonteditor-core/graphics/pathsUtil');;
|
||||
return require('fonteditor-core/graphics/pathsUtil');
|
||||
}
|
||||
);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
define(
|
||||
function (require) {
|
||||
return require('fonteditor-core/graphics/reducePath');;
|
||||
return require('fonteditor-core/graphics/reducePath');
|
||||
}
|
||||
);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
define(
|
||||
function (require) {
|
||||
return require('fonteditor-core/graphics/util');;
|
||||
return require('fonteditor-core/graphics/util');
|
||||
}
|
||||
);
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
define(
|
||||
function (require) {
|
||||
return require('fonteditor-core/math/bezierCubic2Q2');;
|
||||
return require('fonteditor-core/math/bezierCubic2Q2');
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user