From e6e4e53a73b96f0a91ef9d39a4be8a5c950a793a Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Mon, 25 Oct 2021 13:27:40 +0200 Subject: [PATCH] Typography: added light and semibold font/style --- .../com/formdev/flatlaf/FlatLaf.properties | 16 ++++++++++++ .../uidefaults/FlatDarkLaf_1.8.0_202-mac.txt | 12 +++++++++ .../uidefaults/FlatDarkLaf_1.8.0_202.txt | 12 +++++++++ .../uidefaults/FlatLightLaf_1.8.0_202-mac.txt | 12 +++++++++ .../uidefaults/FlatLightLaf_1.8.0_202.txt | 12 +++++++++ .../themeeditor/FlatThemePreviewFonts.java | 20 +++++++++++--- .../themeeditor/FlatThemePreviewFonts.jfd | 26 ++++++++++++++----- .../flatlaf/themeeditor/FlatLafUIKeys.txt | 4 +++ 8 files changed, 105 insertions(+), 9 deletions(-) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties index b483ead4..4dafd803 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties @@ -45,6 +45,20 @@ mini.font = -3 # default font #defaultFont = ... +# font weights +# Windows +[win]light.font = "Segoe UI Light" +[win]semibold.font = "Segoe UI Semibold" +# macOS +[mac]light.font = "HelveticaNeue-Light" +[mac]semibold.font = "HelveticaNeue-Medium" +# Linux +[linux]light.font = "Lato Light", "Ubuntu Light", "Cantarell Light" +[linux]semibold.font = "Lato Semibold", "Ubuntu Medium" +# fallback for unknown platform +light.font = +0 +semibold.font = +0 + # monospaced [win]monospaced.font = Consolas, "Courier New", Monospaced [mac]monospaced.font = Menlo, Monospaced @@ -62,6 +76,8 @@ monospaced.font = Monospaced [style].medium = font: $medium.font [style].small = font: $small.font [style].mini = font: $mini.font +[style].light = font: $light.font +[style].semibold = font: $semibold.font [style].monospaced = font: $monospaced.font diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt index 7c003eb4..18039343 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt @@ -100,6 +100,12 @@ + large.font [active] Helvetica Neue plain 15 javax.swing.plaf.FontUIResource [UI] +#---- light ---- + +- light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] ++ light.font [active] HelveticaNeue-Light plain 13 javax.swing.plaf.FontUIResource [UI] + + #---- medium ---- - medium.font [active] Segoe UI plain 11 javax.swing.plaf.FontUIResource [UI] @@ -118,6 +124,12 @@ + monospaced.font [active] Menlo plain 13 javax.swing.plaf.FontUIResource [UI] +#---- semibold ---- + +- semibold.font [active] Segoe UI Semibold plain 12 javax.swing.plaf.FontUIResource [UI] ++ semibold.font [active] HelveticaNeue-Medium plain 13 javax.swing.plaf.FontUIResource [UI] + + #---- small ---- - small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt index fb98341a..4d706a84 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt @@ -1390,9 +1390,11 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].h3 font: $h3.font [style].h4 font: $h4.font [style].large font: $large.font +[style].light font: $light.font [style].medium font: $medium.font [style].mini font: $mini.font [style].monospaced font: $monospaced.font +[style].semibold font: $semibold.font [style].small font: $small.font @@ -1467,6 +1469,11 @@ laf.scaleFactor [active] 1.0 large.font [active] Segoe UI plain 14 javax.swing.plaf.FontUIResource [UI] +#---- light ---- + +light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] + + #---- medium ---- medium.font [active] Segoe UI plain 11 javax.swing.plaf.FontUIResource [UI] @@ -1493,6 +1500,11 @@ monospaced.font [active] Consolas plain 12 javax.swing.plaf.Fo scrollbar #3e4244 HSL 200 5 25 com.formdev.flatlaf.util.DerivedColor [UI] lighten(1%) +#---- semibold ---- + +semibold.font [active] Segoe UI Semibold plain 12 javax.swing.plaf.FontUIResource [UI] + + #---- small ---- small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt index 7c003eb4..18039343 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt @@ -100,6 +100,12 @@ + large.font [active] Helvetica Neue plain 15 javax.swing.plaf.FontUIResource [UI] +#---- light ---- + +- light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] ++ light.font [active] HelveticaNeue-Light plain 13 javax.swing.plaf.FontUIResource [UI] + + #---- medium ---- - medium.font [active] Segoe UI plain 11 javax.swing.plaf.FontUIResource [UI] @@ -118,6 +124,12 @@ + monospaced.font [active] Menlo plain 13 javax.swing.plaf.FontUIResource [UI] +#---- semibold ---- + +- semibold.font [active] Segoe UI Semibold plain 12 javax.swing.plaf.FontUIResource [UI] ++ semibold.font [active] HelveticaNeue-Medium plain 13 javax.swing.plaf.FontUIResource [UI] + + #---- small ---- - small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt index 4e136ebd..f6748391 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt @@ -1395,9 +1395,11 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].h3 font: $h3.font [style].h4 font: $h4.font [style].large font: $large.font +[style].light font: $light.font [style].medium font: $medium.font [style].mini font: $mini.font [style].monospaced font: $monospaced.font +[style].semibold font: $semibold.font [style].small font: $small.font @@ -1472,6 +1474,11 @@ laf.scaleFactor [active] 1.0 large.font [active] Segoe UI plain 14 javax.swing.plaf.FontUIResource [UI] +#---- light ---- + +light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] + + #---- medium ---- medium.font [active] Segoe UI plain 11 javax.swing.plaf.FontUIResource [UI] @@ -1498,6 +1505,11 @@ monospaced.font [active] Consolas plain 12 javax.swing.plaf.Fo scrollbar #f5f5f5 HSL 0 0 96 com.formdev.flatlaf.util.DerivedColor [UI] lighten(1%) +#---- semibold ---- + +semibold.font [active] Segoe UI Semibold plain 12 javax.swing.plaf.FontUIResource [UI] + + #---- small ---- small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.java index 55bf3cab..9a8d2510 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.java @@ -53,6 +53,8 @@ public class FlatThemePreviewFonts FlatThemePreviewFonts.FontPreview mediumPreview = new FlatThemePreviewFonts.FontPreview(); FlatThemePreviewFonts.FontPreview smallPreview = new FlatThemePreviewFonts.FontPreview(); FlatThemePreviewFonts.FontPreview miniPreview = new FlatThemePreviewFonts.FontPreview(); + FlatThemePreviewFonts.FontPreview lightPreview = new FlatThemePreviewFonts.FontPreview(); + FlatThemePreviewFonts.FontPreview semiboldPreview = new FlatThemePreviewFonts.FontPreview(); FlatThemePreviewFonts.FontPreview monospacedPreview = new FlatThemePreviewFonts.FontPreview(); JLabel scaleLabel = new JLabel(); scaleValueLabel = new JLabel(); @@ -76,6 +78,8 @@ public class FlatThemePreviewFonts "[bottom]" + "[bottom]" + "[bottom]para" + + "[]" + + "[]para" + "[]para" + "[]")); @@ -143,19 +147,29 @@ public class FlatThemePreviewFonts miniPreview.setFontStyle("mini"); add(miniPreview, "cell 0 12,gapx 12"); + //---- lightPreview ---- + lightPreview.setFontType("Light"); + lightPreview.setFontStyle("light"); + add(lightPreview, "cell 0 13,gapx 12"); + + //---- semiboldPreview ---- + semiboldPreview.setFontType("Semibold"); + semiboldPreview.setFontStyle("semibold"); + add(semiboldPreview, "cell 0 14,gapx 12"); + //---- monospacedPreview ---- monospacedPreview.setFontType("Monospaced"); monospacedPreview.setFontStyle("monospaced"); - add(monospacedPreview, "cell 0 13,gapx 12"); + add(monospacedPreview, "cell 0 15,gapx 12"); //---- scaleLabel ---- scaleLabel.setText("Fonts are scaled by:"); - add(scaleLabel, "cell 0 14,gapx 12"); + add(scaleLabel, "cell 0 16,gapx 12"); //---- scaleValueLabel ---- scaleValueLabel.setText("1x"); scaleValueLabel.putClientProperty("FlatLaf.styleClass", "h2"); - add(scaleValueLabel, "cell 0 14"); + add(scaleValueLabel, "cell 0 16"); // JFormDesigner - End of component initialization //GEN-END:initComponents } diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd index e7700964..002e1736 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd @@ -9,7 +9,7 @@ new FormModel { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { "$layoutConstraints": "ltr,insets dialog,hidemode 3" "$columnConstraints": "[left]unrel" - "$rowConstraints": "[][bottom][bottom][bottom][bottom][bottom][bottom]para[][bottom][bottom][bottom][bottom][bottom]para[]para[]" + "$rowConstraints": "[][bottom][bottom][bottom][bottom][bottom][bottom]para[][bottom][bottom][bottom][bottom][bottom]para[][]para[]para[]" } ) { name: "this" add( new FormComponent( "javax.swing.JLabel" ) { @@ -105,18 +105,32 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 12,gapx 12" } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { + name: "lightPreview" + "fontType": "Light" + "fontStyle": "light" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 13,gapx 12" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { + name: "semiboldPreview" + "fontType": "Semibold" + "fontStyle": "semibold" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 14,gapx 12" + } ) add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { name: "monospacedPreview" "fontType": "Monospaced" "fontStyle": "monospaced" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 13,gapx 12" + "value": "cell 0 15,gapx 12" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "scaleLabel" "text": "Fonts are scaled by:" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 14,gapx 12" + "value": "cell 0 16,gapx 12" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "scaleValueLabel" @@ -126,11 +140,11 @@ new FormModel { "JavaCodeGenerator.variableLocal": false } }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 14" + "value": "cell 0 16" } ) }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 5, 0 ) - "size": new java.awt.Dimension( 335, 405 ) + "size": new java.awt.Dimension( 335, 495 ) } ) add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { "$layoutConstraints": "insets 0,hidemode 3" @@ -162,7 +176,7 @@ new FormModel { "value": "cell 1 0" } ) }, new FormLayoutConstraints( null ) { - "location": new java.awt.Point( 5, 435 ) + "location": new java.awt.Point( 5, 545 ) "size": new java.awt.Dimension( 235, 65 ) } ) } diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt index ea68ec20..caa55b35 100644 --- a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt @@ -1071,9 +1071,11 @@ ViewportUI [style].h3 [style].h4 [style].large +[style].light [style].medium [style].mini [style].monospaced +[style].semibold [style].small activeCaption activeCaptionBorder @@ -1102,12 +1104,14 @@ infoText laf.dark laf.scaleFactor large.font +light.font medium.font menu menuText mini.font monospaced.font scrollbar +semibold.font small.font swingx/TaskPaneUI text