Browse Source

fix bug in text utils

pull/6/head
casper 1 year ago
parent
commit
011d9904a7
  1. 9
      src/utils/textUtils.js

9
src/utils/textUtils.js

@ -1,6 +1,5 @@
import { SHAPE_CACHE_LIMIT } from '../constants/general.js';
import { Text } from '@doodle3d/cal';
import { POTRACE_OPTIONS } from '../constants/d2Constants.js';
import * as POTRACE from '@doodle3d/potrace-js';
import ClipperShape from '@doodle3d/clipper-js';
import { shapeToVectorShape } from './vectorUtils.js';
@ -15,7 +14,13 @@ export function createTextRaw(text, size, precision, family, style, weight) {
const canvas = createTextCanvas(text, size * precision, family, style, weight);
// TODO merge with potrace in flood fill trace reducer
const paths = POTRACE.getPaths(POTRACE.traceCanvas(canvas, POTRACE_OPTIONS));
const paths = POTRACE.getPaths(POTRACE.traceCanvas(canvas, {
turnpolicy: 'black',
turdsize: 5.0,
optcurve: false,
alphamax: 0.5,
opttolerance: 0.2
}));
const pathsOffset = paths.map(path => path.map(({ x, y }) => ({
x: (x - MARGIN) / precision,

Loading…
Cancel
Save