1:
8:
9: package ;
10:
11: import ;
12:
13:
19: public final class Font extends XID
20: {
21:
22:
26: public Font(Display display, String lfdNamePattern)
27: {
28: this(display, loadFont(display, lfdNamePattern));
29: }
30:
31: Font(Display display, RawData struct)
32: {
33: super(display, getXIDFromStruct(struct));
34: structure = struct;
35: }
36:
37: static RawData loadFont(Display display, String lfdNamePattern)
38: {
39: RawData returnValue = null;
40: try
41: {
42: returnValue = loadFontImpl (display,lfdNamePattern);
43: }
44: catch (XException e)
45: {
46:
47: throw new XException ("Font not found: " + lfdNamePattern);
48: }
49: return returnValue;
50: }
51: static native RawData loadFontImpl(Display display, String lfdNamePattern);
52:
53: static native int getXIDFromStruct(RawData structure);
54:
55: public native int getAscent();
56: public native int getDescent();
57: public native int getMaxAscent();
58: public native int getMaxDescent();
59:
60: public native int getStringWidth(String str);
61:
62: protected native void finalize();
63:
64: RawData structure;
65: }