Fonts: support specifying preferred font family for easy using another font (e.g. Inter) for all components

This commit is contained in:
Karl Tauber
2022-05-31 11:26:17 +02:00
parent 92cd6f8f34
commit ec77746a43
7 changed files with 208 additions and 14 deletions

View File

@@ -15,7 +15,8 @@ License:
How to install?
---------------
Invoke the `install()` method once in your `main()` method (on AWT thread):
Invoke the `install()` method once (e.g. in your `main()` method; on AWT
thread):
~~~java
FlatJetBrainsMonoFont.install();
@@ -25,6 +26,14 @@ FlatJetBrainsMonoFont.install();
How to use?
-----------
Use as default monospaced font:
~~~java
FlatLaf.setPreferredMonospacedFontFamily( FlatJetBrainsMonoFont.FAMILY );
~~~
Create fonts:
~~~java
// basic styles
new Font( FlatJetBrainsMonoFont.FAMILY, Font.PLAIN, 12 );
@@ -37,6 +46,10 @@ new Font( FlatJetBrainsMonoFont.FAMILY, Font.BOLD | Font.ITALIC, 12 );
Download
--------
Not yet available.
<!--
FlatLaf Fonts binaries are available on **Maven Central**.
If you use Maven or Gradle, add a dependency with following coordinates to your
@@ -49,3 +62,5 @@ build script:
Otherwise download `flatlaf-fonts-jetbrains-mono-<version>.jar` here:
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.formdev/flatlaf-fonts-jetbrains-mono/badge.svg?style=flat-square&color=007ec6)](https://maven-badges.herokuapp.com/maven-central/com.formdev/flatlaf-fonts-jetbrains-mono)
-->

View File

@@ -14,11 +14,11 @@
* limitations under the License.
*/
// Version format: <font-version>-<build-number>
// Version format: <font-version>[-<build-number>]
// For maven compatibility, <font-version> should be in format <major>.<minor>[.<micro>].
// <build-number> is usually '1' and should be incremented only if a new release is
// <build-number> is optional and should be incremented only if a new release is
// necessary, but the <font-version> has not changed.
version = "2.242-1"
version = "2.242"
plugins {
`java-library`

View File

@@ -27,6 +27,24 @@ import java.io.InputStream;
* <p>
* Font home page: <a href="https://www.jetbrains.com/mono">https://www.jetbrains.com/mono</a><br>
* GitHub project: <a href="https://github.com/JetBrains/JetBrainsMono">https://github.com/JetBrains/JetBrainsMono</a>
* <p>
* To install the font, invoke following once (e.g. in your {@code main()} method; on AWT thread):
* <pre>{@code
* FlatJetBrainsMonoFont.install();
* }</pre>
* <p>
* Use as default monospaced font:
* <pre>{@code
* FlatLaf.setPreferredMonospacedFontFamily( FlatJetBrainsMonoFont.FAMILY );
* }</pre>
* <p>
* Create fonts:
* <pre>{@code
* new Font( FlatJetBrainsMonoFont.FAMILY, Font.PLAIN, 12 );
* new Font( FlatJetBrainsMonoFont.FAMILY, Font.ITALIC, 12 );
* new Font( FlatJetBrainsMonoFont.FAMILY, Font.BOLD, 12 );
* new Font( FlatJetBrainsMonoFont.FAMILY, Font.BOLD | Font.ITALIC, 12 );
* }</pre>
*
* @author Karl Tauber
*/