KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > gvt > font > GVTGlyphVector


1 /*
2
3    Copyright 2001-2003 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

18 package org.apache.batik.gvt.font;
19
20 import java.awt.Graphics2D JavaDoc;
21 import java.awt.Shape JavaDoc;
22 import java.awt.font.FontRenderContext JavaDoc;
23 import java.awt.font.GlyphJustificationInfo JavaDoc;
24 import java.awt.geom.AffineTransform JavaDoc;
25 import java.awt.geom.Point2D JavaDoc;
26 import java.awt.geom.Rectangle2D JavaDoc;
27 import java.text.AttributedCharacterIterator JavaDoc;
28
29 /**
30  * An interface for all GVT GlyphVector classes.
31  *
32  * @author <a HREF="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a>
33  * @version $Id: GVTGlyphVector.java,v 1.12 2004/08/18 07:14:35 vhardy Exp $
34  */

35 public interface GVTGlyphVector {
36
37     /**
38      * Returns the Font associated with this GlyphVector.
39      */

40     GVTFont getFont();
41
42     /**
43      * Returns the FontRenderContext associated with this GlyphVector.
44      */

45     FontRenderContext JavaDoc getFontRenderContext();
46
47     /**
48      * Returns the glyphcode of the specified glyph.
49      */

50     int getGlyphCode(int glyphIndex);
51
52     /**
53      * Returns an array of glyphcodes for the specified glyphs.
54      */

55     int[] getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn);
56
57     /**
58      * Returns the justification information for the glyph at the specified
59      * index into this GlyphVector.
60      */

61     GlyphJustificationInfo JavaDoc getGlyphJustificationInfo(int glyphIndex);
62
63     /**
64      * Returns the logical bounds of the specified glyph within this
65      * GlyphVector. This is a good bound for hit detection and
66      * highlighting it is not tight in any sense, and in some (rare)
67      * cases may exclude parts of the glyph.
68      */

69     Shape JavaDoc getGlyphLogicalBounds(int glyphIndex);
70
71     /**
72      * Returns the metrics of the glyph at the specified index into this
73      * GlyphVector.
74      */

75     GVTGlyphMetrics getGlyphMetrics(int glyphIndex);
76
77     /**
78      * Returns a Shape whose interior corresponds to the visual representation
79      * of the specified glyph within this GlyphVector.
80      */

81     Shape JavaDoc getGlyphOutline(int glyphIndex);
82
83     /**
84      * Returns the position of the specified glyph within this GlyphVector.
85      */

86     Point2D JavaDoc getGlyphPosition(int glyphIndex);
87
88     /**
89      * Returns an array of glyph positions for the specified glyphs
90      */

91     float[] getGlyphPositions(int beginGlyphIndex,
92                   int numEntries,
93                   float[] positionReturn);
94
95     /**
96      * Gets the transform of the specified glyph within this GlyphVector.
97      */

98     AffineTransform JavaDoc getGlyphTransform(int glyphIndex);
99
100     /**
101      * Returns the visual bounds of the specified glyph within the GlyphVector.
102      */

103     Shape JavaDoc getGlyphVisualBounds(int glyphIndex);
104
105     /**
106      * Returns the logical bounds of this GlyphVector. This is a
107      * good bound for hit detection and highlighting it is not tight
108      * in any sense, and in some (rare) * cases may exclude parts of
109      * the glyph.
110      */

111     Rectangle2D JavaDoc getLogicalBounds();
112
113     /**
114      * Returns the number of glyphs in this GlyphVector.
115      */

116     int getNumGlyphs();
117
118     /**
119      * Returns a Shape whose interior corresponds to the visual representation
120      * of this GlyphVector.
121      */

122     Shape JavaDoc getOutline();
123
124     /**
125      * Returns a Shape whose interior corresponds to the visual representation
126      * of this GlyphVector, offset to x, y.
127      */

128     Shape JavaDoc getOutline(float x, float y);
129
130     /**
131      * Returns the visual bounds of this GlyphVector The visual bounds is the
132      * tightest rectangle enclosing all non-background pixels in the rendered
133      * representation of this GlyphVector.
134      */

135     Rectangle2D JavaDoc getGeometricBounds();
136
137     /**
138      * Returns a tight bounds on the GylphVector including stroking.
139      * @param aci Required to get painting attributes of glyphVector.
140      */

141     Rectangle2D JavaDoc getBounds2D(AttributedCharacterIterator JavaDoc aci);
142
143     /**
144      * Assigns default positions to each glyph in this GlyphVector.
145      */

146     void performDefaultLayout();
147
148     /**
149      * Sets the position of the specified glyph within this GlyphVector.
150      */

151     void setGlyphPosition(int glyphIndex, Point2D JavaDoc newPos);
152
153     /**
154      * Sets the transform of the specified glyph within this GlyphVector.
155      */

156     void setGlyphTransform(int glyphIndex, AffineTransform JavaDoc newTX);
157
158     /**
159      * Tells the glyph vector whether or not to draw the specified glyph.
160      */

161     void setGlyphVisible(int glyphIndex, boolean visible);
162
163     /**
164      * Returns true if specified glyph will be drawn.
165      */

166     public boolean isGlyphVisible(int glyphIndex);
167
168     /**
169      * Returns the number of chars represented by the glyphs within the
170      * specified range.
171      *
172      * @param startGlyphIndex The index of the first glyph in the range.
173      * @param endGlyphIndex The index of the last glyph in the range.
174      * @return The number of chars.
175      */

176     int getCharacterCount(int startGlyphIndex, int endGlyphIndex);
177
178     /**
179      * Draws the glyph vector.
180      */

181     void draw(Graphics2D JavaDoc graphics2D,
182               AttributedCharacterIterator JavaDoc aci);
183 }
184
Popular Tags