mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-15 19:54:52 +08:00
#9 remove work in progress code for 0.0.5 release
This commit is contained in:
@@ -2,11 +2,8 @@
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using CidFonts;
|
||||
using CompactFontFormat;
|
||||
using Core;
|
||||
using Exceptions;
|
||||
using Filters;
|
||||
using Geometry;
|
||||
@@ -115,39 +112,39 @@
|
||||
var input = new TrueTypeDataBytes(new ByteArrayInputBytes(fontFile));
|
||||
return trueTypeFontParser.Parse(input);
|
||||
case DescriptorFontFile.FontFileType.FromSubtype:
|
||||
{
|
||||
if (!DirectObjectFinder.TryGet(descriptor.FontFile.ObjectKey, pdfScanner, out StreamToken str))
|
||||
{
|
||||
if (!DirectObjectFinder.TryGet(descriptor.FontFile.ObjectKey, pdfScanner, out StreamToken str))
|
||||
{
|
||||
throw new NotSupportedException("Cannot read CID font from subtype.");
|
||||
}
|
||||
|
||||
if (!str.StreamDictionary.TryGet(NameToken.Subtype, out NameToken subtypeName))
|
||||
{
|
||||
throw new PdfDocumentFormatException($"The font file stream did not contain a subtype entry: {str.StreamDictionary}.");
|
||||
}
|
||||
|
||||
if (subtypeName == NameToken.CidFontType0C)
|
||||
{
|
||||
var bytes = str.Decode(filterProvider);
|
||||
var font = compactFontFormatParser.Parse(new CompactFontFormatData(bytes));
|
||||
throw new NotSupportedException($"Unsupported subtype for CID font {subtypeName}. Font: {font}");
|
||||
}
|
||||
|
||||
if (subtypeName == NameToken.Type1C)
|
||||
{
|
||||
|
||||
}
|
||||
else if (subtypeName == NameToken.OpenType)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new PdfDocumentFormatException($"Unexpected subtype for CID font: {subtypeName}.");
|
||||
}
|
||||
|
||||
throw new NotSupportedException("Cannot read CID font from subtype.");
|
||||
}
|
||||
|
||||
if (!str.StreamDictionary.TryGet(NameToken.Subtype, out NameToken subtypeName))
|
||||
{
|
||||
throw new PdfDocumentFormatException($"The font file stream did not contain a subtype entry: {str.StreamDictionary}.");
|
||||
}
|
||||
|
||||
if (subtypeName == NameToken.CidFontType0C)
|
||||
{
|
||||
var bytes = str.Decode(filterProvider);
|
||||
var font = compactFontFormatParser.Parse(new CompactFontFormatData(bytes));
|
||||
return font;
|
||||
}
|
||||
|
||||
if (subtypeName == NameToken.Type1C)
|
||||
{
|
||||
|
||||
}
|
||||
else if (subtypeName == NameToken.OpenType)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new PdfDocumentFormatException($"Unexpected subtype for CID font: {subtypeName}.");
|
||||
}
|
||||
|
||||
throw new NotSupportedException("Cannot read CID font from subtype.");
|
||||
}
|
||||
default:
|
||||
throw new NotSupportedException("Currently only TrueType fonts are supported.");
|
||||
}
|
||||
@@ -259,7 +256,7 @@
|
||||
|
||||
private CharacterIdentifierSystemInfo GetSystemInfo(DictionaryToken dictionary)
|
||||
{
|
||||
if(!dictionary.TryGet(NameToken.CidSystemInfo, out var cidEntry))
|
||||
if (!dictionary.TryGet(NameToken.CidSystemInfo, out var cidEntry))
|
||||
{
|
||||
throw new InvalidFontFormatException($"No CID System Info was found in the CID Font dictionary: {dictionary}");
|
||||
}
|
||||
|
Reference in New Issue
Block a user