Failed to get the font size of the text layer correctly

When I create a text layer in a document, I can get its font size correctly with the code. But when I enlarge the text with the zoom tool, I can’t get the enlarged font size. The returned value is the value before it is changed.

This is my code:

var info=window.require("photoshop").action.batchPlay(

    [{

        "_obj": "get",

        "_target": [{

            "_ref": "layer",

            "_enum": "ordinal",

            "_value": "targetEnum"

        }],

        "_options": {

            "dialogOptions": "dontDisplay"

        }

    }], {

        "synchronousExecution": true,

        "modalBehavior": "execute"

    });

console.log(info[0].textKey.textStyleRange[0].textStyle.size._value);

abc

Who has the code sharing to get the font size correctly?

Your code works fine, it gets the current font size.
However, the Zoom tool and Font size are not connected… unless I’m missing something

You don’t need to use code to scale the font. When you use the scaling tool (Ctrl + T) in PS to enlarge the text, it won’t work properly.

In your case, you do not need textStyle.size
You probably want the value from impliedFontSize

Try this:
info[0].textKey.textStyleRange[0].textStyle.impliedFontSize._value

1 Like

It really works.
Thank you very much for your kind help.

You’re most welcome :slight_smile: