Java Code Examples for org.eclipse.swt.graphics.Font#getDevice()

The following examples show how to use org.eclipse.swt.graphics.Font#getDevice() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpenTypeSelectionDialog.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Font get() {
	final Font font = getDialogArea().getFont();
	final FontData[] data = font.getFontData();
	for (int i = 0; i < data.length; i++) {
		data[i].setStyle(BOLD);
	}
	return new Font(font.getDevice(), data);
}
 
Example 2
Source File: MechanicPopup.java    From workspacemechanic with Eclipse Public License 1.0 5 votes vote down vote up
private Font createBoldFont(Font font) {
  FontData[] fontDatas = font.getFontData();
  for (FontData fd: fontDatas) {
    fd.setStyle(SWT.BOLD);
  }
  return new Font(font.getDevice(), fontDatas);
}
 
Example 3
Source File: Histogram.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private static Font adjustFont(final Composite composite) {
    // Reduce font size for a more pleasing rendering
    final int fontSizeAdjustment = -2;
    final Font font = composite.getFont();
    final FontData fontData = font.getFontData()[0];
    return new Font(font.getDevice(), fontData.getName(), fontData.getHeight() + fontSizeAdjustment, fontData.getStyle());
}
 
Example 4
Source File: SnippetsCompletionProcessor.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private TextFontStyler()
{
	Font textFont = JFaceResources.getFont(JFaceResources.TEXT_FONT);
	FontData[] textFontData = textFont.getFontData();
	// limit the height of the font
	if (textFontData[0].getHeight() > SnippetsContentAssistant.MAX_HEIGHT)
	{
		maxHeightTextFont = new Font(textFont.getDevice(), textFontData[0].getName(),
				SnippetsContentAssistant.MAX_HEIGHT, textFontData[0].getStyle());
	}
}
 
Example 5
Source File: PixelConverter.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public PixelConverter( Font font )
{
	GC gc = new GC( font.getDevice( ) );
	gc.setFont( font );
	fFontMetrics = gc.getFontMetrics( );
	gc.dispose( );
}
 
Example 6
Source File: PixelConverter.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public PixelConverter(Font font) {
	GC gc = new GC(font.getDevice());
	gc.setFont(font);
	fFontMetrics = gc.getFontMetrics();
	gc.dispose();
}
 
Example 7
Source File: PixelConverter.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public PixelConverter(Font font) {
	GC gc = new GC(font.getDevice());
	gc.setFont(font);
	fFontMetrics= gc.getFontMetrics();
	gc.dispose();
}
 
Example 8
Source File: OrderImportDialog.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
private Font createBoldFont(Font baseFont){
	FontData fd = baseFont.getFontData()[0];
	Font font =
		new Font(baseFont.getDevice(), fd.getName(), fd.getHeight(), fd.getStyle() | SWT.BOLD);
	return font;
}