/** * Returns the font that the receiver will use to paint textual information. * * @return the receiver's font * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public Font getFont () { checkWidget(); if (font != null) return font; return parent.getFont (); }
/** * Returns the font that the receiver will use to paint textual information. * * @return the receiver's font * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public Font getFont () { checkWidget(); if (font != null) return font; return parent.getFont (); }
/** * Returns the font that the receiver will use to paint textual information. * * @return the receiver's font * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public Font getFont () { checkWidget(); if (font != null) return font; return parent.getFont (); }
/** * Returns the font that the receiver will use to paint textual information. * * @return the receiver's font * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public Font getFont () { checkWidget(); if (font != null) return font; return parent.getFont (); }
/** * Computes the indentations for the given font and stores them in * <code>fIndentation</code>. */ protected void computeIndentations() { if (fCanvas == null || fCanvas.isDisposed()) return; GC gc= new GC(fCanvas); try { gc.setFont(fCanvas.getFont()); fIndentation= new int[fCachedNumberOfDigits + 1]; char[] nines= new char[fCachedNumberOfDigits]; Arrays.fill(nines, '9'); String nineString= new String(nines); Point p= gc.stringExtent(nineString); fIndentation[0]= p.x; for (int i= 1; i <= fCachedNumberOfDigits; i++) { p= gc.stringExtent(nineString.substring(0, i)); fIndentation[i]= fIndentation[0] - p.x; } } finally { gc.dispose(); } }
/** * Computes the indentations for the given font and stores them in * <code>fIndentation</code>. */ protected void computeIndentations() { if (fCanvas == null || fCanvas.isDisposed()) return; GC gc= new GC(fCanvas); try { gc.setFont(fCanvas.getFont()); fIndentation= new int[fCachedNumberOfDigits + 1]; char[] nines= new char[fCachedNumberOfDigits]; Arrays.fill(nines, '9'); String nineString= new String(nines); Point p= gc.stringExtent(nineString); fIndentation[0]= p.x; for (int i= 1; i <= fCachedNumberOfDigits; i++) { p= gc.stringExtent(nineString.substring(0, i)); fIndentation[i]= fIndentation[0] - p.x; } } finally { gc.dispose(); } }
SWT.DEFAULT, true, false, 2, 1)); font = FontUtils.getFontPercentOf(peerInfoCanvas.getFont(), 0.7f);
/** * Sets or clears the caret in the "Example" widget. */ void setCaret () { Caret oldCaret = canvas.getCaret (); if (caretButton.getSelection ()) { Caret newCaret = new Caret(canvas, SWT.NONE); Font font = canvas.getFont(); newCaret.setFont(font); GC gc = new GC(canvas); gc.setFont(font); newCaret.setBounds(1, 1, 1, gc.getFontMetrics().getHeight()); gc.dispose(); canvas.setCaret (newCaret); canvas.setFocus(); } else { canvas.setCaret (null); } if (oldCaret != null) oldCaret.dispose (); }
}, new GridData(SWT.FILL, SWT.DEFAULT, true, false, 2, 1)); font = FontUtils.getFontPercentOf(pieceInfoCanvas.getFont(), 0.7f);
/** * Double buffer drawing. * * @param dest the GC to draw into */ private void doubleBufferPaint(GC dest) { Point size= fCanvas.getSize(); if (size.x <= 0 || size.y <= 0) return; if (fBuffer != null) { Rectangle r= fBuffer.getBounds(); if (r.width != size.x || r.height != size.y) { fBuffer.dispose(); fBuffer= null; } } if (fBuffer == null) fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y); GC gc= new GC(fBuffer); gc.setFont(fCanvas.getFont()); try { gc.setBackground(getBackground()); gc.fillRectangle(0, 0, size.x, size.y); doPaint(gc); } finally { gc.dispose(); } dest.drawImage(fBuffer, 0, 0); }
/** * Double buffer drawing. * * @param dest the GC to draw into */ private void doubleBufferPaint(GC dest) { Point size= fCanvas.getSize(); if (size.x <= 0 || size.y <= 0) return; if (fBuffer != null) { Rectangle r= fBuffer.getBounds(); if (r.width != size.x || r.height != size.y) { fBuffer.dispose(); fBuffer= null; } } if (fBuffer == null) fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y); GC gc= new GC(fBuffer); gc.setFont(fCanvas.getFont()); try { gc.setBackground(getBackground()); gc.fillRectangle(0, 0, size.x, size.y); doPaint(gc); } finally { gc.dispose(); } dest.drawImage(fBuffer, 0, 0); }
gc.setFont(fCanvas.getFont()); if (fForeground != null) gc.setForeground(fForeground);
fontHeader = FontUtils.getFontPercentOf(cHeaderArea.getFont(), 0.9f); fontHeaderSmall = FontUtils.getFontPercentOf(fontHeader, 0.8f); cHeaderArea.setFont(fontHeader);
Font font = canvas.getFont(); FontData[] fdata = font.getFontData(); fdata[0].setHeight(Constants.isOSX ? 9 : 7);