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.Fontcache(org.eclipse.swt.graphics.Font f) static voiddispose()private static org.eclipse.swt.graphics.FontensureFontFitsHeight(org.eclipse.swt.graphics.Font font, int pxMaxHeight) static voidfontToWidgetHeight(org.eclipse.swt.widgets.Text text) static voidfontToWidgetHeight(org.eclipse.swt.widgets.Text text, Runnable runOnFontSizeChange) static org.eclipse.swt.graphics.FontgetAnyFontBold(org.eclipse.swt.graphics.GC gc) static org.eclipse.swt.graphics.FontgetAnyFontBoldItalic(org.eclipse.swt.graphics.GC gc) static org.eclipse.swt.graphics.FontgetAnyFontItalic(org.eclipse.swt.graphics.GC gc) static doublegetCharacterWidth(org.eclipse.swt.graphics.Font f) static intgetFontHeightInPX(org.eclipse.swt.graphics.Font font) static intgetFontHeightInPX(org.eclipse.swt.graphics.FontData[] fd) static org.eclipse.swt.graphics.FontgetFontPercentOf(org.eclipse.swt.graphics.Font baseFont, float pct) static org.eclipse.swt.graphics.FontgetFontWithHeight(org.eclipse.swt.graphics.Font baseFont, int heightInPixels, int style) private static org.eclipse.swt.graphics.FontgetFontWithHeight(org.eclipse.swt.graphics.Font baseFont, int heightInPixels, int style, boolean runAgain) static org.eclipse.swt.graphics.FontgetFontWithHeight(org.eclipse.swt.graphics.Font baseFont, org.eclipse.swt.graphics.GC gc, int heightInPixels, int style) Deprecated.static org.eclipse.swt.graphics.FontgetFontWithStyle(org.eclipse.swt.graphics.Font baseFont, int style, float sizeByPct) static floatgetHeight(org.eclipse.swt.graphics.FontData fd) static floatgetHeight(org.eclipse.swt.graphics.FontData[] fd) private static StringgetKey(org.eclipse.swt.graphics.Font f) static org.eclipse.swt.graphics.FontgetMonospaceFont(org.eclipse.swt.graphics.Device device, int heightInPoints) static intgetTextWidth(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.Font font, String text) static voidsetBold(org.eclipse.swt.widgets.Control control) static voidsetFontDataHeight(org.eclipse.swt.graphics.FontData[] fd, float fontSize) static voidsetFontHeight(org.eclipse.swt.widgets.Control control, int height, int style) Change the height of the installedFontand takes care of disposing the new font when the control is disposedstatic voiduncache(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 installedFontand 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)
-