1:
37:
38:
39: package ;
40:
41: import ;
42: import ;
43: import ;
44: import ;
45: import ;
46: import ;
47:
48:
52: public abstract class GlyphVector implements Cloneable
53: {
54: public static final int FLAG_COMPLEX_GLYPHS = 8;
55: public static final int FLAG_HAS_POSITION_ADJUSTMENTS = 2;
56: public static final int FLAG_HAS_TRANSFORMS = 1;
57: public static final int FLAG_MASK = 15;
58: public static final int FLAG_RUN_RTL = 4;
59:
60:
63: public GlyphVector ()
64: {
65: }
66:
67: public abstract boolean equals (GlyphVector set);
68:
69: public abstract Font getFont ();
70:
71: public abstract FontRenderContext getFontRenderContext ();
72:
73: public int getGlyphCharIndex (int glyphIndex)
74: {
75: return glyphIndex;
76: }
77:
78: public int[] getGlyphCharIndices(int beginGlyphIndex, int numEntries,
79: int[] codeReturn)
80: {
81: if (codeReturn == null)
82: codeReturn = new int[numEntries];
83:
84: int i = 0;
85: int j = beginGlyphIndex;
86: while (j < numEntries)
87: codeReturn[i++] = getGlyphCharIndex(j++);
88:
89: return codeReturn;
90: }
91:
92: public abstract int getGlyphCode (int glyphIndex);
93:
94: public abstract int[] getGlyphCodes (int beginGlyphIndex, int numEntries,
95: int[] codeReturn);
96:
97: public abstract GlyphJustificationInfo getGlyphJustificationInfo
98: (int glyphIndex);
99:
100: public abstract Shape getGlyphLogicalBounds (int glyphIndex);
101:
102: public abstract GlyphMetrics getGlyphMetrics (int glyphIndex);
103:
104: public abstract Shape getGlyphOutline (int glyphIndex);
105:
106: public Shape getGlyphOutline(int glyphIndex, float x, float y)
107: {
108: Shape s = getGlyphOutline(glyphIndex);
109:
110:
111: AffineTransform at = AffineTransform.getTranslateInstance(x, y);
112: return at.createTransformedShape(s);
113: }
114:
115: public Rectangle getGlyphPixelBounds(int index, FontRenderContext renderFRC,
116: float x, float y)
117: {
118: Rectangle bounds = new Rectangle();
119: Rectangle2D rect = getGlyphVisualBounds(index).getBounds2D();
120:
121: bounds.x = (int) (rect.getX() + x);
122: bounds.y = (int) (rect.getY() + y);
123: bounds.width = (int) rect.getMaxX() - bounds.x;
124: bounds.height = (int) rect.getMaxY() - bounds.y;
125:
126: return bounds;
127: }
128:
129: public abstract Point2D getGlyphPosition (int glyphIndex);
130:
131: public abstract float[] getGlyphPositions (int beginGlyphIndex,
132: int numEntries,
133: float[] positionReturn);
134:
135: public abstract AffineTransform getGlyphTransform (int glyphIndex);
136:
137: public abstract Shape getGlyphVisualBounds (int glyphIndex);
138:
139: public int getLayoutFlags()
140: {
141: return 0;
142: }
143:
144: public abstract Rectangle2D getLogicalBounds ();
145:
146: public abstract int getNumGlyphs ();
147:
148: public abstract Shape getOutline ();
149:
150: public abstract Shape getOutline (float x, float y);
151:
152: public Rectangle getPixelBounds (FontRenderContext renderFRC,
153: float x, float y)
154: {
155: Rectangle bounds = new Rectangle();
156: Rectangle2D rect = getVisualBounds();
157:
158: bounds.x = (int) (rect.getX() + x);
159: bounds.y = (int) (rect.getY() + y);
160: bounds.width = (int) rect.getMaxX() - bounds.x;
161: bounds.height = (int) rect.getMaxY() - bounds.y;
162:
163: return bounds;
164: }
165:
166: public abstract Rectangle2D getVisualBounds ();
167:
168: public abstract void performDefaultLayout ();
169:
170: public abstract void setGlyphPosition (int glyphIndex, Point2D newPos);
171:
172: public abstract void setGlyphTransform (int glyphIndex,
173: AffineTransform newTX);
174: }