psd
psd copied to clipboard
text layer's textProperties no parsed corretly
I try to get font style.but it parse result always same(in fact not).
The StyleSheetData like FontSize
, FillColor
,StrokeColor
and other property are same,it seems like no parse yet?

Hello! Could you provide sample PSD file(s) so we can debug this?
Hello! Could you provide sample PSD file(s) so we can debug this?
Thank you for you reply.
Just use this repository example-node/example.psd
can debug this.
the text layer font size not 12px.
and other property like font color property is wrong too.
i am not sure if i get text properties method is wrong. i use layer.textProperties
to get it (if layer's text exist).
layer.textProperties/DocumentResources/StyleSheetSet /StyleSheetData

Hm. The funny thing is that engine data contains precisely such value:
/Font 3
/FontSize 12.0
/FauxBold false
/FauxItalic false
Maybe it's not any standard size, but instead some custom Adobe dimension?
Hm. The funny thing is that engine data contains precisely such value:
/Font 3 /FontSize 12.0 /FauxBold false /FauxItalic false
Maybe it's not any standard size, but instead some custom Adobe dimension?
Sorry, I didn't check the 'Text Layer' attribute due to my negligence,
However, you can change the font size and color of the 'Text Layer'. You will see that the resolution result is always:
FontSize: 12
FillColor: {Type:1,Values:[1,0,0,0]}
StrokeColor: {Type:1,Values:[1,0,0,0]}
For any PSD that I try, the value of FontSize is always 12 when I try to get it from layer.textProperties/DocumentResources/StyleSheetSet/StyleSheetData
Looking at more sample files, looks like indeed the path you are mentioning has always the same FontSize
.
But the FontSize
in .EngineDict.StyleRun.RunArray | map(.StyleSheet.StyleSheetData.FontSize)
seems to change - could you test if one of these properties changes according to what you expect?
I don't know whether it maps to anything natural in PS UI since I don't have access to it at the moment :)
i tried it.
.EngineDict.StyleRun.RunArray | map(.StyleSheet.StyleSheetData.FontSize)
indeed changed.
when fontsize is 24
, parse result is 100
when fontsize is 30
, parse result is 125
when fontsize is 60
, parse result is 250
The analytical result seems to be 4.166666666666667 times the actual value.This confused me. And I need other attributes of text layer like color
,weight
,textDecoration
.But the current parsing results are not or incorrect
@overQ-N If you were to have a look at .resolutionInfo.horizontal
and .vertical
if it was 300
then if you were to divide this by the default resolution in Photoshop 72 pixels per inch
300/72 = 4.166666666666667
For anyone else that might stumble across this, I was able to solve my issue with additionalLayerProperties
['TySh'] "Type tool object setting" that holds transformXX
and transformYY
so I was able to get the correct font size with
TransformedFontSize = FontSize * ((transformXX + transformYY) / 2)
e.g. 91.79625 * ((0.6806239408469619 + 0.6806239678925272) / 2) = 62.48729
62px is what I see in photoshop 👍