Source Code Cross Referenced for TextRunSegment.java in  » Apache-Harmony-Java-SE » org-package » org » apache » harmony » awt » gl » font » 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 » Apache Harmony Java SE » org package » org.apache.harmony.awt.gl.font 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         */
017:        /*
018:         * @author Oleg V. Khaschansky
019:         * @version $Revision$
020:         */
021:
022:        package org.apache.harmony.awt.gl.font;
023:
024:        import java.awt.Graphics2D;
025:        import java.awt.Shape;
026:        import java.awt.font.TextHitInfo;
027:        import java.awt.geom.Rectangle2D;
028:
029:        /**
030:         * Abstract class which represents the segment of the text with constant attributes
031:         * running in one direction (i.e. constant level).
032:         */
033:        public abstract class TextRunSegment implements  Cloneable {
034:            float x; // Calculated x location of this segment on the screen
035:            float y; // Calculated y location of this segment on the screen
036:
037:            BasicMetrics metrics; // Metrics of this text run segment
038:            TextDecorator.Decoration decoration; // Underline, srikethrough, etc.
039:            Rectangle2D logicalBounds = null; // Logical bounding box for the segment
040:            Rectangle2D visualBounds = null; // Visual bounding box for the segment
041:
042:            /**
043:             * Returns start index of the segment
044:             * @return start index
045:             */
046:            abstract int getStart();
047:
048:            /**
049:             * Returns end index of the segment
050:             * @return end index
051:             */
052:            abstract int getEnd();
053:
054:            /**
055:             * Returns the number of characters in the segment
056:             * @return number of characters
057:             */
058:            abstract int getLength();
059:
060:            /**
061:             * Renders this text run segment
062:             * @param g2d - graphics to render to
063:             * @param xOffset - X offset from the graphics origin to the
064:             * origin of the text layout
065:             * @param yOffset - Y offset from the graphics origin to the
066:             * origin of the text layout
067:             */
068:            abstract void draw(Graphics2D g2d, float xOffset, float yOffset);
069:
070:            /**
071:             * Creates black box bounds shape for the specified range
072:             * @param start - range sart
073:             * @param limit - range end
074:             * @return black box bounds shape
075:             */
076:            abstract Shape getCharsBlackBoxBounds(int start, int limit);
077:
078:            /**
079:             * Returns the outline shape
080:             * @return outline
081:             */
082:            abstract Shape getOutline();
083:
084:            /**
085:             * Returns visual bounds of this segment
086:             * @return visual bounds
087:             */
088:            abstract Rectangle2D getVisualBounds();
089:
090:            /**
091:             * Returns logical bounds of this segment
092:             * @return logical bounds
093:             */
094:            abstract Rectangle2D getLogicalBounds();
095:
096:            /**
097:             * Calculates advance of the segment
098:             * @return advance
099:             */
100:            abstract float getAdvance();
101:
102:            /**
103:             * Calculates advance delta between two characters
104:             * @param start - 1st position
105:             * @param end - 2nd position
106:             * @return advance increment between specified positions
107:             */
108:            abstract float getAdvanceDelta(int start, int end);
109:
110:            /**
111:             * Calculates index of the character which advance is equal to
112:             * the given. If the given advance is greater then the segment
113:             * advance it returns the position after the last character.
114:             * @param advance - given advance
115:             * @param start - character, from which to start measuring advance
116:             * @return character index
117:             */
118:            abstract int getCharIndexFromAdvance(float advance, int start);
119:
120:            /**
121:             * Checks if the character doesn't contribute to the text advance
122:             * @param index - character index
123:             * @return true if the character has zero advance
124:             */
125:            abstract boolean charHasZeroAdvance(int index);
126:
127:            /**
128:             * Calculates position of the character on the screen
129:             * @param index - character index
130:             * @return X coordinate of the character position
131:             */
132:            abstract float getCharPosition(int index);
133:
134:            /**
135:             * Returns the advance of the individual character
136:             * @param index - character index
137:             * @return character advance
138:             */
139:            abstract float getCharAdvance(int index);
140:
141:            /**
142:             * Creates text hit info from the hit position
143:             * @param x - X coordinate relative to the origin of the layout
144:             * @param y - Y coordinate relative to the origin of the layout
145:             * @return hit info
146:             */
147:            abstract TextHitInfo hitTest(float x, float y);
148:
149:            /**
150:             * Collects justification information into JustificationInfo object
151:             * @param jInfo - JustificationInfo object
152:             */
153:            abstract void updateJustificationInfo(
154:                    TextRunBreaker.JustificationInfo jInfo);
155:
156:            /**
157:             * Performs justification of the segment.
158:             * Updates positions of individual characters.
159:             * @param jInfos - justification information, gathered by the previous passes
160:             * @return amount of growth or shrink of the segment
161:             */
162:            abstract float doJustification(
163:                    TextRunBreaker.JustificationInfo jInfos[]);
164:
165:            @Override
166:            public abstract Object clone();
167:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.