Font-related utilities.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
The list of all supported features. -
Method Summary
Modifier and TypeMethodDescriptionderiveFontWithFeatures
(Font font, String... features) getAvailableFeatures
(Font font) This method returns a set of OpenType features supported by the given fontString[]
getEnabledFeatures
(Font font) This method returns an array of features for the given font, set viaderiveFontWithFeatures(java.awt.Font, java.lang.String...)
.Get subpixel resolution for rendering text with greyscale antialiasing, set with-Djava2d.font.subpixelResolution=NxM
, with integers between 1 and 16 instead of N and M.
-
Method Details
-
deriveFontWithFeatures
This method derives a newFont
object with a set of features. Feature syntax is<name>
or<name>=<int>
, likekern
, oraalt=2
. This method does not preserve features of the original font, they are completely overridden, if you need to append features to the font, usegetEnabledFeatures(Font)
.- Parameters:
font
- basic fontfeatures
- set of OpenType's features- Returns:
- new font
-
getEnabledFeatures
This method returns an array of features for the given font, set viaderiveFontWithFeatures(java.awt.Font, java.lang.String...)
. Feature syntax is<name>
or<name>=<int>
, likekern
, oraalt=2
.- Parameters:
font
- the font- Returns:
- an array of features for the font
-
getAvailableFeatures
This method returns a set of OpenType features supported by the given font- Parameters:
font
- the font- Returns:
- set of supported features
-
getSubpixelResolution
Dimension getSubpixelResolution()Get subpixel resolution for rendering text with greyscale antialiasing, set with-Djava2d.font.subpixelResolution=NxM
, with integers between 1 and 16 instead of N and M. This only affects text rendered via glyph cache. Value of NxM means that each glyph has rasterized images for N distinct positions horizontally and M positions vertically. This effectively increases quality of glyph spacing in each direction at the cost of N*M times increased memory consumption.- Returns:
- subpixel resolution (N, M)
-