• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

drop caps using whole word instead of initial cap

Contributor ,
Oct 03, 2018 Oct 03, 2018

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.

Screen Shot 2018-10-04 at 10.42.32 am.png

Views

2.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 03, 2018 Oct 03, 2018

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:

  1. a character style to control the typeface, weight and color, and
  2. a paragraph style to control the drop (how far and initially how many characters).

Add the character style to the drop cap paragraph style and then you'll just have to count characters and override the i

...

Votes

Translate

Translate
Community Expert ,
Oct 03, 2018 Oct 03, 2018

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.

Screen Shot 2018-10-03 at 8.11.50 PM.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 03, 2018 Oct 03, 2018

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 03, 2018 Oct 03, 2018

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:

  1. a character style to control the typeface, weight and color, and
  2. a paragraph style to control the drop (how far and initially how many characters).

Add the character style to the drop cap paragraph style and then you'll just have to count characters and override the initial number.

Screenshot 2018-10-03 19.56.55.png

~Barb

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 03, 2018 Oct 03, 2018

Copy link to clipboard

Copied

Thanks for advice - much appreciated

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 03, 2018 Oct 03, 2018

Copy link to clipboard

Copied

We are always happy to help, gwhPoster.

~Barb

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 04, 2018 Oct 04, 2018

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 04, 2018 Oct 04, 2018

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

Screen Shot 1.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 23, 2021 Feb 23, 2021

Copy link to clipboard

Copied

Please, anyone could translate this apple script to indesign java script.
It would great!
thanks
Sami

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 23, 2021 Feb 23, 2021

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
    }  
}  

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 23, 2021 Feb 23, 2021

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 23, 2021 Feb 23, 2021

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:

 

Screen Shot.png

 

Screen Shot 1.png

 

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 coping

 nbsp; my compiled version out of ESTK, try coping

nbsp; my compiled version out of ESTK, try coping

https://shared-assets.adobe.com/link/572d71d6-217f-4a31-495c-e95706dca5b8ons<u+2069> ▸ <u+2068>Adobe...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 23, 2021 Feb 23, 2021

Copy 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
        } 
    }  
}  

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 23, 2021 Feb 23, 2021

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

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 24, 2021 Feb 24, 2021

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:

Screen Shot 8.png

 

 

 

//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
        } 
    }  
}  

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 24, 2021 Feb 24, 2021

Copy link to clipboard

Copied

Thank You very much Rob!
It worked!

The only issue is, There can be no line wmpty.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 24, 2021 Feb 24, 2021

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
        } 
    }  
}  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 24, 2021 Feb 24, 2021

Copy link to clipboard

Copied

Rob, now it's working perfectly!
Thanks a lot!
Sami

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 05, 2022 Jan 05, 2022

Copy link to clipboard

Copied

LATEST

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines