3 Replies Latest reply on Apr 18, 2008 1:47 AM by (james_hendrickx)

    Globally set font size in ScriptUI

      When I started playing around with ScriptUI I was a little puzzled by the font size which was much smaller compared to the dialog object. Yesterday the font suddenly changed to a bigger size, 13 pt, why I don't now.
      To make sure this altering by it self wouldn't happen again I tried to set the font size with:
      win.graphics.font.size = 13
      but it seems to be a read only property.
      Is there some kind of default setting for font size? Can the font size be set globally in a window?

      Thanks
      Gunno I
        • 1. Re: Globally set font size in ScriptUI
          Level 1
          Interesting question on setting the font for a window or container and having it apply to all contained controls. I dunno. Never tried it.

          Meanwhile, for one project I did, I used the following function to set the font on a control by control basis.

          Let us know if you can set the font on a control and have it inherit correctly. My bet is that we can't, but I would be very pleasantly surprised if we can, and it would save a ton of pain in the butt code.

          setFont = function( control, size, style, font) {
          if ( !size ) {
          size = 10;
          }
          if ( !style ) {
          style = "regular";
          }
          if ( !font ) {
          font = "Arial";
          }
          var g = control.graphics;
          g.font = ScriptUI.newFont( font, style, size );
          }

          Regards

          Bob
          • 2. Re: Globally set font size in ScriptUI
            Level 1
            Strange, after a restart the font size is back to normal again, which seems to be 11pt Lucida Grande.
            As long as it works I will be happy with the default font and size, but thanks for the setFont function

            Regards
            Gunno
            • 3. Re: Globally set font size in ScriptUI
              Level 1
              see what happens to the appearance of a dialog depending what target app you have in ESTK: ESTK itself gives a different result than InDesign! There are some other anamolies in the scriptUI/Indesign combo, like not being to able to select the default value of the first textfield you tab into; although that works with ESTK as target...