List of usage examples for org.eclipse.jface.resource JFaceResources getDefaultFont
public static Font getDefaultFont()
From source file:org.xmind.ui.internal.views.StyleFigureUtils.java
License:Open Source License
private static String getFontName(HashMap<String, String> existedStyle, IStyle style, IStyle template) { String fontName = getValue(existedStyle, Styles.FontFamily, style, template); String availableFontName = FontUtils.getAAvailableFontNameFor(fontName); fontName = availableFontName != null ? availableFontName : fontName; if (Styles.SYSTEM.equals(fontName)) { fontName = JFaceResources.getDefaultFont().getFontData()[0].getName(); }// w ww . j av a 2 s .c o m return fontName; }
From source file:org.xmind.ui.style.StyleUtils.java
License:Open Source License
public static TextStyleData getTextStyleData(IGraphicalPart part, IStyleSelector ss, TextStyleData defaultData) {/*from w w w . jav a2s. co m*/ Object cache = MindMapUtils.getCache(part, MindMapUI.CACHE_TEXT_STYLE); if (cache instanceof TextStyleData) return (TextStyleData) cache; TextStyleData data; if (defaultData == null) { data = new TextStyleData(); defaultData = data; } else { data = new TextStyleData(defaultData); } String name = getString(part, ss, Styles.FontFamily, defaultData.name); String availableFontName = FontUtils.getAAvailableFontNameFor(name); name = availableFontName != null ? availableFontName : name; if (Styles.SYSTEM.equals(name)) { name = JFaceResources.getDefaultFont().getFontData()[0].getName(); } data.name = name; data.height = getInteger(part, ss, Styles.FontSize, defaultData.height); String weight = getString(part, ss, Styles.FontWeight, null); if (weight != null) { data.bold = weight.contains(Styles.FONT_WEIGHT_BOLD); } String style = getString(part, ss, Styles.FontStyle, null); if (style != null) { data.italic = style.contains(Styles.FONT_STYLE_ITALIC); } RGB c = getRGB(part, ss, Styles.TextColor, null); if (c != null) { data.color = c; } String decoration = getString(part, ss, Styles.TextDecoration, null); if (decoration != null) { data.underline = decoration.contains(Styles.TEXT_DECORATION_UNDERLINE); data.strikeout = decoration.contains(Styles.TEXT_DECORATION_LINE_THROUGH); } int align = getAlignValue(part, ss, Styles.TextAlign); data.align = align; int textCase = getCaseValue(part, ss, Styles.TextCase); data.textCase = textCase; return data; }
From source file:org.xmind.ui.style.StyleUtils.java
License:Open Source License
public static FontData getCompositeFontData(IGraphicalPart part, IStyleSelector ss, FontData defaultFontData) { if (defaultFontData == null) defaultFontData = JFaceResources.getDefaultFont().getFontData()[0]; TextStyleData data = getTextStyleData(part, ss, new TextStyleData(defaultFontData)); return data.createFontData(); }
From source file:org.xmind.ui.style.StyleUtils.java
License:Open Source License
public static Font getCompositeFont(IGraphicalPart part, IStyleSelector ss, Font defaultFont) { if (defaultFont == null) defaultFont = JFaceResources.getDefaultFont(); TextStyleData data = getTextStyleData(part, ss, new TextStyleData(defaultFont.getFontData()[0])); return data.createFont(); }
From source file:org.xmind.ui.style.TextStyleData.java
License:Open Source License
public TextStyleData() { this(JFaceResources.getDefaultFont().getFontData()[0]); }
From source file:org.xwiki.eclipse.ui.editors.Preferences.java
License:Open Source License
private Preferences() { stylesToTextAttributeMap = new HashMap<Style, TextAttribute>(); /* Font headingFont = new Font(Display.getDefault(), JFaceResources.getDefaultFont().getFontData()[0].getName(), 18, SWT.BOLD); *//*from ww w .ja va 2 s . c o m*/ stylesToTextAttributeMap.put(Style.HEADING1, new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW), null, SWT.BOLD)); /* headingFont = new Font(Display.getDefault(), JFaceResources.getDefaultFont().getFontData()[0].getName(), 16, SWT.BOLD); */ stylesToTextAttributeMap.put(Style.HEADING2, new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW), null, SWT.BOLD)); /* headingFont = new Font(Display.getDefault(), JFaceResources.getDefaultFont().getFontData()[0].getName(), 14, SWT.BOLD); */ stylesToTextAttributeMap.put(Style.HEADING3, new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW), null, SWT.BOLD)); stylesToTextAttributeMap.put(Style.HEADING4, new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW), null, SWT.BOLD)); stylesToTextAttributeMap.put(Style.HEADING5, new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW), null, SWT.BOLD)); stylesToTextAttributeMap.put(Style.HEADING6, new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW), null, SWT.BOLD)); stylesToTextAttributeMap.put(Style.BOLD, new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_BLUE), null, SWT.BOLD)); stylesToTextAttributeMap.put(Style.ITALIC, new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GREEN), null, SWT.ITALIC)); TextAttribute attribute = new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GREEN), null, SWT.NONE); stylesToTextAttributeMap.put(Style.UNDERLINE, attribute); stylesToTextAttributeMap.put(Style.STRIKEOUT, attribute); stylesToTextAttributeMap.put(Style.SUPERSCRIPT, attribute); stylesToTextAttributeMap.put(Style.SUBSCRIPT, attribute); attribute = new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_RED), null, SWT.BOLD); stylesToTextAttributeMap.put(Style.LINK, attribute); stylesToTextAttributeMap.put(Style.IMAGE, attribute); stylesToTextAttributeMap.put(Style.DEFINITION_TERM, new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW), null, SWT.NONE)); stylesToTextAttributeMap.put(Style.IDENTIFIER, new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_CYAN), null, SWT.BOLD)); stylesToTextAttributeMap.put(Style.LIST_BULLET, new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_CYAN), null, SWT.BOLD)); attribute = new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_MAGENTA), null, SWT.BOLD); stylesToTextAttributeMap.put(Style.MACRO, attribute); Font ttFont = new Font(Display.getDefault(), "Courier", JFaceResources.getDefaultFont().getFontData()[0].getHeight(), SWT.BOLD); stylesToTextAttributeMap.put(Style.TT, new TextAttribute( Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW), null, SWT.BOLD, ttFont)); stylesToTextAttributeMap.put(Style.CODE, new TextAttribute( Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY), null, SWT.BOLD, ttFont)); stylesToTextAttributeMap.put(Style.HTML, new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW), null, SWT.NONE)); attribute = new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_GRAY), null, SWT.NONE); stylesToTextAttributeMap.put(Style.COMMENT, attribute); attribute = new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_BLACK), null, SWT.NONE); stylesToTextAttributeMap.put(Style.DEFAULT, attribute); defaultTextAttribute = new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_BLACK), null, SWT.NONE); }