Source Code Cross Referenced for OutlineFont.java in  » Graphic-Library » fop » org » apache » fop » render » afp » fonts » 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 » fop » org.apache.fop.render.afp.fonts 
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:        /* $Id: OutlineFont.java 426576 2006-07-28 15:44:37Z jeremias $ */
019:
020:        package org.apache.fop.render.afp.fonts;
021:
022:        /**
023:         * A font defined as a set of lines and curves as opposed to a bitmap font. An
024:         * outline font can be scaled to any size and otherwise transformed more easily
025:         * than a bitmap font, and with more attractive results. <p/>
026:         *
027:         */
028:        public class OutlineFont extends AFPFont {
029:
030:            /** The character set for this font */
031:            private CharacterSet _characterSet = null;
032:
033:            /**
034:             * Constructor for an outline font.
035:             *
036:             * @param name
037:             *            the name of the font
038:             * @param characterSet
039:             *            the chracter set
040:             */
041:            public OutlineFont(String name, CharacterSet characterSet) {
042:                super (name);
043:                _characterSet = characterSet;
044:            }
045:
046:            /**
047:             * Get the character set metrics.
048:             *
049:             * @return the character set
050:             */
051:            public CharacterSet getCharacterSet() {
052:
053:                return _characterSet;
054:
055:            }
056:
057:            /**
058:             * Get the character set metrics.
059:             * @param size ignored
060:             * @return the character set
061:             */
062:            public CharacterSet getCharacterSet(int size) {
063:
064:                return _characterSet;
065:
066:            }
067:
068:            /**
069:             * Get the first character in this font.
070:             */
071:            public int getFirstChar() {
072:
073:                return _characterSet.getFirstChar();
074:
075:            }
076:
077:            /**
078:             * Get the last character in this font.
079:             */
080:            public int getLastChar() {
081:
082:                return _characterSet.getLastChar();
083:
084:            }
085:
086:            /**
087:             * The ascender is the part of a lowercase letter that extends above the
088:             * "x-height" (the height of the letter "x"), such as "d", "t", or "h". Also
089:             * used to denote the part of the letter extending above the x-height.
090:             *
091:             * @param size
092:             *            the point size
093:             */
094:            public int getAscender(int size) {
095:
096:                return _characterSet.getAscender() / 1000 * size;
097:
098:            }
099:
100:            /**
101:             * Obtains the height of capital letters for the specified point size.
102:             *
103:             * @param size
104:             *            the point size
105:             */
106:            public int getCapHeight(int size) {
107:
108:                return _characterSet.getCapHeight() / 1000 * size;
109:
110:            }
111:
112:            /**
113:             * The descender is the part of a lowercase letter that extends below the
114:             * base line, such as "g", "j", or "p". Also used to denote the part of the
115:             * letter extending below the base line.
116:             *
117:             * @param size
118:             *            the point size
119:             */
120:            public int getDescender(int size) {
121:
122:                return _characterSet.getDescender() / 1000 * size;
123:
124:            }
125:
126:            /**
127:             * The "x-height" (the height of the letter "x").
128:             *
129:             * @param size
130:             *            the point size
131:             */
132:            public int getXHeight(int size) {
133:
134:                return _characterSet.getXHeight() / 1000 * size;
135:
136:            }
137:
138:            /**
139:             * Obtain the width of the character for the specified point size.
140:             */
141:            public int getWidth(int character, int size) {
142:
143:                return _characterSet.width(character) / 1000 * size;
144:
145:            }
146:
147:            /**
148:             * Get the getWidth (in 1/1000ths of a point size) of all characters in this
149:             * character set.
150:             *
151:             * @param size
152:             *            the point size
153:             * @return the widths of all characters
154:             */
155:            public int[] getWidths(int size) {
156:
157:                int[] widths = _characterSet.getWidths();
158:                for (int i = 0; i < widths.length; i++) {
159:                    widths[i] = widths[i] / 1000 * size;
160:                }
161:                return widths;
162:
163:            }
164:
165:            /**
166:             * Get the getWidth (in 1/1000ths of a point size) of all characters in this
167:             * character set.
168:             *
169:             * @return the widths of all characters
170:             */
171:            public int[] getWidths() {
172:
173:                return getWidths(1000);
174:
175:            }
176:
177:            /**
178:             * Map a Unicode character to a code point in the font.
179:             * @param c character to map
180:             * @return the mapped character
181:             */
182:            public char mapChar(char c) {
183:                return _characterSet.mapChar(c);
184:            }
185:
186:            /**
187:             * Get the encoding of the font.
188:             * @return the encoding
189:             */
190:            public String getEncoding() {
191:                return _characterSet.getEncoding();
192:            }
193:
194:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.