Embedding a font as a report resource makes the template self-contained: it renders with the same typography on every machine, even where the font is not installed.

Register the font as a resource. Read the .ttf bytes and add them to the report dictionary:
var fileContent = File.ReadAllBytes("Fonts/Roboto-Black.ttf");
var resource = new StiResource("Roboto-Black", "Roboto-Black", false,
    StiResourceType.FontTtf, fileContent, false);
report.Dictionary.Resources.Add(resource);
Add it to the font collection. This lets the rendering engine resolve the font by name:
StiFontCollection.AddResourceFont(resource.Name, resource.Content, "ttf", resource.Alias);
Use the font. Reference it by family name on any component:
var text = new StiText(new RectangleD(1, 1, 3, 2));
text.Text = "Sample Text";
text.Font = StiFontCollection.CreateFont("Roboto-Black", 12, FontStyle.Regular);

How it works. Because the font travels inside the .mrt template, previews, prints and PDF/HTML exports all use the exact same glyphs — no environment-specific substitution.

Используя этот сайт, вы соглашаетесь на использование файлов Cookie для аналитики и персонализированного контента. Файлы Cookie хранят полезную информацию на вашем компьютере, чтобы помочь нам повысить эффективность и удобство использования. Для получения дополнительной информации, пожалуйста, прочтите Конфиденциальность и Использование Cookie.