-
-
Notifications
You must be signed in to change notification settings - Fork 16
Svg parsing refactor #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
main/deepnest.js
Outdated
|
||
// assuming no intersections, return a tree where odd leaves are parts and even ones are holes | ||
// might be easier to use the DOM, but paths can't have paths as children. So we'll just make our own tree. | ||
this.getParts = function (paths, filename) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ultimately this entire function should be removable. I started stripping out pieces of it as I replaced the functionality with the typescript stuff.
s = require("../dist/tsc/svgparser.js"); | ||
window.SvgParser = new s.SvgParser(new f.FontFactory()); | ||
console.log(s); | ||
</script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where the entrypoint to the ts code is.
export abstract class Curve { | ||
abstract linearize(tol: number): Array<Point>; | ||
abstract start(): Point; | ||
abstract end(): Point; | ||
abstract toString(): String; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This encapsulates functionality for "path-like things" that can be turned into polygons with some "tolerance", so that we can use polygon-oriented Minkowski for everything, but still handle all of SVG paths.
constructor() { | ||
} | ||
|
||
get(name: String) : opentype.Font { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be replaceable with some kind of browser API, I think? This works on my Mac, but is obviously Wrong and Bad. I only used it because I was originally building in a non-browser context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not be bad. opentype.Font works crossplattform
No description provided.