Re: InDesign: determining bold/italic in text runs
Re: InDesign: determining bold/italic in text runs
- Subject: Re: InDesign: determining bold/italic in text runs
- From: Shane Stanley <email@hidden>
- Date: Fri, 06 Apr 2007 18:31:37 +1000
- Thread-topic: InDesign: determining bold/italic in text runs
On 6/4/07 1:15 PM, "Jeff Jungblut" <email@hidden> wrote:
> Does InDesign completely discard bold/italic tags when it imports from a Word
> doc and sets each styled text range to a different font?
Yes. The old bold/italic system pretty much fell apart when larger font
families were developed and the relationships between weights got more
complex.
You can probably cover most cases by looking for "Bold" and maybe "Semi",
plus "Italic" and "Oblique". There are other options that might get missed,
but then there are plenty of combinations that get flagged wrongly using the
bold/italic styling method.
There are several ways of approaching it. One would be something like this:
tell parent story of selection
set theStyles to font style of text style ranges
repeat with i from (count of theStyles) to 1 by -1
set styleName to item i of theStyles
if styleName contains "Bold" or styleName contains "Semi"
then
if styleName contains "Italic" or styleName contains
"Oblique" then
set contents of text style range i to "<b><i>" &
(get contents of text style range i) & "</i></b>"
else
set contents of text style range i to "<b>" & (get
contents of text style range i) & "</b>"
end if
else if styleName contains "Italic" or styleName contains
"Oblique" then
set contents of text style range i to "<i>" & (get
contents of text style range i) & "</i>"
end if
end repeat
end tell
--
Shane Stanley <email@hidden>
AppleScript Pro Denver, June 2007 <http://scriptingmatters.com/aspro>
_______________________________________________
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