Browse Source

Updated change notes.

Use newer nio.files functions in CreateUITable.
Improved font loading.
pull/170/head
weisj 5 years ago
parent
commit
3308ee1d2d
  1. 3
      change_notes.md
  2. 14
      core/src/main/resources/com/github/weisj/darklaf/properties/font.properties
  3. 4
      core/src/main/resources/com/github/weisj/darklaf/properties/font_sizes.properties
  4. 6
      core/src/test/java/documentation/CreateUITable.java
  5. 14
      property-loader/src/main/java/com/github/weisj/darklaf/PropertyLoader.java

3
change_notes.md

@ -6,13 +6,14 @@
- Balloons tooltips are now enabled by default for buttons.
- Improved html style sheet.
- On Windows (Vista and later) darklaf will now use the system font.
- Better interoperability with custom cell renderers.
- Improved selection painting.
- Added property to control whether the selection is extended to the end of the text component.
````java
textComp.putClientProperty(DarkTextUI.KEY_EXTEND_LINE_SELECTION, enabled);
````
- Performance improvements.
- New scrollbar appearance on macOS that more closely resembles the system appearance.
- New scrollbar appearance on macOS that resembles the system appearance more closely.
- Added rounded button variant.
````java
button.putClientProperty(DarkButtonUI.KEY_ROUND, true);

14
core/src/main/resources/com/github/weisj/darklaf/properties/font.properties

@ -47,10 +47,10 @@ ProgressBar.font = withSize(%fontSize.default)withStyle(0)
RadioButton.font = withSize(%fontSize.default)withStyle(0)
RadioButtonMenuItem.font = withSize(%fontSize.default)withStyle(0)
ScrollPane.font = withSize(%fontSize.default)withStyle(0)
Slider.font = withSize(%fontSize.default, -2)withStyle(0)
Slider.font = withSize(%fontSize.default,-2)withStyle(0)
Spinner.font = withSize(%fontSize.default)withStyle(0)
TabbedPane.font = withSize(%fontSize.default)withStyle(0)
TabFrameTab.font = from(Label.font)withSize(%fontSize.default,-1)withStyle(0)
TabFrameTab.font = from(Label.font)withSize(%fontSize.title)withStyle(0)
Table.font = withSize(%fontSize.default)withStyle(0)
TableHeader.font = withSize(%fontSize.default)withStyle(0)
TextArea.font = withSize(%fontSize.default)withStyle(0)
@ -62,8 +62,8 @@ ToolBar.font = withSize(%fontSize.default)withStyle(0)
ToolTip.font = withSize(%fontSize.default)withStyle(0)
Tree.font = withSize(%fontSize.default)withStyle(0)
Viewport.font = withSize(%fontSize.default)withStyle(0)
MenuItem.acceleratorFont = withSize(%fontSize.default,-2)withStyle(0)
RadioButtonMenuItem.acceleratorFont = withSize(%fontSize.default,-2)withStyle(0)
Menu.acceleratorFont = withSize(%fontSize.default,-2)withStyle(0)
CheckBoxMenuItem.acceleratorFont = withSize(%fontSize.default,-2)withStyle(0)
InternalFrame.titleFont = withSize(%fontSize.default,-1)withStyle(0)
MenuItem.acceleratorFont = withSize(%fontSize.accelerator)withStyle(0)
RadioButtonMenuItem.acceleratorFont = withSize(%fontSize.accelerator)withStyle(0)
Menu.acceleratorFont = withSize(%fontSize.accelerator)withStyle(0)
CheckBoxMenuItem.acceleratorFont = withSize(%fontSize.accelerator)withStyle(0)
InternalFrame.titleFont = withSize(%fontSize.title)withStyle(0)

4
core/src/main/resources/com/github/weisj/darklaf/properties/font_sizes.properties

@ -24,4 +24,6 @@
#
# suppress inspection "UnusedProperty" for whole file
#
fontSize.default = 12
fontSize.default = 12
fontSize.accelerator = 10
fontSize.title = 11

6
core/src/test/java/documentation/CreateUITable.java

@ -29,6 +29,7 @@ import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
@ -73,8 +74,8 @@ public class CreateUITable {
workingFolder = FOLDER + theme.getPrefix() + "/";
String os = SystemInfo.isMac ? "mac" : SystemInfo.isWindows ? "windows" : "linux";
String htmlFile = workingFolder + "defaults_" + os + ".html";
new File(workingFolder).mkdirs();
new File(htmlFile).createNewFile();
Files.createDirectories(new File(workingFolder).toPath());
Files.createFile(new File(htmlFile).toPath());
try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(htmlFile),
StandardCharsets.UTF_8)) {
@ -90,6 +91,7 @@ public class CreateUITable {
private String createTables(final Theme theme, final int ident) {
UIDefaults defaults = setupThemeDefaults(theme);
defaults.entrySet().stream().filter(e -> e.getValue() instanceof Font).forEach(System.out::println);
String misc = "__Misc__";

14
property-loader/src/main/java/com/github/weisj/darklaf/PropertyLoader.java

@ -301,14 +301,22 @@ public final class PropertyLoader {
} else {
break;
}
if (val.isEmpty()) break;
}
if (base == null) base = parseExplicitFont(value);
if (base == null && accumulator.get(key) instanceof Font) base = (Font) accumulator.get(key);
if (base == null) base = currentDefaults.getFont(key);
if (base == null) base = new Font(null, Font.PLAIN, 12);
if (size > 0) base = base.deriveFont((float) size);
if (style >= 0) base = base.deriveFont(style);
return new DarkFontUIResource(base.deriveFont(attributes));
if (size <= 0) size = base.getSize();
if (style < 0) style = base.getStyle();
Font font = base.deriveFont(style).deriveFont((float) size);
font = new DarkFontUIResource(font.deriveFont(attributes));
if (size != font.getSize()) {
throw new IllegalStateException("Font Sizes are not equal. Expected " + size + " but got "
+ font.getSize());
}
assert base.getSize() == font.getSize();
return font;
}
private static Font parseExplicitFont(final String value) {

Loading…
Cancel
Save