From d360375b4fedc50f843e9ed4edc0bc27ac7ed4a6 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Fri, 19 Nov 2021 11:13:32 +0100 Subject: [PATCH] Typography: - use semibold for `h1`, `h2` and `h3` - added `h1.regular`, `h2.regular` and `h3.regular` --- .../com/formdev/flatlaf/FlatLaf.properties | 13 +++++++++--- .../uidefaults/FlatDarkLaf_1.8.0_202-mac.txt | 21 +++++++++++++------ .../uidefaults/FlatDarkLaf_1.8.0_202.txt | 12 ++++++++--- .../uidefaults/FlatLightLaf_1.8.0_202-mac.txt | 21 +++++++++++++------ .../uidefaults/FlatLightLaf_1.8.0_202.txt | 12 ++++++++--- .../uidefaults/FlatTestLaf_1.8.0_202.txt | 12 ++++++++--- .../flatlaf/testing/FlatTypographyTest.java | 18 ++++++++++++---- .../flatlaf/testing/FlatTypographyTest.jfd | 6 ++++++ .../flatlaf/themeeditor/FlatLafUIKeys.txt | 6 ++++++ 9 files changed, 93 insertions(+), 28 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 630ef17e..6e161a61 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties @@ -31,11 +31,15 @@ # headings h00.font = +24 h0.font = +18 -h1.font = +12 -h2.font = +6 -h3.font = +3 +h1.font = +12 $semibold.font +h2.font = +6 $semibold.font +h3.font = +3 $semibold.font h4.font = bold +h1.regular.font = +12 +h2.regular.font = +6 +h3.regular.font = +3 + # text large.font = +2 medium.font = -1 @@ -72,6 +76,9 @@ monospaced.font = Monospaced [style].h2 = font: $h2.font [style].h3 = font: $h3.font [style].h4 = font: $h4.font +[style].h1.regular = font: $h1.regular.font +[style].h2.regular = font: $h2.regular.font +[style].h3.regular = font: $h3.regular.font [style].large = font: $large.font [style].medium = font: $medium.font [style].small = font: $small.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 196104bf..224fa680 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 @@ -72,20 +72,29 @@ #---- h1 ---- -- h1.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] -+ h1.font [active] Helvetica Neue plain 25 javax.swing.plaf.FontUIResource [UI] +- h1.font [active] Segoe UI Semibold plain 24 javax.swing.plaf.FontUIResource [UI] ++ h1.font [active] HelveticaNeue-Medium plain 25 javax.swing.plaf.FontUIResource [UI] + +- h1.regular.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] ++ h1.regular.font [active] Helvetica Neue plain 25 javax.swing.plaf.FontUIResource [UI] #---- h2 ---- -- h2.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] -+ h2.font [active] Helvetica Neue plain 19 javax.swing.plaf.FontUIResource [UI] +- h2.font [active] Segoe UI Semibold plain 18 javax.swing.plaf.FontUIResource [UI] ++ h2.font [active] HelveticaNeue-Medium plain 19 javax.swing.plaf.FontUIResource [UI] + +- h2.regular.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] ++ h2.regular.font [active] Helvetica Neue plain 19 javax.swing.plaf.FontUIResource [UI] #---- h3 ---- -- h3.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] -+ h3.font [active] Helvetica Neue plain 16 javax.swing.plaf.FontUIResource [UI] +- h3.font [active] Segoe UI Semibold plain 15 javax.swing.plaf.FontUIResource [UI] ++ h3.font [active] HelveticaNeue-Medium plain 16 javax.swing.plaf.FontUIResource [UI] + +- h3.regular.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] ++ h3.regular.font [active] Helvetica Neue plain 16 javax.swing.plaf.FontUIResource [UI] #---- h4 ---- 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 4d706a84..8abdbd47 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt @@ -1385,8 +1385,11 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].h00 font: $h00.font [style].h0 font: $h0.font +[style].h1.regular font: $h1.regular.font [style].h1 font: $h1.font +[style].h2.regular font: $h2.regular.font [style].h2 font: $h2.font +[style].h3.regular font: $h3.regular.font [style].h3 font: $h3.font [style].h4 font: $h4.font [style].large font: $large.font @@ -1425,17 +1428,20 @@ h00.font [active] Segoe UI plain 36 javax.swing.plaf.Fo #---- h1 ---- -h1.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] +h1.font [active] Segoe UI Semibold plain 24 javax.swing.plaf.FontUIResource [UI] +h1.regular.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] #---- h2 ---- -h2.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] +h2.font [active] Segoe UI Semibold plain 18 javax.swing.plaf.FontUIResource [UI] +h2.regular.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] #---- h3 ---- -h3.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] +h3.font [active] Segoe UI Semibold plain 15 javax.swing.plaf.FontUIResource [UI] +h3.regular.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] #---- h4 ---- 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 196104bf..224fa680 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 @@ -72,20 +72,29 @@ #---- h1 ---- -- h1.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] -+ h1.font [active] Helvetica Neue plain 25 javax.swing.plaf.FontUIResource [UI] +- h1.font [active] Segoe UI Semibold plain 24 javax.swing.plaf.FontUIResource [UI] ++ h1.font [active] HelveticaNeue-Medium plain 25 javax.swing.plaf.FontUIResource [UI] + +- h1.regular.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] ++ h1.regular.font [active] Helvetica Neue plain 25 javax.swing.plaf.FontUIResource [UI] #---- h2 ---- -- h2.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] -+ h2.font [active] Helvetica Neue plain 19 javax.swing.plaf.FontUIResource [UI] +- h2.font [active] Segoe UI Semibold plain 18 javax.swing.plaf.FontUIResource [UI] ++ h2.font [active] HelveticaNeue-Medium plain 19 javax.swing.plaf.FontUIResource [UI] + +- h2.regular.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] ++ h2.regular.font [active] Helvetica Neue plain 19 javax.swing.plaf.FontUIResource [UI] #---- h3 ---- -- h3.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] -+ h3.font [active] Helvetica Neue plain 16 javax.swing.plaf.FontUIResource [UI] +- h3.font [active] Segoe UI Semibold plain 15 javax.swing.plaf.FontUIResource [UI] ++ h3.font [active] HelveticaNeue-Medium plain 16 javax.swing.plaf.FontUIResource [UI] + +- h3.regular.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] ++ h3.regular.font [active] Helvetica Neue plain 16 javax.swing.plaf.FontUIResource [UI] #---- h4 ---- 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 f6748391..d7271b5c 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt @@ -1390,8 +1390,11 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].h00 font: $h00.font [style].h0 font: $h0.font +[style].h1.regular font: $h1.regular.font [style].h1 font: $h1.font +[style].h2.regular font: $h2.regular.font [style].h2 font: $h2.font +[style].h3.regular font: $h3.regular.font [style].h3 font: $h3.font [style].h4 font: $h4.font [style].large font: $large.font @@ -1430,17 +1433,20 @@ h00.font [active] Segoe UI plain 36 javax.swing.plaf.Fo #---- h1 ---- -h1.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] +h1.font [active] Segoe UI Semibold plain 24 javax.swing.plaf.FontUIResource [UI] +h1.regular.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] #---- h2 ---- -h2.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] +h2.font [active] Segoe UI Semibold plain 18 javax.swing.plaf.FontUIResource [UI] +h2.regular.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] #---- h3 ---- -h3.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] +h3.font [active] Segoe UI Semibold plain 15 javax.swing.plaf.FontUIResource [UI] +h3.regular.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] #---- h4 ---- diff --git a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt index f0770dfc..a268b84e 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt @@ -1394,8 +1394,11 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].h00 font: $h00.font [style].h0 font: $h0.font +[style].h1.regular font: $h1.regular.font [style].h1 font: $h1.font +[style].h2.regular font: $h2.regular.font [style].h2 font: $h2.font +[style].h3.regular font: $h3.regular.font [style].h3 font: $h3.font [style].h4 font: $h4.font [style].large font: $large.font @@ -1434,17 +1437,20 @@ h00.font [active] Segoe UI plain 36 javax.swing.plaf.Fo #---- h1 ---- -h1.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] +h1.font [active] Segoe UI Semibold plain 24 javax.swing.plaf.FontUIResource [UI] +h1.regular.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] #---- h2 ---- -h2.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] +h2.font [active] Segoe UI Semibold plain 18 javax.swing.plaf.FontUIResource [UI] +h2.regular.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] #---- h3 ---- -h3.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] +h3.font [active] Segoe UI Semibold plain 15 javax.swing.plaf.FontUIResource [UI] +h3.regular.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] #---- h4 ---- diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.java index cc8a5f42..a528cf06 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.java @@ -437,6 +437,8 @@ public class FlatTypographyTest fontPreview2.setBaseSize(12); fontPreview2.setFontSize(24); fontPreview2.setFontType("H1"); + fontPreview2.setSemibold(true); + fontPreview2.setShowPlain(true); add(fontPreview2, "cell 0 6"); //---- fontPreview12 ---- @@ -510,6 +512,8 @@ public class FlatTypographyTest fontPreview3.setBaseSize(12); fontPreview3.setFontSize(18); fontPreview3.setFontType("H2"); + fontPreview3.setSemibold(true); + fontPreview3.setShowPlain(true); add(fontPreview3, "cell 0 7"); //---- fontPreview13 ---- @@ -583,6 +587,8 @@ public class FlatTypographyTest fontPreview4.setBaseSize(12); fontPreview4.setFontSize(15); fontPreview4.setFontType("H3"); + fontPreview4.setSemibold(true); + fontPreview4.setShowPlain(true); add(fontPreview4, "cell 0 8"); //---- fontPreview14 ---- @@ -1080,9 +1086,8 @@ public class FlatTypographyTest } private void updateFont() { - Font defaultFont = getBaseFont(); - previewLabel.setFont( defaultFont.deriveFont( bold ? Font.BOLD : Font.PLAIN, fontSize ) ); - preview2Label.setFont( defaultFont.deriveFont( Font.PLAIN, fontSize ) ); + previewLabel.setFont( getBaseFont().deriveFont( bold ? Font.BOLD : Font.PLAIN, fontSize ) ); + preview2Label.setFont( getDefaultFont().deriveFont( (float) fontSize ) ); } private void updateDescription() { @@ -1109,7 +1114,12 @@ public class FlatTypographyTest font = UIManager.getFont( "semibold.font" ); if( font == null ) - font = UIManager.getFont( "defaultFont" ); + font = getDefaultFont(); + return font; + } + + private Font getDefaultFont() { + Font font = UIManager.getFont( "defaultFont" ); if( font == null ) font = UIManager.getFont( "Label.font" ); return font; diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd index b928b42c..f9780885 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd @@ -335,6 +335,8 @@ new FormModel { "baseSize": 12 "fontSize": 24 "fontType": "H1" + "semibold": true + "showPlain": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 6" } ) @@ -430,6 +432,8 @@ new FormModel { "baseSize": 12 "fontSize": 18 "fontType": "H2" + "semibold": true + "showPlain": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 7" } ) @@ -525,6 +529,8 @@ new FormModel { "baseSize": 12 "fontSize": 15 "fontType": "H3" + "semibold": true + "showPlain": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 8" } ) 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 caa55b35..7d9af480 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 @@ -1067,8 +1067,11 @@ ViewportUI [style].h0 [style].h00 [style].h1 +[style].h1.regular [style].h2 +[style].h2.regular [style].h3 +[style].h3.regular [style].h4 [style].large [style].light @@ -1091,8 +1094,11 @@ desktop h0.font h00.font h1.font +h1.regular.font h2.font +h2.regular.font h3.font +h3.regular.font h4.font html.missingImage html.pendingImage