Skip to content

Commit fab2676

Browse files
committed
update source to latest
1 parent 55df33f commit fab2676

File tree

8 files changed

+3086
-1299
lines changed

8 files changed

+3086
-1299
lines changed

Diff for: _source/_data/categories.json

+119
Original file line numberDiff line numberDiff line change
@@ -7759,6 +7759,62 @@
77597759
"todo": null,
77607760
"summary": "Gets a text's paragraph style or gets a paragraph style by name.",
77617761
"codetitle": "paragraphStyle(textOrName, [props])"
7762+
},
7763+
{
7764+
"name": "createOutlines",
7765+
"description": "Returns an array of polygons after outlining text and optionally processes them with a callback function.\nUse together with `pathToPoints()` for getting point and bezier coordinates from outlines. If used on a text frame,\nall linked text frames will be converted to outlines as well.",
7766+
"returns": {
7767+
"name": null,
7768+
"description": "Returns an array of polygons.",
7769+
"type": [
7770+
"Array"
7771+
]
7772+
},
7773+
"category": "Typography",
7774+
"subcategory": null,
7775+
"parameters": [
7776+
{
7777+
"name": "item",
7778+
"description": "Text or TextPath to be outlined.",
7779+
"optional": false,
7780+
"type": [
7781+
"TextFrame",
7782+
"TextPath"
7783+
]
7784+
},
7785+
{
7786+
"name": "cb",
7787+
"description": "Optional: Callback function to use with each polygon. Passed arguments: `obj`, `loopCounter`",
7788+
"optional": true,
7789+
"type": [
7790+
"Function"
7791+
]
7792+
}
7793+
],
7794+
"kind": "function",
7795+
"tags": [
7796+
{
7797+
"title": "summary",
7798+
"description": "Convert text items to outlines."
7799+
},
7800+
{
7801+
"title": "description",
7802+
"description": "Returns an array of polygons after outlining text and optionally processes them with a callback function.\nUse together with `pathToPoints()` for getting point and bezier coordinates from outlines. If used on a text frame,\nall linked text frames will be converted to outlines as well."
7803+
}
7804+
],
7805+
"examples": [
7806+
{
7807+
"description": "Convert text to outlines",
7808+
"code": "textSize(150);\nvar myText = text(\"Hello\", 0, 0, width, height);\nvar outlines = createOutlines(myText);"
7809+
},
7810+
{
7811+
"description": "Run a callback function on each resulting shape",
7812+
"code": "textSize(150);\nvar myText = text(\"Hello \\nWorld\", 0, 0, width, height);\nvar outlines = createOutlines(myText, function(obj){\n var pts = pathToPoints(obj);\n println(pts.length); // check number of points\n});"
7813+
}
7814+
],
7815+
"todo": null,
7816+
"summary": "Convert text items to outlines.",
7817+
"codetitle": "createOutlines(item, [cb])"
77627818
}
77637819
],
77647820
"cat": "Typography"
@@ -9994,6 +10050,69 @@
999410050
"todo": null,
999510051
"summary": "Adds a vertex during drawing complex paths or shapes.",
999610052
"codetitle": "vertex(x, y, [xLeftHandle], [yLeftHandle], [xRightHandle], [yRightHandle])"
10053+
},
10054+
{
10055+
"name": "pathToPoints",
10056+
"description": "Returns an object containing an array of all points, an array of all beziers (points + their anchor points) and an array of all paths (containing its array of points + beziers) of a given pageItem in InDesign. Together with `createOutlines()` this can be used on text items. Accepts both single paths or a collection/group of paths.\nWhen using this on a multi path object (e.g. text with separate paths), the `paths` property can be used to loop over every path separately, whereas the properties `points` and `beziers` contain arrays for all paths combined.\nAn optional second parameter adds interpolated points between existing points, which is helpful for subdividing existing paths.",
10057+
"returns": {
10058+
"name": null,
10059+
"description": "Returns object with the following arrays `points`, `beziers`, `paths`",
10060+
"type": [
10061+
"Object"
10062+
]
10063+
},
10064+
"category": "Shape",
10065+
"subcategory": null,
10066+
"parameters": [
10067+
{
10068+
"name": "obj",
10069+
"description": "The pageItem(s) to process point/bezier coordinates of.",
10070+
"optional": false,
10071+
"type": [
10072+
"Object"
10073+
]
10074+
},
10075+
{
10076+
"name": "addPoints",
10077+
"description": "Optional amount of additional interpolated points.",
10078+
"optional": true,
10079+
"type": [
10080+
"Number"
10081+
]
10082+
}
10083+
],
10084+
"kind": "function",
10085+
"tags": [
10086+
{
10087+
"title": "summary",
10088+
"description": "Get points and bezier coordinates from path(s)."
10089+
},
10090+
{
10091+
"title": "description",
10092+
"description": "Returns an object containing an array of all points, an array of all beziers (points + their anchor points) and an array of all paths (containing its array of points + beziers) of a given pageItem in InDesign. Together with `createOutlines()` this can be used on text items. Accepts both single paths or a collection/group of paths.\nWhen using this on a multi path object (e.g. text with separate paths), the `paths` property can be used to loop over every path separately, whereas the properties `points` and `beziers` contain arrays for all paths combined.\nAn optional second parameter adds interpolated points between existing points, which is helpful for subdividing existing paths."
10093+
}
10094+
],
10095+
"examples": [
10096+
{
10097+
"description": "Draw all points of a vector path",
10098+
"code": "noFill();\nvar myCircle = ellipse(width / 2, height / 2, width / 2, width / 2);\nvar pts = pathToPoints(myCircle);\n\nfor (var i = 0; i < pts.points.length; i++) {\n var pt = pts.points[i];\n ellipse(pt.x, pt.y, 3, 3);\n}"
10099+
},
10100+
{
10101+
"description": "With Interpolation between Points",
10102+
"code": "noFill();\nvar myCircle = ellipse(width / 2, height / 2, width / 2, width / 2);\nvar pts = pathToPoints(myCircle, 5); // add 5 points between each point\n\nfor (var i = 0; i < pts.points.length; i++) {\n var pt = pts.points[i];\n ellipse(pt.x, pt.y, 3, 3);\n}"
10103+
},
10104+
{
10105+
"description": "Draw Beziers and handles from Path",
10106+
"code": "noFill();\ntextSize(400);\nvar myText = text('S', 0, 0, width, height);\nvar myOutlines = createOutlines(myText);\nvar pts = pathToPoints(myOutlines);\n\nbeginShape();\nfor (var i = 0; i < pts.beziers.length; i++) {\n var bz = pts.beziers[i];\n vertex(bz.anchor.x, bz.anchor.y, bz.left.x, bz.left.y, bz.right.x, bz.right.y);\n line(bz.anchor.x, bz.anchor.y, bz.left.x, bz.left.y); // left handle\n line(bz.anchor.x, bz.anchor.y, bz.right.x, bz.right.y); // right handle\n}\nendShape(CLOSE);"
10107+
},
10108+
{
10109+
"description": "Separated Paths of Beziers",
10110+
"code": "noFill();\ntextSize(400);\nvar myText = text('B', 0, 0, width, height);\nvar myOutlines = createOutlines(myText);\nvar pts = pathToPoints(myOutlines); // add 3 for more detail\n\nfor (var j = 0; j < pts.paths.length; j++) {\n var path = pts.paths[j];\n\n beginShape();\n for (var i = 0; i < path.beziers.length; i++) {\n var bz = path.beziers[i];\n vertex(bz.anchor.x, bz.anchor.y, bz.left.x, bz.left.y, bz.right.x, bz.right.y);\n line(bz.anchor.x, bz.anchor.y, bz.left.x, bz.left.y); // left handle\n line(bz.anchor.x, bz.anchor.y, bz.right.x, bz.right.y); // right handle\n }\n endShape(CLOSE);\n}"
10111+
}
10112+
],
10113+
"todo": null,
10114+
"summary": "Get points and bezier coordinates from path(s).",
10115+
"codetitle": "pathToPoints(obj, [addPoints])"
999710116
}
999810117
],
999910118
"cat": "Shape"

Diff for: _source/_data/cats-and-subcats.json

+125
Original file line numberDiff line numberDiff line change
@@ -8739,6 +8739,75 @@
87398739
}
87408740
],
87418741
[
8742+
{
8743+
"entries": [
8744+
{
8745+
"name": "pathToPoints",
8746+
"description": "Returns an object containing an array of all points, an array of all beziers (points + their anchor points) and an array of all paths (containing its array of points + beziers) of a given pageItem in InDesign. Together with `createOutlines()` this can be used on text items. Accepts both single paths or a collection/group of paths.\nWhen using this on a multi path object (e.g. text with separate paths), the `paths` property can be used to loop over every path separately, whereas the properties `points` and `beziers` contain arrays for all paths combined.\nAn optional second parameter adds interpolated points between existing points, which is helpful for subdividing existing paths.",
8747+
"returns": {
8748+
"name": null,
8749+
"description": "Returns object with the following arrays `points`, `beziers`, `paths`",
8750+
"type": [
8751+
"Object"
8752+
]
8753+
},
8754+
"category": "Shape",
8755+
"subcategory": null,
8756+
"parameters": [
8757+
{
8758+
"name": "obj",
8759+
"description": "The pageItem(s) to process point/bezier coordinates of.",
8760+
"optional": false,
8761+
"type": [
8762+
"Object"
8763+
]
8764+
},
8765+
{
8766+
"name": "addPoints",
8767+
"description": "Optional amount of additional interpolated points.",
8768+
"optional": true,
8769+
"type": [
8770+
"Number"
8771+
]
8772+
}
8773+
],
8774+
"kind": "function",
8775+
"tags": [
8776+
{
8777+
"title": "summary",
8778+
"description": "Get points and bezier coordinates from path(s)."
8779+
},
8780+
{
8781+
"title": "description",
8782+
"description": "Returns an object containing an array of all points, an array of all beziers (points + their anchor points) and an array of all paths (containing its array of points + beziers) of a given pageItem in InDesign. Together with `createOutlines()` this can be used on text items. Accepts both single paths or a collection/group of paths.\nWhen using this on a multi path object (e.g. text with separate paths), the `paths` property can be used to loop over every path separately, whereas the properties `points` and `beziers` contain arrays for all paths combined.\nAn optional second parameter adds interpolated points between existing points, which is helpful for subdividing existing paths."
8783+
}
8784+
],
8785+
"examples": [
8786+
{
8787+
"description": "Draw all points of a vector path",
8788+
"code": "noFill();\nvar myCircle = ellipse(width / 2, height / 2, width / 2, width / 2);\nvar pts = pathToPoints(myCircle);\n\nfor (var i = 0; i < pts.points.length; i++) {\n var pt = pts.points[i];\n ellipse(pt.x, pt.y, 3, 3);\n}"
8789+
},
8790+
{
8791+
"description": "With Interpolation between Points",
8792+
"code": "noFill();\nvar myCircle = ellipse(width / 2, height / 2, width / 2, width / 2);\nvar pts = pathToPoints(myCircle, 5); // add 5 points between each point\n\nfor (var i = 0; i < pts.points.length; i++) {\n var pt = pts.points[i];\n ellipse(pt.x, pt.y, 3, 3);\n}"
8793+
},
8794+
{
8795+
"description": "Draw Beziers and handles from Path",
8796+
"code": "noFill();\ntextSize(400);\nvar myText = text('S', 0, 0, width, height);\nvar myOutlines = createOutlines(myText);\nvar pts = pathToPoints(myOutlines);\n\nbeginShape();\nfor (var i = 0; i < pts.beziers.length; i++) {\n var bz = pts.beziers[i];\n vertex(bz.anchor.x, bz.anchor.y, bz.left.x, bz.left.y, bz.right.x, bz.right.y);\n line(bz.anchor.x, bz.anchor.y, bz.left.x, bz.left.y); // left handle\n line(bz.anchor.x, bz.anchor.y, bz.right.x, bz.right.y); // right handle\n}\nendShape(CLOSE);"
8797+
},
8798+
{
8799+
"description": "Separated Paths of Beziers",
8800+
"code": "noFill();\ntextSize(400);\nvar myText = text('B', 0, 0, width, height);\nvar myOutlines = createOutlines(myText);\nvar pts = pathToPoints(myOutlines); // add 3 for more detail\n\nfor (var j = 0; j < pts.paths.length; j++) {\n var path = pts.paths[j];\n\n beginShape();\n for (var i = 0; i < path.beziers.length; i++) {\n var bz = path.beziers[i];\n vertex(bz.anchor.x, bz.anchor.y, bz.left.x, bz.left.y, bz.right.x, bz.right.y);\n line(bz.anchor.x, bz.anchor.y, bz.left.x, bz.left.y); // left handle\n line(bz.anchor.x, bz.anchor.y, bz.right.x, bz.right.y); // right handle\n }\n endShape(CLOSE);\n}"
8801+
}
8802+
],
8803+
"todo": null,
8804+
"summary": "Get points and bezier coordinates from path(s).",
8805+
"codetitle": "pathToPoints(obj, [addPoints])"
8806+
}
8807+
],
8808+
"subcat": "null",
8809+
"cat": "Shape"
8810+
},
87428811
{
87438812
"entries": [
87448813
{
@@ -9917,6 +9986,62 @@
99179986
[
99189987
{
99199988
"entries": [
9989+
{
9990+
"name": "createOutlines",
9991+
"description": "Returns an array of polygons after outlining text and optionally processes them with a callback function.\nUse together with `pathToPoints()` for getting point and bezier coordinates from outlines. If used on a text frame,\nall linked text frames will be converted to outlines as well.",
9992+
"returns": {
9993+
"name": null,
9994+
"description": "Returns an array of polygons.",
9995+
"type": [
9996+
"Array"
9997+
]
9998+
},
9999+
"category": "Typography",
10000+
"subcategory": null,
10001+
"parameters": [
10002+
{
10003+
"name": "item",
10004+
"description": "Text or TextPath to be outlined.",
10005+
"optional": false,
10006+
"type": [
10007+
"TextFrame",
10008+
"TextPath"
10009+
]
10010+
},
10011+
{
10012+
"name": "cb",
10013+
"description": "Optional: Callback function to use with each polygon. Passed arguments: `obj`, `loopCounter`",
10014+
"optional": true,
10015+
"type": [
10016+
"Function"
10017+
]
10018+
}
10019+
],
10020+
"kind": "function",
10021+
"tags": [
10022+
{
10023+
"title": "summary",
10024+
"description": "Convert text items to outlines."
10025+
},
10026+
{
10027+
"title": "description",
10028+
"description": "Returns an array of polygons after outlining text and optionally processes them with a callback function.\nUse together with `pathToPoints()` for getting point and bezier coordinates from outlines. If used on a text frame,\nall linked text frames will be converted to outlines as well."
10029+
}
10030+
],
10031+
"examples": [
10032+
{
10033+
"description": "Convert text to outlines",
10034+
"code": "textSize(150);\nvar myText = text(\"Hello\", 0, 0, width, height);\nvar outlines = createOutlines(myText);"
10035+
},
10036+
{
10037+
"description": "Run a callback function on each resulting shape",
10038+
"code": "textSize(150);\nvar myText = text(\"Hello \\nWorld\", 0, 0, width, height);\nvar outlines = createOutlines(myText, function(obj){\n var pts = pathToPoints(obj);\n println(pts.length); // check number of points\n});"
10039+
}
10040+
],
10041+
"todo": null,
10042+
"summary": "Convert text items to outlines.",
10043+
"codetitle": "createOutlines(item, [cb])"
10044+
},
992010045
{
992110046
"name": "text",
992210047
"description": "Creates a text frame on the current layer on the current page in the current document. The text frame gets created in the position specified by the `x` and `y` parameters. The default document font will be used unless a font is set with the `textFont()` function. The default document font size will be used unless a font size is set with the `textSize()` function. Change the color of the text with the `fill()` function. The text displays in relation to the `textAlign()` and `textYAlign()` functions. The `w` and `h` parameters define a rectangular area. If a rectangle, an oval, a polygon or a graphic line are used instead of an x position, the given text will be placed in/on this shape.",

0 commit comments

Comments
 (0)