Ejemplo n.º 1
0
        internal void findNames()
        {
            tables = new Hashmap();

            try {
                String mainTag = readStandardstring(4);
                if (!mainTag.Equals("ttcf"))
                {
                    throw new DocumentException(fileName + " is not a valid TTC file.");
                }
                rf.skipBytes(4);
                int dirCount = rf.readInt();
                names = new String[dirCount];
                int dirPos = rf.FilePointer;
                for (int dirIdx = 0; dirIdx < dirCount; ++dirIdx)
                {
                    tables.Clear();
                    rf.seek(dirPos);
                    rf.skipBytes(dirIdx * 4);
                    directoryOffset = rf.readInt();
                    rf.seek(directoryOffset);
                    if (rf.readInt() != 0x00010000)
                    {
                        throw new DocumentException(fileName + " is not a valid TTF file.");
                    }
                    int num_tables = rf.readUnsignedShort();
                    rf.skipBytes(6);
                    for (int k = 0; k < num_tables; ++k)
                    {
                        String tag = readStandardstring(4);
                        rf.skipBytes(4);
                        int[] table_location = new int[2];
                        table_location[0] = rf.readInt();
                        table_location[1] = rf.readInt();
                        tables.Add(tag, table_location);
                    }
                    names[dirIdx] = this.BaseFont;
                }
            }
            finally {
                if (rf != null)
                {
                    rf.close();
                }
            }
        }