Hi Praneeth,
Thanks for your feedback. Unfortunately, I have not understood this detail. It seems that your query is different from this detail. It would be great if you please share some more detail about your requirements.
PraneethS:
Our requirement is such that we want “C:\MyFonts\” to be
searched first and if a font is not found here then go to
“D:\Misc\Fonts\”. I mean we want to specify the order along
with the font folders to ensure the folders are visited in
the order we specified.
Please share what problem you want to solve using this feature. If you want to set the sources where Aspose.Words looks for TrueType fonts when rendering documents or embedding fonts, please use FontSettings.setFontsSources method. The following code demonstrates how to set
Aspose.Words to look for TrueType fonts in system folders as well as a
custom defined folder when scanning for fonts.
Document doc = new Document(getMyDir() + “Rendering.doc”);
// Retrieve the array of environment-dependent font sources that are searched by default. For example this will contain a “Windows\Fonts” source on a Windows machines.
// We add this array to a new ArrayList to make adding or removing font entries much easier.
ArrayList fontSources = new ArrayList(Arrays.asList(FontSettings.getFontsSources()));
// Add a new folder source which will instruct Aspose.Words to search the following folder for fonts.
FolderFontSource folderFontSource = new FolderFontSource(“C:\MyFonts\”, true);
// Add the custom folder which contains our fonts to the list of existing font sources.
fontSources.add(folderFontSource);
// Convert the Arraylist of source back into a primitive array of FontSource objects.
FontSourceBase[] updatedFontSources = (FontSourceBase[])fontSources.toArray(new FontSourceBase[fontSources.size()]);
// Apply the new set of font sources to use.
FontSettings.setFontsSources(updatedFontSources);
doc.save(getMyDir() + “Rendering.SetFontsFolders Out.pdf”);