InDesign: determining bold/italic in text runs
InDesign: determining bold/italic in text runs
- Subject: InDesign: determining bold/italic in text runs
- From: Jeff Jungblut <email@hidden>
- Date: Thu, 05 Apr 2007 20:15:54 -0700
- Thread-topic: InDesign: determining bold/italic in text runs
Title: InDesign: determining bold/italic in text runs
I’ve been using the following code to insert bold/italic codes into Quark text for web site posting.
I understand that InDesign doesn’t support bold/italic as text attributes and instead relies on the font to support bold/italic variations. But is it possible to tell if a range of text has a bold or italic font applied, without having to check the font name and know in advance all the possible derivatives of Bold/Heavy/Demi/Thick/Medium/Oblique/Italic/Tilt/Slant/etc that may be available for the applied font? Does InDesign completely discard bold/italic tags when it imports from a Word doc and sets each styled text range to a different font?
tell document 1 of application "QuarkXPress"
tell story 1 of current box
set style of (last character of every paragraph) to plain
try
copy "<b><i>" to before (text style ranges whose style contains {on styles:{bold, italic}})
copy "</i></b>" to after (text style ranges whose style contains {on styles:{bold, italic}})
end try
try
copy "<b>" to before (text style ranges whose style contains bold)
on error
set boldcodes to false
end try
try
copy "<i>" to before (text style ranges whose style contains italic)
copy "</i>" to after (text style ranges whose style contains italic)
end try
if boldcodes is true then
copy "</b>" to after (text style ranges whose style contains bold)
end if
set theParas to text 1 of every paragraph
set theStyles to name of style sheet of every paragraph
end tell
end tell
--
Jeff Jungblut
email@hidden
Senior Graphic Designer & Web Developer
Uptown Publications
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden