font

Stimulsoft Reports.JS discussion
Post Reply
fabien
Posts: 23
Joined: Thu Jul 15, 2021 9:07 am

font

Post by fabien »

Hi,

in post viewtopic.php?f=27&t=59481&hilit=addOpentypeFontFile, this code is mandatory when export to pdf in node.js :

Code: Select all

Stimulsoft.Base.StiFontCollection.addOpentypeFontFile("Roboto-Black.ttf");
in designer, i don't use this font : i use arial font. nevertheless the font used in the pdf export seems to be arial.
Are the system font loaded in Node.js by default ?
Do we have to load them ?

in article https://stimulsoft.zendesk.com/hc/en-us ... PDF-export :

"Update 2020.1.2:

It's possible to load necessary font files from a folder. It's working in node.js only.

Code: Select all

Stimulsoft.Base.StiFontCollection.setOpentypeFontsFolder("/System/Library/Fonts");
"
If we use this option, should we also use this line ?

Code: Select all

Stimulsoft.Base.StiFontCollection.addOpentypeFontFile("Roboto-Black.ttf");
in this article, an example of creating a report from the JavaScript code : https://stimulsoft.zendesk.com/hc/en-us ... ript-code-

Can i have a code sample to change the font (size, bold, italic) on a StiText component ?

Thanks,

Fabien.
Lech Kulikowski
Posts: 6163
Joined: Tue Mar 20, 2018 5:34 am

Re: font

Post by Lech Kulikowski »

Hello,

Sorry, maybe we did not exactly understand your question. Could you explain what issue do you have with fonts?

Thank you.
fabien
Posts: 23
Joined: Thu Jul 15, 2021 9:07 am

Re: font

Post by fabien »

Hello,

ok, I will try to be clearer.

We use nodejs to produce a PDF export with report and data.
The line below is mandatory to calculate Texts width.

Code: Select all

Stimulsoft.Base.StiFontCollection.addOpentypeFontFile("Roboto-Black.ttf");
But in design, we don't to use for example Roboto-Black.ttf font.
We need for example "Arial" font.

How to do this ?
We must call "Stimulsoft.Base.StiFontCollection.addOpentypeFontFile" with all font used in report ?

or is it enough to call the line below for all fonts to be saved ?

Code: Select all

Stimulsoft.Base.StiFontCollection.setOpentypeFontsFolder("/System/Library/Fonts");
In Debian, Are there any fonts already registered in system ?

Thanks,

Fabien.
Lech Kulikowski
Posts: 6163
Joined: Tue Mar 20, 2018 5:34 am

Re: font

Post by Lech Kulikowski »

Hello Fabien,

> We must call "Stimulsoft.Base.StiFontCollection.addOpentypeFontFile" with all font used in report ?

You must either load each font individually which is used in your reports with addOpentypeFontFile() or put all fonts in one folder and setOpentypeFontsFolder() so that all fonts from this folder are loaded at once.

> or is it enough to call the line below for all fonts to be saved ?
> Stimulsoft.Base.StiFontCollection.setOpentypeFontsFolder("/System/Library/Fonts");

We do not recommend doing this, all downloaded fonts remain in memory, if there are a lot of them in the system folder - and long loading, and a lot of memory space is taken. we do not say exactly how in linux, but on Windows a typical size of the fonts folder - 300-500 mb.

Thank you.
fabien
Posts: 23
Joined: Thu Jul 15, 2021 9:07 am

Re: font

Post by fabien »

Hi,
thanks.

We installed the version on another server. it's a Debian 10.
There is an Issue in generated pdf: characters are printed above each other.

however, the next line is well called :

Code: Select all

Stimulsoft.Base.StiFontCollection.addOpentypeFontFile("fonts/Roboto-Black.ttf");
Roboto-Black.ttf is in fonts subfolder and rights seems ok.

In another server (Debian 9), with same code, it works.
I don't understand what's wrong.

Do we need to install a package to make it work ?

if i use line above (Stimulsoft.Base.StiFontCollection.addOpentypeFontFile...) to render report, but i use Arial font in report, Does it work?

Thanks,

Fabien.
Lech Kulikowski
Posts: 6163
Joined: Tue Mar 20, 2018 5:34 am

Re: font

Post by Lech Kulikowski »

Hello,

Please try to load the Arial font also.

Thank you.
fabien
Posts: 23
Joined: Thu Jul 15, 2021 9:07 am

Re: font

Post by fabien »

Hi,

it works when I call the function "addOpentypeFontFile" with the absolute path of the font.
On Debian 9 machine, it works with relative path.
It's strange...

Thanks,

Fabien.
Lech Kulikowski
Posts: 6163
Joined: Tue Mar 20, 2018 5:34 am

Re: font

Post by Lech Kulikowski »

Hello,

Unfortunately, we can not say anything about that issue on Debian.

Thank you.
Post Reply