8 Replies Latest reply on Apr 20, 2008 7:34 AM by (Stephen_van_Essen)

    Using fonts


      I have to include ATM fonts. But scripting accepts only open type fonts and true type fonts. How could i include ATM fonts, for example i have to include Helvetica font with medium condensed style, how can this be achieved.

        • 1. Re: Using fonts
          Level 1
          Hi Priya,

          Scripting will accept any font that InDesign can use. What is the problem that you're having?


          • 2. Re: Using fonts
            Level 1
            Hi Ole,

            myFont = app.fonts.item("Arial");
            myDocument.paragraphStyles.add({name:"ABL", justification:Justification.leftAlign, appliedFont:myFont,
            pointSize:8, leading:8.5, horizontalScale:87});

            I have to include Helvetica ATM Fonts of style medium Condensed, how could i modify the above code for this font. We have Helvetica ATM fonts. How it will be possible for me to include that in my script.

            Thanks & Regards,
            Priya. K
            • 3. Re: Using fonts
              Level 1
              Hi all,

              Can any one specify, how to apply a specified font to a style sheet, indesign accepts Opentype fonts and true type fonts, but atm fonts are not accepted, is there any other way to include atm fonts.

              How to set a tab position for a stylesheet.
              It could be grateful if anyone answers it.

              • 4. Re: Using fonts
                Level 1
                Hi Priya,

                InDesign can use Type 1 fonts as well as TrueType and OpenType fonts. (I assume you mean Type 1 when you say "ATM.") You can put the fonts in the Fonts folder inside the InDesign folder, and the fonts should become available to InDesign.

                //An InDesign CS3 JavaScript
                //Creates a paragraph style with a defined tab stop.
                function main(){
                var myDocument = app.documents.add();
                var myParagraphStyle = myDocument.paragraphStyles.add();
                myParagraphStyle.appliedFont = app.fonts.item("Arial");
                var myTabStop = myParagraphStyle.tabStops.add();
                myTabStop.alignment = TabStopAlignment.LEFT_ALIGN;
                myTabStop.leader = ".";
                myTabStop.position = "12pt";
                //Or you could use a properties record:
                //myParagraphStyle.tabStops.add({alignment:TabStopAlignment.LEFT_ALIGN, leader:".", position:"12pt"});

                Please take a look at the InDesign CS3 object model in the ExtendScript Toolkit 2--it makes all of this much easier to understand.


                • 5. Re: Using fonts
                  Level 1
                  Hi Ole,

                  Thanks a lot for your valuable reply. I have in my certain fonts in my fonts Folder, if i include that in my code, for example

                  myParagraphStyle.appliedFont = app.fonts.item("Helvetica");

                  The error comes like Such fonts is not available. But i can access Helvetica fonts manually through Indesign.

                  • 6. Re: Using fonts
                    Level 1
                    Hi Priya,

                    re: "The error comes like Such fonts is not available. But i can access Helvetica fonts manually through Indesign."

                    Right. That means that InDesign thinks that the font is called something different than what you think it is called. The way to find out what InDesign thinks it's called is to debug using the ExtendScript Toolkit or by putting up alert boxes.

                    Select some text. Format it with the font you're interested in. Create a script that looks at the applied font of the selection. Write it to the JavaScript console or display it in an alert, and you'll know what InDesign thinks it is called.

                    You might want to look at the Text chapter of the InDesign CS3 Scripting Guide: JavaScript for more examples.


                    • 7. Re: Using fonts
                      Hi Olav,
                      is there a way to get from the fonts menu name down to the font itself ? I am having the same problem as described above and this makes creating styles with naming the font a real pain.
                      Thanks Stefan
                      • 8. Re: Using fonts
                        Funny, nobody seems to know the answer to this... same problem here:

                        myTextFrame.Parentstory.AppliedFont = "Helvetica"

                        gives a "Requested Font family is not available" exception.

                        When I then go to the indesign document instance, and select Helvetica manually (written exactly the same, btw) and continue running the application, the error doesn't return, and indesign could find and apply the font....

                        very strange and very annoying, anyone here who could shed some light on this?

                        Thanks, Stephen