private void ReadBbox()
{
int[] tableLocation;
tables.TryGetValue("head", out tableLocation);
if (tableLocation == null)
throw new DocumentException(MessageLocalization.GetComposedMessage("table.1.does.not.exist.in.2", "head", fileName + style));
rf.Seek(tableLocation[0] + TrueTypeFontSubSet.HEAD_LOCA_FORMAT_OFFSET);
bool locaShortTable = (rf.ReadUnsignedShort() == 0);
tables.TryGetValue("loca", out tableLocation);
if (tableLocation == null)
return;
rf.Seek(tableLocation[0]);
int[] locaTable;
if (locaShortTable) {
int entries = tableLocation[1] / 2;
locaTable = new int[entries];
for (int k = 0; k < entries; ++k)
locaTable[k] = rf.ReadUnsignedShort() * 2;
}
else {
int entries = tableLocation[1] / 4;
locaTable = new int[entries];
for (int k = 0; k < entries; ++k)
locaTable[k] = rf.ReadInt();
}
tables.TryGetValue("glyf", out tableLocation);
if (tableLocation == null)
throw new DocumentException(MessageLocalization.GetComposedMessage("table.1.does.not.exist.in.2", "glyf", fileName + style));
int tableGlyphOffset = tableLocation[0];
bboxes = new int[locaTable.Length - 1][];
for (int glyph = 0; glyph < locaTable.Length - 1; ++glyph) {
int start = locaTable[glyph];
if (start != locaTable[glyph + 1]) {
rf.Seek(tableGlyphOffset + start + 2);
bboxes[glyph] = new int[]{
(rf.ReadShort() * 1000) / head.unitsPerEm,
(rf.ReadShort() * 1000) / head.unitsPerEm,
(rf.ReadShort() * 1000) / head.unitsPerEm,
(rf.ReadShort() * 1000) / head.unitsPerEm};
}
}
}