internal void FillTables()
{
int[] table_location;
tables.TryGetValue("head", out table_location);
if (table_location == null)
throw new DocumentException(MessageLocalization.GetComposedMessage("table.1.does.not.exist.in.2", "head", fileName + style));
rf.Seek(table_location[0] + 16);
head.flags = rf.ReadUnsignedShort();
head.unitsPerEm = rf.ReadUnsignedShort();
rf.SkipBytes(16);
head.xMin = rf.ReadShort();
head.yMin = rf.ReadShort();
head.xMax = rf.ReadShort();
head.yMax = rf.ReadShort();
head.macStyle = rf.ReadUnsignedShort();
tables.TryGetValue("hhea", out table_location);
if (table_location == null)
throw new DocumentException(MessageLocalization.GetComposedMessage("table.1.does.not.exist.in.2", "hhea", fileName + style));
rf.Seek(table_location[0] + 4);
hhea.Ascender = rf.ReadShort();
hhea.Descender = rf.ReadShort();
hhea.LineGap = rf.ReadShort();
hhea.advanceWidthMax = rf.ReadUnsignedShort();
hhea.minLeftSideBearing = rf.ReadShort();
hhea.minRightSideBearing = rf.ReadShort();
hhea.xMaxExtent = rf.ReadShort();
hhea.caretSlopeRise = rf.ReadShort();
hhea.caretSlopeRun = rf.ReadShort();
rf.SkipBytes(12);
hhea.numberOfHMetrics = rf.ReadUnsignedShort();
tables.TryGetValue("OS/2", out table_location);
if (table_location == null)
throw new DocumentException(MessageLocalization.GetComposedMessage("table.1.does.not.exist.in.2", "OS/2", fileName + style));
rf.Seek(table_location[0]);
int version = rf.ReadUnsignedShort();
os_2.xAvgCharWidth = rf.ReadShort();
os_2.usWeightClass = rf.ReadUnsignedShort();
os_2.usWidthClass = rf.ReadUnsignedShort();
os_2.fsType = rf.ReadShort();
os_2.ySubscriptXSize = rf.ReadShort();
os_2.ySubscriptYSize = rf.ReadShort();
os_2.ySubscriptXOffset = rf.ReadShort();
os_2.ySubscriptYOffset = rf.ReadShort();
os_2.ySuperscriptXSize = rf.ReadShort();
os_2.ySuperscriptYSize = rf.ReadShort();
os_2.ySuperscriptXOffset = rf.ReadShort();
os_2.ySuperscriptYOffset = rf.ReadShort();
os_2.yStrikeoutSize = rf.ReadShort();
os_2.yStrikeoutPosition = rf.ReadShort();
os_2.sFamilyClass = rf.ReadShort();
rf.ReadFully(os_2.panose);
rf.SkipBytes(16);
rf.ReadFully(os_2.achVendID);
os_2.fsSelection = rf.ReadUnsignedShort();
os_2.usFirstCharIndex = rf.ReadUnsignedShort();
os_2.usLastCharIndex = rf.ReadUnsignedShort();
os_2.sTypoAscender = rf.ReadShort();
os_2.sTypoDescender = rf.ReadShort();
if (os_2.sTypoDescender > 0)
os_2.sTypoDescender = (short)(-os_2.sTypoDescender);
os_2.sTypoLineGap = rf.ReadShort();
os_2.usWinAscent = rf.ReadUnsignedShort();
os_2.usWinDescent = rf.ReadUnsignedShort();
os_2.ulCodePageRange1 = 0;
os_2.ulCodePageRange2 = 0;
if (version > 0) {
os_2.ulCodePageRange1 = rf.ReadInt();
os_2.ulCodePageRange2 = rf.ReadInt();
}
if (version > 1) {
rf.SkipBytes(2);
os_2.sCapHeight = rf.ReadShort();
}
else
os_2.sCapHeight = (int)(0.7 * head.unitsPerEm);
tables.TryGetValue("post", out table_location);
if (table_location == null) {
italicAngle = -Math.Atan2(hhea.caretSlopeRun, hhea.caretSlopeRise) * 180 / Math.PI;
return;
}
rf.Seek(table_location[0] + 4);
short mantissa = rf.ReadShort();
int fraction = rf.ReadUnsignedShort();
italicAngle = (double)mantissa + (double)fraction / 16384.0;
underlinePosition = rf.ReadShort();
underlineThickness = rf.ReadShort();
isFixedPitch = rf.ReadInt() != 0;
}