1 Reply Latest reply on Aug 11, 2014 5:12 AM by c.pfaffenbichler

    Change font in string

    Ghoulfool Level 1

      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?