diff --git a/core/src/main/java/com/github/weisj/darklaf/graphics/PaintUtil.java b/core/src/main/java/com/github/weisj/darklaf/graphics/PaintUtil.java index 1c1ad964..336237d9 100644 --- a/core/src/main/java/com/github/weisj/darklaf/graphics/PaintUtil.java +++ b/core/src/main/java/com/github/weisj/darklaf/graphics/PaintUtil.java @@ -27,6 +27,7 @@ package com.github.weisj.darklaf.graphics; import java.awt.*; import java.awt.geom.Ellipse2D; import java.awt.geom.Path2D; +import java.awt.geom.Rectangle2D; import java.awt.geom.RoundRectangle2D; import javax.swing.*; @@ -117,10 +118,17 @@ public class PaintUtil { private static void doPaint(final Graphics2D g, final float width, final float height, final float arc, final float bw, final boolean inside) { GraphicsContext context = GraphicsUtil.setupStrokePainting(g); - float outerArc = inside ? arc : arc + bw; - float innerArc = inside ? arc - bw : arc; - Shape outerRect = new RoundRectangle2D.Float(0, 0, width, height, outerArc, outerArc); - Shape innerRect = new RoundRectangle2D.Float(bw, bw, width - 2 * bw, height - 2 * bw, innerArc, innerArc); + Shape outerRect; + Shape innerRect; + if (Scale.equalWithError(arc, 0)) { + outerRect = new Rectangle2D.Float(0, 0, width, height); + innerRect = new Rectangle2D.Float(bw, bw, width - 2 * bw, height - 2 * bw); + } else { + float outerArc = inside ? arc : arc + bw; + float innerArc = inside ? arc - bw : arc; + outerRect = new RoundRectangle2D.Float(0, 0, width, height, outerArc, outerArc); + innerRect = new RoundRectangle2D.Float(bw, bw, width - 2 * bw, height - 2 * bw, innerArc, innerArc); + } Path2D path = new Path2D.Float(Path2D.WIND_EVEN_ODD); path.append(outerRect, false); path.append(innerRect, false); diff --git a/core/src/main/java/com/github/weisj/darklaf/task/FontDefaultsInitTask.java b/core/src/main/java/com/github/weisj/darklaf/task/FontDefaultsInitTask.java index 20adb6e4..bed69b82 100644 --- a/core/src/main/java/com/github/weisj/darklaf/task/FontDefaultsInitTask.java +++ b/core/src/main/java/com/github/weisj/darklaf/task/FontDefaultsInitTask.java @@ -60,7 +60,12 @@ public class FontDefaultsInitTask implements DefaultsInitTask { TextAttribute.KERNING_ON); private static final Map DISABLE_KERNING = Collections.singletonMap(TextAttribute.KERNING, null); + /* + * On Catalina the are issues with font kerning and .AppleSystemUIFont. + * For now Helvetica Neue is used instead. + */ private static final String MAC_OS_CATALINA_FONT_NAME = ".AppleSystemUIFont"; + private static final String MAC_OS_CATALINA_FONT_NAME_FALLBACK = "Helvetica Neue"; private static final String WINDOWS_10_FONT_NAME = "Segoe UI"; private static final String MAC_OS_FONT_NAME = ".SF NS Text"; @@ -74,16 +79,18 @@ public class FontDefaultsInitTask implements DefaultsInitTask { patchOSFonts(defaults, this::mapWindowsFont); } + if (SystemInfo.isMacOSCatalina) { + defaults.put(RenderingHints.KEY_FRACTIONALMETRICS, + RenderingHints.VALUE_FRACTIONALMETRICS_ON); + } + if (systemKerningEnabled()) { List kerningFontsList = PropertyUtil.getList(defaults, KERNING_LIST, String.class); if (!kerningFontsList.isEmpty()) { Set kerningFonts = new HashSet<>(kerningFontsList); boolean enabledAll = ALL_FONTS.equals(kerningFontsList.get(0)); - setupKerningPerFont(defaults, key -> { - if (enabledAll) return true; - return kerningFonts.contains(key); - }); + setupKerningPerFont(defaults, key -> enabledAll || kerningFonts.contains(key)); } } diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java b/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java index 06514052..d014b2ba 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java @@ -38,7 +38,6 @@ import com.github.weisj.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.PropertyUtil; /** - * @author Konstantin Bulenkov * @author Jannis Weis */ public class DarkButtonBorder implements Border, UIResource { @@ -89,7 +88,6 @@ public class DarkButtonBorder implements Border, UIResource { } public static boolean showDropShadow(final JComponent c) { - if (ButtonConstants.isRound(c)) return false; return showDropShadow(getCornerFlag(c)); } diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java index 42b01e8b..f93928f9 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java @@ -51,7 +51,6 @@ import com.github.weisj.darklaf.util.PropertyKey; import com.github.weisj.darklaf.util.PropertyUtil; /** - * @author Konstantin Bulenkov * @author Jannis Weis */ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants { @@ -198,9 +197,9 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants { g.setColor(shadowColor); Composite comp = g.getComposite(); g.setComposite(PaintUtil.getShadowComposite()); - int sh = Math.max(shadow, 2 * effectiveArc); - paintBackgroundRect(g, effectiveArc, bgRect.x, bgRect.y + bgRect.height + shadow - sh, - bgRect.width, sh, false); + int stroke = (int) PaintUtil.getStrokeWidth(g); + paintBackgroundRect(g, effectiveArc, bgRect.x, bgRect.y + shadow + stroke, + bgRect.width, bgRect.height); g.setComposite(comp); } @@ -209,16 +208,15 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants { } private void paintBackgroundRect(final Graphics2D g2, final int effectiveArc, final Rectangle bgRect) { - paintBackgroundRect(g2, effectiveArc, bgRect.x, bgRect.y, bgRect.width, bgRect.height, true); + paintBackgroundRect(g2, effectiveArc, bgRect.x, bgRect.y, bgRect.width, bgRect.height); } private void paintBackgroundRect(final Graphics2D g2, final int effectiveArc, - final int x, final int y, final int width, final int height, - final boolean respectBorder) { + final int x, final int y, final int width, final int height) { if (effectiveArc == 0) { g2.fillRect(x, y, width, height); } else { - PaintUtil.fillRoundRect(g2, x, y, width, height, effectiveArc, respectBorder); + PaintUtil.fillRoundRect(g2, x, y, width, height, effectiveArc, true); } } diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/progressbar/DarkProgressBarBorder.java b/core/src/main/java/com/github/weisj/darklaf/ui/progressbar/DarkProgressBarBorder.java index 3d2863c3..72917279 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/progressbar/DarkProgressBarBorder.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/progressbar/DarkProgressBarBorder.java @@ -27,7 +27,6 @@ package com.github.weisj.darklaf.ui.progressbar; import javax.swing.plaf.BorderUIResource; /** - * @author Konstantin Bulenkov * @author Jannis Weis */ public class DarkProgressBarBorder extends BorderUIResource.EmptyBorderUIResource { diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkRootPaneUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkRootPaneUI.java index edf485ee..c18d67e6 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkRootPaneUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkRootPaneUI.java @@ -40,7 +40,6 @@ import com.github.weisj.darklaf.util.PropertyKey; import com.github.weisj.darklaf.util.PropertyUtil; /** - * @author Konstantin Bulenkov * @author Jannis Weis */ public class DarkRootPaneUI extends BasicRootPaneUI implements HierarchyListener { diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkScrollBarUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkScrollBarUI.java index c650d412..08e5b9ed 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkScrollBarUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkScrollBarUI.java @@ -35,7 +35,6 @@ import com.github.weisj.darklaf.graphics.PaintUtil; import com.github.weisj.darklaf.util.ColorUtil; /** - * @author Konstantin Bulenkov * @author Jannis Weis */ public class DarkScrollBarUI extends BasicScrollBarUI implements ScrollBarConstants { diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/text/DarkPasswordFieldUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/text/DarkPasswordFieldUI.java index 695b68fc..d3128db0 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/text/DarkPasswordFieldUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/text/DarkPasswordFieldUI.java @@ -25,23 +25,19 @@ package com.github.weisj.darklaf.ui.text; import java.awt.*; -import java.awt.event.*; +import java.awt.event.MouseEvent; import java.beans.PropertyChangeEvent; import java.util.Arrays; import javax.swing.*; -import javax.swing.border.Border; import javax.swing.plaf.ComponentUI; import javax.swing.text.JTextComponent; -import com.github.weisj.darklaf.graphics.GraphicsContext; -import com.github.weisj.darklaf.graphics.PaintUtil; import com.github.weisj.darklaf.icons.EmptyIcon; import com.github.weisj.darklaf.ui.text.bridge.DarkPasswordFieldUIBridge; import com.github.weisj.darklaf.util.PropertyUtil; /** - * @author Konstantin Bulenkov * @author Jannis Weis */ public class DarkPasswordFieldUI extends DarkPasswordFieldUIBridge { @@ -51,7 +47,6 @@ public class DarkPasswordFieldUI extends DarkPasswordFieldUIBridge { protected Icon show; protected Icon showPressed; protected int borderSize; - protected int arc; private char echo_dot = '*'; private boolean showTriggered = false; @@ -62,38 +57,10 @@ public class DarkPasswordFieldUI extends DarkPasswordFieldUIBridge { @Override protected void installDefaults() { super.installDefaults(); - borderSize = UIManager.getInt("PasswordField.borderThickness"); - arc = UIManager.getInt("PasswordField.arc"); show = UIManager.getIcon("PasswordField.show.icon"); showPressed = UIManager.getIcon("PasswordField.showPressed.icon"); } - protected void paintBackground(final Graphics graphics) { - Graphics2D g = (Graphics2D) graphics; - JTextComponent c = getComponent(); - - Container parent = c.getParent(); - if (parent != null) { - g.setColor(parent.getBackground()); - g.fillRect(0, 0, c.getWidth(), c.getHeight()); - } - - Border border = c.getBorder(); - GraphicsContext config = new GraphicsContext(g); - if (border instanceof DarkTextBorder) { - if (c.isEnabled() && c.isEditable()) { - g.setColor(c.getBackground()); - } - int width = c.getWidth(); - int height = c.getHeight(); - int w = borderSize; - PaintUtil.fillRoundRect(g, w, w, width - 2 * w, height - 2 * w, arc); - } else { - super.paintBackground(g); - } - config.restore(); - } - @Override protected boolean doPaintLeftIcon(final JTextComponent c) { return false; diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextFieldUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextFieldUI.java index b99bc1dc..88a3639e 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextFieldUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextFieldUI.java @@ -44,7 +44,6 @@ import com.github.weisj.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.PropertyUtil; /** - * @author Konstantin Bulenkov * @author Jannis Weis */ public class DarkTextFieldUI extends DarkTextFieldUIBridge implements PropertyChangeListener, MouseClickListener { diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/togglebutton/checkbox/DarkCheckBoxUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/togglebutton/checkbox/DarkCheckBoxUI.java index 0ce98a0e..e24ca9d5 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/togglebutton/checkbox/DarkCheckBoxUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/togglebutton/checkbox/DarkCheckBoxUI.java @@ -33,7 +33,6 @@ import javax.swing.plaf.ComponentUI; import com.github.weisj.darklaf.ui.togglebutton.radiobutton.DarkRadioButtonUI; /** - * @author Konstantin Bulenkov * @author Jannis Weis */ public class DarkCheckBoxUI extends DarkRadioButtonUI { diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/togglebutton/radiobutton/DarkRadioButtonUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/togglebutton/radiobutton/DarkRadioButtonUI.java index 1658f6bc..c997a966 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/togglebutton/radiobutton/DarkRadioButtonUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/togglebutton/radiobutton/DarkRadioButtonUI.java @@ -48,7 +48,6 @@ import com.github.weisj.darklaf.ui.togglebutton.ToggleButtonFocusNavigationActio import com.github.weisj.darklaf.util.PropertyKey; /** - * @author Konstantin Bulenkov * @author Jannis Weis */ public class DarkRadioButtonUI extends MetalRadioButtonUI implements PropertyChangeListener, ToggleButtonConstants { diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/toolbar/DarkToolBarBorder.java b/core/src/main/java/com/github/weisj/darklaf/ui/toolbar/DarkToolBarBorder.java index 62f2c3c2..071cd4fa 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/toolbar/DarkToolBarBorder.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/toolbar/DarkToolBarBorder.java @@ -31,7 +31,6 @@ import javax.swing.border.AbstractBorder; import javax.swing.plaf.UIResource; /** - * @author Konstantin Bulenkov * @author Jannis Weis */ public class DarkToolBarBorder extends AbstractBorder implements UIResource, SwingConstants { diff --git a/core/src/main/resources/com/github/weisj/darklaf/properties/ui/button.properties b/core/src/main/resources/com/github/weisj/darklaf/properties/ui/button.properties index 67801fc3..923c4d66 100644 --- a/core/src/main/resources/com/github/weisj/darklaf/properties/ui/button.properties +++ b/core/src/main/resources/com/github/weisj/darklaf/properties/ui/button.properties @@ -42,10 +42,10 @@ Button.activeFillColorRollOver = %hoverHighlight Button.activeFillColorClick = %clickHighlight Button.arc = %arc -Button.squareArc = %arcSecondary +Button.squareArc = 0 Button.focusArc = %arcFocus -Button.squareFocusArc = %arcSecondaryFocus -Button.minimumArc = %arcSecondary +Button.squareFocusArc = 0 +Button.minimumArc = 0 Button.borderThickness = %borderThickness Button.shadowHeight = %shadowHeight diff --git a/core/src/main/resources/com/github/weisj/darklaf/properties/ui/text.properties b/core/src/main/resources/com/github/weisj/darklaf/properties/ui/text.properties index 835917fb..9940938e 100644 --- a/core/src/main/resources/com/github/weisj/darklaf/properties/ui/text.properties +++ b/core/src/main/resources/com/github/weisj/darklaf/properties/ui/text.properties @@ -104,9 +104,6 @@ PasswordField.selectionForeground = %textCompSelectionForeground PasswordField.border = com.github.weisj.darklaf.ui.text.DarkTextBorder PasswordField.extendSelection = false -PasswordField.arc = %arcSecondary -PasswordField.borderThickness = %borderThickness - #Icons PasswordField.show.icon = misc/eye.svg[themed] PasswordField.showPressed.icon = misc/eyeHovered.svg[themed] diff --git a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java index 32a81e68..eb11fd1e 100644 --- a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java +++ b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java @@ -46,7 +46,6 @@ import com.github.weisj.darklaf.util.PropertyKey; import com.github.weisj.darklaf.util.Scale; /** - * @author Konstantin Bulenkov * @author Jannis Weis */ public class WindowsTitlePane extends CustomTitlePane {