Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found this long time ago in MathGroup (but now I cannot find the exact link there).</p> <pre><code>fontlist = FE`Evaluate[FEPrivate`GetPopupList["MenuListFonts"]] fontlist /. Rule[x_, y_] -&gt; Style[x, 20, FontFamily -&gt; y] </code></pre> <p><img src="https://i.stack.imgur.com/cppgT.png" alt="Mma Fonts"></p> <p>EDIT: The source is Wolfram's John Fultz. Here is the MathGroup link: <a href="http://forums.wolfram.com/mathgroup/archive/2009/Jan/msg00091.html" rel="nofollow noreferrer">V7 FrontEndTokens</a></p> <p>EDIT 2: On windows, if you don't have a highlighted selection, the default seems to be whereever the cursor moves after the command <code>FrontEndExecute[FrontEndToken["FontPanel"]]</code> is executed. By default it is the next cell. Very first keyboard entry you type after the dialog return is styled with the font selection you make in the font dialog. So, if you execute</p> <pre><code>SelectionMove[InputNotebook[], After, Notebook]; FrontEndExecute[FrontEndToken["FontPanel"]] </code></pre> <p>and start typing your font dialog settings will apply. However, any mouse move before a keyboard entry destroys the font settings. </p> <p>EDIT 3: Using Silvia's idea about using an invisible notebook, but instead writing to a new cell in the current notebook also works. Steps: Move selection to a new cell that is closed, write something, invoke the font panel, capture the font options of the cell, delete the cell, and return the captured font options:</p> <pre><code> fontPanelReturn[] := {SelectionMove[EvaluationNotebook[], After, Notebook]; NotebookWrite[EvaluationNotebook[], Cell["text", ShowCellBracket -&gt; False, CellOpen -&gt; False, Magnification -&gt; 0]]; SelectionMove[EvaluationNotebook[], Before, CellContents]; SelectionMove[EvaluationNotebook[], All, Word]; FrontEndExecute[FrontEndToken["FontPanel"]]; fontops = AbsoluteOptions[ NotebookSelection[EvaluationNotebook[]], {FontColor, FontFamily, FontProperties, FontSize, FontSlant, FontTracking, FontVariations, FontWeight, Background}]; NotebookDelete[EvaluationNotebook[]]; SelectionMove[EvaluationNotebook[], Next, Cell]; fontops} </code></pre> <p>Using as</p> <pre><code> fontPanelReturn[] </code></pre> <p>gives, (for example)</p> <pre><code> {{Background -&gt; None, FontColor -&gt; Automatic, FontFamily -&gt; "Trebuchet MS", FontProperties -&gt; {"FontMonospaced" -&gt; Automatic, "FontSerifed" -&gt; Automatic, "ScreenResolution" -&gt; 72}, FontSize -&gt; 24, FontSlant -&gt; "Italic", FontTracking -&gt; "Plain", FontVariations -&gt; {"CapsType" -&gt; Normal, "CompatibilityType" -&gt; Normal, "Masked" -&gt; False, "Outline" -&gt; False, "RotationAngle" -&gt; 0, "Shadow" -&gt; False, "StrikeThrough" -&gt; False, "Underline" -&gt; False}, FontWeight -&gt; "Bold"}} </code></pre> <p>EDIT 4: You get the same result if you change Silvia's code so that you select the cell before invoking the font panel dialog and then capturing the cell's font options (rather than the notebook's):</p> <pre><code> inputFontSettings[] := Module[{doc, opt}, doc = CreateDocument[TextCell["text"], WindowSelected -&gt; False, Visible -&gt; False]; SelectionMove[doc, Next, Cell]; FrontEndTokenExecute[doc, "FontPanel"]; opt = AbsoluteOptions[ NotebookSelection[doc], {FontColor, FontFamily, FontProperties, FontSize, FontSlant, FontTracking, FontVariations, FontWeight, Background}]; NotebookClose[doc]; opt] </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload