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

Free Support Forum - aspose.com

Is Font Hinting possible with ASPOSE?

Hi There,

We are evaluating to use several of the ASPOSE Java libs (cells, word, slides and pdf) on linux. We intend to use monotype fonts. However some of the fonts are not licensed to be used on Linux, and I was wondering if there is a way to 'hint' ASPOSE for a replacement font.

Thanks

umesh

Hi Umesh,

Thanks for your inquiry. Could you please share what exact you want to achieve by using Aspose.Words? We will then provide you more information about your query.

As of now, we are planing to use ASPOSE for conversion. Given a document (word, ppt, pdf xls), we would like to convert it to an image either to PNG or JPG format.

Thanks

umesh

Hi Umesh,

Thanks for sharing the detail. Aspose.Words supports True Type fonts during rendering Word documents to JPG, BMP, PNG EMF, TIFF, and SVG. Please read the list of features supported on

I am in communication with the development team and will update you as soon as I have information about mono type fonts.

Hi Umesh,


I am representing Aspose.Slides and like to share that you can generate the slide thumbnails using Aspose.Slides. Please visit this documentation link for your kind reference. However, I doubt that Aspose.Slides supports monotype fonts. I have created an issue with ID SLIDESJAVA-33955 as new feature request so that our development team may investigate the possibility of implementing the desired font support. This thread has been linked with the issue so that you may be automatically notified once the feature will be available.

Many Thanks,

Tahir & Mudassir,

Thanks for the response..

Just wanted to reiterate that my main question still is 'if ASPOSE has a mechanism to pass in font hints programatically in the API. When a font is not available on my Linux system, I should be able to programmatically pass in a fall back fornt that can be used.

I really would appreciate an answer for this specific question.

Thanks

umesh

Hi Umesh,


Thanks for the additional information.

When Aspose.Words renders a document (e.g. to PDF) it attempts to select the fonts that are specified by the document. However, there are situations when the exact font cannot be found on the machine and Aspose.Words must substitute a similar font instead. By default, Aspose.Words substitutes any missing fonts with '‘Times New Roman". However, you can supply a font of your choice as the default font to the Aspose.Words’ rendering engine by using FontSettings.DefaultFontName property. Aspose.Words then will use this default font name when Aspose.Words can’t find requested font in specified sources. The following example demonstrates how to specify what font to substitute for a missing font during rendering.
Document doc = new Document(“Rendering.doc”);

// If the default font defined here cannot be found during rendering then the closest font on the machine is used instead.
FontSettings.setDefaultFontName(“Arial Unicode MS”);

// Now the set default font is used in place of any missing fonts during any rendering calls.
doc.save(“Rendering.SetDefaultFont Out.pdf”);
doc.save(“Rendering.SetDefaultFont Out.xps”);

I hope, this helps.

Best regards,

Hi,


I would like to address your requirements/issue regarding Aspose.Cells. Similarly (as Awais mentioned for rendering Word documents to PDF format etc.), Aspose.Cells also allows the users to set default fonts, see the sample code below:

Sample code:


com.aspose.cells.Workbook workbook = new com.aspose.cells.Workbook(“f:/files/Book1.xls”);
//…

PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.setDefaultFont(“Lucida Sans”);
workbook.save(“f:/files/outReport.pdf”, saveOptions);

Thank you.

ugnaganhalli:
As of now, we are planing to use ASPOSE for conversion. Given a document (word, ppt, pdf xls), we would like to convert it to an image either to PNG or JPG format.

Hi Umesh,

Thanks for contacting support.

We have a component named Aspose.Pdf for .NET which supports the feature to render pages of PDF file as PNG/JPEG format. For further details, please visit

ugnaganhalli:
Just wanted to reiterate that my main question still is 'if ASPOSE has a mechanism to pass in font hints programatically in the API. When a font is not available on my Linux system, I should be able to programmatically pass in a fall back fornt that can be used.

Hi Umesh,

When PDF file is generated using Aspose.Pdf for .NET, if the font used in PDF file is not available over system where file is being accessed, the contents of file will be displayed in Times New Roman font. However you may consider embedding the fonts inside the PDF document so that if the target system does not have specified fonts installed, the contents will be displayed in appropriate font (substituted font).


In the event of any further query, please feel free to contact.

Hi Umesh,

ugnaganhalli:

Tahir & Mudassir,
Thanks for the response…
Just wanted to reiterate that my main question still is 'if ASPOSE has a mechanism to pass in font hints programatically in the API. When a font is not available on my Linux system, I should be able to programmatically pass in a fall back font that can be used.

In response to your above query regarding setting the font programtically for rendering, I like to share that Aspose.Slides for Java also offers to set the rendering font as in case of Aspose.Words or Aspose.Cells.

Please try using following sample code on your end to serve the purpose. Please share, if I may help you further in this regard.



LoadOptions lo = new LoadOptions(LoadFormat.Auto);
lo.setDefaultRegularFont(“DejaVu Serif”);
lo.setDefaultAsianFont(“DejaVu Serif”);
PresentationEx pres = new PresentationEx(“test.pptx”) ;
ImageIO.write(pres.getSlides().get_Item(0).getThumbnail(1, 1), “PNG”, new java.io.File(“testOut.png”));
pres.save(“testOut.pdf”,com.aspose.slides.SaveFormat.Pdf);
pres.save(“testOut.xps”,com.aspose.slides.SaveFormat.Xps);


Many Thanks,

The issues you have found earlier (filed as SLIDESJAVA-33955) have been fixed in this update.