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?
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.
Copy link to clipboard
Copied
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