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

Get paragraph style details of text layer

Engaged ,
Oct 31, 2013 Oct 31, 2013

Copy link to clipboard

Copied

Hi All,

I am developing an extension for Photoshop CS6 onwards. I want to get the paragraph style and its properties of my text layer. If I apply a new style and try to get the properties, I always get the Basic Paragraph properties and not the properties of the applied style. I am unable to understand this behaviour. Here is the code I am using,

var curLayer = app.activeDocument.activeLayer;

var activeTextItem = curLayer.textItem;

if(activeTextItem.contents != "")

{

    alert(activeTextItem.font);

}

I always get the font details of the Basic Paragraph style.

Am I missing something?

TOPICS
Actions and scripting

Views

702

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
Adobe
Guru ,
Oct 31, 2013 Oct 31, 2013

Copy link to clipboard

Copied

I haven't done much with text styles but I think you need to use Action Manager. As I understand the text style overrides the default text settings and you need Action Manger to get the paragraph style range and settings.

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 ,
Jan 08, 2014 Jan 08, 2014

Copy link to clipboard

Copied

LATEST

Hi All,

I am also getting the trouble in the same situation like this.

Actually I am using Action Manager code to get the text font family, font size etc. applied through paragraph style.

Let me explain my problem,

I have a .psd file with some text applied on it and different paragraph styles are applied on those text. I am trying to get the information of the selected text. I am doing it via Action Manager code. Following is the code:

var paraList = descText.getList(  stringIDToTypeID( "paragraphStyleRange" ) );

var paraDesc = paraList.getObjectValue( 0 );

var paraStyle = paraDesc.getObjectValue( stringIDToTypeID("paragraphStyle") );

var kdefaultStyleStr = stringIDToTypeID("defaultStyle");

if ( paraStyle.hasKey( kdefaultStyleStr ) )

{

     if (defStyle.hasKey( stringIDToTypeID("fontPostScriptName") ) )

          layerFontName = defStyle.getString( stringIDToTypeID("fontPostScriptName") );

     if (defStyle.hasKey( stringIDToTypeID("size") ) )

          textSize = defStyle.getDouble( stringIDToTypeID("size") );

     if (defStyle.hasKey( stringIDToTypeID("tracking") ) )

          tracking = defStyle.getInteger( stringIDToTypeID("tracking") );

}

It is working for some text. But for some text, paraStyle.hasKey( kdefaultStyleStr ) returns 'false' and I dont know why it is.

Is there something I am missing here?

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