Hi,
First of all: Thanks a lot for this great library!
It works like a charm and I had up to this time just one problem which follows:
I'm trying to embed a barcode font. If I do not embed the font everything works fine and the PDF is shown correctly on systems that have the barcode font installed.
When I try to embed the font, I get the following Debug.Assert:
Bug in checksum algorithm.
at IRefFontTable.PrepareForCompilation()
at FontImage.Compile()
at FontImage.CreateFontSubSet(Dictionary`2 glyphs, Boolean cidFont)
at PdfCIDFont.PrepareForSave()
at PdfType0Font.PrepareForSave()
at PdfFontTable.PrepareForSave()
at PdfDocument.PrepareForSave()
at PdfDocument.DoSave(PdfWriter writer)
at PdfDocument.Close()
// rest of stacktrace removed
The relevant code:
#if DEBUG
// Check the checksum algorithm
if (DirectoryEntry.Tag != TableTagNames.Head)
{
byte[] bytes = new byte[DirectoryEntry.PaddedLength];
Buffer.BlockCopy(this.irefDirectoryEntry.FontTable.fontImage.Bytes, this.irefDirectoryEntry.Offset, bytes, 0, DirectoryEntry.PaddedLength);
uint checkSum1 = DirectoryEntry.CheckSum;
uint checkSum2 = CalcChecksum(bytes);
Debug.Assert(checkSum1 == checkSum2, "Bug in checksum algorithm."); <== THIS ASSERT FIRES
}
#endif
It might be worth noting that TableTagNames.Head above contains "head" and DirectoryEntry.Tag contains "hhea" when this problem occurs.
BTW, embedding a normal font like "Times New Roman" works fine.
If you need anything more, please let me know!
Regards
Uwe
EDIT: One more addition: If I ignore the assertion above the font seems to be embedded fine (I was able to open the PDF successfully on a system without the barcode fonts and the barcodes where visible)
|