1 /* Copyright (C) 2000, 2002, 2003 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
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
;
20 * Classpath-compatible peer for a font
22 public class XFontPeer
extends ClasspathFontPeer
24 public XFontPeer (String name
, int style
)
26 this (name
, style
, 12 /* kludge */);
29 public XFontPeer (String name
, int style
, float size
)
31 super (name
, style
, (int)size
);
35 * Implementation of {@link Font#canDisplay(char)}
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
41 public boolean canDisplay (Font font
, int c
)
43 throw new UnsupportedOperationException ();
47 * Implementation of {@link Font#canDisplay(String)},
48 * {@link Font#canDisplay(char [], int, int)}, and
49 * {@link Font#canDisplay(CharacterIterator, int, int)}.
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
55 public int canDisplayUpTo (Font font
, CharacterIterator i
, int start
, int limit
)
57 throw new UnsupportedOperationException ();
61 * Implementation of {@link
62 * Font#createGlyphVector(FontRenderContext, String)}, {@link
63 * Font#createGlyphVector(FontRenderContext, char[])}, and {@link
64 * Font#createGlyphVector(FontRenderContext, CharacterIterator)}.
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.
71 public GlyphVector
createGlyphVector (Font font
, FontRenderContext frc
, CharacterIterator ci
)
73 throw new UnsupportedOperationException ();
77 * Implementation of {@link Font#createGlyphVector(FontRenderContext,
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.
85 public GlyphVector
createGlyphVector (Font font
, FontRenderContext ctx
, int[] glyphCodes
)
87 throw new UnsupportedOperationException ();
91 * Implementation of {@link Font#getBaselineFor(char)}
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
97 public byte getBaselineFor (Font font
, char c
)
99 throw new UnsupportedOperationException ();
103 * Implementation of {@link Font#getFontMetrics()}
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
109 public FontMetrics
getFontMetrics (Font font
)
111 throw new UnsupportedOperationException ();
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.
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.
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
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
143 * @param font the font containing the glyph whose name is
146 * @param glyphIndex the glyph whose name the caller wants to
149 * @return the glyph name, or <code>null</code> if a font does not
150 * provide glyph names.
152 public String
getGlyphName (Font font
, int glyphIndex
)
154 throw new UnsupportedOperationException ();
158 * Implementation of {@link Font#getLineMetrics(CharacterIterator, int,
159 * int, FontRenderContext)}
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
165 public LineMetrics
getLineMetrics (Font font
, CharacterIterator ci
, int begin
, int limit
, FontRenderContext rc
)
167 throw new UnsupportedOperationException ();
171 * Implementation of {@link Font#getMaxCharBounds(FontRenderContext)}
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
177 public Rectangle2D
getMaxCharBounds (Font font
, FontRenderContext rc
)
179 throw new UnsupportedOperationException ();
183 * Implementation of {@link Font#getMissingGlyphCode()}
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
189 public int getMissingGlyphCode (Font font
)
191 throw new UnsupportedOperationException ();
195 * Implementation of {@link Font#getNumGlyphs()}
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
201 public int getNumGlyphs (Font font
)
203 throw new UnsupportedOperationException ();
207 * Implementation of {@link Font#getPSName()}
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
213 public String
getPostScriptName (Font font
)
215 throw new UnsupportedOperationException ();
219 * Implementation of {@link Font#getStringBounds(CharacterIterator, int,
220 * int, FontRenderContext)}
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
226 public Rectangle2D
getStringBounds (Font font
, CharacterIterator ci
, int begin
, int limit
, FontRenderContext frc
)
228 throw new UnsupportedOperationException ();
231 /** Returns the name of this font face inside the family, for example
232 * <i>“Light”</i>.
234 * <p>This method is currently not used by {@link Font}. However,
235 * this name would be needed by any serious desktop publishing
238 * @param font the font whose sub-family name is requested.
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’s default locale.
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.
247 public String
getSubFamilyName (Font font
, Locale locale
)
249 throw new UnsupportedOperationException ();
253 * Implementation of {@link Font#hasUniformLineMetrics()}
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
259 public boolean hasUniformLineMetrics (Font font
)
261 throw new UnsupportedOperationException ();
265 * Implementation of {@link Font#layoutGlyphVector(FontRenderContext,
266 * char[], int, int, int)}.
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.
273 public GlyphVector
layoutGlyphVector (Font font
, FontRenderContext frc
, char[] chars
, int start
, int limit
, int flags
)
275 throw new UnsupportedOperationException ();