Source Code Cross Referenced for GVTFontFace.java in  » Graphic-Library » batik » org » apache » batik » gvt » 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 » Graphic Library » batik » org.apache.batik.gvt.font 
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.font;
020:
021:        import org.apache.batik.util.SVGConstants;
022:
023:        /**
024:         * One line Class Desc
025:         *
026:         * Complete Class Desc
027:         *
028:         * @author <a href="mailto:deweese@apache.org">l449433</a>
029:         * @version $Id: GVTFontFace.java 475477 2006-11-15 22:44:28Z cam $
030:         */
031:        public class GVTFontFace implements  SVGConstants {
032:            protected String familyName;
033:            protected float unitsPerEm;
034:            protected String fontWeight;
035:            protected String fontStyle;
036:            protected String fontVariant;
037:            protected String fontStretch;
038:            protected float slope;
039:            protected String panose1;
040:            protected float ascent;
041:            protected float descent;
042:            protected float strikethroughPosition;
043:            protected float strikethroughThickness;
044:            protected float underlinePosition;
045:            protected float underlineThickness;
046:            protected float overlinePosition;
047:            protected float overlineThickness;
048:
049:            /**
050:             * Constructes an GVTFontFace with the specfied font-face attributes.
051:             */
052:            public GVTFontFace(String familyName, float unitsPerEm,
053:                    String fontWeight, String fontStyle, String fontVariant,
054:                    String fontStretch, float slope, String panose1,
055:                    float ascent, float descent, float strikethroughPosition,
056:                    float strikethroughThickness, float underlinePosition,
057:                    float underlineThickness, float overlinePosition,
058:                    float overlineThickness) {
059:                this .familyName = familyName;
060:                this .unitsPerEm = unitsPerEm;
061:                this .fontWeight = fontWeight;
062:                this .fontStyle = fontStyle;
063:                this .fontVariant = fontVariant;
064:                this .fontStretch = fontStretch;
065:                this .slope = slope;
066:                this .panose1 = panose1;
067:                this .ascent = ascent;
068:                this .descent = descent;
069:                this .strikethroughPosition = strikethroughPosition;
070:                this .strikethroughThickness = strikethroughThickness;
071:                this .underlinePosition = underlinePosition;
072:                this .underlineThickness = underlineThickness;
073:                this .overlinePosition = overlinePosition;
074:                this .overlineThickness = overlineThickness;
075:            }
076:
077:            /**
078:             * Constructs an SVGFontFace with default values for all the
079:             * font-face attributes other than familyName
080:             */
081:            public GVTFontFace(String familyName) {
082:                this (familyName, 1000, SVG_FONT_FACE_FONT_WEIGHT_DEFAULT_VALUE,
083:                        SVG_FONT_FACE_FONT_STYLE_DEFAULT_VALUE,
084:                        SVG_FONT_FACE_FONT_VARIANT_DEFAULT_VALUE,
085:                        SVG_FONT_FACE_FONT_STRETCH_DEFAULT_VALUE, 0,
086:                        SVG_FONT_FACE_PANOSE_1_DEFAULT_VALUE, 800, 200, 300,
087:                        50, -75, 50, 800, 50);
088:            }
089:
090:            /**
091:             * Returns the family name of this font, it may contain more than one.
092:             */
093:            public String getFamilyName() {
094:                return familyName;
095:            }
096:
097:            public boolean hasFamilyName(String family) {
098:                String ffname = familyName;
099:                if (ffname.length() < family.length()) {
100:                    return false;
101:                }
102:
103:                ffname = ffname.toLowerCase();
104:
105:                int idx = ffname.indexOf(family.toLowerCase());
106:
107:                if (idx == -1) {
108:                    return false;
109:                }
110:
111:                // see if the family name is not the part of a bigger family name.
112:                if (ffname.length() > family.length()) {
113:                    boolean quote = false;
114:                    if (idx > 0) {
115:                        char c = ffname.charAt(idx - 1);
116:                        switch (c) {
117:                        default:
118:                            return false;
119:                        case ' ':
120:                            loop: for (int i = idx - 2; i >= 0; --i) {
121:                                switch (ffname.charAt(i)) {
122:                                default:
123:                                    return false;
124:                                case ' ':
125:                                    continue;
126:                                case '"':
127:                                case '\'':
128:                                    quote = true;
129:                                    break loop;
130:                                }
131:                            }
132:                            break;
133:                        case '"':
134:                        case '\'':
135:                            quote = true;
136:                        case ',':
137:                        }
138:                    }
139:                    if (idx + family.length() < ffname.length()) {
140:                        char c = ffname.charAt(idx + family.length());
141:                        switch (c) {
142:                        default:
143:                            return false;
144:                        case ' ':
145:                            loop: for (int i = idx + family.length() + 1; i < ffname
146:                                    .length(); i++) {
147:                                switch (ffname.charAt(i)) {
148:                                default:
149:                                    return false;
150:                                case ' ':
151:                                    continue;
152:                                case '"':
153:                                case '\'':
154:                                    if (!quote) {
155:                                        return false;
156:                                    }
157:                                    break loop;
158:                                }
159:                            }
160:                            break;
161:                        case '"':
162:                        case '\'':
163:                            if (!quote) {
164:                                return false;
165:                            }
166:                        case ',':
167:                        }
168:                    }
169:                }
170:                return true;
171:            }
172:
173:            /**
174:             * Returns the font-weight.
175:             */
176:            public String getFontWeight() {
177:                return fontWeight;
178:            }
179:
180:            /**
181:             * Returns the font-style.
182:             */
183:            public String getFontStyle() {
184:                return fontStyle;
185:            }
186:
187:            /**
188:             * The number of coordinate units on the em square for this font.
189:             */
190:            public float getUnitsPerEm() {
191:                return unitsPerEm;
192:            }
193:
194:            /**
195:             * Returns the maximum unaccented height of the font within the font
196:             * coordinate system.
197:             */
198:            public float getAscent() {
199:                return ascent;
200:            }
201:
202:            /**
203:             * Returns the maximum unaccented depth of the font within the font
204:             * coordinate system.
205:             */
206:            public float getDescent() {
207:                return descent;
208:            }
209:
210:            /**
211:             * Returns the position of the strikethrough decoration.
212:             */
213:            public float getStrikethroughPosition() {
214:                return strikethroughPosition;
215:            }
216:
217:            /**
218:             * Returns the stroke thickness to use when drawing a strikethrough.
219:             */
220:            public float getStrikethroughThickness() {
221:                return strikethroughThickness;
222:            }
223:
224:            /**
225:             * Returns the position of the underline decoration.
226:             */
227:            public float getUnderlinePosition() {
228:                return underlinePosition;
229:            }
230:
231:            /**
232:             * Returns the stroke thickness to use when drawing a underline.
233:             */
234:            public float getUnderlineThickness() {
235:                return underlineThickness;
236:            }
237:
238:            /**
239:             * Returns the position of the overline decoration.
240:             */
241:            public float getOverlinePosition() {
242:                return overlinePosition;
243:            }
244:
245:            /**
246:             * Returns the stroke thickness to use when drawing a overline.
247:             */
248:            public float getOverlineThickness() {
249:                return overlineThickness;
250:            }
251:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.