Package com.biglybt.ui.swt.utils
Class FontUtils
- java.lang.Object
-
- com.biglybt.ui.swt.utils.FontUtils
-
public class FontUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static org.eclipse.swt.graphics.Font
fontBold
private static org.eclipse.swt.graphics.Font
fontBoldItalic
private static org.eclipse.swt.graphics.Font
fontItalic
private static java.lang.reflect.Method
mFontData_GetHeightF
private static java.lang.reflect.Method
mFontData_SetHeight
private static java.lang.String[]
MONO_FONT_NAMES
-
Constructor Summary
Constructors Constructor Description FontUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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, java.lang.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 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, java.lang.String text)
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 disposed
-
-
-
Field Detail
-
MONO_FONT_NAMES
private static final java.lang.String[] MONO_FONT_NAMES
-
mFontData_SetHeight
private static java.lang.reflect.Method mFontData_SetHeight
-
mFontData_GetHeightF
private static java.lang.reflect.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
-
-
Method Detail
-
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)
-
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, java.lang.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, java.lang.String text)
-
-