How to load bold Italic font
Posted: Tue Jan 21, 2025 2:50 am
Hi,
I am trying to load Open Sans (https://fonts.google.com/specimen/Open+Sans) fonts file into the report designer (React web app). Below my code
My question here is how do I load font type Bold + Italic? There is no 'Stimulsoft.System.Drawing.FontStyle' enum option for loading font of type BoldItalic as highlighted in image.
Furthermore I tried loading only Regular, Bold & Italic fonts only but I am unable to format text in Bold & Italic style. When viewing the preview text will be rendered with regular style instead of bold + regular.
Cheers.
I am trying to load Open Sans (https://fonts.google.com/specimen/Open+Sans) fonts file into the report designer (React web app). Below my code
Code: Select all
import regularFont from '../../static/fonts/OpenSans-Regular.ttf';
import boldFont from '../../static/fonts/OpenSans-Bold.ttf';
import italicFont from '../../static/fonts/OpenSans-Italic.ttf';
import boldItalicFont from '../../static/fonts/OpenSans-BoldItalic.ttf';
const options = new Stimulsoft.Designer.StiDesignerOptions();
options.viewerOptions.exports.showExportToJson = true;
options.viewerOptions.email.showEmailDialog = false;
options.viewerOptions.toolbar.showBookmarksButton = false;
options.viewerOptions.toolbar.showSendEmailButton = false;
options.appearance.showSystemFonts = false;
options.toolbar.showFileMenu = false;
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(
regularFont,
'Open Sans',
Stimulsoft.System.Drawing.FontStyle.Regular,
);
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(
boldFont,
'Open Sans',
Stimulsoft.System.Drawing.FontStyle.Bold,
);
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(
italicFont,
'Open Sans',
Stimulsoft.System.Drawing.FontStyle.Italic,
);
// Below code in question
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile(
boldItalicFont,
'Open San',
Stimulsoft.System.Drawing.FontStyle.Italic,
);
Cheers.