I’m working on a project that requires calculating the line height for text layers in Photoshop. I noticed that Photoshop only provides a “leading” value for text layers, rather than a specific “line-height” property. The challenge is that each line of text can have different line spacing, making it tricky to determine a consistent line height.
Additionally, I observed that changing the leading value of the first line in a text layer doesn’t seem to affect its position at all, which is confusing.
Could someone explain how line height is calculated in Photoshop given these factors? Is there a way to derive a line height that accounts for varying leading values across multiple lines?
Any insights or suggestions would be greatly appreciated!
From what I see, you’ll have to do some digging into the descriptor for text layers.
{
let desc = [
{
_obj: 'get',
_target: [
{_property: "textKey", _ref: "property"},
{ _ref: 'layer', _enum: 'ordinal', _value: 'targetEnum' },
]
}
];
require('photoshop').action.batchPlay(desc, {})
.then(r => console.log(r[0]))
}
Take a look at the “textStyleRange” entry.
Hello @samgannaway , thank you for your input!!
The code that you have shared is to get the detailed Layer properties, isn’t it?
I checked textStyleRange entries and yes, we get different leading values for each range. But its line height the property that I am looking for.
As you can see in the below screenshots, for same leading and font size values, we are getting 2 different spacing between lines.
We need some methods to accurately calculate line height