I need a little help..
I want to get the Font size as a value wich is set in Photoshop is that possible?
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;
Text layers can also have a mixture of text font size and more than a single font. Text is very complex.
Is there any way to get this value from here without a text layer?
I do not think there would be any way to retrieve field values in all the different tools option bars. I could be wrong if the text tools is the current selected tool. For I know script cans get at some current brush tools setting of some brush types. Photoshop brushes support is very complex , Photoshop Text tool is very complex as well. Action Manager code would need to be used and the get refence part of action manager code requires a lot of knowledge about the ways Photoshop works. I count on r-bin to help me out in that area.
Why do you need that value if there is no text layer you can most likely set the tool up anyway you want?
// select tool
var r = new ActionReference();
var d = new ActionDescriptor();
r.putEnumerated(charIDToTypeID("capp"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var options = executeActionGet(r);
var object = options.getObjectValue(stringIDToTypeID("currentToolOptions")).getObjectValue(stringIDToTypeID("textToolCharacterOptions")).getObjectValue(stringIDToTypeID("textStyle"));
PSA: this also grabs the incorrect size from a transformed layer
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 I'd like to apply this transform to get the accurate textItem width and height (for paragraph type). Can't really go to the post I made earlier because we broke the page, so I'll put it here.
What I'm seeing is an accurate width, but the height always usually differs by 7-13% regardless of whether there is a transform on the text.