How do I find the font for a specific character in a textItem?

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.

This should get a list of the fonts used in Type Layers in the selected Group.
// get list of fonts used in the active group;
// based on code by paul riggott;
// 2014, use it at your own risk;
#target "photoshop-70.032"
if (app.documents.length > 0) {
var theFonts = main ();
alert ("the fonts used in the folder " + activeDocument.activeLayer.name + " are"+"\n"+theFonts.join("\n"))
function main () {
var theFonts = new Array;
var someLayerStuff = getActiveLayerIIndex();
if (someLayerStuff[1] != "layerSectionStart") {return []};
var aNumber = 0;
// get number of layers;
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var applicationDesc = executeActionGet(ref);
var theNumber = applicationDesc.getInteger(stringIDToTypeID("numberOfLayers"));
// determine the start index;
if (activeDocument.layers[activeDocument.layers.length - 1].isBackgroundLayer == true) {var theStart = someLayerStuff[0] - 2}
else {var theStart = someLayerStuff[0] - 1};
for (var p = theStart; p >= 0; p--) {
try {
var ref = new ActionReference();
ref.putIndex( charIDToTypeID( "Lyr " ), p);
var layerDesc = executeActionGet(ref);
var layerSet = typeIDToStringID(layerDesc.getEnumerationValue(stringIDToTypeID("layerSection")));
var isBackground = layerDesc.getBoolean(stringIDToTypeID("background"));
var theName = layerDesc.getString(stringIDToTypeID('name'));
// check if group closes;
if (layerSet == "layerSectionStart") {aNumber++};
if (layerSet == "layerSectionEnd" && aNumber == 0) {return theFonts};
if (layerSet == "layerSectionEnd" && aNumber != 0) {aNumber--};
// if not layer group collect values;
if (layerSet != "layerSectionEnd" && layerSet != "layerSectionStart" && isBackground != true) {
var hasText = layerDesc.hasKey(stringIDToTypeID("textKey"));
if (hasText == true) {
var textDesc = layerDesc.getObjectValue(stringIDToTypeID('textKey'));
var paragraphStyle = textDesc.getList(stringIDToTypeID('paragraphStyleRange'));
var kernRange = textDesc.getList(stringIDToTypeID('kerningRange'));
var rangeList = textDesc.getList(stringIDToTypeID('textStyleRange'));
for (var o = 0; o < rangeList.count; o++) {
var styleDesc = rangeList.getObjectValue(o).getObjectValue(stringIDToTypeID('textStyle'));
var aFont = styleDesc.getString(stringIDToTypeID('fontPostScriptName'));
// add to array;
var theCheck = true;
for (var n = 0; n < theFonts.length; n++) {
if (theFonts[n] == aFont) {theCheck = false}
if (theCheck  == true) {theFonts.push(aFont)}
catch (e) {};
return theFonts
////// get some stuff from the active layer //////
function getActiveLayerIIndex () {
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var layerDesc = executeActionGet(ref);
var theIndex = layerDesc.getInteger(stringIDToTypeID("itemIndex"));
var theSection = typeIDToStringID(layerDesc.getEnumerationValue(stringIDToTypeID("layerSection")));
var hasText = layerDesc.hasKey(stringIDToTypeID("textKey"));
return [theIndex, theSection, hasText]

Similar Messages

  • How do i find the url for my iMac

    How di I find the URL for my iMac?

    Can you explain in more detail what you mean? A URL is the address of a website - such as Apple.com or Harvard.edu. A computer will only have a URL if it has been set up as a web server and has name servers pointing to it (so that people looking for yourcomputer.com will be sent to the right place).
    Conversely, every computer has an IP address, which is numerical. If you're connected directly to your internet, you will have a public IP address (it might look like 245.46.120.30, for example). Most people connect to the internet through a router, though, which gives them a private IP address only visible within their own network (something like 192.168.1.4).
    Matt

  • How do I find the url for ical

    I had to switch from iphone to droid and now I'm attempting to sync my macbook to my new phone.  How do I find the url for iCal?

    Please see this page:
    http://help.apple.com/icloud/#mm6b1a88ad

  • How do I find the assets for the Pluralist Brochure?

    How do I find the assets for the Pluralist Brochure?

    Hi Rita,
    Is it possible to speak with you?
    I put in the web address you gave to me and it took me to the tutorial: 
    https://helpx.adobe.com/creative-cloud/learn/tutorials/indesign.html?code=eyJhbGciOiJSUzI1 NiIsIng1dSI6Imltc19uYTEta2V5LTEuY2VyIn0.eyJpZCI6IjEzOTQxMTY4MTQ5NTUtMTgzMGQwZDMtNDk4OC00Y2 ZmLWE3ODYtYzZkZTc5NGQ2Y2EwIiwic2NvcGUiOiJvcGVuaWQsY3JlYXRpdmVfY2xvdWQscmVhZF9vcmdhbml6YXRp b25zLGFkZGl0aW9uYWxfaW5mby5zY3JlZW5fbmFtZSxhZGRpdGlvbmFsX2luZm8uc2Vjb25kYXJ5X2VtYWlsIiwic3 RhdGUiOm51bGwsImFzIjoiaW1zLW5hMSIsImNyZWF0ZWRfYXQiOiIxMzk0MTE2ODE0OTU1IiwiZXhwaXJlc19pbiI6 IjE4MDAwMDAiLCJ1c2VyX2lkIjoiQTBFNDc2QTg1MzA3RTlDMTBBNDkwRDQ0QEFkb2JlSUQiLCJjbGllbnRfaWQiOi JDcmVhdGl2ZUNsb3VkVGVzdDMiLCJ0eXBlIjoiYXV0aG9yaXphdGlvbl9jb2RlIn0.StAmeYFnZ2Bl81D_E9GdQaKw jS9irovZVi2TgXvKvyYFFydbK_moes9zwu8eNCcyzVEW4LKVM4pky15WrQlT3TpBsLj-wubTBFHfrbTy5ShKwVrCW7 ON09EHAgn_5UKmT1mvKDtzPJFN1rVw4ZEWzAbH7IW52Kpt-Mcdzuf1v38N5GHxWfRxtGFob0vcsO_i155mtYRgdRd3 IyGJf5m9ObNztwE6w1phzddkK8itwIr2WhNAPRnHPwHIp10bgIBT14cnN0D8lfXvLfe1C8RV3OoX4b4KeuN7sytv_K lmY97pWrlwNGGJGeKCY7OF0lGV2MEdz1WezTGQYjrm1QjS2Q
    and I do not see a large hero image that you were referring to.
    Thanks Joe (Yogi1948)

  • How do i find the link for my adobe revel photo gallery

    How do i find the link for my adobe reveal gallery?

    Have you tried to sign in with your Adobe ID at https://www.adoberevel.com/ ?
    If you need more help, please ask in the Revel forum.

  • How do I find the SSd for my MacBookair 2012 13"

    How do I find the SSD for my MacBook Air 2012 13"?

    If your somewhat obscure question is asking for larger alternative storage, look here:
    eshop.macsales.com/shop/SSD/OWC/Air-Retina/Apple-MacBook-Air-2012-Drive-Internal -Flash
    Otherwise I must agree with Csound1'
    Ciao.

  • How do i find the registration for quicktime pro ?

    how do i find the registration for quicktime pro ?

    It should be under the Quicktime Player 7 menu, right under 'preferences'.

  • How do I find the key for my time capsule router

    How do I find the key for my time capsule router

    Hello, see if these are of any help...
    http://www.iclarified.com/entry/index.php?enid=4547
    http://manuals.info.apple.com/en/TimeCapsule_SetupGuide.pdf
    If it's the Pre-Shared Key you're looking for, open Airport Utility, under the menu item Base Station, look for Equivalent Network Password.

  • How do I find the password for my iMac on version 10.7.4?

    How do I find the password for my iMac on version 10.7.4?

    DO NOT FOLLOW THE INSTRUCTIONS IN THE ABOVE LINKS.
    Boot into Recovery by holding down the key combination command-R at startup. Release the keys when you see a gray screen with a spinning dial.
    When the Mac OS X Utilities screen appears, select Utilities ▹ Terminal from the menu bar.
    In the Terminal window, enter “resetpassword” and press return. A Reset Password window opens.
    Select your boot volume if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Follow the prompts to reset the password. It's safest to choose a password that includes only the characters a-z, A-Z, and 0-9.
    Select  ▹ Restart from the menu bar.
    You should now be able to log in with the new password, but you won't be able to unlock the Keychain. If you've forgotten the Keychain password (which is ordinarily the same as your login password), there's no way to recover it. You’ll need to reset your keychain in the preferences of the Keychain Access application.

  • How do i find the carrier for iphone 4 uk?

    how do i find the carrier for iphone 4 uk?

    Call AppleCare in the UK, they may be able to tell you.

  • How do i find the tablet for taking notes in school

    how do i find the tablet for taking notes in school on macbookpro

    Tablet?  Do you mean like a notepad or notebook?
    TextEdit is included as a part of Mac OS X.  There are plenty of other word processor programs available- Microsoft Word, Apple's Pages, OpenOffice, to name a few

  • How do i find the serial # for my cs5.1 upgrade, my new laptop doesn't have a dvd player.

    how do i find the serial # for my cs5.1 upgrade.  my new laptop doesn't have a dvd player.

    Gmavaughn for information on how to locate your serial number please see Find your serial number quickly - http://helpx.adobe.com/x-productkb/global/find-serial-number.html.
    You can also download a fresh copy of the Creative Suite 5 installation files at http://helpx.adobe.com/creative-suite/kb/cs5-product-downloads.html.

  • How do I find the URL for a document loaded into Buzzword?

    How do I find the URL for a document loaded into Buzzword?

    What kind of document? What is Buzzword?

  • How can i change the font for a theme in iDVD.

    how can i change the font for a theme in iDVD. For example; the text of the rotation theme in the background of the movie. i want to change the font of the rotating text there. How do i do this?

    Have a look at this: http://hints.macworld.com/article.php?story=20080130180258257

  • How can i find the fields for &DOPOS_CPY-WRBT1(I13.0)&

    Hi All,
    In sapscripts, what is the meaning for (13.0)?
    how can i find the fields for &DOPOS_CPY-WRBT1(I13.0)&?
    Thanks.

    meaning for (13.0) is write to form this variable's 13 character non decimal and 0 character decimal places.
    shortly not write decimal places.
    DOPOS_CPY-WRBT1 is exist in form caller program. check in abap program not in sapscript.
    take care
    Çağatay

Maybe you are looking for

  • Office 2013 - Templates contacting MS Server

    Dear Community, I've installed Office 2013 Std. on one of our Windows 7 (32 bit) without Office templates. But when I start Word or Excel, the system is always asking for a username & password. This message popups, because our proxy is blocking the c

  • Internet on my PB does not work

    Hi guys. I have a problem with my powerbook. I just bought a new broadband to my new apartment, and the internet works on my pc with a ethernet cable, and my powerbook work if I have the ethernet cable plugged in. But I want it to be wireless, my pb

  • Can't see pages in Iweb when no monitor connected to mac

    ...Sounds obvious I guess, but basicaly this is my problem. I have a mac mini and I connect to it using logmein via my laptop. It works a treat. However when I open I web i can see all my websites but the pages just display as blank. If i connect a m

  • Reg : Gird Title In REUSE_ALV_GRID_DISPLAY

    Hi Friends, I am working with ALV Grid Display . In that my requirement is i need keep the grid title at 30th column out of 60 colums. So i am providing space infront of grid title like this : '  ALV Grid' but after 75 characters space it is going to

  • Not showing  pop up message window when message type I and W

    Hi, My requirement is to show the popup message window with material number, material description and ABC indicator of material at Every line item of PO in Transaction ME21N , if material is significant. I find Badi to transaction me21n ME_PROCESS_PO