Adobe 23101335 Scripting Guide - Page 66

Setting text stroke colors, 3.10.3 Setting fonts

Page 66 highlights

Scripting Photoshop 3 Text item object 3.10.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.14, "Color objects" on page 77 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.10.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 7.0 Scripting Guide 66

  • 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

Photoshop 7.0 Scripting Guide
66
Scripting Photoshop
Text item object
3
3.10.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.14, “Color objects” on page 77
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.10.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")