Adobe 23101764 Scripting Guide - Page 84

Setting text stroke colors, Setting fonts

Page 84 highlights

Scripting Photoshop 3 Text item object 3.11.2 Setting text stroke colors Setting the stroke color in AppleScript is a bit different then setting it in Visual Basic or JavaScript. To set the stroke color in AppleScript, use one of the color classes: CMYK color, gray color, HSB color, Lab color, or RGB color. To set it in Visual Basic or JavaScript, you must first create a SolidColor object and appropriately assign one of the color classes to it. The following examples show how to set the stroke color of a text item-object to a CMYK color. See section 3.15, "Color objects" on page 91 for more information on working with colors. AS: set stroke color of textItemRef to {class:CMYK color, cyan:20,¬ magenta:50, yellow:30, black:0} VB: Set newColor = CreateObject ("Photoshop.SolidColor") newColor.CMYK.Cyan = 20 newColor.CMYK.Magenta = 100 newColor.CMYK.Yellow = 30 newColor.CMYK.Black = 0 textLayerRef.TextItem.Color = newColor JS: var newColor = new SolidColor(); newColor.cmyk.cyan = 20; newColor.cmyk.magenta = 100; newColor.cmyk.yellow = 30; newColor.cmyk.black = 0; textLayerRef.color = newColor; 3.11.3 Setting fonts To set the font of your text item object, set the text item's font property. The font names that you can use are the PostScript® names for the fonts. The PostScript names are not the names that are displayed in Photoshop's character palette. The steps below show how to find a PostScript font name. 1. Using the Photoshop user interface, create a new Photoshop document. 2. Create a new text layer and add some text to it. 3. Select the text you created in step 2. 4. Select the desired font from the Font pull down menu (for example, "Arial") Photoshop CS Scripting Guide 80

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105

Photoshop CS Scripting Guide
80
Scripting Photoshop
Text item object
3
3.11.2
Setting text stroke colors
Setting the stroke color in AppleScript is a bit different then setting it in Visual Basic or
JavaScript. To set the stroke color in AppleScript, use one of the color classes: CMYK color,
gray color, HSB color, Lab color, or RGB color.
To set it in Visual Basic or JavaScript, you must
rst create a
SolidColor
object and
appropriately assign one of the color classes to it. The following examples show how to set the
stroke color of a text item-object to a CMYK color.
See section
3.15, “Color objects” on page 91
for more information on working with colors.
AS:
set stroke color of textItemRef to {class:CMYK color, cyan:20,¬
magenta:50, yellow:30, black:0}
VB:
Set newColor = CreateObject ("Photoshop.SolidColor")
newColor.CMYK.Cyan = 20
newColor.CMYK.Magenta = 100
newColor.CMYK.Yellow = 30
newColor.CMYK.Black = 0
textLayerRef.TextItem.Color = newColor
JS:
var newColor = new SolidColor();
newColor.cmyk.cyan = 20;
newColor.cmyk.magenta = 100;
newColor.cmyk.yellow = 30;
newColor.cmyk.black = 0;
textLayerRef.color = newColor;
3.11.3
Setting fonts
To set the font of your text item object, set the text item's
font
property. The font names that
you can use are the PostScript
®
names for the fonts. The PostScript names are not the names
that are displayed in Photoshop's character palette. The steps below show how to
nd a
PostScript font name.
1.
Using the Photoshop user interface, create a new Photoshop document.
2.
Create a new text layer and add some text to it.
3.
Select the text you created in step 2.
4.
Select the desired font from the Font pull down menu (for example, "Arial")