Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

Change font in string

$
0
0

How you you join two strings with different fonts together?

 

var srcDoc = app.activeDocument;
var artLayerRef = srcDoc.artLayers.add()
artLayerRef.kind = LayerKind.TEXT;
textItemRef = artLayerRef.textItem;

textItemRef.size = 18;
textItemRef.color = app.foregroundColor;
textItemRef.font = "ArialMT";
textItemRef.contents = "Hello";
textItemRef.font = "Arial-BoldMT";
textItemRef.contents += " world!";

 

The above script puts the usual Hello world in Arial bold onto a new layer; but I was hoping it would write "Hello world!" (the difference being the second word is in bold). Is it possible to do this, and can anyone show me where I'm going wrong?


Viewing all articles
Browse latest Browse all 12244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>