Hi All!
I wanted to know how we can get the names of fonts applied in each text layer in a psd file. I tried the following,
int32 numLayers = 0;
// calculate number of text layers.
error = PIUGetInfo(classTextLayer, keyCount, &numLayers, NULL);
for (int i = numLayers - 1; i > 0; --i)
{
char* fontName = new char[100];
int32 len = 100;
// get font name of each layer by index.
error = PIUGetInfoByIndex(i, classTextLayer, keyFontName, fontName, &len);
}
Suppose I have a document that has 2 text layers and 2 solid color layers as shown in the screen shot. Note that this document does not have a background layer. So, number of layers are 4.
If layer selection is at one of the solid color layers, then I get number of layers as 0. But, if the layer selection is at any of the text layers, I get number of layers as 4. Why don't I get the number of layers as 2 as I requested info of text layers in the statement, PIUGetInfo(classTextLayer, keyCount, &numLayers, NULL).
Also, I get error = -25922 at PIUGetInfoByIndex(i, classTextLayer, keyFontName, fontName, &len),
which is errReferenceNotFoundDefine.
How can I go about this?
Thanks!