0

I am trying to draw a string into an image.is it possible to add multiple Font style at the same text(bold and italic).?

my code is:

        Graphics g = image.getGraphics();
        Font font = new Font("Arial", Font.ITALIC, 16);

        g.setFont(font);
        g.drawString(text, 100, 100);
        g.dispose();

but i want to add italic with bold attribute.

CloudyMarble
  • 36,908
  • 70
  • 97
  • 130

1 Answers1

2

As per the documentation, you can OR together the styles you want.

Font font = new Font ("Arial", Font.BOLD | Font.ITALIC, 16);
RB.
  • 36,301
  • 12
  • 91
  • 131