GdkFontMetrics.java (GdkFontMetrics): Pass font name, not XLFD, to initState.
2003-12-01 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/java/awt/peer/gtk/GdkFontMetrics.java (GdkFontMetrics): Pass font name, not XLFD, to initState. (stringWidth(String, int, String)): New method. (stringWidth(String)): Call new stringWidth. (getLeading): Always return 0. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c (initState): New Pango implementation. (stringWidth): Likewise. From-SVN: r74133
This commit is contained in:
parent
47aeffac9c
commit
bebae71041
3 changed files with 69 additions and 34 deletions
|
@ -50,16 +50,20 @@ public class GdkFontMetrics extends FontMetrics
|
|||
MAX_ADVANCE = 4;
|
||||
|
||||
private int[] metrics;
|
||||
private native int[] initState (String xlfd, int pts);
|
||||
private native int[] initState (String fname, int size);
|
||||
|
||||
public GdkFontMetrics (Font font)
|
||||
{
|
||||
super (font);
|
||||
metrics = initState (((GtkFontPeer)font.getPeer ()).getXLFD (),
|
||||
font.getSize ());
|
||||
metrics = initState (font.getName (), font.getSize ());
|
||||
}
|
||||
|
||||
native public int stringWidth (String str);
|
||||
native public int stringWidth (String fname, int size, String str);
|
||||
|
||||
public int stringWidth (String str)
|
||||
{
|
||||
return stringWidth (font.getName (), font.getSize (), str);
|
||||
}
|
||||
|
||||
public int charWidth (char ch)
|
||||
{
|
||||
|
@ -71,15 +75,10 @@ public class GdkFontMetrics extends FontMetrics
|
|||
return stringWidth (new String (data, off, len));
|
||||
}
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Sun's Motif implementation always returns 0 or 1 here (???).
|
||||
public int getLeading ()
|
||||
{
|
||||
return 1;
|
||||
// return metrics[ASCENT] + metrics[DESCENT];
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getAscent ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue