Skip to content

Commit

Permalink
glyf align to center
Browse files Browse the repository at this point in the history
  • Loading branch information
kekee000 committed Apr 8, 2016
1 parent 9a45bef commit 9c72fb5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/fonteditor/widget/util/glyf2svgfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ define(function (require) {
if (glyf.contours && glyf.contours.length) {
var contours = lang.clone(glyf.contours);
var bound = computeBoundingBox.computePath.apply(null, contours);
var scale = opt.unitsPerEm / Math.max(bound.width, bound.height);
var originSize = Math.max(bound.width, bound.height);
var scale = opt.unitsPerEm / originSize;
contours.forEach(function (contour) {
pathAdjust(contour, 1, 1, -bound.x, -bound.y - bound.height / 2);
pathAdjust(contour, 1, -1, 0, 0);
pathAdjust(contour, scale, scale, 0, bound.height / 2);
pathAdjust(contour, scale, scale, (originSize - bound.width) / 2, bound.height / 2);
pathCeil(contour, 2);
});
g.d = 'd="' + contours2svg(contours) + '"';
Expand Down

0 comments on commit 9c72fb5

Please sign in to comment.