Font Problem

Stimulsoft Reports.PHP discussion
Post Reply
PeterB
Posts: 5
Joined: Thu Sep 26, 2019 4:04 pm

Font Problem

Post by PeterB »

Hello,

I am at the beginning of a migration process from Reports.PHP 2016 (Flash) to the latest version of Reports.PHP, using the JS-part of it (because of the soon coming deprecation of Flash).

Contrary to the old, Flash-based version(s) I ran into a font problem.
The standard fonts of my company are "DejaVu Sans Condensed" and "DejaVu Sans Extralight". These fonts are installed locally as well as on the server (Debian, Version 8 as far as I remember, Apache 2.4.10, PHP 5.6.40). Both, designer and the standalone version of Stimulsoft Designer are offering only "DejaVu Sans" in their font selectors. I am talking about the Mac version, Ican't tell if the Windows version of Stimulsoft Designer is suffering from the same.

If I haven't mis-configured something a bug fix would be very nice. Otherwise I would appreciated any help. Using another easy recognizable font and then loading the ready designed report into a text editor, in order to replace that font with the preferrable one is a workaround but not very handy.

Many thanks in advance.
Peter
Lech Kulikowski
Posts: 6271
Joined: Tue Mar 20, 2018 5:34 am

Re: Font Problem

Post by Lech Kulikowski »

Hello,

You can add necessary fonts with the following code:
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile("data/arial.ttf", "Arial");

The async method for MacOS was added in the 2017.1.8 buld:
static addOpentypeFontFileAsync(callback: Function, filePath: string, fontName: string = null)

Thank you.
PeterB
Posts: 5
Joined: Thu Sep 26, 2019 4:04 pm

Re: Font Problem

Post by PeterB »

Hello Lech,

thank you, sounds easy. Can you please tell me which file I have to modify? I tried this with my "designer.php" - the result is a blank, white page:

<script type="text/javascript">
Stimulsoft.Base.StiLicense.loadFromFile("stimulsoft/license.php");
Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile("localization/de.xml");

Stimulsoft.Base.StiFontCollection.addOpentypeFontFile("data/DejaVuSansCondensed.ttf", "DejaVu Sans Condensed");

...

Thank you.
PeterB
Posts: 5
Joined: Thu Sep 26, 2019 4:04 pm

Re: Font Problem

Post by PeterB »

I figured out that it works when I convert the font from ttf to otf.
Andrew
Posts: 4107
Joined: Fri Jun 09, 2006 3:58 am

Re: Font Problem

Post by Andrew »

Okay, thank you for this information.
Post Reply