// Reads through the Name Record Table and saves each of the Name Records in an array. // Loops through the nameRecord array to find a record with a nameID == 1 and a length > 0. // If such a nameRecord is found, the family name is read and returned. If no such // nameRecord is found, returns null. public string GetFamilyName(TableRecord record, byte[] source) { start = record.offset; current = record.offset; ushort format = ReadDataAndIncreaseIndex <ushort>(source, ref current, sizeof(ushort)); ushort count = ReadDataAndIncreaseIndex <ushort>(source, ref current, sizeof(ushort)); ushort stringOffset = ReadDataAndIncreaseIndex <ushort>(source, ref current, sizeof(ushort)); NameRecord[] nameRecords = new NameRecord[count]; for (int i = 0; i < nameRecords.Length; i++) { nameRecords[i] = ReadNameRecordEntry(source, ref current); } for (int i = 0; i < nameRecords.Length; i++) { if (nameRecords[i].nameID == 1 && nameRecords[i].length > 0) { uint index = current + nameRecords[i].offset; return(ReadDataAndIncreaseIndexForFamilyName(source, ref index, nameRecords[i].length)); } } return(null); }