Source Code Cross Referenced for GVTAttributedCharacterIterator.java in  » Graphic-Library » batik » org » apache » batik » gvt » text » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Graphic Library » batik » org.apache.batik.gvt.text 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Licensed to the Apache Software Foundation (ASF) under one or more
004:           contributor license agreements.  See the NOTICE file distributed with
005:           this work for additional information regarding copyright ownership.
006:           The ASF licenses this file to You under the Apache License, Version 2.0
007:           (the "License"); you may not use this file except in compliance with
008:           the License.  You may obtain a copy of the License at
009:
010:               http://www.apache.org/licenses/LICENSE-2.0
011:
012:           Unless required by applicable law or agreed to in writing, software
013:           distributed under the License is distributed on an "AS IS" BASIS,
014:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015:           See the License for the specific language governing permissions and
016:           limitations under the License.
017:
018:         */
019:        package org.apache.batik.gvt.text;
020:
021:        import java.text.AttributedCharacterIterator;
022:        import java.text.AttributedString;
023:        import java.util.Map;
024:        import java.util.Set;
025:
026:        /**
027:         * GVTAttributedCharacterIterator
028:         *
029:         * Used to implement SVG <tspan> and <text>
030:         * attributes.  This implementation is designed for efficient support
031:         * of per-character attributes (i.e. single character attribute spans).
032:         * It supports an extended set of TextAttributes, via inner class
033:         * SVGAttributedCharacterIterator.TextAttributes.
034:         *
035:         * @author <a href="mailto:bill.haneman@ireland.sun.com">Bill Haneman</a>
036:         * @version $Id: GVTAttributedCharacterIterator.java 489226 2006-12-21 00:05:36Z cam $
037:         */
038:
039:        public interface GVTAttributedCharacterIterator extends
040:                AttributedCharacterIterator {
041:
042:            /**
043:             * Sets this iterator's contents to an unattributed copy of String s.
044:             */
045:            void setString(String s);
046:
047:            /**
048:             * Assigns this iterator's contents to be equivalent to AttributedString s.
049:             */
050:            void setString(AttributedString s);
051:
052:            /**
053:             * Sets values of a per-character attribute associated with the content
054:             *     string.
055:             * Characters from <tt>beginIndex</tt> to <tt>endIndex</tt>
056:             *     (zero-offset) are assigned values for attribute key <tt>attr</tt>
057:             *     from the array <tt>attValues.</tt>
058:             * If the length of attValues is less than character span
059:             *     <tt>(endIndex-beginIndex)</tt> the last value is duplicated;
060:             *     if attValues is longer than the character span
061:             *     the extra values are ignored.
062:             * Note that if either beginIndex or endIndex are outside the bounds
063:             *     of the current character array they are clipped accordingly.
064:             */
065:            void setAttributeArray(TextAttribute attr, Object[] attValues,
066:                    int beginIndex, int endIndex);
067:
068:            //From java.text.AttributedCharacterIterator
069:
070:            /**
071:             * Get the keys of all attributes defined on the iterator's text range.
072:             */
073:            Set getAllAttributeKeys();
074:
075:            /**
076:             * Get the value of the named attribute for the current
077:             *     character.
078:             */
079:            Object getAttribute(AttributedCharacterIterator.Attribute attribute);
080:
081:            /**
082:             * Returns a map with the attributes defined on the current
083:             * character.
084:             */
085:            Map getAttributes();
086:
087:            /**
088:             * Get the index of the first character following the
089:             *     run with respect to all attributes containing the current
090:             *     character.
091:             */
092:            int getRunLimit();
093:
094:            /**
095:             * Get the index of the first character following the
096:             *      run with respect to the given attribute containing the current
097:             *      character.
098:             */
099:            int getRunLimit(AttributedCharacterIterator.Attribute attribute);
100:
101:            /**
102:             * Get the index of the first character following the
103:             *     run with respect to the given attributes containing the current
104:             *     character.
105:             */
106:            int getRunLimit(Set attributes);
107:
108:            /**
109:             * Get the index of the first character of the run with
110:             *    respect to all attributes containing the current character.
111:             */
112:            int getRunStart();
113:
114:            /**
115:             * Get the index of the first character of the run with
116:             *      respect to the given attribute containing the current character.
117:             * @param attribute The attribute for whose appearance the first offset
118:             *      is requested.
119:             */
120:            int getRunStart(AttributedCharacterIterator.Attribute attribute);
121:
122:            /**
123:             * Get the index of the first character of the run with
124:             *      respect to the given attributes containing the current character.
125:             * @param attributes the Set of attributes which begins at the returned index.
126:             */
127:            int getRunStart(Set attributes);
128:
129:            //From CharacterIterator
130:
131:            /**
132:             * Create a copy of this iterator
133:             */
134:            Object clone();
135:
136:            /**
137:             * Get the character at the current position (as returned
138:             *      by getIndex()).
139:             * <br><b>Specified by:</b> java.text.CharacterIterator.
140:             */
141:            char current();
142:
143:            /**
144:             * Sets the position to getBeginIndex().
145:             * @return the character at the start index of the text.
146:             * <br><b>Specified by:</b> java.text.CharacterIterator.
147:             */
148:            char first();
149:
150:            /**
151:             * Get the start index of the text.
152:             * <br><b>Specified by:</b> java.text.CharacterIterator.
153:             */
154:            int getBeginIndex();
155:
156:            /**
157:             * Get the end index of the text.
158:             * <br><b>Specified by:</b> java.text.CharacterIterator.
159:             */
160:            int getEndIndex();
161:
162:            /**
163:             * Get the current index.
164:             * <br><b>Specified by:</b> java.text.CharacterIterator.
165:             */
166:            int getIndex();
167:
168:            /**
169:             * Sets the position to getEndIndex()-1 (getEndIndex() if
170:             * the text is empty) and returns the character at that position.
171:             * <br><b>Specified by:</b> java.text.CharacterIterator.
172:             */
173:            char last();
174:
175:            /**
176:             * Increments the iterator's index by one, returning the next character.
177:             * @return the character at the new index.
178:             * <br><b>Specified by:</b> java.text.CharacterIterator.
179:             */
180:            char next();
181:
182:            /**
183:             * Decrements the iterator's index by one and returns
184:             * the character at the new index.
185:             * <br><b>Specified by:</b> java.text.CharacterIterator.
186:             */
187:            char previous();
188:
189:            /**
190:             * Sets the position to the specified position in the text.
191:             * @param position The new (current) index into the text.
192:             * @return the character at new index <em>position</em>.
193:             * <br><b>Specified by:</b> java.text.CharacterIterator.
194:             */
195:            char setIndex(int position);
196:
197:            //Inner classes:
198:
199:            /**
200:             * Attribute keys that identify SVG text attributes.  Anchor point for
201:             * attribute values of X, Y, and ROTATION is determined by the character's
202:             * font and other attributes.
203:             * We duplicate the features of java.awt.font.TextAttribute rather than
204:             * subclassing because java.awt.font.TextAttribute is <em>final</em>.
205:             */
206:            class TextAttribute extends AttributedCharacterIterator.Attribute {
207:
208:                /** Construct a TextAttribute key with name s */
209:                public TextAttribute(String s) {
210:                    super (s);
211:                }
212:
213:                public static final TextAttribute FLOW_PARAGRAPH = new TextAttribute(
214:                        "FLOW_PARAGRAPH");
215:
216:                public static final TextAttribute FLOW_EMPTY_PARAGRAPH = new TextAttribute(
217:                        "FLOW_EMPTY_PARAGRAPH");
218:
219:                public static final TextAttribute FLOW_LINE_BREAK = new TextAttribute(
220:                        "FLOW_LINE_BREAK");
221:
222:                public static final TextAttribute FLOW_REGIONS = new TextAttribute(
223:                        "FLOW_REGIONS");
224:
225:                public static final TextAttribute LINE_HEIGHT = new TextAttribute(
226:                        "LINE_HEIGHT");
227:
228:                public static final TextAttribute PREFORMATTED = new TextAttribute(
229:                        "PREFORMATTED");
230:
231:                /** Attribute span delimiter - new tspan, tref, or textelement.*/
232:                public static final TextAttribute TEXT_COMPOUND_DELIMITER = new TextAttribute(
233:                        "TEXT_COMPOUND_DELIMITER");
234:
235:                /** Element identifier all chars from same element will share an
236:                 *  ID. */
237:                public static final TextAttribute TEXT_COMPOUND_ID = new TextAttribute(
238:                        "TEXT_COMPOUND_ID");
239:
240:                /** Anchor type.*/
241:                public static final TextAttribute ANCHOR_TYPE = new TextAttribute(
242:                        "ANCHOR_TYPE");
243:
244:                /** Marker attribute indicating explicit glyph layout.*/
245:                public static final TextAttribute EXPLICIT_LAYOUT = new TextAttribute(
246:                        "EXPLICIT_LAYOUT");
247:
248:                /** User-space X coordinate for character.*/
249:                public static final TextAttribute X = new TextAttribute("X");
250:
251:                /** User-space Y coordinate for character.*/
252:                public static final TextAttribute Y = new TextAttribute("Y");
253:
254:                /** User-space relative X coordinate for character.*/
255:                public static final TextAttribute DX = new TextAttribute("DX");
256:
257:                /** User-space relative Y coordinate for character.*/
258:                public static final TextAttribute DY = new TextAttribute("DY");
259:
260:                /** Rotation for character, in degrees.*/
261:                public static final TextAttribute ROTATION = new TextAttribute(
262:                        "ROTATION");
263:
264:                /** All the paint attributes for the text.*/
265:                public static final TextAttribute PAINT_INFO = new TextAttribute(
266:                        "PAINT_INFO");
267:
268:                /** Author-expected width for bounding box containing
269:                 *  all text string glyphs.
270:                 */
271:                public static final TextAttribute BBOX_WIDTH = new TextAttribute(
272:                        "BBOX_WIDTH");
273:
274:                /** Method specified for adjusting text element layout size.
275:                 */
276:                public static final TextAttribute LENGTH_ADJUST = new TextAttribute(
277:                        "LENGTH_ADJUST");
278:
279:                /** Convenience flag indicating that non-default glyph spacing is needed.
280:                 */
281:                public static final TextAttribute CUSTOM_SPACING = new TextAttribute(
282:                        "CUSTOM_SPACING");
283:
284:                /** User-specified inter-glyph kerning value.
285:                 */
286:                public static final TextAttribute KERNING = new TextAttribute(
287:                        "KERNING");
288:
289:                /** User-specified inter-glyph spacing value.
290:                 */
291:                public static final TextAttribute LETTER_SPACING = new TextAttribute(
292:                        "LETTER_SPACING");
293:
294:                /** User-specified width for whitespace characters.
295:                 */
296:                public static final TextAttribute WORD_SPACING = new TextAttribute(
297:                        "WORD_SPACING");
298:
299:                /** Path along which text is to be laid out */
300:                public static final TextAttribute TEXTPATH = new TextAttribute(
301:                        "TEXTPATH");
302:
303:                /** Font variant to be used for this character span.
304:                 * @see org.apache.batik.gvt.text.GVTAttributedCharacterIterator.TextAttribute#SMALL_CAPS
305:                 */
306:                public static final TextAttribute FONT_VARIANT = new TextAttribute(
307:                        "FONT_VARIANT");
308:
309:                /** Baseline adjustment to be applied to this character span.
310:                 */
311:                public static final TextAttribute BASELINE_SHIFT = new TextAttribute(
312:                        "BASELINE_SHIFT");
313:
314:                /** Directional writing mode applied to this character span.
315:                 */
316:                public static final TextAttribute WRITING_MODE = new TextAttribute(
317:                        "WRITING_MODE");
318:
319:                public static final TextAttribute VERTICAL_ORIENTATION = new TextAttribute(
320:                        "VERTICAL_ORIENTATION");
321:
322:                public static final TextAttribute VERTICAL_ORIENTATION_ANGLE = new TextAttribute(
323:                        "VERTICAL_ORIENTATION_ANGLE");
324:
325:                public static final TextAttribute HORIZONTAL_ORIENTATION_ANGLE = new TextAttribute(
326:                        "HORIZONTAL_ORIENTATION_ANGLE");
327:
328:                public static final TextAttribute GVT_FONT_FAMILIES = new TextAttribute(
329:                        "GVT_FONT_FAMILIES");
330:
331:                public static final TextAttribute GVT_FONTS = new TextAttribute(
332:                        "GVT_FONTS");
333:
334:                public static final TextAttribute GVT_FONT = new TextAttribute(
335:                        "GVT_FONT");
336:
337:                public static final TextAttribute ALT_GLYPH_HANDLER = new TextAttribute(
338:                        "ALT_GLYPH_HANDLER");
339:
340:                public static final TextAttribute BIDI_LEVEL = new TextAttribute(
341:                        "BIDI_LEVEL");
342:
343:                public static final TextAttribute CHAR_INDEX = new TextAttribute(
344:                        "CHAR_INDEX");
345:
346:                public static final TextAttribute ARABIC_FORM = new TextAttribute(
347:                        "ARABIC_FORM");
348:
349:                // VALUES
350:
351:                /** Value for WRITING_MODE indicating left-to-right */
352:                public static final Integer WRITING_MODE_LTR = new Integer(0x1);
353:
354:                /** Value for WRITING_MODE indicating right-to-left */
355:                public static final Integer WRITING_MODE_RTL = new Integer(0x2);
356:
357:                /** Value for WRITING_MODE indicating top-to-botton */
358:                public static final Integer WRITING_MODE_TTB = new Integer(0x3);
359:
360:                /** Value for VERTICAL_ORIENTATION indicating an angle */
361:                public static final Integer ORIENTATION_ANGLE = new Integer(0x1);
362:
363:                /** Value for VERTICAL_ORIENTATION indicating auto */
364:                public static final Integer ORIENTATION_AUTO = new Integer(0x2);
365:
366:                /** Value for FONT_VARIANT specifying small caps */
367:                public static final Integer SMALL_CAPS = new Integer(0x10);
368:
369:                /** Value for UNDERLINE specifying underlining-on */
370:                public static final Integer UNDERLINE_ON = java.awt.font.TextAttribute.UNDERLINE_ON;
371:
372:                /** Value for OVERLINE specifying overlining-on */
373:                public static final Boolean OVERLINE_ON = Boolean.TRUE;
374:
375:                /** Value for STRIKETHROUGH specifying strikethrough-on */
376:                public static final Boolean STRIKETHROUGH_ON = java.awt.font.TextAttribute.STRIKETHROUGH_ON;
377:
378:                /** Value for LENGTH_ADJUST specifying adjustment to inter-glyph spacing */
379:                public static final Integer ADJUST_SPACING = new Integer(0x0);
380:
381:                /** Value for LENGTH_ADJUST specifying overall scaling of layout outlines */
382:                public static final Integer ADJUST_ALL = new Integer(0x01);
383:
384:                // constant values for the arabic glyph forms
385:                public static final Integer ARABIC_NONE = new Integer(0x0);
386:                public static final Integer ARABIC_ISOLATED = new Integer(0x1);
387:                public static final Integer ARABIC_TERMINAL = new Integer(0x2);
388:                public static final Integer ARABIC_INITIAL = new Integer(0x3);
389:                public static final Integer ARABIC_MEDIAL = new Integer(0x4);
390:
391:            }
392:
393:            /**
394:             * Interface for helper class which mutates the attributes of an
395:             * AttributedCharacterIterator.
396:             * Typically used to convert location and rotation attributes to
397:             * TextAttribute.TRANSFORM attributes, or convert between implementations
398:             * of AttributedCharacterIterator.Attribute.
399:             */
400:            interface AttributeFilter {
401:
402:                /**
403:                 * Modify an AttributedCharacterIterator's attributes systematically.
404:                 * Usually returns a copy since AttributedCharacterIterator instances
405:                 * are often immutable.  The effect of the attribute modification
406:                 * is implementation dependent.
407:                 * @param aci an AttributedCharacterIterator whose attributes are
408:                 *     to be modified.
409:                 * @return an instance of AttributedCharacterIterator with mutated
410:                 *     attributes.
411:                 */
412:                AttributedCharacterIterator mutateAttributes(
413:                        AttributedCharacterIterator aci);
414:
415:            }
416:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.