Search code examples
frama-c

How to increase Frama-C's GUI font/text size?


When running frama-c-gui, I'd like to increase its font size (for a tutorial, class, demo, video, etc), to ensure the text is visible in a large room. How can I do it?


Solution

  • The exact answer may depend on system settings, but overall, these should work:

    • If your Frama-C GUI has been compiled with GTK 2 (i.e. you have the opam package lablgtk installed but not lablgtk3):

      • If you are using Frama-C <= 25 (Manganese):

        There is a frama-c.rc file in the share directory of the Frama-C installation (frama-c -print-share-path). You can modify the lines with font_name by adding the desired size after the font name, e.g.:

        font_name = "DejaVu Sans" -> font_name = "DejaVu Sans 18"

        Then re-run the GUI.

      • If you are using Frama-C >= 26 (Iron):

        • The frama-c.rc file is not installed, so you have to manually write it. A simple way to do so is to open file $(frama-c -print-share-path)/frama-c.rc in your favorite text editor and then write the following:

          style "large"
          {
             font_name = "18"
          }
          widget "*" style "large"
          

        Save and reload the GUI.

      If none of the above work for GTK 2, in some systems it is possible to simply add/modify file ~/.gtkrc-2.0, with a line such as:

      gtk-font-name="Noto Sans, 18"
      

      This will however apply to all GTK 2 applications. However, this has stopped working in some recent systems.

    • If you are using GTK 3 (e.g. you had the opam package lablgtk3 installed):

      Use GTK's high DPI settings, such as:

      GDK_DPI_SCALE=1.33 frama-c-gui <options>
      

      Adjust the scale factor as you wish.

      Note: this also works with Ivette (the new Frama-C GUI), so GDK_GPI_SCALE=1.33 ivette <options> also works. Except on macOS, on Sway, and some other graphical environments...