Is there any Java API to get the font name from a font file (TTF)?
Sure, the java.awt.Font
class will handle this task just fine. Here's how:
Font f = Font.createFont(Font.TRUETYPE_FONT, new FileInputStream("font.ttf"));
String name = f.getName();
(I tried it on one of the ttf-fonts on my system and it works as intended.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With