I'm writing a script that builds a font list for an open document. While I could have lookup the fonts for the file as a whole, my goal is to iterate over specific layerSets to build a font list from. The issue I'm facing, is that referencing:
app.fonts[text[n].textItem.font].name
Only pulls the font name of the first character of the textItem. I need to get the names of all the fonts in the textItem, and while I can successfully loop through each of the letters, they do not have the character attributes associated with them.
I tried this: app.fonts[text[n].textItem.contents.font].name
As well as many iterations of a similar idea, and I cannot get it to pull the font name, as it's not an attribute of each character. I apologize if this is a remedial question, but I'm a bit of a novice with javascript in Adobe programs.
For an example of what I'm trying to acheive, I was easily able to do this in illustrator, by using the following statement:
fontName = text.characters[j].characterAttributes.textFont.name;
When placed in a loop, this goes through each font in the text Layer.