public static Font getFont( String name, int size, int style, boolean strikeout, boolean underline) { if (name.equals("Arial") && SWTResourceManager.isMac()) { size += 2; } String fontName = name + "|" + size + "|" + style + "|" + strikeout + "|" + underline; if (resources.containsKey(fontName)) return (Font) resources.get(fontName); FontData fd = new FontData(name, size, style); if (strikeout || underline) { try { Class<?> lfCls = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); Object lf = FontData.class.getField("data").get(fd); if (lf != null && lfCls != null) { if (strikeout) lfCls.getField("lfStrikeOut").set(lf, new Byte((byte) 1)); if (underline) lfCls.getField("lfUnderline").set(lf, new Byte((byte) 1)); } } catch (Throwable e) { System.err.println( "Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); } } Font font = new Font(Display.getDefault(), fd); resources.put(fontName, font); return font; }