Files
PdfPig/src/UglyToad.PdfPig/Fonts/CompactFontFormat/CompactFontFormatIndividualFontParser.cs

49 lines
1.7 KiB
C#
Raw Normal View History

2018-04-28 19:33:50 +01:00
namespace UglyToad.PdfPig.Fonts.CompactFontFormat
{
using Dictionaries;
2018-04-28 19:33:50 +01:00
internal class CompactFontFormatIndividualFontParser
{
private readonly CompactFontFormatIndexReader indexReader;
private readonly CompactFontFormatTopLevelDictionaryReader topLevelDictionaryReader;
private readonly CompactFontFormatPrivateDictionaryReader privateDictionaryReader;
2018-04-28 19:33:50 +01:00
public CompactFontFormatIndividualFontParser(CompactFontFormatIndexReader indexReader,
CompactFontFormatTopLevelDictionaryReader topLevelDictionaryReader,
CompactFontFormatPrivateDictionaryReader privateDictionaryReader)
2018-04-28 19:33:50 +01:00
{
this.indexReader = indexReader;
this.topLevelDictionaryReader = topLevelDictionaryReader;
this.privateDictionaryReader = privateDictionaryReader;
2018-04-28 19:33:50 +01:00
}
public void Parse(CompactFontFormatData data, string name, byte[] topDictionaryIndex, string[] stringIndex)
2018-04-28 19:33:50 +01:00
{
var individualData = new CompactFontFormatData(topDictionaryIndex);
2018-04-28 19:33:50 +01:00
var dictionary = topLevelDictionaryReader.Read(individualData, stringIndex);
2018-04-28 19:33:50 +01:00
var privateDictionary = new CompactFontFormatPrivateDictionary();
2018-04-28 19:33:50 +01:00
if (dictionary.PrivateDictionarySizeAndOffset.Item2 >= 0)
2018-04-28 19:33:50 +01:00
{
data.Seek(dictionary.PrivateDictionarySizeAndOffset.Item2);
2018-04-28 19:33:50 +01:00
privateDictionary = privateDictionaryReader.Read(data, stringIndex);
2018-04-28 19:33:50 +01:00
}
if (dictionary.CharSetOffset >= 0)
2018-04-28 19:33:50 +01:00
{
}
if (dictionary.CharStringsOffset >= 0)
2018-04-28 19:33:50 +01:00
{
data.Seek(dictionary.CharStringsOffset);
2018-04-28 19:33:50 +01:00
var index = indexReader.ReadDictionaryData(data);
2018-04-28 19:33:50 +01:00
}
}
}
}