1 Reply Latest reply on Mar 29, 2010 3:17 AM by [Jongware]

    Font Name in a Text Variable

    Malcolm Wooden


      I have a single page sampler for showing a font design. Is it possible to grab the font name and style and put it in a text variable to save me typing the font name in the sample every time I need to print it out?



        • 1. Re: Font Name in a Text Variable
          [Jongware] Most Valuable Participant

          Y... Well ... it depends on what you mean with "grab".


          This fast javascript will


          - Create a new text variable called "Font" in your current document.


          - Put the name of the current default font into that variable (i.e., emphatically not the one "in" your document, but the font selected in your Character formatting panel when nothing is selected).


          As always, these sorts of things are not "live", and changing the default font will not "magically" change the variable. However, if you run the script again, all occurrences of the variable "Font" in your document will (magically ) be adjusted.


          try {
          } catch (_) {}
          try {
           app.activeDocument.textVariables.item("Font").variableOptions.contents = app.activeDocument.textDefaults.appliedFont.fullName;
          } catch (_) {}