If the font is installed, the sample text will show up in that font. If the font is not installed it will show up in a spindly vector font.
Dialog | DialogInput | Monospaced | SansSerif | Serif |
If the font is installed, the sample text will show up in that font. If the font is not installed it will show up in a spindly vector font.
cursive | fantasy | monospace | sans-serif | serif |
The five Java logical fonts Dialog, DialogInput, Monospaced, SansSerif, Serif are guaranteed available to every Java program. They will be automatically mapped onto the most suitable font available at a given platform. They generally will not work in HTML (Hypertext Markup Language) or CSS. Note how they have slightly different spellings than the equivalent logical fonts in HTML/CSS: Java’s Monospaced vs CSS ’s monospace, SansSerif vs sans-serif and Serif vs serif.
Since every computer supports a different set of fonts, Sun decided to ensure at least these five fonts were supported everywhere: Serif, SansSerif, Monospaced, Dialog and DialogInput. These are not actual fonts, but they map to some actual font either built into the OS (Operating System) or supplied by Sun in TrueType form. The key is these fonts you can count on being present everywhere.
If there were no logical fonts it would be impossible to write a program guaranteed to run everywhere since they are no physical fonts guaranteed to be installed everywhere. By mapping logical fonts to physical fonts, monospaced for example can be mapped onto the most popular monospaced font on a given platform, without Sun having to licence and provide the physical font for every conceivable platform.
Even though your computer may have hundreds of fonts installed, with AWT, you can only get at five of them, five chosen by Sun, (unless you use drawString). Sun chooses the physical fonts from ones it bundles and ones known to be installed with the OS, and then maps the five logical fonts onto five chosen physical ones. Sun chose physical fonts with support for a wide selection of Unicode characters to represent its logical fonts.
Java Logical Fonts In Windows | ||
---|---|---|
Java Logical Font | Corresponding Actual Font | Notes |
Dialog | Lucida Sans or Arial plus extra chars in Vista. | comes with JRE (Java Runtime Environment) |
DialogInput | Courier New | comes with Windows |
Monospaced | Courier New | comes with Windows |
SansSerif | Lucida Sans or Arial plus extra chars in Vista. | comes with JRE |
Serif | Times New Roman | comes with Windows |
In Vista, it would make more sense to map Monospaced ⇒ Consolas and Dialog ⇒ Segoe UI. You could do that now by testing the platform and selecting specific rather than logical fonts when you are running under Vista.
In Java version 1.4 or later and perhaps earlier you also have guaranteed Swing fonts Lucida Bright, Lucida Sans and Lucida Sans Typewriter which are not strictly speaking considered logical fonts, even though Sun makes them universally available by shipping them with the JRE.
Swing components can use the five Java logical fonts and any other scalable (i.e. OpenType, PostScript or TrueType) fonts installed on the system, e.g. Lucida Console or Tiresias PCFont Z.
This page is posted |
http://mindprod.com/jgloss/logicalfonts.html | |
Optional Replicator mirror
|
J:\mindprod\jgloss\logicalfonts.html | |
Please read the feedback from other visitors,
or send your own feedback about the site. Contact Roedy. Please feel free to link to this page without explicit permission. | ||
Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[3.15.4.42] |
| |
Feedback |
You are visitor number | |