Project: SWT
Bug 251614 Space in font name
Reported: 2008-10-21 16:42:26 | Status: resolved fixed

Build ID: I20080917-0800 Steps To Reproduce: There is a problem when getting font names. Say we want "Lucida Grande", one version return this, but the other version returns without the space i.e. "LucidaGrande" They are the same font, but can't be matched because of the space. please see the snippet below. Snippet: package bugs; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; public class SpaceInFontName { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); String name = shell.getFont().getFontData()[0].getName(); System.out.println(name); // outputs "Lucida Grande" FontData d = display.getFontList("LucidaGrande", true)[0]; Font f = new Font (display, d); System.out.println(f.getFontData()[0].getName()); // outputs "Lucida Grande" FontData[] fonts = display.getFontList(null, true);// getFontList returns "LucidaGrande" for (int i = 0; i < fonts.length; i++) { FontData fontData = fonts[i]; System.out.println(fontData.getName()); } // shell.open(); // while (!shell.isDisposed()) { // if (!display.readAndDispatch()) { // display.sleep(); // } // } // display.dispose(); } } More information:

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Device.java