We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

FontSettings.GetFontsFolders no longer available in 11.1

Try to upgrade to the latest & greatest version of Aspose.Words, and get compile error on the following.

FontSettings.GetFontsFolders().

What's the new API? Is it replaced with FontSettings.GetFontsSources()?

Looks like FontSettings.GetFontsSources() is NOT the replacement for FontSettings.GetFontsFolders().

How can we get fonts folders with 11.1?

Hi Tony,


Thanks for your inquiry.

FontSettings.GetFontsFolders() method is no longer a member of FontSettings class. Instead, we have introduced a new member named GetFontsSources that gets a copy of the array that contains the list of sources where Aspose.Words looks for TrueType fonts. These font sources can be of Aspose.Words.Fonts.FileFontSource, Aspose.Words.Fonts.FolderFontSource, Aspose.Words.Fonts.MemoryFontSource and Aspose.Words.Fonts.SystemFontSource types. Aspose.Words v11.1.0 has also introduced FontSourceBase Class which is an abstract base class for the above four classes that allow the user to specify various font sources.

Best Regards,

Is there still a way to get the fonts folders as before?

Loss of functionality?

Hi Tony,


Thanks for your inquiry. Sure, you can get a list of font folders by using the following code snippet:

var folderFonts = FontSettings.GetFontsSources().
Where(x => x.GetType().Equals((typeof(FolderFontSource))));

I hope, this will help.

Best Regards,

The x.GetType() returns FontSourceBase type, it won't be equal (typeof(FolderFontSource)).

I have following old VB code, and try your sugguestion, and not able to compile.

Dim fontFolders As New ArrayList(FontSettings.GetFontsFolders())

I might miss something. With the old API, I get “c:\windows\fonts” return. With the new API, it returns SystemFontSource. How can I get the font folder from the SystemFontSource

Why not have the FolderPath property in the FontSourceBase class?

Hi there,


Thanks for your inquiry.

Yes I see what you mean. There is currently no way to find the path of a system font source. I will discuss this problem with the appropriate developers and get back to you. I will also discuss a better way of finding the paths of the different font sources.

I will back to you as soon as there are any developments.

Thanks,

Hi there,


I have discussed your issues with the developers and we agree that there is some missing functionality here.

We have logged change requests for:
  • Making the path for SystemFontSource public so you can find the paths default font folders again.
  • Adding an enumeration for the different font sources so there will be no longer any need for the “is” keyword.

We will try to implement them as soon as possible.

Will these features satisfy all of your issues? Are you having any other troubles with the API?

Thanks,

I think that's great. Thanks for the help.

Just wonder if it's possible to restore the FontSettings.GetFontsFolders(), so we don't have to change our code. At this moment, we have to comment out our codes to use 11.1.

Hi


Thanks for your request. I think once the features mentioned by Adam are available you will not need this method.

Best regards,

Hey,

what is the correct way of adding a font folder with Aspose 11.1, the example from the documentation still use the getFontsFolders. And this method, whatever it might be, will it continue to function once the changes mentioned by Adam are implemented?

Regards,
Dragos

Hi Dragos,


Thanks for your inquiry. I think for now you can achieve this by using the following code snippet:

ArrayList fontSources = new ArrayList(FontSettings.GetFontsSources());

// Add your custom folder to the list.
fontSources.Add(new FolderFontSource(@“C:\MyFonts”, true));

// Convert the list into an array and pass it to the FontSettings class.
FontSettings.SetFontsSources((FontSourceBase[])fontSources.ToArray(typeof(FontSourceBase)));

I hope, this will help.

Best Regards,

Hi Dragos,


Thanks for your inquiry.

To answer your other question, the code used to set font folders will stay the same even after the issues linked to this thread are fixed. There will be one fix at the end of the month which will introduce a FontSourceType enumeration to make enumerating these sources easier.

Thanks,

The issues you have found earlier (filed as WORDSNET-6071) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.