Search in sources :

Example 41 with FontData

use of org.eclipse.swt.graphics.FontData in project dbeaver by serge-rider.

the class HexPreferencesManager method getNextFontData.

FontData getNextFontData() {
    if (fontsListCurrent.size() == 0) {
        fontsListCurrent = fontsScalable;
    }
    FontData aData = fontsListCurrent.get(0);
    fontsListCurrent.remove(0);
    while (fontsRejected.contains(aData.getName()) && fontsScalable.size() > 0) {
        if (fontsListCurrent.size() == 0) {
            fontsListCurrent = fontsScalable;
        }
        aData = fontsListCurrent.get(0);
        fontsListCurrent.remove(0);
    }
    return aData;
}
Also used : FontData(org.eclipse.swt.graphics.FontData)

Example 42 with FontData

use of org.eclipse.swt.graphics.FontData in project dbeaver by serge-rider.

the class HexPreferencesPage method getPrefFontData.

/**
     * Get font data information common to all plugin editors. Data comes from preferences store.
     *
     * @return font data to be used by plugin editors. Returns null for default font data.
     */
public static FontData getPrefFontData() {
    DBPPreferenceStore store = DBeaverCore.getGlobalPreferenceStore();
    String fontName = store.getString(DBeaverPreferences.HEX_FONT_NAME);
    int fontStyle = store.getInt(DBeaverPreferences.HEX_FONT_STYLE);
    int fontSize = store.getInt(DBeaverPreferences.HEX_FONT_SIZE);
    if (!CommonUtils.isEmpty(fontName) && fontSize > 0) {
        return new FontData(fontName, fontSize, fontStyle);
    }
    return null;
}
Also used : FontData(org.eclipse.swt.graphics.FontData) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 43 with FontData

use of org.eclipse.swt.graphics.FontData in project ow by vtst.

the class LessLabelProvider method getModifiedFontData.

private static FontData[] getModifiedFontData(FontData[] originalData, int additionalStyle) {
    FontData[] styleData = new FontData[originalData.length];
    for (int i = 0; i < styleData.length; i++) {
        FontData base = originalData[i];
        styleData[i] = new FontData(base.getName(), base.getHeight(), base.getStyle() | additionalStyle);
    }
    return styleData;
}
Also used : FontData(org.eclipse.swt.graphics.FontData)

Example 44 with FontData

use of org.eclipse.swt.graphics.FontData in project cubrid-manager by CUBRID.

the class ResourceManager method getFont.

public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) {
    String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline;
    Font font = fontMap.get(fontName);
    if (font == null) {
        FontData fontData = new FontData(name, size, style);
        if (strikeout || underline) {
            try {
                //$NON-NLS-1$
                Class<?> logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT");
                //$NON-NLS-1$
                Object logFont = FontData.class.getField("data").get(fontData);
                if (logFont != null && logFontClass != null) {
                    if (strikeout) {
                        //$NON-NLS-1$
                        logFontClass.getField("lfStrikeOut").set(logFont, Byte.valueOf((byte) 1));
                    }
                    if (underline) {
                        //$NON-NLS-1$
                        logFontClass.getField("lfUnderline").set(logFont, Byte.valueOf((byte) 1));
                    }
                }
            } catch (Exception e) {
                LOGGER.error(e.getMessage(), e);
            }
        }
        font = new Font(Display.getCurrent(), fontData);
        fontMap.put(fontName, font);
    }
    return font;
}
Also used : FontData(org.eclipse.swt.graphics.FontData) Font(org.eclipse.swt.graphics.Font)

Example 45 with FontData

use of org.eclipse.swt.graphics.FontData in project cubrid-manager by CUBRID.

the class ResourceManager method getFont.

public static Font getFont(String fontString) {
    if (fontString == null || fontString.trim().length() == 0) {
        return null;
    }
    Font font = fontMap.get(fontString);
    if (font == null) {
        FontData fontData = new FontData(fontString);
        font = new Font(Display.getDefault(), fontData);
        fontMap.put(fontString, font);
    }
    return font;
}
Also used : FontData(org.eclipse.swt.graphics.FontData) Font(org.eclipse.swt.graphics.Font)

Aggregations

FontData (org.eclipse.swt.graphics.FontData)70 Font (org.eclipse.swt.graphics.Font)38 FontStyle (org.eclipse.gmf.runtime.notation.FontStyle)14 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)11 GridData (org.eclipse.swt.layout.GridData)11 GridLayout (org.eclipse.swt.layout.GridLayout)9 Composite (org.eclipse.swt.widgets.Composite)9 Point (org.eclipse.swt.graphics.Point)8 Label (org.eclipse.swt.widgets.Label)8 Text (org.eclipse.swt.widgets.Text)5 ColorStyledText (org.talend.commons.ui.swt.colorstyledtext.ColorStyledText)5 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 Color (org.eclipse.swt.graphics.Color)4 GC (org.eclipse.swt.graphics.GC)4 IFigure (org.eclipse.draw2d.IFigure)3 Dimension (org.eclipse.draw2d.geometry.Dimension)3 DecoratedField (org.eclipse.jface.fieldassist.DecoratedField)3 FormAttachment (org.eclipse.swt.layout.FormAttachment)3 FormData (org.eclipse.swt.layout.FormData)3