Section 13.4 Manipulating Fonts

• Class Font (p. 566) contains methods and constants for manipulating fonts.

• Class Font’s constructor takes three arguments—the font name (p. 567), font style and font size.

• A Font’s font style can be Font.PLAIN, Font.ITALIC or Font.BOLD (each is a static field of class Font). Font styles can be used in combination (e.g., Font.ITALIC + Font.BOLD).

• The font size is measured in points. A point is 1/72 of an inch.

Graphics method setFont (p. 567) sets the drawing font in which text will be displayed.

Font method getSize (p. 567) returns the font size in points.

Font method getName (p. 567) returns the current font name as a string.

Font method getStyle (p. 569) returns an integer value representing ...

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.