Okay, I’m afraid you’re going to have to tol­er­ate a lit­tle gloat­ing. I’m work­ing on our annual report again — these things always end up being such mas­sive projects for just a few pages of doc­u­ment — and this year I’m doing it as a jour­nal or scrap­book. I’ve got these bor­ders that look like pasted-​​in pages; I’ve got Polaroid frames; I even worked out a way to make images in those Polaroid frames look like actual Polaroid images, com­plete with vari­able color weirdness.

What else I have is all the text entered in a hand­writ­ing type­face called “Journal”. The prob­lem with it is one endemic to all hand­writ­ing type­faces — the base­line is far too reg­u­lar and the strokes too con­sis­tent for it to really look like handwriting.

One way to deal with that would be to hand-​​set the base­line shift and stroke attrib­utes of each char­ac­ter, but I do not have that kind of time. Another way would be to cre­ate a nice OTF set that uses dis­cre­tionary items to cre­ate vari­able text effects; but again, I don’t have the time to do that either.

What I do have, though, is a Mac, and AppleScript. Oh, and quite some expe­ri­ence writ­ing code in a pre­vi­ous life.

That was how I was able to pro­duce the results you see below in a nicely auto­matic fashion.

The script follows.

-- This script changes the baseline offset, stroke width, and color tint
-- of any type set in the "Journal" typeface to randomized values, giving
-- the text a much more organic look and feel.
-- Written by Warren Ockrassa, http://indigestible.nightwares.com/
-- Free to use, modify and distribute, but I'd prefer attribution.
-- Note that this script can take quite a while to execute with larger
-- or more complex files.
set theItem to 0
set theItem to choose file with prompt "Select a CS5 InDesign document to modify..."
if theItem is not equal to 0 then
 tell application "Adobe InDesign CS5"
  open theItem
  tell active document
   -- Determine how many text frames we need to change
   set myFrames to the number of text frames
   if myFrames is not equal to 0 then
    set theFrame to 1
    repeat until theFrame > myFrames
     set myText to text frame theFrame
     set myFont to applied font of character 1 of myText as string
     -- Check to make sure we're only modifying text frames
     -- that have been set in the "Journal" typeface
     if word 1 of myFont is "Journal" then
      repeat with thisCharacter in (characters of myText)
       -- Randomize the values of baseline shift, stroke, and tint
       set baselineShift to ((random number from -5 to 5) / 10)
       set strokeWeight to (((random number 10)) / 100)
       set myTint to (100 - (random number 10))
       set fillColor to fill color of thisCharacter
       set baseline shift of thisCharacter to baselineShift
       set stroke color of thisCharacter to fillColor
       set stroke weight of thisCharacter to strokeWeight
       set fill tint of thisCharacter to myTint
       set stroke tint of thisCharacter to myTint
      end repeat
     end if
     set theFrame to (theFrame + 1)
    end repeat
   end if
  end tell
 end tell
 beep
 display dialog "Modifications finished!" buttons {"Groovy!"} default button 1
else
 display dialog "Operation cancelled" buttons {"OK"} default button 1
end if
Share

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.