Registering a Fonts Folder
Our sample projects and report templates can help you learn the basics of working with our products.Register the required resource in JavaScript so the report renders consistently in every environment.
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.
// Describe each custom font by name, style and file path
const myFontCollection = [
{ fontName: 'Long Cang', fontStyle: 'Regular', fontPath: '../Fonts/LongCang-Regular.ttf' },
{ fontName: 'Noto Sans SC', fontStyle: 'Regular', fontPath: '../Fonts/NotoSansSC-Regular.ttf' },
{ fontName: 'Stick', fontStyle: 'Regular', fontPath: '../Fonts/Stick-Regular.ttf' },
];
// Register the whole collection at once
Stimulsoft.Base.StiFontCollection.registerFontConfig(myFontCollection);
var designer = new Stimulsoft.Designer.StiDesigner(null, 'StiDesigner', false);
designer.renderHtml('content');
var report = new Stimulsoft.Report.StiReport();
designer.report = report;registerFontConfig takes an array describing each font's name and file path, making all of them available to reports at once. This is convenient when your application ships a whole family of custom fonts.