Not accepting Arial Font

Hi ,


I am using Aspose.pdf 3.1.0 java component

I have set text font as Arial and pdf.setUnicode();but font comes up on windows machine.

But on Linux its not picking up Arial font and showing default Times New Roman

I have tried all the option mentioned in below link but no luck so far.

Is there a way to get these fonts without setting font directory path explicitly.(I dont want to hardcode directory path explicitly)
text.getTextInfo().setTruetypeFontFileName(“/usr/share/fonts/arial/Arial.ttf”);
pdf.setTruetypeFontDirectoryPath(“/usr/share/fonts/arial/”);

Linux environment details-

java version “1.7.0_07”<o:p></o:p>

Java(TM) SE Runtime Environment (build 1.7.0_07-b10)

Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

Linux:"x86_64-redhat-linux-gnu"

Any suggestions will be helpful

Regards,
Ankit

Hi Ankit,


Thanks for contacting support and sorry for the delayed response.

I
have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as PDFJAVA-33186. We
will investigate this issue in details and will keep you updated on the status
of a correction. <o:p></o:p>

We apologize for your inconvenience.

Hi Nayyer ,


Is there any workaround for it . Could you tell us ETA for this.

Regards,
Ankit

Hi Ankit,


As we just have been able to notice this issue and at the moment, I might not be able to share the reasons of “Arial font not being used when using our component over Linux platform”. Nevertheless, as soon as we have made some progress towards the resolution of this issue, we would be more than happy to update you with the status of correction. Please be patient and spare us little time.

Hi Nayyer ,


Any updates on this or any work around for the time being

Regards,
Ankit

Hi Ankit,


Thanks for
your inquiry. I’m afraid we can’t provide you any workaround for the issue and I’ve verified the status of the issue and regret to share that
this issue is still unresolved and pending for analysis in the queue. However, I’ve requested the team for ETA and as soon as I get a feedback I’ll update you via this forum thread.


Sorry for the inconvenience faced.


Best Regards,

Hi,


Have you fixed this defect, is there nay workaround for this or its still an issue? Currently I am using 4.3.1 aspose.pdf version and still see this issue.

Regards,
Ankit

Hi Ankit,


Thanks for your patience.

We have further investigated the earlier reported issue and frankly speaking, We do not know where/how TrueType fonts maybe present on Linux (for different distributions, the paths are different) so for your particular case, you may consider using pdf.setTruetypeFontDirectoryPath("/usr/share/fonts/arial/");

[Java]

Pdf pdf = new Pdf();<o:p></o:p>

Section sec = pdf.getSections().add();

Text text = new Text("Hello World in Arial Font....");

sec.getParagraphs().add(text);

text.getTextInfo().setFontName("Arial");

pdf.setTruetypeFontDirectoryPath("/usr/share/fonts/arial/");

pdf.save(“Arial.pdf”);

Thanks for the reply.

I don't see pdf.setTruetypeFontDirectoryPath("/usr/share/fonts/arial/"); method in aspose.pdf 4.3.1 so used pdf.setTruetypeFontMapPath(/usr/share/fonts/arial/) method to set font directory path .

Is it necessary to provide font directory path explicitly, is there any other workaround?

Regards,
Ankit

Hi Ankit,


As shared earlier, as there are many Linux distributions, so we cannot be certain about the path of TryeType fonts present over particular instance, so in order to generate the correct output, you need to explicitly specify the TrueType font path.