4 Replies Latest reply on Jun 29, 2018 2:53 AM by arjun2

    Creating quick font sets

    arjun2 Level 1

      fonts+screens.jpg

       

       

      I want to create fonts preview sets in InDesign as shown in screenshot. I want to apply all the fonts available in a particular family so that It becomes easy for me to copy and paste such styles in an existing document.

       

      Now, I'm doing the regular "drag, select and apply the font" method. Is there a faster way to apply all the font styles available in a family to text lines?

       

       

      P.S. I don't know how to create scripts.

        • 1. Re: Creating quick font sets
          [Jongware] Most Valuable Participant

          Sure there is. You can access the full list of fonts in InDesign through 'app.fonts': https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Application.html#d1e42152

           

          Each single font contains information about its family name (in your case "Akzidenz-Grotesk Std") as well as its styles: https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Font.html

           

          Unfortunately, they are not grouped per family; having the name of one member of a family does not mean you can get a list of all of its styles. So you have to write a custom filter to get a list of all styles of the single family. With that list it's just a matter of applying each font to the current 'cursor position' and then writing out the name of the font.

           

          Draw an empty text frame, select any style of the font you're interested in, then run this script:

           

          target = app.selection[0].parentStory;
          basefont = app.selection[0].appliedFont.fontFamily;
          allfontlist = app.fonts.everyItem().getElements();
          fontlist = [];
          
          for (i=0; i<allfontlist.length; i++)
          {
            if (allfontlist[i].fontFamily == basefont)
            fontlist.push(allfontlist[i]);
          }
          for (i=0; i<fontlist.length; i++)
          {
            target.insertionPoints[-1].appliedFont = fontlist[i];
            target.insertionPoints[-1].contents = fontlist[i].name.replace('\t',' ')+'\r';
          }
          

           

          to get this:

           

          Screen Shot 2017-12-10 at 3.23.49 PM.png

           

          Note that there is no hidden magic that makes it do things that InDesign itself cannot do either. For example, I have separate fonts called "Arial" and "Arial Black" (as the full family name, not as a separate style). InDesign shows them as separate choices and does not see that the Black is a style of plain "Arial"  because there is no information in the font file that tells it is part of the Arial family.

          2 people found this helpful
          • 2. Re: Creating quick font sets
            winterm Level 5

            Any chance it could work for temporarily installed (document-level) fonts, too?

            • 3. Re: Creating quick font sets
              arjun2 Level 1

              https://forums.adobe.com/people/%5BJongware%5D  wrote

               

              Sure there is. You can access the full list of fonts in InDesign through 'app.fonts': https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Application.html#d1e42152

               

              Each single font contains information about its family name (in your case "Akzidenz-Grotesk Std") as well as its styles: https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Font.html

               

              Unfortunately, they are not grouped per family; having the name of one member of a family does not mean you can get a list of all of its styles. So you have to write a custom filter to get a list of all styles of the single family. With that list it's just a matter of applying each font to the current 'cursor position' and then writing out the name of the font.

               

              Draw an empty text frame, select any style of the font you're interested in, then run this script:

               

              target = app.selection[0].parentStory; basefont = app.selection[0].appliedFont.fontFamily; allfontlist = app.fonts.everyItem().getElements(); fontlist = [];  for (i=0; i<allfontlist.length; i++) {   if (allfontlist[i].fontFamily == basefont)   fontlist.push(allfontlist[i]); } for (i=0; i<fontlist.length; i++) {   target.insertionPoints[-1].appliedFont = fontlist[i];   target.insertionPoints[-1].contents = fontlist[i].name.replace('\t',' ')+'\r'; }

               

              to get this:

               

              Screen Shot 2017-12-10 at 3.23.49 PM.png

               

              Note that there is no hidden magic that makes it do things that InDesign itself cannot do either. For example, I have separate fonts called "Arial" and "Arial Black" (as the full family name, not as a separate style). InDesign shows them as separate choices and does not see that the Black is a style of plain "Arial"  because there is no information in the font file that tells it is part of the Arial family.

               

              Wow!! This is so cool! Thank you so much Jongware!!

              • 4. Re: Creating quick font sets
                arjun2 Level 1

                winterm  wrote

                 

                Any chance it could work for temporarily installed (document-level) fonts, too?

                Yes, I also have this question and also is it possible that we select a bunch of fonts in one go, and we can create a preview set for them using a script?