Skip to content
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

opentype creates inset cuts #2

Open
rlarge opened this issue Mar 8, 2018 · 4 comments
Open

opentype creates inset cuts #2

rlarge opened this issue Mar 8, 2018 · 4 comments

Comments

@rlarge
Copy link

rlarge commented Mar 8, 2018

I know this is a long shot but would you know any reason opentype would create a string of text thats inset instead of the example of the outset.

@tmpvar
Copy link
Owner

tmpvar commented Mar 9, 2018

not off the top of my head, could you provide the font + command that you are running?

@rlarge
Copy link
Author

rlarge commented Mar 10, 2018

I was using your code exactly but a font called norwester. I then went and tried your font and found that its a negative space font. So it was working as expected by creating the gcode from the fill area. I was using the gcanvas example to create the same effect by putting a rectangle behind.

  roundRect(ctx, 0,0,180,60,5);
  ctx.fill('evenodd');

function roundRect(ctx, x, y, w, h, r) {
  if (w < 2 * r) r = w / 2;
  if (h < 2 * r) r = h / 2;
  ctx.moveTo(x+r, y);
  ctx.arcTo(x+w, y,   x+w, y+h, r);
  ctx.arcTo(x+w, y+h, x,   y+h, r);
  ctx.arcTo(x,   y+h, x,   y,   r);
  ctx.arcTo(x,   y,   x+w, y,   r);
  ctx.closePath();
}

I can't seem to recreate it with your code any ideas.

@tmpvar
Copy link
Owner

tmpvar commented Mar 10, 2018

very interesting - I tried to repro what you are doing and downloaded https://www.fontsquirrel.com/fonts/norwester - is that the font you are using?

I ran into an opentype.js error on 0.3.x and 0.8.x:

text2gcode (master)‣ node text2gcode.js --font=/Users/tmpvar/Downloads/norwester/norwester.otf --diameter=6.35 --depth=-10 --pass=1
/Users/tmpvar/work/js/text2gcode/node_modules/opentype.js/dist/opentype.js:331
    for (i = 0; i < s.length; i += 1) {
                     ^

TypeError: Cannot read property 'length' of undefined
    at Font.stringToGlyphs (/Users/tmpvar/work/js/text2gcode/node_modules/opentype.js/dist/opentype.js:331:22)
    at Font.forEachGlyph (/Users/tmpvar/work/js/text2gcode/node_modules/opentype.js/dist/opentype.js:384:19)
    at Font.getPath (/Users/tmpvar/work/js/text2gcode/node_modules/opentype.js/dist/opentype.js:410:10)
    at /Users/tmpvar/work/js/text2gcode/text2gcode.js:62:19
    at /Users/tmpvar/work/js/text2gcode/node_modules/opentype.js/dist/opentype.js:950:16
    at /Users/tmpvar/work/js/text2gcode/node_modules/opentype.js/dist/opentype.js:797:9
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:504:3)

@rlarge
Copy link
Author

rlarge commented Mar 10, 2018

Ya i don't get any errors, i'm running newest version of opentype. That is the font i was using also. And it works as expected. I had to put in a feed to preview in the visualization but thats it.

I can't only get inset code still playing around with it. any ideas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants