code: protected AttributedCharacterIterator textIterator (Graphics2D gfx)
      {
          // first set up any attributes that apply to the entire text
          Font font = (_font == null) ? gfx.getFont() : _font;
          HashMap<TextAttribute,Object> map = new HashMap<TextAttribute,Object>();
          map.put(TextAttribute.FONT, font);
          if ((_style & UNDERLINE) != 0) {
              map.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
          }
  
          AttributedString text = new AttributedString(_text, map);
          addAttributes(text);
          return text.getIterator();
      }
docs: Constructs an attributed character iterator with our text and the appropriate font.