update readme

This commit is contained in:
kekee000 2019-10-24 18:11:49 +08:00
parent b2f3fe5685
commit f4e20f3f8f
8 changed files with 63 additions and 98 deletions

View File

@ -8,36 +8,17 @@ fonteditor 在线ttf字体编辑器
### 开发:
* fonteditor依赖[fonteditor-core](https://github.com/kekee000/fonteditor-core)项目需要在dep目录引入`fonteditor-core`
```
cd ./dep
git clone https://github.com/kekee000/fonteditor-core
npm install && npm run dev
```
* `index.tpl`为入口模板文件,若要修改`index.tpl`需要执行以下命令来生成`index.html``index-en.html`入口文件。
```
node ./build/build-index.js
```
* `less`文件修改之后使用如下脚本编译:
```
node ./build/build-css.js
```
* 使用`edp`对fonteditor进行调试
```
edp webserver start
```
* `index.tpl`为入口模板文件,根据`index.tpl`生成`index.html``index-en.html`入口文件。
* jszip模块3.0 api有变动若要升级需要测试和修改导出zip模式
### 编译:
```
sh build.sh
npm run build
```
### 相关项目
@ -45,8 +26,6 @@ sh build.sh
在线编辑器核心: [fonteditor-core](https://github.com/kekee000/fonteditor-core)
在线编辑器node版: [fonteditor-ttf](https://github.com/kekee000/fonteditor-ttf)
## release log:
@ -104,3 +83,7 @@ sh build.sh
26. 2016-3-22 增加字形旋转吸附,调整配色.
27. 2016-4-18 更新新lib库优化错误提示体验.
28. 2019-10-14 使用es6 module 进行重构.
29. 2019-10-24 支持woff2读取和写入.

View File

@ -1,38 +1,10 @@
#!/bin/bash
cd $(dirname $0)
[ -d ./dist ] && rm -r dist
# 时间戳
version=`date "+%Y%m%d"`
npm run prod
# build首页版本
build_index() {
node "./build/build-index.js" $version
}
# build静态资源
build_asset() {
edp build --stage=release --force
if [ $? != 0 ]; then
echo "edp build failed!"
exit 1
fi
echo "asset path./release"
}
# 移动文件到指定目录
move_asset() {
mv ./release/src ./release/$version
cat ./release/index.html | sed -e "s#'\.\/src'#'./$version'#g" > ./release/index.html.tmp
mv ./release/index.html.tmp ./release/index.html
cat ./release/index-en.html | sed -e "s#'\.\/src'#'./$version'#g" > ./release/index-en.html.tmp
mv ./release/index-en.html.tmp ./release/index-en.html
cat ./release/editor.html | sed -e "s#'\.\/src'#'./$version'#g" > ./release/editor.html.tmp
mv ./release/editor.html.tmp ./release/editor.html
}
build_index
build_asset
move_asset
cp -r dep dist
cp -r font dist
cp empty.html proxy.html dist
echo 'build to `dist` done'

View File

@ -13,21 +13,21 @@
"name": "junmer"
}
],
"description": "ttf to woff,svg,eot convert, ttf adjust",
"description": "ttf to woff, woff2, svg, eot convert, ttf adjust",
"scripts": {
"dev": "webpack-dev-server --open --config ./config/webpack.dev.js",
"build": "webpack --production --config ./config/webpack.prod.js"
"prod": "webpack --production --config ./config/webpack.prod.js",
"build": "sh build.sh"
},
"devDependencies": {
"css-loader": "^3.2.0",
"file-loader": "^4.2.0",
"fonteditor-core": "^2.0.3",
"html-webpack-plugin": "^3.2.0",
"jquery": "^3.4.1",
"less": "^2.0.0",
"less-loader": "^5.0.0",
"mini-css-extract-plugin": "^0.8.0",
"q": "^1.2.0",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"style-loader": "^1.0.0",
"to-string-loader": "^1.1.5",
"url-loader": "^2.2.0",
@ -50,5 +50,5 @@
"type": "git",
"url": "git://github.com/ecomfe/fonteditor.git"
},
"version": "1.0.1"
"version": "2.0.1"
}

View File

@ -3,18 +3,30 @@
* @author mengke01(kekee000@gmail.com)
*/
import * as lang from 'fonteditor-core/common/lang';
lang.parseQuery = function (querystring) {
let query = querystring.split('&')
.map(function (item) {
item = item.split('=');
return [item[0], decodeURIComponent(item[1])];
})
.reduce(function (query, item) {
query[item[0]] = item[1];
return query;
}, {});
return query;
};
import {
clone,
overwrite,
debounce,
throttle,
equals
} from 'fonteditor-core/common/lang';
export default lang;
export default {
clone,
overwrite,
debounce,
throttle,
equals,
parseQuery(querystring) {
let query = querystring.split('&')
.map(function (item) {
item = item.split('=');
return [item[0], decodeURIComponent(item[1])];
})
.reduce(function (query, item) {
query[item[0]] = item[1];
return query;
}, {});
return query;
}
};

View File

@ -40,7 +40,7 @@ export default class Editor {
this.render = render;
// 按顺序执行editor的控制器
for (var i = 0, l = this.initers.length; i < l; i++) {
for (let i = 0, l = this.initers.length; i < l; i++) {
this.initers[i].call(this);
}
@ -54,16 +54,14 @@ export default class Editor {
* 切换编辑模式
*
* @param {string} modeName 模式名称
* @param {...Array} args args
* @return {this}
*/
setMode(modeName) {
setMode(modeName, ...args) {
if (this.mode) {
this.mode.end && this.mode.end.call(this);
}
this.mode = modeSupport[modeName] || modeSupport.default;
var args = Array.prototype.slice.call(arguments, 1);
this.mode.begin && this.mode.begin.apply(this, args);
return this;
}
@ -107,13 +105,13 @@ export default class Editor {
*/
refreshSelected(shapes) {
if (this.currentGroup) {
var lastShapes = this.currentGroup.shapes;
let lastShapes = this.currentGroup.shapes;
this.currentGroup.setShapes(shapes);
this.currentGroup.refresh();
if (shapes !== lastShapes) {
this.fire('selection:change', {
shapes: shapes
shapes
});
}
}
@ -132,14 +130,13 @@ export default class Editor {
* 执行指定命令
*
* @param {...string} command 指令名后续为命令参数集合
* @param {...Array} args args
* @return {boolean} 是否执行成功
*/
execCommand(command) {
var args = Array.prototype.slice.call(arguments, 1);
var event = {
command: command,
args: args
execCommand(command, ...args) {
let event = {
command,
args
};
this.fire('beforecommand', event);
@ -148,7 +145,7 @@ export default class Editor {
}
if (commandSupport[command]) {
var ret = commandSupport[command].apply(this, args);
let ret = commandSupport[command].apply(this, args);
event.result = ret;
this.fire('command', event);
return ret;
@ -188,7 +185,7 @@ export default class Editor {
* @return {boolean}
*/
isChanged() {
var font = this.getFont();
let font = this.getFont();
return this.fontHash !== getFontHash(font);
}
@ -202,7 +199,7 @@ export default class Editor {
this.fontHash = 0;
}
else {
var font = this.getFont();
let font = this.getFont();
this.fontHash = getFontHash(font);
}
}

View File

@ -95,6 +95,7 @@ const transform = {
* @return {boolean} `false`或者`undefined`
*/
mirrorshapes(shapes) {
debugger;
shapes = shapes || (this.currentGroup && this.currentGroup.shapes);
if (!shapes || !shapes.length) {
return false;
@ -108,4 +109,4 @@ const transform = {
}
};
export default transform;
export default transform;

View File

@ -4,7 +4,7 @@
*/
export default {
glyph_name: 'Glyph Name',
glyph_name: 'Glyph Name',
left_side_bearing: 'Left Side Bearing',
right_side_bearing: 'Right Side Bearing',
baseline_offset: 'Baseline Offset',

View File

@ -4,7 +4,7 @@
*/
import computeBoundingBox from 'fonteditor-core/graphics/computeBoundingBox';
import computeBoundingBox from 'graphics/computeBoundingBox';
import contours2svg from 'fonteditor-core/ttf/util/contours2svg';
import pathAdjust from 'fonteditor-core/graphics/pathAdjust';
import pathCeil from 'fonteditor-core/graphics/pathCeil';