diff options
Diffstat (limited to 'tests/tests/graphics/src/android/graphics/fonts/FontFileTestUtil.java')
-rw-r--r-- | tests/tests/graphics/src/android/graphics/fonts/FontFileTestUtil.java | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/tests/tests/graphics/src/android/graphics/fonts/FontFileTestUtil.java b/tests/tests/graphics/src/android/graphics/fonts/FontFileTestUtil.java index 5ee09124e2a..fcaab4bc0b7 100644 --- a/tests/tests/graphics/src/android/graphics/fonts/FontFileTestUtil.java +++ b/tests/tests/graphics/src/android/graphics/fonts/FontFileTestUtil.java @@ -90,50 +90,4 @@ public class FontFileTestUtil { } return null; } - - public static boolean containsEmojiCompatMetadata(File file) throws IOException { - try (FileInputStream fis = new FileInputStream(file)) { - final FileChannel fc = fis.getChannel(); - long size = fc.size(); - ByteBuffer buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, size) - .order(ByteOrder.BIG_ENDIAN); - - int magicNumber = buffer.getInt(0); - - int fontOffset = 0; - if (magicNumber == TTC_TAG) { - throw new IOException("Emoji font is not expected to be in a font collection."); - } else if (magicNumber != SFNT_VERSION_1 && magicNumber != SFNT_VERSION_OTTO) { - throw new IOException("Unknown magic number: #" + magicNumber); - } - - int numTables = buffer.getShort(fontOffset + 4); // offset to number of table - int metaTableOffset = 0; - for (int i = 0; i < numTables; ++i) { - int tableEntryOffset = fontOffset + 12 + i * 16; - int tableTag = buffer.getInt(tableEntryOffset); - if (tableTag == META_TAG) { - metaTableOffset = buffer.getInt(tableEntryOffset + 8); - break; - } - } - - if (metaTableOffset == 0) { - throw new IOException("name table not found."); - } - - int dataMapsCount = buffer.getInt(metaTableOffset + 12); - - for (int i = 0; i < dataMapsCount; ++i) { - int tag = buffer.getInt(metaTableOffset + 16 + 12 * i); - int offset = buffer.getInt(metaTableOffset + 16 + 12 * i + 4); - int dataLength = buffer.getInt(metaTableOffset + 16 + 12 * i + 8); - - if (tag == EMJI_TAG && dataLength != 0) { - return true; - } - } - } - return false; - } } |