Package com.biglybt.ui.swt.utils
Class FontUtils
java.lang.Object
com.biglybt.ui.swt.utils.FontUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.eclipse.swt.graphics.Font
cache
(org.eclipse.swt.graphics.Font f) static void
dispose()
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 installedFont
and takes care of disposing the new font when the control is disposedstatic void
uncache
(org.eclipse.swt.graphics.Font... fonts)
-
Field Details
-
MONO_FONT_NAMES
-
mFontData_SetHeight
-
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
-
-
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
-
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 installedFont
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)
-