Source Code Cross Referenced for PDFontDescriptor.java in  » PDF » PDFBox-0.7.3 » org » pdfbox » pdmodel » 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 » PDF » PDFBox 0.7.3 » org.pdfbox.pdmodel.font 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright (c) 2004, www.pdfbox.org
003:         * All rights reserved.
004:         *
005:         * Redistribution and use in source and binary forms, with or without
006:         * modification, are permitted provided that the following conditions are met:
007:         *
008:         * 1. Redistributions of source code must retain the above copyright notice,
009:         *    this list of conditions and the following disclaimer.
010:         * 2. Redistributions in binary form must reproduce the above copyright notice,
011:         *    this list of conditions and the following disclaimer in the documentation
012:         *    and/or other materials provided with the distribution.
013:         * 3. Neither the name of pdfbox; nor the names of its
014:         *    contributors may be used to endorse or promote products derived from this
015:         *    software without specific prior written permission.
016:         *
017:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
018:         * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
019:         * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
020:         * DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
021:         * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
022:         * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
023:         * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
024:         * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
025:         * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
026:         * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
027:         *
028:         * http://www.pdfbox.org
029:         *
030:         */package org.pdfbox.pdmodel.font;
031:
032:        import java.io.IOException;
033:
034:        import org.pdfbox.pdmodel.common.PDRectangle;
035:
036:        /**
037:         * This class represents an interface to the font description.  This will depend
038:         * on the font type for the actual implementation.  If it is a AFM/cmap/or embedded font.
039:         *
040:         * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
041:         * @version $Revision: 1.2 $
042:         */
043:        public abstract class PDFontDescriptor {
044:            /**
045:             * A font descriptor flag.  See PDF Reference for description.
046:             */
047:            private static final int FLAG_FIXED_PITCH = 1;
048:            /**
049:             * A font descriptor flag.  See PDF Reference for description.
050:             */
051:            private static final int FLAG_SERIF = 2;
052:            /**
053:             * A font descriptor flag.  See PDF Reference for description.
054:             */
055:            private static final int FLAG_SYMBOLIC = 3;
056:            /**
057:             * A font descriptor flag.  See PDF Reference for description.
058:             */
059:            private static final int FLAG_SCRIPT = 4;
060:            /**
061:             * A font descriptor flag.  See PDF Reference for description.
062:             */
063:            private static final int FLAG_NON_SYMBOLIC = 6;
064:            /**
065:             * A font descriptor flag.  See PDF Reference for description.
066:             */
067:            private static final int FLAG_ITALIC = 7;
068:            /**
069:             * A font descriptor flag.  See PDF Reference for description.
070:             */
071:            private static final int FLAG_ALL_CAP = 17;
072:            /**
073:             * A font descriptor flag.  See PDF Reference for description.
074:             */
075:            private static final int FLAG_SMALL_CAP = 18;
076:            /**
077:             * A font descriptor flag.  See PDF Reference for description.
078:             */
079:            private static final int FLAG_FORCE_BOLD = 19;
080:
081:            /**
082:             * Get the font name.
083:             *
084:             * @return The name of the font.
085:             */
086:            public abstract String getFontName();
087:
088:            /**
089:             * This will set the font name.
090:             *
091:             * @param fontName The new name for the font.
092:             */
093:            public abstract void setFontName(String fontName);
094:
095:            /**
096:             * A string representing the preferred font family.
097:             *
098:             * @return The font family.
099:             */
100:            public abstract String getFontFamily();
101:
102:            /**
103:             * This will set the font family.
104:             *
105:             * @param fontFamily The font family.
106:             */
107:            public abstract void setFontFamily(String fontFamily);
108:
109:            /**
110:             * A string representing the preferred font stretch.
111:             * According to the PDF Spec:
112:             * The font stretch value; it must be one of the following (ordered from
113:             * narrowest to widest): UltraCondensed, ExtraCondensed, Condensed, SemiCondensed,
114:             * Normal, SemiExpanded, Expanded, ExtraExpanded or UltraExpanded.
115:             *
116:             * @return The font stretch.
117:             */
118:            public abstract String getFontStretch();
119:
120:            /**
121:             * This will set the font stretch.
122:             *
123:             * @param fontStretch The font stretch
124:             */
125:            public abstract void setFontStretch(String fontStretch);
126:
127:            /**
128:             * The weight of the font.  According to the PDF spec "possible values are
129:             * 100, 200, 300, 400, 500, 600, 700, 800 or 900"  Where a higher number is
130:             * more weight and appears to be more bold.
131:             *
132:             * @return The font weight.
133:             */
134:            public abstract float getFontWeight();
135:
136:            /**
137:             * Set the weight of the font.
138:             *
139:             * @param fontWeight The new weight of the font.
140:             */
141:            public abstract void setFontWeight(float fontWeight);
142:
143:            /**
144:             * This will get the font flags.
145:             *
146:             * @return The font flags.
147:             */
148:            public abstract int getFlags();
149:
150:            /**
151:             * This will set the font flags.
152:             *
153:             * @param flags The new font flags.
154:             */
155:            public abstract void setFlags(int flags);
156:
157:            /**
158:             * A convenience method that checks the flag bit.
159:             *
160:             * @return The flag value.
161:             */
162:            public boolean isFixedPitch() {
163:                return isFlagBitOn(FLAG_FIXED_PITCH);
164:            }
165:
166:            /**
167:             * A convenience method that sets the flag bit.
168:             *
169:             * @param flag The flag value.
170:             */
171:            public void setFixedPitch(boolean flag) {
172:                setFlagBit(FLAG_FIXED_PITCH, flag);
173:            }
174:
175:            /**
176:             * A convenience method that checks the flag bit.
177:             *
178:             * @return The flag value.
179:             */
180:            public boolean isSerif() {
181:                return isFlagBitOn(FLAG_SERIF);
182:            }
183:
184:            /**
185:             * A convenience method that sets the flag bit.
186:             *
187:             * @param flag The flag value.
188:             */
189:            public void setSerif(boolean flag) {
190:                setFlagBit(FLAG_SERIF, flag);
191:            }
192:
193:            /**
194:             * A convenience method that checks the flag bit.
195:             *
196:             * @return The flag value.
197:             */
198:            public boolean isSymbolic() {
199:                return isFlagBitOn(FLAG_SYMBOLIC);
200:            }
201:
202:            /**
203:             * A convenience method that sets the flag bit.
204:             *
205:             * @param flag The flag value.
206:             */
207:            public void setSymbolic(boolean flag) {
208:                setFlagBit(FLAG_SYMBOLIC, flag);
209:            }
210:
211:            /**
212:             * A convenience method that checks the flag bit.
213:             *
214:             * @return The flag value.
215:             */
216:            public boolean isScript() {
217:                return isFlagBitOn(FLAG_SCRIPT);
218:            }
219:
220:            /**
221:             * A convenience method that sets the flag bit.
222:             *
223:             * @param flag The flag value.
224:             */
225:            public void setScript(boolean flag) {
226:                setFlagBit(FLAG_SCRIPT, flag);
227:            }
228:
229:            /**
230:             * A convenience method that checks the flag bit.
231:             *
232:             * @return The flag value.
233:             */
234:            public boolean isNonSymbolic() {
235:                return isFlagBitOn(FLAG_NON_SYMBOLIC);
236:            }
237:
238:            /**
239:             * A convenience method that sets the flag bit.
240:             *
241:             * @param flag The flag value.
242:             */
243:            public void setNonSymbolic(boolean flag) {
244:                setFlagBit(FLAG_NON_SYMBOLIC, flag);
245:            }
246:
247:            /**
248:             * A convenience method that checks the flag bit.
249:             *
250:             * @return The flag value.
251:             */
252:            public boolean isItalic() {
253:                return isFlagBitOn(FLAG_ITALIC);
254:            }
255:
256:            /**
257:             * A convenience method that sets the flag bit.
258:             *
259:             * @param flag The flag value.
260:             */
261:            public void setItalic(boolean flag) {
262:                setFlagBit(FLAG_ITALIC, flag);
263:            }
264:
265:            /**
266:             * A convenience method that checks the flag bit.
267:             *
268:             * @return The flag value.
269:             */
270:            public boolean isAllCap() {
271:                return isFlagBitOn(FLAG_ALL_CAP);
272:            }
273:
274:            /**
275:             * A convenience method that sets the flag bit.
276:             *
277:             * @param flag The flag value.
278:             */
279:            public void setAllCap(boolean flag) {
280:                setFlagBit(FLAG_ALL_CAP, flag);
281:            }
282:
283:            /**
284:             * A convenience method that checks the flag bit.
285:             *
286:             * @return The flag value.
287:             */
288:            public boolean isSmallCap() {
289:                return isFlagBitOn(FLAG_SMALL_CAP);
290:            }
291:
292:            /**
293:             * A convenience method that sets the flag bit.
294:             *
295:             * @param flag The flag value.
296:             */
297:            public void setSmallCap(boolean flag) {
298:                setFlagBit(FLAG_SMALL_CAP, flag);
299:            }
300:
301:            /**
302:             * A convenience method that checks the flag bit.
303:             *
304:             * @return The flag value.
305:             */
306:            public boolean isForceBold() {
307:                return isFlagBitOn(FLAG_FORCE_BOLD);
308:            }
309:
310:            /**
311:             * A convenience method that sets the flag bit.
312:             *
313:             * @param flag The flag value.
314:             */
315:            public void setForceBold(boolean flag) {
316:                setFlagBit(FLAG_FORCE_BOLD, flag);
317:            }
318:
319:            private boolean isFlagBitOn(int bit) {
320:                return (getFlags() & (1 << (bit - 1))) != 0;
321:            }
322:
323:            private void setFlagBit(int bit, boolean value) {
324:                int flags = getFlags();
325:                if (value) {
326:                    flags = flags | (1 << (bit - 1));
327:                } else {
328:                    flags = flags & (0xFFFFFFFF ^ (1 << (bit - 1)));
329:                }
330:                setFlags(flags);
331:            }
332:
333:            /**
334:             * This will get the fonts bouding box.
335:             *
336:             * @return The fonts bouding box.
337:             */
338:            public abstract PDRectangle getFontBoundingBox();
339:
340:            /**
341:             * Set the fonts bounding box.
342:             *
343:             * @param rect The new bouding box.
344:             */
345:            public abstract void setFontBoundingBox(PDRectangle rect);
346:
347:            /**
348:             * This will get the italic angle for the font.
349:             *
350:             * @return The italic angle.
351:             */
352:            public abstract float getItalicAngle();
353:
354:            /**
355:             * This will set the italic angle for the font.
356:             *
357:             * @param angle The new italic angle for the font.
358:             */
359:            public abstract void setItalicAngle(float angle);
360:
361:            /**
362:             * This will get the ascent for the font.
363:             *
364:             * @return The ascent.
365:             */
366:            public abstract float getAscent();
367:
368:            /**
369:             * This will set the ascent for the font.
370:             *
371:             * @param ascent The new ascent for the font.
372:             */
373:            public abstract void setAscent(float ascent);
374:
375:            /**
376:             * This will get the descent for the font.
377:             *
378:             * @return The descent.
379:             */
380:            public abstract float getDescent();
381:
382:            /**
383:             * This will set the descent for the font.
384:             *
385:             * @param descent The new descent for the font.
386:             */
387:            public abstract void setDescent(float descent);
388:
389:            /**
390:             * This will get the leading for the font.
391:             *
392:             * @return The leading.
393:             */
394:            public abstract float getLeading();
395:
396:            /**
397:             * This will set the leading for the font.
398:             *
399:             * @param leading The new leading for the font.
400:             */
401:            public abstract void setLeading(float leading);
402:
403:            /**
404:             * This will get the CapHeight for the font.
405:             *
406:             * @return The cap height.
407:             */
408:            public abstract float getCapHeight();
409:
410:            /**
411:             * This will set the cap height for the font.
412:             *
413:             * @param capHeight The new cap height for the font.
414:             */
415:            public abstract void setCapHeight(float capHeight);
416:
417:            /**
418:             * This will get the x height for the font.
419:             *
420:             * @return The x height.
421:             */
422:            public abstract float getXHeight();
423:
424:            /**
425:             * This will set the x height for the font.
426:             *
427:             * @param xHeight The new x height for the font.
428:             */
429:            public abstract void setXHeight(float xHeight);
430:
431:            /**
432:             * This will get the stemV for the font.
433:             *
434:             * @return The stem v value.
435:             */
436:            public abstract float getStemV();
437:
438:            /**
439:             * This will set the stem V for the font.
440:             *
441:             * @param stemV The new stem v for the font.
442:             */
443:            public abstract void setStemV(float stemV);
444:
445:            /**
446:             * This will get the stemH for the font.
447:             *
448:             * @return The stem h value.
449:             */
450:            public abstract float getStemH();
451:
452:            /**
453:             * This will set the stem H for the font.
454:             *
455:             * @param stemH The new stem h for the font.
456:             */
457:            public abstract void setStemH(float stemH);
458:
459:            /**
460:             * This will get the average width for the font.  This is part of the
461:             * definition in the font description.  If it is not present then PDFBox
462:             * will make an attempt to calculate it.
463:             *
464:             * @return The average width value.
465:             *
466:             * @throws IOException If there is an error calculating the average width.
467:             */
468:            public abstract float getAverageWidth() throws IOException;
469:
470:            /**
471:             * This will set the average width for the font.
472:             *
473:             * @param averageWidth The new average width for the font.
474:             */
475:            public abstract void setAverageWidth(float averageWidth);
476:
477:            /**
478:             * This will get the max width for the font.
479:             *
480:             * @return The max width value.
481:             */
482:            public abstract float getMaxWidth();
483:
484:            /**
485:             * This will set the max width for the font.
486:             *
487:             * @param maxWidth The new max width for the font.
488:             */
489:            public abstract void setMaxWidth(float maxWidth);
490:
491:            /**
492:             * This will get the character set for the font.
493:             *
494:             * @return The character set value.
495:             */
496:            public abstract String getCharSet();
497:
498:            /**
499:             * This will set the character set for the font.
500:             *
501:             * @param charSet The new character set for the font.
502:             */
503:            public abstract void setCharacterSet(String charSet);
504:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.