Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Plugin and Companion App SDK
Viewing all articles
Browse latest Browse all 54282

How can we get the font names of each text layer in a document?

$
0
0

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.

Forum.JPG

 

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!


Viewing all articles
Browse latest Browse all 54282

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>