Hi - we have a number a .ttf font files that are part of our project that we need to use, the client requirement is the fonts cannot be installed on the machine so we need to load them from the project folder. I've attempted to do this without success, in the instance below the font remains on the default and doesn't change to use our .ttf. Can you take a look at our code and let us know what the issue is, thanks.
var installationFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
var assetFolder = await installationFolder.GetFolderAsync("Assets");
var fontFolder = await assetFolder.GetFolderAsync("Fonts");
var stagMediumFontFile = await fontFolder.GetFileAsync(Constants.StagSansMediumPath);
var stagMediumFontFileStream = await stagMediumFontFile.OpenStreamForReadAsync();
PdfTextElement element = new PdfTextElement("Test Text);
var stagMediumFont = new PdfTrueTypeFont(stagMediumFontFileStream, 70);
element.Font = stagMediumFont;
element.Brush = new PdfSolidBrush(new PdfColor(32, 2, 78));
PdfLayoutResult result = element.Draw(page, new RectangleF(115, 260, page.Graphics.ClientSize.Width / 2, 200));
As you can see above, we are just getting a stream of the font file from the installation directory, then using that stream to create a PdfTrueTypeFont .. when I inspect the stagMediumFont variable it seems as the the font has been read correctly as the name and properties appear, but when the text is drawn on the screen it is not using the specified font.