UNPKG

fonteditor-core

Version:

fonts (ttf, woff, woff2, eot, svg, otf) parse, write, transform, glyph adjust.

44 lines (41 loc) 779 B
/** * @file 矩形转换成轮廓 * @author mengke01(kekee000@gmail.com) */ /** * 矩形转换成轮廓 * * @param {number} x 左上角x * @param {number} y 左上角y * @param {number} width 宽度 * @param {number} height 高度 * @return {Array} 轮廓数组 */ export default function rect2contour(x, y, width, height) { x = +x; y = +y; width = +width; height = +height; return [ { x, y, onCurve: true }, { x: x + width, y, onCurve: true }, { x: x + width, y: y + height, onCurve: true }, { x, y: y + height, onCurve: true } ]; }