50 |
MAX_ADVANCE = 4; |
MAX_ADVANCE = 4; |
51 |
|
|
52 |
private int[] metrics; |
private int[] metrics; |
53 |
private native int[] initState (String xlfd, int pts); |
private native int[] initState (String fname, int size); |
54 |
|
|
55 |
public GdkFontMetrics (Font font) |
public GdkFontMetrics (Font font) |
56 |
{ |
{ |
57 |
super (font); |
super (font); |
58 |
metrics = initState (((GtkFontPeer)font.getPeer ()).getXLFD (), |
metrics = initState (font.getName (), font.getSize ()); |
|
font.getSize ()); |
|
59 |
} |
} |
60 |
|
|
61 |
native public int stringWidth (String str); |
native public int stringWidth (String fname, int size, String str); |
62 |
|
|
63 |
|
public int stringWidth (String str) |
64 |
|
{ |
65 |
|
return stringWidth (font.getName (), font.getSize (), str); |
66 |
|
} |
67 |
|
|
68 |
public int charWidth (char ch) |
public int charWidth (char ch) |
69 |
{ |
{ |
75 |
return stringWidth (new String (data, off, len)); |
return stringWidth (new String (data, off, len)); |
76 |
} |
} |
77 |
|
|
78 |
/* |
// Sun's Motif implementation always returns 0 or 1 here (???). |
|
Sun's Motif implementation always returns 0 or 1 here (???), but |
|
|
going by the X11 man pages, it seems as though we should return |
|
|
font.ascent + font.descent. |
|
|
*/ |
|
79 |
public int getLeading () |
public int getLeading () |
80 |
{ |
{ |
81 |
return 1; |
return 0; |
|
// return metrics[ASCENT] + metrics[DESCENT]; |
|
82 |
} |
} |
83 |
|
|
84 |
public int getAscent () |
public int getAscent () |