2 Replies Latest reply on Sep 12, 2012 12:47 AM by Srikanth.M.V

    How to access Document Installed fonts using jsx.

    Srikanth.M.V

      Hi,

       

      For fonts other than document installed ones, scripting DOM gives Font propeties like "location", using which we can access the fonts location. But for document installed fonts (see here, for definition), scriting DOM throws error- "Requested font family is not available", while accessing many properties like location, fullname, fontstylename etc. I've tried getting the reflection of the "Font" object and printing out all its properties and values. I could see only properties like isValid: true, Index: -1, fontFamily: <name>, name: <fonts name>, status: NOT_AVAILABLE are not throwing exception.

       

      Does anyone know how to access exactly font_family along with its style (bold/italics) and file location?

       

      Please let me know if some thing is unclear.

       

      Script to print all the font's propeties can be something like:

       

       

      function getFontName (font) {

        var fil=new File(Folder.desktop+"/sample.txt");

        fil.open('a');

        var objRef = font.reflect.properties;

        for(var obj in objRef){

             alert(objRef[obj]);

             try{

                  alert(font[objRef[obj]]);

             }catch(e){

                  alert(e.description);continue;

             }

             fil.writeln(objRef[obj]+":"+font[objRef[obj]]);

        }

        fil.close();

      }