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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations