// Copyright 1996, Marimba Inc. All Rights Reserved.


// Confidential and Proprietary Information of Marimba, Inc.


// @(#)DeviceFont.java, 1.4, 12/15/96





package marimba.text;





import java.awt.*;





/**


 * This is a Font subclass which keeps around the font metrics for


 * the font so we don't have to keep asking for them!


 *


 * @author	Jonathan Payne


 * @version 1.4, 12/15/96


 */


public class DeviceFont extends Font {


    FontMetrics metrics;


    int widths[];





    DeviceFont(String name, int style, int size) {


	super(name, style, size);


    }





    FontMetrics getMetrics() {


	if (metrics == null) {


	    metrics = Toolkit.getDefaultToolkit().getFontMetrics(this);


	}


	return metrics;


    }





    final int[] getWidths() {


	if (widths == null) {


	    widths = getMetrics().getWidths();


	}


	return widths;


    }


}


