Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ private FontRecord createFont(String symbolicName, FontData[] fonts) {
}

FontData[] validData = filterData(fonts, display);
if (validData.length == 0) {
if (validData == null || validData.length == 0) {
//Nothing specified
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,20 @@ public void get_forNameThatWasNeverRegistered_returnsDefaultFontAndIsStableAfter
assertSame(first, second);
}

@Test
public void get_forNameRegisteredWithoutAnyFontData_returnsDefaultFont() {
FontRegistry fontRegistry = new FontRegistry();
// an empty array leaves nothing to filter, so filterData() yields no usable data at all
fontRegistry.put("fontWithoutData", new FontData[0]);

Font first = fontRegistry.get("fontWithoutData");
Font second = fontRegistry.get("fontWithoutData");

assertSame(fontRegistry.get(JFaceResources.DEFAULT_FONT), first,
"a name that cannot be resolved to any font data must fall back to the default font");
assertSame(first, second);
}

@Test
public void getBoldAndGetItalic_returnSameInstanceOnRepeatedCalls() {
FontRegistry fontRegistry = new FontRegistry();
Expand Down
Loading