🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #19604

Re: [VB´] Write Textframe with different fonts

#19604
From: jpeliksza
Date: Mon, 02 Dec 2002 16:49
44 lines
2285 bytes
Hans,
One way to do it would be:

      Set myStory = myFrame.ParentStory Set mySelection = myStory.TextWords.Item(1)
      mySelection.AppliedFont = "Arial"
      Set mySelection = myStory.TextWords.Item(2)
      mySelection.AppliedFont = "Frutiger"
      Set mySelection = myStory.TextWords.Item(3)
      mySelection.AppliedFont = "Univers"





Or, if you have groups of words that need different fonts, you can try this (in this example, the first 2 words get Arial and the last one gets Univers):

      myWords = "Indesign looks" myLastWord = " complex"
      Set myStory = myFrame.ParentStory
      mySentence = myWords & myLastWord
      Set myTextWords = myStory.TextWords
      myFrame.TextContents = myWords
      Set myStory = myFrame.ParentStory
      mywordscounter = myStory.TextWords.Count
      myFrame.TextContents = myLastWord
      Set myStory = myFrame.ParentStory
      mylastwordcounter = myStory.TextWords.Count
      myFrame.TextContents = mySentence
      For mybase = 1 To mywordscounter
      Set mySelection = myStory.TextWords.Item(mybase)
      mySelection.AppliedFont = "Arial"
      Next mybase
      mywordscounter = mywordscounter + 1
      For mybase = 1 To mylastwordcounter
      Set mySelection = myStory.TextWords.Item(mywordscounter)
      mySelection.AppliedFont = "Univers"
      Next mybase





You could also use character styles instead of using AppliedFont. All this assumes you've created a textbox.
HTH,
~j~
Technical Details
Message-ID: <1de6d4e2.1@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-02!sn-xit-06!sn-xit-04!supernews.com!iad-peer.news.verio.net!news.verio.net!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de6d4e2.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,7b3d2bca67002363
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-12-02 09:08:05 PST
From: jpeliksza <jpeliksza@tampatrib.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-02!sn-xit-06!sn-xit-04!supernews.com!iad-peer.news.verio.net!news.verio.net!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: [VB´] Write Textframe with different fonts
Message-ID: <1de6d4e2.1@WebX.la2eafNXanI>
Date: Mon, 2 Dec 2002 08:49:42 -0800
References: <1de6d4e2.-1@WebX.la2eafNXanI>
Lines: 39
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit