internal void Read()
{
try
{
int tableOffset = this.fontData.Position;
this.version = this.fontData.ReadUShort();
this.numTables = this.fontData.ReadUShort();
bool success = false;
for (int idx = 0; idx < this.numTables; idx++)
{
PlatformId platformId = (PlatformId)this.fontData.ReadUShort();
WinEncodingId encodingId = (WinEncodingId)this.fontData.ReadUShort();
int offset = this.fontData.ReadLong();
int currentPosition = this.fontData.Position;
// Just read Windows stuff
if (platformId == PlatformId.Win && (encodingId == WinEncodingId.Symbol || encodingId == WinEncodingId.Unicode))
{
this.symbol = encodingId == WinEncodingId.Symbol;
this.fontData.Position = tableOffset + offset;
this.cmap4 = new CMap4(this.fontData, encodingId);
this.fontData.Position = currentPosition;
// We have found what we are looking for, so break.
success = true;
break;
}
}
if (!success)
throw new InvalidOperationException("Font has no usable platform or encoding ID. It cannot be used with PDFsharp.");
}
catch (Exception ex)
{
throw new PdfSharpException(PSSR.ErrorReadingFontData, ex);
}
}
}