Using a Custom Font
Our sample projects and report templates can help you learn the basics of working with our products.Fonts can also be supplied to the whole engine rather than stored in the report. This example registers a TTF file with the global font collection.
Registering the resource. Load or register the external resource before rendering so the finished report remains portable across environments.
Registering the resource. Load or register the external resource before rendering so the finished report remains portable across environments.
@Component({
selector: "using-custom-font",
imports: [Designer],
template: `<sti-designer [(report)]="report" [options]="designerOptions"></sti-designer>`
})
export class UsingCustomFont {
report: Stimulsoft.Report.StiReport;
designerOptions: Stimulsoft.Designer.StiDesignerOptions;
constructor() {
this.report = new Stimulsoft.Report.StiReport();
this.report.loadFile("Reports/CusomFontSimpleList.mrt");
// Adding Custom Font
Stimulsoft.Base.StiFontCollection.addFontFile('Fonts/LongCang-Regular.ttf');
this.designerOptions = new Stimulsoft.Designer.StiDesignerOptions();
this.designerOptions.appearance.fullScreenMode = true;
}
}StiFontCollection.addFontFile makes the font available for rendering and export across all reports, without embedding it into a specific template.