How to use Noto fonts in AWS Lambda using Java

Hi,

Do you have some recomendation how to handle 2GB of Noto fonts, stored in Amazon S3, when running Aspose Word in an AWS Lambda?

Scenario.
We are looking for a way to load font information on-demand when we are running our Aspose word code in an AWS Lambda.

The Noto fonts are stored in a Amazon S3 bucket.

The idea was to register the font names when the lambda starts and then just load the necessary fonts on-demand from Amazon S3 using the StreamFontSource.

The StreamFontSource class have some unresolved issues (Derive Java Class from StreamFontSource & Implement openFontDataStream() method to Use Stream Font Source) that prevents us from moving further.

If our approach is correct, is there something we need to think about regarding the cold start of the lambda? if we need to initialize something in the lambda constructor etc.

Regards
Tobias

@tobias.sohl

Unfortunately, Aspose.Words does not support the requested feature at the moment. However, we have logged this feature request as WORDSNET-20174 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

2 posts were split to a new topic: How to create a cloud solution

@tobias.sohl

Currently Aspose.Words has to load and parse all available fonts to get the search info (font family name, style etc) first time; the fonts are required for the document processing. The cache of font search info is stored in the FontSetting instance. So cold start of the lambda function will anyway require significant amount of time to load and parse all 2GB Noto fonts. To improve the performance you could store the FontSettings instance in the lambda context (static FontSettings.DefaultInstance). In this case loading all fonts will be required only when lambda context is disposed and have to be recreated.

To improve the performance in this case we could try to implement a feature to store font search info cache into external file. The use of this feature in your case will be like this:

  • Prepare font environment (i.e. load all required fonts into S3 bucket).
  • Setup FontSettings instance font sources to use the prepared font environment (i.e. pass StreamFontSource for each font file in S3) and then save font search info cache.
  • When calling lambda function, setup FontSettings instance font sources the same way and load the stored font search info cache. This way Aspose.Words will not parse all the available font and will load only fonts required for document processing.

Please let us know if this solution will help you. We will then create new feature for your case.

The issues you have found earlier (filed as WORDSNET-20174) have been fixed in this Aspose.Words for .NET 20.10 update and this Aspose.Words for Java 20.10 update.