Dead
[official-gcc.git] / gomp-20050608-branch / libjava / gnu / gcj / xlib / Font.java
blob74985b9388e081d8417584d1ec93dce0da903d58
1 /* Copyright (C) 2000 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
7 details. */
9 package gnu.gcj.xlib;
11 import gnu.gcj.RawData;
13 /**
14 * An X11 Font, implemented as a wrapper around an X11 Font XID and
15 * the associated Xlib XFontStruct structure.
17 * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
19 public final class Font extends XID
22 /**
23 * @param lfdNamePattern a font name pattern following the
24 * <em>X Logical Font Description Conventions</em>.
26 public Font(Display display, String lfdNamePattern)
28 this(display, loadFont(display, lfdNamePattern));
31 Font(Display display, RawData struct)
33 super(display, getXIDFromStruct(struct));
34 structure = struct;
37 static RawData loadFont(Display display, String lfdNamePattern)
39 RawData returnValue = null;
40 try
42 returnValue = loadFontImpl (display,lfdNamePattern);
44 catch (XException e)
46 // Throw a descriptive exception, including the font pattern
47 throw new XException ("Font not found: " + lfdNamePattern);
49 return returnValue;
51 static native RawData loadFontImpl(Display display, String lfdNamePattern);
53 static native int getXIDFromStruct(RawData structure);
55 public native int getAscent();
56 public native int getDescent();
57 public native int getMaxAscent();
58 public native int getMaxDescent();
60 public native int getStringWidth(String str);
62 protected native void finalize();
64 RawData structure;