internal void Read() { try { int tableOffset = _fontData.Position; version = _fontData.ReadUShort(); numTables = _fontData.ReadUShort(); bool success = false; for (int idx = 0; idx < numTables; idx++) { PlatformId platformId = (PlatformId)_fontData.ReadUShort(); WinEncodingId encodingId = (WinEncodingId)_fontData.ReadUShort(); int offset = _fontData.ReadLong(); int currentPosition = _fontData.Position; // Just read Windows stuff. if (platformId == PlatformId.Win && (encodingId == WinEncodingId.Symbol || encodingId == WinEncodingId.Unicode)) { symbol = encodingId == WinEncodingId.Symbol; _fontData.Position = tableOffset + offset; cmap4 = new CMap4(_fontData, encodingId); _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 InvalidOperationException(PSSR.ErrorReadingFontData, ex); } }