When embedding and using Gotham Narrow (OTF), Acrobat complains that the font cannot be found. I can use other fonts.
Here’s the error in Adobe Acrobat Pro DC:
Cannot find or create teh font ‘GothamNarrow-Light’. Some characters may not display or print correctly.
Aspose.PDF .NET 18.8.0
C#:
Font regularFont;
string regularPath = Path.Combine(fontsPath, "GothamNarrow-Light.OTF");
if (!File.Exists(regularPath))
{
throw new FileNotFoundException("Font file not found. ", regularPath);
}
using (var stream = new FileStream(regularPath, FileMode.Open, FileAccess.Read))
{
regularFont = FontRepository.OpenFont(stream, FontTypes.OTF);
regularFont.IsEmbedded = true;
regularFont.IsSubset = false;
}
var paragraph = new TextState
{
FontSize = 11,
ForegroundColor = Color.FromCmyk(c: .7, m: .68, y: .64, k: .74),
Font = regularFont,
LineSpacing = 4.5f
};
var doc = new Document();
var page = doc.Pages.Add();
var text = new TextFragment($"{methodName} created on {DateTime.Now}");
text.TextState.ApplyChangesFrom(paragraph);
page.Paragraphs.Add(text);
I tried both OTF and TTF files. Get them here: