Source Code Cross Referenced for PjFontDescriptor.java in  » PDF » pjx » com » etymon » pj » object » 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 » pjx » com.etymon.pj.object 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.etymon.pj.object;
002:
003:        import java.io.*;
004:        import java.util.*;
005:        import com.etymon.pj.*;
006:        import com.etymon.pj.exception.*;
007:
008:        /**
009:         A representation of a PDF font descriptor (abstract base class).
010:         @author Carl Scholz (Texterity Inc.)
011:         @author Nassib Nassar (Etymon Systems, Inc.)
012:         */
013:        public class PjFontDescriptor extends PjDictionary {
014:
015:            /**
016:               @deprecated
017:             */
018:            private static String[] PjFDFlagBitNames = { "FixedWidth", // (2)
019:                    "Serif", // (2^2)
020:                    "Symbolic", // (2^3)
021:                    "Script", // (2^4)
022:                    "Reserved5", // (2^5)
023:                    "RomanCharSet", // (2^6)
024:                    "Italic", // (2^7)
025:                    "Reserved8", // (2^8)
026:                    "Reserved9", // (2^9)
027:                    "Reserved10", // (2^10)
028:                    "Reserved11", // (2^11)
029:                    "Reserved12", // (2^12)
030:                    "Reserved13", // (2^13)
031:                    "Reserved14", // (2^14)
032:                    "Reserved15", // (2^15)
033:                    "Reserved16", // (2^16)
034:                    "AllCap", // (2^17)
035:                    "SmallCap", // (2^18)
036:                    "ForceBoldAtSmallSizes", // (2^19)
037:                    "Reserved20", // (2^20)
038:                    "Reserved21", // (2^21)
039:                    "Reserved22", // (2^22)
040:                    "Reserved23", // (2^23)
041:                    "Reserved24", // (2^24)
042:                    "Reserved25", // (2^25)
043:                    "Reserved26", // (2^26)
044:                    "Reserved27", // (2^27)
045:                    "Reserved28", // (2^28)
046:                    "Reserved29", // (2^29)
047:                    "Reserved30", // (2^30)
048:                    "Reserved31", // (2^31)
049:                    "Reserved32" // (2^32)
050:            };
051:
052:            /**
053:               Creates a new font descriptor dictionary.
054:             */
055:            public PjFontDescriptor() {
056:                super ();
057:                _h.put(PjName.TYPE, PjName.FONTDESCRIPTOR);
058:            }
059:
060:            /**
061:               Creates a font descriptor dictionary as a wrapper around a Hashtable.
062:               @param h the Hashtable to use for this dictionary.
063:             */
064:            public PjFontDescriptor(Hashtable h) {
065:                super (h);
066:                _h.put(PjName.TYPE, PjName.FONTDESCRIPTOR);
067:            }
068:
069:            /* Required --------------------------------------- */
070:
071:            public void setAscent(PjNumber ascent) {
072:                _h.put(PjName.ASCENT, ascent);
073:            }
074:
075:            public PjObject getAscent() throws InvalidPdfObjectException {
076:                return hget(PjName.ASCENT);
077:            }
078:
079:            public void setCapHeight(PjNumber capheight) {
080:                _h.put(PjName.CAPHEIGHT, capheight);
081:            }
082:
083:            public PjObject getCapHeight() throws InvalidPdfObjectException {
084:                return hget(PjName.CAPHEIGHT);
085:            }
086:
087:            public void setDescent(PjNumber descent) {
088:                _h.put(PjName.DESCENT, descent);
089:            }
090:
091:            public PjObject getDescent() throws InvalidPdfObjectException {
092:                return hget(PjName.DESCENT);
093:            }
094:
095:            public void setFlags(PjNumber flags) {
096:                _h.put(PjName.FLAGS, flags);
097:            }
098:
099:            public PjObject getFlags() throws InvalidPdfObjectException {
100:                return hget(PjName.FLAGS);
101:            }
102:
103:            public static boolean flagsFixedWidth(int flags) {
104:                return ((flags & (1 << 0)) != 0);
105:            }
106:
107:            public static boolean flagsSerif(int flags) {
108:                return ((flags & (1 << 1)) != 0);
109:            }
110:
111:            public static boolean flagsSymbolic(int flags) {
112:                return ((flags & (1 << 2)) != 0);
113:            }
114:
115:            public static boolean flagsScript(int flags) {
116:                return ((flags & (1 << 3)) != 0);
117:            }
118:
119:            public static boolean flagsRomanCharSet(int flags) {
120:                return ((flags & (1 << 5)) != 0);
121:            }
122:
123:            public static boolean flagsItalic(int flags) {
124:                return ((flags & (1 << 6)) != 0);
125:            }
126:
127:            public static boolean flagsAllCap(int flags) {
128:                return ((flags & (1 << 16)) != 0);
129:            }
130:
131:            public static boolean flagsSmallCap(int flags) {
132:                return ((flags & (1 << 17)) != 0);
133:            }
134:
135:            public static boolean flagsForceBoldAtSmallSizes(int flags) {
136:                return ((flags & (2 << 18)) != 0);
137:            }
138:
139:            /**
140:               @deprecated
141:             */
142:            public String getFlagBits() throws InvalidPdfObjectException {
143:                int _flags = ((PjNumber) hget(PjName.FLAGS)).getInt();
144:                StringBuffer buf = new StringBuffer();
145:
146:                for (int i = 0; i <= 31; i++) {
147:                    // bit range is 1 to 32 in spec, so that's a loop from 0 to
148:                    // 31 here.
149:
150:                    if ((_flags & 1) == 1) {
151:                        buf.append(PjFDFlagBitNames[i] + " ");
152:                    }
153:                    _flags = _flags >> 1;
154:                }
155:                if (buf.length() > 0) {
156:                    return buf.toString();
157:                } else {
158:                    return null;
159:                }
160:            }
161:
162:            public void setFontBBox(PjRectangle fontbbox) {
163:                _h.put(PjName.FONTBBOX, fontbbox);
164:            }
165:
166:            public PjObject getFontBBox() throws InvalidPdfObjectException {
167:                return hget(PjName.FONTBBOX);
168:            }
169:
170:            public void setFontName(PjName fontname) {
171:                _h.put(PjName.FONTNAME, fontname);
172:            }
173:
174:            public PjObject getFontName() throws InvalidPdfObjectException {
175:                return hget(PjName.FONTNAME);
176:            }
177:
178:            public void setItalicAngle(PjNumber italicangle) {
179:                _h.put(PjName.ITALICANGLE, italicangle);
180:            }
181:
182:            public PjObject getItalicAngle() throws InvalidPdfObjectException {
183:                return hget(PjName.ITALICANGLE);
184:            }
185:
186:            public void setStemV(PjNumber stemv) {
187:                _h.put(PjName.STEMV, stemv);
188:            }
189:
190:            public PjObject getStemV() throws InvalidPdfObjectException {
191:                return hget(PjName.STEMV);
192:            }
193:
194:            /* Optional --------------------------------------- */
195:
196:            public void setAvgWidth(PjNumber avgWidth) {
197:                _h.put(PjName.AVGWIDTH, avgWidth);
198:            }
199:
200:            public PjObject getAvgWidth() throws InvalidPdfObjectException {
201:                return hget(PjName.AVGWIDTH);
202:            }
203:
204:            public void setCharSet(PjString charSet) {
205:                _h.put(PjName.CHARSET, charSet);
206:            }
207:
208:            public PjObject getCharSet() throws InvalidPdfObjectException {
209:                return hget(PjName.CHARSET);
210:            }
211:
212:            public void setFontFile(PjStream fontFile) {
213:                _h.put(PjName.FONTFILE, fontFile);
214:            }
215:
216:            public PjObject getFontFile() throws InvalidPdfObjectException {
217:                return hget(PjName.FONTFILE);
218:            }
219:
220:            public void setFontFile2(PjStream fontFile2) {
221:                _h.put(PjName.FONTFILE2, fontFile2);
222:            }
223:
224:            public PjObject getFontFile2() throws InvalidPdfObjectException {
225:                return hget(PjName.FONTFILE2);
226:            }
227:
228:            public void setFontFile3(PjStream fontFile3) {
229:                _h.put(PjName.FONTFILE3, fontFile3);
230:            }
231:
232:            public PjObject getFontFile3() throws InvalidPdfObjectException {
233:                return hget(PjName.FONTFILE3);
234:            }
235:
236:            public void setLeading(PjNumber leading) {
237:                _h.put(PjName.LEADING, leading);
238:            }
239:
240:            public PjObject getLeading() throws InvalidPdfObjectException {
241:                return hget(PjName.LEADING);
242:            }
243:
244:            public void setMaxWidth(PjNumber maxWidth) {
245:                _h.put(PjName.MAXWIDTH, maxWidth);
246:            }
247:
248:            public PjObject getMaxWidth() throws InvalidPdfObjectException {
249:                return hget(PjName.MAXWIDTH);
250:            }
251:
252:            public void setMissingWidth(PjNumber missingWidth) {
253:                _h.put(PjName.MISSINGWIDTH, missingWidth);
254:            }
255:
256:            public PjObject getMissingWidth() throws InvalidPdfObjectException {
257:                return hget(PjName.MISSINGWIDTH);
258:            }
259:
260:            public void setStemH(PjNumber stemH) {
261:                _h.put(PjName.STEMH, stemH);
262:            }
263:
264:            public PjObject getStemH() throws InvalidPdfObjectException {
265:                return hget(PjName.STEMH);
266:            }
267:
268:            public void setXHeight(PjNumber xHeight) {
269:                _h.put(PjName.XHEIGHT, xHeight);
270:            }
271:
272:            public PjObject getXHeight() throws InvalidPdfObjectException {
273:                return hget(PjName.XHEIGHT);
274:            }
275:
276:            /**
277:               Examines a dictionary to see if it is a PDF font descriptor.
278:               @param dictionary the dictionary to examine.
279:               @return true if the dictionary could be interpreted as a
280:               valid PjFontDescriptor object.
281:             */
282:            public static boolean isLike(PjDictionary dictionary) {
283:                Hashtable h = dictionary.getHashtable();
284:                // check if the Type is FontDescriptor
285:                try {
286:                    PjName type = (PjName) (h.get(PjName.TYPE));
287:                    if (type == null) {
288:                        return false;
289:                    }
290:                    if (!type.equals(PjName.FONTDESCRIPTOR)) {
291:                        return false;
292:                    }
293:                } catch (ClassCastException e) {
294:                    return false;
295:                }
296:                return true;
297:            }
298:
299:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.