private void setStyleFromAttributes(Graphics g, AttributeSet attributes) {
		Font oldFont = textPane.getFont();
		int style = 0;
		if (Boolean.TRUE.equals(attributes.getAttribute(StyleConstants.Bold))) {
			style |= Font.BOLD;
		}
		if (Boolean.TRUE.equals(attributes.getAttribute(StyleConstants.Italic))) {
			style |= Font.ITALIC;
		}
		g.setFont(new Font(oldFont.getName(), style, oldFont.getSize()));
		Color color = (Color) attributes.getAttribute(StyleConstants.Foreground);
		if (color == null) color = textPane.getForeground();
		g.setColor(color);
	}