1:
37:
38:
39: package ;
40:
41: import ;
42:
43: import ;
44: import ;
45: import ;
46: import ;
47: import ;
48: import ;
49: import ;
50: import ;
51: import ;
52: import ;
53:
54: public class GtkFontPeer extends ClasspathFontPeer
55: {
56: private static ResourceBundle bundle;
57:
58: static
59: {
60: try
61: {
62: bundle = ResourceBundle.getBundle ("gnu.java.awt.peer.gtk.font");
63: }
64: catch (Throwable ignored)
65: {
66: bundle = null;
67: }
68: }
69:
70: private final String Xname;
71:
72: public GtkFontPeer (String name, int style)
73: {
74:
75: this(name, style, 12);
76: }
77:
78: public GtkFontPeer (String name, int style, int size)
79: {
80: super(name, style, size);
81:
82: String Xname = null;
83: if (bundle != null)
84: {
85: try
86: {
87: Xname = bundle.getString (name.toLowerCase () + "." + style);
88: }
89: catch (MissingResourceException mre)
90: {
91:
92: }
93: }
94:
95: if (Xname == null)
96: {
97: String weight;
98: String slant;
99: String spacing;
100:
101: if (style == Font.ITALIC || (style == (Font.BOLD+Font.ITALIC)))
102: slant = "i";
103: else
104: slant = "r";
105: if (style == Font.BOLD || (style == (Font.BOLD+Font.ITALIC)))
106: weight = "bold";
107: else
108: weight = "medium";
109: if (name.equals("Serif") || name.equals("SansSerif")
110: || name.equals("Helvetica") || name.equals("Times"))
111: spacing = "p";
112: else
113: spacing = "c";
114:
115: Xname = "-*-*-" + weight + "-" + slant + "-normal-*-*-" + size + "-*-*-" + spacing + "-*-*-*";
116: }
117:
118: this.Xname = Xname;
119: }
120:
121: public String getXLFD ()
122: {
123: return Xname;
124: }
125:
126:
127:
131:
132: public boolean canDisplay (Font font, char c)
133: {
134: throw new UnsupportedOperationException();
135: }
136:
137: public int canDisplayUpTo (Font font, CharacterIterator i, int start, int limit)
138: {
139: throw new UnsupportedOperationException();
140: }
141:
142: public String getSubFamilyName (Font font, Locale locale)
143: {
144: throw new UnsupportedOperationException();
145: }
146:
147: public String getPostScriptName (Font font)
148: {
149: throw new UnsupportedOperationException();
150: }
151:
152: public int getNumGlyphs (Font font)
153: {
154: throw new UnsupportedOperationException();
155: }
156:
157: public int getMissingGlyphCode (Font font)
158: {
159: throw new UnsupportedOperationException();
160: }
161:
162: public byte getBaselineFor (Font font, char c)
163: {
164: throw new UnsupportedOperationException();
165: }
166:
167: public String getGlyphName (Font font, int glyphIndex)
168: {
169: throw new UnsupportedOperationException();
170: }
171:
172: public GlyphVector createGlyphVector (Font font,
173: FontRenderContext frc,
174: CharacterIterator ci)
175: {
176: throw new UnsupportedOperationException();
177: }
178:
179: public GlyphVector createGlyphVector (Font font,
180: FontRenderContext ctx,
181: int[] glyphCodes)
182: {
183: throw new UnsupportedOperationException();
184: }
185:
186: public GlyphVector layoutGlyphVector (Font font,
187: FontRenderContext frc,
188: char[] chars, int start,
189: int limit, int flags)
190: {
191: throw new UnsupportedOperationException();
192: }
193:
194: public FontMetrics getFontMetrics (Font font)
195: {
196: throw new UnsupportedOperationException();
197: }
198:
199: public boolean hasUniformLineMetrics (Font font)
200: {
201: throw new UnsupportedOperationException();
202: }
203:
204: public LineMetrics getLineMetrics (Font font,
205: CharacterIterator ci,
206: int begin, int limit,
207: FontRenderContext rc)
208: {
209: throw new UnsupportedOperationException();
210: }
211:
212: public Rectangle2D getMaxCharBounds (Font font,
213: FontRenderContext rc)
214: {
215: throw new UnsupportedOperationException();
216: }
217:
218: public Rectangle2D getStringBounds (Font font,
219: CharacterIterator ci,
220: int begin, int limit,
221: FontRenderContext frc)
222: {
223: throw new UnsupportedOperationException();
224: }
225: }