Class CSSSWTFontHelper
java.lang.Object
org.eclipse.e4.ui.css.swt.helpers.CSSSWTFontHelper
CSS SWT Font Helper to :
- get CSS2FontProperties from Font of SWT Control.
- get Font of SWT Control from CSS2FontProperties.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanOn certain platforms, may have two font instances that actually are the samestatic CSS2FontPropertiesgetCSS2FontProperties(Font font) Build CSS2FontProperties from SWT Font.static CSS2FontPropertiesgetCSS2FontProperties(Font font, CSSElementContext context) static CSS2FontPropertiesgetCSS2FontProperties(Widget widget, CSSElementContext context) Get CSS2FontProperties from the widget.static CSS2FontPropertiesgetCSS2FontProperties(Widget widget, Font font, CSSElementContext context) Get CSS2FontProperties from Control stored into Data of Control.static FontDatagetFirstFontData(Font font) Return first FontData from SWT Font.static FontDatagetFirstFontData(Control control) Return first FontData from Control Font.static FontgetFont(CSS2FontProperties fontProperties, FontData oldFontData, Display display) static FontgetFont(CSS2FontProperties fontProperties, Control control) Get CSS2FontProperties from Font of JComponent and store CSS2FontProperties instance into ClientProperty of JComponent.static StringgetFontComposite(Font font) Return CSS Value font-family from SWT Fontstatic StringgetFontComposite(FontData fontData) static StringgetFontComposite(Control control) Return CSS Value font-family from Control Fontstatic FontDatagetFontData(CSS2FontProperties fontProperties, FontData oldFontData) Return FontData fromCSS2FontProperties.static StringgetFontFamily(Font font) Return CSS Value font-family from SWT Fontstatic StringgetFontFamily(FontData fontData) static StringgetFontFamily(Widget widget) Return CSS Value font-family from the widget's font, if it has a fontstatic StringgetFontSize(Font font) Return CSS Value font-size from SWT Fontstatic StringgetFontSize(FontData fontData) static StringgetFontSize(Widget widget) Return CSS Value font-size the widget's font, if it has a fontstatic StringgetFontStyle(Font font) Return CSS Value font-style from SWT Fontstatic StringgetFontStyle(FontData fontData) static StringgetFontStyle(Widget widget) Return CSS Value font-style from the widget's font, if it has a fontstatic StringgetFontWeight(Font font) Return CSS Value font-weight from Control Fontstatic StringgetFontWeight(FontData fontData) static StringgetFontWeight(Widget widget) Return CSS Value font-weight from the widget's font, if it has a fontstatic intgetSWTStyle(CSS2FontProperties fontProperties, FontData fontData) Return SWT style Font fromCSS2FontProperties.static booleanstatic booleanstatic booleanstatic voidrestoreDefaultFont(CTabItem item) static voidrestoreDefaultFont(Control control) static voidHelper function to avoid setting fonts unnecessarilystatic voidHelper function to avoid setting fonts unnecessarilystatic voidstoreDefaultFont(CTabItem item) static voidstoreDefaultFont(Control control)
-
Field Details
-
FONT_DEFINITION_MARKER
- See Also:
-
-
Constructor Details
-
CSSSWTFontHelper
public CSSSWTFontHelper()
-
-
Method Details
-
getCSS2FontProperties
public static CSS2FontProperties getCSS2FontProperties(Widget widget, Font font, CSSElementContext context) Get CSS2FontProperties from Control stored into Data of Control. If CSS2FontProperties doesn't exist, create it from Font of Control and store it into Data of Control. -
getCSS2FontProperties
Get CSS2FontProperties from the widget. If CSS2FontProperties doesn't exist, create it from the widget's font, if it has one, and then store it in the widget's data if applicable.- Parameters:
widget- the widget to retrieve CSS2 font properties from- Returns:
- the font properties of the specified widget, or
nullif none
-
getCSS2FontProperties
-
getCSS2FontProperties
Build CSS2FontProperties from SWT Font. -
getFont
Get CSS2FontProperties from Font of JComponent and store CSS2FontProperties instance into ClientProperty of JComponent. -
getFont
public static Font getFont(CSS2FontProperties fontProperties, FontData oldFontData, Display display) -
getFontData
Return FontData fromCSS2FontProperties. -
hasFontDefinitionAsFamily
-
getSWTStyle
Return SWT style Font fromCSS2FontProperties. -
getFontFamily
Return CSS Value font-family from the widget's font, if it has a font -
getFontFamily
Return CSS Value font-family from SWT Font -
getFontFamily
-
getFontSize
Return CSS Value font-size the widget's font, if it has a font -
getFontSize
Return CSS Value font-size from SWT Font -
getFontSize
-
getFontStyle
Return CSS Value font-style from the widget's font, if it has a font -
getFontStyle
Return CSS Value font-style from SWT Font -
getFontStyle
-
isItalic
-
getFontWeight
Return CSS Value font-weight from the widget's font, if it has a font -
getFontWeight
Return CSS Value font-weight from Control Font -
getFontWeight
-
isBold
-
getFontComposite
Return CSS Value font-family from Control Font -
getFontComposite
Return CSS Value font-family from SWT Font -
getFontComposite
-
getFirstFontData
Return first FontData from Control Font. -
getFirstFontData
Return first FontData from SWT Font. -
storeDefaultFont
-
storeDefaultFont
-
restoreDefaultFont
-
restoreDefaultFont
-
setFont
Helper function to avoid setting fonts unnecessarily -
setFont
Helper function to avoid setting fonts unnecessarily -
equals
On certain platforms, may have two font instances that actually are the same
-