Copy link to clipboard
Copied
Hi everyone,
I'm trying to create a drop cap using either the first word or two words in a paragraph (like in the image below). I wondered if somone could tell me how I could achieve this effect in Indesign?
Would really appreciate any help.
Hi gwhPoster:
Is this a limitation of Indesign?
Yes. You can use a nested style to add a character format to a particular number of words, but they won't be able to drop into the paragraph.
In your situation, I would set up two styles:
Add the character style to the drop cap paragraph style and then you'll just have to count characters and override the i
...Copy link to clipboard
Copied
A drop cap is a paragraph attribute. You apply the settings to a specific number of characters, at the beginning of the paragraph, and it will go down, into the paragraph a specific number of lines. The number of characters will be set according to the paragraph settings.
If you want just the word like in your screen shot "initial" to be a different color, font and size, and NOT dropped into the paragraph, that can be done by setting up a Nested Paragraph Style.
First make a style for your body text called Body with Red first words.
Then make a CHARACTER style to make the word Red, bigger - call it Red Word
Then open up your Paragraph Style (body with red first words) and on the list on the left, choose Drop Cap and Nested Style.
You have to define a Nested Style here, NOT a Drop Cap.
Click New Nested Style Button.
Choose your Character style Red Word from the list
Choose "through"
Choose how many Words (1 or 2 or 3)
Choose what you want the Red Word character style to stop at, if you picked 2 above and Words from the fourth position, this will always apply the red character style to the first 2 words, when this paragraph style is used.
Confusing I know. get more info by looking up a video on using Nested Styles
If you know that you ALWAYS want 1 or 2 characters dropped down 3 lines into your paragraph you can set it up in the top part of the dialog shown here, but the problem is when you want one paragarph to have 2 words, then another to have 4 words and the number of characters is different for each instance.
Copy link to clipboard
Copied
Thanks for the reply. I knew about the nested styles but it wasn't producing the effect I was after. I need for each first word in the paragraph to be larger, a different colour and font and also to drop down two lines. As each of these first words will differ in the number of characters that it continas I don't see how to do this?
Is this a limitation of Indesign?
Copy link to clipboard
Copied
Hi gwhPoster:
Is this a limitation of Indesign?
Yes. You can use a nested style to add a character format to a particular number of words, but they won't be able to drop into the paragraph.
In your situation, I would set up two styles:
Add the character style to the drop cap paragraph style and then you'll just have to count characters and override the initial number.
~Barb
Copy link to clipboard
Copied
Thanks for advice - much appreciated
Copy link to clipboard
Copied
We are always happy to help, gwhPoster.
~Barb
Copy link to clipboard
Copied
One very small thing to add to Barb’s answer:
If you enable “Scale for Descenders”, the “q” won’t descend into the next line.
Copy link to clipboard
Copied
Is this a limitation of Indesign?
You could do it via scripting. Something like this AppleScript (OSX only), which looks for any paragraph with a style named "Drop Style". Just change the name in line 1 to your style name, and the number in line to for the number of words to drop cap.
set dropstylename to "Drop Style"
set wdcnt to 2
tell application "Adobe InDesign CC 2018"
set ps to object reference of every paragraph of every story of active document whose name of applied paragraph style is dropstylename
repeat with x in ps
set cc to ((index of last character of word wdcnt of x) + 1) - (index of first character of word 1 of x)
set drop cap characters of x to cc
set drop cap lines of x to 2
end repeat
end tell
Copy link to clipboard
Copied
Please, anyone could translate this apple script to indesign java script.
It would great!
thanks
Sami
Copy link to clipboard
Copied
Hi Sami, try this:
//The paragraph’s style name you want to dropcap
var dsName = "Drop Style"
//number of words to dropcap
var wcnt = 2
//number of lines for the dropcap height
var lcnt = 2
var ds = app.activeDocument.stories
for(var i=0; i < ds.length; i++){
var s = ds.item(i);
for(var j=0; j < s.paragraphs.length; j++){
var p=s.paragraphs.item(j);
var dc = p.words.itemByRange(p.words[0], p.words[wcnt-1]);
p.dropCapCharacters = Math.round(dc.length)
p.dropCapLines = lcnt
}
}
Copy link to clipboard
Copied
Hi Rob, thank for your help.
I am receiving an error:
Java Script Error!
Error Number: 45
Engine: main
Line: 16
p.dropCapCharacters = Math.round(dc.length)
And I would like to know if is possible also add the space with the first words,
and if it is possible the selection be the paragraph and not the stories.
Thank You.
Sami
Copy link to clipboard
Copied
Hmm, I not getting that error. What version of ID, and are you running it from the Scripts Panel?
It is running on paragraphs—it has to loop thru the stories in order to get at the paragraphs. I did forget to check for the paragraph style name, should be this:
//The paragraph’s style name you want to dropcap
var dsName = "Drop Style"
//number of words to dropcap
var wcnt = 2
//number of lines for the dropcap height
var lcnt = 2
var ds = app.activeDocument.stories
for(var i=0; i < ds.length; i++){
var s = ds.item(i);
for(var j=0; j < s.paragraphs.length; j++){
var p=s.paragraphs.item(j);
if (p.appliedParagraphStyle.name == dsName) {
var dc = p.words.itemByRange(p.words[0], p.words[wcnt-1]);
p.dropCapCharacters = Math.round(dc.length)
p.dropCapLines = lcnt
}
}
}
This is what I get in CC2020:
Here’s my compiled version out of ESTK, try coping it into your Applications<u+2069> ▸ <u+2068>Adobe InDesign 20XX<u+2069> ▸ <u+2068>Scripts<u+2069> ▸ <u+2068>Scripts Panel folder<u+2069>:
ere’s my compiled version out of ESTK, try copingnbsp; my compiled version out of ESTK, try coping
nbsp; my compiled version out of ESTK, try copingCopy link to clipboard
Copied
Also I was having problems with the p.dropCapCharacters = dc.length line and wrapping it in the Math.round() worked for me.
This also works: p.dropCapCharacters = dc.characters.length. So you can try this version:
//The paragraph’s style name you want to dropcap
var dsName = "Drop Style"
//number of words to dropcap
var wcnt = 2
//number of lines for the dropcap height
var lcnt = 2
var ds = app.activeDocument.stories
for(var i=0; i < ds.length; i++){
var s = ds.item(i);
for(var j=0; j < s.paragraphs.length; j++){
var p=s.paragraphs.item(j);
if (p.appliedParagraphStyle.name == dsName) {
var dc = p.words.itemByRange(p.words[0], p.words[wcnt-1]);
p.dropCapCharacters = dc.characters.length
p.dropCapLines = lcnt
}
}
}
Copy link to clipboard
Copied
Hi Rob, It worked better but still with problems.
I forgot to say my text is RTL (hebrew)
The space is still missing and I got the error again.
Thank You for your help
Copy link to clipboard
Copied
I can‘t help with the error—not sure why it is happening on your end.
If I increase the dropcap number by 1 the space after the last word is included. So, I get this with left to right text:
//The paragraph’s style name you want to dropcap
var dsName = "Drop Style"
//number of words to dropcap
var wcnt = 2
//number of lines for the dropcap height
var lcnt = 2
var ds = app.activeDocument.stories
for(var i=0; i < ds.length; i++){
var s = ds.item(i);
for(var j=0; j < s.paragraphs.length; j++){
var p=s.paragraphs.item(j);
if (p.appliedParagraphStyle.name == dsName) {
var dc = p.words.itemByRange(p.words[0], p.words[wcnt-1]);
p.dropCapCharacters = dc.characters.length+1
p.dropCapLines = lcnt
}
}
}
Copy link to clipboard
Copied
Thank You very much Rob!
It worked!
The only issue is, There can be no line wmpty.
Copy link to clipboard
Copied
This checks for a paragraph with fewer words than dropcap word count:
//The paragraph’s style name you want to dropcap
var dsName = "Drop Style"
//number of words to dropcap
var wcnt = 2
//number of lines for the dropcap height
var lcnt = 2
var ds = app.activeDocument.stories
for(var i=0; i < ds.length; i++){
var s = ds.item(i);
for(var j=0; j < s.paragraphs.length; j++){
var p=s.paragraphs.item(j);
if (p.appliedParagraphStyle.name == dsName && p.words.length > wcnt) {
var dc = p.words.itemByRange(p.words[0], p.words[wcnt-1]);
p.dropCapCharacters = dc.characters.length+1
p.dropCapLines = lcnt
}
}
}
Copy link to clipboard
Copied
Rob, now it's working perfectly!
Thanks a lot!
Sami
Copy link to clipboard
Copied
Hi!
Not completely related to the question, but I was wondering what was the best place to learn about Indesign API and it's scripting?
Thanks!