KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > dom > svg > SVGTextContent


1 /*
2
3    Copyright 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.dom.svg;
19
20 import java.awt.geom.Rectangle2D JavaDoc;
21 import java.awt.geom.Point2D JavaDoc;
22
23 /**
24  * This class provides the interface for the SVGTextContentElement
25  * for the bridge to implement.
26  *
27  * @author nicolas.socheleau@bitflash.com
28  * @version $Id: SVGTextContent.java,v 1.5 2004/08/18 07:13:19 vhardy Exp $
29  */

30 public interface SVGTextContent
31 {
32     /**
33      * Returns the total number of characters to be
34      * rendered within the current element.
35      * Includes characters which are included
36      * via a <tref> reference.
37      *
38      * @return Total number of characters.
39      */

40     public int getNumberOfChars();
41
42     /**
43      * Returns a tightest rectangle which defines the
44      * minimum and maximum X and Y values in the user
45      * coordinate system for rendering the glyph(s)
46      * that correspond to the specified character.
47      * The calculations assume that all glyphs occupy
48      * the full standard glyph cell for the font. If
49      * multiple consecutive characters are rendered
50      * inseparably (e.g., as a single glyph or a
51      * sequence of glyphs), then each of the inseparable
52      * characters will return the same extent.
53      *
54      * @param charnum The index of the character, where the
55      * first character has an index of 0.
56      * @return The rectangle which encloses all of
57      * the rendered glyph(s).
58      */

59     public Rectangle2D JavaDoc getExtentOfChar(int charnum );
60
61     /**
62      * Returns the current text position before rendering
63      * the character in the user coordinate system for
64      * rendering the glyph(s) that correspond to the
65      * specified character. The current text position has
66      * already taken into account the effects of any inter-
67      * character adjustments due to properties 'kerning',
68      * 'letter-spacing' and 'word-spacing' and adjustments
69      * due to attributes x, y, dx and dy. If multiple
70      * consecutive characters are rendered inseparably
71      * (e.g., as a single glyph or a sequence of glyphs),
72      * then each of the inseparable characters will return
73      * the start position for the first glyph.
74      *
75      * @param charnum The index of the character, where the
76      * first character has an index of 0.
77      * @return The character's start position.
78      */

79     public Point2D JavaDoc getStartPositionOfChar(int charnum);
80
81     /**
82      * Returns the current text position after rendering
83      * the character in the user coordinate system for
84      * rendering the glyph(s) that correspond to the
85      * specified character. This current text position
86      * does not take into account the effects of any inter-
87      * character adjustments to prepare for the next
88      * character, such as properties 'kerning',
89      * 'letter-spacing' and 'word-spacing' and adjustments
90      * due to attributes x, y, dx and dy. If multiple
91      * consecutive characters are rendered inseparably
92      * (e.g., as a single glyph or a sequence of glyphs),
93      * then each of the inseparable characters will return
94      * the end position for the last glyph.
95      *
96      * @param charnum The index of the character, where the
97      * first character has an index of 0.
98      * @return The character's end position.
99      */

100     public Point2D JavaDoc getEndPositionOfChar(int charnum);
101
102     /**
103      * Returns the rotation value relative to the current
104      * user coordinate system used to render the glyph(s)
105      * corresponding to the specified character. If
106      * multiple glyph(s) are used to render the given
107      * character and the glyphs each have different
108      * rotations (e.g., due to text-on-a-path), the user
109      * agent shall return an average value (e.g., the
110      * rotation angle at the midpoint along the path for
111      * all glyphs used to render this character). The
112      * rotation value represents the rotation that is
113      * supplemental to any rotation due to properties
114      * 'glyph-orientation-horizontal' and
115      * 'glyph-orientation-vertical'; thus, any glyph
116      * rotations due to these properties are not included
117      * into the returned rotation value. If multiple
118      * consecutive characters are rendered inseparably
119      * (e.g., as a single glyph or a sequence of glyphs),
120      * then each of the inseparable characters will
121      * return the same rotation value.
122      *
123      * @param charnum The index of the character, where the
124      * first character has an index of 0.
125      * @return The character's rotation angle.
126      */

127     public float getRotationOfChar(int charnum);
128     /**
129      * Causes the specified substring to be selected
130      * just as if the user selected the substring interactively.
131      *
132      * @param charnum : The index of the start character
133      * which is at the given point, where the first
134      * character has an index of 0.
135      * @param nchars : The number of characters in the
136      * substring. If nchars specifies more characters
137      * than are available, then the substring will
138      * consist of all characters starting with charnum
139      * until the end of the list of characters.
140      */

141     public void selectSubString(int charnum, int nchars);
142
143     public float getComputedTextLength();
144
145     public float getSubStringLength(int charnum, int nchars);
146
147     public int getCharNumAtPosition(float x, float y);
148 }
149
Popular Tags