Quaqua 8.0 2011-10-02

ch.randelshofer.quaqua.util
Class Fonts

java.lang.Object
  extended by ch.randelshofer.quaqua.util.Fonts

public class Fonts
extends java.lang.Object

Fonts.

Version:
$Id: Fonts.java 363 2010-11-21 17:41:04Z wrandelshofer $
Author:
Werner Randelshofer, Hausmatt 10, CH-6405 Immensee, Switzerland

Method Summary
static java.lang.String dialogFontTag(java.lang.String text)
          Puts an HTML font tag for the Dialog Font around the specified text.
static java.lang.String emphasizedDialogFontTag(java.lang.String text)
          Puts an HTML font tag for the Emphasized Dialog Font around the specified text.
static java.awt.Font getApplicationFont()
          If your application creates text documents, use the application font as the default for user-created content.
static java.awt.Font getDialogFont()
          The dialog font is used for text in menus, modeless dialogs, and titles of document windows.
static java.awt.Font getEmphasizedDialogFont()
          Use emphasized dialog fonts sparingly.
static java.awt.Font getEmphasizedSmallDialogFont()
          You might use emphasized small dialog font to title a group of settings that appear without a group box, or for brief informative text below a text field.
static java.awt.Font getLabelFont()
          The label font is used for labels with controls such as sliders and icon bevel buttons.
static java.awt.Font getMiniDialogFont()
          If necessary, the mini dialog font can be used for utility window labels and text.
static java.awt.Font getMonospaceFont()
          If your application needs monospaced fonts, use the monospace font.
static int getPerceivedAscent(java.awt.Font f, java.awt.font.FontRenderContext frc, int system)
          Returns the perceived ascent of the specified font, if text is written using the specified script system and font render context.
static java.awt.Rectangle getPerceivedBounds(java.lang.String str, java.awt.Font f, java.awt.Component c)
          Returns the perceived bounds of the specified string, if it is rendered using the specified font on the provided component.
static int getPerceivedDescent(java.awt.Font f, java.awt.font.FontRenderContext frc, int system)
          Returns the perceived descent of the specified font, if text is written using the specified script system and font render context.
static java.awt.Font getSmallDialogFont()
          The small dialog font is used for informative text in alerts.
static int getVisualAscent(java.awt.Font f, java.awt.Component c, char ch)
          Gets the visually perceived ascent of the specified character.
static java.lang.String miniDialogFontTag(java.lang.String text)
          Puts an HTML font tag for the Small Dialog Font around the specified text.
static java.lang.String smallDialogFontTag(java.lang.String text)
          Puts an HTML font tag for the Small Dialog Font around the specified text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDialogFont

public static java.awt.Font getDialogFont()
The dialog font is used for text in menus, modeless dialogs, and titles of document windows.


getEmphasizedDialogFont

public static java.awt.Font getEmphasizedDialogFont()
Use emphasized dialog fonts sparingly. Emphasized (bold) dialog font is used in only two places in the interface: the application name in an About window and the message text in an option pane.


getSmallDialogFont

public static java.awt.Font getSmallDialogFont()
The small dialog font is used for informative text in alerts. It is also the default font for headings in lists, for help tags, and for text in the small versions of many controls. You can also use it to provide additional information about settings in various windows.


getEmphasizedSmallDialogFont

public static java.awt.Font getEmphasizedSmallDialogFont()
You might use emphasized small dialog font to title a group of settings that appear without a group box, or for brief informative text below a text field.


getApplicationFont

public static java.awt.Font getApplicationFont()
If your application creates text documents, use the application font as the default for user-created content.


getMonospaceFont

public static java.awt.Font getMonospaceFont()
If your application needs monospaced fonts, use the monospace font.


getLabelFont

public static java.awt.Font getLabelFont()
The label font is used for labels with controls such as sliders and icon bevel buttons. You should rarely need to use this font in dialogs, but may find it useful in utility windows when space is at a premium.


getMiniDialogFont

public static java.awt.Font getMiniDialogFont()
If necessary, the mini dialog font can be used for utility window labels and text.


dialogFontTag

public static java.lang.String dialogFontTag(java.lang.String text)
Puts an HTML font tag for the Dialog Font around the specified text.


smallDialogFontTag

public static java.lang.String smallDialogFontTag(java.lang.String text)
Puts an HTML font tag for the Small Dialog Font around the specified text.


miniDialogFontTag

public static java.lang.String miniDialogFontTag(java.lang.String text)
Puts an HTML font tag for the Small Dialog Font around the specified text.


emphasizedDialogFontTag

public static java.lang.String emphasizedDialogFontTag(java.lang.String text)
Puts an HTML font tag for the Emphasized Dialog Font around the specified text.


getVisualAscent

public static int getVisualAscent(java.awt.Font f,
                                  java.awt.Component c,
                                  char ch)
Gets the visually perceived ascent of the specified character.


getPerceivedBounds

public static java.awt.Rectangle getPerceivedBounds(java.lang.String str,
                                                    java.awt.Font f,
                                                    java.awt.Component c)
Returns the perceived bounds of the specified string, if it is rendered using the specified font on the provided component.


getPerceivedAscent

public static int getPerceivedAscent(java.awt.Font f,
                                     java.awt.font.FontRenderContext frc,
                                     int system)
Returns the perceived ascent of the specified font, if text is written using the specified script system and font render context.

The perceived ascent is a distance above the baseline, chosen by the font designer and the same for all glyphs in a script system, that often corresponds approximately to the tops of the uppercase letters in a Latin script system. Uppercase letters are chosen because, among the regularly used glyphs in a font, they are generally the tallest.

The value returned by this method differs from the ascent returned by java.awt.font.LineMetrics.getAscent(), in that the perceived ascent does not include diacritical marks of the font. Therefore the perceived ascent is useful for visually north alignig text with graphical elements.


getPerceivedDescent

public static int getPerceivedDescent(java.awt.Font f,
                                      java.awt.font.FontRenderContext frc,
                                      int system)
Returns the perceived descent of the specified font, if text is written using the specified script system and font render context.

The perceived descent is a distance below the baseline that usually corresponds to the bottoms of uppercase letters in a Latin script system, whithout the descenders of lower case characters. In a Latin script system the perceived descent is usually 0. The descent is the same distance from the baseline for all glyphs in the script system.

The value returned by this method differs from the one that would be returned by java.awt.font.LineMetrics.getAscent(), in that the perceived descent does not include the descender of lower case characters and diacritical marks below them. Therefore the perceived descent is useful for visully south aligning text with graphical elements.


Copyright 2003-2007 (c) Werner Randelshofer.
All rights reserved.