List of usage examples for org.eclipse.jface.resource FontDescriptor copy
public static FontData copy(FontData next)
From source file:org.eclipse.nebula.widgets.suggestbox.SuggestBox.java
License:Open Source License
private FontDescriptor getFontDescriptor() { FontData[] copy = FontDescriptor.copy(getFont().getFontData()); for (FontData fontData : copy) { fontData.height += 2;/*w w w .j a v a 2 s.com*/ } return FontDescriptor.createFrom(copy); }
From source file:org.eclipse.scada.chart.swt.render.TitleRenderer.java
License:Open Source License
private Font createFont(final ResourceManager resourceManager) { final Font defaultFont = resourceManager.getDevice().getSystemFont(); if (defaultFont == null) { return null; }//from ww w. ja v a 2s. c o m final FontData fd[] = FontDescriptor.copy(defaultFont.getFontData()); if (fd == null) { return null; } for (final FontData f : fd) { if (this.fontSize > 0) { f.setHeight(this.fontSize); } } return resourceManager.createFont(FontDescriptor.createFrom(fd)); }
From source file:org.eclipse.scada.vi.ui.draw2d.primitives.TextController.java
License:Open Source License
private Font convertFont(final String fontName, final Integer fontSize, final Boolean bold, final Boolean italic) { if (fontName == null && fontSize == null && bold == null && italic == null) { return null; }/*from w w w .j ava2 s . c o m*/ FontData[] fontData; Font font = this.figure.getFont(); if (font == null) { font = this.canvas.getFont(); } if (font == null) { font = Display.getDefault().getSystemFont(); } fontData = FontDescriptor.copy(font.getFontData()); if (fontName != null) { if (fontSize != null && fontSize > 0) { fontData = FontDescriptor.createFrom(fontName, fontSize, SWT.NORMAL).getFontData(); } else { // we need to get the original font size and change the font only int origFontSize = 0; for (final FontData fd : fontData) { origFontSize = fd.getHeight(); } fontData = FontDescriptor.createFrom(fontName, origFontSize, SWT.NORMAL).getFontData(); } } for (final FontData fd : fontData) { if (fontName != null) { fd.setName(fontName); } if (fontSize != null && fontSize > 0) { fd.setHeight(fontSize); } int style = fd.getStyle(); if (bold != null) { if (bold) { style = style | SWT.BOLD; } else { style = style & ~SWT.BOLD; } } if (italic != null) { if (italic) { style = style | SWT.ITALIC; } else { style = style & ~SWT.ITALIC; } } fd.setStyle(style); } return this.manager.createFont(FontDescriptor.createFrom(fontData)); }
From source file:org.springsource.ide.eclipse.gradle.ui.taskview.TaskLabelProvider.java
License:Open Source License
private Font getTaskNameFont() { if (taskNameFont == null) { FontData[] fontData = FontDescriptor.copy(JFaceResources.getDefaultFontDescriptor().getFontData()); for (int i = 0; i < fontData.length; i++) { fontData[i].setStyle(fontData[i].getStyle() | SWT.BOLD); }/* w w w. j a v a 2 s . c om*/ taskNameFont = FontDescriptor.createFrom(fontData).createFont(PlatformUI.getWorkbench().getDisplay()); } return taskNameFont; }
From source file:org.whole.lang.ui.figures.FigurePrefs.java
License:Open Source License
private static final Font getFont(IPreferenceStore store, String key) { FontRegistry registry = UIUtils.getFontRegistry(); registry.put(key, setStyle(FontDescriptor.copy(PreferenceConverter.getFontDataArray(store, FONT)), getStyle(store, key)));/* w w w. ja v a 2 s . co m*/ return registry.get(key); }