Commit 7f6f517f by Mark Wielaard Committed by Michael Koch

GtkFontPeer.java: Use fallback when MissingResourceException is thrown.

2004-04-20  Mark Wielaard  <mark@klomp.org>

	* gnu/java/awt/peer/gtk/GtkFontPeer.java: Use fallback when
	MissingResourceException is thrown.
	* gnu/java/awt/peer/gtk/GtkToolkit.java (getFontPeer): Don't return
	null when a MissingResourceException is thrown. Should never happen.

From-SVN: r80888
parent a7b1dc36
2004-04-20 Mark Wielaard <mark@klomp.org>
* gnu/java/awt/peer/gtk/GtkFontPeer.java: Use fallback when
MissingResourceException is thrown.
* gnu/java/awt/peer/gtk/GtkToolkit.java (getFontPeer): Don't return
null when a MissingResourceException is thrown. Should never happen.
2004-04-20 Sascha Brawer <brawer@dandelis.ch> 2004-04-20 Sascha Brawer <brawer@dandelis.ch>
* java/awt/image/DataBufferShort.java, * java/awt/image/DataBufferShort.java,
......
...@@ -43,6 +43,7 @@ import java.awt.geom.*; ...@@ -43,6 +43,7 @@ import java.awt.geom.*;
import java.awt.font.*; import java.awt.font.*;
import java.util.Locale; import java.util.Locale;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.MissingResourceException;
import java.text.*; import java.text.*;
import gnu.java.awt.peer.ClasspathFontPeer; import gnu.java.awt.peer.ClasspathFontPeer;
...@@ -74,9 +75,20 @@ public class GtkFontPeer extends ClasspathFontPeer ...@@ -74,9 +75,20 @@ public class GtkFontPeer extends ClasspathFontPeer
{ {
super(name, style, size); super(name, style, size);
String Xname = null;
if (bundle != null) if (bundle != null)
Xname = bundle.getString (name.toLowerCase () + "." + style); {
else try
{
Xname = bundle.getString (name.toLowerCase () + "." + style);
}
catch (MissingResourceException mre)
{
// ignored
}
}
if (Xname == null)
{ {
String weight; String weight;
String slant; String slant;
...@@ -98,6 +110,8 @@ public class GtkFontPeer extends ClasspathFontPeer ...@@ -98,6 +110,8 @@ public class GtkFontPeer extends ClasspathFontPeer
Xname = "-*-*-" + weight + "-" + slant + "-normal-*-*-" + size + "-*-*-" + spacing + "-*-*-*"; Xname = "-*-*-" + weight + "-" + slant + "-normal-*-*-" + size + "-*-*-" + spacing + "-*-*-*";
} }
this.Xname = Xname;
} }
public String getXLFD () public String getXLFD ()
......
...@@ -377,12 +377,8 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit ...@@ -377,12 +377,8 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
*/ */
private FontPeer getFontPeer (String name, int style, int size) private FontPeer getFontPeer (String name, int style, int size)
{ {
try { GtkFontPeer fp = new GtkFontPeer (name, style, size);
GtkFontPeer fp = new GtkFontPeer (name, style, size); return fp;
return fp;
} catch (MissingResourceException ex) {
return null;
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment