<p>Is there a way in SWT to get a monospaced font simply, that works across various operating systems?</p>

<p>For example. this works on Linux, but not Windows:</p>

<pre>
<code>
Font mono = new Font(parent.getDisplay(), "Mono", 10, SWT.NONE);
</code>
</pre>

<p>or do I need to have a method that tries loading varying fonts (Consolas, Terminal, Monaco, Mono) until one isn't null? Alternatively I could specify it in a properties file on startup.</p>

<p>I tried getting the system font from Display, but that wasn't monospaced.</p>

According to the section on
Font Configuration Files
in the JDK documentation of
Internationalization Support
-related APIs, the concept of
Logical Font
s is used to define certain platform-independent fonts which are mapped to physical fonts in the default font configuration files:
The Java Platform defines five logical font names that every implementation must support: Serif, SansSerif, Monospaced, Dialog, and DialogInput. These logical font names are mapped to physical fonts in implementation dependent ways.
So in your case, I'd try
```
Font mono = new Font(parent.getDisplay(), "Monospaced", 10, SWT.NONE);
```
to get a handle to the physical monospaced font of the current platform your code is running on.
Edit
: It seems that SWT doesn't know anything about logical fonts (
Bug 48055
on eclipse.org describes this in detail). In this bug report a hackish workaround was suggested, where the name of the physical font may be retrieved from an AWT font...