- When setting fonts for app.findTextPreferences.appliedFont or app.changeTextPreferences.appliedFont if you set that to a non-existent font in CS3 it would fail (the value would not get set and there would be an error). In CS4 it succeeds silently, well sorta. The value will get set, but since the font doesn't exist, the find or change event will definitely fail. Which is better? I like the CS3 result.
- In CS3 if you a looking at a link to a file you can use .update() to import the link again. In CS4 you can't do that if the link isn't modified. I like the CS3 behavior because it allowed you to reimport a linked text file that has been modified in Adobe InDesign, but hasn't changed in the file system. Now in CS4 you have to use .place() on the frame.
- Definitely an improvement here. In ExtendScript you can use $.level = 0 to ignore many errors. In CS4 this works. In CS3 it was pretty much ignored. $.level has three values 2, 1, 0. When set to 2 it even stops at errors that are enclosed in try blocks. When set at 1 it ignores those errors. When set to 0 it ignores most errors.
- Another improvement in CS4 app.applyWorkspace(). Wonderful.
2009-10-02
CS3 to CS4 observations
I've been updating a few ExtendScript functions from CS3 to CS4. I've noticed two interesting cases where it could be argued that something is broke, but it is hard to tell.
2009-09-30
Collapse InDesign Text Frame to Descenders
It used to be as I taught Adobe InDesign to QuarkXPress users that I would always get asked why Adobe InDesign collapses the frame to the baseline instead of forcing the frame to the descenders as QuarkXPress does. For whatever reason, I don't get asked the question much anymore, but this function will make Adobe InDesign behave the same as QuarkXPress, and maybe even better.
If you pass this function a reference to a text frame it will automatically collapse it to the position of the final descender. It is great for headlines. However, if you pass it a second argument, a real in points, it will add that number of points to the frame. Great if you still haven't adopted a baseline grid (baseline grids make building pages easy).
I wrote this function for a project nearly a year ago and I know it gets used every day multiple times by the client who uses it. Now anybody that wants it can have it too.
This function could very easily be given an alternate keyboard shortcut to replace the default
control alt c
or
command option c
keyboard shortcuts for Fit Frame to Content.
function holdDescenders ( aTextFrame_o , extraHeight_n ) {
//-------------------------------------------------------------------------
//-- H O L D D E S C E N D E R S
//-------------------------------------------------------------------------
//-- Generic: Yes.
//-------------------------------------------------------------------------
//-- Purpose: To increase the height of the passed frame by the amount
//-- that Adobe InDesign indicates is the height of the largest
//-- descender of the frame.
//-- Assumptions: 2
//-- 1: This function assumes that the frame has already been collapsed
//-- to the baseline of the last line of text as if you had used
//-- its 'Fit Frame to Contents' function. Call this function
//-- _after_ collapseing the frame using your desired method.
//-- 2: The measurement system is assumed to be points.
//-- Warning: There is no error checking for text that is not visible.
//-------------------------------------------------------------------------
//-- Parameters: 2
//-- aTextFrame_o: A single text frame object. The frame whose height
//-- you want to increase the height of by adding the maximum
//-- descender height.
//-- extraHeight_n: a point value. If not supplied, zero is assumed.
//-- Returns: Nothing. The passed object is modified.
//-------------------------------------------------------------------------
//-- Written by Jon S. Winters on 2008.10.29
//-- eps@electronicpublishingsupport.com
//-------------------------------------------------------------------------
//-- Verify argument 2. If it isn't a number, make it zero.
extraHeight_n = parseFloat ( extraHeight_n ) ;
if ( isNaN ( extraHeight_n ) ) { extraHeight_n = 0 } ;
//-- Get the descender value
var descenderHeight = aTextFrame_o.parentStory.characters[-1].descent ;
//-- Increase the frame height
var currentBounds = aTextFrame_o.geometricBounds ;
currentBounds[2] = currentBounds[2] + descenderHeight + extraHeight_n ;
aTextFrame_o.geometricBounds = currentBounds ;
}
Subscribe to:
Posts (Atom)