public void setFont( String fontName, int fontSize, boolean fontBold, boolean fontItalic ) { int swt = SWT.NORMAL; if ( fontBold ) { swt = SWT.BOLD; } if ( fontItalic ) { swt = swt | SWT.ITALIC; } Font font = new Font( PropsUI.getDisplay(), fontName, fontSize, swt ); int index = fonts.indexOf( font ); if ( index < 0 ) { fonts.add( font ); } else { font.dispose(); font = fonts.get( index ); } gc.setFont( font ); }
public void setFont( String fontName, int fontSize, boolean fontBold, boolean fontItalic ) { int swt = SWT.NORMAL; if ( fontBold ) { swt = SWT.BOLD; } if ( fontItalic ) { swt = swt | SWT.ITALIC; } Font font = new Font( PropsUI.getDisplay(), fontName, fontSize, swt ); int index = fonts.indexOf( font ); if ( index < 0 ) { fonts.add( font ); } else { font.dispose(); font = fonts.get( index ); } gc.setFont( font ); }
public void paintControl( PaintEvent pe ) { pe.gc.setFont( fixedFont ); Rectangle max = wFFont.getBounds(); String name = fixedFontData.getName() + " - " + fixedFontData.getHeight(); Point size = pe.gc.textExtent( name ); pe.gc.drawText( name, ( max.width - size.x ) / 2, ( max.height - size.y ) / 2, true ); } } );
public void paintControl( PaintEvent pe ) { pe.gc.setFont( graphFont ); Rectangle max = wGFont.getBounds(); String name = graphFontData.getName() + " - " + graphFontData.getHeight(); Point size = pe.gc.textExtent( name ); pe.gc.drawText( name, ( max.width - size.x ) / 2, ( max.height - size.y ) / 2, true ); } } );
public void paintControl( PaintEvent pe ) { pe.gc.setFont( noteFont ); Rectangle max = wNFont.getBounds(); String name = noteFontData.getName() + " - " + noteFontData.getHeight(); Point size = pe.gc.textExtent( name ); pe.gc.drawText( name, ( max.width - size.x ) / 2, ( max.height - size.y ) / 2, true ); } } );
private void drawVersionWarning( GC gc, Display display ) { gc.setBackground( versionWarningBackgroundColor ); gc.setForeground( new Color( display, 65, 65, 65 ) ); // gc.fillRectangle(290, 231, 367, 49); // gc.drawRectangle(290, 231, 367, 49); gc.drawImage( exclamation_image, 304, 243 ); gc.setFont( devWarningFont ); gc.drawText( BaseMessages.getString( PKG, "SplashDialog.DevelopmentWarning" ), 335, 241, true ); }
public void paintControl( PaintEvent e ) { Point area = getArea(); if ( area.x == 0 || area.y == 0 ) { return; // nothing to do! } Display disp = shell.getDisplay(); Image img = getTransformationImage( disp, area.x, area.y, magnification ); e.gc.drawImage( img, 0, 0 ); if ( transMeta.nrSteps() == 0 ) { e.gc.setForeground( GUIResource.getInstance().getColorCrystalTextPentaho() ); e.gc.setFont( GUIResource.getInstance().getFontMedium() ); Image pentahoImage = GUIResource.getInstance().getImageTransCanvas(); int leftPosition = ( area.x - pentahoImage.getBounds().width ) / 2; int topPosition = ( area.y - pentahoImage.getBounds().height ) / 2; e.gc.drawImage( pentahoImage, leftPosition, topPosition ); } img.dispose(); // spoon.setShellText(); }
public void paintControl( PaintEvent e ) { Point area = getArea(); if ( area.x == 0 || area.y == 0 ) { return; // nothing to do! } Display disp = shell.getDisplay(); Image img = getJobImage( disp, area.x, area.y, magnification ); e.gc.drawImage( img, 0, 0 ); if ( jobMeta.nrJobEntries() == 0 ) { e.gc.setForeground( GUIResource.getInstance().getColorCrystalTextPentaho() ); e.gc.setBackground( GUIResource.getInstance().getColorBackground() ); e.gc.setFont( GUIResource.getInstance().getFontMedium() ); Image pentahoImage = GUIResource.getInstance().getImageJobCanvas(); int leftPosition = ( area.x - pentahoImage.getBounds().width ) / 2; int topPosition = ( area.y - pentahoImage.getBounds().height ) / 2; e.gc.drawImage( pentahoImage, leftPosition, topPosition ); } img.dispose(); }
GC gc = new GC(text); try { gc.setFont(text.getFont()); FontMetrics fm = gc.getFontMetrics(); /* Set the height to 5 rows of characters */ data.heightHint = 5 * fm.getHeight(); } finally { gc.dispose(); }
gc.setFont( fixed );
return; gc.setFont( (Font) object ); FontData[] array = gc.getFont().getFontData(); String string = "";
TableView.dummyGC.setFont( gridFont );
@Override public Point computeSizeConstraints(int widthInChars, int heightInChars) { GC gc= new GC(fText); gc.setFont(fTextFont); int width= gc.getFontMetrics().getAverageCharWidth(); int height= fText.getLineHeight(); //https://bugs.eclipse.org/bugs/show_bug.cgi?id=377109 gc.dispose(); return new Point(widthInChars * width, heightInChars * height); } }
public static int getFontHeightInPX(Font font) { GC gc = new GC(font.getDevice()); try { gc.setFont(font); return gc.textExtent(Utils.GOOD_STRING).y; } finally { gc.dispose(); } }
public PixelConverter(Control control) { GC gc = new GC(control); gc.setFont(control.getFont()); fFontMetrics= gc.getFontMetrics(); gc.dispose(); }
private static int getButtonWidthHint(Button button) { button.setFont(JFaceResources.getDialogFont()); GC gc = new GC(button); gc.setFont(button.getFont()); FontMetrics fontMetrics= gc.getFontMetrics(); gc.dispose(); int widthHint= Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH); return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); } }