Module ij
Package ij.util

Class FontUtil

java.lang.Object
ij.util.FontUtil

public class FontUtil
extends java.lang.Object
This class contains static utility methods for replacing fonts that are not available on the current system.
  • Constructor Summary

    Constructors 
    Constructor Description
    FontUtil()  
  • Method Summary

    Modifier and Type Method Description
    static java.awt.Font getFont​(java.lang.String fontFamilyName, int style, float size)
    Returns a font with the given family name or, if not available, a similar font, e.g.
    static java.lang.String[] getSimilarFontsList​(java.lang.String fontFamily)
    For a few basic font types, gets a list of replacement font families Note that java's 'SansSerif' has wider characters (significantly different metrics) than the other sans-serif fonts in the list; thus it should be considered a fallback option only.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getFont

      public static java.awt.Font getFont​(java.lang.String fontFamilyName, int style, float size)
      Returns a font with the given family name or, if not available, a similar font, e.g. Helvetica replaced by Arial
    • getSimilarFontsList

      public static java.lang.String[] getSimilarFontsList​(java.lang.String fontFamily)
      For a few basic font types, gets a list of replacement font families Note that java's 'SansSerif' has wider characters (significantly different metrics) than the other sans-serif fonts in the list; thus it should be considered a fallback option only. Also note that some fonts (Times, Helvetica, Courier, Monospace, Serif) tend to truncate some diacritical marks when using FontMetrics.getHeight (as ImageJ does), e.g. the ring of the Angstrom symbol Å may be clipped (at least on Java 1.6/Mac)