Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

text layer's textProperties no parsed corretly #64

Open
overQ-N opened this issue Oct 26, 2022 · 9 comments
Open

text layer's textProperties no parsed corretly #64

overQ-N opened this issue Oct 26, 2022 · 9 comments

Comments

@overQ-N
Copy link

overQ-N commented Oct 26, 2022

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?

image

@pastelmind
Copy link
Collaborator

Hello! Could you provide sample PSD file(s) so we can debug this?

@overQ-N
Copy link
Author

overQ-N commented Oct 27, 2022

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

image

@scoiatael
Copy link
Collaborator

scoiatael commented Oct 28, 2022

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?

engine_data.txt

@overQ-N
Copy link
Author

overQ-N commented Oct 31, 2022

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?

engine_data.txt

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]}

@BrunoQuaresma
Copy link

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

@scoiatael
Copy link
Collaborator

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 :)

@overQ-N
Copy link
Author

overQ-N commented Nov 18, 2022

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

@jcrisp88
Copy link

@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

@jcrisp88
Copy link

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 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants