Source Code Cross Referenced for HeadTable.java in  » PDF » PDF-Renderer » com » sun » pdfview » font » ttf » 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 » PDF Renderer » com.sun.pdfview.font.ttf 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: HeadTable.java,v 1.3 2007/12/20 18:33:30 rbair Exp $
003:         *
004:         * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
005:         * Santa Clara, California 95054, U.S.A. All rights reserved.
006:         *
007:         * This library is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU Lesser General Public
009:         * License as published by the Free Software Foundation; either
010:         * version 2.1 of the License, or (at your option) any later version.
011:         * 
012:         * This library is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         * Lesser General Public License for more details.
016:         * 
017:         * You should have received a copy of the GNU Lesser General Public
018:         * License along with this library; if not, write to the Free Software
019:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
020:         */
021:
022:        package com.sun.pdfview.font.ttf;
023:
024:        import java.nio.ByteBuffer;
025:        import java.util.Date;
026:
027:        /**
028:         *
029:         * @author  jkaplan
030:         */
031:        public class HeadTable extends TrueTypeTable {
032:
033:            /** Holds value of property version. */
034:            private int version;
035:
036:            /** Holds value of property fontRevision. */
037:            private int fontRevision;
038:
039:            /** Holds value of property checksumAdjustment. */
040:            private int checksumAdjustment;
041:
042:            /** Holds value of property magicNumber. */
043:            private int magicNumber;
044:
045:            /** Holds value of property flags. */
046:            private short flags;
047:
048:            /** Holds value of property unitsPerEm. */
049:            private short unitsPerEm;
050:
051:            /** Holds value of property created. */
052:            private long created;
053:
054:            /** Holds value of property modified. */
055:            private long modified;
056:
057:            /** Holds value of property xMin. */
058:            private short xMin;
059:
060:            /** Holds value of property yMin. */
061:            private short yMin;
062:
063:            /** Holds value of property xMax. */
064:            private short xMax;
065:
066:            /** Holds value of property yMax. */
067:            private short yMax;
068:
069:            /** Holds value of property macStyle. */
070:            private short macStyle;
071:
072:            /** Holds value of property lowestRecPPem. */
073:            private short lowestRecPPem;
074:
075:            /** Holds value of property fontDirectionHint. */
076:            private short fontDirectionHint;
077:
078:            /** Holds value of property indexToLocFormat. */
079:            private short indexToLocFormat;
080:
081:            /** Holds value of property glyphDataFormat. */
082:            private short glyphDataFormat;
083:
084:            /** Creates a new instance of HeadTable 
085:             * Makes up reasonable(?) defaults for all values
086:             */
087:            protected HeadTable() {
088:                super (TrueTypeTable.HEAD_TABLE);
089:
090:                setVersion(0x10000);
091:                setFontRevision(0x10000);
092:                setChecksumAdjustment(0);
093:                setMagicNumber(0x5f0f3cf5);
094:                setFlags((short) 0x0);
095:                setUnitsPerEm((short) 64);
096:                setCreated(System.currentTimeMillis());
097:                setModified(System.currentTimeMillis());
098:                setXMin((short) 0);
099:                setXMax((short) Short.MAX_VALUE);
100:                setYMin((short) 0);
101:                setYMax((short) Short.MAX_VALUE);
102:                setMacStyle((short) 0x0);
103:                setLowestRecPPem((short) 0);
104:                setFontDirectionHint((short) 0);
105:                setIndexToLocFormat((short) 0);
106:                setGlyphDataFormat((short) 0);
107:            }
108:
109:            /**
110:             * Parse the data before it is set
111:             */
112:            public void setData(ByteBuffer data) {
113:                if (data.remaining() != 54) {
114:                    throw new IllegalArgumentException("Bad Head table size");
115:                }
116:                setVersion(data.getInt());
117:                setFontRevision(data.getInt());
118:                setChecksumAdjustment(data.getInt());
119:                setMagicNumber(data.getInt());
120:                setFlags(data.getShort());
121:                setUnitsPerEm(data.getShort());
122:                setCreated(data.getLong());
123:                setModified(data.getLong());
124:                setXMin(data.getShort());
125:                setXMax(data.getShort());
126:                setYMin(data.getShort());
127:                setYMax(data.getShort());
128:                setMacStyle(data.getShort());
129:                setLowestRecPPem(data.getShort());
130:                setFontDirectionHint(data.getShort());
131:                setIndexToLocFormat(data.getShort());
132:                setGlyphDataFormat(data.getShort());
133:            }
134:
135:            /**
136:             * Get the data we have stored
137:             */
138:            public ByteBuffer getData() {
139:                ByteBuffer buf = ByteBuffer.allocate(getLength());
140:
141:                buf.putInt(getVersion());
142:                buf.putInt(getFontRevision());
143:                buf.putInt(getChecksumAdjustment());
144:                buf.putInt(getMagicNumber());
145:                buf.putShort(getFlags());
146:                buf.putShort(getUnitsPerEm());
147:                buf.putLong(getCreated());
148:                buf.putLong(getModified());
149:                buf.putShort(getXMin());
150:                buf.putShort(getXMax());
151:                buf.putShort(getYMin());
152:                buf.putShort(getYMax());
153:                buf.putShort(getMacStyle());
154:                buf.putShort(getLowestRecPPem());
155:                buf.putShort(getFontDirectionHint());
156:                buf.putShort(getIndexToLocFormat());
157:                buf.putShort(getGlyphDataFormat());
158:
159:                // reset the position to the start of the buffer
160:                buf.flip();
161:
162:                return buf;
163:            }
164:
165:            /**
166:             * Get the length of this table
167:             */
168:            public int getLength() {
169:                return 54;
170:            }
171:
172:            /** Getter for property version.
173:             * @return Value of property version.
174:             *
175:             */
176:            public int getVersion() {
177:                return version;
178:            }
179:
180:            /** Getter for property fontRevision.
181:             * @return Value of property fontRevision.
182:             *
183:             */
184:            public int getFontRevision() {
185:                return this .fontRevision;
186:            }
187:
188:            /** Getter for property checksumAdjustment.
189:             * @return Value of property checksumAdjustment.
190:             *
191:             */
192:            public int getChecksumAdjustment() {
193:                return this .checksumAdjustment;
194:            }
195:
196:            /** Getter for property magicNumber.
197:             * @return Value of property magicNumber.
198:             *
199:             */
200:            public int getMagicNumber() {
201:                return this .magicNumber;
202:            }
203:
204:            /** Getter for property flags.
205:             * @return Value of property flags.
206:             *
207:             */
208:            public short getFlags() {
209:                return this .flags;
210:            }
211:
212:            /** Getter for property unitsPerEm.
213:             * @return Value of property unitsPerEm.
214:             *
215:             */
216:            public short getUnitsPerEm() {
217:                return this .unitsPerEm;
218:            }
219:
220:            /** Getter for property created.
221:             * @return Value of property created.
222:             *
223:             */
224:            public long getCreated() {
225:                return this .created;
226:            }
227:
228:            /** Getter for property modified.
229:             * @return Value of property modified.
230:             *
231:             */
232:            public long getModified() {
233:                return this .modified;
234:            }
235:
236:            /** Getter for property xMin.
237:             * @return Value of property xMin.
238:             *
239:             */
240:            public short getXMin() {
241:                return this .xMin;
242:            }
243:
244:            /** Getter for property yMin.
245:             * @return Value of property yMin.
246:             *
247:             */
248:            public short getYMin() {
249:                return this .yMin;
250:            }
251:
252:            /** Getter for property xMax.
253:             * @return Value of property xMax.
254:             *
255:             */
256:            public short getXMax() {
257:                return this .xMax;
258:            }
259:
260:            /** Getter for property yMax.
261:             * @return Value of property yMax.
262:             *
263:             */
264:            public short getYMax() {
265:                return this .yMax;
266:            }
267:
268:            /** Getter for property macStyle.
269:             * @return Value of property macStyle.
270:             *
271:             */
272:            public short getMacStyle() {
273:                return this .macStyle;
274:            }
275:
276:            /** Getter for property lowestRecPPem.
277:             * @return Value of property lowestRecPPem.
278:             *
279:             */
280:            public short getLowestRecPPem() {
281:                return this .lowestRecPPem;
282:            }
283:
284:            /** Getter for property fontDirectionHint.
285:             * @return Value of property fontDirectionHint.
286:             *
287:             */
288:            public short getFontDirectionHint() {
289:                return this .fontDirectionHint;
290:            }
291:
292:            /** Getter for property indexToLocFormat.
293:             * @return Value of property indexToLocFormat.
294:             *
295:             */
296:            public short getIndexToLocFormat() {
297:                return this .indexToLocFormat;
298:            }
299:
300:            /** Getter for property glyphDataFormat.
301:             * @return Value of property glyphDataFormat.
302:             *
303:             */
304:            public short getGlyphDataFormat() {
305:                return this .glyphDataFormat;
306:            }
307:
308:            /** Setter for property XMax.
309:             * @param xMax New value of property XMax.
310:             *
311:             */
312:            public void setXMax(short xMax) {
313:                this .xMax = xMax;
314:            }
315:
316:            /** Setter for property XMin.
317:             * @param xMin New value of property XMin.
318:             *
319:             */
320:            public void setXMin(short xMin) {
321:                this .xMin = xMin;
322:            }
323:
324:            /** Setter for property YMax.
325:             * @param yMax New value of property YMax.
326:             *
327:             */
328:            public void setYMax(short yMax) {
329:                this .yMax = yMax;
330:            }
331:
332:            /** Setter for property YMin.
333:             * @param yMin New value of property YMin.
334:             *
335:             */
336:            public void setYMin(short yMin) {
337:                this .yMin = yMin;
338:            }
339:
340:            /** Setter for property checksumAdjustment.
341:             * @param checksumAdjustment New value of property checksumAdjustment.
342:             *
343:             */
344:            public void setChecksumAdjustment(int checksumAdjustment) {
345:                this .checksumAdjustment = checksumAdjustment;
346:            }
347:
348:            /** Setter for property created.
349:             * @param created New value of property created.
350:             *
351:             */
352:            public void setCreated(long created) {
353:                this .created = created;
354:            }
355:
356:            /** Setter for property flags.
357:             * @param flags New value of property flags.
358:             *
359:             */
360:            public void setFlags(short flags) {
361:                this .flags = flags;
362:            }
363:
364:            /** Setter for property fontDirectionHint.
365:             * @param fontDirectionHint New value of property fontDirectionHint.
366:             *
367:             */
368:            public void setFontDirectionHint(short fontDirectionHint) {
369:                this .fontDirectionHint = fontDirectionHint;
370:            }
371:
372:            /** Setter for property fontRevision.
373:             * @param fontRevision New value of property fontRevision.
374:             *
375:             */
376:            public void setFontRevision(int fontRevision) {
377:                this .fontRevision = fontRevision;
378:            }
379:
380:            /** Setter for property glyphDataFormat.
381:             * @param glyphDataFormat New value of property glyphDataFormat.
382:             *
383:             */
384:            public void setGlyphDataFormat(short glyphDataFormat) {
385:                this .glyphDataFormat = glyphDataFormat;
386:            }
387:
388:            /** Setter for property indexToLocFormat.
389:             * @param indexToLocFormat New value of property indexToLocFormat.
390:             *
391:             */
392:            public void setIndexToLocFormat(short indexToLocFormat) {
393:                this .indexToLocFormat = indexToLocFormat;
394:            }
395:
396:            /** Setter for property lowestRecPPem.
397:             * @param lowestRecPPem New value of property lowestRecPPem.
398:             *
399:             */
400:            public void setLowestRecPPem(short lowestRecPPem) {
401:                this .lowestRecPPem = lowestRecPPem;
402:            }
403:
404:            /** Setter for property macStyle.
405:             * @param macStyle New value of property macStyle.
406:             *
407:             */
408:            public void setMacStyle(short macStyle) {
409:                this .macStyle = macStyle;
410:            }
411:
412:            /** Setter for property magicNumber.
413:             * @param magicNumber New value of property magicNumber.
414:             *
415:             */
416:            public void setMagicNumber(int magicNumber) {
417:                this .magicNumber = magicNumber;
418:            }
419:
420:            /** Setter for property modified.
421:             * @param modified New value of property modified.
422:             *
423:             */
424:            public void setModified(long modified) {
425:                this .modified = modified;
426:            }
427:
428:            /** Setter for property unitsPerEm.
429:             * @param unitsPerEm New value of property unitsPerEm.
430:             *
431:             */
432:            public void setUnitsPerEm(short unitsPerEm) {
433:                this .unitsPerEm = unitsPerEm;
434:            }
435:
436:            /** Setter for property version.
437:             * @param version New value of property version.
438:             *
439:             */
440:            public void setVersion(int version) {
441:                this .version = version;
442:            }
443:
444:            /**
445:             * Create a pretty string
446:             */
447:            public String toString() {
448:                StringBuffer buf = new StringBuffer();
449:                String indent = "    ";
450:
451:                buf.append(indent + "Version          : "
452:                        + Integer.toHexString(getVersion()) + "\n");
453:                buf.append(indent + "Revision         : "
454:                        + Integer.toHexString(getFontRevision()) + "\n");
455:                buf.append(indent + "ChecksumAdj      : "
456:                        + Integer.toHexString(getChecksumAdjustment()) + "\n");
457:                buf.append(indent + "MagicNumber      : "
458:                        + Integer.toHexString(getMagicNumber()) + "\n");
459:                buf.append(indent + "Flags            : "
460:                        + Integer.toBinaryString(getFlags()) + "\n");
461:                buf.append(indent + "UnitsPerEm       : " + getUnitsPerEm()
462:                        + "\n");
463:                buf.append(indent + "Created          : "
464:                        + new Date(getCreated()) + "\n");
465:                buf.append(indent + "Modified         : "
466:                        + new Date(getModified()) + "\n");
467:                buf.append(indent + "XMin             : " + getXMin() + "\n");
468:                buf.append(indent + "XMax             : " + getXMax() + "\n");
469:                buf.append(indent + "YMin             : " + getYMin() + "\n");
470:                buf.append(indent + "YMax             : " + getYMax() + "\n");
471:                buf.append(indent + "MacStyle         : "
472:                        + Integer.toBinaryString(getMacStyle()) + "\n");
473:                buf.append(indent + "LowestPPem       : " + getLowestRecPPem()
474:                        + "\n");
475:                buf.append(indent + "FontDirectionHint: "
476:                        + getFontDirectionHint() + "\n");
477:                buf.append(indent + "IndexToLocFormat : "
478:                        + getIndexToLocFormat() + "\n");
479:                buf.append(indent + "GlyphDataFormat  : "
480:                        + getGlyphDataFormat() + "\n");
481:
482:                return buf.toString();
483:            }
484:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.