Class FontUtils

java.lang.Object
com.biglybt.ui.swt.utils.FontUtils

public class FontUtils extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static org.eclipse.swt.graphics.Font
     
    private static org.eclipse.swt.graphics.Font
     
    private static Map<String,Object[]>
     
    private static org.eclipse.swt.graphics.Font
     
    private static Method
     
    private static Method
     
    private static final String[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.eclipse.swt.graphics.Font
    cache(org.eclipse.swt.graphics.Font f)
     
    static void
     
    private static org.eclipse.swt.graphics.Font
    ensureFontFitsHeight(org.eclipse.swt.graphics.Font font, int pxMaxHeight)
     
    static void
    fontToWidgetHeight(org.eclipse.swt.widgets.Text text)
     
    static void
    fontToWidgetHeight(org.eclipse.swt.widgets.Text text, Runnable runOnFontSizeChange)
     
    static org.eclipse.swt.graphics.Font
    getAnyFontBold(org.eclipse.swt.graphics.GC gc)
     
    static org.eclipse.swt.graphics.Font
    getAnyFontBoldItalic(org.eclipse.swt.graphics.GC gc)
     
    static org.eclipse.swt.graphics.Font
    getAnyFontItalic(org.eclipse.swt.graphics.GC gc)
     
    static double
    getCharacterWidth(org.eclipse.swt.graphics.Font f)
     
    static int
    getFontHeightInPX(org.eclipse.swt.graphics.Font font)
     
    static int
    getFontHeightInPX(org.eclipse.swt.graphics.FontData[] fd)
     
    static org.eclipse.swt.graphics.Font
    getFontPercentOf(org.eclipse.swt.graphics.Font baseFont, float pct)
     
    static org.eclipse.swt.graphics.Font
    getFontWithHeight(org.eclipse.swt.graphics.Font baseFont, int heightInPixels, int style)
     
    private static org.eclipse.swt.graphics.Font
    getFontWithHeight(org.eclipse.swt.graphics.Font baseFont, int heightInPixels, int style, boolean runAgain)
     
    static org.eclipse.swt.graphics.Font
    getFontWithHeight(org.eclipse.swt.graphics.Font baseFont, org.eclipse.swt.graphics.GC gc, int heightInPixels, int style)
    Deprecated.
    static org.eclipse.swt.graphics.Font
    getFontWithStyle(org.eclipse.swt.graphics.Font baseFont, int style, float sizeByPct)
     
    static float
    getHeight(org.eclipse.swt.graphics.FontData fd)
     
    static float
    getHeight(org.eclipse.swt.graphics.FontData[] fd)
     
    private static String
    getKey(org.eclipse.swt.graphics.Font f)
     
    static org.eclipse.swt.graphics.Font
    getMonospaceFont(org.eclipse.swt.graphics.Device device, int heightInPoints)
     
    static int
    getTextWidth(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.Font font, String text)
     
    static void
    setBold(org.eclipse.swt.widgets.Control control)
     
    static void
    setFontDataHeight(org.eclipse.swt.graphics.FontData[] fd, float fontSize)
     
    static void
    setFontHeight(org.eclipse.swt.widgets.Control control, int height, int style)
    Change the height of the installed Font and takes care of disposing the new font when the control is disposed
    static void
    uncache(org.eclipse.swt.graphics.Font... fonts)
     

    Methods inherited from class java.lang.Object

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

    • MONO_FONT_NAMES

      private static final String[] MONO_FONT_NAMES
    • mFontData_SetHeight

      private static Method mFontData_SetHeight
    • mFontData_GetHeightF

      private static Method mFontData_GetHeightF
    • fontBold

      private static org.eclipse.swt.graphics.Font fontBold
    • fontItalic

      private static org.eclipse.swt.graphics.Font fontItalic
    • fontBoldItalic

      private static org.eclipse.swt.graphics.Font fontBoldItalic
    • fontCache

      private static Map<String,Object[]> fontCache
  • Constructor Details

    • FontUtils

      public FontUtils()
  • Method Details

    • cache

      public static org.eclipse.swt.graphics.Font cache(org.eclipse.swt.graphics.Font f)
    • uncache

      public static void uncache(org.eclipse.swt.graphics.Font... fonts)
    • getKey

      private static String getKey(org.eclipse.swt.graphics.Font f)
    • getFontWithHeight

      public static org.eclipse.swt.graphics.Font getFontWithHeight(org.eclipse.swt.graphics.Font baseFont, int heightInPixels, int style)
    • getFontWithHeight

      private static org.eclipse.swt.graphics.Font getFontWithHeight(org.eclipse.swt.graphics.Font baseFont, int heightInPixels, int style, boolean runAgain)
    • getFontWithHeight

      @Deprecated public static org.eclipse.swt.graphics.Font getFontWithHeight(org.eclipse.swt.graphics.Font baseFont, org.eclipse.swt.graphics.GC gc, int heightInPixels, int style)
      Deprecated.
    • setFontDataHeight

      public static void setFontDataHeight(org.eclipse.swt.graphics.FontData[] fd, float fontSize)
    • getFontHeightInPX

      public static int getFontHeightInPX(org.eclipse.swt.graphics.FontData[] fd)
    • getFontHeightInPX

      public static int getFontHeightInPX(org.eclipse.swt.graphics.Font font)
    • setFontHeight

      public static void setFontHeight(org.eclipse.swt.widgets.Control control, int height, int style)
      Change the height of the installed Font and takes care of disposing the new font when the control is disposed
      Parameters:
      control -
      height -
      style - one or both of SWT.BOLD, SWT.ITALIC, or SWT.NORMAL
    • getHeight

      public static float getHeight(org.eclipse.swt.graphics.FontData[] fd)
    • getHeight

      public static float getHeight(org.eclipse.swt.graphics.FontData fd)
    • getFontWithStyle

      public static org.eclipse.swt.graphics.Font getFontWithStyle(org.eclipse.swt.graphics.Font baseFont, int style, float sizeByPct)
    • getFontPercentOf

      public static org.eclipse.swt.graphics.Font getFontPercentOf(org.eclipse.swt.graphics.Font baseFont, float pct)
    • getAnyFontBold

      public static org.eclipse.swt.graphics.Font getAnyFontBold(org.eclipse.swt.graphics.GC gc)
    • getAnyFontItalic

      public static org.eclipse.swt.graphics.Font getAnyFontItalic(org.eclipse.swt.graphics.GC gc)
    • getAnyFontBoldItalic

      public static org.eclipse.swt.graphics.Font getAnyFontBoldItalic(org.eclipse.swt.graphics.GC gc)
    • dispose

      public static void dispose()
    • fontToWidgetHeight

      public static void fontToWidgetHeight(org.eclipse.swt.widgets.Text text)
    • fontToWidgetHeight

      public static void fontToWidgetHeight(org.eclipse.swt.widgets.Text text, Runnable runOnFontSizeChange)
    • ensureFontFitsHeight

      private static org.eclipse.swt.graphics.Font ensureFontFitsHeight(org.eclipse.swt.graphics.Font font, int pxMaxHeight)
    • getCharacterWidth

      public static double getCharacterWidth(org.eclipse.swt.graphics.Font f)
    • getMonospaceFont

      public static org.eclipse.swt.graphics.Font getMonospaceFont(org.eclipse.swt.graphics.Device device, int heightInPoints)
    • getTextWidth

      public static int getTextWidth(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.Font font, String text)
    • setBold

      public static void setBold(org.eclipse.swt.widgets.Control control)