private void initializeFontMetrics ( ) { if ( ! fontMetricsInitialized ) { FontMetrics fontMetrics = getFontMetrics ( getFont ( ) ) ; charWidth = fontMetrics . charWidth ( ' ' ) ; charHeight = fontMetrics . getHeight ( ) ; descent = fontMetrics . getDescent ( ) ; fontMetricsInitialized = true ; } }
Sets up metrics relating to the size of the font used to display the text grid . This only needs to be done once but this method can be called many times as it is guarded by an initialization flag to prevent these being calculated many times .