# Failed to get the font size of the text layer correctly

**URL:** <https://forums.creativeclouddeveloper.com/t/failed-to-get-the-font-size-of-the-text-layer-correctly/2617>\
**Category:** Photoshop\
**Created:** [March 4, 2021, 6:29pm UTC](https://forums.creativeclouddeveloper.com/t/failed-to-get-the-font-size-of-the-text-layer-correctly/2617 "2021-03-04T18:29:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrL](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@MrL](https://forums.creativeclouddeveloper.com/u/MrL)\
**Post date:** [March 4, 2021, 6:29pm UTC](https://forums.creativeclouddeveloper.com/t/failed-to-get-the-font-size-of-the-text-layer-correctly/2617/1 "2021-03-04T18:29:17Z")

</div>

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](https://us1.discourse-cdn.com/flex015/uploads/xdplugins/original/2X/b/b22199bb3bf42e8487d6bdbd3fa470dd244e2961.jpeg)

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

---

<div class="post-metadata">

**Author:** ![Pierre\_G](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/pierre_g/32/971_2.png) [@Pierre\_G](https://forums.creativeclouddeveloper.com/u/Pierre_G)\
**Post date:** [March 4, 2021, 6:34pm UTC](https://forums.creativeclouddeveloper.com/t/failed-to-get-the-font-size-of-the-text-layer-correctly/2617/2 "2021-03-04T18:34:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MrL](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@MrL](https://forums.creativeclouddeveloper.com/u/MrL)\
**Post date:** [March 4, 2021, 7:00pm UTC](https://forums.creativeclouddeveloper.com/t/failed-to-get-the-font-size-of-the-text-layer-correctly/2617/3 "2021-03-04T19:00:46Z")

</div>

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.

 ![abc](https://us1.discourse-cdn.com/flex015/uploads/xdplugins/original/2X/0/01328e2d17e1e956e3f0d60693ed3c599e33fe51.jpeg)

---

<div class="post-metadata">

**Author:** ![Pierre\_G](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/pierre_g/32/971_2.png) [@Pierre\_G](https://forums.creativeclouddeveloper.com/u/Pierre_G)\
**Post date:** [March 4, 2021, 7:19pm UTC](https://forums.creativeclouddeveloper.com/t/failed-to-get-the-font-size-of-the-text-layer-correctly/2617/4 "2021-03-04T19:19:45Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![MrL](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@MrL](https://forums.creativeclouddeveloper.com/u/MrL)\
**Post date:** [March 4, 2021, 7:28pm UTC](https://forums.creativeclouddeveloper.com/t/failed-to-get-the-font-size-of-the-text-layer-correctly/2617/5 "2021-03-04T19:28:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Pierre\_G](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/pierre_g/32/971_2.png) [@Pierre\_G](https://forums.creativeclouddeveloper.com/u/Pierre_G)\
**Post date:** [March 4, 2021, 7:32pm UTC](https://forums.creativeclouddeveloper.com/t/failed-to-get-the-font-size-of-the-text-layer-correctly/2617/6 "2021-03-04T19:32:26Z")

</div>

You’re most welcome 🙂
