Source for gnu.awt.xlib.XFontPeer

   1: /* Copyright (C) 2000, 2002, 2003  Free Software Foundation
   2:  
   3:    This file is part of libgcj.
   4:  
   5: This software is copyrighted work licensed under the terms of the
   6: Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
   7: details.  */
   8: 
   9: package gnu.awt.xlib;
  10: 
  11: import java.awt.*;
  12: import gnu.java.awt.ClasspathToolkit;
  13: import gnu.java.awt.peer.ClasspathFontPeer;
  14: import java.util.Locale;
  15: import java.awt.font.*;
  16: import java.awt.geom.*;
  17: import java.text.CharacterIterator;
  18: 
  19: /**
  20:  * Classpath-compatible peer for a font
  21:  */
  22: public class XFontPeer extends ClasspathFontPeer
  23: {
  24:   public XFontPeer (String name, int style)
  25:   {
  26:     this (name, style, 12 /* kludge */);
  27:   }
  28:   
  29:   public XFontPeer (String name, int style, float size)
  30:   {
  31:     super (name, style, (int)size);
  32:   }
  33:   
  34:   /**
  35:    * Implementation of {@link Font#canDisplay(char)}
  36:    *
  37:    * @param font the font this peer is being called from. This may be
  38:    * useful if you are sharing peers between Font objects. Otherwise it may
  39:    * be ignored.
  40:    */
  41:   public boolean canDisplay (Font font, int c)
  42:   {
  43:     throw new UnsupportedOperationException ();
  44:   }
  45:   
  46:   /**
  47:    * Implementation of {@link Font#canDisplay(String)},
  48:    * {@link Font#canDisplay(char [], int, int)}, and
  49:    * {@link Font#canDisplay(CharacterIterator, int, int)}.
  50:    *
  51:    * @param font the font this peer is being called from. This may be
  52:    * useful if you are sharing peers between Font objects. Otherwise it may
  53:    * be ignored.
  54:    */
  55:   public int canDisplayUpTo (Font font, CharacterIterator i, int start, int limit)
  56:   {
  57:     throw new UnsupportedOperationException ();
  58:   }
  59:   
  60:   /**
  61:    * Implementation of {@link
  62:    * Font#createGlyphVector(FontRenderContext, String)}, {@link
  63:    * Font#createGlyphVector(FontRenderContext, char[])}, and {@link
  64:    * Font#createGlyphVector(FontRenderContext, CharacterIterator)}.
  65:    *
  66:    * @param font the font object that the created GlyphVector will return
  67:    * when it gets asked for its font. This argument is needed because the
  68:    * public API of {@link GlyphVector} works with {@link java.awt.Font},
  69:    * not with font peers.
  70:    */
  71:   public GlyphVector createGlyphVector (Font font, FontRenderContext frc, CharacterIterator ci)
  72:   {
  73:     throw new UnsupportedOperationException ();
  74:   }
  75:   
  76:   /**
  77:    * Implementation of {@link Font#createGlyphVector(FontRenderContext,
  78:    * int[])}.
  79:    *
  80:    * @param font the font object that the created GlyphVector will return
  81:    * when it gets asked for its font. This argument is needed because the
  82:    * public API of {@link GlyphVector} works with {@link java.awt.Font},
  83:    * not with font peers.
  84:    */
  85:   public GlyphVector createGlyphVector (Font font, FontRenderContext ctx, int[] glyphCodes)
  86:   {
  87:     throw new UnsupportedOperationException ();
  88:   }
  89:   
  90:   /**
  91:    * Implementation of {@link Font#getBaselineFor(char)}
  92:    *
  93:    * @param font the font this peer is being called from. This may be
  94:    * useful if you are sharing peers between Font objects. Otherwise it may
  95:    * be ignored.
  96:    */
  97:   public byte getBaselineFor (Font font, char c)
  98:   {
  99:     throw new UnsupportedOperationException ();
 100:   }
 101:   
 102:   /**
 103:    * Implementation of {@link Font#getFontMetrics()}
 104:    *
 105:    * @param font the font this peer is being called from. This may be
 106:    * useful if you are sharing peers between Font objects. Otherwise it may
 107:    * be ignored.
 108:    */
 109:   public FontMetrics getFontMetrics (Font font)
 110:   {
 111:     throw new UnsupportedOperationException ();
 112:   }
 113:   
 114:   /** Returns a name for the specified glyph. This is useful for
 115:    * generating PostScript or PDF files that embed some glyphs of a
 116:    * font. If the implementation follows glyph naming conventions
 117:    * specified by Adobe, search engines can extract the original text
 118:    * from the generated PostScript and PDF files.
 119:    *
 120:    * <p>This method is currently not used by GNU Classpath. However,
 121:    * it would be very useful for someone wishing to write a good
 122:    * PostScript or PDF stream provider for the
 123:    * <code>javax.print</code> package.
 124:    *
 125:    * <p><b>Names are not unique:</b> Under some rare circumstances,
 126:    * the same name can be returned for different glyphs. It is
 127:    * therefore recommended that printer drivers check whether the same
 128:    * name has already been returned for antoher glyph, and make the
 129:    * name unique by adding the string ".alt" followed by the glyph
 130:    * index.</p>
 131:    *
 132:    * <p>This situation would occur for an OpenType or TrueType font
 133:    * that has a <code>post</code> table of format 3 and provides a
 134:    * mapping from glyph IDs to Unicode sequences through a
 135:    * <code>Zapf</code> table. If the same sequence of Unicode
 136:    * codepoints leads to different glyphs (depending on contextual
 137:    * position, for example, or on typographic sophistication level),
 138:    * the same name would get synthesized for those glyphs. To avoid
 139:    * this, the font peer would have to go through the names of all
 140:    * glyphs, which would make this operation very inefficient with
 141:    * large fonts.
 142:    *
 143:    * @param font the font containing the glyph whose name is
 144:    * requested.
 145:    *
 146:    * @param glyphIndex the glyph whose name the caller wants to
 147:    * retrieve.
 148:    *
 149:    * @return the glyph name, or <code>null</code> if a font does not
 150:    * provide glyph names.
 151:    */
 152:   public String getGlyphName (Font font, int glyphIndex)
 153:   {
 154:     throw new UnsupportedOperationException ();
 155:   }
 156:   
 157:   /**
 158:    * Implementation of {@link Font#getLineMetrics(CharacterIterator, int,
 159:    * int, FontRenderContext)}
 160:    *
 161:    * @param font the font this peer is being called from. This may be
 162:    * useful if you are sharing peers between Font objects. Otherwise it may
 163:    * be ignored.
 164:    */
 165:   public LineMetrics getLineMetrics (Font font, CharacterIterator ci, int begin, int limit, FontRenderContext rc)
 166:   {
 167:     throw new UnsupportedOperationException ();
 168:   }
 169:   
 170:   /**
 171:    * Implementation of {@link Font#getMaxCharBounds(FontRenderContext)}
 172:    *
 173:    * @param font the font this peer is being called from. This may be
 174:    * useful if you are sharing peers between Font objects. Otherwise it may
 175:    * be ignored.
 176:    */
 177:   public Rectangle2D getMaxCharBounds (Font font, FontRenderContext rc)
 178:   {
 179:     throw new UnsupportedOperationException ();
 180:   }
 181:   
 182:   /**
 183:    * Implementation of {@link Font#getMissingGlyphCode()}
 184:    *
 185:    * @param font the font this peer is being called from. This may be
 186:    * useful if you are sharing peers between Font objects. Otherwise it may
 187:    * be ignored.
 188:    */
 189:   public int getMissingGlyphCode (Font font)
 190:   {
 191:     throw new UnsupportedOperationException ();
 192:   }
 193:   
 194:   /**
 195:    * Implementation of {@link Font#getNumGlyphs()}
 196:    *
 197:    * @param font the font this peer is being called from. This may be
 198:    * useful if you are sharing peers between Font objects. Otherwise it may
 199:    * be ignored.
 200:    */
 201:   public int getNumGlyphs (Font font)
 202:   {
 203:     throw new UnsupportedOperationException ();
 204:   }
 205:   
 206:   /**
 207:    * Implementation of {@link Font#getPSName()}
 208:    *
 209:    * @param font the font this peer is being called from. This may be
 210:    * useful if you are sharing peers between Font objects. Otherwise it may
 211:    * be ignored.
 212:    */
 213:   public String getPostScriptName (Font font)
 214:   {
 215:     throw new UnsupportedOperationException ();
 216:   }
 217:   
 218:   /**
 219:    * Implementation of {@link Font#getStringBounds(CharacterIterator, int,
 220:    * int, FontRenderContext)}
 221:    *
 222:    * @param font the font this peer is being called from. This may be
 223:    * useful if you are sharing peers between Font objects. Otherwise it may
 224:    * be ignored.
 225:    */
 226:   public Rectangle2D getStringBounds (Font font, CharacterIterator ci, int begin, int limit, FontRenderContext frc)
 227:   {
 228:     throw new UnsupportedOperationException ();
 229:   }
 230:   
 231:   /** Returns the name of this font face inside the family, for example
 232:    * <i>&#x201c;Light&#x201d;</i>.
 233:    *
 234:    * <p>This method is currently not used by {@link Font}. However,
 235:    * this name would be needed by any serious desktop publishing
 236:    * application.
 237:    *
 238:    * @param font the font whose sub-family name is requested.
 239:    *
 240:    * @param locale the locale for which to localize the name.  If
 241:    * <code>locale</code> is <code>null</code>, the returned name is
 242:    * localized to the user&#x2019;s default locale.
 243:    *
 244:    * @return the name of the face inside its family, or
 245:    * <code>null</code> if the font does not provide a sub-family name.
 246:    */
 247:   public String getSubFamilyName (Font font, Locale locale)
 248:   {
 249:     throw new UnsupportedOperationException ();
 250:   }
 251:   
 252:   /**
 253:    * Implementation of {@link Font#hasUniformLineMetrics()}
 254:    *
 255:    * @param font the font this peer is being called from. This may be
 256:    * useful if you are sharing peers between Font objects. Otherwise it may
 257:    * be ignored.
 258:    */
 259:   public boolean hasUniformLineMetrics (Font font)
 260:   {
 261:     throw new UnsupportedOperationException ();
 262:   }
 263:   
 264:   /**
 265:    * Implementation of {@link Font#layoutGlyphVector(FontRenderContext,
 266:    * char[], int, int, int)}.
 267:    *
 268:    * @param font the font object that the created GlyphVector will return
 269:    * when it gets asked for its font. This argument is needed because the
 270:    * public API of {@link GlyphVector} works with {@link java.awt.Font},
 271:    * not with font peers.
 272:    */
 273:   public GlyphVector layoutGlyphVector (Font font, FontRenderContext frc, char[] chars, int start, int limit, int flags)
 274:   {
 275:     throw new UnsupportedOperationException ();
 276:   }
 277: }