Free Support Forum - aspose.com

Is there a way to list all fonts in available in the FontRepository?

I know findFont but that requires you have the font name … I want to get the list that is installed already.

@jezerinac,

The following Java code should help:

GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
String[] families = ge.getAvailableFontFamilyNames();
for (String family : families)
    System.out.println(family); 

If your question is not related to any Aspose API, then we suggest you please search the web to find answers to your general (non-Aspose APIs related) questions.

font name obtained by this way pass to FontRepository.findFont ,many of these cause a FontNotFoundException

@liu9527

We are checking it and will get back to you shortly.

@liu9527

We have tested the scenario in our environment after installing the font “Microsoft Yahei” and above line of code returned correct name of the font. Would you please make sure that you have installed the font where you are using the API. In case you still face any issue, please share your complete environment details i.e. OS Name and Version, Application Type, API Version, etc. We will again test the scenario in our environment and address it accordingly.