Report.JS custom font

Stimulsoft Reports.JS discussion
Ehsan
Posts: 100
Joined: Tue Jan 05, 2016 10:39 am
Location: Iran

Report.JS custom font

Post by Ehsan »

Hello,

How can I embed and use custom font in Report Js designer and viewer??
I did it by font name in mrt file, but it doesn't change fonts in print mode.
Please Help me how should I do it.

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Report.JS custom font

Post by HighAley »

Hello.

Yes, it's possible.

You could use next code to add custom font:

Code: Select all

Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(filePath: string, fontName: string = null)
Also you could try to use CSS:

Code: Select all

@font-face {
    font-family: myFirstFont;
    src: url(sansation_light.woff);
}
Thank you.
Ehsan
Posts: 100
Joined: Tue Jan 05, 2016 10:39 am
Location: Iran

Re: Report.JS custom font

Post by Ehsan »

Hello,

none of above code work,
first code require opentype library,
after adding that library to project,
it doesn't add any font file to Stimulsoft.Base.StiFontCollection ( Stimulsoft.Base.StiFontCollection.getFontFamilies() ).
and the font list in Report JS designer doesn't show any thing.

Thank you.
Attachments
font list of Report JS designer
font list of Report JS designer
Capture.PNG (16 KiB) Viewed 6756 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Report.JS custom font

Post by HighAley »

Hello.

There was no opentype library in our trial build. We have added it.
Also we have found a bug. The bug is fixed.
Please, check our next prerelease build on Friday.

Thank you.
Ehsan
Posts: 100
Joined: Tue Jan 05, 2016 10:39 am
Location: Iran

Re: Report.JS custom font

Post by Ehsan »

Hello,

So I cannot use this
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(filePath: string, fontName: string = null)
code in trial version?

or this issue already exist in project? Cause there is still Uncaught ReferenceError: opentype is not defined(…) error when I use above code.

Thank you!
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Report.JS custom font

Post by HighAley »

Hello.

Sorry, for the issue.
We have found a bug in our minified build.
We have made an improvement.
Please, check our next build on Friday.

Thank you.
Ehsan
Posts: 100
Joined: Tue Jan 05, 2016 10:39 am
Location: Iran

Re: Report.JS custom font

Post by Ehsan »

Hello,

Thank you for your efforts,
Sorry, there wasn't any prerelease build in Friday,
so which Friday exactly your prerelease build will be prepare?
thank you
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

Re: Report.JS custom font

Post by Andrew »

Hello,

The pre-release build will be today on Monday.

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Report.JS custom font

Post by HighAley »

Hello.

Sorry, the prerelease build was postponed for today.
It will be available in a few hours.

Thank you.
Ehsan
Posts: 100
Joined: Tue Jan 05, 2016 10:39 am
Location: Iran

Re: Report.JS custom font

Post by Ehsan »

Hello,

Thank you :_)
:(
Post Reply