Skip to main content
Innotex Nico Tanne
Inspiring
October 28, 2019
Question

Read Font size with script

  • October 28, 2019
  • 1 reply
  • 3337 views

Hi,

 

I need a little help..

I want to get the Font size as a value wich is set  in Photoshop is that possible?

This topic has been closed for replies.

1 reply

Chuck Uebele
Community Expert
October 28, 2019

One warning about getting font size: if the layer has been transformed, you will get an incorrect reading of the size.

You can try this:

var tLayer = activeDocument.activeLayer;

alert(tLayer.textItem.font.size);

JJMack
Community Expert
October 28, 2019

Text layers can also have a mixture of text font size and more than a single font. Text is very complex.

 
JJMack
nickcombs
Inspiring
July 19, 2022

 

sTT = stringIDToTypeID, tK = sTT('textKey');
(ref = new ActionReference()).putProperty(sTT('property'), tK)
ref.putEnumerated(sTT('textLayer'),sTT('ordinal'),sTT('targetEnum'))
executeActionGet(ref).getObjectValue(tK).getObjectValue
(sTT('transform')).getDouble(sTT('yy'))	// * size

 


@Kukurykus sorry i didn't see this until recently.

attached (as txt) is my basic test to use this code.

maybe i'm using it wrong, because I'm getting undefined for the transform value expected.