Title: The graphics2d package of the FreeHEP library
1The graphics2d package of the FreeHEP library
- Simon Fischer (University of Dortmund)
- Sami Kama (METU, Ankara)
2Overview
- Features
- Package structure and inheritance tree
- Users view example and demo
- PDFGraphics2D
- Font inclusion
- Todo
31.1 Features
- Export graphics displayed on the screen to a file
- in a portable format (PDF, PS)
- independent of the generating application (e.g.
JAS/WIRED) - additional features (limited html strings,
symbols) - Subclass the java.awt.Graphics2D
- easily export everything that can be rendered by
a graphics context
PDF File
41.2 Division of Work
- What we built on
- Mark Dönszelmann PDF writer and utilities
- Charles Loomis PSGraphics and VectorGraphics
interfaces - Whats new?
- PDFGraphics2D
- Type1 and Type3 font embedding both for ps and
pdf - multipage output
52.1 The graphics2d Inheritance Tree
GraphicsdrawLine()drawString()drawImage()
Java 1.1
Graphics2Ddraw(Shape)setTransform()setStroke()
Java 2
62.2 The VectorGraphics2D Implementations
- VectorGraphics2D implementations
- PixelGraphics2D
- PDFGraphics2D
- PSGraphics2D
- SVGGraphics2D
- Additional Exportfilters for bitmaps
- gif, png, ppm
72.3 Additional Utility Classes
83.1 Code Example
public static void export(Component component
String filename)
throws IOException
PDFGraphics2D graphics PDFGraphics2D.createP
DFGraphics2D( component.getSize(),
new FileOutputStream(filename) )
graphics.writeHeader() component.printAll(graph
ics) graphics.donePrinting()
9D E M O
104. PDFGraphics2D
VectorGraphics2D
MultipageDocument
PDFImageDelayQueue
PDFPaintDelayQueue
PDFFontTable
GenericTagHandler
PDFWriter implements PathConstructor
115.1 Font Embedding (1)
- Embed shapes of glyphs plus metric information in
PDF/PS files - Type3 fonts
- simple
- large files
- Type1 fonts
- more difficult (binary, encrypted) representation
- compact format (filesize approx. factor 5)
- hints for better display/rendering of fonts
125.2 Font Embedding (2)
Hello W
135.3 Generation of CharTables
CharTabletoName()toEncoding()toUnicode()
145.4 Font Enbedding (3)
Font
PDFLatin
155.5 Font Embedding (4)
!FontType1-1.0 Monotype Corsiva Generated by
org.freehep.graphics2d.FontEmbedderType111 dict
begin/FontInfo 8 dict dup begin/FullName
(Monotype Corsiva) readonly def/FamilyName
(Monotype Corsiva) readonly defend readonly
def/Encoding 256 array0 1 255 1 index exch
/.notdef put fordup 24 /breve putdup 25 /caron
put...dup 255 /ydieresis putreadonly
defcurrentdict enddup /Private 8 dict dup
begin2 index /CharStrings 230 dict dup
begin/breve 91 RD binary dataND/caron 40 RD
binary dataND.../ydieresis 360 binary
dataND/.notdef 38 RD binary dataNDend end
readonly put noaccess putdup /FontName get exch
definefont pop
165.6 Font Embedding Classes
FontIncluder
FontEmbedder
FontEmbedderPDF
FontEmbedderType1
FontEmbedderPDFType3
FontEmbedderType1PDF
FontEmbedderPS
176. Todo
- PDF
- thumbnails and bookmarks for PDF
- cyclic gradient and custom fill
- Fonts
- add hints to type 1 fonts
- Misc
- progress bar for exporting files