private void createFontInfoXML(InputStream in, final String dir) throws Exception {
        XMLReader parser = XMLReaderFactory.createXMLReader();
        DefaultHandler handler = new DefaultHandler() {
            int cc = 0;
            String ff = "";
            short s = 0;
            boolean bo = false;
            boolean it = false;
            boolean un = true;
            short lh = 0;
            short bw = 0;
            short pages = 1;
            GlyphInfo[] glyphs = new GlyphInfo[0];

            public void startElement(String namespaceURI, String localName, String qualifiedName, Attributes atts) throws SAXException {
                switch (localName) {
                    case INFO:
                        ff = atts.getValue(INFO_FACE);
                        s = Short.valueOf(atts.getValue(INFO_SIZE));
                        bo = atts.getValue(INFO_BOLD).equals("1");
                        it = atts.getValue(INFO_ITALIC).equals("1");
                        un = atts.getValue(INFO_UNICODE).equals("1");
                        break;
                    case COMMON:
                        lh = Short.parseShort(atts.getValue(COMMON_LINE_HEIGHT));
                        bw = Short.parseShort(atts.getValue(COMMON_BASE));
                        pages = Short.parseShort(atts.getValue(COMMON_PAGES));
                        tex = new Texture[pages];
                        break;
                    case PAGE:
                        Texture t = Texture.getTexture(Resource.getResource(dir + '/' + atts.getValue(PAGE_FILE)));
                        tex[Short.parseShort(atts.getValue(PAGE_ID))] = t;
                        break;
                    case CHARS:
                        glyphs = new GlyphInfo[Integer.parseInt(atts.getValue(CHARS_COUNT))];
                        break;
                    case CHAR:
                        short id = Short.parseShort(atts.getValue(CHAR_ID));
                        short x = Short.parseShort(atts.getValue(CHAR_X));
                        short y = Short.parseShort(atts.getValue(CHAR_Y));
                        short w = Short.parseShort(atts.getValue(CHAR_WIDTH));
                        short h = Short.parseShort(atts.getValue(CHAR_HEIGHT));
                        short xo = Short.parseShort(atts.getValue(CHAR_X_OFFSET));
                        short yo = Short.parseShort(atts.getValue(CHAR_Y_OFFSET));
                        short xa = Short.parseShort(atts.getValue(CHAR_X_ADVANCE));
                        short p = Short.parseShort(atts.getValue(CHAR_PAGE));
                        glyphIndexMap.put((char) id, cc);
                        glyphs[cc++] = new GlyphInfo((char) id, x, y, w, h, xo, yo, xa, p);
                        break;
                }
            }

            public void endElement(String uri, String localName, String qname) {
                if (localName.equals("font")) {
                    info = new FontInfo(ff, s, bo, it, un, bw, lh, cc, glyphs);
                }
            }
        };
        parser.setContentHandler(handler);
        parser.parse(new InputSource(in));
    }