public TrueTypeFont parse(RandomAccessRead randomAccessRead) throws IOException
    {
        RandomAccessReadDataStream dataStream = new RandomAccessReadDataStream(randomAccessRead);
        try (randomAccessRead)
        {
            return parse(dataStream);
        }
        catch (IOException ex)
        {
            // close only on error (source is still being accessed later)
            dataStream.close();
            throw ex;
        }
    }
@Test
    void testPostTable() throws IOException
    {
        InputStream input = TestTTFParser.class.getResourceAsStream(
                "/ttf/LiberationSans-Regular.ttf");
        assertNotNull(input);

        TTFParser parser = new TTFParser();
        TrueTypeFont font = parser.parse(new RandomAccessReadBuffer(input));

        CmapTable cmapTable = font.getCmap();
        assertNotNull(cmapTable);

        CmapSubtable[] cmaps = cmapTable.getCmaps();
        assertNotNull(cmaps);

        CmapSubtable cmap = null;

        for (CmapSubtable e : cmaps)
        {
            if (e.getPlatformId() == NameRecord.PLATFORM_WINDOWS
                    && e.getPlatformEncodingId() == NameRecord.ENCODING_WINDOWS_UNICODE_BMP)
            {
                cmap = e;
                break;
            }
        }

        assertNotNull(cmap);

        PostScriptTable post = font.getPostScript();
        assertNotNull(post);

        String[] glyphNames = font.getPostScript().getGlyphNames();
        assertNotNull(glyphNames);

        // test a WGL4 (Macintosh standard) name
        int gid = cmap.getGlyphId(0x2122); // TRADE MARK SIGN
        assertEquals("trademark", glyphNames[gid]);

        // test an additional name
        gid = cmap.getGlyphId(0x20AC); // EURO SIGN
        assertEquals("Euro", glyphNames[gid]);
    }