Examples of FontData


Examples of org.eclipse.swt.graphics.FontData

  }

  public static double textWidth(String s, String fontName, int fontSize,
      FontStyle... styles) {
    // TODO: optimize this
    FontData fd = new FontData(fontName, fontSize, FontStyle.toStyleMask(styles));
    Font f = new Font(device, fd);
    setGC();
    gc.setFont(f);
    double result = gc.textExtent(s).x;
    f.dispose();
View Full Code Here

Examples of org.eclipse.swt.graphics.FontData

  public void setFont(String fontName, int fontSize, FontStyle... styles) {
    int styleMask = FontStyle.toStyleMask(styles);
    if(currentFontData != null && currentFontData.getName().equals(fontName) && currentFontData.getHeight() == (int)fontSize && currentFontData.getStyle() == styleMask){
      return;
    }
    FontData fd = new FontData(fontName, (int) fontSize, styleMask );
    currentFontData = fd;
    //if(fd.equals(this.fontData)) return;
    this.fontData = fd;
    disposeIfNessary(currentFont);
    currentFont = new Font(device, fd);
View Full Code Here

Examples of org.eclipse.swt.graphics.FontData

    public JcrCellLabelProvider(TableViewer viewer) {
        this.viewer = viewer;

        Display display = viewer.getControl().getDisplay();
       
        FontData fontData = viewer.getTable().getFont().getFontData()[0];
        italic = new Font(display, new FontData(fontData.getName(), fontData
                .getHeight(), SWT.ITALIC));
        normal = new Font(display, new FontData(fontData.getName(), fontData
                .getHeight(), SWT.NORMAL));
        bold = new Font(display, new FontData(fontData.getName(), fontData
                .getHeight(), SWT.BOLD));
        greyColor = new Color(display, 100, 100, 100);
        normalColor = viewer.getTable().getForeground();
    }
View Full Code Here

Examples of org.eclipse.swt.graphics.FontData

        viewer.setInput(TestTreeModel.getInstance());

        resultsLabel = new Label(parent, SWT.SINGLE);
        resultsLabel.setText("Passed: 0    Failed: 0   Skipped: 0   Canceled: 0");
        final FontData font = new FontData();
        font.setStyle(SWT.BOLD);
        resultsLabel.setFont(new Font(Display.getCurrent(), font));

    }
View Full Code Here

Examples of org.eclipse.swt.graphics.FontData

            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$
View Full Code Here

Examples of org.eclipse.swt.graphics.FontData

     * @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

Examples of org.eclipse.swt.graphics.FontData

        int numTokens = tokenizer.countTokens();
        FontData[] fontData = new FontData[numTokens];

        for (int i = 0; i < numTokens; i++) {
            try {
                fontData[i] = new FontData(tokenizer.nextToken());
            } catch (SWTException error) {
                return FONTDATA_ARRAY_DEFAULT_DEFAULT;
            } catch (IllegalArgumentException error) {
                return FONTDATA_ARRAY_DEFAULT_DEFAULT;
            }
View Full Code Here

Examples of org.eclipse.swt.graphics.FontData

        data.heightHint = 30;
        data.widthHint = 370;

        Font f = label.getFont();
        FontData[] farr = f.getFontData();
        FontData fd = farr[0];
        fd.setStyle(SWT.BOLD);
        label.setFont(new Font(Display.getCurrent(), fd));

        label.setLayoutData(data);
        label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
View Full Code Here

Examples of org.eclipse.swt.graphics.FontData

        data.heightHint = 30;
        data.widthHint = 370;

        Font f = label.getFont();
        FontData[] farr = f.getFontData();
        FontData fd = farr[0];
        fd.setStyle(SWT.BOLD);
        label.setFont(new Font(Display.getCurrent(), fd));

        label.setLayoutData(data);
        label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
View Full Code Here

Examples of org.eclipse.swt.graphics.FontData

        data.heightHint = 30;
        data.widthHint = 370;

        Font f = label.getFont();
        FontData[] farr = f.getFontData();
        FontData fd = farr[0];
        fd.setStyle(SWT.BOLD);
        label.setFont(new Font(Display.getCurrent(), fd));

        label.setLayoutData(data);
        label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.