Class Index | File Index

Classes


Namespace jamText


Version 4.5.

Defined in: jamText.jsxinc.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Global object (used to simulate a namespace in JavaScript) containing a set of layer text-related functions for scripts written with the JSON Action Manager engine.
Method Summary
Method Attributes Method Name and Description
<static>  
jamText.fromLayerTextObject(layerTextObject)
Get a simplified layer text JSON object from a layer text object in JSON AM Data Format.
<static>  
jamText.getLayerText()
Get the current layer text.
<static>  
jamText.setLayerText(layerText)
Set the current layer text.
<static>  
jamText.toLayerTextObject(layerText)
Get a layer text object in JSON AM Data Format from a simplified layer text JSON object.
Namespace Detail
jamText
Global object (used to simulate a namespace in JavaScript) containing a set of layer text-related functions for scripts written with the JSON Action Manager engine.
Author: Michel MARIANI.
Method Detail
<static> {Object} jamText.fromLayerTextObject(layerTextObject)
Get a simplified layer text JSON object from a layer text object in JSON AM Data Format.
jamEngine.meaningfulIds = true;
jamEngine.parseFriendly = true;
var resultObj = jamEngine.jsonGet
(
    [
        { "property": { "<property>": "textKey" } },
        { "layer": { "<enumerated>": { "ordinal": "targetEnum" } } }
    ]
);
if ("textKey" in resultObj)
{
    var layerTextObj = jamText.fromLayerTextObject (resultObj["textKey"]);
    $.writeln (jamJSON.stringify (layerTextObj, '\t'));
}
Parameters:
{Object|Array} layerTextObject
Layer text object in JSON AM Data Format
Returns:
{Object} Simplified layer text JSON object (cf. Layer Text Object Simplified Format)
See:
jamText.toLayerTextObject

<static> {Object|Null} jamText.getLayerText()
Get the current layer text.
var layerText = jamText.getLayerText ();
if (layerText)
{
    var jsonFile = new File ("~/Desktop/layer-text.json");
    jamUtils.writeJsonFile (jsonFile, layerText, '\t');
    jsonFile.execute ();
}
else
{
    alert ("No text layer selected.");
}
Returns:
{Object|Null} Simplified layer text JSON object made of two members: "textLayer" and "typeUnit"
(cf. Layer Text Object Simplified Format)
or null if not available
See:
jamText.setLayerText

<static> jamText.setLayerText(layerText)
Set the current layer text.
var text = "Bonjour !";
var layerText =
{
    "layerText":
    {
        "textKey": text,
        "textClickPoint": { "horizontal": 50, "vertical": 95 },
        "antiAlias": "antiAliasCrisp",
        "textShape":
        [
            { "textType": "point", "orientation": "horizontal" }
        ],
        "textStyleRange":
        [
            {
                "from": 0,
                "to": text.length,
                "textStyle":
                {
                    "fontPostScriptName": "Myriad-Italic",
                    "size": 288,
                    "color": { "red": 144, "green": 0, "blue": 255 }
                }
            }
        ],
        "paragraphStyleRange":
        [
            {
                "from": 0,
                "to": text.length,
                "paragraphStyle": { "alignment": "center" }
            }
        ]
    },
    "typeUnit": "pixelsUnit"
};
jamText.setLayerText (layerText);
Parameters:
{Object} layerText
Simplified layer text JSON object made of two members: "textLayer" and "typeUnit"
(cf. Layer Text Object Simplified Format)
See:
jamText.getLayerText

<static> {Object|Array} jamText.toLayerTextObject(layerText)
Get a layer text object in JSON AM Data Format from a simplified layer text JSON object.
var text = "Hello, world!";
var layerText =
{
    "layerText":
    {
        "textKey": text,
        "warp":
        {
            "warpStyle": "warpRise",
            "warpValue": 33.3333
        },
        "textClickPoint":
        {
            "horizontal": 50,
            "vertical": 50
        },
        "antiAlias": "antiAliasSmooth",
        "textShape":
        [
            {
                "textType": "point",
                "orientation": "horizontal"
            }
        ],
        "textStyleRange":
        [
            {
                "from": 0,
                "to": text.length,
                "textStyle":
                {
                    "fontPostScriptName": "Minion-Regular",
                    "size": 288,
                    "color": { "red": 63, "green": 255, "blue": 0 }
                }
            }
        ],
        "paragraphStyleRange":
        [
            {
                "from": 0,
                "to": text.length,
                "paragraphStyle":
                {
                    "alignment": "center"
                }
            }
        ]
    },
    "typeUnit": "pixelsUnit"
};
jamEngine.jsonPlay
(
    "make",
    {
        "target": [ "<reference>", [ [ "textLayer", [ "<class>", null ] ] ] ],
        "using": jamText.toLayerTextObject (layerText)
    }
);
Parameters:
{Object} layerText
Simplified layer text JSON object (cf. Layer Text Object Simplified Format)
Returns:
{Object|Array} Layer text object in JSON AM Data Format
See:
jamText.fromLayerTextObject

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Oct 12 2016 23:32:44 GMT+0200 (CEST)