InDesign tip : #28

with a little bit of effort you can turn poor typography into ok typography in your body copy. unfortunately, InDesign doesn’t really allow for great typography — but that’s something we’ll touch on in a moment. this post is about automatic kerning, justification and hyphenation.

the first thing to check when you’re working with a particular font is what result you get with each of the automatic kerning options — metrics and optical. which one of those is best for a particular font depends on how good the type designers were at doing their job.

when you choose metrics you are using the mathematical settings created by the typographer. a well created font will have metrics for all the most common character pairs — specifying, for example, the amount of space that should appear between ‘AB’, which will (at least, should) be different from the amount of space that appears between ‘AV’. these metrics are generally known as kerning tables.

when you choose optical you are asking InDesign to override the typographer’s kerning tables and space the characters more or less visually based on the shapes of the characters.

here are a couple of screen grabs showing the same portion of text using the two different automatic kerning methods :
screen grab of text set with metric automatic kerningscreen grab of text set with metric automatic kerning

as you can see, neither of these methods is perfect. ‘his’ and ‘and’ are undoubtedly better using metrics kerning, but ‘winston’ and ‘musing’ are better when using optical kerning — the metrics don’t come up to scratch. and this for a font called Adobe Garamond Pro — you would think we should expect better from the metrics.

and here’s why InDesign doesn’t allow for great typography and why, in at least this one aspect, Quark shits all over InDesign. with Quark you have the option to correct dodgy metrics by editing the kerning tables. so, with Quark we could get in there and fix that diabolical ‘mu’ combination in the kerning table and then it would be corrected for every instance throughout the entire document. InDesign allows no such finessing — we are stuck with the shitty kern-pairs that come with the font or we take our chances with optical kerning.

so, when working with a new font, always check both automatic kerning methods to see which will give you the least disappointing results.

ok, now on to justification. the default justification settings that come with InDesign are simply insane and lead to this kind of abomination :
screen grab of poorly justified type

this is because the default justification settings look something like this :
screen grab of poor justification settings

those numbers are invariably going to lead to shit results. all the adjustments to a line of text happen between the words — none between the individual characters — and those adjustments range from 133% word spacing (big gaps) down to 80% (words running together).

settings which make just a little more sense look something like this :
screen grab of better justification settings

… and will lead to better results — not perfect, but better :
screen grab of better justified type

right, last we have hyphenation and, again, the defaults are ludicrous :
screen grab of default hyphenation settings
just the fact that automatic hyphenation is turned on by default is silly enough — because InDesign is not that great at deciding where a hyphen should appear within a word. but the rest of those settings will, AGAIN, invariably lead to shit results — like this :
screen grab of text using default hyphenation settings
four hyphens in the first seven lines and the very first word on the page is the second half of a word from the previous page — just atrocious.

most jobs do not require automatic hyphenation — you should add your own (discretionary) hyphens, where appropriate, as you set the text. if you really must use automatic hyphenation (eg. you’re laying out vast tracts of text like a novel) then you should uncheck all those check boxes and adjust the other settings to something more like this :
screen grab of better hyphenation settings

the improvement to the type is simply indisputable :
screen grab of text using better hyphenation settings

but wait, there’s more …
once you come up with a bunch of settings which suit your sensibilities you can make them your very own defaults — just the same as you can change so many of InDesign’s default settings. just make sure you have no documents open then adjust the justification and hyphenation settings through the paragraph panel (under the type menu) :
screen grab of paragraph panel and dropdown menu
those will be your new defaults for every new document from now on.

keep grunting

macgrunt icon

InDesign tip : #27

ok, so, here’s the deal with ruler guides … there’s probably handy stuff you don’t know yet …

let’s start with the basics. you click-drag a guide from a ruler (if your rulers aren’t showing, hit cmnd-r). if you want a horizontal guide, drag from the top ruler. if you want a vertical guide, drag from the left ruler. BUT if you accidentally drag from the wrong ruler, just hold your option key before you let that button go and your guide will change orientation. cool.

if you want your guide to only traverse the page, you drop it on the page. if you want it to extend across a complete spread or across the pasteboard, drop it on the pasteboard. simple.

you can also drag a horizontal and vertical guide at the same time — hold your cmnd key and click-drag from your origin (these guides always traverse the spread/pasteboard) :
screen grab of two guides being dragged from origin

to select a guide, just click on it. to select a bunch of guides, click-drag over them. to lock your guides so they can’t be selected (and moved or deleted) go view > grids & guides > lock guides. to lock individual guides (rather than the whole lot) just select and lock them the same as you would an object — object > lock — or cmnd-L.

and you can lock all the guides on a particular layer by double-clicking the layer in the layers panel and then checking the lock guides box in the layer options window that appears (notice you can show/hide guides on a particular layer here too) :
screen grab of the layer options window

an active (selected) guide is the same colour as the active layer. so, if you’re having difficulty seeing a guide as you drag it because the guide is the same colour as the background, just change the colour of the layer or choose a different layer to drag the guide on to.

the colour of a placed (deselected) guide is determined by your ruler guides settings. find this under your layout menu. setting the colour here only affects the guides you create from here-on-in. already existing guides maintain their original colour. change an existing guide by selecting it and then choosing ruler guides (which you can also access with a right-click once a guide is selected). go crazy.

screen grab of document with multiple guide colours

this is also the place to set the view threshold of a guide — that is, the magnification level below which the guide will no longer be visible (unfortunately this isn’t terribly accurate — eg. in CS6, guides with a view threshold of 100% don’t disappear until 55% — you just have to get over it). if you want the guide to be visible at every magnification level — set the view threshold to 5% (the minimum magnification in InDesign) :
screen grab of the ruler guides window

to quickly hide or show all guides use cmnd-; (also see the difference when you just hit ‘w’ — making sure your text cursor isn’t active at the time, of course — this is called preview mode).

to delete all guides on a spread right-click (or cntrl-click) a ruler and choose that command from the dropdown. this can also be accessed through view > grids & guides (this does not affect locked guides) :
screen grab of ruler contextual menu

but you might prefer to do it entirely from the keyboard — select all non-locked guides with cmnd-opt-g and then just hit delete.

to delete all guides throughout an entire document you need a tiny little script which you’ll find all the way back in InDesign scripting : lesson 01

if you just love precision (and don’t we all) you can use your control panel to place and distribute guides exactly where you want them. this screen grab shows what the control panel might look like with four vertical guides selected :
screen grab of control panel with guides selected

and now for tricky guides …
if you double-click the top ruler you’ll get a vertical guide in that position (left ruler gives you a horizontal guide, of course) — this is a great way to get a bunch of guides on the page quickly, before dragging them into exact position.

but the tricky guides are the ones you get if you use this method with the option key selected. they are partially protected guides. you can’t select them with the cmnd-opt-g method and they won’t be deleted when you choose delete all guides on spread. but these guides can still be selected and moved with your mouse and they can be deleted once they are selected. tricky — and handy.

note that the default view threshold of the tricky guides is the same as the magnification level at which they were placed. to change it, simply select the guides and right-click to access the ruler guides window.

but wait, there’s more …
if you want to place a whole bunch of guides in a regular pattern you can use create guides under the layout menu. this not only lets you create the familiar looking columns but also the less common but still-quite-functional-really rows :
screen grab of the create guides window
screen grab of document with guide grid in place
rock on

and there’s still even more …
if you like to work by placing items on a page and then dragging guides to match the edges or centres of your placed items then you really should play around with the AddGuides scripts (both applescript and javascript) that come with InDesign. select your item/s and double-click the script in the scripts panel (window > automation > scripts OR window > utilities > scripts) and you’ll get a dialog box something like this (the javascript version is a little different) :
screen grab of Add Guides script window
automatically placing as many guides for as many objects as you want :
screen grab of artwork after guides have been placed

and we haven’t even started on guide preferences, snap to guides and smart guides — but you probably already know all about that stuff.

keep grunting

macgrunt icon

InDesign scripting : lesson 03

one more thing needs to be explained about the script from lesson 02 before we move on to gruntier things. here’s the script again, notice the line ‘tell active document’ :

surely it’s obvious, when there’s only one document open, that the document is active. why can’t we just write ‘tell document’? who knows, it’s just the way it is, so you’ll have to get over it.

there’s a bunch of different ways to address InDesign documents, depending on what you’re trying to do. here’s one other way to address the active (frontmost) document :

tell document 1

here’s how you’d bring the second document (the one behind the active document) to the front :

set active document to document 2

that’s pretty handy if you only need to swap the active document once or twice, but as you get more adventurous you’ll be wanting to swap between more than two open documents, or swap backwards and forwards a lot, and it becomes virtually impossible to keep track of which document is active at any given point in your script.

that’s when you need variables. a variable is a ‘container’ to store stuff in so you can keep track of it and access it easily throughout your script. it is basically just a name you assign so that you can refer to your stuff in shorthand. an example might help to explain it better. in the calendars example, the calendar template is named “CodeNo_Calendar Title_C.indd”. here’s the long-winded way to work with that document :

set active document to every document whose name is "CodeNo_Calendar Title_C.indd"
tell active document
  --do some interesting stuff
end tell

but, if early in the script we assign the document to a variable …

set mgTemplate to every document whose name contains "CodeNo"

… we can from then on refer to it in shorthand :

set active document to mgTemplate
tell mgTemplate
  --do some interesting stuff
end tell

you can use anything you like as your variable name, as long as it doesn’t conflict with any of applescript’s recognised terms or commands. scripter’s will often use things like ‘myTemplate’, my_template’ or ‘theTemplate’ — whatever suits your style.

you can easily identify variables in script editor — as they are given a unique colour when the script is compiled:

script editor screen grab

macgrunt icon

InDesign scripting : lesson 02

let’s start with where we left off from lesson 01. this script is telling an application to tell a document to delete all its guides. here’s a screen grab of what it looks like in script editor after the ‘compile’ button has been hit.

but how do we arrive at this finished script? well, this one is pretty obvious, you want to delete the guides so you just say ‘delete guides’. but applescript syntax is not always so simple. sometimes the wording is torturous. one of the lines in the postcards example states :

set locked of every page item of every document to false

well, why not simply …

unlock every page item of every document

why not? because it won’t bloody work, that’s why not.

so, let’s have a look at the ‘delete guides’ script and see where it all came from. you can see immediately that the ‘tell’ command is pretty important. script editor automatically bolds all the core applescript commands. ‘tell’ is one of the fundamental commands of scripting — tell something to do something. now, if we were going to guess at the syntax of a ‘delete guides’ script, we might try this :

tell application "Adobe InDesign CS2"
  delete guides
end tell

looks good, makes sense, but it won’t work. fortunately, scriptable applications come with support documentation in the form of a ‘dictionary’ – to help you construct scripts with correct syntax. in script editor, go to window > library. to open the InDesign dictionary, just double click it in the library list. if your version of InDesign is not in the list, click the ‘+’ button :

unfortunately, like traditional dictionaries, there’s a limit to how useful the dictionary can be to syntax construction. but, there are significant clues once you know how to read it. with traditional language nouns, verbs and adjectives are different types of words with different functions. it’s the same with a scripting language.

ok, a ‘tell’ statement addresses a scriptable object of the kind ‘class’. our first tell statement addresses the scriptable object ‘application’. look up ‘application’ and you’ll see it is listed as kind = class :

each class has associated ‘properties’ and ‘elements’. properties are the aspects of the class that can be addressed (and generally altered), elements are other scriptable objects associated with that class. if you look through the list of properties and elements associated with the class ‘application’ you will not find ‘guides’ – this is why the above example does not work – because the application cannot directly address guides (except, as you’ll notice, through changing guide preferences). but look carefully and you’ll see that class ‘application’ contains the element ‘documents’ (so, we can tell the application to tell the document …). click ‘documents’ and you’ll be taken to its definition :

now, the very observant will see that the class ‘documents’ is contained by the element ‘application’ and contains the element ‘guides’ (so, we can tell the application to tell the document to tell the guides …). click ‘guides’ and you’ll be taken to its definition :

now we’ve come to the end of the line, because ‘guides’ do not contain any other scriptable objects (elements). they merely have properties, most of which can be altered (except the ones with r/o next to them — they are read-only properties).

ok, so we’ve just seen the structure from the top down. but when creating a script, you’d work from the bottom up. if you want to do something with guides (in this case, delete them) you’d search for ‘guides’ or ‘guide’ in the dictionary until you found an entry of kind = class. you would find that guides are contained by class ‘documents’ and, in turn, a document is contained by class ‘application’, which is contained by nothing and is, therefore, the first thing to be addressed. the finished script could just as easily have been :

tell application "Adobe InDesign CS2"
  tell active document
    tell guides
    end tell
  end tell
end tell

but that would be just silly.

now, a test for you … how would you delete guides from a particular layer, rather than the entire document?

macgrunt icon