Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.Font


        fTextLayout = new TextLayout(fBrowser.getDisplay());

        // Initialize fonts
        final String symbolicFontName = fSymbolicFontName == null ? JFaceResources.DIALOG_FONT
                : fSymbolicFontName;
        Font font = JFaceResources.getFont(symbolicFontName);
        fTextLayout.setFont(font);
        fTextLayout.setWidth(-1);
        font = JFaceResources.getFontRegistry().getBold(symbolicFontName);
        fBoldStyle = new TextStyle(font, null, null);
View Full Code Here


        if (fSymbolicFontName == null) {
            return null;
        }

        final GC gc = new GC(fBrowser);
        final Font font = fSymbolicFontName == null ? JFaceResources.getDialogFont()
                : JFaceResources.getFont(fSymbolicFontName);
        gc.setFont(font);
        final int width = gc.getFontMetrics().getAverageCharWidth();
        final int height = gc.getFontMetrics().getHeight();
        gc.dispose();
View Full Code Here

        GridLayout layout = new GridLayout();
        layout.numColumns = 2;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        parent.setLayout(layout);
        final Font font = ancestor.getFont();
        parent.setFont(font);

        GridData data;

        final Composite composite = new Composite(parent, SWT.NONE);
View Full Code Here

        final GridLayout layout = new GridLayout();
        layout.numColumns = 2;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        parent.setLayout(layout);
        final Font font = ancestor.getFont();
        parent.setFont(font);

        final Label lblNewLabel_7 = new Label(parent, SWT.WRAP);
        final GridData gd_lblNewLabel_7 = new GridData(SWT.FILL, SWT.CENTER, false,
                false, 2, 1);
View Full Code Here

     */
    public static Font getFont(final String name, final int size, final int style,
            final boolean strikeout, final boolean underline) {
        final String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|'
                + underline;
        Font font = m_fontMap.get(fontName);
        if (font == null) {
            final FontData fontData = new FontData(name, size, style);
            if (strikeout || underline) {
                try {
                    final Class<?> logFontClass = Class
                            .forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$
                    final Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$
                    if (logFont != null && logFontClass != null) {
                        if (strikeout) {
                            logFontClass
                                    .getField("lfStrikeOut").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$
                        }
                        if (underline) {
                            logFontClass
                                    .getField("lfUnderline").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$
                        }
                    }
                } catch (final Throwable e) {
                    System.err
                            .println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$
                }
            }
            font = new Font(Display.getCurrent(), fontData);
            m_fontMap.put(fontName, font);
        }
        return font;
    }
View Full Code Here

     * @param baseFont
     *            the {@link Font} for which a bold version is desired
     * @return the bold version of the given {@link Font}
     */
    public static Font getBoldFont(final Font baseFont) {
        Font font = m_fontToBoldFontMap.get(baseFont);
        if (font == null) {
            final FontData fontDatas[] = baseFont.getFontData();
            final FontData data = fontDatas[0];
            font = new Font(Display.getCurrent(), data.getName(), data.getHeight(),
                    SWT.BOLD);
            m_fontToBoldFontMap.put(baseFont, font);
        }
        return font;
    }
View Full Code Here

    @Override
    protected Control createDialogArea(final Composite parent) {
        // page group
        final Composite composite = (Composite) super.createDialogArea(parent);

        final Font font = parent.getFont();
        composite.setFont(font);

        createMessageArea(composite);

        fTableViewer = new TableViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL
View Full Code Here

        final ErlangSourceViewerConfiguration configuration = new SyntaxColorPreviewEditorConfiguration(
                store, colorManager, colors);
        viewer.configure(configuration);

        final Font font = JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
        viewer.getTextWidget().setFont(font);
        new ErlangSourceViewerUpdater(viewer, configuration, store);
        viewer.setEditable(false);

        final Cursor arrowCursor = viewer.getTextWidget().getDisplay()
View Full Code Here

     *            the window used to calculate
     * @return <code>Point</code>
     */
    private Point computeImageSize(Control window) {
        GC gc = new GC(window);
        Font f = JFaceResources.getFontRegistry().get(
                JFaceResources.DIALOG_FONT);
        gc.setFont(f);
        int height = gc.getFontMetrics().getHeight();
        gc.dispose();
        Point p = new Point(height * 3 - 6, height);
View Full Code Here

          if (foreground != null)
            settings.setForeground(foreground);
        }
       
        if(decorator instanceof IFontDecorator) {
          Font font = ((IFontDecorator) decorator).decorateFont(element);
          if (font != null)
            settings.setFont(font);
        }
        }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.graphics.Font

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.