Caricamento e estrazione di dati | Java

Carica il carattere CFF dal disco

Aspose.Font per API Java ti consente di aprire i file di carattere CFF nelle tue applicazioni Java. I file di carattere CFF archiviati su disco possono essere caricati utilizzando i seguenti passaggi.

1// For complete examples and data files, please go to https://github.com/aspose-font/Aspose.Font-for-Java
2String fileName = Utils.getDataDir() + "OpenSans-Regular.cff"; //Font file name with full path
3
4      FontDefinition fd = new FontDefinition(FontType.CFF, new FontFileDefinition("cff", new FileSystemStreamSource(fileName)));
5      CffFont ttfFont = (CffFont) Font.open(fd);
6      
7      System.out.println("Font has been loaded");

Carica il carattere CFF dall’array di byte

È inoltre possibile caricare i caratteri CFF dal flusso utilizzando il seguente campione di codice.

1// For complete examples and data files, please go to https://github.com/aspose-font/Aspose.Font-for-Java
2byte [] fontMemoryData = Utils.getInputFileBytes("OpenSans-Regular.cff");
3
4      FontDefinition fd = new FontDefinition(FontType.CFF, new FontFileDefinition("cff", new ByteContentStreamSource(fontMemoryData)));
5      CffFont ttfFont = (CffFont) Font.open(fd);
6      
7      System.out.println("Font has been loaded");

Have any questions about Aspose.Font?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.