Product: PDFNet Dynamic Link Library for .NET 4.5.1 and above
Product Version: 11.12.8.6892
Please give a brief summary of your issue: pdftron.PDF.Font.GetWidth() returns 0 for some characters.
Please describe your issue and provide steps to reproduce it: We are trying to use the pdftron.PDF.Font.GetWidth() method to determine the character width / advance on certain characters. When we use it using the “built-in” fonts, some characters (like the smart quote characters such as Unicode 8220 “Left Double Quotation Mark: “) we get back 0 (instead of a valid width).
We tried marking the font as “embedded” as well, and get the same result.
Please provide a link to a minimal sample where the issue is reproducible:
pdftron.PDFNet.Initialize(LICENSE_KEY);
pdftron.PDF.PDFDoc doc = new pdftron.PDF.PDFDoc();
pdftron.PDF.Font font = pdftron.PDF.Font.Create(doc, type: pdftron.PDF.Font.StandardType1Font.e_helvetica);
foreach (char c in new char [] { 'A', '“', '§' })
{
double width = font.GetWidth(char_code: (int)c);
System.Console.WriteLine($"font.GetWidth('{c}') = {width}");
}
Produces:
PDFNet is running in demo mode.
PackageV2: base
font.GetWidth(‘A’) = 667
font.GetWidth(‘"’) = 0
font.GetWidth(‘’) = 556