This example shows how to add font to resource for reports. First, Use getFile() method to load font file. After that, use StiResource() method to add it to resource:
<script type="text/javascript">
	var designer = new Stimulsoft.Designer.StiDesigner(null, "StiDesigner", false);
	var report = new Stimulsoft.Report.StiReport();

	var fileContent = Stimulsoft.System.IO.File.getFile("../reports/Roboto-Black.ttf", true);
	var resource = new Stimulsoft.Report.Dictionary.StiResource("Roboto-Black", "Roboto-Black", false, Stimulsoft.Report.Dictionary.StiResourceType.FontTtf, fileContent);

	var page = report.pages.getByIndex(0);

	//Create text component
	var dataText = new Stimulsoft.Report.Components.StiText();
	dataText.clientRectangle = new Stimulsoft.System.Drawing.Rectangle(1, 1, 3, 2);
	dataText.text = "Sample Text";
	dataText.font = new Stimulsoft.System.Drawing.Font("Roboto-Black");
	dataText.border.side = Stimulsoft.Base.Drawing.StiBorderSides.All;

	page.components.add(dataText); = report;

In the screenshot below you can see the result of the sample code:

Adding a Font to the Resource

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.