DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Five Java Developer Must-Haves for Ultra-Fast Startup Solutions
  • A Maven Story
  • How To Install CMAK, Apache Kafka, Java 18, and Java 19 [Video Tutorials]
  • Build a Java Backend That Connects With Salesforce

Trending

  • Doris: Unifying SQL Dialects for a Seamless Data Query Ecosystem
  • Revolutionizing Financial Monitoring: Building a Team Dashboard With OpenObserve
  • Segmentation Violation and How Rust Helps Overcome It
  • Chaos Engineering for Microservices
  1. DZone
  2. Coding
  3. Java
  4. The Font of All Knowledge About Java and Fonts

The Font of All Knowledge About Java and Fonts

Here's everything you need to know about fonts in the JDK.

By 
Simon Ritter user avatar
Simon Ritter
·
Mar. 18, 19 · Presentation
Likes (3)
Comment
Save
Tweet
Share
9.6K Views

Join the DZone community and get the full member experience.

Join For Free

duke-press

Around the middle of the 15th century, Johannes Gutenberg introduced the metal movable-type printing press. I think it would be easy to argue that this was one of the most significant inventions in history for enabling widespread access to information; something, today, we take very much for granted. The metal type pieces of Gutenberg’s press led to the development of both typography and fonts. Although the basic character shapes are the same, fonts allow us to render the same fundamental alphabet in different ways. The use of styles like bold and italics can further be used to highlight or emphasise parts of text. Although we no longer use metal type pieces, we still use fonts for text displayed on the screen for our applications and rely on font rendering to do this for us.

Java has always aimed to be as cross-platform as possible, leading to the famous “write once, run anywhere” slogan. Aside from the low-level fundamentals such as bytecodes and the JVM, this extends to how a graphical application looks on the screen.

Desktop operating systems all provide a range of fonts that can be used by applications to display text. However, there is no standard to ensure that the same fonts are supported across all possible platforms. To solve this problem, the Oracle JDK included a simple set of physical fonts; the idea being that, if you used only those fonts, your application text would look the same wherever you ran it. The fonts that were included were from the Lucida design family:

fonts1

One of the changes made in JDK 11 was the removal of these fonts. As part of the convergence of the Oracle JDK with the OpenJDK, the Oracle JDK also no longer uses the T2K rendering engine (described in the JDK 11 Migration Guide) that it had in the past.

The JDK now relies purely on the fonts available on the host platform and supports both TrueType and PostScript Type 1 fonts.

There are also five logical fonts:

  • Dialog
  • DialogInput
  • Monospaced
  • Serif
  • SansSerif

These are simply names that are guaranteed to exist on all platforms but map to underlying operating system fonts, which may differ from one platform to another and so may not render in the same way.

When migrating graphical applications from JDK 8 (or earlier) to JDK 11, the availability of physical fonts is something that you may need to check to ensure that the way your applications appear on the screen correctly.

To determine what fonts are supported on a given platform and available to a Java application is straightforward. An array of font names can be retrieved using the GraphicsEnvironment class:

String fonts[] = GraphicsEnvironment
  .getLocalGraphicsEnvironment()
  .getAvailableFontFamilyNames();


Azul’s Zulu JDK is built only from the OpenJDK source, so it does not include the physical fonts. For users who do require these fonts we have provided a separate download, the Zulu Commercial Compatibilty Kit (ZCCK). We have been doing this for JDK 6, 7, and 8 (download link) and now have a version available for JDK 11 (download link).

The four fonts that are included in the ZCCK are shown below:

fonts2

Under the terms of use, these fonts they are provided for internal use only, so may not be redistributed in any way. For further details, please read the license that comes with the Zulu CCK in full (which I’m sure everyone always does anyway).

The good news is that if you want to migrate to JDK 11 and continue to use the default physical fonts, then Zulu will be your choice of Java runtime.

Java (programming language) Java Development Kit application operating system

Published at DZone with permission of Simon Ritter, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Five Java Developer Must-Haves for Ultra-Fast Startup Solutions
  • A Maven Story
  • How To Install CMAK, Apache Kafka, Java 18, and Java 19 [Video Tutorials]
  • Build a Java Backend That Connects With Salesforce

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!