/[classpath]/classpath/gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java
ViewVC logotype

Diff of /classpath/gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by mkoch, Tue Nov 4 11:24:08 2003 UTC revision 1.2 by graydon, Thu Nov 20 22:27:36 2003 UTC
# Line 49  import java.util.Map; Line 49  import java.util.Map;
49  import java.util.StringTokenizer;  import java.util.StringTokenizer;
50  import java.text.CharacterIterator;  import java.text.CharacterIterator;
51  import java.text.AttributedCharacterIterator;  import java.text.AttributedCharacterIterator;
52    import java.text.StringCharacterIterator;
53  import java.awt.font.TextAttribute;  import java.awt.font.TextAttribute;
54  import gnu.classpath.Configuration;  import gnu.classpath.Configuration;
55  import gnu.java.awt.peer.ClasspathFontPeer;  import gnu.java.awt.peer.ClasspathFontPeer;
# Line 180  public class GdkClasspathFontPeer extend Line 181  public class GdkClasspathFontPeer extend
181      throw new UnsupportedOperationException ();      throw new UnsupportedOperationException ();
182    }    }
183    
184      protected class GdkFontLineMetrics extends LineMetrics
185      {
186        FontMetrics fm;
187        int nchars;
188    
189        public GdkFontLineMetrics (FontMetrics m, int n)
190        {
191          fm = m;
192          nchars = n;
193        }
194    
195        public float getAscent()
196        {
197          return (float) fm.getAscent ();
198        }
199      
200        public int getBaselineIndex()
201        {
202          return Font.ROMAN_BASELINE;
203        }
204        
205        public float[] getBaselineOffsets()
206        {
207          return new float[3];
208        }
209        
210        public float getDescent()
211        {
212          return (float) fm.getDescent ();
213        }
214        
215        public float getHeight()
216        {
217          return (float) fm.getHeight ();
218        }
219        
220        public float getLeading() { return 0.f; }    
221        public int getNumChars() { return nchars; }
222        public float getStrikethroughOffset() { return 0.f; }    
223        public float getStrikethroughThickness() { return 0.f; }  
224        public float getUnderlineOffset() { return 0.f; }
225        public float getUnderlineThickness() { return 0.f; }
226    
227      }
228    
229    
230    public LineMetrics getLineMetrics (Font font, CharacterIterator ci,    public LineMetrics getLineMetrics (Font font, CharacterIterator ci,
231                                       int begin, int limit, FontRenderContext rc)                                       int begin, int limit, FontRenderContext rc)
232    {    {
233      throw new UnsupportedOperationException ();      return new GdkFontLineMetrics (getFontMetrics (font), limit - begin);
234    }    }
235    
236    public Rectangle2D getMaxCharBounds (Font font, FontRenderContext rc)    public Rectangle2D getMaxCharBounds (Font font, FontRenderContext rc)
# Line 214  public class GdkClasspathFontPeer extend Line 261  public class GdkClasspathFontPeer extend
261    
262    public boolean hasUniformLineMetrics (Font font)    public boolean hasUniformLineMetrics (Font font)
263    {    {
264      throw new UnsupportedOperationException ();      return true;
265    }    }
266    
267    public GlyphVector layoutGlyphVector (Font font, FontRenderContext frc,    public GlyphVector layoutGlyphVector (Font font, FontRenderContext frc,
268                                          char[] chars, int start, int limit,                                          char[] chars, int start, int limit,
269                                          int flags)                                          int flags)
270    {    {
271      throw new UnsupportedOperationException ();        int nchars = (limit - start) + 1;
272        char[] nc = new char[nchars];
273    
274        for (int i = 0; i < nchars; ++i)
275          nc[i] = chars[start + i];
276    
277        return createGlyphVector (font, frc,
278                                  new StringCharacterIterator (new String (nc)));
279    }    }
280    
281    public LineMetrics getLineMetrics (Font font, String str,    public LineMetrics getLineMetrics (Font font, String str,
282                                       FontRenderContext frc)                                       FontRenderContext frc)
283    {    {
284      throw new UnsupportedOperationException();      return new GdkFontLineMetrics (getFontMetrics (font), str.length ());
285    }    }
286    
287    public FontMetrics getFontMetrics (Font font)    public FontMetrics getFontMetrics (Font font)
288    {    {
289      throw new UnsupportedOperationException();      return new GdkClasspathFontPeerMetrics (font);
290    }    }
291    
292  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26