MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How the customize the fonts in the menu?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg21738] Re: How the customize the fonts in the menu?
  • From: "P.J. Hinton" <paulh at wolfram.com>
  • Date: Wed, 26 Jan 2000 03:45:38 -0500 (EST)
  • Organization: "Wolfram Research, Inc."
  • Sender: owner-wri-mathgroup at wolfram.com

In article <86e93l$fdd at smc.vnet.net>, I wrote:

> I'm not sure what you mean by "customize," but I suspect that
> the answer is "no."  The Format -> Font menu on the front end
> determines its subcontents based on what fonts are supplied
> by the operating system.  There is no way to add, remove, 
> or rearrange the order of these items, short of uninstalling
> fonts from the operating system (or windowing environment, if
> you run Mathematica on a Unix system).

I would like to post a correction to this information.

A member of the front end development group has informed me that it is
possible to control the contents of the submenu Format -> Font.

The trick is to create a private copy of the text resource file that
governs the contents of menus.  The file is MenuSetup.tr, and it can be
found in the directory with path:

    LinkWrite[
      $ParentLink,
      FrontEnd`ToFileName[
        FrontEnd`FileName[
          {$TopDirectory, "SystemFiles", "FrontEnd",
             "TextResources", $SystemID}
          ]
        ]
      ]; LinkRead[$ParentLink])

Locate this file and copy it to a newly created directory with path:

    LinkWrite[
      $ParentLink,
      FrontEnd`ToFileName[
        FrontEnd`FileName[
          {$PreferencesDirectory, "SystemFiles", "FrontEnd",
             "TextResources", $SystemID}
          ]
        ]
      ]; LinkRead[$ParentLink])

Once the file is copied, open the file in a plain text editor and locate
the lines that read:

        Menu["Font",
        {
            Item["Start Font Listing", "MenuListFonts", MenuAnchor->True]
        }]

You will need to change the Item[] expression to something that befits
your preferences.  Suppose we wanted only to list the Courier font in the
menu, then the new entry for this Menu[] expression would look like:

        Menu["Font",
        {
            Item["Courier",
                FrontEndExecute[{
                    SetOptions[
                        NotebookSelection[InputNotebook[]],
                        FontFamily -> "Courier"
                    ]
                }]
            ]
        }]

You would need to repeat this for each instance of a font that you want
added to the menu.  Note however, if you decide to take this route, the
font list would not update itself if new fonts were added to the operating
system's pool of fonts.

If you are interested in just excluding certain font families, you can do
this from a separate text resource file.  The file is named
MiscStrings.tr, and it resides one level above the directory mentioned
eariler in this posting.

Early on in this file, you will find resource lists that look something
like this:

@@resource fontsNotListedInFontsMenu Windows
{
"Math1",
"Math1Mono",
"Math2",
"Math2Mono",
"Math3",
"Math3Mono",
"Math4",
"Math4Mono",
"Math5",
"Math5Mono"
}

To exclude additional fonts, simply add their family names (e.g.
"Verdana") to the list and restart the front end.  You can place a
modified, private copy of the .tr file in your preferences directory tree,
much in the same way that can be done for MenuSetup.tr.

-- 
P.J. Hinton
Mathematica Programming Group           paulh at wolfram.com
Wolfram Research, Inc.
Disclaimer: Opinions expressed herein are those of the author alone.



  • Prev by Date: Re: Re: Problem with evaluation of delayed rules
  • Next by Date: Simplifying Finite Sums With A Variable # of Terms
  • Previous by thread: Re: How the customize the fonts in the menu?
  • Next by thread: Comparison of Mathematica on Various Computers