mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2024-12-22 11:03:48 +01:00
fix bug in text utils
This commit is contained in:
parent
80c08d7b2c
commit
011d9904a7
@ -1,6 +1,5 @@
|
|||||||
import { SHAPE_CACHE_LIMIT } from '../constants/general.js';
|
import { SHAPE_CACHE_LIMIT } from '../constants/general.js';
|
||||||
import { Text } from '@doodle3d/cal';
|
import { Text } from '@doodle3d/cal';
|
||||||
import { POTRACE_OPTIONS } from '../constants/d2Constants.js';
|
|
||||||
import * as POTRACE from '@doodle3d/potrace-js';
|
import * as POTRACE from '@doodle3d/potrace-js';
|
||||||
import ClipperShape from '@doodle3d/clipper-js';
|
import ClipperShape from '@doodle3d/clipper-js';
|
||||||
import { shapeToVectorShape } from './vectorUtils.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);
|
const canvas = createTextCanvas(text, size * precision, family, style, weight);
|
||||||
|
|
||||||
// TODO merge with potrace in flood fill trace reducer
|
// 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 }) => ({
|
const pathsOffset = paths.map(path => path.map(({ x, y }) => ({
|
||||||
x: (x - MARGIN) / precision,
|
x: (x - MARGIN) / precision,
|
||||||
|
Loading…
Reference in New Issue
Block a user