Unable to add OTF font to StiFontCollection

Stimulsoft Reports.NET discussion
Post Reply
JoshS
Posts: 12
Joined: Thu Aug 11, 2022 4:38 am

Unable to add OTF font to StiFontCollection

Post by JoshS »

Hi,

Have tried a number of different ways to try and add an OTF font to StiFontCollection, eg.

StiFontCollection.AddFontFile($"/path/to/font.otf");
StiFontCollection.AddFontBytes();
StiFontCollection.AddResourceFont();

None of these add the font to the collection if it's an OTF (collection is empty).

If I switch to a TTF of the same font, it is added successfully when using all of the 3 methods above. This is using
Stimulsoft.Base, Version=2022.3.4.0 from stimulsoft.reports.engine.netcore\2022.3.4\lib\netstandard2.1\Stimulsoft.Base.dll

Here is an example font I am trying to use:
https://github.com/googlefonts/noto-cjk ... c-Bold.otf
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Unable to add OTF font to StiFontCollection

Post by Lech Kulikowski »

Hello,

In version 2022.3.x a new build Stimulsoft.System.Drawing was added to our NetCore libraries.
This is an implementation of System.Drawing for non-Windows systems, as starting from Net6 this assembly is officially not supported (for non-Windows systems).
You can switch between this and the standard library using the Stimulsoft.Drawing.Graphics.GraphicsEngine property, possible values ImageSharp and Gdi.

Currently do not support OpenType fonts with CFF tables, will try to add in next builds.
For now the solution is only for Windows - set GraphicsEngine = Gdi;
for other systems, use TTF fonts.

Thank you.
JoshS
Posts: 12
Joined: Thu Aug 11, 2022 4:38 am

Re: Unable to add OTF font to StiFontCollection

Post by JoshS »

Thank you, look forward to seeing OTF support in future build if possible.
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Unable to add OTF font to StiFontCollection

Post by Lech Kulikowski »

Hello,

You are welcome.
Post Reply