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

Convert text to path #100

Open
ff6347 opened this issue Sep 26, 2016 · 6 comments
Open

Convert text to path #100

ff6347 opened this issue Sep 26, 2016 · 6 comments

Comments

@ff6347
Copy link
Member

ff6347 commented Sep 26, 2016

This is a easy one. See http://yearbook.github.io/esdocs/#/InDesign/Paragraph/createOutlines

could be something like:

/**
 * @param Story|TextFrame||Paragraph||Line||Word||Character
 * @param deleteOriginal default to true
 * return polygon group
 */
var poly = b.outline(item, [deleteOriginal]);


pub.outline = function(item, deleteOriginal) {
  if(deleteOriginal === null || deleteOriginal === undef){
    deleteOriginal = true;
  }
  var res = null;
  if(item instanceof Story||TextFrame||Paragraph||Line||Word||Character){
    res = item.createOutlines(deleteOriginal);
  }else{
    warn();
  }
return res
}
@trych
Copy link
Contributor

trych commented Sep 26, 2016

Nice idea, would like to see this implemented.

One thing though: I think the deleteOriginal parameter is not really consistent with how basil.js parameters work. There are no functions in basil which take a true or false as argument (edit: b.close() seems to be an exception?). I'm not sure myself, why that is, is this maybe adopted from Processing?

For example when I was implementing b.gradient() I thought I would allow a boolean argument that makes the gradient radial if true. I then settled for the (what I thought is the) more basil like way of introducing b.LINEAR and b.RADIAL instead.

Can somebody tell me – or can we together decide – which one is the preferred way of doing this?

@ff6347
Copy link
Member Author

ff6347 commented Sep 26, 2016

Hm. I get your point but what would be the CONSTANT to use? B.DELETEORIGINAL or B.KEEPORIGINAL? I think in a binary case like this one (yes vs no) keeping the original object it is okay to use a boolean. The gradiant could also be a b.WAVE gradiant. I know this does not exist but the possibility of another type is there. In the UI it is a dropdown not a checkbox.

@trych
Copy link
Contributor

trych commented Sep 26, 2016

Yes, I see what you mean. I'm not really against it, I just wanted to point out that these boolean arguments have not really been part of basil.js so far. Maybe @b-g knows if there is any specific reason for that or if there just never was any need for it?

@ffd8
Copy link
Member

ffd8 commented Sep 26, 2016

True this does stem back to some aspects of Processing, ie. endShape(CLOSE). And for the gradient example you designed, I think that's the right way to go, having a default type, but allowing one to specify another (why should 'true' == radial ?).

Since by default it deletes the original when creating outlines from type, it makes sense to keep that the same here too. Not sure how often one keeps the original, but if it's easy, why not. Of course yeah, do you use b.KEEPORIGINAL or an optional 'true'.. or to avoid any extra layer of complexity.. always delete the original and it's up to the coder to duplicate it first if they really want to keep it?

@ff6347
Copy link
Member Author

ff6347 commented Sep 26, 2016

always delete the original and it's up to the coder to duplicate it first if they really want to keep it?

This would be best I think.

@b-g
Copy link
Member

b-g commented Sep 26, 2016

Great, all clear! Please PR! :)

@ff6347 ff6347 self-assigned this Nov 11, 2016
ffd8 added a commit that referenced this issue Apr 2, 2018
- 4 new point based functions: createOutlines(), addPoints(), points(), pointsInPaths()
- w/ initial research by @kajetansom on point getting and interpolating, extended to handle live type, multi-line type, pageitems, etc.
- built upon outline pseudocode from @fabianmoronzirfas on issue #100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants