0

Is there any existing tool or library in the Java ecosystem that can handle variable fonts and allow me to read and modify their variable axes programmatically (with the aim of rendering the font)?

I have come across the TrueTypeFont class from the Apache PDFBox library, but it does not seem to provide direct methods for accessing and modifying the variable axes. Similarly, java.awt.Font offers a getAvailableAttributes() method but does not return any variable font axes.

micycle
  • 3,328
  • 14
  • 33
  • You can pass a [TextAttribute](https://docs.oracle.com/en/java/javase/20/docs/api/java.desktop/java/awt/font/TextAttribute.html) to [deriveFont](https://docs.oracle.com/en/java/javase/20/docs/api/java.desktop/java/awt/Font.html#deriveFont(java.util.Map)). For example, `Font semiBoldfont = font.deriveFont(Map.of(TextAttribute.WEIGHT, TextAttribute.WEIGHT_SEMIBOLD));`. Support for uncommon values seems to be lacking for a lot of attributes (perhaps only on some operating systems?). In theory, any attribute whose documented value type is Number or Integer should support a continuum of values. – VGR Jun 02 '23 at 11:42
  • Is there another term for _variable axes_? What part of the font does it describe? – Reilas Jun 02 '23 at 15:26
  • @Reilas Variable fonts can have any axis for any variable the type designer chooses (slant or weight for instance). – micycle Jun 02 '23 at 20:16

0 Answers0