overline=true;
    public static TextDocument parseDXFText(DXFText text) {        TextDocument doc = new TextDocument();         boolean asciicontrol = false;        StringBuffer buf = new StringBuffer();        StyledTextParagraph p = new StyledTextParagraph();        p.setFontHeight(text.getHeight());        p.setInsertPoint(text.getAlignmentPoint());        switch (text.getValign()) {        case DXFText.VALIGN_BASELINE:            if (text.getAlign() == DXFText.ALIGN_MIDDLE) {                // described in the DXF specs                p.setValign(StyledTextParagraph.VERTICAL_ALIGNMENT_CENTER);            } else {                p.setValign(StyledTextParagraph.VERTICAL_ALIGNMENT_BASELINE);            }            break;        case DXFText.VALIGN_BOTTOM:            p.setValign(StyledTextParagraph.VERTICAL_ALIGNMENT_BASELINE);            break;        case DXFText.VALIGN_CENTER:            p.setValign(StyledTextParagraph.VERTICAL_ALIGNMENT_CENTER);            break;        case DXFText.VALIGN_TOP:            p.setValign(StyledTextParagraph.VERTICAL_ALIGNMENT_TOP);            break;        }        if ((text.getAlign() == 3) || (text.getAlign() == 5)) {            double length = DXFUtils.distance(text.getInsertPoint(),                    text.getAlignmentPoint());            p.setWidth(length);        }        //parse the symbols        String str = parseSymbols(text.getText());        //parse the style        int marker = 0;        char c;        // initialize        boolean overline = false;        boolean underline = false;                        for (int i = 0; i < str.length(); i++) {            c = str.charAt(i);            if (c == '%') {                marker++;            } else {                if (marker == 0) {                    buf.append(c);                } else if (marker == 2) {                    switch (c) {                    case 'o':                    	overline=true;                        p.setText(buf.toString());                        p.setUnderline(underline);                        p.setOverline(overline);                        doc.addStyledParagraph(p);                        p = createParagraphFromParent(p);                        buf.delete(0, buf.length());                        overline = !overline;                        p.setOverline(overline);                        break;                    case 'u':                                            p.setText(buf.toString());                        p.setUnderline(underline);                        p.setOverline(overline);                        doc.addStyledParagraph(p);                        p = createParagraphFromParent(p);                        buf.delete(0, buf.length());                    	underline = !underline;                        p.setUnderline(underline);                        break;                    }                    marker = 0;                }            }        }        if ((marker == 1) || (marker == 3)) {            buf.append('%');        }        // something left over?        if (buf.length() > 0) {            p.setText(buf.toString());            p.setUnderline(underline);            p.setOverline(overline);            doc.addStyledParagraph(p);        }        return doc;    }