mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-14 19:05:01 +08:00
make byte array input bytes behave correctly when seeking rather than forcing the consumer to work around it.
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
public static GlyphDataTable Load(TrueTypeDataBytes data, TrueTypeHeaderTable table, HeaderTable headerTable,
|
||||
IndexToLocationTable indexToLocationTable)
|
||||
{
|
||||
data.Seek(table.Offset - 1);
|
||||
data.Seek(table.Offset);
|
||||
|
||||
var offsets = indexToLocationTable.GlyphOffsets;
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
data.Seek(offsets[i] - 1 + table.Offset);
|
||||
data.Seek(offsets[i] + table.Offset);
|
||||
|
||||
var contourCount = data.ReadSignedShort();
|
||||
|
||||
|
@@ -87,7 +87,7 @@
|
||||
|
||||
public static HeaderTable Load(TrueTypeDataBytes data, TrueTypeHeaderTable table)
|
||||
{
|
||||
data.Seek(table.Offset - 1);
|
||||
data.Seek(table.Offset);
|
||||
var version = data.Read32Fixed();
|
||||
var fontRevision = data.Read32Fixed();
|
||||
var checkSumAdjustment = data.ReadUnsignedInt();
|
||||
|
@@ -99,7 +99,7 @@
|
||||
|
||||
public static HorizontalHeaderTable Load(TrueTypeDataBytes data, TrueTypeHeaderTable table)
|
||||
{
|
||||
data.Seek(table.Offset - 1);
|
||||
data.Seek(table.Offset);
|
||||
var majorVersion = data.ReadUnsignedShort();
|
||||
var minorVersion = data.ReadUnsignedShort();
|
||||
|
||||
|
@@ -29,7 +29,7 @@
|
||||
const short shortFormat = 0;
|
||||
const short longFormat = 1;
|
||||
|
||||
data.Seek(table.Offset - 1);
|
||||
data.Seek(table.Offset);
|
||||
|
||||
var format = headerTable.IndexToLocFormat;
|
||||
|
||||
|
@@ -32,7 +32,7 @@
|
||||
|
||||
public static BasicMaximumProfileTable Load(TrueTypeDataBytes data, TrueTypeHeaderTable table)
|
||||
{
|
||||
data.Seek(table.Offset - 1);
|
||||
data.Seek(table.Offset);
|
||||
|
||||
var version = data.Read32Fixed();
|
||||
var numberOfGlyphs = data.ReadUnsignedShort();
|
||||
|
@@ -81,7 +81,7 @@
|
||||
|
||||
public static PostScriptTable Load(TrueTypeDataBytes data, TrueTypeHeaderTable table, BasicMaximumProfileTable maximumProfileTable)
|
||||
{
|
||||
data.Seek(table.Offset - 1);
|
||||
data.Seek(table.Offset);
|
||||
var formatType = data.Read32Fixed();
|
||||
var italicAngle = data.Read32Fixed();
|
||||
var underlinePosition = data.ReadSignedShort();
|
||||
|
@@ -45,7 +45,7 @@
|
||||
|
||||
public void Seek(long position)
|
||||
{
|
||||
CurrentOffset = (int)position;
|
||||
CurrentOffset = (int)position - 1;
|
||||
CurrentByte = CurrentOffset < 0 ? (byte)0 : bytes[CurrentOffset];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user