Copy link to clipboard
Copied
Hello,
I'm trying to programmatically read meta data from a PSD Text layer about the initial baseline offset for a paragraph [hopefully the right term here] - can someone point me in the right direction ?
I've read through the Photoshop File Formats.pdf and thus far did not see where to find this metadata - the TySh section talks about additional data in the 'Descriptor' - but the data I'm looking for is not jumping out at me.
Visually:
On left, artist designed a template in CS4/5 using font 'CAC Champagne', using a defined paragraph region/bounding box.
Note that the text is nice and top aligned inside the box.
I'm trying to find this vertical shift as shown in the rectangle on the right.
[I noted that ancient versions of photoshop (6/7) don't do this magical up-shift of the font, they render it like the right hand side of the above picture]
This is the same vertical spacing that I'd see when I type the font in ms word:
It appears that the shift is approximate to capheight?
Thank you for any information!
Erik Hoffmann
Copy link to clipboard
Copied
You might find my psd parser useful to show the content of the type tool descriptors in XML form:
http://telegraphics.com.au/svn/psdparse/trunk
It is a command line tool. You can see the XML with:
./psdparse your.psd -e --xmlout
or
./psdparse your.psd -e --xml
to write an XML file.
--Toby
Copy link to clipboard
Copied
Hello Toby!
I actually have been inspecting the PSD using your wonderful utility - I was actually in process of drafting you a mail w/ praise on it! It is an amazing utility - it has helped me learn lots about the format!
Thus far, that particular metadata has not jumped out at me..
Are you aware of any additional documentation on the Descriptor data for text layers? The Photoshop File Formats.psd certainly tells me what the fields are, not necessarily how best to interpret/use
Thank you,
Erik Hoffmann
Copy link to clipboard
Copied
Hi Erik
Thanks for the feedback on psdparse. Great to know it's useful.
Re: interpreting the Text Engine data, I don't know any more than you do! I'm not aware of documentation (beyond the lexical details of PDF, which are thoroughly covered in the excellent PDF spec). But only Cox or Ruark are definitive, either they'll say "it's a black box, don't touch it, we don't tell you how it works for good reasons" or they'll point you to some useful document that I haven't stumbled over yet.
A start may be to see if you can emulate the positioning of either engine with a simple heuristic based on font metrics. That gets you halfway there... but it looks like you have a lot of trial and error ahead.
--Toby
Message was edited by: qu1j0t3
Message was edited by: qu1j0t3
Copy link to clipboard
Copied
Sorry. I don't know of any further information than using the 'keys' or "stringKeys" in PI*Terminology.h to try and decode the parameter names and values inside the Descriptor.
What I usually do is leverage "getter" output by making small changes and comparing the outputs.
I have a long list of things needed in the documentation as Toby has mentioned and never get a chance to update it.
Copy link to clipboard
Copied
Hi Tom
Maybe we can work together on that in some way. [If I can find time] I have been considering making a clearer exposition of what I've learned about PSD and translated into code, much as this person did for Gimp XCF:
http://henning.makholm.net/xcftools/xcfspec.txt