🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #19537

Re: Changing text kerning

#19537
From: Olav Kvern
Date: Mon, 16 Dec 2002 21:19
30 lines
1974 bytes
Rich--

I understand the need to search for pairs, I was just making a joke about using the UI vs. using scripting. How about something like this:



tell application "InDesign 2.0.1" 
	--Assumes you have a pair selected. 
	set myText to object reference of item 1 of selection 
	set kerningValue to kerning value of character 1 of myText 
	set theIndex to index of myText 
	set charContents to contents of myText 
	set charFontStyle to font style of myText 
	set CharFontSize to point size of myText 
	set charFont to applied font of myText 
	set find preferences to nothing 
	set change preferences to nothing 
	set myFoundItems to search document 1 for charContents with find attributes {applied font:charFont, point size:CharFontSize, font style:charFontStyle} with case sensitive 
	repeat with myFoundItem in myFoundItems 
		--Apply kerning to the *first* character in each found pair 
		set properties of character 1 of myFoundItem to {kerning value:kerningValue} 
	end repeat 
end tell 
</end tell>

I have to note--most of the time, I find that turning Optical Kerning on obviates the need for this sort of searching. That said, not all fonts work well with the Optical Kerning method.

Thanks,

Ole
Technical Details
Message-ID: <1de70063.3@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newspump.sol.net!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de70063.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,3bc2053af32b20a2
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-12-16 13:37:56 PST
From: "Olav Kvern" <okvern@adobe.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newspump.sol.net!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Changing text kerning
Message-ID: <1de70063.3@WebX.la2eafNXanI>
Date: Mon, 16 Dec 2002 13:19:24 -0800
References: <1de70063.-1@WebX.la2eafNXanI>
Lines: 34
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit