Modify the app so that the font is scaled down to fit within the space that is alloted to the graphics object. (The scaling should work when the window is resized)
Hints:
The object LineBreakMeasurer encapsulates font information: the font information is associated with the AttributedString and the AttributedString is used in the determination of the position of the line breaks. So anytime there is a change to the font, a new instance of the LineBreakMeasurer is needed. This, in turn, means that any time the font changes, the actual list of TextLayout's will need to be reconstructed. You first step is to encapsulate this functionality into a separate method that will return a fresh version of the list of TextLayout's as a function of an AttributedString, a Graphics2D object, and a width allocation.
Next, devise a test to determine the vertical space requirements of the text. Encapsulate the test in a method that takes as parameters: List
Last, create a mechanism whereby a specified font, if too large, is reduced in point size. You can repeatedly apply a size reduction until the vertical space requirements are satisfied.
The class Font has following methods which will be useful:
Font deriveFont(float size)
int getSize()
Warning - there is a method with the following signature
Font deriveFont(int style)
Don't confuse the two.

