Using MemoryFontSource as font substitution issue

Hello,

I work as a developer at a company where we are using the Aspose.PDF library. I’m reaching out because we’ve encountered a problem:

Our application operates in the cloud, and we’re restricted to using only one system font, which is Lucida Casual. Since we’re unable to install additional fonts, we’ve decided to use Aspose.Pdf.Text.FontRepository in conjunction with Aspose.Pdf.Text.MemoryFontSource:

byte[] fontData = <Font byte array> // suppose this is Helvetica.ttf
var fontSource = new Aspose.Pdf.Text.MemoryFontSource(fontData);
Aspose.Pdf.Text.FontRepository.Sources.Add(fontSource);
Aspose.Pdf.Text.FontRepository.ReloadFonts();

The first issue is when using the FindFont method.
The code:

Aspose.Pdf.Text.FontRepository.FindFont("Lucida Casual")

correctly returns a Font object for “Lucida Casual.” However, when we try:

Aspose.Pdf.Text.FontRepository.FindFont("Helvetica")

we get the exception “Font Helvetica was not found.”

The second issue presents itself during the conversion of a PDF, that uses Helvetica but doesn’t embed the font, into a PNG file. The resulting image lacks text. For the conversion, we employ the Aspose.Pdf.Devices.PngDevice with these settings:

Aspose.Pdf.Devices.ImageDevice imageDevice = new Aspose.Pdf.Devices.PngDevice(<page size>, <resolution>)
{
    TransparentBackground = false,
};
imageDevice.RenderingOptions.UseNewImagingEngine = true;
imageDevice.RenderingOptions.InterpolationHighQuality = true;
imageDevice.RenderingOptions.UseFontHinting = true;
imageDevice.Process(<page>, <output stream>);

My assessment is that fonts loaded into the Aspose.Pdf.Text.FontRepository as Aspose.Pdf.Text.MemoryFontSource aren’t being recognized for font substitution. I may be incorrect and would welcome your perspective. Thank you for considering my request.

Best regards,

Rok

2 Likes

@rokkovacic

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-56292

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@asad.ali

Thanks for opening the ticket. Do you have any information when the problem will be reviewed and assigned to technical person?

Best Regards, Rok

@rokkovacic

The ticket is logged under free support model and it will be prioritized on a first come first serve basis. As soon as its investigation is done, we will be able to share some ETA or updates with you. We will let you know once we have more news about it. Please spare us some time.