[med-svn] [mesquite] 02/05: Imported Upstream version 3.04+dfsg.1
Andreas Tille
tille at debian.org
Mon May 23 13:47:33 UTC 2016
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository mesquite.
commit ca7b9fea089d1266a7c8698fea7cb8eb9830015c
Author: Andreas Tille <tille at debian.org>
Date: Mon May 23 10:26:20 2016 +0200
Imported Upstream version 3.04+dfsg.1
---
LibrarySource/com/lowagie/text/Anchor.java | 366 ---
LibrarySource/com/lowagie/text/Annotation.java | 727 -----
.../com/lowagie/text/BadElementException.java | 89 -
LibrarySource/com/lowagie/text/Cell.java | 1006 -------
LibrarySource/com/lowagie/text/Chapter.java | 156 -
LibrarySource/com/lowagie/text/Chunk.java | 788 -----
LibrarySource/com/lowagie/text/DocListener.java | 182 --
LibrarySource/com/lowagie/text/DocWriter.java | 510 ----
LibrarySource/com/lowagie/text/Document.java | 916 ------
.../com/lowagie/text/DocumentException.java | 186 --
LibrarySource/com/lowagie/text/Element.java | 319 --
.../com/lowagie/text/ElementListener.java | 75 -
LibrarySource/com/lowagie/text/ElementTags.java | 461 ---
LibrarySource/com/lowagie/text/Entities.java | 388 ---
.../com/lowagie/text/ExceptionConverter.java | 135 -
LibrarySource/com/lowagie/text/Font.java | 752 -----
LibrarySource/com/lowagie/text/FontFactory.java | 661 -----
LibrarySource/com/lowagie/text/Graphic.java | 277 --
LibrarySource/com/lowagie/text/GreekList.java | 141 -
LibrarySource/com/lowagie/text/Header.java | 98 -
LibrarySource/com/lowagie/text/HeaderFooter.java | 206 --
LibrarySource/com/lowagie/text/Image.java | 1892 ------------
LibrarySource/com/lowagie/text/ImgCCITT.java | 146 -
LibrarySource/com/lowagie/text/ImgPostscript.java | 220 --
LibrarySource/com/lowagie/text/ImgRaw.java | 97 -
LibrarySource/com/lowagie/text/ImgTemplate.java | 91 -
LibrarySource/com/lowagie/text/ImgWMF.java | 190 --
LibrarySource/com/lowagie/text/Jpeg.java | 350 ---
LibrarySource/com/lowagie/text/List.java | 549 ----
LibrarySource/com/lowagie/text/ListItem.java | 292 --
.../com/lowagie/text/MarkupAttributes.java | 102 -
LibrarySource/com/lowagie/text/Meta.java | 263 --
LibrarySource/com/lowagie/text/PageSize.java | 153 -
LibrarySource/com/lowagie/text/Paragraph.java | 517 ----
LibrarySource/com/lowagie/text/Phrase.java | 595 ----
LibrarySource/com/lowagie/text/Rectangle.java | 869 ------
LibrarySource/com/lowagie/text/RomanList.java | 291 --
LibrarySource/com/lowagie/text/Row.java | 470 ---
LibrarySource/com/lowagie/text/Section.java | 660 -----
LibrarySource/com/lowagie/text/SpecialSymbol.java | 214 --
LibrarySource/com/lowagie/text/SplitCharacter.java | 99 -
LibrarySource/com/lowagie/text/StringCompare.java | 77 -
LibrarySource/com/lowagie/text/Table.java | 1952 -------------
.../com/lowagie/text/TextElementArray.java | 75 -
LibrarySource/com/lowagie/text/Watermark.java | 123 -
.../com/lowagie/text/ZapfDingbatsList.java | 119 -
.../com/lowagie/text/ZapfDingbatsNumberList.java | 132 -
.../com/lowagie/text/html/HtmlEncoder.java | 211 --
LibrarySource/com/lowagie/text/html/HtmlTags.java | 331 ---
.../com/lowagie/text/html/HtmlWriter.java | 1084 -------
.../text/html/simpleparser/ChainedProperties.java | 127 -
.../text/html/simpleparser/FactoryProperties.java | 174 --
.../lowagie/text/html/simpleparser/HTMLWorker.java | 500 ----
.../lowagie/text/html/simpleparser/IncCell.java | 124 -
.../lowagie/text/html/simpleparser/IncTable.java | 122 -
.../lowagie/text/html/simpleparser/StyleSheet.java | 112 -
.../com/lowagie/text/markup/MarkupParser.java | 567 ----
.../com/lowagie/text/markup/MarkupTags.java | 233 --
.../com/lowagie/text/pdf/ArabicLigaturizer.java | 772 -----
.../com/lowagie/text/pdf/AsianFontMapper.java | 104 -
.../lowagie/text/pdf/BadPdfFormatException.java | 86 -
LibrarySource/com/lowagie/text/pdf/BaseField.java | 686 -----
LibrarySource/com/lowagie/text/pdf/BaseFont.java | 1094 -------
LibrarySource/com/lowagie/text/pdf/BidiLine.java | 915 ------
LibrarySource/com/lowagie/text/pdf/BidiOrder.java | 1241 --------
LibrarySource/com/lowagie/text/pdf/ByteBuffer.java | 597 ----
LibrarySource/com/lowagie/text/pdf/CFFFont.java | 1184 --------
.../com/lowagie/text/pdf/CFFFontSubset.java | 1633 -----------
LibrarySource/com/lowagie/text/pdf/CJKFont.java | 626 ----
LibrarySource/com/lowagie/text/pdf/CMYKColor.java | 118 -
.../com/lowagie/text/pdf/ColorDetails.java | 102 -
LibrarySource/com/lowagie/text/pdf/ColumnText.java | 1420 ---------
.../com/lowagie/text/pdf/DefaultFontMapper.java | 309 --
.../com/lowagie/text/pdf/DocumentFont.java | 413 ---
.../com/lowagie/text/pdf/EnumerateTTC.java | 119 -
.../com/lowagie/text/pdf/ExtendedColor.java | 122 -
.../com/lowagie/text/pdf/ExtraEncoding.java | 74 -
LibrarySource/com/lowagie/text/pdf/FdfReader.java | 214 --
.../com/lowagie/text/pdf/FontDetails.java | 279 --
LibrarySource/com/lowagie/text/pdf/FontMapper.java | 81 -
.../com/lowagie/text/pdf/FontSelector.java | 124 -
LibrarySource/com/lowagie/text/pdf/GlyphList.java | 2200 --------------
LibrarySource/com/lowagie/text/pdf/GrayColor.java | 75 -
.../com/lowagie/text/pdf/HyphenationAuto.java | 126 -
.../com/lowagie/text/pdf/HyphenationEvent.java | 79 -
.../com/lowagie/text/pdf/IntHashtable.java | 339 ---
LibrarySource/com/lowagie/text/pdf/LZWDecoder.java | 232 --
.../com/lowagie/text/pdf/MultiColumnText.java | 504 ----
.../com/lowagie/text/pdf/OutputStreamCounter.java | 170 --
.../com/lowagie/text/pdf/PRIndirectReference.java | 103 -
LibrarySource/com/lowagie/text/pdf/PRStream.java | 229 --
.../com/lowagie/text/pdf/PRTokeniser.java | 587 ----
.../com/lowagie/text/pdf/PageResources.java | 175 --
.../com/lowagie/text/pdf/PatternColor.java | 71 -
.../com/lowagie/text/pdf/PdfAcroForm.java | 744 -----
LibrarySource/com/lowagie/text/pdf/PdfAction.java | 558 ----
.../com/lowagie/text/pdf/PdfAnnotation.java | 741 -----
.../com/lowagie/text/pdf/PdfAppearance.java | 151 -
LibrarySource/com/lowagie/text/pdf/PdfArray.java | 223 --
LibrarySource/com/lowagie/text/pdf/PdfBoolean.java | 130 -
.../com/lowagie/text/pdf/PdfBorderArray.java | 82 -
.../com/lowagie/text/pdf/PdfBorderDictionary.java | 100 -
LibrarySource/com/lowagie/text/pdf/PdfCell.java | 883 ------
LibrarySource/com/lowagie/text/pdf/PdfChunk.java | 782 -----
LibrarySource/com/lowagie/text/pdf/PdfColor.java | 80 -
.../com/lowagie/text/pdf/PdfContentByte.java | 2728 -----------------
.../com/lowagie/text/pdf/PdfContents.java | 147 -
.../com/lowagie/text/pdf/PdfDashPattern.java | 144 -
LibrarySource/com/lowagie/text/pdf/PdfDate.java | 190 --
.../com/lowagie/text/pdf/PdfDestination.java | 221 --
.../com/lowagie/text/pdf/PdfDictionary.java | 315 --
.../com/lowagie/text/pdf/PdfDocument.java | 2972 -------------------
.../com/lowagie/text/pdf/PdfEncodings.java | 717 -----
.../com/lowagie/text/pdf/PdfEncryption.java | 363 ---
.../com/lowagie/text/pdf/PdfEncryptionStream.java | 85 -
.../com/lowagie/text/pdf/PdfException.java | 86 -
.../com/lowagie/text/pdf/PdfFileSpecification.java | 188 --
LibrarySource/com/lowagie/text/pdf/PdfFont.java | 189 --
.../com/lowagie/text/pdf/PdfFormField.java | 353 ---
.../com/lowagie/text/pdf/PdfFormXObject.java | 105 -
.../com/lowagie/text/pdf/PdfFunction.java | 143 -
LibrarySource/com/lowagie/text/pdf/PdfGState.java | 144 -
.../com/lowagie/text/pdf/PdfGraphics2D.java | 1423 ---------
.../com/lowagie/text/pdf/PdfICCBased.java | 88 -
LibrarySource/com/lowagie/text/pdf/PdfImage.java | 281 --
.../com/lowagie/text/pdf/PdfImportedPage.java | 150 -
.../com/lowagie/text/pdf/PdfIndirectObject.java | 171 --
.../com/lowagie/text/pdf/PdfIndirectReference.java | 129 -
LibrarySource/com/lowagie/text/pdf/PdfLayer.java | 302 --
.../com/lowagie/text/pdf/PdfLayerMembership.java | 140 -
LibrarySource/com/lowagie/text/pdf/PdfLine.java | 476 ---
LibrarySource/com/lowagie/text/pdf/PdfLister.java | 187 --
LibrarySource/com/lowagie/text/pdf/PdfLiteral.java | 111 -
.../com/lowagie/text/pdf/PdfMediaClipData.java | 64 -
LibrarySource/com/lowagie/text/pdf/PdfName.java | 1093 -------
.../com/lowagie/text/pdf/PdfNameTree.java | 165 --
LibrarySource/com/lowagie/text/pdf/PdfNull.java | 83 -
LibrarySource/com/lowagie/text/pdf/PdfNumber.java | 159 -
LibrarySource/com/lowagie/text/pdf/PdfOCG.java | 67 -
.../com/lowagie/text/pdf/PdfOCProperties.java | 59 -
LibrarySource/com/lowagie/text/pdf/PdfObject.java | 371 ---
LibrarySource/com/lowagie/text/pdf/PdfOutline.java | 542 ----
LibrarySource/com/lowagie/text/pdf/PdfPCell.java | 697 -----
.../com/lowagie/text/pdf/PdfPCellEvent.java | 74 -
LibrarySource/com/lowagie/text/pdf/PdfPRow.java | 530 ----
.../com/lowagie/text/pdf/PdfPSXObject.java | 99 -
LibrarySource/com/lowagie/text/pdf/PdfPTable.java | 1014 -------
.../com/lowagie/text/pdf/PdfPTableEvent.java | 95 -
LibrarySource/com/lowagie/text/pdf/PdfPage.java | 198 --
.../com/lowagie/text/pdf/PdfPageElement.java | 78 -
.../com/lowagie/text/pdf/PdfPageEvent.java | 191 --
.../com/lowagie/text/pdf/PdfPageEventHelper.java | 203 --
.../com/lowagie/text/pdf/PdfPageLabels.java | 192 --
LibrarySource/com/lowagie/text/pdf/PdfPages.java | 206 --
LibrarySource/com/lowagie/text/pdf/PdfPattern.java | 84 -
.../com/lowagie/text/pdf/PdfPatternPainter.java | 391 ---
.../com/lowagie/text/pdf/PdfPrinterGraphics2D.java | 73 -
LibrarySource/com/lowagie/text/pdf/PdfReader.java | 3052 --------------------
.../com/lowagie/text/pdf/PdfReaderInstance.java | 183 --
.../com/lowagie/text/pdf/PdfRectangle.java | 277 --
.../com/lowagie/text/pdf/PdfRendition.java | 62 -
.../com/lowagie/text/pdf/PdfResources.java | 91 -
LibrarySource/com/lowagie/text/pdf/PdfShading.java | 262 --
.../com/lowagie/text/pdf/PdfShadingPattern.java | 120 -
.../com/lowagie/text/pdf/PdfSpotColor.java | 132 -
LibrarySource/com/lowagie/text/pdf/PdfStream.java | 287 --
LibrarySource/com/lowagie/text/pdf/PdfString.java | 236 --
LibrarySource/com/lowagie/text/pdf/PdfTable.java | 316 --
.../com/lowagie/text/pdf/PdfTemplate.java | 267 --
.../com/lowagie/text/pdf/PdfTextArray.java | 99 -
.../com/lowagie/text/pdf/PdfTransition.java | 253 --
.../com/lowagie/text/pdf/PdfTransparencyGroup.java | 85 -
LibrarySource/com/lowagie/text/pdf/PdfWriter.java | 2542 ----------------
.../lowagie/text/pdf/PdfXConformanceException.java | 70 -
LibrarySource/com/lowagie/text/pdf/Pfm2afm.java | 774 -----
.../com/lowagie/text/pdf/PushbuttonField.java | 602 ----
.../com/lowagie/text/pdf/RadioCheckField.java | 416 ---
.../lowagie/text/pdf/RandomAccessFileOrArray.java | 594 ----
.../com/lowagie/text/pdf/SequenceList.java | 316 --
.../com/lowagie/text/pdf/ShadingColor.java | 75 -
.../com/lowagie/text/pdf/SimpleBookmark.java | 745 -----
.../lowagie/text/pdf/SimpleNamedDestination.java | 335 ---
.../com/lowagie/text/pdf/SimpleXMLDocHandler.java | 80 -
.../text/pdf/SimpleXMLDocHandlerComment.java | 59 -
.../com/lowagie/text/pdf/SimpleXMLParser.java | 1177 --------
LibrarySource/com/lowagie/text/pdf/SpotColor.java | 84 -
LibrarySource/com/lowagie/text/pdf/TextField.java | 556 ----
.../com/lowagie/text/pdf/TrueTypeFont.java | 1300 ---------
.../com/lowagie/text/pdf/TrueTypeFontSubSet.java | 421 ---
.../com/lowagie/text/pdf/TrueTypeFontUnicode.java | 473 ---
LibrarySource/com/lowagie/text/pdf/Type1Font.java | 808 ------
.../com/lowagie/text/pdf/VerticalText.java | 350 ---
LibrarySource/com/lowagie/text/pdf/XfdfReader.java | 208 --
.../com/lowagie/text/pdf/codec/BmpImage.java | 1307 ---------
.../com/lowagie/text/pdf/codec/CCITTG4Encoder.java | 509 ----
.../com/lowagie/text/pdf/codec/GifImage.java | 592 ----
.../com/lowagie/text/pdf/codec/PngImage.java | 989 -------
.../com/lowagie/text/pdf/codec/TIFFConstants.java | 297 --
.../com/lowagie/text/pdf/codec/TIFFDirectory.java | 657 -----
.../com/lowagie/text/pdf/codec/TIFFFaxDecoder.java | 1480 ----------
.../com/lowagie/text/pdf/codec/TIFFField.java | 472 ---
.../com/lowagie/text/pdf/codec/TIFFLZWDecoder.java | 255 --
.../com/lowagie/text/pdf/codec/TiffImage.java | 477 ---
.../text/pdf/codec/postscript/JavaCharStream.java | 548 ----
.../text/pdf/codec/postscript/MetaDoPS.java | 98 -
.../text/pdf/codec/postscript/PACommand.java | 22 -
.../text/pdf/codec/postscript/PAContext.java | 2053 -------------
.../text/pdf/codec/postscript/PAEngine.java | 144 -
.../text/pdf/codec/postscript/PAParser.java | 305 --
.../pdf/codec/postscript/PAParserConstants.java | 49 -
.../pdf/codec/postscript/PAParserTokenManager.java | 803 -----
.../text/pdf/codec/postscript/PAPencil.java | 401 ---
.../lowagie/text/pdf/codec/postscript/PAToken.java | 70 -
.../pdf/codec/postscript/PainterException.java | 23 -
.../text/pdf/codec/postscript/ParseException.java | 193 --
.../lowagie/text/pdf/codec/postscript/Token.java | 82 -
.../text/pdf/codec/postscript/TokenMgrError.java | 134 -
.../lowagie/text/pdf/codec/postscript/paparser.jj | 290 --
.../com/lowagie/text/pdf/codec/wmf/InputMeta.java | 114 -
.../com/lowagie/text/pdf/codec/wmf/MetaBrush.java | 95 -
.../com/lowagie/text/pdf/codec/wmf/MetaDo.java | 760 -----
.../com/lowagie/text/pdf/codec/wmf/MetaFont.java | 206 --
.../com/lowagie/text/pdf/codec/wmf/MetaObject.java | 72 -
.../com/lowagie/text/pdf/codec/wmf/MetaPen.java | 92 -
.../com/lowagie/text/pdf/codec/wmf/MetaState.java | 367 ---
.../com/lowagie/text/pdf/fonts/Courier-Bold.afm | 343 ---
.../lowagie/text/pdf/fonts/Courier-BoldOblique.afm | 343 ---
.../com/lowagie/text/pdf/fonts/Courier-Oblique.afm | 343 ---
.../com/lowagie/text/pdf/fonts/Courier.afm | 343 ---
.../text/pdf/fonts/FontsResourceAnchor.java | 62 -
.../com/lowagie/text/pdf/fonts/Helvetica-Bold.afm | 2828 ------------------
.../text/pdf/fonts/Helvetica-BoldOblique.afm | 2828 ------------------
.../lowagie/text/pdf/fonts/Helvetica-Oblique.afm | 3052 --------------------
.../com/lowagie/text/pdf/fonts/Helvetica.afm | 3052 --------------------
.../com/lowagie/text/pdf/fonts/Symbol.afm | 214 --
.../com/lowagie/text/pdf/fonts/Times-Bold.afm | 2589 -----------------
.../lowagie/text/pdf/fonts/Times-BoldItalic.afm | 2385 ---------------
.../com/lowagie/text/pdf/fonts/Times-Italic.afm | 2668 -----------------
.../com/lowagie/text/pdf/fonts/Times-Roman.afm | 2420 ----------------
.../com/lowagie/text/pdf/fonts/ZapfDingbats.afm | 226 --
.../lowagie/text/pdf/hyphenation/ByteVector.java | 125 -
.../lowagie/text/pdf/hyphenation/CharVector.java | 135 -
.../com/lowagie/text/pdf/hyphenation/Hyphen.java | 69 -
.../lowagie/text/pdf/hyphenation/Hyphenation.java | 84 -
.../text/pdf/hyphenation/HyphenationException.java | 29 -
.../text/pdf/hyphenation/HyphenationTree.java | 462 ---
.../lowagie/text/pdf/hyphenation/Hyphenator.java | 186 --
.../text/pdf/hyphenation/PatternConsumer.java | 56 -
.../text/pdf/hyphenation/SimplePatternParser.java | 278 --
.../lowagie/text/pdf/hyphenation/TernaryTree.java | 668 -----
LibrarySource/pal/alignment/AbstractAlignment.java | 177 --
LibrarySource/pal/alignment/Alignment.java | 77 -
.../pal/alignment/AlignmentParseException.java | 26 -
LibrarySource/pal/alignment/AlignmentUtils.java | 610 ----
.../pal/alignment/AminoAcidAlignment.java | 102 -
.../pal/alignment/BootstrappedAlignment.java | 75 -
LibrarySource/pal/alignment/CodonAlignment.java | 103 -
.../pal/alignment/ConcatenatedAlignment.java | 89 -
.../pal/alignment/GapBalancedAlignment.java | 230 --
LibrarySource/pal/alignment/JumbledAlignment.java | 78 -
LibrarySource/pal/alignment/ReadAlignment.java | 410 ---
LibrarySource/pal/alignment/SimpleAlignment.java | 181 --
LibrarySource/pal/alignment/SitePattern.java | 253 --
LibrarySource/pal/alignment/StrippedAlignment.java | 213 --
LibrarySource/pal/alignment/makefile | 42 -
LibrarySource/pal/alignment/package.html | 8 -
.../pal/coalescent/CoalescentException.java | 34 -
.../pal/coalescent/CoalescentIntervals.java | 405 ---
.../pal/coalescent/CoalescentSimulator.java | 49 -
LibrarySource/pal/coalescent/CoalescentTree.java | 23 -
LibrarySource/pal/coalescent/ConstExpGrowth.java | 416 ---
.../pal/coalescent/ConstantPopulation.java | 236 --
.../pal/coalescent/DemographicClockTree.java | 110 -
LibrarySource/pal/coalescent/DemographicModel.java | 189 --
LibrarySource/pal/coalescent/DemographicTree.java | 27 -
.../pal/coalescent/ExpandingPopulation.java | 287 --
.../pal/coalescent/ExponentialGrowth.java | 285 --
.../pal/coalescent/IntervalsExtractor.java | 237 --
LibrarySource/pal/coalescent/SkylinePlot.java | 415 ---
LibrarySource/pal/coalescent/makefile | 42 -
LibrarySource/pal/coalescent/package.html | 5 -
LibrarySource/pal/datatype/AminoAcids.java | 164 --
LibrarySource/pal/datatype/CodonTable.java | 56 -
LibrarySource/pal/datatype/CodonTableFactory.java | 271 --
LibrarySource/pal/datatype/CodonTableUtils.java | 76 -
LibrarySource/pal/datatype/Codons.java | 73 -
LibrarySource/pal/datatype/DataType.java | 103 -
LibrarySource/pal/datatype/DataTypeUtils.java | 81 -
LibrarySource/pal/datatype/GeneralizedCodons.java | 223 --
LibrarySource/pal/datatype/IUPACNucleotides.java | 148 -
LibrarySource/pal/datatype/IUPACPenaltyTable.java | 67 -
LibrarySource/pal/datatype/Nucleotides.java | 151 -
LibrarySource/pal/datatype/SimpleDataType.java | 60 -
LibrarySource/pal/datatype/StateRemover.java | 91 -
.../pal/datatype/TransitionPenaltyTable.java | 25 -
LibrarySource/pal/datatype/TwoStates.java | 83 -
LibrarySource/pal/datatype/makefile | 42 -
LibrarySource/pal/datatype/package.html | 6 -
.../pal/distance/AlignmentDistanceMatrix.java | 109 -
LibrarySource/pal/distance/DistanceMatrix.java | 286 --
.../pal/distance/DistanceMatrixUtils.java | 121 -
.../pal/distance/DistanceParseException.java | 26 -
.../pal/distance/JukesCantorDistanceMatrix.java | 130 -
LibrarySource/pal/distance/PairwiseDistance.java | 213 --
LibrarySource/pal/distance/ReadDistanceMatrix.java | 88 -
.../pal/distance/SUPGMADistanceMatrix.java | 48 -
.../pal/distance/SequencePairLikelihood.java | 168 --
LibrarySource/pal/distance/makefile | 42 -
LibrarySource/pal/distance/package.html | 8 -
LibrarySource/pal/eval/ChiSquareValue.java | 196 --
.../pal/eval/DemographicLikelihoodValue.java | 58 -
LibrarySource/pal/eval/DemographicValue.java | 178 --
LibrarySource/pal/eval/LikelihoodValue.java | 1358 ---------
LibrarySource/pal/eval/ModelParameters.java | 236 --
LibrarySource/pal/eval/makefile | 42 -
LibrarySource/pal/eval/package.html | 7 -
LibrarySource/pal/gui/CircularGraphics.java | 213 --
LibrarySource/pal/gui/Painter.java | 26 -
LibrarySource/pal/gui/PositionedNode.java | 80 -
LibrarySource/pal/gui/TreeComponent.java | 152 -
LibrarySource/pal/gui/TreePainter.java | 247 --
LibrarySource/pal/gui/TreePainterCircular.java | 142 -
LibrarySource/pal/gui/TreePainterNormal.java | 168 --
LibrarySource/pal/gui/makefile | 42 -
LibrarySource/pal/gui/package.html | 5 -
LibrarySource/pal/io/FormattedInput.java | 362 ---
LibrarySource/pal/io/FormattedOutput.java | 312 --
LibrarySource/pal/io/InputSource.java | 81 -
LibrarySource/pal/io/OutputTarget.java | 102 -
LibrarySource/pal/io/makefile | 42 -
LibrarySource/pal/io/package.html | 7 -
LibrarySource/pal/makefile | 52 -
LibrarySource/pal/math/Binomial.java | 81 -
LibrarySource/pal/math/BoundsCheckedFunction.java | 96 -
.../pal/math/ConjugateDirectionSearch.java | 953 ------
.../pal/math/ConjugateGradientSearch.java | 492 ----
LibrarySource/pal/math/DifferentialEvolution.java | 371 ---
LibrarySource/pal/math/ErrorFunction.java | 104 -
LibrarySource/pal/math/GammaFunction.java | 205 --
LibrarySource/pal/math/GeneralizedDEOptimizer.java | 51 -
LibrarySource/pal/math/LineFunction.java | 295 --
LibrarySource/pal/math/MFWithGradient.java | 39 -
LibrarySource/pal/math/MachineAccuracy.java | 45 -
LibrarySource/pal/math/MathUtils.java | 67 -
LibrarySource/pal/math/MersenneTwisterFast.java | 771 -----
LibrarySource/pal/math/MultivariateFunction.java | 54 -
LibrarySource/pal/math/MultivariateMinimum.java | 218 --
LibrarySource/pal/math/NumericalDerivative.java | 138 -
LibrarySource/pal/math/OrthogonalLineFunction.java | 102 -
LibrarySource/pal/math/OrthogonalSearch.java | 80 -
LibrarySource/pal/math/UnivariateFunction.java | 42 -
LibrarySource/pal/math/UnivariateMinimum.java | 479 ---
LibrarySource/pal/math/UrnModel.java | 121 -
LibrarySource/pal/math/makefile | 42 -
LibrarySource/pal/math/package.html | 7 -
LibrarySource/pal/mep/ConstantMutationRate.java | 198 --
LibrarySource/pal/mep/MutationRateModel.java | 113 -
LibrarySource/pal/mep/SteppedMutationRate.java | 374 ---
LibrarySource/pal/mep/WindowedMutationRate.java | 310 --
LibrarySource/pal/mep/makefile | 42 -
LibrarySource/pal/mep/package.html | 6 -
LibrarySource/pal/misc/BranchLimits.java | 40 -
LibrarySource/pal/misc/GeneralFunction.java | 22 -
LibrarySource/pal/misc/IdGenerator.java | 42 -
LibrarySource/pal/misc/IdGroup.java | 41 -
LibrarySource/pal/misc/Identifier.java | 67 -
LibrarySource/pal/misc/Nameable.java | 35 -
LibrarySource/pal/misc/Parameterized.java | 85 -
LibrarySource/pal/misc/ParameterizedDouble.java | 144 -
LibrarySource/pal/misc/Product.java | 32 -
LibrarySource/pal/misc/ReleaseInfo.java | 31 -
LibrarySource/pal/misc/Report.java | 30 -
LibrarySource/pal/misc/SimpleIdGroup.java | 169 --
LibrarySource/pal/misc/SimpleSummarizable.java | 56 -
LibrarySource/pal/misc/Sum.java | 33 -
LibrarySource/pal/misc/SumToOneWeighting.java | 198 --
LibrarySource/pal/misc/Summarizable.java | 23 -
LibrarySource/pal/misc/TimeOrderCharacterData.java | 387 ---
LibrarySource/pal/misc/TimeStamp.java | 66 -
LibrarySource/pal/misc/UniformWeighting.java | 124 -
LibrarySource/pal/misc/Units.java | 24 -
LibrarySource/pal/misc/Utils.java | 118 -
LibrarySource/pal/misc/WeightedFunction.java | 51 -
LibrarySource/pal/misc/Weighting.java | 26 -
LibrarySource/pal/misc/makefile | 42 -
LibrarySource/pal/misc/package.html | 5 -
.../pal/statistics/BootstrapStatistics.java | 172 --
.../pal/statistics/ChiSquareDistribution.java | 97 -
LibrarySource/pal/statistics/ChiSquareTest.java | 103 -
.../pal/statistics/DiscreteStatistics.java | 234 --
.../pal/statistics/ExponentialDistribution.java | 100 -
.../pal/statistics/GammaDistribution.java | 180 --
.../pal/statistics/KishinoHasegawaTest.java | 202 --
.../pal/statistics/LikelihoodRatioTest.java | 41 -
LibrarySource/pal/statistics/ModelSupport.java | 341 ---
.../pal/statistics/NormalDistribution.java | 99 -
.../pal/statistics/ParetoDistribution.java | 122 -
.../pal/statistics/PenalizedLikelihood.java | 71 -
.../pal/statistics/ShimodairaHasegawaTest.java | 262 --
LibrarySource/pal/statistics/makefile | 42 -
LibrarySource/pal/statistics/package.html | 8 -
.../pal/substmodel/AbstractRateMatrix.java | 278 --
LibrarySource/pal/substmodel/AminoAcidModel.java | 192 --
LibrarySource/pal/substmodel/AminoAcidModelID.java | 36 -
LibrarySource/pal/substmodel/BLOSUM62.java | 195 --
LibrarySource/pal/substmodel/CPREV.java | 210 --
LibrarySource/pal/substmodel/CodonModel.java | 89 -
LibrarySource/pal/substmodel/Dayhoff.java | 198 --
LibrarySource/pal/substmodel/F81.java | 104 -
LibrarySource/pal/substmodel/F84.java | 168 --
LibrarySource/pal/substmodel/GTR.java | 227 --
LibrarySource/pal/substmodel/GammaRates.java | 133 -
LibrarySource/pal/substmodel/HKY.java | 140 -
LibrarySource/pal/substmodel/InvariableSites.java | 126 -
LibrarySource/pal/substmodel/JTT.java | 197 --
LibrarySource/pal/substmodel/MTREV24.java | 196 --
.../pal/substmodel/MatrixExponential.java | 894 ------
LibrarySource/pal/substmodel/NucleotideModel.java | 132 -
.../pal/substmodel/NucleotideModelID.java | 34 -
LibrarySource/pal/substmodel/RateDistribution.java | 92 -
LibrarySource/pal/substmodel/RateMatrix.java | 86 -
LibrarySource/pal/substmodel/RateMatrixUtils.java | 64 -
.../pal/substmodel/SubstitutionModel.java | 288 --
LibrarySource/pal/substmodel/TN.java | 183 --
.../pal/substmodel/TransitionProbability.java | 48 -
LibrarySource/pal/substmodel/TwoStateModel.java | 115 -
LibrarySource/pal/substmodel/UniformRate.java | 84 -
LibrarySource/pal/substmodel/VT.java | 210 --
LibrarySource/pal/substmodel/WAG.java | 210 --
LibrarySource/pal/substmodel/YangCodonModel.java | 276 --
LibrarySource/pal/substmodel/makefile | 42 -
LibrarySource/pal/substmodel/package.html | 9 -
LibrarySource/pal/tree/ClockTree.java | 143 -
LibrarySource/pal/tree/DatedTipsClockTree.java | 446 ---
LibrarySource/pal/tree/LogParameterizedTree.java | 100 -
LibrarySource/pal/tree/MutationRateModelTree.java | 175 --
LibrarySource/pal/tree/NeighborJoiningTree.java | 209 --
LibrarySource/pal/tree/Node.java | 138 -
LibrarySource/pal/tree/NodeFactory.java | 40 -
LibrarySource/pal/tree/NodeUtils.java | 629 ----
LibrarySource/pal/tree/ParameterizedTree.java | 112 -
LibrarySource/pal/tree/ReadTree.java | 157 -
LibrarySource/pal/tree/SUPGMATree.java | 102 -
LibrarySource/pal/tree/SimpleNode.java | 448 ---
LibrarySource/pal/tree/SimpleTree.java | 274 --
LibrarySource/pal/tree/SimulatedAlignment.java | 211 --
LibrarySource/pal/tree/SplitSystem.java | 127 -
LibrarySource/pal/tree/SplitUtils.java | 169 --
LibrarySource/pal/tree/Tree.java | 72 -
LibrarySource/pal/tree/TreeDistanceMatrix.java | 135 -
LibrarySource/pal/tree/TreeParseException.java | 26 -
LibrarySource/pal/tree/TreeUtils.java | 1042 -------
LibrarySource/pal/tree/UPGMATree.java | 201 --
LibrarySource/pal/tree/UnconstrainedTree.java | 110 -
LibrarySource/pal/tree/makefile | 42 -
LibrarySource/pal/tree/package.html | 8 -
LibrarySource/pal/util/Comparable.java | 36 -
LibrarySource/pal/util/ComparableDouble.java | 50 -
LibrarySource/pal/util/Comparator.java | 37 -
LibrarySource/pal/util/HeapSort.java | 411 ---
LibrarySource/pal/util/Log.java | 55 -
LibrarySource/pal/util/Logger.java | 25 -
LibrarySource/pal/util/ThreeNumberSort.java | 237 --
LibrarySource/pal/util/makefile | 42 -
LibrarySource/pal/util/package.html | 5 -
465 files changed, 154598 deletions(-)
diff --git a/LibrarySource/com/lowagie/text/Anchor.java b/LibrarySource/com/lowagie/text/Anchor.java
deleted file mode 100644
index 2248358..0000000
--- a/LibrarySource/com/lowagie/text/Anchor.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * $Id: Anchor.java,v 1.84 2005/05/03 13:03:49 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Properties;
-
-import com.lowagie.text.markup.MarkupTags;
-import com.lowagie.text.markup.MarkupParser;
-
-/**
- * An <CODE>Anchor</CODE> can be a reference or a destination of a reference.
- * <P>
- * An <CODE>Anchor</CODE> is a special kind of <CODE>Phrase</CODE>.
- * It is constructed in the same way.
- * <P>
- * Example:
- * <BLOCKQUOTE><PRE>
- * <STRONG>Anchor anchor = new Anchor("this is a link");</STRONG>
- * <STRONG>anchor.setName("LINK");</STRONG>
- * <STRONG>anchor.setReference("http://www.lowagie.com");</STRONG>
- * </PRE></BLOCKQUOTE>
- *
- * @see Element
- * @see Phrase
- */
-
-public class Anchor extends Phrase implements TextElementArray, MarkupAttributes {
-
- // membervariables
-
-/** This is the anchor tag. */
- public static final String ANCHOR = "anchor";
-
-/** This is the name of the <CODE>Anchor</CODE>. */
- protected String name = null;
-
-/** This is the reference of the <CODE>Anchor</CODE>. */
- protected String reference = null;
-
- // constructors
-
-/**
- * Constructs an <CODE>Anchor</CODE> without specifying a leading.
- */
-
- public Anchor() {
- super(16);
- }
-
-/**
- * Constructs an <CODE>Anchor</CODE> with a certain leading.
- *
- * @param leading the leading
- */
-
- public Anchor(float leading) {
- super(leading);
- }
-
-/**
- * Constructs an <CODE>Anchor</CODE> with a certain <CODE>Chunk</CODE>.
- *
- * @param chunk a <CODE>Chunk</CODE>
- */
-
- public Anchor(Chunk chunk) {
- super(chunk);
- }
-
-/**
- * Constructs an <CODE>Anchor</CODE> with a certain <CODE>String</CODE>.
- *
- * @param string a <CODE>String</CODE>
- */
-
- public Anchor(String string) {
- super(string);
- }
-
-/**
- * Constructs an <CODE>Anchor</CODE> with a certain <CODE>String</CODE>
- * and a certain <CODE>Font</CODE>.
- *
- * @param string a <CODE>String</CODE>
- * @param font a <CODE>Font</CODE>
- */
-
- public Anchor(String string, Font font) {
- super(string, font);
- }
-
-/**
- * Constructs an <CODE>Anchor</CODE> with a certain <CODE>Chunk</CODE>
- * and a certain leading.
- *
- * @param leading the leading
- * @param chunk a <CODE>Chunk</CODE>
- */
-
- public Anchor(float leading, Chunk chunk) {
- super(leading, chunk);
- }
-
-/**
- * Constructs an <CODE>Anchor</CODE> with a certain leading
- * and a certain <CODE>String</CODE>.
- *
- * @param leading the leading
- * @param string a <CODE>String</CODE>
- */
-
- public Anchor(float leading, String string) {
- super(leading, string);
- }
-
-/**
- * Constructs an <CODE>Anchor</CODE> with a certain leading,
- * a certain <CODE>String</CODE> and a certain <CODE>Font</CODE>.
- *
- * @param leading the leading
- * @param string a <CODE>String</CODE>
- * @param font a <CODE>Font</CODE>
- */
-
- public Anchor(float leading, String string, Font font) {
- super(leading, string, font);
- }
-
-/**
- * Returns an <CODE>Anchor</CODE> that has been constructed taking in account
- * the value of some <VAR>attributes</VAR>.
- *
- * @param attributes Some attributes
- */
-
- public Anchor(Properties attributes) {
- this("", FontFactory.getFont(attributes));
- String value;
- if ((value = (String)attributes.remove(ElementTags.ITEXT)) != null) {
- Chunk chunk = new Chunk(value);
- if ((value = (String)attributes.remove(ElementTags.GENERICTAG)) != null) {
- chunk.setGenericTag(value);
- }
- add(chunk);
- }
- if ((value = (String)attributes.remove(ElementTags.LEADING)) != null) {
- setLeading(Float.valueOf(value + "f").floatValue());
- }
- else if ((value = (String)attributes.remove(MarkupTags.CSS_KEY_LINEHEIGHT)) != null) {
- setLeading(MarkupParser.parseLength(value));
- }
- if ((value = (String)attributes.remove(ElementTags.NAME)) != null) {
- setName(value);
- }
- if ((value = (String)attributes.remove(ElementTags.REFERENCE)) != null) {
- setReference(value);
- }
- if (attributes.size() > 0) setMarkupAttributes(attributes);
- }
-
- // implementation of the Element-methods
-
-/**
- * Processes the element by adding it (or the different parts) to an
- * <CODE>ElementListener</CODE>.
- *
- * @param listener an <CODE>ElementListener</CODE>
- * @return <CODE>true</CODE> if the element was processed successfully
- */
-
- public boolean process(ElementListener listener) {
- try {
- Chunk chunk;
- Iterator i = getChunks().iterator();
- boolean localDestination = (reference != null && reference.startsWith("#"));
- boolean notGotoOK = true;
- while (i.hasNext()) {
- chunk = (Chunk) i.next();
- if (name != null && notGotoOK && !chunk.isEmpty()) {
- chunk.setLocalDestination(name);
- notGotoOK = false;
- }
- if (localDestination) {
- chunk.setLocalGoto(reference.substring(1));
- }
- listener.add(chunk);
- }
- return true;
- }
- catch(DocumentException de) {
- return false;
- }
- }
-
-/**
- * Gets all the chunks in this element.
- *
- * @return an <CODE>ArrayList</CODE>
- */
-
- public ArrayList getChunks() {
- ArrayList tmp = new ArrayList();
- Chunk chunk;
- Iterator i = iterator();
- boolean localDestination = (reference != null && reference.startsWith("#"));
- boolean notGotoOK = true;
- while (i.hasNext()) {
- chunk = (Chunk) i.next();
- if (name != null && notGotoOK && !chunk.isEmpty()) {
- chunk.setLocalDestination(name);
- notGotoOK = false;
- }
- if (localDestination) {
- chunk.setLocalGoto(reference.substring(1));
- }
- else if (reference != null)
- chunk.setAnchor(reference);
- tmp.add(chunk);
- }
- return tmp;
- }
-
-/**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type() {
- return Element.ANCHOR;
- }
-
- // methods
-
-/**
- * Gets an iterator of <CODE>Element</CODE>s.
- *
- * @return an <CODE>Iterator</CODE>
- */
-
- // suggestion by by Curt Thompson
- public Iterator getElements() {
- return this.iterator();
- }
-
-/**
- * Sets the name of this <CODE>Anchor</CODE>.
- *
- * @param name a new name
- */
-
- public void setName(String name) {
- this.name = name;
- }
-
-/**
- * Sets the reference of this <CODE>Anchor</CODE>.
- *
- * @param reference a new reference
- */
-
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- // methods to retrieve information
-
-/**
- * Returns the name of this <CODE>Anchor</CODE>.
- *
- * @return a name
- */
-
- public String name() {
- return name;
- }
-
-/**
- * Gets the reference of this <CODE>Anchor</CODE>.
- *
- * @return a reference
- */
-
- public String reference() {
- return reference;
- }
-
-/**
- * Gets the reference of this <CODE>Anchor</CODE>.
- *
- * @return an <CODE>URL</CODE>
- */
-
- public URL url() {
- try {
- return new URL(reference);
- }
- catch(MalformedURLException mue) {
- return null;
- }
- }
-
-/**
- * Checks if a given tag corresponds with this object.
- *
- * @param tag the given tag
- * @return true if the tag corresponds
- */
-
- public static boolean isTag(String tag) {
- return ElementTags.ANCHOR.equals(tag);
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/Annotation.java b/LibrarySource/com/lowagie/text/Annotation.java
deleted file mode 100644
index 557a8be..0000000
--- a/LibrarySource/com/lowagie/text/Annotation.java
+++ /dev/null
@@ -1,727 +0,0 @@
-/*
- * $Id: Annotation.java,v 1.70 2005/04/13 09:17:09 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.ArrayList;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * An <CODE>Annotation</CODE> is a little note that can be added to a page on
- * a document.
- *
- * @see Element
- * @see Anchor
- */
-
-public class Annotation implements Element, MarkupAttributes {
-
- // membervariables
-
- /** This is a possible annotation type. */
- public static final int TEXT = 0;
-
- /** This is a possible annotation type. */
- public static final int URL_NET = 1;
-
- /** This is a possible annotation type. */
- public static final int URL_AS_STRING = 2;
-
- /** This is a possible annotation type. */
- public static final int FILE_DEST = 3;
-
- /** This is a possible annotation type. */
- public static final int FILE_PAGE = 4;
-
- /** This is a possible annotation type. */
- public static final int NAMED_DEST = 5;
-
- /** This is a possible annotation type. */
- public static final int LAUNCH = 6;
-
- /** This is a possible annotation type. */
- public static final int SCREEN = 7;
-
- /** This is a possible attribute. */
- public static String TITLE = "title";
-
- /** This is a possible attribute. */
- public static String CONTENT = "content";
-
- /** This is a possible attribute. */
- public static String URL = "url";
-
- /** This is a possible attribute. */
- public static String FILE = "file";
-
- /** This is a possible attribute. */
- public static String DESTINATION = "destination";
-
- /** This is a possible attribute. */
- public static String PAGE = "page";
-
- /** This is a possible attribute. */
- public static String NAMED = "named";
-
- /** This is a possible attribute. */
- public static String APPLICATION = "application";
-
- /** This is a possible attribute. */
- public static String PARAMETERS = "parameters";
-
- /** This is a possible attribute. */
- public static String OPERATION = "operation";
-
- /** This is a possible attribute. */
- public static String DEFAULTDIR = "defaultdir";
-
- /** This is a possible attribute. */
- public static String LLX = "llx";
-
- /** This is a possible attribute. */
- public static String LLY = "lly";
-
- /** This is a possible attribute. */
- public static String URX = "urx";
-
- /** This is a possible attribute. */
- public static String URY = "ury";
-
- /** This is a possible attribute. */
- public static String MIMETYPE = "mime";
-
- /** This is the type of annotation. */
- protected int annotationtype;
-
- /** This is the title of the <CODE>Annotation</CODE>. */
- protected HashMap annotationAttributes = new HashMap();
-
- /** Contains extra markupAttributes */
- protected Properties markupAttributes = null;
-
- /** This is the lower left x-value */
- protected float llx = Float.NaN;
-
- /** This is the lower left y-value */
- protected float lly = Float.NaN;
-
- /** This is the upper right x-value */
- protected float urx = Float.NaN;
-
- /** This is the upper right y-value */
- protected float ury = Float.NaN;
-
- // constructors
-
- /**
- * Constructs an <CODE>Annotation</CODE> with a certain title and some
- * text.
- *
- * @param llx
- * lower left x coordinate
- * @param lly
- * lower left y coordinate
- * @param urx
- * upper right x coordinate
- * @param ury
- * upper right y coordinate
- */
-
- private Annotation(float llx, float lly, float urx, float ury) {
- this.llx = llx;
- this.lly = lly;
- this.urx = urx;
- this.ury = ury;
- }
-
- /**
- * Constructs an <CODE>Annotation</CODE> with a certain title and some
- * text.
- *
- * @param title
- * the title of the annotation
- * @param text
- * the content of the annotation
- */
-
- public Annotation(String title, String text) {
- annotationtype = TEXT;
- annotationAttributes.put(TITLE, title);
- annotationAttributes.put(CONTENT, text);
- }
-
- /**
- * Constructs an <CODE>Annotation</CODE> with a certain title and some
- * text.
- *
- * @param title
- * the title of the annotation
- * @param text
- * the content of the annotation
- * @param llx
- * the lower left x-value
- * @param lly
- * the lower left y-value
- * @param urx
- * the upper right x-value
- * @param ury
- * the upper right y-value
- */
-
- public Annotation(String title, String text, float llx, float lly,
- float urx, float ury) {
- this(llx, lly, urx, ury);
- annotationtype = TEXT;
- annotationAttributes.put(TITLE, title);
- annotationAttributes.put(CONTENT, text);
- }
-
- /**
- * Constructs an <CODE>Annotation</CODE>.
- *
- * @param llx
- * the lower left x-value
- * @param lly
- * the lower left y-value
- * @param urx
- * the upper right x-value
- * @param ury
- * the upper right y-value
- * @param url
- * the external reference
- */
-
- public Annotation(float llx, float lly, float urx, float ury, URL url) {
- this(llx, lly, urx, ury);
- annotationtype = URL_NET;
- annotationAttributes.put(URL, url);
- }
-
- /**
- * Constructs an <CODE>Annotation</CODE>.
- *
- * @param llx
- * the lower left x-value
- * @param lly
- * the lower left y-value
- * @param urx
- * the upper right x-value
- * @param ury
- * the upper right y-value
- * @param url
- * the external reference
- */
-
- public Annotation(float llx, float lly, float urx, float ury, String url) {
- this(llx, lly, urx, ury);
- annotationtype = URL_AS_STRING;
- annotationAttributes.put(FILE, url);
- }
-
- /**
- * Constructs an <CODE>Annotation</CODE>.
- *
- * @param llx
- * the lower left x-value
- * @param lly
- * the lower left y-value
- * @param urx
- * the upper right x-value
- * @param ury
- * the upper right y-value
- * @param file
- * an external PDF file
- * @param dest
- * the destination in this file
- */
-
- public Annotation(float llx, float lly, float urx, float ury, String file,
- String dest) {
- this(llx, lly, urx, ury);
- annotationtype = FILE_DEST;
- annotationAttributes.put(FILE, file);
- annotationAttributes.put(DESTINATION, dest);
- }
-
- /**
- * Creates a Screen anotation to embed media clips
- *
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @param moviePath
- * path to the media clip file
- * @param mimeType
- * mime type of the media
- * @param showOnDisplay
- * if true play on display of the page
- */
- public Annotation(float llx, float lly, float urx, float ury,
- String moviePath, String mimeType, boolean showOnDisplay) {
- this(llx, lly, urx, ury);
- annotationtype = SCREEN;
- annotationAttributes.put(FILE, moviePath);
- annotationAttributes.put(MIMETYPE, mimeType);
- annotationAttributes.put(PARAMETERS, new boolean[] {
- false /* embedded */, showOnDisplay });
- }
-
- /**
- * Constructs an <CODE>Annotation</CODE>.
- *
- * @param llx
- * the lower left x-value
- * @param lly
- * the lower left y-value
- * @param urx
- * the upper right x-value
- * @param ury
- * the upper right y-value
- * @param file
- * an external PDF file
- * @param page
- * a page number in this file
- */
-
- public Annotation(float llx, float lly, float urx, float ury, String file,
- int page) {
- this(llx, lly, urx, ury);
- annotationtype = FILE_PAGE;
- annotationAttributes.put(FILE, file);
- annotationAttributes.put(PAGE, new Integer(page));
- }
-
- /**
- * Constructs an <CODE>Annotation</CODE>.
- *
- * @param llx
- * the lower left x-value
- * @param lly
- * the lower left y-value
- * @param urx
- * the upper right x-value
- * @param ury
- * the upper right y-value
- * @param named
- * a named destination in this file
- */
-
- public Annotation(float llx, float lly, float urx, float ury, int named) {
- this(llx, lly, urx, ury);
- annotationtype = NAMED_DEST;
- annotationAttributes.put(NAMED, new Integer(named));
- }
-
- /**
- * Constructs an <CODE>Annotation</CODE>.
- *
- * @param llx
- * the lower left x-value
- * @param lly
- * the lower left y-value
- * @param urx
- * the upper right x-value
- * @param ury
- * the upper right y-value
- * @param application
- * an external application
- * @param parameters
- * parameters to pass to this application
- * @param operation
- * the operation to pass to this application
- * @param defaultdir
- * the default directory to run this application in
- */
-
- public Annotation(float llx, float lly, float urx, float ury,
- String application, String parameters, String operation,
- String defaultdir) {
- this(llx, lly, urx, ury);
- annotationtype = LAUNCH;
- annotationAttributes.put(APPLICATION, application);
- annotationAttributes.put(PARAMETERS, parameters);
- annotationAttributes.put(OPERATION, operation);
- annotationAttributes.put(DEFAULTDIR, defaultdir);
- }
-
- /**
- * Returns an <CODE>Annotation</CODE> that has been constructed taking in
- * account the value of some <VAR>attributes </VAR>.
- *
- * @param attributes
- * Some attributes
- */
-
- public Annotation(Properties attributes) {
- String value = (String) attributes.remove(ElementTags.LLX);
- if (value != null) {
- llx = Float.valueOf(value + "f").floatValue();
- }
- value = (String) attributes.remove(ElementTags.LLY);
- if (value != null) {
- lly = Float.valueOf(value + "f").floatValue();
- }
- value = (String) attributes.remove(ElementTags.URX);
- if (value != null) {
- urx = Float.valueOf(value + "f").floatValue();
- }
- value = (String) attributes.remove(ElementTags.URY);
- if (value != null) {
- ury = Float.valueOf(value + "f").floatValue();
- }
- String title = (String) attributes.remove(ElementTags.TITLE);
- String text = (String) attributes.remove(ElementTags.CONTENT);
- if (title != null || text != null) {
- annotationtype = TEXT;
- } else if ((value = (String) attributes.remove(ElementTags.URL)) != null) {
- annotationtype = URL_AS_STRING;
- annotationAttributes.put(FILE, value);
- } else if ((value = (String) attributes.remove(ElementTags.NAMED)) != null) {
- annotationtype = NAMED_DEST;
- annotationAttributes.put(NAMED, Integer.valueOf(value));
- } else {
- String file = (String) attributes.remove(ElementTags.FILE);
- String destination = (String) attributes
- .remove(ElementTags.DESTINATION);
- String page = (String) attributes.remove(ElementTags.PAGE);
- if (file != null) {
- annotationAttributes.put(FILE, file);
- if (destination != null) {
- annotationtype = FILE_DEST;
- annotationAttributes.put(DESTINATION, destination);
- } else if (page != null) {
- annotationtype = FILE_PAGE;
- annotationAttributes.put(FILE, file);
- annotationAttributes.put(PAGE, Integer.valueOf(page));
- }
- } else if ((value = (String) attributes.remove(ElementTags.NAMED)) != null) {
- annotationtype = LAUNCH;
- annotationAttributes.put(APPLICATION, value);
- annotationAttributes.put(PARAMETERS, (String) attributes
- .remove(ElementTags.PARAMETERS));
- annotationAttributes.put(OPERATION, (String) attributes
- .remove(ElementTags.OPERATION));
- annotationAttributes.put(DEFAULTDIR, (String) attributes
- .remove(ElementTags.DEFAULTDIR));
- }
- }
- if (annotationtype == TEXT) {
- if (title == null)
- title = "";
- if (text == null)
- text = "";
- annotationAttributes.put(TITLE, title);
- annotationAttributes.put(CONTENT, text);
- }
- if (attributes.size() > 0)
- setMarkupAttributes(attributes);
- }
-
- // implementation of the Element-methods
-
- /**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type() {
- return Element.ANNOTATION;
- }
-
- // methods
-
- /**
- * Processes the element by adding it (or the different parts) to an <CODE>
- * ElementListener</CODE>.
- *
- * @param listener
- * an <CODE>ElementListener</CODE>
- * @return <CODE>true</CODE> if the element was processed successfully
- */
-
- public boolean process(ElementListener listener) {
- try {
- return listener.add(this);
- } catch (DocumentException de) {
- return false;
- }
- }
-
- /**
- * Gets all the chunks in this element.
- *
- * @return an <CODE>ArrayList</CODE>
- */
-
- public ArrayList getChunks() {
- return new ArrayList();
- }
-
- // methods
-
- /**
- * Sets the dimensions of this annotation.
- *
- * @param llx
- * the lower left x-value
- * @param lly
- * the lower left y-value
- * @param urx
- * the upper right x-value
- * @param ury
- * the upper right y-value
- */
-
- public void setDimensions(float llx, float lly, float urx, float ury) {
- this.llx = llx;
- this.lly = lly;
- this.urx = urx;
- this.ury = ury;
- }
-
- // methods to retrieve information
-
- /**
- * Returns the lower left x-value.
- *
- * @return a value
- */
-
- public float llx() {
- return llx;
- }
-
- /**
- * Returns the lower left y-value.
- *
- * @return a value
- */
-
- public float lly() {
- return lly;
- }
-
- /**
- * Returns the uppper right x-value.
- *
- * @return a value
- */
-
- public float urx() {
- return urx;
- }
-
- /**
- * Returns the uppper right y-value.
- *
- * @return a value
- */
-
- public float ury() {
- return ury;
- }
-
- /**
- * Returns the lower left x-value.
- *
- * @param def
- * the default value
- * @return a value
- */
-
- public float llx(float def) {
- if (Float.isNaN(llx))
- return def;
- return llx;
- }
-
- /**
- * Returns the lower left y-value.
- *
- * @param def
- * the default value
- * @return a value
- */
-
- public float lly(float def) {
- if (Float.isNaN(lly))
- return def;
- return lly;
- }
-
- /**
- * Returns the upper right x-value.
- *
- * @param def
- * the default value
- * @return a value
- */
-
- public float urx(float def) {
- if (Float.isNaN(urx))
- return def;
- return urx;
- }
-
- /**
- * Returns the upper right y-value.
- *
- * @param def
- * the default value
- * @return a value
- */
-
- public float ury(float def) {
- if (Float.isNaN(ury))
- return def;
- return ury;
- }
-
- /**
- * Returns the type of this <CODE>Annotation</CODE>.
- *
- * @return a type
- */
-
- public int annotationType() {
- return annotationtype;
- }
-
- /**
- * Returns the title of this <CODE>Annotation</CODE>.
- *
- * @return a name
- */
-
- public String title() {
- String s = (String) annotationAttributes.get(TITLE);
- if (s == null)
- s = "";
- return s;
- }
-
- /**
- * Gets the content of this <CODE>Annotation</CODE>.
- *
- * @return a reference
- */
-
- public String content() {
- String s = (String) annotationAttributes.get(CONTENT);
- if (s == null)
- s = "";
- return s;
- }
-
- /**
- * Gets the content of this <CODE>Annotation</CODE>.
- *
- * @return a reference
- */
-
- public HashMap attributes() {
- return annotationAttributes;
- }
-
- /**
- * Checks if a given tag corresponds with this object.
- *
- * @param tag
- * the given tag
- * @return true if the tag corresponds
- */
-
- public static boolean isTag(String tag) {
- return ElementTags.ANNOTATION.equals(tag);
- }
-
- /**
- * @see com.lowagie.text.MarkupAttributes#setMarkupAttribute(java.lang.String,
- * java.lang.String)
- */
- public void setMarkupAttribute(String name, String value) {
- if (markupAttributes == null) markupAttributes = new Properties();
- markupAttributes.put(name, value);
- }
-
- /**
- * @see com.lowagie.text.MarkupAttributes#setMarkupAttributes(java.util.Properties)
- */
- public void setMarkupAttributes(Properties markupAttributes) {
- this.markupAttributes = markupAttributes;
- }
-
- /**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttribute(java.lang.String)
- */
- public String getMarkupAttribute(String name) {
- return (markupAttributes == null) ? null : String
- .valueOf(markupAttributes.get(name));
- }
-
- /**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttributeNames()
- */
- public Set getMarkupAttributeNames() {
- return Chunk.getKeySet(markupAttributes);
- }
-
- /**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttributes()
- */
- public Properties getMarkupAttributes() {
- return markupAttributes;
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/BadElementException.java b/LibrarySource/com/lowagie/text/BadElementException.java
deleted file mode 100644
index a8dec67..0000000
--- a/LibrarySource/com/lowagie/text/BadElementException.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * $Id: BadElementException.java,v 1.50 2004/12/14 11:33:49 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-/**
- * Signals an attempt to create an <CODE>Element</CODE> that hasn't got the right form.
- *
- * @see DocumentException
- * @see Cell
- * @see Table
- */
-
-public class BadElementException extends DocumentException {
-
- // constructors
- /**
- * Constructs a BadElementException
- * @param ex an Exception object that has to be turned into a BadElementException
- */
- public BadElementException(Exception ex) {
- super(ex);
- }
-
-/**
- * Constructs a <CODE>BadElementException</CODE> whithout a message.
- */
-
- BadElementException() {
- super();
- }
-
-/**
- * Constructs a <code>BadElementException</code> with a message.
- *
- * @param message a message describing the exception
- */
-
- public BadElementException(String message) {
- super(message);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/Cell.java b/LibrarySource/com/lowagie/text/Cell.java
deleted file mode 100644
index 3306f36..0000000
--- a/LibrarySource/com/lowagie/text/Cell.java
+++ /dev/null
@@ -1,1006 +0,0 @@
-/*
- * $Id: Cell.java,v 1.101 2005/04/28 13:20:11 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import headless.awt.Color;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Properties;
-
-import com.lowagie.text.markup.*;
-import com.lowagie.text.pdf.PdfPCell;
-
-/**
- * A <CODE>Cell</CODE> is a <CODE>Rectangle</CODE> containing other
- * <CODE>Element</CODE>s.
- * <P>
- * A <CODE>Cell</CODE> must be added to a <CODE>Table</CODE>.
- * The <CODE>Table</CODE> will place the <CODE>Cell</CODE> in
- * a <CODE>Row</CODE>.
- * <P>
- * Example:
- * <BLOCKQUOTE><PRE>
- * Table table = new Table(3);
- * table.setBorderWidth(1);
- * table.setBorderColor(new Color(0, 0, 255));
- * table.setCellpadding(5);
- * table.setCellspacing(5);
- * <STRONG>Cell cell = new Cell("header");</STRONG>
- * <STRONG>cell.setHeader(true);</STRONG>
- * <STRONG>cell.setColspan(3);</STRONG>
- * table.addCell(cell);
- * <STRONG>cell = new Cell("example cell with colspan 1 and rowspan 2");</STRONG>
- * <STRONG>cell.setRowspan(2);</STRONG>
- * <STRONG>cell.setBorderColor(new Color(255, 0, 0));</STRONG>
- * table.addCell(cell);
- * table.addCell("1.1");
- * table.addCell("2.1");
- * table.addCell("1.2");
- * table.addCell("2.2");
- * </PRE></BLOCKQUOTE>
- *
- * @see Rectangle
- * @see Element
- * @see Table
- * @see Row
- */
-
-public class Cell extends Rectangle implements TextElementArray {
-
- // static final membervariable
-
- // This accessor replaces the dangerous static member DUMMY_CELL
- /**
- * Get dummy cell used when merging inner tables.
- * @return a cell with colspan 3 and no border
- */
- public static Cell getDummyCell() {
- Cell cell = new Cell(true);
- cell.setColspan(3);
- cell.setBorder(NO_BORDER);
- return cell;
- }
-
- // membervariables
-
-/** This is the <CODE>ArrayList</CODE> of <CODE>Element</CODE>s. */
- protected ArrayList arrayList = null;
-
-/** This is the horizontal alignment. */
- protected int horizontalAlignment = Element.ALIGN_UNDEFINED;
-
-/** This is the vertical alignment. */
- protected int verticalAlignment = Element.ALIGN_UNDEFINED;
-
-/** This is the vertical alignment. */
- protected String width;
-
-/** This is the colspan. */
- protected int colspan = 1;
-
-/** This is the rowspan. */
- protected int rowspan = 1;
-
-/** This is the leading. */
- float leading = Float.NaN;
-
-/** Is this <CODE>Cell</CODE> a header? */
- protected boolean header;
-
- /** Indicates that the largest ascender height should be used to determine the
- * height of the first line. Note that this only has an effect when rendered
- * to PDF. Setting this to true can help with vertical alignment problems. */
- protected boolean useAscender = false;
-
- /** Indicates that the largest descender height should be added to the height of
- * the last line (so characters like y don't dip into the border). Note that
- * this only has an effect when rendered to PDF. */
- protected boolean useDescender = false;
-
- /**
- * Adjusts the cell contents to compensate for border widths. Note that
- * this only has an effect when rendered to PDF.
- */
- protected boolean useBorderPadding;
-
- // constructors
-
-/**
- * Constructs an empty <CODE>Cell</CODE>.
- */
-
- public Cell() {
- // creates a Rectangle with BY DEFAULT a border of 0.5
- super(0, 0, 0, 0);
- setBorder(UNDEFINED);
- setBorderWidth(0.5f);
-
- // initializes the arraylist and adds an element
- arrayList = new ArrayList();
- }
-
-/**
- * Constructs an empty <CODE>Cell</CODE> (for internal use only).
- *
- * @param dummy a dummy value
- */
-
- public Cell(boolean dummy) {
- this();
- arrayList.add(new Paragraph(0));
- }
-
-/**
- * Constructs a <CODE>Cell</CODE> with a certain content.
- * <P>
- * The <CODE>String</CODE> will be converted into a <CODE>Paragraph</CODE>.
- *
- * @param content a <CODE>String</CODE>
- */
-
- public Cell(String content) {
- // creates a Rectangle with BY DEFAULT a border of 0.5
- super(0, 0, 0, 0);
- setBorder(UNDEFINED);
- setBorderWidth(0.5f);
-
- // initializes the arraylist and adds an element
- arrayList = new ArrayList();
- try {
- addElement(new Paragraph(content));
- }
- catch(BadElementException bee) {
- }
- }
-
-/**
- * Constructs a <CODE>Cell</CODE> with a certain <CODE>Element</CODE>.
- * <P>
- * if the element is a <CODE>ListItem</CODE>, <CODE>Row</CODE> or
- * <CODE>Cell</CODE>, an exception will be thrown.
- *
- * @param element the element
- * @throws BadElementException when the creator was called with a <CODE>ListItem</CODE>, <CODE>Row</CODE> or <CODE>Cell</CODE>
- */
-
- public Cell(Element element) throws BadElementException {
- // creates a Rectangle with BY DEFAULT a border of 0.5
- super(0, 0, 0, 0);
- setBorder(UNDEFINED);
- setBorderWidth(0.5f);
-
- // Update by Benoit WIART <b.wiart at proxiad.com>
- if(element instanceof Phrase) {
- Phrase p = (Phrase)element;
- leading = p.leading();
- }
-
- // initializes the arraylist and adds an element
- arrayList = new ArrayList();
- addElement(element);
- }
-
-/**
- * Returns a <CODE>Cell</CODE> that has been constructed taking in account
- * the value of some <VAR>attributes</VAR>.
- *
- * @param attributes Some attributes
- */
-
- public Cell(Properties attributes) {
- this();
- String value;
- if ((value = (String)attributes.remove(ElementTags.HORIZONTALALIGN)) != null) {
- setHorizontalAlignment(value);
- }
- if ((value = (String)attributes.remove(ElementTags.VERTICALALIGN)) != null) {
- setVerticalAlignment(value);
- }
- if ((value = (String)attributes.remove(ElementTags.WIDTH)) != null) {
- setWidth(value);
- }
- if ((value = (String)attributes.remove(ElementTags.COLSPAN)) != null) {
- setColspan(Integer.parseInt(value));
- }
- if ((value = (String)attributes.remove(ElementTags.ROWSPAN)) != null) {
- setRowspan(Integer.parseInt(value));
- }
- if ((value = (String)attributes.remove(ElementTags.LEADING)) != null) {
- setLeading(Float.valueOf(value + "f").floatValue());
- }
- if ((value = (String)attributes.remove(ElementTags.HEADER)) != null) {
- setHeader(new Boolean(value).booleanValue());
- }
- if ((value = (String)attributes.remove(ElementTags.NOWRAP)) != null) {
- setNoWrap(new Boolean(value).booleanValue());
- }
- if ((value = (String)attributes.remove(ElementTags.BORDERWIDTH)) != null) {
- setBorderWidth(Float.valueOf(value + "f").floatValue());
- }
- int border = 0;
- if ((value = (String)attributes.remove(ElementTags.LEFT)) != null) {
- if (new Boolean(value).booleanValue()) border |= Rectangle.LEFT;
- }
- if ((value = (String)attributes.remove(ElementTags.RIGHT)) != null) {
- if (new Boolean(value).booleanValue()) border |= Rectangle.RIGHT;
- }
- if ((value = (String)attributes.remove(ElementTags.TOP)) != null) {
- if (new Boolean(value).booleanValue()) border |= Rectangle.TOP;
- }
- if ((value = (String)attributes.remove(ElementTags.BOTTOM)) != null) {
- if (new Boolean(value).booleanValue()) border |= Rectangle.BOTTOM;
- }
- setBorder(border);
- String r = (String)attributes.remove(ElementTags.RED);
- String g = (String)attributes.remove(ElementTags.GREEN);
- String b = (String)attributes.remove(ElementTags.BLUE);
- if (r != null || g != null || b != null) {
- int red = 0;
- int green = 0;
- int blue = 0;
- if (r != null) red = Integer.parseInt(r);
- if (g != null) green = Integer.parseInt(g);
- if (b != null) blue = Integer.parseInt(b);
- setBorderColor(new Color(red, green, blue));
- }
- else if ((value = (String)attributes.remove(ElementTags.BORDERCOLOR)) != null) {
- setBorderColor(MarkupParser.decodeColor(value));
- }
- r = (String)attributes.remove(ElementTags.BGRED);
- g = (String)attributes.remove(ElementTags.BGGREEN);
- b = (String)attributes.remove(ElementTags.BGBLUE);
- if (r != null || g != null || b != null) {
- int red = 0;
- int green = 0;
- int blue = 0;
- if (r != null) red = Integer.parseInt(r);
- if (g != null) green = Integer.parseInt(g);
- if (b != null) blue = Integer.parseInt(b);
- setBackgroundColor(new Color(red, green, blue));
- }
- else if ((value = (String)attributes.remove(ElementTags.BACKGROUNDCOLOR)) != null) {
- setBackgroundColor(MarkupParser.decodeColor(value));
- }
- if ((value = (String)attributes.remove(ElementTags.GRAYFILL)) != null) {
- setGrayFill(Float.valueOf(value + "f").floatValue());
- }
- if (attributes.size() > 0) setMarkupAttributes(attributes);
- }
-
- // implementation of the Element-methods
-
-/**
- * Processes the element by adding it (or the different parts) to an
- * <CODE>ElementListener</CODE>.
- *
- * @param listener an <CODE>ElementListener</CODE>
- * @return <CODE>true</CODE> if the element was processed successfully
- */
-
- public boolean process(ElementListener listener) {
- try {
- return listener.add(this);
- }
- catch(DocumentException de) {
- return false;
- }
- }
-
-/**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type() {
- return Element.CELL;
- }
-
-/**
- * Gets all the chunks in this element.
- *
- * @return an <CODE>ArrayList</CODE>
- */
-
- public ArrayList getChunks() {
- ArrayList tmp = new ArrayList();
- for (Iterator i = arrayList.iterator(); i.hasNext(); ) {
- tmp.addAll(((Element) i.next()).getChunks());
- }
- return tmp;
- }
-
- // methods to set the membervariables
-
-/**
- * Adds an element to this <CODE>Cell</CODE>.
- * <P>
- * Remark: you can't add <CODE>ListItem</CODE>s, <CODE>Row</CODE>s, <CODE>Cell</CODE>s,
- * <CODE>JPEG</CODE>s, <CODE>GIF</CODE>s or <CODE>PNG</CODE>s to a <CODE>Cell</CODE>.
- *
- * @param element The <CODE>Element</CODE> to add
- * @throws BadElementException if the method was called with a <CODE>ListItem</CODE>, <CODE>Row</CODE> or <CODE>Cell</CODE>
- */
-
- public void addElement(Element element) throws BadElementException {
- if (isTable()) {
- Table table = (Table) arrayList.get(0);
- Cell tmp = new Cell(element);
- tmp.setBorder(NO_BORDER);
- tmp.setColspan(table.columns());
- table.addCell(tmp);
- return;
- }
- switch(element.type()) {
- case Element.LISTITEM:
- case Element.ROW:
- case Element.CELL:
- throw new BadElementException("You can't add listitems, rows or cells to a cell.");
- case Element.LIST:
- if (Float.isNaN(leading)) {
- leading = ((List) element).leading();
- }
- if (((List) element).size() == 0) return;
- arrayList.add(element);
- return;
- case Element.ANCHOR:
- case Element.PARAGRAPH:
- case Element.PHRASE:
- if (Float.isNaN(leading)) {
- leading = ((Phrase) element).leading();
- }
- if (((Phrase) element).isEmpty()) return;
- arrayList.add(element);
- return;
- case Element.CHUNK:
- if (((Chunk) element).isEmpty()) return;
- arrayList.add(element);
- return;
- case Element.TABLE:
- Table table = new Table(3);
- float[] widths = new float[3];
- widths[1] = ((Table)element).widthPercentage();
-
- switch(((Table)element).alignment()) {
- case Element.ALIGN_LEFT:
- widths[0] = 0f;
- widths[2] = 100f - widths[1];
- break;
- case Element.ALIGN_CENTER:
- widths[0] = (100f - widths[1]) / 2f;
- widths[2] = widths[0];
- break;
- case Element.ALIGN_RIGHT:
- widths[0] = 100f - widths[1];
- widths[2] = 0f;
- }
- table.setWidths(widths);
- Cell tmp;
- if (arrayList.size() == 0) {
- table.addCell(getDummyCell());
- }
- else {
- tmp = new Cell();
- tmp.setBorder(NO_BORDER);
- tmp.setColspan(3);
- for (Iterator i = arrayList.iterator(); i.hasNext(); ) {
- tmp.add((Element) i.next());
- }
- table.addCell(tmp);
- }
- tmp = new Cell();
- tmp.setBorder(NO_BORDER);
- table.addCell(tmp);
- table.insertTable((Table)element);
- table.addCell(tmp);
- table.addCell(getDummyCell());
- clear();
- arrayList.add(table);
- return;
- default:
- arrayList.add(element);
- }
- }
-
-/**
- * Add an <CODE>Object</CODE> to this cell.
- *
- * @param o the object to add
- * @return always <CODE>true</CODE>
- */
-
- public boolean add(Object o) {
- try {
- this.addElement((Element) o);
- return true;
- }
- catch(ClassCastException cce) {
- throw new ClassCastException("You can only add objects that implement the Element interface.");
- }
- catch(BadElementException bee) {
- throw new ClassCastException(bee.getMessage());
- }
- }
-
-/**
- * Sets the leading.
- *
- * @param value the new value
- */
-
- public void setLeading(float value) {
- leading = value;
- }
-
-/**
- * Sets the horizontal alignment.
- *
- * @param value the new value
- */
-
- public void setHorizontalAlignment(int value) {
- horizontalAlignment = value;
- }
-
-/**
- * Sets the alignment of this cell.
- *
- * @param alignment the new alignment as a <CODE>String</CODE>
- */
-
- public void setHorizontalAlignment(String alignment) {
- if (ElementTags.ALIGN_CENTER.equalsIgnoreCase(alignment)) {
- this.horizontalAlignment = Element.ALIGN_CENTER;
- return;
- }
- if (ElementTags.ALIGN_RIGHT.equalsIgnoreCase(alignment)) {
- this.horizontalAlignment = Element.ALIGN_RIGHT;
- return;
- }
- if (ElementTags.ALIGN_JUSTIFIED.equalsIgnoreCase(alignment)) {
- this.horizontalAlignment = Element.ALIGN_JUSTIFIED;
- return;
- }
- if (ElementTags.ALIGN_JUSTIFIED_ALL.equalsIgnoreCase(alignment)) {
- this.horizontalAlignment = Element.ALIGN_JUSTIFIED_ALL;
- return;
- }
- this.horizontalAlignment = Element.ALIGN_LEFT;
- }
-
-/**
- * Sets the vertical alignment.
- *
- * @param value the new value
- */
-
- public void setVerticalAlignment(int value) {
- verticalAlignment = value;
- }
-
-/**
- * Sets the alignment of this paragraph.
- *
- * @param alignment the new alignment as a <CODE>String</CODE>
- */
-
- public void setVerticalAlignment(String alignment) {
- if (ElementTags.ALIGN_MIDDLE.equalsIgnoreCase(alignment)) {
- this.verticalAlignment = Element.ALIGN_MIDDLE;
- return;
- }
- if (ElementTags.ALIGN_BOTTOM.equalsIgnoreCase(alignment)) {
- this.verticalAlignment = Element.ALIGN_BOTTOM;
- return;
- }
- if (ElementTags.ALIGN_BASELINE.equalsIgnoreCase(alignment)) {
- this.verticalAlignment = Element.ALIGN_BASELINE;
- return;
- }
- this.verticalAlignment = Element.ALIGN_TOP;
- }
-
-/**
- * Sets the width.
- *
- * @param value the new value
- */
-
- public void setWidth(String value) {
- width = value;
- }
-
-/**
- * Sets the colspan.
- *
- * @param value the new value
- */
-
- public void setColspan(int value) {
- colspan = value;
- }
-
-/**
- * Sets the rowspan.
- *
- * @param value the new value
- */
-
- public void setRowspan(int value) {
- rowspan = value;
- }
-
-/**
- * Sets header.
- *
- * @param value the new value
- */
-
- public void setHeader(boolean value) {
- header = value;
- }
-
-/**
- * Set nowrap.
- *
- * @param value the new value
- */
-
- public void setNoWrap(boolean value) {
- maxLines = 1;
- }
-
- // methods to retrieve information
-
-/**
- * Gets the number of <CODE>Element</CODE>s in the Cell.
- *
- * @return a <CODE>size</CODE>.
- */
-
- public int size() {
- return arrayList.size();
- }
-
-/**
- * Checks if the <CODE>Cell</CODE> is empty.
- *
- * @return <CODE>false</CODE> if there are non-empty <CODE>Element</CODE>s in the <CODE>Cell</CODE>.
- */
-
- public boolean isEmpty() {
- switch(size()) {
- case 0:
- return true;
- case 1:
- Element element = (Element) arrayList.get(0);
- switch (element.type()) {
- case Element.CHUNK:
- return ((Chunk) element).isEmpty();
- case Element.ANCHOR:
- case Element.PHRASE:
- case Element.PARAGRAPH:
- return ((Phrase) element).isEmpty();
- case Element.LIST:
- return ((List) element).size() == 0;
- }
- return false;
- default:
- return false;
- }
- }
-
-/**
- * Makes sure there is at least 1 object in the Cell.
- *
- * Otherwise it might not be shown in the table.
- */
-
- void fill() {
- if (size() == 0) arrayList.add(new Paragraph(0));
- }
-
-/**
- * Checks if the <CODE>Cell</CODE> is empty.
- *
- * @return <CODE>false</CODE> if there are non-empty <CODE>Element</CODE>s in the <CODE>Cell</CODE>.
- */
-
- public boolean isTable() {
- return (size() == 1) && (((Element)arrayList.get(0)).type() == Element.TABLE);
- }
-
-/**
- * Gets an iterator of <CODE>Element</CODE>s.
- *
- * @return an <CODE>Iterator</CODE>.
- */
-
- public Iterator getElements() {
- return arrayList.iterator();
- }
-
-/**
- * Gets the horizontal alignment.
- *
- * @return a value
- */
-
- public int horizontalAlignment() {
- return horizontalAlignment;
- }
-
-/**
- * Gets the vertical alignment.
- *
- * @return a value
- */
-
- public int verticalAlignment() {
- return verticalAlignment;
- }
-
-/**
- * Gets the width.
- *
- * @return a value
- */
-
- public String cellWidth() {
- return width;
- }
-
-/**
- * Gets the colspan.
- *
- * @return a value
- */
-
- public int colspan() {
- return colspan;
- }
-
-/**
- * Gets the rowspan.
- *
- * @return a value
- */
-
- public int rowspan() {
- return rowspan;
- }
-
-/**
- * Gets the leading.
- *
- * @return a value
- */
-
- public float leading() {
- if (Float.isNaN(leading)) {
- return 16;
- }
- return leading;
- }
-
-/**
- * Is this <CODE>Cell</CODE> a header?
- *
- * @return a value
- */
-
- public boolean header() {
- return header;
- }
-
-/**
- * Get nowrap.
- *
- * @return a value
- */
-
- public boolean noWrap() {
- return maxLines == 1;
- }
-
-/**
- * Clears all the <CODE>Element</CODE>s of this <CODE>Cell</CODE>.
- */
- public void clear() {
- arrayList.clear();
- }
-
-/**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @return NA
- */
- public float top() {
- throw new UnsupportedOperationException("Dimensions of a Cell can't be calculated. See the FAQ.");
- }
-
-/**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @return NA
- */
- public float bottom() {
- throw new UnsupportedOperationException("Dimensions of a Cell can't be calculated. See the FAQ.");
- }
-
-/**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @return NA
- */
- public float left() {
- throw new UnsupportedOperationException("Dimensions of a Cell can't be calculated. See the FAQ.");
- }
-
-/**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @return NA
- */
- public float right() {
- throw new UnsupportedOperationException("Dimensions of a Cell can't be calculated. See the FAQ.");
- }
-
-/**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @param margin
- * @return NA
- */
- public float top(int margin) {
- throw new UnsupportedOperationException("Dimensions of a Cell can't be calculated. See the FAQ.");
- }
-
-/**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @param margin
- * @return NA
- */
- public float bottom(int margin) {
- throw new UnsupportedOperationException("Dimensions of a Cell can't be calculated. See the FAQ.");
- }
-
-/**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @param margin
- * @return NA
- */
- public float left(int margin) {
- throw new UnsupportedOperationException("Dimensions of a Cell can't be calculated. See the FAQ.");
- }
-
-/**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @param margin NA
- * @return NA
- */
- public float right(int margin) {
- throw new UnsupportedOperationException("Dimensions of a Cell can't be calculated. See the FAQ.");
- }
-
-/**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @param value NA
- */
- public void setTop(int value) {
- throw new UnsupportedOperationException("Dimensions of a Cell are attributed automagically. See the FAQ.");
- }
-
-/**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @param value NA
- */
- public void setBottom(int value) {
- throw new UnsupportedOperationException("Dimensions of a Cell are attributed automagically. See the FAQ.");
- }
-
-/**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @param value NA
- */
- public void setLeft(int value) {
- throw new UnsupportedOperationException("Dimensions of a Cell are attributed automagically. See the FAQ.");
- }
-
-/**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @param value NA
- */
- public void setRight(int value) {
- throw new UnsupportedOperationException("Dimensions of a Cell are attributed automagically. See the FAQ.");
- }
-
-/**
- * Checks if a given tag corresponds with this object.
- *
- * @param tag the given tag
- * @return true if the tag corresponds
- */
-
- public static boolean isTag(String tag) {
- return ElementTags.CELL.equals(tag);
- }
-
-/** Does this <CODE>Cell</CODE> force a group change? */
- protected boolean groupChange = true;
-
-/**
- * Does this <CODE>Cell</CODE> force a group change?
- *
- * @return a value
- */
-
- public boolean getGroupChange() {
- return groupChange;
- }
-
-/**
- * Sets group change.
- *
- * @param value the new value
- */
-
- public void setGroupChange(boolean value) {
- groupChange = value;
- }
-
- /**
- * Getter for {@link #maxLines}
- * @return the maxLines value
- */
- public int getMaxLines() {
- return maxLines;
- }
- /**
- * Setter for {@link #maxLines}
- * @param value the maximum number of lines
- */
- public void setMaxLines(int value) {
- maxLines = value;
- }
- /**
- * Maximum number of lines allowed in the cell.
- * The default value of this property is not to limit the maximum number of lines
- * (contributed by dperezcar at fcc.es)
- */
- protected int maxLines = Integer.MAX_VALUE;
- /**Setter for {@link #showTruncation}
- * @param value Can be null for avoiding marking the truncation.*/
- public void setShowTruncation(String value) {
- showTruncation = value;
- }
- /**
- * Getter for {@link #showTruncation}
- * @return the showTruncation value
- */
- public String getShowTruncation() {
- return showTruncation;
- }
- /**
- * If a truncation happens due to the {@link #maxLines} property, then this text will
- * be added to indicate a truncation has happened.
- * Default value is null, and means avoiding marking the truncation.
- * A useful value of this property could be e.g. "..."
- * (contributed by dperezcar at fcc.es)
- */
- String showTruncation;
-
-
- /**
- * Sets the value of {@link #useAscender}.
- * @param use use ascender height if true
- */
- public void setUseAscender(boolean use) {
- useAscender = use;
- }
-
- /**
- * Gets the value of {@link #useAscender}
- * @return useAscender
- */
- public boolean isUseAscender() {
- return useAscender;
- }
-
- /**
- * Sets the value of {@link #useDescender}.
- * @param use use descender height if true
- */
- public void setUseDescender(boolean use) {
- useDescender = use;
- }
-
- /**
- * gets the value of {@link #useDescender }
- * @return useDescender
- */
- public boolean isUseDescender() {
- return useDescender;
- }
-
- /**
- * Sets the value of {@link #useBorderPadding}.
- * @param use adjust layour for borders if true
- */
- public void setUseBorderPadding(boolean use) {
- useBorderPadding = use;
- }
-
- /**
- * Gets the value of {@link #useBorderPadding}.
- * @return useBorderPadding
- */
- public boolean isUseBorderPadding() {
- return useBorderPadding;
- }
-
- /**
- * Creates a PdfPCell based on this Cell object.
- * @return a PdfPCell
- * @throws BadElementException
- */
- public PdfPCell createPdfPCell() throws BadElementException {
- if (rowspan > 1) throw new BadElementException("PdfPCells can't have a rowspan > 1");
- if (isTable()) return new PdfPCell(((Table)arrayList.get(0)).createPdfPTable());
- PdfPCell cell = new PdfPCell();
- cell.setVerticalAlignment(verticalAlignment);
- cell.setHorizontalAlignment(horizontalAlignment);
- cell.setColspan(colspan);
- cell.setUseBorderPadding(useBorderPadding);
- cell.setUseDescender(useDescender);
- cell.setLeading(leading(), 0);
- cell.cloneNonPositionParameters(this);
- for (Iterator i = getElements(); i.hasNext(); ) {
- cell.addElement((Element)i.next());
- }
- return cell;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/Chapter.java b/LibrarySource/com/lowagie/text/Chapter.java
deleted file mode 100644
index 80afae9..0000000
--- a/LibrarySource/com/lowagie/text/Chapter.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * $Id: Chapter.java,v 1.69 2005/04/13 09:51:14 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- *
- */
-
-package com.lowagie.text;
-
-import java.util.ArrayList;
-import java.util.Properties;
-
-/**
- * A <CODE>Chapter</CODE> is a special <CODE>Section</CODE>.
- * <P>
- * A chapter number has to be created using a <CODE>Paragraph</CODE> as title
- * and an <CODE>int</CODE> as chapter number. The chapter number is shown be
- * default. If you don't want to see the chapter number, you have to set the
- * numberdepth to <VAR>0</VAR>.
- * <P>
- * Example:
- * <BLOCKQUOTE><PRE>
- * Paragraph title2 = new Paragraph("This is Chapter 2", FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0, 255)));
- * <STRONG>Chapter chapter2 = new Chapter(title2, 2);</STRONG>
- * <STRONG>chapter2.setNumberDepth(0);</STRONG>
- * Paragraph someText = new Paragraph("This is some text");
- * <STRONG>chapter2.add(someText);</STRONG>
- * Paragraph title21 = new Paragraph("This is Section 1 in Chapter 2", FontFactory.getFont(FontFactory.HELVETICA, 16, Font.BOLD, new Color(255, 0, 0)));
- * Section section1 = <STRONG>chapter2.addSection(title21);</STRONG>
- * Paragraph someSectionText = new Paragraph("This is some silly paragraph in a chapter and/or section. It contains some text to test the functionality of Chapters and Section.");
- * section1.add(someSectionText);
- * </PRE></BLOCKQUOTE>
- */
-
-public class Chapter extends Section implements TextElementArray {
-
- // constructors
-
- /**
- * Constructs a new <CODE>Chapter</CODE>.
- *
- * @param title the Chapter title (as a <CODE>Paragraph</CODE>)
- * @param number the Chapter number
- */
-
- public Chapter(Paragraph title, int number) {
- super(title, 1);
- numbers = new ArrayList();
- numbers.add(new Integer(number));
- }
-
-/**
- * Constructs a new <CODE>Chapter</CODE>.
- *
- * @param title the Chapter title (as a <CODE>String</CODE>)
- * @param number the Chapter number
- */
-
- public Chapter(String title, int number) {
- this(new Paragraph(title), number);
- }
-
-/**
- * Creates a new <CODE>Chapter</CODE> following a set of attributes.
- *
- * @param attributes the attributes
- * @param number a userdefined Chapter number
- */
-
- public Chapter(Properties attributes, int number) {
- this(new Paragraph(""), number);
-
- String value;
- if ((value = (String)attributes.remove(ElementTags.NUMBERDEPTH)) != null) {
- setNumberDepth(Integer.parseInt(value));
- }
- if ((value = (String)attributes.remove(ElementTags.INDENT)) != null) {
- setIndentation(Float.valueOf(value + "f").floatValue());
- }
- if ((value = (String)attributes.remove(ElementTags.INDENTATIONLEFT)) != null) {
- setIndentationLeft(Float.valueOf(value + "f").floatValue());
- }
- if ((value = (String)attributes.remove(ElementTags.INDENTATIONRIGHT)) != null) {
- setIndentationRight(Float.valueOf(value + "f").floatValue());
- }
- }
-
- // implementation of the Element-methods
-
-/**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type() {
- return Element.CHAPTER;
- }
-
- // methods
-
-/**
- * Checks if a given tag corresponds with this object.
- *
- * @param tag the given tag
- * @return true if the tag corresponds
- */
-
- public static boolean isTag(String tag) {
- return ElementTags.CHAPTER.equals(tag);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/Chunk.java b/LibrarySource/com/lowagie/text/Chunk.java
deleted file mode 100644
index 93cd221..0000000
--- a/LibrarySource/com/lowagie/text/Chunk.java
+++ /dev/null
@@ -1,788 +0,0 @@
-/*
- * $Id: Chunk.java,v 1.111 2005/05/03 13:03:47 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import headless.awt.Color;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Properties;
-import java.util.Set;
-import java.net.URL;
-
-import com.lowagie.text.pdf.PdfAction;
-import com.lowagie.text.pdf.PdfAnnotation;
-import com.lowagie.text.pdf.HyphenationEvent;
-import com.lowagie.text.pdf.PdfContentByte;
-import com.lowagie.text.markup.MarkupTags;
-import com.lowagie.text.markup.MarkupParser;
-
-/**
- * This is the smallest significant part of text that can be added to a document.
- * <P>
- * Most elements can be divided in one or more <CODE>Chunk</CODE>s.
- * A chunk is a <CODE>String</CODE> with a certain <CODE>Font</CODE>.
- * all other layoutparameters should be defined in the object to which
- * this chunk of text is added.
- * <P>
- * Example:
- * <BLOCKQUOTE><PRE>
- * <STRONG>Chunk chunk = new Chunk("Hello world", FontFactory.getFont(FontFactory.COURIER, 20, Font.ITALIC, new Color(255, 0, 0)));</STRONG>
- * document.add(chunk);
- * </PRE></BLOCKQUOTE>
- */
-
-public class Chunk implements Element, MarkupAttributes {
-
-// public static membervariables
-
- /**
- * The character stand in for an image.
- */
- public static final String OBJECT_REPLACEMENT_CHARACTER = "\ufffc";
-
-/** This is a Chunk containing a newline. */
- public static final Chunk NEWLINE = new Chunk("\n");
-
-/** This is a Chunk containing a newpage. */
- public static final Chunk NEXTPAGE = new Chunk("");
- static {
- NEXTPAGE.setNewPage();
- }
-/** Key for sub/superscript. */
- public static final String SUBSUPSCRIPT = "SUBSUPSCRIPT";
-
-/** Key for underline. */
- public static final String UNDERLINE = "UNDERLINE";
-
-/** Key for color. */
- public static final String COLOR = "COLOR";
-
-/** Key for encoding. */
- public static final String ENCODING = "ENCODING";
-
-/** Key for remote goto. */
- public static final String REMOTEGOTO = "REMOTEGOTO";
-
-/** Key for local goto. */
- public static final String LOCALGOTO = "LOCALGOTO";
-
-/** Key for local destination. */
- public static final String LOCALDESTINATION = "LOCALDESTINATION";
-
-/** Key for image. */
- public static final String IMAGE = "IMAGE";
-
-/** Key for generic tag. */
- public static final String GENERICTAG = "GENERICTAG";
-
-/** Key for newpage. */
- public static final String NEWPAGE = "NEWPAGE";
-
-/** Key for split character. */
- public static final String SPLITCHARACTER = "SPLITCHARACTER";
-
-/** Key for Action. */
- public static final String ACTION = "ACTION";
-
-/** Key for background. */
- public static final String BACKGROUND = "BACKGROUND";
-
-/** Key for annotation. */
- public static final String PDFANNOTATION = "PDFANNOTATION";
-
-/** Key for hyphenation. */
- public static final String HYPHENATION = "HYPHENATION";
-
-/** Key for text rendering mode. */
- public static final String TEXTRENDERMODE = "TEXTRENDERMODE";
-
-/** Key for text skewing. */
- public static final String SKEW = "SKEW";
-
-/** Key for text horizontal scaling. */
- public static final String HSCALE = "HSCALE";
-
-// member variables
-
-/** This is the content of this chunk of text. */
- protected StringBuffer content = null;
-
-/** This is the <CODE>Font</CODE> of this chunk of text. */
- protected Font font = null;
-
-/** Contains some of the attributes for this Chunk. */
- protected HashMap attributes = null;
-
-/** Contains extra markupAttributes */
- protected Properties markupAttributes = null;
-
-// constructors
-
-/**
- * Empty constructor.
- */
- protected Chunk() {
- }
-
-/**
- * Constructs a chunk of text with a certain content and a certain <CODE>Font</CODE>.
- *
- * @param content the content
- * @param font the font
- */
-
- public Chunk(String content, Font font) {
- this.content = new StringBuffer(content);
- this.font = font;
- }
-
-/**
- * Constructs a chunk of text with a certain content, without specifying a <CODE>Font</CODE>.
- *
- * @param content the content
- */
- public Chunk(String content) {
- this(content, new Font());
- }
-
-/**
- * Constructs a chunk of text with a char and a certain <CODE>Font</CODE>.
- *
- * @param c the content
- * @param font the font
- */
- public Chunk(char c, Font font) {
- this.content = new StringBuffer();
- this.content.append(c);
- this.font = font;
- }
-
-/**
- * Constructs a chunk of text with a char, without specifying a <CODE>Font</CODE>.
- *
- * @param c the content
- */
- public Chunk(char c) {
- this(c, new Font());
- }
-
-/**
- * Constructs a chunk containing an <CODE>Image</CODE>.
- *
- * @param image the image
- * @param offsetX the image offset in the x direction
- * @param offsetY the image offset in the y direction
- */
-
- public Chunk(Image image, float offsetX, float offsetY) {
- this(OBJECT_REPLACEMENT_CHARACTER, new Font());
- Image copyImage = Image.getInstance(image);
- copyImage.setAbsolutePosition(Float.NaN, Float.NaN);
- setAttribute(IMAGE, new Object[]{copyImage, new Float(offsetX), new Float(offsetY), new Boolean(false)});
- }
-
-/**
- * Constructs a chunk containing an <CODE>Image</CODE>.
- *
- * @param image the image
- * @param offsetX the image offset in the x direction
- * @param offsetY the image offset in the y direction
- * @param changeLeading true if the leading has to be adapted to the image
- */
-
- public Chunk(Image image, float offsetX, float offsetY, boolean changeLeading) {
- this(OBJECT_REPLACEMENT_CHARACTER, new Font());
- setAttribute(IMAGE, new Object[]{image, new Float(offsetX), new Float(offsetY), new Boolean(changeLeading)});
- }
-
-/**
- * Returns a <CODE>Chunk</CODE> that has been constructed taking in account
- * the value of some <VAR>attributes</VAR>.
- *
- * @param attributes Some attributes
- */
-
- public Chunk(Properties attributes) {
- this("", FontFactory.getFont(attributes));
- String value;
- if ((value = (String)attributes.remove(ElementTags.ITEXT)) != null) {
- append(value);
- }
- if ((value = (String)attributes.remove(ElementTags.LOCALGOTO)) != null) {
- setLocalGoto(value);
- }
- if ((value = (String)attributes.remove(ElementTags.REMOTEGOTO)) != null) {
- String destination = (String) attributes.remove(ElementTags.DESTINATION);
- String page = (String) attributes.remove(ElementTags.PAGE);
- if (page != null) {
- setRemoteGoto(value, Integer.valueOf(page).intValue());
- }
- else if (destination != null) {
- setRemoteGoto(value, destination);
- }
- }
- if ((value = (String)attributes.remove(ElementTags.LOCALDESTINATION)) != null) {
- setLocalDestination(value);
- }
- if ((value = (String)attributes.remove(ElementTags.SUBSUPSCRIPT)) != null) {
- setTextRise(Float.valueOf(value + "f").floatValue());
- }
- if ((value = (String)attributes.remove(MarkupTags.CSS_KEY_VERTICALALIGN)) != null && value.endsWith("%")) {
- float p = Float.valueOf(value.substring(0, value.length() - 1) + "f").floatValue() / 100f;
- setTextRise(p * font.size());
- }
- if ((value = (String)attributes.remove(ElementTags.GENERICTAG)) != null) {
- setGenericTag(value);
- }
- if ((value = (String)attributes.remove(ElementTags.BACKGROUNDCOLOR)) != null) {
- setBackground(MarkupParser.decodeColor(value));
- }
- if (attributes.size() > 0) setMarkupAttributes(attributes);
- }
-
- // implementation of the Element-methods
-
-/**
- * Processes the element by adding it (or the different parts) to an
- * <CODE>ElementListener</CODE>.
- *
- * @param listener an <CODE>ElementListener</CODE>
- * @return <CODE>true</CODE> if the element was processed successfully
- */
-
- public boolean process(ElementListener listener) {
- try {
- return listener.add(this);
- }
- catch(DocumentException de) {
- return false;
- }
- }
-
-/**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type() {
- return Element.CHUNK;
- }
-
-/**
- * Gets all the chunks in this element.
- *
- * @return an <CODE>ArrayList</CODE>
- */
-
- public ArrayList getChunks() {
- ArrayList tmp = new ArrayList();
- tmp.add(this);
- return tmp;
- }
-
- // methods
-
-/**
- * appends some text to this <CODE>Chunk</CODE>.
- *
- * @param string <CODE>String</CODE>
- * @return a <CODE>StringBuffer</CODE>
- */
-
- public StringBuffer append(String string) {
- return content.append(string);
- }
-
- // methods to retrieve information
-
-/**
- * Gets the font of this <CODE>Chunk</CODE>.
- *
- * @return a <CODE>Font</CODE>
- */
-
- public Font font() {
- return font;
- }
-
-/**
- * Sets the font of this <CODE>Chunk</CODE>.
- *
- * @param font a <CODE>Font</CODE>
- */
-
- public void setFont(Font font) {
- this.font = font;
- }
-
-/**
- * Returns the content of this <CODE>Chunk</CODE>.
- *
- * @return a <CODE>String</CODE>
- */
-
- public String content() {
- return content.toString();
- }
-
-/**
- * Checks is this <CODE>Chunk</CODE> is empty.
- *
- * @return <CODE>false</CODE> if the Chunk contains other characters than space.
- */
-
- public boolean isEmpty() {
- return (content.toString().trim().length() == 0) && (content.toString().indexOf("\n") == -1) && (attributes == null);
- }
-
-/**
- * Gets the width of the Chunk in points.
- * @return a width in points
- */
- public float getWidthPoint() {
- if (getImage() != null) {
- return getImage().scaledWidth();
- }
- return font.getCalculatedBaseFont(true).getWidthPoint(content(), font.getCalculatedSize()) * getHorizontalScaling();
- }
-
-/**
- * Sets the text displacement relative to the baseline. Positive values rise the text,
- * negative values lower the text.
- * <P>
- * It can be used to implement sub/superscript.
- * @param rise the displacement in points
- * @return this <CODE>Chunk</CODE>
- */
-
- public Chunk setTextRise(float rise) {
- return setAttribute(SUBSUPSCRIPT, new Float(rise));
- }
-
- /**
- * Gets the text displacement relatiev to the baseline.
- * @return a displacement in points
- */
- public float getTextRise() {
- if (attributes.containsKey(SUBSUPSCRIPT)) {
- Float f = (Float)attributes.get(SUBSUPSCRIPT);
- return f.floatValue();
- }
- return 0.0f;
- }
-
- /** Sets the text rendering mode. It can outline text, simulate bold and make
- * text invisible.
- * @param mode the text rendering mode. It can be <CODE>PdfContentByte.TEXT_RENDER_MODE_FILL</CODE>,
- * <CODE>PdfContentByte.TEXT_RENDER_MODE_STROKE</CODE>, <CODE>PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE</CODE>
- * and <CODE>PdfContentByte.TEXT_RENDER_MODE_INVISIBLE</CODE>.
- * @param strokeWidth the stroke line width for the modes <CODE>PdfContentByte.TEXT_RENDER_MODE_STROKE</CODE> and
- * <CODE>PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE</CODE>.
- * @param strokeColor the stroke color or <CODE>null</CODE> to follow the text color
- * @return this <CODE>Chunk</CODE>
- */
- public Chunk setTextRenderMode(int mode, float strokeWidth, Color strokeColor) {
- return setAttribute(TEXTRENDERMODE, new Object[]{new Integer(mode), new Float(strokeWidth), strokeColor});
- }
-
- /**
- * Skews the text to simulate italic and other effects.
- * Try <CODE>alpha=0</CODE> and <CODE>beta=12</CODE>.
- * @param alpha the first angle in degrees
- * @param beta the second angle in degrees
- * @return this <CODE>Chunk</CODE>
- */
- public Chunk setSkew(float alpha, float beta) {
- alpha = (float)Math.tan(alpha * Math.PI / 180);
- beta = (float)Math.tan(beta * Math.PI / 180);
- return setAttribute(SKEW, new float[]{alpha, beta});
- }
-
- /**
- * Sets the text horizontal scaling. A value of 1 is normal and a value of 0.5f
- * shrinks the text to half it's width.
- * @param scale the horizontal scaling factor
- * @return this <CODE>Chunk</CODE>
- */
- public Chunk setHorizontalScaling(float scale) {
- return setAttribute(HSCALE, new Float(scale));
- }
-
- /**
- * Gets the horizontal scaling.
- * @return a percentage in float
- */
- public float getHorizontalScaling() {
- if (attributes == null) return 1f;
- Float f = (Float)attributes.get(HSCALE);
- if (f == null) return 1f;
- return f.floatValue();
- }
-
-/**
- * Sets an action for this <CODE>Chunk</CODE>.
- *
- * @param action the action
- * @return this <CODE>Chunk</CODE>
- */
-
- public Chunk setAction(PdfAction action) {
- return setAttribute(ACTION, action);
- }
-
-/**
- * Sets an anchor for this <CODE>Chunk</CODE>.
- *
- * @param url the <CODE>URL</CODE> to link to
- * @return this <CODE>Chunk</CODE>
- */
-
- public Chunk setAnchor(URL url) {
- return setAttribute(ACTION, new PdfAction(url.toExternalForm()));
- }
-
-/**
- * Sets an anchor for this <CODE>Chunk</CODE>.
- *
- * @param url the url to link to
- * @return this <CODE>Chunk</CODE>
- */
-
- public Chunk setAnchor(String url) {
- return setAttribute(ACTION, new PdfAction(url));
- }
-
-/**
- * Sets a local goto for this <CODE>Chunk</CODE>.
- * <P>
- * There must be a local destination matching the name.
- * @param name the name of the destination to go to
- * @return this <CODE>Chunk</CODE>
- */
-
- public Chunk setLocalGoto(String name) {
- return setAttribute(LOCALGOTO, name);
- }
-
-/**
- * Sets the color of the background <CODE>Chunk</CODE>.
- * @param color the color of the background
- * @return this <CODE>Chunk</CODE>
- */
- public Chunk setBackground(Color color) {
- return setBackground(color, 0, 0, 0, 0);
- }
-
- /** Sets the color and the size of the background <CODE>Chunk</CODE>.
- * @param color the color of the background
- * @param extraLeft increase the size of the rectangle in the left
- * @param extraBottom increase the size of the rectangle in the bottom
- * @param extraRight increase the size of the rectangle in the right
- * @param extraTop increase the size of the rectangle in the top
- * @return this <CODE>Chunk</CODE>
- */
- public Chunk setBackground(Color color, float extraLeft, float extraBottom, float extraRight, float extraTop) {
- return setAttribute(BACKGROUND, new Object[]{color, new float[]{extraLeft, extraBottom, extraRight, extraTop}});
- }
-
- /**
- * Sets an horizontal line that can be an underline or a strikethrough.
- * Actually, the line can be anywhere vertically and has always the
- * <CODE>Chunk</CODE> width. Multiple call to this method will
- * produce multiple lines.
- * @param thickness the absolute thickness of the line
- * @param yPosition the absolute y position relative to the baseline
- * @return this <CODE>Chunk</CODE>
- */
- public Chunk setUnderline(float thickness, float yPosition) {
- return setUnderline(null, thickness, 0f, yPosition, 0f, PdfContentByte.LINE_CAP_BUTT);
- }
-
- /**
- * Sets an horizontal line that can be an underline or a strikethrough.
- * Actually, the line can be anywhere vertically and has always the
- * <CODE>Chunk</CODE> width. Multiple call to this method will
- * produce multiple lines.
- * @param color the color of the line or <CODE>null</CODE> to follow
- * the text color
- * @param thickness the absolute thickness of the line
- * @param thicknessMul the thickness multiplication factor with the font size
- * @param yPosition the absolute y position relative to the baseline
- * @param yPositionMul the position multiplication factor with the font size
- * @param cap the end line cap. Allowed values are
- * PdfContentByte.LINE_CAP_BUTT, PdfContentByte.LINE_CAP_ROUND and
- * PdfContentByte.LINE_CAP_PROJECTING_SQUARE
- * @return this <CODE>Chunk</CODE>
- */
- public Chunk setUnderline(Color color, float thickness, float thicknessMul, float yPosition, float yPositionMul, int cap) {
- if (attributes == null)
- attributes = new HashMap();
- Object obj[] = {color, new float[]{thickness, thicknessMul, yPosition, yPositionMul, (float)cap}};
- Object unders[][] = addToArray((Object[][])attributes.get(UNDERLINE), obj);
- return setAttribute(UNDERLINE, unders);
- }
-
- /**
- * Utility method to extend an array.
- * @param original the original array or <CODE>null</CODE>
- * @param item the item to be added to the array
- * @return a new array with the item appended
- */
- public static Object[][] addToArray(Object original[][], Object item[]) {
- if (original == null) {
- original = new Object[1][];
- original[0] = item;
- return original;
- }
- else {
- Object original2[][] = new Object[original.length + 1][];
- System.arraycopy(original, 0, original2, 0, original.length);
- original2[original.length] = item;
- return original2;
- }
- }
-
-/**
- * Sets a generic annotation to this <CODE>Chunk</CODE>.
- * @param annotation the annotation
- * @return this <CODE>Chunk</CODE>
- */
- public Chunk setAnnotation(PdfAnnotation annotation) {
- return setAttribute(PDFANNOTATION, annotation);
- }
-
-/** sets the hyphenation engine to this <CODE>Chunk</CODE>.
- * @param hyphenation the hyphenation engine
- * @return this <CODE>Chunk</CODE>
- */
- public Chunk setHyphenation(HyphenationEvent hyphenation) {
- return setAttribute(HYPHENATION, hyphenation);
- }
-
- /**
- * Sets a goto for a remote destination for this <CODE>Chunk</CODE>.
- * @param filename the file name of the destination document
- * @param name the name of the destination to go to
- * @return this <CODE>Chunk</CODE>
- */
-
- public Chunk setRemoteGoto(String filename, String name) {
- return setAttribute(REMOTEGOTO, new Object[]{filename, name});
- }
-
-/**
- * Sets a goto for a remote destination for this <CODE>Chunk</CODE>.
- *
- * @param filename the file name of the destination document
- * @param page the page of the destination to go to. First page is 1
- * @return this <CODE>Chunk</CODE>
- */
-
- public Chunk setRemoteGoto(String filename, int page) {
- return setAttribute(REMOTEGOTO, new Object[]{filename, new Integer(page)});
- }
-
-/**
- * Sets a local destination for this <CODE>Chunk</CODE>.
- *
- * @param name the name for this destination
- * @return this <CODE>Chunk</CODE>
- */
- public Chunk setLocalDestination(String name) {
- return setAttribute(LOCALDESTINATION, name);
- }
-
-/**
- * Sets the generic tag <CODE>Chunk</CODE>.
- * <P>
- * The text for this tag can be retrieved with <CODE>PdfPageEvent</CODE>.
- *
- * @param text the text for the tag
- * @return this <CODE>Chunk</CODE>
- */
-
- public Chunk setGenericTag(String text) {
- return setAttribute(GENERICTAG, text);
- }
-
-/**
- * Sets the split characters.
- *
- * @param splitCharacter the <CODE>SplitCharacter</CODE> interface
- * @return this <CODE>Chunk</CODE>
- */
-
- public Chunk setSplitCharacter(SplitCharacter splitCharacter) {
- return setAttribute(SPLITCHARACTER, splitCharacter);
- }
-
-/**
- * Sets a new page tag..
- * @return this <CODE>Chunk</CODE>
- */
-
- public Chunk setNewPage() {
- return setAttribute(NEWPAGE, null);
- }
-
-/**
- * Sets an arbitrary attribute.
- *
- * @param name the key for the attribute
- * @param obj the value of the attribute
- * @return this <CODE>Chunk</CODE>
- */
-
- private Chunk setAttribute(String name, Object obj) {
- if (attributes == null)
- attributes = new HashMap();
- attributes.put(name, obj);
- return this;
- }
-
-/**
- * Gets the attributes for this <CODE>Chunk</CODE>.
- * <P>
- * It may be null.
- *
- * @return the attributes for this <CODE>Chunk</CODE>
- */
-
- public HashMap getAttributes() {
- return attributes;
- }
-
-/**
- * Checks the attributes of this <CODE>Chunk</CODE>.
- *
- * @return false if there aren't any.
- */
-
- public boolean hasAttributes() {
- return attributes != null;
- }
-
- /**
- * Returns the image.
- * @return the image
- */
-
- public Image getImage() {
- if (attributes == null) return null;
- Object obj[] = (Object[])attributes.get(Chunk.IMAGE);
- if (obj == null)
- return null;
- else {
- return (Image)obj[0];
- }
- }
-
-/**
- * Checks if a given tag corresponds with this object.
- *
- * @param tag the given tag
- * @return true if the tag corresponds
- */
-
- public static boolean isTag(String tag) {
- return ElementTags.CHUNK.equals(tag);
- }
-
-
-/**
- * @see com.lowagie.text.MarkupAttributes#setMarkupAttribute(java.lang.String, java.lang.String)
- */
- public void setMarkupAttribute(String name, String value) {
- if (markupAttributes == null) markupAttributes = new Properties();
- markupAttributes.put(name, value);
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#setMarkupAttributes(java.util.Properties)
- */
- public void setMarkupAttributes(Properties markupAttributes) {
- this.markupAttributes = markupAttributes;
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttribute(java.lang.String)
- */
- public String getMarkupAttribute(String name) {
- return (markupAttributes == null) ? null : String.valueOf(markupAttributes.get(name));
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttributeNames()
- */
- public Set getMarkupAttributeNames() {
- return getKeySet(markupAttributes);
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttributes()
- */
- public Properties getMarkupAttributes() {
- return markupAttributes;
- }
-
- /**
- * Gets the keys of a Hashtable
- * @param table a Hashtable
- * @return the keyset of a Hashtable (or an empty set if table is null)
- */
- public static Set getKeySet(Hashtable table) {
- return (table == null) ? Collections.EMPTY_SET : table.keySet();
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/DocListener.java b/LibrarySource/com/lowagie/text/DocListener.java
deleted file mode 100644
index 5228f2d..0000000
--- a/LibrarySource/com/lowagie/text/DocListener.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * $Id: DocListener.java,v 1.52 2004/12/14 11:52:47 blowagie Exp $
- * $Name: $
- *
- * Copyright (c) 1999, 2000, 2001, 2002 Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-/**
- * A class that implements <CODE>DocListener</CODE> will perform some
- * actions when some actions are performed on a <CODE>Document</CODE>.
- *
- * @see ElementListener
- * @see Document
- * @see DocWriter
- */
-
-public interface DocListener extends ElementListener {
-
- // methods
-
-/**
- * Signals that the <CODE>Document</CODE> has been opened and that
- * <CODE>Elements</CODE> can be added.
- */
-
- public void open();
-
-/**
- * Sets the pagesize.
- *
- * @param pageSize the new pagesize
- * @return a <CODE>boolean</CODE>
- */
-
- public boolean setPageSize(Rectangle pageSize);
-
-/**
- * Signals that a <CODE>Watermark</CODE> was added to the <CODE>Document</CODE>.
- *
- * @param watermark the Watermark object
- * @return <CODE>true</CODE> if the element was added, <CODE>false</CODE> if not.
- */
-
- public boolean add(Watermark watermark);
-
-/**
- * Signals that a <CODE>Watermark</CODE> was removed from the <CODE>Document</CODE>.
- */
-
- public void removeWatermark();
-
-/**
- * Sets the margins.
- *
- * @param marginLeft the margin on the left
- * @param marginRight the margin on the right
- * @param marginTop the margin on the top
- * @param marginBottom the margin on the bottom
- * @return a <CODE>boolean</CODE>
- */
-
- public boolean setMargins(float marginLeft, float marginRight, float marginTop, float marginBottom);
-
- /**
- * Parameter that allows you to do margin mirroring (odd/even pages)
- * @param marginMirroring
- * @return true if succesfull
- */
- public boolean setMarginMirroring(boolean marginMirroring);
-
-/**
- * Signals that an new page has to be started.
- *
- * @return <CODE>true</CODE> if the page was added, <CODE>false</CODE> if not.
- * @throws DocumentException when a document isn't open yet, or has been closed
- */
-
- public boolean newPage() throws DocumentException;
-
-/**
- * Changes the header of this document.
- *
- * @param header the new header
- */
-
- public void setHeader(HeaderFooter header);
-
-/**
- * Resets the header of this document.
- */
-
- public void resetHeader();
-
-/**
- * Changes the footer of this document.
- *
- * @param footer the new footer
- */
-
- public void setFooter(HeaderFooter footer);
-
-/**
- * Resets the footer of this document.
- */
-
- public void resetFooter();
-
-/**
- * Sets the page number to 0.
- */
-
- public void resetPageCount();
-
-/**
- * Sets the page number.
- *
- * @param pageN the new page number
- */
-
- public void setPageCount(int pageN);
-
-/**
- * Clears text wrapping around images (if applicable).
- * Method suggested by Pelikan Stephan
- * @throws DocumentException
- */
- public void clearTextWrap() throws DocumentException;
-
-/**
- * Signals that the <CODE>Document</CODE> was closed and that no other
- * <CODE>Elements</CODE> will be added.
- * <P>
- * The outputstream of every writer implementing <CODE>DocListener</CODE> will be closed.
- */
-
- public void close();
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/DocWriter.java b/LibrarySource/com/lowagie/text/DocWriter.java
deleted file mode 100644
index 0d05b32..0000000
--- a/LibrarySource/com/lowagie/text/DocWriter.java
+++ /dev/null
@@ -1,510 +0,0 @@
-/*
- * $Id: DocWriter.java,v 1.70 2004/12/14 11:52:47 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.io.BufferedOutputStream;
-import java.io.OutputStream;
-import java.io.IOException;
-import java.util.Iterator;
-import com.lowagie.text.pdf.OutputStreamCounter;
-
-/**
- * An abstract <CODE>Writer</CODE> class for documents.
- * <P>
- * <CODE>DocWriter</CODE> is the abstract class of several writers such
- * as <CODE>PdfWriter</CODE> and <CODE>HtmlWriter</CODE>.
- * A <CODE>DocWriter</CODE> can be added as a <CODE>DocListener</CODE>
- * to a certain <CODE>Document</CODE> by getting an instance (see method
- * <CODE>getInstance()</CODE> in the specific writer-classes).
- * Every <CODE>Element</CODE> added to the original <CODE>Document</CODE>
- * will be written to the <CODE>OutputStream</CODE> of the listening
- * <CODE>DocWriter</CODE>.
- *
- * @see Document
- * @see DocListener
- */
-
-public abstract class DocWriter implements DocListener {
-
-/** This is some byte that is often used. */
- public static final byte NEWLINE = (byte)'\n';
-
-/** This is some byte that is often used. */
- public static final byte TAB = (byte)'\t';
-
-/** This is some byte that is often used. */
- public static final byte LT = (byte)'<';
-
-/** This is some byte that is often used. */
- public static final byte SPACE = (byte)' ';
-
-/** This is some byte that is often used. */
- public static final byte EQUALS = (byte)'=';
-
-/** This is some byte that is often used. */
- public static final byte QUOTE = (byte)'\"';
-
-/** This is some byte that is often used. */
- public static final byte GT = (byte)'>';
-
-/** This is some byte that is often used. */
- public static final byte FORWARD = (byte)'/';
-
- // membervariables
-
-/** The pageSize. */
- protected Rectangle pageSize;
-
-/** This is the document that has to be written. */
- protected Document document;
-
-/** The outputstream of this writer. */
- protected OutputStreamCounter os;
-
-/** Is the writer open for writing? */
- protected boolean open = false;
-
-/** Do we have to pause all writing actions? */
- protected boolean pause = false;
-
-/** Closes the stream on document close */
- protected boolean closeStream = true;
-
- // constructor
-
- protected DocWriter() {
- }
-
-/**
- * Constructs a <CODE>DocWriter</CODE>.
- *
- * @param document The <CODE>Document</CODE> that has to be written
- * @param os The <CODE>OutputStream</CODE> the writer has to write to.
- */
-
- protected DocWriter(Document document, OutputStream os) {
- this.document = document;
- this.os = new OutputStreamCounter(new BufferedOutputStream(os));
- }
-
- // implementation of the DocListener methods
-
-/**
- * Signals that an <CODE>Element</CODE> was added to the <CODE>Document</CODE>.
- * <P>
- * This method should be overriden in the specific <CODE>DocWriter<CODE> classes
- * derived from this abstract class.
- *
- * @param element A high level object to add
- * @return <CODE>false</CODE>
- * @throws DocumentException when a document isn't open yet, or has been closed
- */
-
- public boolean add(Element element) throws DocumentException {
- return false;
- }
-
-/**
- * Signals that the <CODE>Document</CODE> was opened.
- */
-
- public void open() {
- open = true;
- }
-
-/**
- * Sets the pagesize.
- *
- * @param pageSize the new pagesize
- * @return a <CODE>boolean</CODE>
- */
-
- public boolean setPageSize(Rectangle pageSize) {
- this.pageSize = pageSize;
- return true;
- }
-
-/**
- * Sets the <CODE>Watermark</CODE>.
- * <P>
- * This method should be overriden in the specific <CODE>DocWriter<CODE> classes
- * derived from this abstract class if they actually support the use of
- * a <CODE>Watermark</CODE>.
- *
- * @param watermark A watermark object
- * @return <CODE>false</CODE> (because watermarks aren't supported by default).
- */
-
- public boolean add(Watermark watermark) {
- return false;
- }
-
-/**
- * Removes the <CODE>Watermark</CODE> (if there is one).
- */
-
- public void removeWatermark() {
- }
-
-/**
- * Sets the margins.
- * <P>
- * This does nothing. Has to be overridden if needed.
- *
- * @param marginLeft the margin on the left
- * @param marginRight the margin on the right
- * @param marginTop the margin on the top
- * @param marginBottom the margin on the bottom
- * @return <CODE>false</CODE>
- */
-
- public boolean setMargins(float marginLeft, float marginRight, float marginTop, float marginBottom) {
- return false;
- }
-
-/**
- * Signals that an new page has to be started.
- * <P>
- * This does nothing. Has to be overridden if needed.
- *
- * @return <CODE>true</CODE> if the page was added, <CODE>false</CODE> if not.
- * @throws DocumentException when a document isn't open yet, or has been closed
- */
-
- public boolean newPage() throws DocumentException {
- if (!open) {
- return false;
- }
- return true;
- }
-
-/**
- * Changes the header of this document.
- * <P>
- * This method should be overriden in the specific <CODE>DocWriter<CODE> classes
- * derived from this abstract class if they actually support the use of
- * headers.
- *
- * @param header the new header
- */
-
- public void setHeader(HeaderFooter header) {
- }
-
-/**
- * Resets the header of this document.
- * <P>
- * This method should be overriden in the specific <CODE>DocWriter<CODE> classes
- * derived from this abstract class if they actually support the use of
- * headers.
- */
-
- public void resetHeader() {
- }
-
-/**
- * Changes the footer of this document.
- * <P>
- * This method should be overriden in the specific <CODE>DocWriter<CODE> classes
- * derived from this abstract class if they actually support the use of
- * footers.
- *
- * @param footer the new footer
- */
-
- public void setFooter(HeaderFooter footer) {
- }
-
-/**
- * Resets the footer of this document.
- * <P>
- * This method should be overriden in the specific <CODE>DocWriter<CODE> classes
- * derived from this abstract class if they actually support the use of
- * footers.
- */
-
- public void resetFooter() {
- }
-
-/**
- * Sets the page number to 0.
- * <P>
- * This method should be overriden in the specific <CODE>DocWriter<CODE> classes
- * derived from this abstract class if they actually support the use of
- * pagenumbers.
- */
-
- public void resetPageCount() {
- }
-
-/**
- * Sets the page number.
- * <P>
- * This method should be overriden in the specific <CODE>DocWriter<CODE> classes
- * derived from this abstract class if they actually support the use of
- * pagenumbers.
- *
- * @param pageN the new page number
- */
-
- public void setPageCount(int pageN) {
- }
-
-/**
- * Signals that the <CODE>Document</CODE> was closed and that no other
- * <CODE>Elements</CODE> will be added.
- */
-
- public void close() {
- open = false;
- try {
- os.flush();
- if (closeStream)
- os.close();
- }
- catch(IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- }
-
- // methods
-
-/** Converts a <CODE>String</CODE> into a <CODE>Byte</CODE> array
- * according to the ISO-8859-1 codepage.
- * @param text the text to be converted
- * @return the conversion result
- */
-
- public static final byte[] getISOBytes(String text)
- {
- if (text == null)
- return null;
- int len = text.length();
- byte b[] = new byte[len];
- for (int k = 0; k < len; ++k)
- b[k] = (byte)text.charAt(k);
- return b;
- }
-
-/**
- * Let the writer know that all writing has to be paused.
- */
-
- public void pause() {
- pause = true;
- }
-
-/**
- * Let the writer know that writing may be resumed.
- */
-
- public void resume() {
- pause = false;
- }
-
-/**
- * Flushes the <CODE>BufferedOutputStream</CODE>.
- */
-
- public void flush() {
- try {
- os.flush();
- }
- catch(IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- }
-
-/**
- * Writes a <CODE>String</CODE> to the <CODE>OutputStream</CODE>.
- *
- * @param string the <CODE>String</CODE> to write
- * @throws IOException
- */
-
- protected void write(String string) throws IOException {
- os.write(getISOBytes(string));
- }
-
-/**
- * Writes a number of tabs.
- *
- * @param indent the number of tabs to add
- * @throws IOException
- */
-
- protected void addTabs(int indent) throws IOException {
- os.write(NEWLINE);
- for (int i = 0; i < indent; i++) {
- os.write(TAB);
- }
- }
-
-/**
- * Writes a key-value pair to the outputstream.
- *
- * @param key the name of an attribute
- * @param value the value of an attribute
- * @throws IOException
- */
-
- protected void write(String key, String value)
- throws IOException {
- os.write(SPACE);
- write(key);
- os.write(EQUALS);
- os.write(QUOTE);
- write(value);
- os.write(QUOTE);
- }
-
-/**
- * Writes a starttag to the outputstream.
- *
- * @param tag the name of the tag
- * @throws IOException
- */
-
- protected void writeStart(String tag)
- throws IOException {
- os.write(LT);
- write(tag);
- }
-
-/**
- * Writes an endtag to the outputstream.
- *
- * @param tag the name of the tag
- * @throws IOException
- */
-
- protected void writeEnd(String tag)
- throws IOException {
- os.write(LT);
- os.write(FORWARD);
- write(tag);
- os.write(GT);
- }
-
-/**
- * Writes an endtag to the outputstream.
- * @throws IOException
- */
-
- protected void writeEnd()
- throws IOException {
- os.write(SPACE);
- os.write(FORWARD);
- os.write(GT);
- }
-
-/**
- * Writes the markup attributes of the specified <CODE>MarkupAttributes</CODE>
- * object to the <CODE>OutputStream</CODE>.
- * @param mAtt the <CODE>MarkupAttributes</CODE> to write.
- * @return true, if writing the markup attributes succeeded
- * @throws IOException
- */
- protected boolean writeMarkupAttributes(MarkupAttributes mAtt)
- throws IOException
- {
- Iterator attributeIterator = mAtt.getMarkupAttributeNames().iterator();
- boolean result = attributeIterator.hasNext();
- while (attributeIterator.hasNext()) {
- String name = String.valueOf(attributeIterator.next());
- write(name, mAtt.getMarkupAttribute(name));
- }
- return result;
- }
-
-
-/**
- * Returns <CODE>true</CODE> if the specified <CODE>Element</CODE> implements
- * <CODE>MarkupAttributes</CODE> and has one or more attributes to write.
- * @param element the <CODE>Element</CODE> to check.
- * @return <CODE>boolean</CODE>.
- */
- protected static boolean hasMarkupAttributes(Element element) {
- return (element instanceof MarkupAttributes &&
- !(((MarkupAttributes)element).getMarkupAttributeNames().isEmpty()));
- }
-
- /** Checks if the stream is to be closed on document close
- * @return true if the stream is closed on documnt close
- *
- */
- public boolean isCloseStream() {
- return closeStream;
- }
-
- /** Sets the close state of the stream after document close
- * @param closeStream true if the stream is closed on document close
- *
- */
- public void setCloseStream(boolean closeStream) {
- this.closeStream = closeStream;
- }
-
-
- /**
- * @see com.lowagie.text.DocListener#clearTextWrap()
- */
- public void clearTextWrap() throws DocumentException {
- // do nothing
- }
- /**
- * @see com.lowagie.text.DocListener#setMarginMirroring(boolean)
- */
- public boolean setMarginMirroring(boolean MarginMirroring) {
- return false;
- }
-
-}
diff --git a/LibrarySource/com/lowagie/text/Document.java b/LibrarySource/com/lowagie/text/Document.java
deleted file mode 100644
index 2603ea2..0000000
--- a/LibrarySource/com/lowagie/text/Document.java
+++ /dev/null
@@ -1,916 +0,0 @@
-/*
- * $Id: Document.java,v 1.82 2004/12/14 10:32:59 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import java.util.Date;
-
-/**
- * A generic Document class.
- * <P>
- * All kinds of Text-elements can be added to a <CODE>HTMLDocument</CODE>.
- * The <CODE>Document</CODE> signals all the listeners when an element has
- * been added.
- * <P>
- * Remark:
- * <OL>
- * <LI>Once a document is created you can add some meta information.
- * <LI>You can also set the headers/footers.
- * <LI>You have to open the document before you can write content.
- * <LI>You can only write content (no more meta-formation!) once a document is
- * opened.
- * <LI>When you change the header/footer on a certain page, this will be
- * effective starting on the next page.
- * <LI>Ater closing the document, every listener (as well as its <CODE>
- * OutputStream</CODE>) is closed too.
- * </OL>
- * Example: <BLOCKQUOTE>
- *
- * <PRE>// creation of the document with a certain size and certain margins
- * <STRONG>Document document = new Document(PageSize.A4, 50, 50, 50, 50);
- * </STRONG> try { // creation of the different writers HtmlWriter.getInstance(
- * <STRONG>document </STRONG>, System.out); PdfWriter.getInstance(
- * <STRONG>document </STRONG>, new FileOutputStream("text.pdf"));
- * // we add some meta information to the document
- * <STRONG>document.addAuthor("Bruno Lowagie"); </STRONG>
- * <STRONG>document.addSubject("This is the result of a Test."); </STRONG>
- * // we define a header and a footer HeaderFooter header = new
- * HeaderFooter(new Phrase("This is a header."), false); HeaderFooter footer =
- * new HeaderFooter(new Phrase("This is page "), new Phrase("."));
- * footer.setAlignment(Element.ALIGN_CENTER);
- * <STRONG>document.setHeader(header); </STRONG>
- * <STRONG>document.setFooter(footer); </STRONG>// we open the document for
- * writing <STRONG>document.open(); </STRONG> <STRONG>document.add(new
- * Paragraph("Hello world")); </STRONG>} catch(DocumentException de) {
- * System.err.println(de.getMessage()); } <STRONG>document.close(); </STRONG>
- * </CODE>
- * </PRE>
- *
- * </BLOCKQUOTE>
- */
-
-public class Document implements DocListener {
-
- // membervariables
-
- /** This constant may only be changed by Paulo Soares and/or Bruno Lowagie. */
- private static final String ITEXT_VERSION = "itext-paulo-154 (itextpdf.sf.net-lowagie.com)";
-
- /**
- * Allows the pdf documents to be produced without compression for debugging
- * purposes.
- */
- public static boolean compress = true;
-
- /** The DocListener. */
- private ArrayList listeners = new ArrayList();
-
- /** Is the document open or not? */
- protected boolean open;
-
- /** Has the document already been closed? */
- protected boolean close;
-
- // membervariables concerning the layout
-
- /** The size of the page. */
- protected Rectangle pageSize;
-
- /** The watermark on the pages. */
- protected Watermark watermark = null;
-
- /** margin in x direction starting from the left */
- protected float marginLeft = 0;
-
- /** margin in x direction starting from the right */
- protected float marginRight = 0;
-
- /** margin in y direction starting from the top */
- protected float marginTop = 0;
-
- /** margin in y direction starting from the bottom */
- protected float marginBottom = 0;
-
- protected boolean marginMirroring = false;
-
- /** Content of JavaScript onLoad function */
- protected String javaScript_onLoad = null;
-
- /** Content of JavaScript onUnLoad function */
- protected String javaScript_onUnLoad = null;
-
- /** Style class in HTML body tag */
- protected String htmlStyleClass = null;
-
- // headers, footers
-
- /** Current pagenumber */
- protected int pageN = 0;
-
- /** This is the textual part of a Page; it can contain a header */
- protected HeaderFooter header = null;
-
- /** This is the textual part of the footer */
- protected HeaderFooter footer = null;
-
- // constructor
-
- /**
- * Constructs a new <CODE>Document</CODE> -object.
- */
-
- public Document() {
- this(PageSize.A4);
- }
-
- /**
- * Constructs a new <CODE>Document</CODE> -object.
- *
- * @param pageSize
- * the pageSize
- */
-
- public Document(Rectangle pageSize) {
- this(pageSize, 36, 36, 36, 36);
- }
-
- /**
- * Constructs a new <CODE>Document</CODE> -object.
- *
- * @param pageSize
- * the pageSize
- * @param marginLeft
- * the margin on the left
- * @param marginRight
- * the margin on the right
- * @param marginTop
- * the margin on the top
- * @param marginBottom
- * the margin on the bottom
- */
-
- public Document(Rectangle pageSize, float marginLeft, float marginRight,
- float marginTop, float marginBottom) {
- this.pageSize = pageSize;
- this.marginLeft = marginLeft;
- this.marginRight = marginRight;
- this.marginTop = marginTop;
- this.marginBottom = marginBottom;
- }
-
- // listener methods
-
- /**
- * Adds a <CODE>DocListener</CODE> to the <CODE>Document</CODE>.
- *
- * @param listener
- * the new DocListener.
- */
-
- public void addDocListener(DocListener listener) {
- listeners.add(listener);
- }
-
- /**
- * Removes a <CODE>DocListener</CODE> from the <CODE>Document</CODE>.
- *
- * @param listener
- * the DocListener that has to be removed.
- */
-
- public void removeDocListener(DocListener listener) {
- listeners.remove(listener);
- }
-
- // methods implementing the DocListener interface
-
- /**
- * Adds an <CODE>Element</CODE> to the <CODE>Document</CODE>.
- *
- * @param element
- * the <CODE>Element</CODE> to add
- * @return <CODE>true</CODE> if the element was added, <CODE>false
- * </CODE> if not
- * @throws DocumentException
- * when a document isn't open yet, or has been closed
- */
-
- public boolean add(Element element) throws DocumentException {
- if (close) {
- throw new DocumentException(
- "The document has been closed. You can't add any Elements.");
- }
- int type = element.type();
- if (open) {
- if (!(type == Element.CHUNK || type == Element.PHRASE
- || type == Element.PARAGRAPH || type == Element.TABLE
- || type == Element.PTABLE
- || type == Element.MULTI_COLUMN_TEXT
- || type == Element.ANCHOR || type == Element.ANNOTATION
- || type == Element.CHAPTER || type == Element.SECTION
- || type == Element.LIST || type == Element.LISTITEM
- || type == Element.RECTANGLE || type == Element.JPEG
- || type == Element.IMGRAW || type == Element.IMGTEMPLATE || type == Element.GRAPHIC)) {
- throw new DocumentException(
- "The document is open; you can only add Elements with content.");
- }
- } else {
- if (!(type == Element.HEADER || type == Element.TITLE
- || type == Element.SUBJECT || type == Element.KEYWORDS
- || type == Element.AUTHOR || type == Element.PRODUCER
- || type == Element.CREATOR || type == Element.CREATIONDATE)) {
- throw new DocumentException(
- "The document is not open yet; you can only add Meta information.");
- }
- }
- boolean success = false;
- DocListener listener;
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
- listener = (DocListener) iterator.next();
- success |= listener.add(element);
- }
- return success;
- }
-
- /**
- * Opens the document.
- * <P>
- * Once the document is opened, you can't write any Header- or
- * Meta-information anymore. You have to open the document before you can
- * begin to add content to the body of the document.
- */
-
- public void open() {
- if (!close) {
- open = true;
- }
- DocListener listener;
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
- listener = (DocListener) iterator.next();
- listener.setPageSize(pageSize);
- listener.setMargins(marginLeft, marginRight, marginTop,
- marginBottom);
- listener.open();
- }
- }
-
- /**
- * Sets the pagesize.
- *
- * @param pageSize
- * the new pagesize
- * @return a <CODE>boolean</CODE>
- */
-
- public boolean setPageSize(Rectangle pageSize) {
- this.pageSize = pageSize;
- DocListener listener;
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
- listener = (DocListener) iterator.next();
- listener.setPageSize(pageSize);
- }
- return true;
- }
-
- /**
- * Sets the <CODE>Watermark</CODE>.
- *
- * @param watermark
- * the watermark to add
- * @return <CODE>true</CODE> if the element was added, <CODE>false
- * </CODE> if not.
- */
-
- public boolean add(Watermark watermark) {
- this.watermark = watermark;
- DocListener listener;
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
- listener = (DocListener) iterator.next();
- listener.add(watermark);
- }
- return true;
- }
-
- /**
- * Removes the <CODE>Watermark</CODE>.
- */
-
- public void removeWatermark() {
- this.watermark = null;
- DocListener listener;
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
- listener = (DocListener) iterator.next();
- listener.removeWatermark();
- }
- }
-
- /**
- * Sets the margins.
- *
- * @param marginLeft
- * the margin on the left
- * @param marginRight
- * the margin on the right
- * @param marginTop
- * the margin on the top
- * @param marginBottom
- * the margin on the bottom
- * @return a <CODE>boolean</CODE>
- */
-
- public boolean setMargins(float marginLeft, float marginRight,
- float marginTop, float marginBottom) {
- this.marginLeft = marginLeft;
- this.marginRight = marginRight;
- this.marginTop = marginTop;
- this.marginBottom = marginBottom;
- DocListener listener;
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
- listener = (DocListener) iterator.next();
- listener.setMargins(marginLeft, marginRight, marginTop,
- marginBottom);
- }
- return true;
- }
-
- /**
- * Signals that an new page has to be started.
- *
- * @return <CODE>true</CODE> if the page was added, <CODE>false</CODE>
- * if not.
- * @throws DocumentException
- * when a document isn't open yet, or has been closed
- */
-
- public boolean newPage() throws DocumentException {
- if (!open || close) {
- return false;
- }
- DocListener listener;
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
- listener = (DocListener) iterator.next();
- listener.newPage();
- }
- return true;
- }
-
- /**
- * Changes the header of this document.
- *
- * @param header
- * the new header
- */
-
- public void setHeader(HeaderFooter header) {
- this.header = header;
- DocListener listener;
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
- listener = (DocListener) iterator.next();
- listener.setHeader(header);
- }
- }
-
- /**
- * Resets the header of this document.
- */
-
- public void resetHeader() {
- this.header = null;
- DocListener listener;
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
- listener = (DocListener) iterator.next();
- listener.resetHeader();
- }
- }
-
- /**
- * Changes the footer of this document.
- *
- * @param footer
- * the new footer
- */
-
- public void setFooter(HeaderFooter footer) {
- this.footer = footer;
- DocListener listener;
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
- listener = (DocListener) iterator.next();
- listener.setFooter(footer);
- }
- }
-
- /**
- * Resets the footer of this document.
- */
-
- public void resetFooter() {
- this.footer = null;
- DocListener listener;
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
- listener = (DocListener) iterator.next();
- listener.resetFooter();
- }
- }
-
- /**
- * Sets the page number to 0.
- */
-
- public void resetPageCount() {
- pageN = 0;
- DocListener listener;
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
- listener = (DocListener) iterator.next();
- listener.resetPageCount();
- }
- }
-
- /**
- * Sets the page number.
- *
- * @param pageN
- * the new page number
- */
-
- public void setPageCount(int pageN) {
- this.pageN = pageN;
- DocListener listener;
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
- listener = (DocListener) iterator.next();
- listener.setPageCount(pageN);
- }
- }
-
- /**
- * Returns the current page number.
- *
- * @return the current page number
- */
-
- public int getPageNumber() {
- return this.pageN;
- }
-
- /**
- * Closes the document.
- * <P>
- * Once all the content has been written in the body, you have to close the
- * body. After that nothing can be written to the body anymore.
- */
-
- public void close() {
- if (!close) {
- open = false;
- close = true;
- }
- DocListener listener;
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
- listener = (DocListener) iterator.next();
- listener.close();
- }
- }
-
- // methods concerning the header or some meta information
-
- /**
- * Adds a user defined header to the document.
- *
- * @param name
- * the name of the header
- * @param content
- * the content of the header
- * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
- */
-
- public boolean addHeader(String name, String content) {
- try {
- return add(new Header(name, content));
- } catch (DocumentException de) {
- throw new ExceptionConverter(de);
- }
- }
-
- /**
- * Adds the title to a Document.
- *
- * @param title
- * the title
- * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
- */
-
- public boolean addTitle(String title) {
- try {
- return add(new Meta(Element.TITLE, title));
- } catch (DocumentException de) {
- throw new ExceptionConverter(de);
- }
- }
-
- /**
- * Adds the subject to a Document.
- *
- * @param subject
- * the subject
- * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
- */
-
- public boolean addSubject(String subject) {
- try {
- return add(new Meta(Element.SUBJECT, subject));
- } catch (DocumentException de) {
- throw new ExceptionConverter(de);
- }
- }
-
- /**
- * Adds the keywords to a Document.
- *
- * @param keywords
- * adds the keywords to the document
- * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
- */
-
- public boolean addKeywords(String keywords) {
- try {
- return add(new Meta(Element.KEYWORDS, keywords));
- } catch (DocumentException de) {
- throw new ExceptionConverter(de);
- }
- }
-
- /**
- * Adds the author to a Document.
- *
- * @param author
- * the name of the author
- * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
- */
-
- public boolean addAuthor(String author) {
- try {
- return add(new Meta(Element.AUTHOR, author));
- } catch (DocumentException de) {
- throw new ExceptionConverter(de);
- }
- }
-
- /**
- * Adds the creator to a Document.
- *
- * @param creator
- * the name of the creator
- * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
- */
-
- public boolean addCreator(String creator) {
- try {
- return add(new Meta(Element.CREATOR, creator));
- } catch (DocumentException de) {
- throw new ExceptionConverter(de);
- }
- }
-
- /**
- * Adds the producer to a Document.
- *
- * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
- */
-
- public boolean addProducer() {
- try {
- return add(new Meta(Element.PRODUCER, "iText by lowagie.com"));
- } catch (DocumentException de) {
- throw new ExceptionConverter(de);
- }
- }
-
- /**
- * Adds the current date and time to a Document.
- *
- * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
- */
-
- public boolean addCreationDate() {
- try {
- /* bugfix by 'taqua' (Thomas) */
- final SimpleDateFormat sdf = new SimpleDateFormat(
- "EEE MMM dd HH:mm:ss zzz yyyy");
- return add(new Meta(Element.CREATIONDATE, sdf.format(new Date())));
- } catch (DocumentException de) {
- throw new ExceptionConverter(de);
- }
- }
-
- // methods to get the layout of the document.
-
- /**
- * Returns the left margin.
- *
- * @return the left margin
- */
-
- public float leftMargin() {
- return marginLeft;
- }
-
- /**
- * Return the right margin.
- *
- * @return the right margin
- */
-
- public float rightMargin() {
- return marginRight;
- }
-
- /**
- * Returns the top margin.
- *
- * @return the top margin
- */
-
- public float topMargin() {
- return marginTop;
- }
-
- /**
- * Returns the bottom margin.
- *
- * @return the bottom margin
- */
-
- public float bottomMargin() {
- return marginBottom;
- }
-
- /**
- * Returns the lower left x-coordinate.
- *
- * @return the lower left x-coordinate
- */
-
- public float left() {
- return pageSize.left(marginLeft);
- }
-
- /**
- * Returns the upper right x-coordinate.
- *
- * @return the upper right x-coordinate
- */
-
- public float right() {
- return pageSize.right(marginRight);
- }
-
- /**
- * Returns the upper right y-coordinate.
- *
- * @return the upper right y-coordinate
- */
-
- public float top() {
- return pageSize.top(marginTop);
- }
-
- /**
- * Returns the lower left y-coordinate.
- *
- * @return the lower left y-coordinate
- */
-
- public float bottom() {
- return pageSize.bottom(marginBottom);
- }
-
- /**
- * Returns the lower left x-coordinate considering a given margin.
- *
- * @param margin
- * a margin
- * @return the lower left x-coordinate
- */
-
- public float left(float margin) {
- return pageSize.left(marginLeft + margin);
- }
-
- /**
- * Returns the upper right x-coordinate, considering a given margin.
- *
- * @param margin
- * a margin
- * @return the upper right x-coordinate
- */
-
- public float right(float margin) {
- return pageSize.right(marginRight + margin);
- }
-
- /**
- * Returns the upper right y-coordinate, considering a given margin.
- *
- * @param margin
- * a margin
- * @return the upper right y-coordinate
- */
-
- public float top(float margin) {
- return pageSize.top(marginTop + margin);
- }
-
- /**
- * Returns the lower left y-coordinate, considering a given margin.
- *
- * @param margin
- * a margin
- * @return the lower left y-coordinate
- */
-
- public float bottom(float margin) {
- return pageSize.bottom(marginBottom + margin);
- }
-
- /**
- * Gets the pagesize.
- *
- * @return the page size
- */
-
- public Rectangle getPageSize() {
- return this.pageSize;
- }
-
- /**
- * Checks if the document is open.
- *
- * @return <CODE>true</CODE> if the document is open
- */
- public boolean isOpen() {
- return open;
- }
-
- /**
- * Gets the iText version.
- *
- * @return iText version
- */
- public static String getVersion() {
- return ITEXT_VERSION;
- }
-
- /**
- * Adds a JavaScript onLoad function to the HTML body tag
- *
- * @param code
- * the JavaScript code to be executed on load of the HTML page
- */
-
- public void setJavaScript_onLoad(String code) {
- this.javaScript_onLoad = code;
- }
-
- /**
- * Gets the JavaScript onLoad command.
- *
- * @return the JavaScript onLoad command
- */
-
- public String getJavaScript_onLoad() {
- return this.javaScript_onLoad;
- }
-
- /**
- * Adds a JavaScript onUnLoad function to the HTML body tag
- *
- * @param code
- * the JavaScript code to be executed on unload of the HTML page
- */
-
- public void setJavaScript_onUnLoad(String code) {
- this.javaScript_onUnLoad = code;
- }
-
- /**
- * Gets the JavaScript onUnLoad command.
- *
- * @return the JavaScript onUnLoad command
- */
-
- public String getJavaScript_onUnLoad() {
- return this.javaScript_onUnLoad;
- }
-
- /**
- * Adds a style class to the HTML body tag
- *
- * @param htmlStyleClass
- * the style class for the HTML body tag
- */
-
- public void setHtmlStyleClass(String htmlStyleClass) {
- this.htmlStyleClass = htmlStyleClass;
- }
-
- /**
- * Gets the style class of the HTML body tag
- *
- * @return the style class of the HTML body tag
- */
-
- public String getHtmlStyleClass() {
- return this.htmlStyleClass;
- }
-
- /**
- * @see com.lowagie.text.DocListener#clearTextWrap()
- */
- public void clearTextWrap() throws DocumentException {
- if (open && !close) {
- DocListener listener;
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
- listener = (DocListener) iterator.next();
- listener.clearTextWrap();
- }
- }
- }
-
- /**
- * Set the margin mirroring. It will mirror margins for odd/even pages.
- * <p>
- * Note: it will not work with {@link Table}.
- *
- * @param marginMirroring
- * <CODE>true</CODE> to mirror the margins
- * @return always <CODE>true</CODE>
- */
- public boolean setMarginMirroring(boolean marginMirroring) {
- this.marginMirroring = marginMirroring;
- DocListener listener;
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
- listener = (DocListener) iterator.next();
- listener.setMarginMirroring(marginMirroring);
- }
- return true;
- }
-
- /**
- * Gets the margin mirroring flag.
- *
- * @return the margin mirroring flag
- */
- public boolean isMarginMirroring() {
- return marginMirroring;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/DocumentException.java b/LibrarySource/com/lowagie/text/DocumentException.java
deleted file mode 100644
index 00e098e..0000000
--- a/LibrarySource/com/lowagie/text/DocumentException.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * $Id: DocumentException.java,v 1.50 2004/12/14 11:52:46 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- *
- */
-
-package com.lowagie.text;
-
-/**
- * Signals that an error has occurred in a <CODE>Document</CODE>.
- *
- * @see BadElementException
- * @see Document
- * @see DocWriter
- * @see DocListener
- */
-
-public class DocumentException extends Exception {
- private Exception ex;
-
- /**
- * Creates a Document exception.
- * @param ex an exception that has to be turned into a DocumentException
- */
- public DocumentException(Exception ex) {
- this.ex = ex;
- }
-
- // constructors
-
-/**
- * Constructs a <CODE>DocumentException</CODE> whithout a message.
- */
-
- public DocumentException() {
- super();
- }
-
-/**
- * Constructs a <code>DocumentException</code> with a message.
- *
- * @param message a message describing the exception
- */
-
- public DocumentException(String message) {
- super(message);
- }
-
- /**
- * We print the message of the checked exception
- * @return the error message
- */
- public String getMessage() {
- if (ex == null)
- return super.getMessage();
- else
- return ex.getMessage();
- }
-
- /**
- * and make sure we also produce a localized version
- * @return a localized message
- */
- public String getLocalizedMessage() {
- if (ex == null)
- return super.getLocalizedMessage();
- else
- return ex.getLocalizedMessage();
- }
-
- /**
- * The toString() is changed to be prefixed with ExceptionConverter
- * @return the String version of the exception
- */
- public String toString() {
- if (ex == null)
- return super.toString();
- else
- return split(getClass().getName()) + ": " + ex;
- }
-
- /** we have to override this as well */
- public void printStackTrace() {
- printStackTrace(System.err);
- }
-
- /**
- * here we prefix, with s.print(), not s.println(), the stack
- * trace with "ExceptionConverter:"
- * @param s a printstream object
- */
- public void printStackTrace(java.io.PrintStream s) {
- if (ex == null)
- super.printStackTrace(s);
- else {
- synchronized (s) {
- s.print(split(getClass().getName()) + ": ");
- ex.printStackTrace(s);
- }
- }
- }
-
- /**
- * Again, we prefix the stack trace with "ExceptionConverter:"
- * @param s A PrintWriter object
- */
- public void printStackTrace(java.io.PrintWriter s) {
- if (ex == null)
- super.printStackTrace(s);
- else {
- synchronized (s) {
- s.print(split(getClass().getName()) + ": ");
- ex.printStackTrace(s);
- }
- }
- }
-
- /**
- * Removes everything in a String that comes before a '.'
- * @param s the original string
- * @return the part that comes after the dot
- */
- private static String split(String s) {
- int i = s.lastIndexOf('.');
- if (i < 0)
- return s;
- else
- return s.substring(i + 1);
- }
-
- /** requests to fill in the stack trace we will have to ignore.
- * We can't throw an exception here, because this method
- * is called by the constructor of Throwable */
-// public Throwable fillInStackTrace() {
-// if (ex == null)
-// return super.fillInStackTrace();
-// else
-// return this;
-// }
-
-}
diff --git a/LibrarySource/com/lowagie/text/Element.java b/LibrarySource/com/lowagie/text/Element.java
deleted file mode 100644
index a5a448f..0000000
--- a/LibrarySource/com/lowagie/text/Element.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * $Id: Element.java,v 1.31 2002/06/20 13:30:24 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.util.ArrayList;
-
-/**
- * Interface for a text element.
- * <P>
- * Remark: I looked at the interface javax.swing.text.Element, but
- * I decided to write my own text-classes for two reasons:
- * <OL>
- * <LI>The javax.swing.text-classes may be very generic, I think
- * they are overkill: they are to heavy for what they have to do.
- * <LI>A lot of people using iText (formerly known as rugPdf), still use JDK1.1.x.
- * I try to keep the Java2 requirements limited to the Collection classes
- * (I think they're really great). However, if I use the javax.swing.text
- * classes, it will become very difficult to downgrade rugPdf.
- * </OL>
- *
- * @see Anchor
- * @see Cell
- * @see Chapter
- * @see Chunk
- * @see Graphic
- * @see Header
- * @see Image
- * @see Jpeg
- * @see List
- * @see ListItem
- * @see Meta
- * @see Paragraph
- * @see Phrase
- * @see Rectangle
- * @see Row
- * @see Section
- * @see Table
- */
-
-public interface Element {
-
- // static membervariables (meta information)
-
-/** This is a possible type of <CODE>Element</CODE>. */
- public static final int HEADER = 0;
-
-/** This is a possible type of <CODE>Element</CODE>. */
- public static final int TITLE = 1;
-
-/** This is a possible type of <CODE>Element</CODE>. */
- public static final int SUBJECT = 2;
-
-/** This is a possible type of <CODE>Element</CODE>. */
- public static final int KEYWORDS = 3;
-
-/** This is a possible type of <CODE>Element</CIDE>. */
- public static final int AUTHOR = 4;
-
-/** This is a possible type of <CODE>Element</CIDE>. */
- public static final int PRODUCER = 5;
-
-/** This is a possible type of <CODE>Element</CIDE>. */
- public static final int CREATIONDATE = 6;
-
-/** This is a possible type of <CODE>Element</CIDE>. */
- public static final int CREATOR = 7;
-
- // static membervariables (content)
-
-/** This is a possible type of <CODE>Element</CODE>. */
- public static final int CHUNK = 10;
-
-/** This is a possible type of <CODE>Element</CODE>. */
- public static final int PHRASE = 11;
-
-/** This is a possible type of <CODE>Element</CODE>. */
- public static final int PARAGRAPH = 12;
-
-/** This is a possible type of <CODE>Element</CODE> */
- public static final int SECTION = 13;
-
-/** This is a possible type of <CODE>Element</CODE> */
- public static final int LIST = 14;
-
-/** This is a possible type of <CODE>Element</CODE> */
- public static final int LISTITEM = 15;
-
-/** This is a possible type of <CODE>Element</CODE> */
- public static final int CHAPTER = 16;
-
-/** This is a possible type of <CODE>Element</CODE> */
- public static final int ANCHOR = 17;
-
- // static membervariables (tables)
-
-/** This is a possible type of <CODE>Element</CODE>. */
- public static final int CELL = 20;
-
-/** This is a possible type of <CODE>Element</CODE>. */
- public static final int ROW = 21;
-
-/** This is a possible type of <CODE>Element</CODE>. */
- public static final int TABLE = 22;
-
-/** This is a possible type of <CODE>Element</CODE>. */
- public static final int PTABLE = 23;
-
- // static membervariables (annotations)
-
-/** This is a possible type of <CODE>Element</CODE>. */
- public static final int ANNOTATION = 29;
-
- // static membervariables (geometric figures)
-
-/** This is a possible type of <CODE>Element</CODE>. */
- public static final int RECTANGLE = 30;
-
-/** This is a possible type of <CODE>Element</CODE>. */
- public static final int JPEG = 32;
-
-/** This is a possible type of <CODE>Element</CODE>. */
- public static final int IMGRAW = 34;
-
-/** This is a possible type of <CODE>Element</CODE>. */
- public static final int IMGTEMPLATE = 35;
-
-/** This is a possible type of <CODE>Element</CODE>. */
- public static final int GRAPHIC = 39;
-
- /** This is a possible type of <CODE>Element</CODE>. */
- public static final int MULTI_COLUMN_TEXT = 40;
-
- // static membervariables (alignment)
-
-/**
- * A possible value for paragraph alignment. This
- * specifies that the text is aligned to the left
- * indent and extra whitespace should be placed on
- * the right.
- */
- public static final int ALIGN_UNDEFINED = -1;
-
-/**
- * A possible value for paragraph alignment. This
- * specifies that the text is aligned to the left
- * indent and extra whitespace should be placed on
- * the right.
- */
- public static final int ALIGN_LEFT = 0;
-
-/**
- * A possible value for paragraph alignment. This
- * specifies that the text is aligned to the center
- * and extra whitespace should be placed equally on
- * the left and right.
- */
- public static final int ALIGN_CENTER = 1;
-
-/**
- * A possible value for paragraph alignment. This
- * specifies that the text is aligned to the right
- * indent and extra whitespace should be placed on
- * the left.
- */
- public static final int ALIGN_RIGHT = 2;
-
-/**
- * A possible value for paragraph alignment. This
- * specifies that extra whitespace should be spread
- * out through the rows of the paragraph with the
- * text lined up with the left and right indent
- * except on the last line which should be aligned
- * to the left.
- */
- public static final int ALIGN_JUSTIFIED = 3;
-
-/**
- * A possible value for vertical alignment.
- */
-
- public static final int ALIGN_TOP = 4;
-
-/**
- * A possible value for vertical alignment.
- */
-
- public static final int ALIGN_MIDDLE = 5;
-
-/**
- * A possible value for vertical alignment.
- */
-
- public static final int ALIGN_BOTTOM = 6;
-
-/**
- * A possible value for vertical alignment.
- */
- public static final int ALIGN_BASELINE = 7;
-
-/**
- * Does the same as ALIGN_JUSTIFIED but the last line is also spread out.
- */
- public static final int ALIGN_JUSTIFIED_ALL = 8;
-
- // static member variables for CCITT compression
-
- /** Pure two-dimensional encoding (Group 4)
- */
- public static final int CCITTG4 = 0x100;
- /** Pure one-dimensional encoding (Group 3, 1-D)
- */
- public static final int CCITTG3_1D = 0x101;
- /** Mixed one- and two-dimensional encoding (Group 3, 2-D)
- */
- public static final int CCITTG3_2D = 0x102;
- /** A flag indicating whether 1-bits are to be interpreted as black pixels
- * and 0-bits as white pixels,
- */
- public static final int CCITT_BLACKIS1 = 1;
- /** A flag indicating whether the filter expects extra 0-bits before each
- * encoded line so that the line begins on a byte boundary.
- */
- public static final int CCITT_ENCODEDBYTEALIGN = 2;
- /** A flag indicating whether end-of-line bit patterns are required to be
- * present in the encoding.
- */
- public static final int CCITT_ENDOFLINE = 4;
- /** A flag indicating whether the filter expects the encoded data to be
- * terminated by an end-of-block pattern, overriding the Rows
- * parameter. The use of this flag will set the key /EndOfBlock to false.
- */
- public static final int CCITT_ENDOFBLOCK = 8;
-
-
- // methods
-
-/**
- * Processes the element by adding it (or the different parts) to an
- * <CODE>ElementListener</CODE>.
- *
- * @param listener an <CODE>ElementListener</CODE>
- * @return <CODE>true</CODE> if the element was processed successfully
- */
-
- public boolean process(ElementListener listener);
-
-/**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type();
-
-/**
- * Gets all the chunks in this element.
- *
- * @return an <CODE>ArrayList</CODE>
- */
-
- public ArrayList getChunks();
-
-/**
- * Gets the content of the text element.
- *
- * @return a type
- */
-
- public String toString();
-}
-
diff --git a/LibrarySource/com/lowagie/text/ElementListener.java b/LibrarySource/com/lowagie/text/ElementListener.java
deleted file mode 100644
index 5e9a8cf..0000000
--- a/LibrarySource/com/lowagie/text/ElementListener.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * $Id: ElementListener.java,v 1.48 2004/12/14 11:52:46 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.util.EventListener;
-
-/**
- * A class that implements <CODE>ElementListener</CODE> will perform some
- * actions when an <CODE>Element</CODE> is added.
- *
- * @see DocListener
- */
-
-public interface ElementListener extends EventListener {
-
- // methods
-
-/**
- * Signals that an <CODE>Element</CODE> was added to the <CODE>Document</CODE>.
- *
- * @param element a high level object
- * @return <CODE>true</CODE> if the element was added, <CODE>false</CODE> if not.
- * @throws DocumentException when a document isn't open yet, or has been closed
- */
-
- public boolean add(Element element) throws DocumentException;
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/ElementTags.java b/LibrarySource/com/lowagie/text/ElementTags.java
deleted file mode 100644
index 8ecca0f..0000000
--- a/LibrarySource/com/lowagie/text/ElementTags.java
+++ /dev/null
@@ -1,461 +0,0 @@
-/*
- * $Id: ElementTags.java,v 1.84 2005/04/06 07:01:18 blowagie Exp $
- * $Name: $
- *
- * Copyright (c) 2001, 2002 Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-/**
- * A class that contains all the possible tagnames and their attributes.
- */
-
-public class ElementTags {
-
-/** the root tag. */
- public static final String ITEXT = "itext";
-
-/** attribute of the root and annotation tag (also a special tag within a chapter or section) */
- public static final String TITLE = "title";
-
-/** attribute of the root tag */
- public static final String SUBJECT = "subject";
-
-/** attribute of the root tag */
- public static final String KEYWORDS = "keywords";
-
-/** attribute of the root tag */
- public static final String AUTHOR = "author";
-
-/** attribute of the root tag */
- public static final String CREATIONDATE = "creationdate";
-
-/** attribute of the root tag */
- public static final String PRODUCER = "producer";
-
- // Chapters and Sections
-
-/** the chapter tag */
- public static final String CHAPTER = "chapter";
-
-/** the section tag */
- public static final String SECTION = "section";
-
-/** attribute of section/chapter tag */
- public static final String NUMBERDEPTH = "numberdepth";
-
-/** attribute of section/chapter tag */
- public static final String DEPTH = "depth";
-
-/** attribute of section/chapter tag */
- public static final String NUMBER = "number";
-
-/** attribute of section/chapter tag */
- public static final String INDENT = "indent";
-
-/** attribute of chapter/section/paragraph/table/cell tag */
- public static final String LEFT = "left";
-
-/** attribute of chapter/section/paragraph/table/cell tag */
- public static final String RIGHT = "right";
-
- // Phrases, Anchors, Lists and Paragraphs
-
-/** the phrase tag */
- public static final String PHRASE = "phrase";
-
-/** the anchor tag */
- public static final String ANCHOR = "anchor";
-
-/** the list tag */
- public static final String LIST = "list";
-
-/** the listitem tag */
- public static final String LISTITEM = "listitem";
-
-/** the paragraph tag */
- public static final String PARAGRAPH = "paragraph";
-
-/** attribute of phrase/paragraph/cell tag */
- public static final String LEADING = "leading";
-
-/** attribute of paragraph/image/table tag */
- public static final String ALIGN = "align";
-
-/** attribute of paragraph */
- public static final String KEEPTOGETHER = "keeptogether";
-
-/** attribute of anchor tag */
- public static final String NAME = "name";
-
-/** attribute of anchor tag */
- public static final String REFERENCE = "reference";
-
-/** attribute of list tag */
- public static final String LISTSYMBOL = "listsymbol";
-
-/** attribute of list tag */
- public static final String NUMBERED = "numbered";
-
-/** attribute of the list tag */
- public static final String LETTERED = "lettered";
-
-/** attribute of list tag */
- public static final String FIRST = "first";
-
-/** attribute of list tag */
- public static final String SYMBOLINDENT = "symbolindent";
-
-/** attribute of list tag */
- public static final String INDENTATIONLEFT = "indentationleft";
-
-/** attribute of list tag */
- public static final String INDENTATIONRIGHT = "indentationright";
-
- // Chunks
-
-/** the chunk tag */
- public static final String IGNORE = "ignore";
-
-/** the chunk tag */
- public static final String ENTITY = "entity";
-
-/** the chunk tag */
- public static final String ID = "id";
-
-/** the chunk tag */
- public static final String CHUNK = "chunk";
-
-/** attribute of the chunk tag */
- public static final String ENCODING = "encoding";
-
-/** attribute of the chunk tag */
- public static final String EMBEDDED = "embedded";
-
-/** attribute of the chunk/table/cell tag */
- public static final String COLOR = "color";
-
-/** attribute of the chunk/table/cell tag */
- public static final String RED = "red";
-
-/** attribute of the chunk/table/cell tag */
- public static final String GREEN = "green";
-
-/** attribute of the chunk/table/cell tag */
- public static final String BLUE = "blue";
-
-/** attribute of the chunk tag */
- public static final String SUBSUPSCRIPT = Chunk.SUBSUPSCRIPT.toLowerCase();
-
-/** attribute of the chunk tag */
- public static final String LOCALGOTO = Chunk.LOCALGOTO.toLowerCase();
-
-/** attribute of the chunk tag */
- public static final String REMOTEGOTO = Chunk.REMOTEGOTO.toLowerCase();
-
-/** attribute of the chunk tag */
- public static final String LOCALDESTINATION = Chunk.LOCALDESTINATION.toLowerCase();
-
-/** attribute of the chunk tag */
- public static final String GENERICTAG = Chunk.GENERICTAG.toLowerCase();
-
- // tables/cells
-
-/** the table tag */
- public static final String TABLE = "table";
-
-/** the cell tag */
- public static final String ROW = "row";
-
-/** the cell tag */
- public static final String CELL = "cell";
-
-/** attribute of the table tag */
- public static final String COLUMNS = "columns";
-
-/** attribute of the table tag */
- public static final String LASTHEADERROW = "lastHeaderRow";
-
-/** attribute of the table tag */
- public static final String CELLPADDING = "cellpadding";
-
-/** attribute of the table tag */
- public static final String CELLSPACING = "cellspacing";
-
-/** attribute of the table tag */
- public static final String OFFSET = "offset";
-
-/** attribute of the table tag */
- public static final String WIDTHS = "widths";
-
-/** attribute of the table tag */
- public static final String TABLEFITSPAGE = "tablefitspage";
-
-/** attribute of the table tag */
- public static final String CELLSFITPAGE = "cellsfitpage";
-
-/** attribute of the cell tag */
- public static final String HORIZONTALALIGN = "horizontalalign";
-
-/** attribute of the cell tag */
- public static final String VERTICALALIGN = "verticalalign";
-
-/** attribute of the cell tag */
- public static final String COLSPAN = "colspan";
-
-/** attribute of the cell tag */
- public static final String ROWSPAN = "rowspan";
-
-/** attribute of the cell tag */
- public static final String HEADER = "header";
-
-/** attribute of the cell tag */
- public static final String NOWRAP = "nowrap";
-
-/** attribute of the table/cell tag */
- public static final String BORDERWIDTH = "borderwidth";
-
-/** attribute of the table/cell tag */
- public static final String TOP = "top";
-
-/** attribute of the table/cell tag */
- public static final String BOTTOM = "bottom";
-
-/** attribute of the table/cell tag */
- public static final String WIDTH = "width";
-
-/** attribute of the table/cell tag */
- public static final String BORDERCOLOR = "bordercolor";
-
-/** attribute of the table/cell tag */
- public static final String BACKGROUNDCOLOR = "backgroundcolor";
-
-/** attribute of the table/cell tag */
- public static final String BGRED = "bgred";
-
-/** attribute of the table/cell tag */
- public static final String BGGREEN = "bggreen";
-
-/** attribute of the table/cell tag */
- public static final String BGBLUE = "bgblue";
-
-/** attribute of the table/cell tag */
- public static final String GRAYFILL = "grayfill";
-
- // Misc
-
-/** the image tag */
- public static final String IMAGE = "image";
-
-/** attribute of the image and annotation tag */
- public static final String URL = "url";
-
-/** attribute of the image tag */
- public static final String UNDERLYING = "underlying";
-
-/** attribute of the image tag */
- public static final String TEXTWRAP = "textwrap";
-
-/** attribute of the image tag */
- public static final String ALT = "alt";
-
-/** attribute of the image tag */
- public static final String ABSOLUTEX = "absolutex";
-
-/** attribute of the image tag */
- public static final String ABSOLUTEY = "absolutey";
-
-/** attribute of the image tag */
- public static final String PLAINWIDTH = "plainwidth";
-
-/** attribute of the image tag */
- public static final String PLAINHEIGHT = "plainheight";
-
-/** attribute of the image tag */
- public static final String SCALEDWIDTH = "scaledwidth";
-
-/** attribute of the image tag */
- public static final String SCALEDHEIGHT = "scaledheight";
-
-/** attribute of the image tag */
- public static final String ROTATION = "rotation";
-
-/** the newpage tag */
- public static final String NEWPAGE = "newpage";
-
-/** the newpage tag */
- public static final String NEWLINE = "newline";
-
-/** the annotation tag */
- public static final String ANNOTATION = "annotation";
-
-/** attribute of the annotation tag */
- public static String FILE = "file";
-
-/** attribute of the annotation tag */
- public static String DESTINATION = "destination";
-
-/** attribute of the annotation tag */
- public static String PAGE = "page";
-
-/** attribute of the annotation tag */
- public static String NAMED = "named";
-
-/** attribute of the annotation tag */
- public static String APPLICATION = "application";
-
-/** attribute of the annotation tag */
- public static String PARAMETERS = "parameters";
-
-/** attribute of the annotation tag */
- public static String OPERATION = "operation";
-
-/** attribute of the annotation tag */
- public static String DEFAULTDIR = "defaultdir";
-
-/** attribute of the annotation tag */
- public static String LLX = "llx";
-
-/** attribute of the annotation tag */
- public static String LLY = "lly";
-
-/** attribute of the annotation tag */
- public static String URX = "urx";
-
-/** attribute of the annotation tag */
- public static String URY = "ury";
-
-/** attribute of the annotation tag */
- public static final String CONTENT = "content";
-
- // alignment attribute values
-
-/** the possible value of an alignment attribute */
- public static final String ALIGN_LEFT = "Left";
-
-/** the possible value of an alignment attribute */
- public static final String ALIGN_CENTER = "Center";
-
-/** the possible value of an alignment attribute */
- public static final String ALIGN_RIGHT = "Right";
-
-/** the possible value of an alignment attribute */
- public static final String ALIGN_JUSTIFIED = "Justify";
-
-/** the possible value of an alignment attribute */
- public static final String ALIGN_JUSTIFIED_ALL = "JustifyAll";
-
-/** the possible value of an alignment attribute */
- public static final String ALIGN_TOP = "Top";
-
-/** the possible value of an alignment attribute */
- public static final String ALIGN_MIDDLE = "Middle";
-
-/** the possible value of an alignment attribute */
- public static final String ALIGN_BOTTOM = "Bottom";
-
-/** the possible value of an alignment attribute */
- public static final String ALIGN_BASELINE = "Baseline";
-
-/** the possible value of an alignment attribute */
- public static final String DEFAULT = "Default";
-
-/** the possible value of an alignment attribute */
- public static final String UNKNOWN = "unknown";
-
-/** the possible value of an alignment attribute */
- public static final String FONT = "font";
-
-/** the possible value of an alignment attribute */
- public static final String SIZE = "size";
-
-/** the possible value of an alignment attribute */
- public static final String STYLE = "fontstyle";
-
-/** the possible value of a tag */
- public static final String HORIZONTALRULE = "horizontalrule";
-
- /** the possible value of a tag */
- public static final String PAGE_SIZE = "pagesize";
-
- /** the possible value of a tag */
- public static final String ORIENTATION = "orientation";
-
- // methods
-
-/**
- * Translates the alignment value.
- *
- * @param alignment the alignment value
- * @return the translated value
- */
-
- public static String getAlignment(int alignment) {
- switch(alignment) {
- case Element.ALIGN_LEFT:
- return ALIGN_LEFT;
- case Element.ALIGN_CENTER:
- return ALIGN_CENTER;
- case Element.ALIGN_RIGHT:
- return ALIGN_RIGHT;
- case Element.ALIGN_JUSTIFIED:
- case Element.ALIGN_JUSTIFIED_ALL:
- return ALIGN_JUSTIFIED;
- case Element.ALIGN_TOP:
- return ALIGN_TOP;
- case Element.ALIGN_MIDDLE:
- return ALIGN_MIDDLE;
- case Element.ALIGN_BOTTOM:
- return ALIGN_BOTTOM;
- case Element.ALIGN_BASELINE:
- return ALIGN_BASELINE;
- default:
- return DEFAULT;
- }
- }
-
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/Entities.java b/LibrarySource/com/lowagie/text/Entities.java
deleted file mode 100644
index 1f1b596..0000000
--- a/LibrarySource/com/lowagie/text/Entities.java
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * $Id: Entities.java,v 1.43 2004/12/14 11:52:46 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.util.HashMap;
-
-/**
- * This class contains entities that can be used in an entity tag.
- */
-
-public class Entities {
-
- /** This is a map that contains all possible id values of the entity tag. */
- public static final HashMap map;
-
- static {
- map = new HashMap();
- map.put("169", new Integer(227));
- map.put("172", new Integer(216));
- map.put("174", new Integer(210));
- map.put("177", new Integer(177));
- map.put("215", new Integer(180));
- map.put("247", new Integer(184));
- map.put("8230", new Integer(188));
- map.put("8242", new Integer(162));
- map.put("8243", new Integer(178));
- map.put("8260", new Integer(164));
- map.put("8364", new Integer(240));
- map.put("8465", new Integer(193));
- map.put("8472", new Integer(195));
- map.put("8476", new Integer(194));
- map.put("8482", new Integer(212));
- map.put("8501", new Integer(192));
- map.put("8592", new Integer(172));
- map.put("8593", new Integer(173));
- map.put("8594", new Integer(174));
- map.put("8595", new Integer(175));
- map.put("8596", new Integer(171));
- map.put("8629", new Integer(191));
- map.put("8656", new Integer(220));
- map.put("8657", new Integer(221));
- map.put("8658", new Integer(222));
- map.put("8659", new Integer(223));
- map.put("8660", new Integer(219));
- map.put("8704", new Integer(34));
- map.put("8706", new Integer(182));
- map.put("8707", new Integer(36));
- map.put("8709", new Integer(198));
- map.put("8711", new Integer(209));
- map.put("8712", new Integer(206));
- map.put("8713", new Integer(207));
- map.put("8717", new Integer(39));
- map.put("8719", new Integer(213));
- map.put("8721", new Integer(229));
- map.put("8722", new Integer(45));
- map.put("8727", new Integer(42));
- map.put("8729", new Integer(183));
- map.put("8730", new Integer(214));
- map.put("8733", new Integer(181));
- map.put("8734", new Integer(165));
- map.put("8736", new Integer(208));
- map.put("8743", new Integer(217));
- map.put("8744", new Integer(218));
- map.put("8745", new Integer(199));
- map.put("8746", new Integer(200));
- map.put("8747", new Integer(242));
- map.put("8756", new Integer(92));
- map.put("8764", new Integer(126));
- map.put("8773", new Integer(64));
- map.put("8776", new Integer(187));
- map.put("8800", new Integer(185));
- map.put("8801", new Integer(186));
- map.put("8804", new Integer(163));
- map.put("8805", new Integer(179));
- map.put("8834", new Integer(204));
- map.put("8835", new Integer(201));
- map.put("8836", new Integer(203));
- map.put("8838", new Integer(205));
- map.put("8839", new Integer(202));
- map.put("8853", new Integer(197));
- map.put("8855", new Integer(196));
- map.put("8869", new Integer(94));
- map.put("8901", new Integer(215));
- map.put("8992", new Integer(243));
- map.put("8993", new Integer(245));
- map.put("9001", new Integer(225));
- map.put("9002", new Integer(241));
- map.put("913", new Integer(65));
- map.put("914", new Integer(66));
- map.put("915", new Integer(71));
- map.put("916", new Integer(68));
- map.put("917", new Integer(69));
- map.put("918", new Integer(90));
- map.put("919", new Integer(72));
- map.put("920", new Integer(81));
- map.put("921", new Integer(73));
- map.put("922", new Integer(75));
- map.put("923", new Integer(76));
- map.put("924", new Integer(77));
- map.put("925", new Integer(78));
- map.put("926", new Integer(88));
- map.put("927", new Integer(79));
- map.put("928", new Integer(80));
- map.put("929", new Integer(82));
- map.put("931", new Integer(83));
- map.put("932", new Integer(84));
- map.put("933", new Integer(85));
- map.put("934", new Integer(70));
- map.put("935", new Integer(67));
- map.put("936", new Integer(89));
- map.put("937", new Integer(87));
- map.put("945", new Integer(97));
- map.put("946", new Integer(98));
- map.put("947", new Integer(103));
- map.put("948", new Integer(100));
- map.put("949", new Integer(101));
- map.put("950", new Integer(122));
- map.put("951", new Integer(104));
- map.put("952", new Integer(113));
- map.put("953", new Integer(105));
- map.put("954", new Integer(107));
- map.put("955", new Integer(108));
- map.put("956", new Integer(109));
- map.put("957", new Integer(110));
- map.put("958", new Integer(120));
- map.put("959", new Integer(111));
- map.put("960", new Integer(112));
- map.put("961", new Integer(114));
- map.put("962", new Integer(86));
- map.put("963", new Integer(115));
- map.put("964", new Integer(116));
- map.put("965", new Integer(117));
- map.put("966", new Integer(102));
- map.put("967", new Integer(99));
- map.put("9674", new Integer(224));
- map.put("968", new Integer(121));
- map.put("969", new Integer(119));
- map.put("977", new Integer(74));
- map.put("978", new Integer(161));
- map.put("981", new Integer(106));
- map.put("982", new Integer(118));
- map.put("9824", new Integer(170));
- map.put("9827", new Integer(167));
- map.put("9829", new Integer(169));
- map.put("9830", new Integer(168));
- map.put("Alpha", new Integer(65));
- map.put("Beta", new Integer(66));
- map.put("Chi", new Integer(67));
- map.put("Delta", new Integer(68));
- map.put("Epsilon", new Integer(69));
- map.put("Eta", new Integer(72));
- map.put("Gamma", new Integer(71));
- map.put("Iota", new Integer(73));
- map.put("Kappa", new Integer(75));
- map.put("Lambda", new Integer(76));
- map.put("Mu", new Integer(77));
- map.put("Nu", new Integer(78));
- map.put("Omega", new Integer(87));
- map.put("Omicron", new Integer(79));
- map.put("Phi", new Integer(70));
- map.put("Pi", new Integer(80));
- map.put("Prime", new Integer(178));
- map.put("Psi", new Integer(89));
- map.put("Rho", new Integer(82));
- map.put("Sigma", new Integer(83));
- map.put("Tau", new Integer(84));
- map.put("Theta", new Integer(81));
- map.put("Upsilon", new Integer(85));
- map.put("Xi", new Integer(88));
- map.put("Zeta", new Integer(90));
- map.put("alefsym", new Integer(192));
- map.put("alpha", new Integer(97));
- map.put("and", new Integer(217));
- map.put("ang", new Integer(208));
- map.put("asymp", new Integer(187));
- map.put("beta", new Integer(98));
- map.put("cap", new Integer(199));
- map.put("chi", new Integer(99));
- map.put("clubs", new Integer(167));
- map.put("cong", new Integer(64));
- map.put("copy", new Integer(211));
- map.put("crarr", new Integer(191));
- map.put("cup", new Integer(200));
- map.put("dArr", new Integer(223));
- map.put("darr", new Integer(175));
- map.put("delta", new Integer(100));
- map.put("diams", new Integer(168));
- map.put("divide", new Integer(184));
- map.put("empty", new Integer(198));
- map.put("epsilon", new Integer(101));
- map.put("equiv", new Integer(186));
- map.put("eta", new Integer(104));
- map.put("euro", new Integer(240));
- map.put("exist", new Integer(36));
- map.put("forall", new Integer(34));
- map.put("frasl", new Integer(164));
- map.put("gamma", new Integer(103));
- map.put("ge", new Integer(179));
- map.put("hArr", new Integer(219));
- map.put("harr", new Integer(171));
- map.put("hearts", new Integer(169));
- map.put("hellip", new Integer(188));
- map.put("horizontal arrow extender", new Integer(190));
- map.put("image", new Integer(193));
- map.put("infin", new Integer(165));
- map.put("int", new Integer(242));
- map.put("iota", new Integer(105));
- map.put("isin", new Integer(206));
- map.put("kappa", new Integer(107));
- map.put("lArr", new Integer(220));
- map.put("lambda", new Integer(108));
- map.put("lang", new Integer(225));
- map.put("large brace extender", new Integer(239));
- map.put("large integral extender", new Integer(244));
- map.put("large left brace (bottom)", new Integer(238));
- map.put("large left brace (middle)", new Integer(237));
- map.put("large left brace (top)", new Integer(236));
- map.put("large left bracket (bottom)", new Integer(235));
- map.put("large left bracket (extender)", new Integer(234));
- map.put("large left bracket (top)", new Integer(233));
- map.put("large left parenthesis (bottom)", new Integer(232));
- map.put("large left parenthesis (extender)", new Integer(231));
- map.put("large left parenthesis (top)", new Integer(230));
- map.put("large right brace (bottom)", new Integer(254));
- map.put("large right brace (middle)", new Integer(253));
- map.put("large right brace (top)", new Integer(252));
- map.put("large right bracket (bottom)", new Integer(251));
- map.put("large right bracket (extender)", new Integer(250));
- map.put("large right bracket (top)", new Integer(249));
- map.put("large right parenthesis (bottom)", new Integer(248));
- map.put("large right parenthesis (extender)", new Integer(247));
- map.put("large right parenthesis (top)", new Integer(246));
- map.put("larr", new Integer(172));
- map.put("le", new Integer(163));
- map.put("lowast", new Integer(42));
- map.put("loz", new Integer(224));
- map.put("minus", new Integer(45));
- map.put("mu", new Integer(109));
- map.put("nabla", new Integer(209));
- map.put("ne", new Integer(185));
- map.put("not", new Integer(216));
- map.put("notin", new Integer(207));
- map.put("nsub", new Integer(203));
- map.put("nu", new Integer(110));
- map.put("omega", new Integer(119));
- map.put("omicron", new Integer(111));
- map.put("oplus", new Integer(197));
- map.put("or", new Integer(218));
- map.put("otimes", new Integer(196));
- map.put("part", new Integer(182));
- map.put("perp", new Integer(94));
- map.put("phi", new Integer(102));
- map.put("pi", new Integer(112));
- map.put("piv", new Integer(118));
- map.put("plusmn", new Integer(177));
- map.put("prime", new Integer(162));
- map.put("prod", new Integer(213));
- map.put("prop", new Integer(181));
- map.put("psi", new Integer(121));
- map.put("rArr", new Integer(222));
- map.put("radic", new Integer(214));
- map.put("radical extender", new Integer(96));
- map.put("rang", new Integer(241));
- map.put("rarr", new Integer(174));
- map.put("real", new Integer(194));
- map.put("reg", new Integer(210));
- map.put("rho", new Integer(114));
- map.put("sdot", new Integer(215));
- map.put("sigma", new Integer(115));
- map.put("sigmaf", new Integer(86));
- map.put("sim", new Integer(126));
- map.put("spades", new Integer(170));
- map.put("sub", new Integer(204));
- map.put("sube", new Integer(205));
- map.put("sum", new Integer(229));
- map.put("sup", new Integer(201));
- map.put("supe", new Integer(202));
- map.put("tau", new Integer(116));
- map.put("there4", new Integer(92));
- map.put("theta", new Integer(113));
- map.put("thetasym", new Integer(74));
- map.put("times", new Integer(180));
- map.put("trade", new Integer(212));
- map.put("uArr", new Integer(221));
- map.put("uarr", new Integer(173));
- map.put("upsih", new Integer(161));
- map.put("upsilon", new Integer(117));
- map.put("vertical arrow extender", new Integer(189));
- map.put("weierp", new Integer(195));
- map.put("xi", new Integer(120));
- map.put("zeta", new Integer(122));
- }
-
- /**
- * Gets a chunk with a symbol character.
- * @param e a symbol value (see Entities class: alfa is greek alfa,...)
- * @param font the font if the symbol isn't found (otherwise Font.SYMBIL)
- * @return a Chunk
- */
-
- public static Chunk get(String e, Font font) {
- int s = getCorrespondingSymbol(e);
- if (s == -1) {
- try {
- return new Chunk(String.valueOf((char)Integer.parseInt(e)), font);
- }
- catch(Exception exception) {
- return new Chunk(e, font);
- }
- }
- Font symbol = new Font(Font.SYMBOL, font.size(), font.style(), font.color());
- return new Chunk(String.valueOf((char)s), symbol);
- }
-
-/**
- * Looks for the corresponding symbol in the font Symbol.
- *
- * @param c the original ASCII-char
- * @return the corresponding symbol in font Symbol
- */
-
- public static int getCorrespondingSymbol(String c) {
- Integer integer = (Integer) map.get(c);
- if (integer == null) {
- return -1;
- }
- return integer.intValue();
- }
-
-/**
- * Checks if a given tag corresponds with this object.
- *
- * @param tag the given tag
- * @return true if the tag corresponds
- */
-
- public static boolean isTag(String tag) {
- return ElementTags.ENTITY.equals(tag);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/ExceptionConverter.java b/LibrarySource/com/lowagie/text/ExceptionConverter.java
deleted file mode 100644
index 3715a47..0000000
--- a/LibrarySource/com/lowagie/text/ExceptionConverter.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text;
-
-/**
- * The ExceptionConverter changes a checked exception into an
- * unchecked exception.
- */
-public class ExceptionConverter extends RuntimeException {
- /** we keep a handle to the wrapped exception */
- private Exception ex;
- /** prefix for the exception */
- private String prefix;
-
- /**
- * Construct a RuntimeException based on another Exception
- * @param ex the exception that has to be turned into a RuntimeException
- */
- public ExceptionConverter(Exception ex) {
- this.ex = ex;
- prefix = (ex instanceof RuntimeException) ? "" : "ExceptionConverter: ";
- }
-
- /**
- * and allow the user of ExceptionConverter to get a handle to it.
- * @return the original exception
- */
- public Exception getException() {
- return ex;
- }
-
- /**
- * We print the message of the checked exception
- * @return message of the original exception
- */
- public String getMessage() {
- return ex.getMessage();
- }
-
- /**
- * and make sure we also produce a localized version
- * @return localized version of the message
- */
- public String getLocalizedMessage() {
- return ex.getLocalizedMessage();
- }
-
- /**
- * The toString() is changed to be prefixed with ExceptionConverter
- * @return Stringversion of the exception
- */
- public String toString() {
- return prefix + ex;
- }
-
- /** we have to override this as well */
- public void printStackTrace() {
- printStackTrace(System.err);
- }
-
- /**
- * here we prefix, with s.print(), not s.println(), the stack
- * trace with "ExceptionConverter:"
- * @param s
- */
- public void printStackTrace(java.io.PrintStream s) {
- synchronized (s) {
- s.print(prefix);
- ex.printStackTrace(s);
- }
- }
-
- /**
- * Again, we prefix the stack trace with "ExceptionConverter:"
- * @param s
- */
- public void printStackTrace(java.io.PrintWriter s) {
- synchronized (s) {
- s.print(prefix);
- ex.printStackTrace(s);
- }
- }
-
- /**
- * requests to fill in the stack trace we will have to ignore.
- * We can't throw an exception here, because this method
- * is called by the constructor of Throwable
- * @return a Throwable
- */
- public Throwable fillInStackTrace() {
- return this;
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/Font.java b/LibrarySource/com/lowagie/text/Font.java
deleted file mode 100644
index 07eb07b..0000000
--- a/LibrarySource/com/lowagie/text/Font.java
+++ /dev/null
@@ -1,752 +0,0 @@
-/*
- * $Id: Font.java,v 1.92 2005/05/03 13:03:51 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import headless.awt.Color;
-
-import com.lowagie.text.pdf.BaseFont;
-import com.lowagie.text.markup.MarkupTags;
-
-/**
- * Contains all the specifications of a font: fontfamily, size, style and color.
- * <P>
- * Example:
- * <BLOCKQUOTE><PRE>
- * Paragraph p = new Paragraph("This is a paragraph",
- * <STRONG>new Font(Font.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0, 255))</STRONG>);
- * </PRE></BLOCKQUOTE>
- */
-
-public class Font implements Comparable {
-
-// static membervariables for the different families
-
-/** a possible value of a font family. */
- public static final int COURIER = 0;
-
-/** a possible value of a font family. */
- public static final int HELVETICA = 1;
-
-/** a possible value of a font family. */
- public static final int TIMES_ROMAN = 2;
-
-/** a possible value of a font family. */
- public static final int SYMBOL = 3;
-
-/** a possible value of a font family. */
- public static final int ZAPFDINGBATS = 4;
-
-// static membervariables for the different styles
-
-/** this is a possible style. */
- public static final int NORMAL = 0;
-
-/** this is a possible style. */
- public static final int BOLD = 1;
-
-/** this is a possible style. */
- public static final int ITALIC = 2;
-
-/** this is a possible style. */
- public static final int UNDERLINE = 4;
-
-/** this is a possible style. */
- public static final int STRIKETHRU = 8;
-
-/** this is a possible style. */
- public static final int BOLDITALIC = BOLD | ITALIC;
-
-// static membervariables
-
-/** the value of an undefined attribute. */
- public static final int UNDEFINED = -1;
-
-/** the value of the default size. */
- public static final int DEFAULTSIZE = 12;
-
-// membervariables
-
-/** the value of the fontfamily. */
- private int family = UNDEFINED;
-
-/** the value of the fontsize. */
- private float size = UNDEFINED;
-
-/** the value of the style. */
- private int style = UNDEFINED;
-
-/** the value of the color. */
- private Color color = null;
-
-/** the external font */
- private BaseFont baseFont = null;
-
-// constructors
-
- /**
- * Copy constructor of a Font
- * @param other the font that has to be copied
- */
- public Font(Font other) {
- this.color = other.color;
- this.family = other.family;
- this.size = other.size;
- this.style = other.style;
- this.baseFont = other.baseFont;
- }
-
-/**
- * Constructs a Font.
- *
- * @param family the family to which this font belongs
- * @param size the size of this font
- * @param style the style of this font
- * @param color the <CODE>Color</CODE> of this font.
- */
-
- public Font(int family, float size, int style, Color color) {
- this.family = family;
- this.size = size;
- this.style = style;
- this.color = color;
- }
-
-/**
- * Constructs a Font.
- *
- * @param bf the external font
- * @param size the size of this font
- * @param style the style of this font
- * @param color the <CODE>Color</CODE> of this font.
- */
-
- public Font(BaseFont bf, float size, int style, Color color) {
- this.baseFont = bf;
- this.size = size;
- this.style = style;
- this.color = color;
- }
-
-/**
- * Constructs a Font.
- *
- * @param bf the external font
- * @param size the size of this font
- * @param style the style of this font
- */
- public Font(BaseFont bf, float size, int style) {
- this(bf, size, style, null);
- }
-
-/**
- * Constructs a Font.
- *
- * @param bf the external font
- * @param size the size of this font
- */
- public Font(BaseFont bf, float size) {
- this(bf, size, UNDEFINED, null);
- }
-
-/**
- * Constructs a Font.
- *
- * @param bf the external font
- */
- public Font(BaseFont bf) {
- this(bf, UNDEFINED, UNDEFINED, null);
- }
-
-/**
- * Constructs a Font.
- *
- * @param family the family to which this font belongs
- * @param size the size of this font
- * @param style the style of this font
- */
-
- public Font(int family, float size, int style) {
- this(family, size, style, null);
- }
-
-/**
- * Constructs a Font.
- *
- * @param family the family to which this font belongs
- * @param size the size of this font
- */
-
- public Font(int family, float size) {
- this(family, size, UNDEFINED, null);
- }
-
-/**
- * Constructs a Font.
- *
- * @param family the family to which this font belongs
- */
-
- public Font(int family) {
- this(family, UNDEFINED, UNDEFINED, null);
- }
-
-/**
- * Constructs a Font.
- */
-
- public Font() {
- this(UNDEFINED, UNDEFINED, UNDEFINED, null);
- }
-
- // implementation of the Comparable interface
-
-/**
- * Compares this <CODE>Font</CODE> with another
- *
- * @param object the other <CODE>Font</CODE>
- * @return a value
- */
-
- public int compareTo(Object object) {
- if (object == null) {
- return -1;
- }
- Font font;
- try {
- font = (Font) object;
- if (baseFont != null && !baseFont.equals(font.getBaseFont())) {
- return -2;
- }
- if (this.family != font.family()) {
- return 1;
- }
- if (this.size != font.size()) {
- return 2;
- }
- if (this.style != font.style()) {
- return 3;
- }
- if (this.color == null) {
- if (font.color == null) {
- return 0;
- }
- return 4;
- }
- if (font.color == null) {
- return 4;
- }
- if (this.color.equals(font.color())) {
- return 0;
- }
- return 4;
- }
- catch(ClassCastException cce) {
- return -3;
- }
- }
-
- // methods
-
-/**
- * Sets the family using a <CODE>String</CODE> ("Courier",
- * "Helvetica", "Times New Roman", "Symbol" or "ZapfDingbats").
- *
- * @param family A <CODE>String</CODE> representing a certain font-family.
- */
-
- public void setFamily(String family) {
- this.family = getFamilyIndex(family);
- }
-
-/**
- * Translates a <CODE>String</CODE>-value of a certain family
- * into the index that is used for this family in this class.
- *
- * @param family A <CODE>String</CODE> representing a certain font-family
- * @return the corresponding index
- */
-
- public static int getFamilyIndex(String family) {
- if (family.equalsIgnoreCase(FontFactory.COURIER)) {
- return COURIER;
- }
- if (family.equalsIgnoreCase(FontFactory.HELVETICA)) {
- return HELVETICA;
- }
- if (family.equalsIgnoreCase(FontFactory.TIMES_ROMAN)) {
- return TIMES_ROMAN;
- }
- if (family.equalsIgnoreCase(FontFactory.SYMBOL)) {
- return SYMBOL;
- }
- if (family.equalsIgnoreCase(FontFactory.ZAPFDINGBATS)) {
- return ZAPFDINGBATS;
- }
- return UNDEFINED;
- }
-
-/**
- * Gets the familyname as a String.
- *
- * @return the familyname
- */
-
- public String getFamilyname() {
- String tmp = "unknown";
- switch(family()) {
- case Font.COURIER:
- return FontFactory.COURIER;
- case Font.HELVETICA:
- return FontFactory.HELVETICA;
- case Font.TIMES_ROMAN:
- return FontFactory.TIMES_ROMAN;
- case Font.SYMBOL:
- return FontFactory.SYMBOL;
- case Font.ZAPFDINGBATS:
- return FontFactory.ZAPFDINGBATS;
- default:
- if (baseFont != null) {
- String[][] names = baseFont.getFamilyFontName();
- for (int i = 0; i < names.length; i++) {
- if ("0".equals(names[i][2])) {
- return names[i][3];
- }
- if ("1033".equals(names[i][2])) {
- tmp = names[i][3];
- }
- if ("".equals(names[i][2])) {
- tmp = names[i][3];
- }
- }
- }
- }
- return tmp;
- }
-
-/**
- * Sets the size.
- *
- * @param size The new size of the font.
- */
-
- public void setSize(float size) {
- this.size = size;
- }
-
-/**
- * Sets the style using a <CODE>String</CODE> containing one of
- * more of the following values: normal, bold, italic, underline, strike.
- *
- * @param style A <CODE>String</CODE> representing a certain style.
- */
-
- public void setStyle(String style) {
- if (this.style == UNDEFINED) this.style = NORMAL;
- this.style |= getStyleValue(style);
- }
-
-/**
- * Sets the style.
- * @param style the style.
- */
-
- public void setStyle(int style) {
- if (this.style == UNDEFINED) this.style = NORMAL;
- this.style |= style;
- }
-
-/**
- * Translates a <CODE>String</CODE>-value of a certain style
- * into the index value is used for this style in this class.
- *
- * @param style A <CODE>String</CODE>
- * @return the corresponding value
- */
-
- public static int getStyleValue(String style) {
- int s = 0;
- if (style.indexOf(MarkupTags.CSS_VALUE_NORMAL) != -1) {
- s |= NORMAL;
- }
- if (style.indexOf(MarkupTags.CSS_VALUE_BOLD) != -1) {
- s |= BOLD;
- }
- if (style.indexOf(MarkupTags.CSS_VALUE_ITALIC) != -1) {
- s |= ITALIC;
- }
- if (style.indexOf(MarkupTags.CSS_VALUE_OBLIQUE) != -1) {
- s |= ITALIC;
- }
- if (style.indexOf(MarkupTags.CSS_VALUE_UNDERLINE) != -1) {
- s |= UNDERLINE;
- }
- if (style.indexOf(MarkupTags.CSS_VALUE_LINETHROUGH) != -1) {
- s |= STRIKETHRU;
- }
- return s;
- }
-
-/**
- * Sets the color.
- *
- * @param color the new color of the font
- */
-
- public void setColor(Color color) {
- this.color = color;
- }
-
-/**
- * Sets the color.
- *
- * @param red the red-value of the new color
- * @param green the green-value of the new color
- * @param blue the blue-value of the new color
- */
-
- public void setColor(int red, int green, int blue) {
- this.color = new Color(red, green, blue);
- }
-
-/**
- * Gets the leading that can be used with this font.
- *
- * @param linespacing a certain linespacing
- * @return the height of a line
- */
-
- public float leading(float linespacing) {
- if (size == UNDEFINED) {
- return linespacing * DEFAULTSIZE;
- }
- return linespacing * size;
- }
-
-/**
- * Checks if the properties of this font are undefined or null.
- * <P>
- * If so, the standard should be used.
- *
- * @return a <CODE>boolean</CODE>
- */
-
- public boolean isStandardFont() {
- return (family == UNDEFINED
- && size == UNDEFINED
- && style == UNDEFINED
- && color == null
- && baseFont == null);
- }
-
-/**
- * Replaces the attributes that are equal to <VAR>null</VAR> with
- * the attributes of a given font.
- *
- * @param font the font of a bigger element class
- * @return a <CODE>Font</CODE>
- */
-
- public Font difference(Font font) {
- // size
- float dSize = font.size;
- if (dSize == UNDEFINED) {
- dSize = this.size;
- }
- // style
- int dStyle = UNDEFINED;
- int style1 = this.style;
- int style2 = font.style();
- if (style1 != UNDEFINED || style2 != UNDEFINED) {
- if (style1 == UNDEFINED) style1 = 0;
- if (style2 == UNDEFINED) style2 = 0;
- dStyle = style1 | style2;
- }
- // color
- Color dColor = font.color;
- if (dColor == null) {
- dColor = this.color;
- }
- // family
- if (font.baseFont != null) {
- return new Font(font.baseFont, dSize, dStyle, dColor);
- }
- if (font.family() != UNDEFINED) {
- return new Font(font.family, dSize, dStyle, dColor);
- }
- if (this.baseFont != null) {
- if (dStyle == style1) {
- return new Font(this.baseFont, dSize, dStyle, dColor);
- }
- else {
- return FontFactory.getFont(this.getFamilyname(), dSize, dStyle, dColor);
- }
- }
- return new Font(this.family, dSize, dStyle, dColor);
- }
-
- // methods to retrieve the membervariables
-
-/**
- * Gets the family of this font.
- *
- * @return the value of the family
- */
-
- public int family() {
- return family;
- }
-
-/**
- * Gets the size of this font.
- *
- * @return a size
- */
-
- public float size() {
- return size;
- }
-
-/**
- * Gets the style of this font.
- *
- * @return a size
- */
-
- public int style() {
- return style;
- }
-
-/**
- * checks if this font is Bold.
- *
- * @return a <CODE>boolean</CODE>
- */
-
- public boolean isBold() {
- if (style == UNDEFINED) {
- return false;
- }
- return (style & BOLD) == BOLD;
- }
-
-/**
- * checks if this font is Bold.
- *
- * @return a <CODE>boolean</CODE>
- */
-
- public boolean isItalic() {
- if (style == UNDEFINED) {
- return false;
- }
- return (style & ITALIC) == ITALIC;
- }
-
-/**
- * checks if this font is underlined.
- *
- * @return a <CODE>boolean</CODE>
- */
-
- public boolean isUnderlined() {
- if (style == UNDEFINED) {
- return false;
- }
- return (style & UNDERLINE) == UNDERLINE;
- }
-
-/**
- * checks if the style of this font is STRIKETHRU.
- *
- * @return a <CODE>boolean</CODE>
- */
-
- public boolean isStrikethru() {
- if (style == UNDEFINED) {
- return false;
- }
- return (style & STRIKETHRU) == STRIKETHRU;
- }
-
-/**
- * Gets the color of this font.
- *
- * @return a color
- */
-
- public Color color() {
- return color;
- }
-
- /** Gets the <CODE>BaseFont</CODE> inside this object.
- * @return the <CODE>BaseFont</CODE>
- */
-
- public BaseFont getBaseFont() {
- return baseFont;
- }
-
- /** Gets the <CODE>BaseFont</CODE> this class represents.
- * For the built-in fonts a <CODE>BaseFont</CODE> is calculated.
- * @param specialEncoding <CODE>true</CODE> to use the special encoding for Symbol and ZapfDingbats,
- * <CODE>false</CODE> to always use <CODE>Cp1252</CODE>
- * @return the <CODE>BaseFont</CODE> this class represents
- */
- public BaseFont getCalculatedBaseFont(boolean specialEncoding) {
- if (baseFont != null)
- return baseFont;
- int style = this.style;
- if (style == UNDEFINED) {
- style = NORMAL;
- }
- String fontName = BaseFont.HELVETICA;
- String encoding = BaseFont.WINANSI;
- BaseFont cfont = null;
- switch(family) {
- case COURIER:
- switch(style & BOLDITALIC) {
- case BOLD:
- fontName = BaseFont.COURIER_BOLD;
- break;
- case ITALIC:
- fontName = BaseFont.COURIER_OBLIQUE;
- break;
- case BOLDITALIC:
- fontName = BaseFont.COURIER_BOLDOBLIQUE;
- break;
- default:
- //case NORMAL:
- fontName = BaseFont.COURIER;
- break;
- }
- break;
- case TIMES_ROMAN:
- switch(style & BOLDITALIC) {
- case BOLD:
- fontName = BaseFont.TIMES_BOLD;
- break;
- case ITALIC:
- fontName = BaseFont.TIMES_ITALIC;
- break;
- case BOLDITALIC:
- fontName = BaseFont.TIMES_BOLDITALIC;
- break;
- default:
- case NORMAL:
- fontName = BaseFont.TIMES_ROMAN;
- break;
- }
- break;
- case SYMBOL:
- fontName = BaseFont.SYMBOL;
- if (specialEncoding)
- encoding = BaseFont.SYMBOL;
- break;
- case ZAPFDINGBATS:
- fontName = BaseFont.ZAPFDINGBATS;
- if (specialEncoding)
- encoding = BaseFont.ZAPFDINGBATS;
- break;
- default:
- //case Font.HELVETICA:
- switch(style & BOLDITALIC) {
- case BOLD:
- fontName = BaseFont.HELVETICA_BOLD;
- break;
- case ITALIC:
- fontName = BaseFont.HELVETICA_OBLIQUE;
- break;
- case BOLDITALIC:
- fontName = BaseFont.HELVETICA_BOLDOBLIQUE;
- break;
- default:
- case NORMAL:
- fontName = BaseFont.HELVETICA;
- break;
- }
- break;
- }
- try {
- cfont = BaseFont.createFont(fontName, encoding, false);
- }
- catch (Exception ee) {
- throw new ExceptionConverter(ee);
- }
- return cfont;
- }
-
- /** Gets the style that can be used with the calculated <CODE>BaseFont</CODE>.
- * @return the style that can be used with the calculated <CODE>BaseFont</CODE>
- */
- public int getCalculatedStyle() {
- int style = this.style;
- if (style == UNDEFINED) {
- style = NORMAL;
- }
- if (baseFont != null)
- return style;
- if (family == SYMBOL || family == ZAPFDINGBATS)
- return style;
- else
- return style & (~BOLDITALIC);
- }
-
- /** Gets the size that can be used with the calculated <CODE>BaseFont</CODE>.
- * @return the size that can be used with the calculated <CODE>BaseFont</CODE>
- */
- public float getCalculatedSize() {
- float s = this.size;
- if (s == UNDEFINED) {
- s = DEFAULTSIZE;
- }
- return s;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/FontFactory.java b/LibrarySource/com/lowagie/text/FontFactory.java
deleted file mode 100644
index 7ab657e..0000000
--- a/LibrarySource/com/lowagie/text/FontFactory.java
+++ /dev/null
@@ -1,661 +0,0 @@
-/*
- * $Id: FontFactory.java,v 1.65 2005/05/03 13:03:47 blowagie Exp $
- * $Name: $
- *
- * Copyright 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import headless.awt.Color;
-import java.io.IOException;
-import java.util.Hashtable;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Enumeration;
-import java.io.File;
-import com.lowagie.text.pdf.BaseFont;
-import com.lowagie.text.markup.MarkupTags;
-import com.lowagie.text.markup.MarkupParser;
-
-/**
- * If you are using True Type fonts, you can declare the paths of the different ttf- and ttc-files
- * to this static class first and then create fonts in your code using one of the static getFont-method
- * without having to enter a path as parameter.
- *
- * @author Bruno Lowagie
- */
-
-public class FontFactory extends java.lang.Object {
-
-/** This is a possible value of a base 14 type 1 font */
- public static final String COURIER = BaseFont.COURIER;
-
-/** This is a possible value of a base 14 type 1 font */
- public static final String COURIER_BOLD = BaseFont.COURIER_BOLD;
-
-/** This is a possible value of a base 14 type 1 font */
- public static final String COURIER_OBLIQUE = BaseFont.COURIER_OBLIQUE;
-
-/** This is a possible value of a base 14 type 1 font */
- public static final String COURIER_BOLDOBLIQUE = BaseFont.COURIER_BOLDOBLIQUE;
-
-/** This is a possible value of a base 14 type 1 font */
- public static final String HELVETICA = BaseFont.HELVETICA;
-
-/** This is a possible value of a base 14 type 1 font */
- public static final String HELVETICA_BOLD = BaseFont.HELVETICA_BOLD;
-
-/** This is a possible value of a base 14 type 1 font */
- public static final String HELVETICA_OBLIQUE = BaseFont.HELVETICA_OBLIQUE;
-
-/** This is a possible value of a base 14 type 1 font */
- public static final String HELVETICA_BOLDOBLIQUE = BaseFont.HELVETICA_BOLDOBLIQUE;
-
-/** This is a possible value of a base 14 type 1 font */
- public static final String SYMBOL = BaseFont.SYMBOL;
-
-/** This is a possible value of a base 14 type 1 font */
- public static final String TIMES = "Times";
-
-/** This is a possible value of a base 14 type 1 font */
- public static final String TIMES_ROMAN = BaseFont.TIMES_ROMAN;
-
-/** This is a possible value of a base 14 type 1 font */
- public static final String TIMES_BOLD = BaseFont.TIMES_BOLD;
-
-/** This is a possible value of a base 14 type 1 font */
- public static final String TIMES_ITALIC = BaseFont.TIMES_ITALIC;
-
-/** This is a possible value of a base 14 type 1 font */
- public static final String TIMES_BOLDITALIC = BaseFont.TIMES_BOLDITALIC;
-
-/** This is a possible value of a base 14 type 1 font */
- public static final String ZAPFDINGBATS = BaseFont.ZAPFDINGBATS;
-
-/** This is a map of postscriptfontnames of True Type fonts and the path of their ttf- or ttc-file. */
- private static Properties trueTypeFonts = new Properties();
-
- static {
- trueTypeFonts.setProperty(COURIER, COURIER);
- trueTypeFonts.setProperty(COURIER_BOLD, COURIER_BOLD);
- trueTypeFonts.setProperty(COURIER_OBLIQUE, COURIER_OBLIQUE);
- trueTypeFonts.setProperty(COURIER_BOLDOBLIQUE, COURIER_BOLDOBLIQUE);
- trueTypeFonts.setProperty(HELVETICA, HELVETICA);
- trueTypeFonts.setProperty(HELVETICA_BOLD, HELVETICA_BOLD);
- trueTypeFonts.setProperty(HELVETICA_OBLIQUE, HELVETICA_OBLIQUE);
- trueTypeFonts.setProperty(HELVETICA_BOLDOBLIQUE, HELVETICA_BOLDOBLIQUE);
- trueTypeFonts.setProperty(SYMBOL, SYMBOL);
- trueTypeFonts.setProperty(TIMES_ROMAN, TIMES_ROMAN);
- trueTypeFonts.setProperty(TIMES_BOLD, TIMES_BOLD);
- trueTypeFonts.setProperty(TIMES_ITALIC, TIMES_ITALIC);
- trueTypeFonts.setProperty(TIMES_BOLDITALIC, TIMES_BOLDITALIC);
- trueTypeFonts.setProperty(ZAPFDINGBATS, ZAPFDINGBATS);
- }
-
-/** This is a map of fontfamilies. */
- private static Hashtable fontFamilies = new Hashtable();
-
- static {
- HashSet tmp;
- tmp = new HashSet();
- tmp.add(COURIER);
- tmp.add(COURIER_BOLD);
- tmp.add(COURIER_OBLIQUE);
- tmp.add(COURIER_BOLDOBLIQUE);
- fontFamilies.put(COURIER, tmp);
- tmp = new HashSet();
- tmp.add(HELVETICA);
- tmp.add(HELVETICA_BOLD);
- tmp.add(HELVETICA_OBLIQUE);
- tmp.add(HELVETICA_BOLDOBLIQUE);
- fontFamilies.put(HELVETICA, tmp);
- tmp = new HashSet();
- tmp.add(SYMBOL);
- fontFamilies.put(SYMBOL, tmp);
- tmp = new HashSet();
- tmp.add(TIMES_ROMAN);
- tmp.add(TIMES_BOLD);
- tmp.add(TIMES_ITALIC);
- tmp.add(TIMES_BOLDITALIC);
- fontFamilies.put(TIMES, tmp);
- fontFamilies.put(TIMES_ROMAN, tmp);
- tmp = new HashSet();
- tmp.add(ZAPFDINGBATS);
- fontFamilies.put(ZAPFDINGBATS, tmp);
- }
-
-
-/** This is the default encoding to use. */
- public static String defaultEncoding = BaseFont.WINANSI;
-
-/** This is the default value of the <VAR>embedded</VAR> variable. */
- public static boolean defaultEmbedding = BaseFont.NOT_EMBEDDED;
-
-/** Creates new FontFactory */
- private FontFactory() {
- }
-
-/**
- * Constructs a <CODE>Font</CODE>-object.
- *
- * @param fontname the name of the font
- * @param encoding the encoding of the font
- * @param embedded true if the font is to be embedded in the PDF
- * @param size the size of this font
- * @param style the style of this font
- * @param color the <CODE>Color</CODE> of this font.
- * @return the Font constructed based on the parameters
- */
-
- public static Font getFont(String fontname, String encoding, boolean embedded, float size, int style, Color color) {
- if (fontname == null) return new Font(Font.UNDEFINED, size, style, color);
- HashSet tmp = (HashSet) fontFamilies.get(fontname);
- if (tmp != null) {
- // some bugs were fixed here by Daniel Marczisovszky
- String lowercasefontname = fontname.toLowerCase();
- int s = style == Font.UNDEFINED ? Font.NORMAL : style;
- int fs = Font.NORMAL;
- boolean found = false;
- for (Iterator i = tmp.iterator(); i.hasNext(); ) {
- String f = (String) i.next();
- String lcf = f.toLowerCase();
- fs = Font.NORMAL;
- if (lcf.toLowerCase().indexOf("bold") != -1) fs |= Font.BOLD;
- if (lcf.toLowerCase().indexOf("italic") != -1 || lcf.toLowerCase().indexOf("oblique") != -1) fs |= Font.ITALIC;
- if ((s & Font.BOLDITALIC) == fs) {
- fontname = f;
- found = true;
- break;
- }
- }
- if (style != Font.UNDEFINED && found) {
- style &= ~fs;
- }
- }
- BaseFont basefont = null;
- try {
- try {
- // the font is a type 1 font or CJK font
- basefont = BaseFont.createFont(fontname, encoding, embedded);
- }
- catch(DocumentException de) {
- // the font is a true type font or an unknown font
- fontname = trueTypeFonts.getProperty(fontname);
- // the font is not registered as truetype font
- if (fontname == null) return new Font(Font.UNDEFINED, size, style, color);
- // the font is registered as truetype font
- basefont = BaseFont.createFont(fontname, encoding, embedded);
- }
- }
- catch(DocumentException de) {
- // this shouldn't happen
- throw new ExceptionConverter(de);
- }
- catch(IOException ioe) {
- // the font is registered as a true type font, but the path was wrong
- return new Font(Font.UNDEFINED, size, style, color);
- }
- catch(NullPointerException npe) {
- // null was entered as fontname and/or encoding
- return new Font(Font.UNDEFINED, size, style, color);
- }
- return new Font(basefont, size, style, color);
- }
-
-/**
- * Constructs a <CODE>Font</CODE>-object.
- *
- * @param attributes the attributes of a <CODE>Font</CODE> object.
- * @return the Font constructed based on the attributes
- */
-
- public static Font getFont(Properties attributes) {
- String fontname = null;
- String encoding = defaultEncoding;
- boolean embedded = defaultEmbedding;
- float size = Font.UNDEFINED;
- int style = Font.NORMAL;
- Color color = null;
- String value = (String) attributes.remove(MarkupTags.HTML_ATTR_STYLE);
- if (value != null && value.length() > 0) {
- Properties styleAttributes = MarkupParser.parseAttributes(value);
- if (styleAttributes.size() == 0) {
- attributes.put(MarkupTags.HTML_ATTR_STYLE, value);
- }
- else {
- fontname = (String)styleAttributes.remove(MarkupTags.CSS_KEY_FONTFAMILY);
- if (fontname != null) {
- String tmp;
- while (fontname.indexOf(",") != -1) {
- tmp = fontname.substring(0, fontname.indexOf(","));
- if (isRegistered(tmp)) {
- fontname = tmp;
- }
- else {
- fontname = fontname.substring(fontname.indexOf(",") + 1);
- }
- }
- }
- if ((value = (String)styleAttributes.remove(MarkupTags.CSS_KEY_FONTSIZE)) != null) {
- size = MarkupParser.parseLength(value);
- }
- if ((value = (String)styleAttributes.remove(MarkupTags.CSS_KEY_FONTWEIGHT)) != null) {
- style |= Font.getStyleValue(value);
- }
- if ((value = (String)styleAttributes.remove(MarkupTags.CSS_KEY_FONTSTYLE)) != null) {
- style |= Font.getStyleValue(value);
- }
- if ((value = (String)styleAttributes.remove(MarkupTags.CSS_KEY_COLOR)) != null) {
- color = MarkupParser.decodeColor(value);
- }
- attributes.putAll(styleAttributes);
- for (Enumeration e = styleAttributes.keys(); e.hasMoreElements();) {
- Object o = e.nextElement();
- attributes.put(o, styleAttributes.get(o));
- }
- }
- }
- if ((value = (String)attributes.remove(ElementTags.ENCODING)) != null) {
- encoding = value;
- }
- if ("true".equals((String) attributes.remove(ElementTags.EMBEDDED))) {
- embedded = true;
- }
- if ((value = (String)attributes.remove(ElementTags.FONT)) != null) {
- fontname = value;
- }
- if ((value = (String)attributes.remove(ElementTags.SIZE)) != null) {
- size = Float.valueOf(value + "f").floatValue();
- }
- if ((value = (String)attributes.remove(MarkupTags.HTML_ATTR_STYLE)) != null) {
- style |= Font.getStyleValue(value);
- }
- if ((value = (String)attributes.remove(ElementTags.STYLE)) != null) {
- style |= Font.getStyleValue(value);
- }
- String r = (String)attributes.remove(ElementTags.RED);
- String g = (String)attributes.remove(ElementTags.GREEN);
- String b = (String)attributes.remove(ElementTags.BLUE);
- if (r != null || g != null || b != null) {
- int red = 0;
- int green = 0;
- int blue = 0;
- if (r != null) red = Integer.parseInt(r);
- if (g != null) green = Integer.parseInt(g);
- if (b != null) blue = Integer.parseInt(b);
- color = new Color(red, green, blue);
- }
- else if ((value = (String)attributes.remove(ElementTags.COLOR)) != null) {
- color = MarkupParser.decodeColor(value);
- }
- if (fontname == null) {
- return getFont(null, encoding, embedded, size, style, color);
- }
- return getFont(fontname, encoding, embedded, size, style, color);
- }
-
-/**
- * Constructs a <CODE>Font</CODE>-object.
- *
- * @param fontname the name of the font
- * @param encoding the encoding of the font
- * @param embedded true if the font is to be embedded in the PDF
- * @param size the size of this font
- * @param style the style of this font
- * @return the Font constructed based on the parameters
- */
-
- public static Font getFont(String fontname, String encoding, boolean embedded, float size, int style) {
- return getFont(fontname, encoding, embedded, size, style, null);
- }
-
-/**
- * Constructs a <CODE>Font</CODE>-object.
- *
- * @param fontname the name of the font
- * @param encoding the encoding of the font
- * @param embedded true if the font is to be embedded in the PDF
- * @param size the size of this font
- * @return the Font constructed based on the parameters
- */
-
- public static Font getFont(String fontname, String encoding, boolean embedded, float size) {
- return getFont(fontname, encoding, embedded, size, Font.UNDEFINED, null);
- }
-
-/**
- * Constructs a <CODE>Font</CODE>-object.
- *
- * @param fontname the name of the font
- * @param encoding the encoding of the font
- * @param embedded true if the font is to be embedded in the PDF
- * @return the Font constructed based on the parameters
- */
-
- public static Font getFont(String fontname, String encoding, boolean embedded) {
- return getFont(fontname, encoding, embedded, Font.UNDEFINED, Font.UNDEFINED, null);
- }
-
-/**
- * Constructs a <CODE>Font</CODE>-object.
- *
- * @param fontname the name of the font
- * @param encoding the encoding of the font
- * @param size the size of this font
- * @param style the style of this font
- * @param color the <CODE>Color</CODE> of this font.
- * @return the Font constructed based on the parameters
- */
-
- public static Font getFont(String fontname, String encoding, float size, int style, Color color) {
- return getFont(fontname, encoding, defaultEmbedding, size, style, color);
- }
-
-/**
- * Constructs a <CODE>Font</CODE>-object.
- *
- * @param fontname the name of the font
- * @param encoding the encoding of the font
- * @param size the size of this font
- * @param style the style of this font
- * @return the Font constructed based on the parameters
- */
-
- public static Font getFont(String fontname, String encoding, float size, int style) {
- return getFont(fontname, encoding, defaultEmbedding, size, style, null);
- }
-
-/**
- * Constructs a <CODE>Font</CODE>-object.
- *
- * @param fontname the name of the font
- * @param encoding the encoding of the font
- * @param size the size of this font
- * @return the Font constructed based on the parameters
- */
-
- public static Font getFont(String fontname, String encoding, float size) {
- return getFont(fontname, encoding, defaultEmbedding, size, Font.UNDEFINED, null);
- }
-
-/**
- * Constructs a <CODE>Font</CODE>-object.
- *
- * @param fontname the name of the font
- * @param encoding the encoding of the font
- * @return the Font constructed based on the parameters
- */
-
- public static Font getFont(String fontname, String encoding) {
- return getFont(fontname, encoding, defaultEmbedding, Font.UNDEFINED, Font.UNDEFINED, null);
- }
-
-/**
- * Constructs a <CODE>Font</CODE>-object.
- *
- * @param fontname the name of the font
- * @param size the size of this font
- * @param style the style of this font
- * @param color the <CODE>Color</CODE> of this font.
- * @return the Font constructed based on the parameters
- */
-
- public static Font getFont(String fontname, float size, int style, Color color) {
- return getFont(fontname, defaultEncoding, defaultEmbedding, size, style, color);
- }
-
-/**
- * Constructs a <CODE>Font</CODE>-object.
- *
- * @param fontname the name of the font
- * @param size the size of this font
- * @param style the style of this font
- * @return the Font constructed based on the parameters
- */
-
- public static Font getFont(String fontname, float size, int style) {
- return getFont(fontname, defaultEncoding, defaultEmbedding, size, style, null);
- }
-
-/**
- * Constructs a <CODE>Font</CODE>-object.
- *
- * @param fontname the name of the font
- * @param size the size of this font
- * @return the Font constructed based on the parameters
- */
-
- public static Font getFont(String fontname, float size) {
- return getFont(fontname, defaultEncoding, defaultEmbedding, size, Font.UNDEFINED, null);
- }
-
-/**
- * Constructs a <CODE>Font</CODE>-object.
- *
- * @param fontname the name of the font
- * @return the Font constructed based on the parameters
- */
-
- public static Font getFont(String fontname) {
- return getFont(fontname, defaultEncoding, defaultEmbedding, Font.UNDEFINED, Font.UNDEFINED, null);
- }
-
-/**
- * Register a ttf- or a ttc-file.
- *
- * @param path the path to a ttf- or ttc-file
- */
-
- public static void register(String path) {
- register(path, null);
- }
-
-/**
- * Register a font file and use an alias for the font contained in it.
- *
- * @param path the path to a font file
- * @param alias the alias you want to use for the font
- */
-
- public static void register(String path, String alias) {
- try {
- if (path.toLowerCase().endsWith(".ttf") || path.toLowerCase().endsWith(".otf") || path.toLowerCase().indexOf(".ttc,") > 0) {
- Object allNames[] = BaseFont.getAllFontNames(path, BaseFont.WINANSI, null);
- trueTypeFonts.setProperty((String)allNames[0], path);
- if (alias != null) {
- trueTypeFonts.setProperty(alias, path);
- }
- String fullName = null;
- String familyName = null;
- String[][] names = (String[][])allNames[2];
- for (int i = 0; i < names.length; i++) {
- if ("0".equals(names[i][2])) {
- fullName = names[i][3];
- break;
- }
- }
- // register all the font names with all the locales
- for (int i = 0; i < names.length; i++) {
- trueTypeFonts.setProperty(names[i][3], path);
- }
- if (fullName != null) {
- names = (String[][])allNames[1];
- for (int i = 0; i < names.length; i++) {
- if ("0".equals(names[i][2])) {
- familyName = names[i][3];
- HashSet tmp = (HashSet) fontFamilies.get(familyName);
- if (tmp == null) {
- tmp = new HashSet();
- }
- tmp.add(fullName);
- fontFamilies.put(familyName, tmp);
- break;
- }
- }
- }
- }
- else if (path.toLowerCase().endsWith(".ttc")) {
- if (alias != null)
- System.err.println("class FontFactory: You can't define an alias for a true type collection.");
- String[] names = BaseFont.enumerateTTCNames(path);
- for (int i = 0; i < names.length; i++) {
- register(path + "," + i);
- }
- }
- else if (path.toLowerCase().endsWith(".afm")) {
- BaseFont bf = BaseFont.createFont(path, BaseFont.CP1252, false);
- trueTypeFonts.setProperty(bf.getPostscriptFontName(), path);
- trueTypeFonts.setProperty(bf.getFullFontName()[0][3], path);
- }
- }
- catch(DocumentException de) {
- // this shouldn't happen
- throw new ExceptionConverter(de);
- }
- catch(IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- }
-
- /** Register all the fonts in a directory.
- * @param dir the directory
- * @return the number of fonts registered
- */
- public static int registerDirectory(String dir) {
- int count = 0;
- try {
- File file = new File(dir);
- if (!file.exists() || !file.isDirectory())
- return 0;
- String files[] = file.list();
- if (files == null)
- return 0;
- for (int k = 0; k < files.length; ++k) {
- try {
- file = new File(dir, files[k]);
- String name = file.getPath().toLowerCase();
- if (name.endsWith(".ttf") || name.endsWith(".otf") || name.endsWith(".afm") || name.endsWith(".ttc")) {
- register(file.getPath(), null);
- ++count;
- }
- }
- catch (Exception e) {
- //empty on purpose
- }
- }
- }
- catch (Exception e) {
- //empty on purpose
- }
- return count;
- }
-
- /** Register fonts in some probable directories. It usually works in Windows,
- * Linux and Solaris.
- * @return the number of fonts registered
- */
- public static int registerDirectories() {
- int count = 0;
- count += registerDirectory("c:/windows/fonts");
- count += registerDirectory("c:/winnt/fonts");
- count += registerDirectory("d:/windows/fonts");
- count += registerDirectory("d:/winnt/fonts");
- count += registerDirectory("/usr/X/lib/X11/fonts/TrueType");
- count += registerDirectory("/usr/openwin/lib/X11/fonts/TrueType");
- count += registerDirectory("/usr/share/fonts/default/TrueType");
- count += registerDirectory("/usr/X11R6/lib/X11/fonts/ttf");
- return count;
- }
-
-/**
- * Gets a set of registered fontnames.
- * @return a set of registered fonts
- */
-
- public static Set getRegisteredFonts() {
- return Chunk.getKeySet(trueTypeFonts);
- }
-
-/**
- * Gets a set of registered fontnames.
- * @return a set of registered font families
- */
-
- public static Set getRegisteredFamilies() {
- return Chunk.getKeySet(fontFamilies);
- }
-
-/**
- * Gets a set of registered fontnames.
- * @param fontname of a font that may or may not be registered
- * @return true if a given font is registered
- */
-
- public static boolean contains(String fontname) {
- return trueTypeFonts.containsKey(fontname);
- }
-
-/**
- * Checks if a certain font is registered.
- *
- * @param fontname the name of the font that has to be checked.
- * @return true if the font is found
- */
-
- public static boolean isRegistered(String fontname) {
- String tmp;
- for (Enumeration e = trueTypeFonts.propertyNames(); e.hasMoreElements(); ) {
- tmp = (String) e.nextElement();
- if (fontname.equalsIgnoreCase(tmp)) {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/Graphic.java b/LibrarySource/com/lowagie/text/Graphic.java
deleted file mode 100644
index ac401af..0000000
--- a/LibrarySource/com/lowagie/text/Graphic.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * $Id: Graphic.java,v 1.57 2004/12/14 12:33:47 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import headless.awt.Color;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.HashMap;
-
-import com.lowagie.text.pdf.PdfContentByte;
-
-/**
- * A <CODE>Graphic</CODE> element can contain several geometric figures (curves, lines,...).
- * <P>
- * If you want to use this <CODE>Element</CODE>, please read the Sections 8.4 and 8.5 of
- * the PDF Reference Manual version 1.3 first.
- *
- * @see Element
- */
-
-public class Graphic extends PdfContentByte implements Element {
-
-/** This is a type of Graphic. */
- public static final String HORIZONTAL_LINE = "HORIZONTAL";
-
-/** This is a type of Graphic. */
- public static final String BORDER = "BORDER";
-
-/** Contains some of the attributes for this Graphic. */
- private HashMap attributes;
-
- // constructor
-
-/**
- * Constructs a <CODE>Graphic</CODE>-object.
- */
-
- public Graphic() {
- super(null);
- }
-
- // implementation of the Element interface
-
-/**
- * Processes the element by adding it (or the different parts) to an
- * <CODE>ElementListener</CODE>.
- *
- * @param listener an <CODE>ElementListener</CODE>
- * <CODE>true</CODE> if the element was processed successfully
- * @return true if processing this object succeeded
- */
-
- public boolean process(ElementListener listener) {
- try {
- return listener.add(this);
- }
- catch(DocumentException de) {
- return false;
- }
- }
-
-/**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type() {
- return Element.GRAPHIC;
- }
-
-/**
- * Gets all the chunks in this element.
- *
- * @return an <CODE>ArrayList</CODE>
- */
-
- public ArrayList getChunks() {
- return new ArrayList();
- }
-
- /**
- * Orders this graphic to draw a horizontal, centered line.
- * @param linewidth the line width
- * @param percentage the percentage horizontal width in relation to the margins or if negative, an absolute value
- */
-
- public void setHorizontalLine(float linewidth, float percentage) {
- if (attributes == null) attributes = new HashMap();
- attributes.put(HORIZONTAL_LINE, new Object[]{new Float(linewidth), new Float(percentage), Color.black, new Integer(Element.ALIGN_CENTER)});
- }
-
- /**
- * Orders this graphic to draw a horizontal line with some alignment.
- * @param linewidth the line width
- * @param percentage the percentage horizontal width in relation to the margins or if negative, an absolute value
- * @param align the line alignment
- */
- public void setHorizontalLine(float linewidth, float percentage, int align) {
- if (attributes == null) attributes = new HashMap();
- attributes.put(HORIZONTAL_LINE, new Object[]{new Float(linewidth), new Float(percentage), Color.black, new Integer(align)});
- }
-
- /**
- * Orders this graphic to draw a horizontal, centered line.
- * @param linewidth the line width
- * @param percentage the percentage horizontal width in relation to the margins or if negative, an absolute value
- * @param color the color of the line
- */
-
- public void setHorizontalLine(float linewidth, float percentage, Color color) {
- if (attributes == null) attributes = new HashMap();
- attributes.put(HORIZONTAL_LINE, new Object[]{new Float(linewidth), new Float(percentage), color, new Integer(Element.ALIGN_CENTER)});
- }
-
- /**
- * Orders this graphic to draw a horizontal, centered line.
- * @param linewidth the line width
- * @param percentage the percentage horizontal width in relation to the margins or if negative, an absolute value
- * @param color the color of the line
- * @param align the line alignment
- */
- public void setHorizontalLine(float linewidth, float percentage, Color color, int align) {
- if (attributes == null) attributes = new HashMap();
- attributes.put(HORIZONTAL_LINE, new Object[]{new Float(linewidth), new Float(percentage), color, new Integer(align)});
- }
-
-/**
- * draws a horizontal line.
- * @param lineWidth width of the line
- * @param color color of the line
- * @param x1 start position of the line
- * @param x2 end position of the line
- * @param y y-coordinate of the line
- */
-
- public void drawHorizontalLine(float lineWidth, Color color, float x1, float x2, float y) {
- setLineWidth(lineWidth);
- setColorStroke(color);
- moveTo(x1, y);
- lineTo(x2, y);
- stroke();
- resetRGBColorStroke();
- }
-
-/**
- * Orders this graphic to draw a horizontal line.
- * @param linewidth linewidth of the border
- * @param extraSpace extraspace needed as marging on the page
- */
-
- public void setBorder(float linewidth, float extraSpace) {
- if (attributes == null) attributes = new HashMap();
- attributes.put(BORDER, new Object[]{new Float(linewidth), new Float(extraSpace), new Color(0, 0, 0)});
- }
-
-/**
- * Orders this graphic to draw a horizontal line.
- * @param linewidth linewidth of the border
- * @param extraSpace extraspace needed as marging on the page
- * @param color color of the borderbox
- */
-
- public void setBorder(float linewidth, float extraSpace, Color color) {
- if (attributes == null) attributes = new HashMap();
- attributes.put(BORDER, new Object[]{new Float(linewidth), new Float(extraSpace), color});
- }
-
-/**
- * Draws a border
- * @param lineWidth linewidth of the border
- * @param color color of the borderbox
- * @param llx lower left x coordinate
- * @param lly lower left y coordinate
- * @param urx upper right x coordinate
- * @param ury upper right y coordinate
- */
- public void drawBorder(float lineWidth, Color color, float llx, float lly, float urx, float ury) {
- setLineWidth(lineWidth);
- setColorStroke(color);
- rectangle(llx, lly, urx - llx, ury - lly);
- stroke();
- resetRGBColorStroke();
- }
-
-/**
- * Processes the attributes of this object.
- * @param llx lower left x coordinate
- * @param lly lower left y coordinate
- * @param urx upper right x coordinate
- * @param ury upper right y coordinate
- * @param y
- */
-
- public void processAttributes(float llx, float lly, float urx, float ury, float y) {
- if (attributes == null) return;
- String attribute;
- Object[] o;
- for (Iterator i = attributes.keySet().iterator(); i.hasNext(); ) {
- attribute = (String) i.next();
- o = (Object[]) attributes.get(attribute);
- if (HORIZONTAL_LINE.equals(attribute)) {
- float p = ((Float)o[1]).floatValue();
- float w;
- if (p < 0)
- w = -p;
- else
- w = (urx - llx) * p / 100.0f;
- int align = ((Integer)o[3]).intValue();
- float s;
- switch (align) {
- case Element.ALIGN_LEFT:
- s = 0;
- break;
- case Element.ALIGN_RIGHT:
- s = urx - llx - w;
- break;
- default:
- s = (urx - llx - w) / 2;
- }
- drawHorizontalLine(((Float)o[0]).floatValue(), (Color)o[2], s + llx, s + w + llx, y);
- }
- if (BORDER.equals(attribute)) {
- float extra = ((Float)o[1]).floatValue();
- drawBorder(((Float)o[0]).floatValue(), (Color)o[2], llx - extra, lly - extra, urx + extra, ury + extra);
- }
- }
- }
-}
diff --git a/LibrarySource/com/lowagie/text/GreekList.java b/LibrarySource/com/lowagie/text/GreekList.java
deleted file mode 100644
index d87a1d0..0000000
--- a/LibrarySource/com/lowagie/text/GreekList.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright 2003 by Michael Niedermair.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text;
-
-/**
- *
- * A special-version of <CODE>LIST</CODE> whitch use greek-letters.
- *
- * @see com.lowagie.text.List
- * @version 2003-06-22
- * @author Michael Niedermair
- */
-
-public class GreekList extends List {
-
- /**
- * UpperCase or LowerCase
- */
- protected boolean greeklower;
-
- /**
- * Initialisierung
- *
- * @param symbolIndent indent
- */
- public GreekList(int symbolIndent) {
- super(true, symbolIndent);
- setGreekFont();
- }
-
- /**
- * Initialisierung
- * @param greeklower greek-char in lowercase
- * @param symbolIndent indent
- */
- public GreekList(boolean greeklower, int symbolIndent) {
- super(true, symbolIndent);
- this.greeklower = greeklower;
- setGreekFont();
- }
-
- /**
- * change the font to SYMBOL
- */
- protected void setGreekFont() {
- float fontsize = symbol.font().size();
- symbol.setFont(FontFactory.getFont(FontFactory.SYMBOL, fontsize, Font.NORMAL));
- }
-
- /**
- * set the greek-letters to lowercase otherwise to uppercase
- *
- * @param greeklower
- */
- public void setGreekLower(boolean greeklower) {
- this.greeklower = greeklower;
- }
-
- /**
- * Checks if the list is greek-letter with lowercase
- *
- * @return <CODE>true</CODE> if the greek-letter is lowercase, <CODE>false</CODE> otherwise.
- */
- public boolean isGreekLower() {
- return greeklower;
- }
-
- /**
- * Adds an <CODE>Object</CODE> to the <CODE>List</CODE>.
- *
- * @param o the object to add.
- * @return true if adding the object succeeded
- */
- public boolean add(Object o) {
- if (o instanceof ListItem) {
- ListItem item = (ListItem) o;
- Chunk chunk;
- if (greeklower)
- chunk = new Chunk((char) (first + list.size() + 96), symbol.font());
- else
- chunk = new Chunk((char) (first + list.size() + 64), symbol.font());
- chunk.append(".");
- item.setListSymbol(chunk);
- item.setIndentationLeft(symbolIndent);
- item.setIndentationRight(0);
- list.add(item);
- } else if (o instanceof List) {
- List nested = (List) o;
- nested.setIndentationLeft(nested.indentationLeft() + symbolIndent);
- first--;
- return list.add(nested);
- } else if (o instanceof String) {
- return this.add(new ListItem((String) o));
- }
- return false;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/Header.java b/LibrarySource/com/lowagie/text/Header.java
deleted file mode 100644
index 5634acb..0000000
--- a/LibrarySource/com/lowagie/text/Header.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * $Id: Header.java,v 1.29 2002/07/09 10:41:33 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-/**
- * This is an <CODE>Element</CODE> that contains
- * some userdefined meta information about the document.
- * <P>
- * <B>Example:</B>
- * <BLOCKQUOTE><PRE>
- * <STRONG>Header header = new Header("inspired by", "William Shakespeare");</STRONG>
- * </PRE></BLOCKQUOTE>
- *
- * @see Element
- * @see Meta
- */
-
-public class Header extends Meta implements Element {
-
- // membervariables
-
-/** This is the content of this chunk of text. */
- private StringBuffer name;
-
- // constructors
-
-/**
- * Constructs a <CODE>Meta</CODE>.
- *
- * @param name the name of the meta-information
- * @param content the content
- */
-
- public Header(String name, String content) {
- super(Element.HEADER, content);
- this.name = new StringBuffer(name);
- }
-
- // methods to retrieve information
-
-/**
- * Returns the name of the meta information.
- *
- * @return a <CODE>String</CODE>
- */
-
- public String name() {
- return name.toString();
- }
-}
diff --git a/LibrarySource/com/lowagie/text/HeaderFooter.java b/LibrarySource/com/lowagie/text/HeaderFooter.java
deleted file mode 100644
index a4427d6..0000000
--- a/LibrarySource/com/lowagie/text/HeaderFooter.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * $Id: HeaderFooter.java,v 1.44 2003/04/29 07:45:47 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import com.lowagie.text.Paragraph;
-import com.lowagie.text.Phrase;
-
-/**
- * A <CODE>HeaderFooter</CODE>-object is a <CODE>Rectangle</CODe> with text
- * that can be put above and/or below every page.
- * <P>
- * Example:
- * <BLOCKQUOTE><PRE>
- * <STRONG>HeaderFooter header = new HeaderFooter(new Phrase("This is a header."), false);</STRONG>
- * <STRONG>HeaderFooter footer = new HeaderFooter(new Phrase("This is page "), new Phrase("."));</STRONG>
- * document.setHeader(header);
- * document.setFooter(footer);
- * </PRE></BLOCKQUOTE>
- */
-
-public class HeaderFooter extends Rectangle implements MarkupAttributes {
-
- // membervariables
-
-/** Does the page contain a pagenumber? */
- private boolean numbered;
-
-/** This is the <CODE>Phrase</CODE> that comes before the pagenumber. */
- private Phrase before = null;
-
-/** This is number of the page. */
- private int pageN;
-
-/** This is the <CODE>Phrase</CODE> that comes after the pagenumber. */
- private Phrase after = null;
-
-/** This is alignment of the header/footer. */
- private int alignment;
-
- // constructors
-
-/**
- * Constructs a <CODE>HeaderFooter</CODE>-object.
- *
- * @param before the <CODE>Phrase</CODE> before the pagenumber
- * @param after the <CODE>Phrase</CODE> before the pagenumber
- */
-
- public HeaderFooter(Phrase before, Phrase after) {
- super(0, 0, 0, 0);
- setBorder(TOP + BOTTOM);
- setBorderWidth(1);
-
- numbered = true;
- this.before = before;
- this.after = after;
- }
-
-/**
- * Constructs a <CODE>Header</CODE>-object with a pagenumber at the end.
- *
- * @param before the <CODE>Phrase</CODE> before the pagenumber
- * @param numbered <CODE>true</CODE> if the page has to be numbered
- */
-
- public HeaderFooter(Phrase before, boolean numbered) {
- super(0, 0, 0, 0);
- setBorder(TOP + BOTTOM);
- setBorderWidth(1);
-
- this.numbered = numbered;
- this.before = before;
- }
-
- // methods
-
-/**
- * Checks if the HeaderFooter contains a page number.
- *
- * @return true if the page has to be numbered
- */
-
- public boolean isNumbered() {
- return numbered;
- }
-
-/**
- * Gets the part that comes before the pageNumber.
- *
- * @return a Phrase
- */
-
- public Phrase getBefore() {
- return before;
- }
-
-/**
- * Gets the part that comes after the pageNumber.
- *
- * @return a Phrase
- */
-
- public Phrase getAfter() {
- return after;
- }
-
-/**
- * Sets the page number.
- *
- * @param pageN the new page number
- */
-
- public void setPageNumber(int pageN) {
- this.pageN = pageN;
- }
-
-/**
- * Sets the alignment.
- *
- * @param alignment the new alignment
- */
-
- public void setAlignment(int alignment) {
- this.alignment = alignment;
- }
-
- // methods to retrieve the membervariables
-
-/**
- * Gets the <CODE>Paragraph</CODE> that can be used as header or footer.
- *
- * @return a <CODE>Paragraph</CODE>
- */
-
- public Paragraph paragraph() {
- Paragraph paragraph = new Paragraph(before.leading());
- paragraph.add(before);
- if (numbered) {
- paragraph.addSpecial(new Chunk(String.valueOf(pageN), before.font()));
- }
- if (after != null) {
- paragraph.addSpecial(after);
- }
- paragraph.setAlignment(alignment);
- return paragraph;
- }
-
- /**
- * Gets the alignment of this HeaderFooter.
- *
- * @return alignment
- */
-
- public int alignment() {
- return alignment;
- }
-
-}
diff --git a/LibrarySource/com/lowagie/text/Image.java b/LibrarySource/com/lowagie/text/Image.java
deleted file mode 100644
index 870a27b..0000000
--- a/LibrarySource/com/lowagie/text/Image.java
+++ /dev/null
@@ -1,1892 +0,0 @@
-/*
- * $Id: Image.java,v 1.102 2005/04/13 09:17:15 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.util.Properties;
-import java.util.Set;
-import headless.awt.color.ICC_Profile;
-import com.lowagie.text.pdf.PdfTemplate;
-import com.lowagie.text.pdf.codec.CCITTG4Encoder;
-import java.lang.reflect.Constructor;
-import com.lowagie.text.pdf.RandomAccessFileOrArray;
-import com.lowagie.text.pdf.PdfDictionary;
-import com.lowagie.text.pdf.codec.GifImage;
-import com.lowagie.text.pdf.codec.PngImage;
-import com.lowagie.text.pdf.codec.TiffImage;
-import com.lowagie.text.pdf.codec.BmpImage;
-import com.lowagie.text.pdf.PdfOCG;
-
-/**
- * An <CODE>Image</CODE> is the representation of a graphic element (JPEG, PNG
- * or GIF) that has to be inserted into the document
- *
- * @see Element
- * @see Rectangle
- */
-
-public abstract class Image extends Rectangle implements Element,
- MarkupAttributes {
-
- // static membervariables
-
- /** this is a kind of image alignment. */
- public static final int DEFAULT = 0;
-
- /** this is a kind of image alignment. */
- public static final int RIGHT = 2;
-
- /** this is a kind of image alignment. */
- public static final int LEFT = 0;
-
- /** this is a kind of image alignment. */
- public static final int MIDDLE = 1;
-
- /** this is a kind of image alignment. */
- public static final int TEXTWRAP = 4;
-
- /** this is a kind of image alignment. */
- public static final int UNDERLYING = 8;
-
- /** This represents a coordinate in the transformation matrix. */
- public static final int AX = 0;
-
- /** This represents a coordinate in the transformation matrix. */
- public static final int AY = 1;
-
- /** This represents a coordinate in the transformation matrix. */
- public static final int BX = 2;
-
- /** This represents a coordinate in the transformation matrix. */
- public static final int BY = 3;
-
- /** This represents a coordinate in the transformation matrix. */
- public static final int CX = 4;
-
- /** This represents a coordinate in the transformation matrix. */
- public static final int CY = 5;
-
- /** This represents a coordinate in the transformation matrix. */
- public static final int DX = 6;
-
- /** This represents a coordinate in the transformation matrix. */
- public static final int DY = 7;
-
- /** type of image */
- public static final int ORIGINAL_NONE = 0;
-
- /** type of image */
- public static final int ORIGINAL_JPEG = 1;
-
- /** type of image */
- public static final int ORIGINAL_PNG = 2;
-
- /** type of image */
- public static final int ORIGINAL_GIF = 3;
-
- /** type of image */
- public static final int ORIGINAL_BMP = 4;
-
- /** type of image */
- public static final int ORIGINAL_TIFF = 5;
-
- /** type of image */
- public static final int ORIGINAL_WMF = 6;
-
- /** type of image */
- public static final int ORIGINAL_PS = 7;
-
- /** Image color inversion */
- protected boolean invert = false;
-
- /** The imagetype. */
- protected int type;
-
- /** The URL of the image. */
- protected URL url;
-
- /** The raw data of the image. */
- protected byte rawData[];
-
- /** The template to be treated as an image. */
- protected PdfTemplate template[] = new PdfTemplate[1];
-
- /** The alignment of the Image. */
- protected int alignment;
-
- /** Text that can be shown instead of the image. */
- protected String alt;
-
- /** This is the absolute X-position of the image. */
- protected float absoluteX = Float.NaN;
-
- /** This is the absolute Y-position of the image. */
- protected float absoluteY = Float.NaN;
-
- /** This is the width of the image without rotation. */
- protected float plainWidth;
-
- /** This is the width of the image without rotation. */
- protected float plainHeight;
-
- /** This is the scaled width of the image taking rotation into account. */
- protected float scaledWidth;
-
- /** This is the original height of the image taking rotation into account. */
- protected float scaledHeight;
-
- /** This is the rotation of the image. */
- protected float rotation;
-
- /** this is the colorspace of a jpeg-image. */
- protected int colorspace = -1;
-
- /**
- * this is the bits per component of the raw image. It also flags a CCITT
- * image.
- */
- protected int bpc = 1;
-
- /** this is the transparency information of the raw image */
- protected int transparency[];
-
- // for the moment these variables are only used for Images in class Table
- // code contributed by Pelikan Stephan
- /** the indentation to the left. */
- protected float indentationLeft = 0;
-
- /** the indentation to the right. */
- protected float indentationRight = 0;
-
- // serial stamping
-
- protected Long mySerialId = getSerialId();
-
- static long serialId = 0;
-
- /** Holds value of property dpiX. */
- protected int dpiX = 0;
-
- /** Holds value of property dpiY. */
- protected int dpiY = 0;
-
- protected boolean mask = false;
-
- protected Image imageMask;
-
- /** Holds value of property interpolation. */
- protected boolean interpolation;
-
- /** if the annotation is not null the image will be clickable. */
- protected Annotation annotation = null;
-
- /** Contains extra markupAttributes */
- protected Properties markupAttributes;
-
- /** ICC Profile attached */
- protected ICC_Profile profile = null;
-
- /** Holds value of property deflated. */
- protected boolean deflated = false;
-
- private PdfDictionary additional = null;
-
- /** Holds value of property smask. */
- private boolean smask;
-
- /** Holds value of property XYRatio. */
- private float XYRatio = 0;
-
- /** Holds value of property originalType. */
- protected int originalType = ORIGINAL_NONE;
-
- /** Holds value of property originalData. */
- protected byte[] originalData;
-
- /** The spacing before the image. */
- protected float spacingBefore;
-
- /** The spacing after the image. */
- protected float spacingAfter;
-
- /**
- * Holds value of property widthPercentage.
- */
- private float widthPercentage = 100;
-
- protected PdfOCG layer;
-
- // constructors
-
- /**
- * Constructs an <CODE>Image</CODE> -object, using an <VAR>url </VAR>.
- *
- * @param url
- * the <CODE>URL</CODE> where the image can be found.
- */
-
- public Image(URL url) {
- super(0, 0);
- this.url = url;
- this.alignment = DEFAULT;
- rotation = 0;
- }
-
- /**
- * Constructs an <CODE>Image</CODE> -object, using an <VAR>url </VAR>.
- *
- * @param image
- * another Image object.
- */
-
- protected Image(Image image) {
- super(image);
- this.type = image.type;
- this.url = image.url;
- this.alignment = image.alignment;
- this.alt = image.alt;
- this.absoluteX = image.absoluteX;
- this.absoluteY = image.absoluteY;
- this.plainWidth = image.plainWidth;
- this.plainHeight = image.plainHeight;
- this.scaledWidth = image.scaledWidth;
- this.scaledHeight = image.scaledHeight;
- this.rotation = image.rotation;
- this.colorspace = image.colorspace;
- this.rawData = image.rawData;
- this.template = image.template;
- this.bpc = image.bpc;
- this.transparency = image.transparency;
- this.mySerialId = image.mySerialId;
- this.invert = image.invert;
- this.dpiX = image.dpiX;
- this.dpiY = image.dpiY;
- this.mask = image.mask;
- this.imageMask = image.imageMask;
- this.interpolation = image.interpolation;
- this.annotation = image.annotation;
- this.markupAttributes = image.markupAttributes;
- this.profile = image.profile;
- this.deflated = image.deflated;
- this.additional = image.additional;
- this.smask = image.smask;
- this.XYRatio = image.XYRatio;
- this.originalData = image.originalData;
- this.originalType = image.originalType;
- this.spacingAfter = image.spacingAfter;
- this.spacingBefore = image.spacingBefore;
- this.widthPercentage = image.widthPercentage;
- this.layer = image.layer;
- }
-
- /**
- * gets an instance of an Image
- *
- * @param image
- * an Image object
- * @return a new Image object
- */
-
- public static Image getInstance(Image image) {
- if (image == null)
- return null;
- try {
- Class cs = image.getClass();
- Constructor constructor = cs
- .getDeclaredConstructor(new Class[] { Image.class });
- return (Image) constructor.newInstance(new Object[] { image });
- } catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- /**
- * Gets an instance of an Image.
- *
- * @param url
- * an URL
- * @return an Image
- * @throws BadElementException
- * @throws MalformedURLException
- * @throws IOException
- */
-
- public static Image getInstance(URL url) throws BadElementException,
- MalformedURLException, IOException {
- InputStream is = null;
- try {
- is = url.openStream();
- int c1 = is.read();
- int c2 = is.read();
- int c3 = is.read();
- int c4 = is.read();
- is.close();
-
- is = null;
- if (c1 == 'G' && c2 == 'I' && c3 == 'F') {
- GifImage gif = new GifImage(url);
- Image img = gif.getImage(1);
- return img;
- }
- if (c1 == 0xFF && c2 == 0xD8) {
- return new Jpeg(url);
- }
- if (c1 == PngImage.PNGID[0] && c2 == PngImage.PNGID[1]
- && c3 == PngImage.PNGID[2] && c4 == PngImage.PNGID[3]) {
- return PngImage.getImage(url);
- }
- if (c1 == '%' && c2 == '!' && c3 == 'P' && c4 == 'S') {
- return new ImgPostscript(url);
- }
- if (c1 == 0xD7 && c2 == 0xCD) {
- return new ImgWMF(url);
- }
- if (c1 == 'B' && c2 == 'M') {
- return BmpImage.getImage(url);
- }
- if ((c1 == 'M' && c2 == 'M' && c3 == 0 && c4 == 42)
- || (c1 == 'I' && c2 == 'I' && c3 == 42 && c4 == 0)) {
- RandomAccessFileOrArray ra = null;
- try {
- if (url.getProtocol().equals("file")) {
- String file = url.getFile();
- ra = new RandomAccessFileOrArray(file);
- } else
- ra = new RandomAccessFileOrArray(url);
- Image img = TiffImage.getTiffImage(ra, 1);
- img.url = url;
- return img;
- } finally {
- if (ra != null)
- ra.close();
- }
-
- }
- throw new IOException(url.toString()
- + " is not a recognized imageformat.");
- } finally {
- if (is != null) {
- is.close();
- }
- }
- }
-
- /**
- * gets an instance of an Image
- *
- * @param imgb
- * raw image date
- * @return an Image object
- * @throws BadElementException
- * @throws MalformedURLException
- * @throws IOException
- */
- public static Image getInstance(byte imgb[]) throws BadElementException,
- MalformedURLException, IOException {
- InputStream is = null;
- try {
- is = new java.io.ByteArrayInputStream(imgb);
- int c1 = is.read();
- int c2 = is.read();
- int c3 = is.read();
- int c4 = is.read();
- is.close();
-
- is = null;
- if (c1 == 'G' && c2 == 'I' && c3 == 'F') {
- GifImage gif = new GifImage(imgb);
- return gif.getImage(1);
- }
- if (c1 == 0xFF && c2 == 0xD8) {
- return new Jpeg(imgb);
- }
- if (c1 == PngImage.PNGID[0] && c2 == PngImage.PNGID[1]
- && c3 == PngImage.PNGID[2] && c4 == PngImage.PNGID[3]) {
- return PngImage.getImage(imgb);
- }
- if (c1 == '%' && c2 == '!' && c3 == 'P' && c4 == 'S') {
- return new ImgPostscript(imgb);
- }
- if (c1 == 0xD7 && c2 == 0xCD) {
- return new ImgWMF(imgb);
- }
- if (c1 == 'B' && c2 == 'M') {
- return BmpImage.getImage(imgb);
- }
- if ((c1 == 'M' && c2 == 'M' && c3 == 0 && c4 == 42)
- || (c1 == 'I' && c2 == 'I' && c3 == 42 && c4 == 0)) {
- RandomAccessFileOrArray ra = null;
- try {
- ra = new RandomAccessFileOrArray(imgb);
- Image img = TiffImage.getTiffImage(ra, 1);
- img.setOriginalData(imgb);
- return img;
- } finally {
- if (ra != null)
- ra.close();
- }
-
- }
- throw new IOException(
- "The byte array is not a recognized imageformat.");
- } finally {
- if (is != null) {
- is.close();
- }
- }
- }
-
- /**
- * Gets an instance of an Image from a java.awt.Image.
- *
- * @param image
- * the <CODE>java.awt.Image</CODE> to convert
- * @param color
- * if different from <CODE>null</CODE> the transparency pixels
- * are replaced by this color
- * @param forceBW
- * if <CODE>true</CODE> the image is treated as black and white
- * @return an object of type <CODE>ImgRaw</CODE>
- * @throws BadElementException
- * on error
- * @throws IOException
- * on error
- */
-
- public static Image getInstance(java.awt.Image image, java.awt.Color color,
- boolean forceBW) throws BadElementException, IOException {
- java.awt.image.PixelGrabber pg = new java.awt.image.PixelGrabber(image,
- 0, 0, -1, -1, true);
- try {
- pg.grabPixels();
- } catch (InterruptedException e) {
- throw new IOException(
- "java.awt.Image Interrupted waiting for pixels!");
- }
- if ((pg.getStatus() & java.awt.image.ImageObserver.ABORT) != 0) {
- throw new IOException("java.awt.Image fetch aborted or errored");
- }
- int w = pg.getWidth();
- int h = pg.getHeight();
- int[] pixels = (int[]) pg.getPixels();
- if (forceBW) {
- int byteWidth = (w / 8) + ((w & 7) != 0 ? 1 : 0);
- byte[] pixelsByte = new byte[byteWidth * h];
-
- int index = 0;
- int size = h * w;
- int transColor = 1;
- if (color != null) {
- transColor = (color.getRed() + color.getGreen()
- + color.getBlue() < 384) ? 0 : 1;
- }
- int transparency[] = null;
- int cbyte = 0x80;
- int wMarker = 0;
- int currByte = 0;
- if (color != null) {
- for (int j = 0; j < size; j++) {
- int alpha = (pixels[j] >> 24) & 0xff;
- if (alpha < 250) {
- if (transColor == 1)
- currByte |= cbyte;
- } else {
- if ((pixels[j] & 0x888) != 0)
- currByte |= cbyte;
- }
- cbyte >>= 1;
- if (cbyte == 0 || wMarker + 1 >= w) {
- pixelsByte[index++] = (byte) currByte;
- cbyte = 0x80;
- currByte = 0;
- }
- ++wMarker;
- if (wMarker >= w)
- wMarker = 0;
- }
- } else {
- for (int j = 0; j < size; j++) {
- if (transparency == null) {
- int alpha = (pixels[j] >> 24) & 0xff;
- if (alpha == 0) {
- transparency = new int[2];
- transparency[0] = transparency[1] = ((pixels[j] & 0x888) != 0) ? 1
- : 0;
- }
- }
- if ((pixels[j] & 0x888) != 0)
- currByte |= cbyte;
- cbyte >>= 1;
- if (cbyte == 0 || wMarker + 1 >= w) {
- pixelsByte[index++] = (byte) currByte;
- cbyte = 0x80;
- currByte = 0;
- }
- ++wMarker;
- if (wMarker >= w)
- wMarker = 0;
- }
- }
- return Image.getInstance(w, h, 1, 1, pixelsByte, transparency);
- } else {
- byte[] pixelsByte = new byte[w * h * 3];
- byte[] smask = null;
-
- int index = 0;
- int size = h * w;
- int red = 255;
- int green = 255;
- int blue = 255;
- if (color != null) {
- red = color.getRed();
- green = color.getGreen();
- blue = color.getBlue();
- }
- int transparency[] = null;
- if (color != null) {
- for (int j = 0; j < size; j++) {
- int alpha = (pixels[j] >> 24) & 0xff;
- if (alpha < 250) {
- pixelsByte[index++] = (byte) red;
- pixelsByte[index++] = (byte) green;
- pixelsByte[index++] = (byte) blue;
- } else {
- pixelsByte[index++] = (byte) ((pixels[j] >> 16) & 0xff);
- pixelsByte[index++] = (byte) ((pixels[j] >> 8) & 0xff);
- pixelsByte[index++] = (byte) ((pixels[j]) & 0xff);
- }
- }
- } else {
- int transparentPixel = 0;
- smask = new byte[w * h];
- boolean shades = false;
- for (int j = 0; j < size; j++) {
- byte alpha = smask[j] = (byte) ((pixels[j] >> 24) & 0xff);
- /* bugfix by Chris Nokleberg */
- if (!shades) {
- if (alpha != 0 && alpha != -1) {
- shades = true;
- } else if (transparency == null) {
- if (alpha == 0) {
- transparentPixel = pixels[j] & 0xffffff;
- transparency = new int[6];
- transparency[0] = transparency[1] = (transparentPixel >> 16) & 0xff;
- transparency[2] = transparency[3] = (transparentPixel >> 8) & 0xff;
- transparency[4] = transparency[5] = transparentPixel & 0xff;
- }
- } else if ((pixels[j] & 0xffffff) != transparentPixel) {
- shades = true;
- }
- }
- pixelsByte[index++] = (byte) ((pixels[j] >> 16) & 0xff);
- pixelsByte[index++] = (byte) ((pixels[j] >> 8) & 0xff);
- pixelsByte[index++] = (byte) ((pixels[j]) & 0xff);
- }
- if (shades)
- transparency = null;
- else
- smask = null;
- }
- Image img = Image.getInstance(w, h, 3, 8, pixelsByte, transparency);
- if (smask != null) {
- Image sm = Image.getInstance(w, h, 1, 8, smask);
- try {
- sm.makeMask();
- img.setImageMask(sm);
- } catch (DocumentException de) {
- throw new ExceptionConverter(de);
- }
- }
- return img;
- }
- }
-
- /**
- * Gets an instance of an Image from a java.awt.Image.
- *
- * @param image
- * the <CODE>java.awt.Image</CODE> to convert
- * @param color
- * if different from <CODE>null</CODE> the transparency pixels
- * are replaced by this color
- * @return an object of type <CODE>ImgRaw</CODE>
- * @throws BadElementException
- * on error
- * @throws IOException
- * on error
- */
- public static Image getInstance(java.awt.Image image, java.awt.Color color)
- throws BadElementException, IOException {
- return Image.getInstance(image, color, false);
- }
-
- /**
- * Gets an instance of an Image.
- *
- * @param filename
- * a filename
- * @return an object of type <CODE>Gif</CODE>,<CODE>Jpeg</CODE> or
- * <CODE>Png</CODE>
- * @throws BadElementException
- * @throws MalformedURLException
- * @throws IOException
- */
-
- public static Image getInstance(String filename)
- throws BadElementException, MalformedURLException, IOException {
- return getInstance(toURL(filename));
- }
-
- /**
- * Gets an instance of an Image in raw mode.
- *
- * @param width
- * the width of the image in pixels
- * @param height
- * the height of the image in pixels
- * @param components
- * 1,3 or 4 for GrayScale, RGB and CMYK
- * @param data
- * the image data
- * @param bpc
- * bits per component
- * @return an object of type <CODE>ImgRaw</CODE>
- * @throws BadElementException
- * on error
- */
-
- public static Image getInstance(int width, int height, int components,
- int bpc, byte data[]) throws BadElementException {
- return Image.getInstance(width, height, components, bpc, data, null);
- }
-
- /**
- * gets an instance of an Image
- *
- * @param template
- * a PdfTemplate that has to be wrapped in an Image object
- * @return an Image object
- * @throws BadElementException
- */
- public static Image getInstance(PdfTemplate template)
- throws BadElementException {
- return new ImgTemplate(template);
- }
-
- /**
- * Creates an Image with CCITT G3 or G4 compression. It assumes that the
- * data bytes are already compressed.
- *
- * @param width
- * the exact width of the image
- * @param height
- * the exact height of the image
- * @param reverseBits
- * reverses the bits in <code>data</code>. Bit 0 is swapped
- * with bit 7 and so on
- * @param typeCCITT
- * the type of compression in <code>data</code>. It can be
- * CCITTG4, CCITTG31D, CCITTG32D
- * @param parameters
- * parameters associated with this stream. Possible values are
- * CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFLINE and
- * CCITT_ENDOFBLOCK or a combination of them
- * @param data
- * the image data
- * @return an Image object
- * @throws BadElementException
- * on error
- */
- public static Image getInstance(int width, int height, boolean reverseBits,
- int typeCCITT, int parameters, byte[] data)
- throws BadElementException {
- return Image.getInstance(width, height, reverseBits, typeCCITT,
- parameters, data, null);
- }
-
- /**
- * Creates an Image with CCITT G3 or G4 compression. It assumes that the
- * data bytes are already compressed.
- *
- * @param width
- * the exact width of the image
- * @param height
- * the exact height of the image
- * @param reverseBits
- * reverses the bits in <code>data</code>. Bit 0 is swapped
- * with bit 7 and so on
- * @param typeCCITT
- * the type of compression in <code>data</code>. It can be
- * CCITTG4, CCITTG31D, CCITTG32D
- * @param parameters
- * parameters associated with this stream. Possible values are
- * CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFLINE and
- * CCITT_ENDOFBLOCK or a combination of them
- * @param data
- * the image data
- * @param transparency
- * transparency information in the Mask format of the image
- * dictionary
- * @return an Image object
- * @throws BadElementException
- * on error
- */
- public static Image getInstance(int width, int height, boolean reverseBits,
- int typeCCITT, int parameters, byte[] data, int transparency[])
- throws BadElementException {
- if (transparency != null && transparency.length != 2)
- throw new BadElementException(
- "Transparency length must be equal to 2 with CCITT images");
- Image img = new ImgCCITT(width, height, reverseBits, typeCCITT,
- parameters, data);
- img.transparency = transparency;
- return img;
- }
-
- /**
- * Gets an instance of an Image in raw mode.
- *
- * @param width
- * the width of the image in pixels
- * @param height
- * the height of the image in pixels
- * @param components
- * 1,3 or 4 for GrayScale, RGB and CMYK
- * @param data
- * the image data
- * @param bpc
- * bits per component
- * @param transparency
- * transparency information in the Mask format of the image
- * dictionary
- * @return an object of type <CODE>ImgRaw</CODE>
- * @throws BadElementException
- * on error
- */
-
- public static Image getInstance(int width, int height, int components,
- int bpc, byte data[], int transparency[])
- throws BadElementException {
- if (transparency != null && transparency.length != components * 2)
- throw new BadElementException(
- "Transparency length must be equal to (componentes * 2)");
- if (components == 1 && bpc == 1) {
- byte g4[] = CCITTG4Encoder.compress(data, width, height);
- return Image.getInstance(width, height, false, Image.CCITTG4,
- Image.CCITT_BLACKIS1, g4, transparency);
- }
- Image img = new ImgRaw(width, height, components, bpc, data);
- img.transparency = transparency;
- return img;
- }
-
- /**
- * Returns an <CODE>Image</CODE> that has been constructed taking in
- * account the value of some <VAR>attributes </VAR>.
- *
- * @param attributes
- * Some attributes
- * @return an <CODE>Image</CODE>
- * @throws BadElementException
- * @throws MalformedURLException
- * @throws IOException
- */
-
- public static Image getInstance(Properties attributes)
- throws BadElementException, MalformedURLException, IOException {
- String value = (String) attributes.remove(ElementTags.URL);
- if (value == null)
- throw new MalformedURLException("The URL of the image is missing.");
- Image image = Image.getInstance(value);
- int align = 0;
- if ((value = (String) attributes.remove(ElementTags.ALIGN)) != null) {
- if (ElementTags.ALIGN_LEFT.equalsIgnoreCase(value))
- align |= Image.LEFT;
- else if (ElementTags.ALIGN_RIGHT.equalsIgnoreCase(value))
- align |= Image.RIGHT;
- else if (ElementTags.ALIGN_MIDDLE.equalsIgnoreCase(value))
- align |= Image.MIDDLE;
- }
- if ((value = (String) attributes.remove(ElementTags.UNDERLYING)) != null) {
- if (new Boolean(value).booleanValue())
- align |= Image.UNDERLYING;
- }
- if ((value = (String) attributes.remove(ElementTags.TEXTWRAP)) != null) {
- if (new Boolean(value).booleanValue())
- align |= Image.TEXTWRAP;
- }
- image.setAlignment(align);
- if ((value = (String) attributes.remove(ElementTags.ALT)) != null) {
- image.setAlt(value);
- }
- String x;
- String y;
- if (((x = (String) attributes.remove(ElementTags.ABSOLUTEX)) != null)
- && ((y = (String) attributes.remove(ElementTags.ABSOLUTEY)) != null)) {
- image.setAbsolutePosition(Float.valueOf(x + "f").floatValue(),
- Float.valueOf(y + "f").floatValue());
- }
- if ((value = (String) attributes.remove(ElementTags.PLAINWIDTH)) != null) {
- image.scaleAbsoluteWidth(Float.valueOf(value + "f").floatValue());
- }
- if ((value = (String) attributes.remove(ElementTags.PLAINHEIGHT)) != null) {
- image.scaleAbsoluteHeight(Float.valueOf(value + "f").floatValue());
- }
- if ((value = (String) attributes.remove(ElementTags.ROTATION)) != null) {
- image.setRotation(Float.valueOf(value + "f").floatValue());
- }
- if (attributes.size() > 0)
- image.setMarkupAttributes(attributes);
- return image;
- }
-
- // methods to set information
-
- /**
- * Sets the alignment for the image.
- *
- * @param alignment
- * the alignment
- */
-
- public void setAlignment(int alignment) {
- this.alignment = alignment;
- }
-
- /**
- * Sets the alternative information for the image.
- *
- * @param alt
- * the alternative information
- */
-
- public void setAlt(String alt) {
- this.alt = alt;
- }
-
- /**
- * Sets the absolute position of the <CODE>Image</CODE>.
- *
- * @param absoluteX
- * @param absoluteY
- */
-
- public void setAbsolutePosition(float absoluteX, float absoluteY) {
- this.absoluteX = absoluteX;
- this.absoluteY = absoluteY;
- }
-
- /**
- * Scale the image to an absolute width and an absolute height.
- *
- * @param newWidth
- * the new width
- * @param newHeight
- * the new height
- */
-
- public void scaleAbsolute(float newWidth, float newHeight) {
- plainWidth = newWidth;
- plainHeight = newHeight;
- float[] matrix = matrix();
- scaledWidth = matrix[DX] - matrix[CX];
- scaledHeight = matrix[DY] - matrix[CY];
- }
-
- /**
- * Scale the image to an absolute width.
- *
- * @param newWidth
- * the new width
- */
-
- public void scaleAbsoluteWidth(float newWidth) {
- plainWidth = newWidth;
- float[] matrix = matrix();
- scaledWidth = matrix[DX] - matrix[CX];
- scaledHeight = matrix[DY] - matrix[CY];
- }
-
- /**
- * Scale the image to an absolute height.
- *
- * @param newHeight
- * the new height
- */
-
- public void scaleAbsoluteHeight(float newHeight) {
- plainHeight = newHeight;
- float[] matrix = matrix();
- scaledWidth = matrix[DX] - matrix[CX];
- scaledHeight = matrix[DY] - matrix[CY];
- }
-
- /**
- * Scale the image to a certain percentage.
- *
- * @param percent
- * the scaling percentage
- */
-
- public void scalePercent(float percent) {
- scalePercent(percent, percent);
- }
-
- /**
- * Scale the width and height of an image to a certain percentage.
- *
- * @param percentX
- * the scaling percentage of the width
- * @param percentY
- * the scaling percentage of the height
- */
-
- public void scalePercent(float percentX, float percentY) {
- plainWidth = (width() * percentX) / 100f;
- plainHeight = (height() * percentY) / 100f;
- float[] matrix = matrix();
- scaledWidth = matrix[DX] - matrix[CX];
- scaledHeight = matrix[DY] - matrix[CY];
- }
-
- /**
- * Scales the image so that it fits a certain width and height.
- *
- * @param fitWidth
- * the width to fit
- * @param fitHeight
- * the height to fit
- */
-
- public void scaleToFit(float fitWidth, float fitHeight) {
- float percentX = (fitWidth * 100) / width();
- float percentY = (fitHeight * 100) / height();
- scalePercent(percentX < percentY ? percentX : percentY);
- }
-
- /**
- * Sets the rotation of the image in radians.
- *
- * @param r
- * rotation in radians
- */
-
- public void setRotation(float r) {
- double d = Math.PI; //__IDS__
- rotation = (float) (r % (2.0 * d)); //__IDS__
- if (rotation < 0) {
- rotation += 2.0 * d; //__IDS__
- }
- float[] matrix = matrix();
- scaledWidth = matrix[DX] - matrix[CX];
- scaledHeight = matrix[DY] - matrix[CY];
- }
-
- /**
- * Sets the rotation of the image in degrees.
- *
- * @param deg
- * rotation in degrees
- */
-
- public void setRotationDegrees(float deg) {
- double d = Math.PI; //__IDS__
- setRotation(deg / 180 * (float) d); //__IDS__
- }
-
- /**
- * Sets the annotation of this Image.
- *
- * @param annotation
- * the annotation
- */
-
- public void setAnnotation(Annotation annotation) {
- this.annotation = annotation;
- }
-
- /**
- * Gets the annotation.
- *
- * @return the annotation that is linked to this image
- */
-
- public Annotation annotation() {
- return annotation;
- }
-
- // methods to retrieve information
-
- /**
- * Gets the bpc for the image.
- * <P>
- * Remark: this only makes sense for Images of the type <CODE>RawImage
- * </CODE>.
- *
- * @return a bpc value
- */
-
- public int bpc() {
- return bpc;
- }
-
- /**
- * Gets the raw data for the image.
- * <P>
- * Remark: this only makes sense for Images of the type <CODE>RawImage
- * </CODE>.
- *
- * @return the raw data
- */
-
- public byte[] rawData() {
- return rawData;
- }
-
- /**
- * Gets the template to be used as an image.
- * <P>
- * Remark: this only makes sense for Images of the type <CODE>ImgTemplate
- * </CODE>.
- *
- * @return the template
- */
-
- public PdfTemplate templateData() {
- return template[0];
- }
-
- /**
- * Sets data from a PdfTemplate
- *
- * @param template
- * the template with the content
- */
- public void setTemplateData(PdfTemplate template) {
- this.template[0] = template;
- }
-
- /**
- * Checks if the <CODE>Images</CODE> has to be added at an absolute
- * position.
- *
- * @return a boolean
- */
-
- public boolean hasAbsolutePosition() {
- return !Float.isNaN(absoluteY);
- }
-
- /**
- * Checks if the <CODE>Images</CODE> has to be added at an absolute X
- * position.
- *
- * @return a boolean
- */
-
- public boolean hasAbsoluteX() {
- return !Float.isNaN(absoluteX);
- }
-
- /**
- * Returns the absolute X position.
- *
- * @return a position
- */
-
- public float absoluteX() {
- return absoluteX;
- }
-
- /**
- * Returns the absolute Y position.
- *
- * @return a position
- */
-
- public float absoluteY() {
- return absoluteY;
- }
-
- /**
- * Returns the type.
- *
- * @return a type
- */
-
- public int type() {
- return type;
- }
-
- /**
- * Returns <CODE>true</CODE> if the image is a <CODE>Jpeg</CODE>
- * -object.
- *
- * @return a <CODE>boolean</CODE>
- */
-
- public boolean isJpeg() {
- return type == JPEG;
- }
-
- /**
- * Returns <CODE>true</CODE> if the image is a <CODE>ImgRaw</CODE>
- * -object.
- *
- * @return a <CODE>boolean</CODE>
- */
-
- public boolean isImgRaw() {
- return type == IMGRAW;
- }
-
- /**
- * Returns <CODE>true</CODE> if the image is an <CODE>ImgTemplate</CODE>
- * -object.
- *
- * @return a <CODE>boolean</CODE>
- */
-
- public boolean isImgTemplate() {
- return type == IMGTEMPLATE;
- }
-
- /**
- * Gets the <CODE>String</CODE> -representation of the reference to the
- * image.
- *
- * @return a <CODE>String</CODE>
- */
-
- public URL url() {
- return url;
- }
-
- /**
- * Gets the alignment for the image.
- *
- * @return a value
- */
-
- public int alignment() {
- return alignment;
- }
-
- /**
- * Gets the alternative text for the image.
- *
- * @return a <CODE>String</CODE>
- */
-
- public String alt() {
- return alt;
- }
-
- /**
- * Gets the scaled width of the image.
- *
- * @return a value
- */
-
- public float scaledWidth() {
- return scaledWidth;
- }
-
- /**
- * Gets the scaled height of the image.
- *
- * @return a value
- */
-
- public float scaledHeight() {
- return scaledHeight;
- }
-
- /**
- * Gets the colorspace for the image.
- * <P>
- * Remark: this only makes sense for Images of the type <CODE>Jpeg</CODE>.
- *
- * @return a colorspace value
- */
-
- public int colorspace() {
- return colorspace;
- }
-
- /**
- * Returns the transformation matrix of the image.
- *
- * @return an array [AX, AY, BX, BY, CX, CY, DX, DY]
- */
-
- public float[] matrix() {
- float[] matrix = new float[8];
- float cosX = (float) Math.cos(rotation);
- float sinX = (float) Math.sin(rotation);
- matrix[AX] = plainWidth * cosX;
- matrix[AY] = plainWidth * sinX;
- matrix[BX] = (-plainHeight) * sinX;
- matrix[BY] = plainHeight * cosX;
- if (rotation < Math.PI / 2f) {
- matrix[CX] = matrix[BX];
- matrix[CY] = 0;
- matrix[DX] = matrix[AX];
- matrix[DY] = matrix[AY] + matrix[BY];
- } else if (rotation < Math.PI) {
- matrix[CX] = matrix[AX] + matrix[BX];
- matrix[CY] = matrix[BY];
- matrix[DX] = 0;
- matrix[DY] = matrix[AY];
- } else if (rotation < Math.PI * 1.5f) {
- matrix[CX] = matrix[AX];
- matrix[CY] = matrix[AY] + matrix[BY];
- matrix[DX] = matrix[BX];
- matrix[DY] = 0;
- } else {
- matrix[CX] = 0;
- matrix[CY] = matrix[AY];
- matrix[DX] = matrix[AX] + matrix[BX];
- matrix[DY] = matrix[BY];
- }
- return matrix;
- }
-
- /**
- * This method is an alternative for the <CODE>InputStream.skip()</CODE>
- * -method that doesn't seem to work properly for big values of <CODE>size
- * </CODE>.
- *
- * @param is
- * the <CODE>InputStream</CODE>
- * @param size
- * the number of bytes to skip
- * @throws IOException
- */
-
- static public void skip(InputStream is, int size) throws IOException {
- while (size > 0) {
- size -= is.skip(size);
- }
- }
-
- /**
- * This method makes a valid URL from a given filename.
- * <P>
- * This method makes the conversion of this library from the JAVA 2 platform
- * to a JDK1.1.x-version easier.
- *
- * @param filename
- * a given filename
- * @return a valid URL
- * @throws MalformedURLException
- */
-
- public static URL toURL(String filename) throws MalformedURLException {
- if (filename.startsWith("file:/") || filename.startsWith("http://")
- || filename.startsWith("https://")
- || filename.startsWith("jar:")) {
- return new URL(filename);
- }
- File f = new File(filename);
- String path = f.getAbsolutePath();
- if (File.separatorChar != '/') {
- path = path.replace(File.separatorChar, '/');
- }
- if (!path.startsWith("/")) {
- path = "/" + path;
- }
- if (!path.endsWith("/") && f.isDirectory()) {
- path = path + "/";
- }
- return new URL("file", "", path);
- }
-
- /**
- * Returns the transparency.
- *
- * @return the transparency values
- */
-
- public int[] getTransparency() {
- return transparency;
- }
-
- /**
- * Sets the transparency values
- *
- * @param transparency
- * the transparency values
- */
- public void setTransparency(int transparency[]) {
- this.transparency = transparency;
- }
-
- /**
- * Checks if a given tag corresponds with this object.
- *
- * @param tag
- * the given tag
- * @return true if the tag corresponds
- */
-
- public static boolean isTag(String tag) {
- return ElementTags.IMAGE.equals(tag);
- }
-
- /**
- * Gets the plain width of the image.
- *
- * @return a value
- */
-
- public float plainWidth() {
- return plainWidth;
- }
-
- /**
- * Gets the plain height of the image.
- *
- * @return a value
- */
-
- public float plainHeight() {
- return plainHeight;
- }
-
- static protected synchronized Long getSerialId() {
- ++serialId;
- return new Long(serialId);
- }
-
- /**
- * Returns a serial id for the Image (reuse the same image more than once)
- *
- * @return a serialId
- */
- public Long getMySerialId() {
- return mySerialId;
- }
-
- /**
- * Gets the dots-per-inch in the X direction. Returns 0 if not available.
- *
- * @return the dots-per-inch in the X direction
- */
- public int getDpiX() {
- return dpiX;
- }
-
- /**
- * Gets the dots-per-inch in the Y direction. Returns 0 if not available.
- *
- * @return the dots-per-inch in the Y direction
- */
- public int getDpiY() {
- return dpiY;
- }
-
- /**
- * Sets the dots per inch value
- *
- * @param dpiX
- * dpi for x coordinates
- * @param dpiY
- * dpi for y coordinates
- */
- public void setDpi(int dpiX, int dpiY) {
- this.dpiX = dpiX;
- this.dpiY = dpiY;
- }
-
- /**
- * Returns <CODE>true</CODE> if this <CODE>Image</CODE> has the
- * requisites to be a mask.
- *
- * @return <CODE>true</CODE> if this <CODE>Image</CODE> can be a mask
- */
- public boolean isMaskCandidate() {
- if (type == IMGRAW) {
- if (bpc > 0xff)
- return true;
- }
- return colorspace == 1;
- }
-
- /**
- * Make this <CODE>Image</CODE> a mask.
- *
- * @throws DocumentException
- * if this <CODE>Image</CODE> can not be a mask
- */
- public void makeMask() throws DocumentException {
- if (!isMaskCandidate())
- throw new DocumentException("This image can not be an image mask.");
- mask = true;
- }
-
- /**
- * Sets the explicit masking.
- *
- * @param mask
- * the mask to be applied
- * @throws DocumentException
- * on error
- */
- public void setImageMask(Image mask) throws DocumentException {
- if (this.mask)
- throw new DocumentException(
- "An image mask cannot contain another image mask.");
- if (!mask.mask)
- throw new DocumentException(
- "The image mask is not a mask. Did you do makeMask()?");
- imageMask = mask;
- smask = (mask.bpc > 1 && mask.bpc <= 8);
- }
-
- /**
- * Gets the explicit masking.
- *
- * @return the explicit masking
- */
- public Image getImageMask() {
- return imageMask;
- }
-
- /**
- * Returns <CODE>true</CODE> if this <CODE>Image</CODE> is a mask.
- *
- * @return <CODE>true</CODE> if this <CODE>Image</CODE> is a mask
- */
- public boolean isMask() {
- return mask;
- }
-
- /**
- * Inverts the meaning of the bits of a mask.
- *
- * @param invert
- * <CODE>true</CODE> to invert the meaning of the bits of a
- * mask
- */
- public void setInvertMask(boolean invert) {
- this.invert = invert;
- }
-
- /**
- * Returns <CODE>true</CODE> if the bits are to be inverted in the mask.
- *
- * @return <CODE>true</CODE> if the bits are to be inverted in the mask
- */
- public boolean isInvertMask() {
- return invert;
- }
-
- /**
- * Getter for the inverted value
- *
- * @return true if the image is inverted
- */
- public boolean isInverted() {
- return invert;
- }
-
- /**
- * Sets inverted true or false
- *
- * @param invert
- * true or false
- */
- public void setInverted(boolean invert) {
- this.invert = invert;
- }
-
- /**
- * Getter for property interpolation.
- *
- * @return Value of property interpolation.
- */
- public boolean isInterpolation() {
- return interpolation;
- }
-
- /**
- * Sets the image interpolation. Image interpolation attempts to produce a
- * smooth transition between adjacent sample values.
- *
- * @param interpolation
- * New value of property interpolation.
- */
- public void setInterpolation(boolean interpolation) {
- this.interpolation = interpolation;
- }
-
- /**
- * @see com.lowagie.text.MarkupAttributes#setMarkupAttribute(java.lang.String,
- * java.lang.String)
- */
- public void setMarkupAttribute(String name, String value) {
- if (markupAttributes == null) markupAttributes = new Properties();
- markupAttributes.put(name, value);
- }
-
- /**
- * @see com.lowagie.text.MarkupAttributes#setMarkupAttributes(java.util.Properties)
- */
- public void setMarkupAttributes(Properties markupAttributes) {
- this.markupAttributes = markupAttributes;
- }
-
- /**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttribute(java.lang.String)
- */
- public String getMarkupAttribute(String name) {
- return (markupAttributes == null) ? null : String
- .valueOf(markupAttributes.get(name));
- }
-
- /**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttributeNames()
- */
- public Set getMarkupAttributeNames() {
- return Chunk.getKeySet(markupAttributes);
- }
-
- /**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttributes()
- */
- public Properties getMarkupAttributes() {
- return markupAttributes;
- }
-
- /**
- * Tags this image with an ICC profile.
- *
- * @param profile
- * the profile
- */
- public void tagICC(ICC_Profile profile) {
- this.profile = profile;
- }
-
- /**
- * Checks is the image has an ICC profile.
- *
- * @return the ICC profile or <CODE>null</CODE>
- */
- public boolean hasICCProfile() {
- return (this.profile != null);
- }
-
- /**
- * Gets the images ICC profile.
- *
- * @return the ICC profile
- */
- public ICC_Profile getICCProfile() {
- return profile;
- }
-
- /**
- * Getter for property deflated.
- *
- * @return Value of property deflated.
- *
- */
- public boolean isDeflated() {
- return this.deflated;
- }
-
- /**
- * Setter for property deflated.
- *
- * @param deflated
- * New value of property deflated.
- *
- */
- public void setDeflated(boolean deflated) {
- this.deflated = deflated;
- }
-
- /**
- * Getter for property indexed.
- *
- * @return Value of property indexed.
- *
- */
- public PdfDictionary getAdditional() {
- return this.additional;
- }
-
- /**
- * Sets the /Colorspace key.
- *
- * @param additional
- * New value of property indexed.
- */
- public void setAdditional(PdfDictionary additional) {
- this.additional = additional;
- }
-
- /**
- * Getter for property smask.
- *
- * @return Value of property smask.
- *
- */
- public boolean isSmask() {
- return this.smask;
- }
-
- /**
- * Setter for property smask.
- *
- * @param smask
- * New value of property smask.
- *
- */
- public void setSmask(boolean smask) {
- this.smask = smask;
- }
-
- /**
- * Gets the X/Y pixel dimensionless aspect ratio.
- *
- * @return the X/Y pixel dimensionless aspect ratio
- */
- public float getXYRatio() {
- return this.XYRatio;
- }
-
- /**
- * Sets the X/Y pixel dimensionless aspect ratio.
- *
- * @param XYRatio
- * the X/Y pixel dimensionless aspect ratio
- */
- public void setXYRatio(float XYRatio) {
- this.XYRatio = XYRatio;
- }
-
- /**
- * Gets the left indentation.
- *
- * @return the left indentation
- */
- public float indentationLeft() {
- return indentationLeft;
- }
-
- /**
- * Gets the right indentation.
- *
- * @return the right indentation
- */
- public float indentationRight() {
- return indentationRight;
- }
-
- /**
- * Sets the left indentation.
- *
- * @param f
- */
- public void setIndentationLeft(float f) {
- indentationLeft = f;
- }
-
- /**
- * Sets the right indentation.
- *
- * @param f
- */
- public void setIndentationRight(float f) {
- indentationRight = f;
- }
-
- /**
- * Getter for property originalType.
- *
- * @return Value of property originalType.
- *
- */
- public int getOriginalType() {
- return this.originalType;
- }
-
- /**
- * Setter for property originalType.
- *
- * @param originalType
- * New value of property originalType.
- *
- */
- public void setOriginalType(int originalType) {
- this.originalType = originalType;
- }
-
- /**
- * Getter for property originalData.
- *
- * @return Value of property originalData.
- *
- */
- public byte[] getOriginalData() {
- return this.originalData;
- }
-
- /**
- * Setter for property originalData.
- *
- * @param originalData
- * New value of property originalData.
- *
- */
- public void setOriginalData(byte[] originalData) {
- this.originalData = originalData;
- }
-
- /**
- * Sets the url of the image
- *
- * @param url
- * the url of the image
- */
- public void setUrl(URL url) {
- this.url = url;
- }
-
- /**
- * Sets the spacing before this image.
- *
- * @param spacing
- * the new spacing
- */
-
- public void setSpacingBefore(float spacing) {
- this.spacingBefore = spacing;
- }
-
- /**
- * Sets the spacing after this image.
- *
- * @param spacing
- * the new spacing
- */
-
- public void setSpacingAfter(float spacing) {
- this.spacingAfter = spacing;
- }
-
- /**
- * Gets the spacing before this image.
- *
- * @return the spacing
- */
-
- public float spacingBefore() {
- return spacingBefore;
- }
-
- /**
- * Gets the spacing before this image.
- *
- * @return the spacing
- */
-
- public float spacingAfter() {
- return spacingAfter;
- }
-
- /**
- * Getter for property widthPercentage.
- *
- * @return Value of property widthPercentage.
- */
- public float getWidthPercentage() {
- return this.widthPercentage;
- }
-
- /**
- * Setter for property widthPercentage.
- *
- * @param widthPercentage
- * New value of property widthPercentage.
- */
- public void setWidthPercentage(float widthPercentage) {
- this.widthPercentage = widthPercentage;
- }
-
- /**
- * Gets the layer this image belongs to.
- *
- * @return the layer this image belongs to or <code>null</code> for no
- * layer defined
- */
- public PdfOCG getLayer() {
- return layer;
- }
-
- /**
- * Sets the layer this image belongs to.
- *
- * @param layer
- * the layer this image belongs to
- */
- public void setLayer(PdfOCG layer) {
- this.layer = layer;
- }
-
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/ImgCCITT.java b/LibrarySource/com/lowagie/text/ImgCCITT.java
deleted file mode 100644
index 9ef99f0..0000000
--- a/LibrarySource/com/lowagie/text/ImgCCITT.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * $Id: ImgCCITT.java,v 1.14 2002/08/23 08:59:32 blowagie Exp $
- * $Name: $
- *
- * Copyright 2000, 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.net.URL;
-
-/**
- * CCITT Image data that has to be inserted into the document
- *
- * @see Element
- * @see Image
- *
- * @author Paulo Soares
- */
-
-public class ImgCCITT extends Image implements Element {
- /** A table to do fast bit reversal.
- */
- static final byte bitReversal[] = {
- (byte)0x00, (byte)0x80, (byte)0x40, (byte)0xc0, (byte)0x20, (byte)0xa0, (byte)0x60, (byte)0xe0,
- (byte)0x10, (byte)0x90, (byte)0x50, (byte)0xd0, (byte)0x30, (byte)0xb0, (byte)0x70, (byte)0xf0,
- (byte)0x08, (byte)0x88, (byte)0x48, (byte)0xc8, (byte)0x28, (byte)0xa8, (byte)0x68, (byte)0xe8,
- (byte)0x18, (byte)0x98, (byte)0x58, (byte)0xd8, (byte)0x38, (byte)0xb8, (byte)0x78, (byte)0xf8,
- (byte)0x04, (byte)0x84, (byte)0x44, (byte)0xc4, (byte)0x24, (byte)0xa4, (byte)0x64, (byte)0xe4,
- (byte)0x14, (byte)0x94, (byte)0x54, (byte)0xd4, (byte)0x34, (byte)0xb4, (byte)0x74, (byte)0xf4,
- (byte)0x0c, (byte)0x8c, (byte)0x4c, (byte)0xcc, (byte)0x2c, (byte)0xac, (byte)0x6c, (byte)0xec,
- (byte)0x1c, (byte)0x9c, (byte)0x5c, (byte)0xdc, (byte)0x3c, (byte)0xbc, (byte)0x7c, (byte)0xfc,
- (byte)0x02, (byte)0x82, (byte)0x42, (byte)0xc2, (byte)0x22, (byte)0xa2, (byte)0x62, (byte)0xe2,
- (byte)0x12, (byte)0x92, (byte)0x52, (byte)0xd2, (byte)0x32, (byte)0xb2, (byte)0x72, (byte)0xf2,
- (byte)0x0a, (byte)0x8a, (byte)0x4a, (byte)0xca, (byte)0x2a, (byte)0xaa, (byte)0x6a, (byte)0xea,
- (byte)0x1a, (byte)0x9a, (byte)0x5a, (byte)0xda, (byte)0x3a, (byte)0xba, (byte)0x7a, (byte)0xfa,
- (byte)0x06, (byte)0x86, (byte)0x46, (byte)0xc6, (byte)0x26, (byte)0xa6, (byte)0x66, (byte)0xe6,
- (byte)0x16, (byte)0x96, (byte)0x56, (byte)0xd6, (byte)0x36, (byte)0xb6, (byte)0x76, (byte)0xf6,
- (byte)0x0e, (byte)0x8e, (byte)0x4e, (byte)0xce, (byte)0x2e, (byte)0xae, (byte)0x6e, (byte)0xee,
- (byte)0x1e, (byte)0x9e, (byte)0x5e, (byte)0xde, (byte)0x3e, (byte)0xbe, (byte)0x7e, (byte)0xfe,
- (byte)0x01, (byte)0x81, (byte)0x41, (byte)0xc1, (byte)0x21, (byte)0xa1, (byte)0x61, (byte)0xe1,
- (byte)0x11, (byte)0x91, (byte)0x51, (byte)0xd1, (byte)0x31, (byte)0xb1, (byte)0x71, (byte)0xf1,
- (byte)0x09, (byte)0x89, (byte)0x49, (byte)0xc9, (byte)0x29, (byte)0xa9, (byte)0x69, (byte)0xe9,
- (byte)0x19, (byte)0x99, (byte)0x59, (byte)0xd9, (byte)0x39, (byte)0xb9, (byte)0x79, (byte)0xf9,
- (byte)0x05, (byte)0x85, (byte)0x45, (byte)0xc5, (byte)0x25, (byte)0xa5, (byte)0x65, (byte)0xe5,
- (byte)0x15, (byte)0x95, (byte)0x55, (byte)0xd5, (byte)0x35, (byte)0xb5, (byte)0x75, (byte)0xf5,
- (byte)0x0d, (byte)0x8d, (byte)0x4d, (byte)0xcd, (byte)0x2d, (byte)0xad, (byte)0x6d, (byte)0xed,
- (byte)0x1d, (byte)0x9d, (byte)0x5d, (byte)0xdd, (byte)0x3d, (byte)0xbd, (byte)0x7d, (byte)0xfd,
- (byte)0x03, (byte)0x83, (byte)0x43, (byte)0xc3, (byte)0x23, (byte)0xa3, (byte)0x63, (byte)0xe3,
- (byte)0x13, (byte)0x93, (byte)0x53, (byte)0xd3, (byte)0x33, (byte)0xb3, (byte)0x73, (byte)0xf3,
- (byte)0x0b, (byte)0x8b, (byte)0x4b, (byte)0xcb, (byte)0x2b, (byte)0xab, (byte)0x6b, (byte)0xeb,
- (byte)0x1b, (byte)0x9b, (byte)0x5b, (byte)0xdb, (byte)0x3b, (byte)0xbb, (byte)0x7b, (byte)0xfb,
- (byte)0x07, (byte)0x87, (byte)0x47, (byte)0xc7, (byte)0x27, (byte)0xa7, (byte)0x67, (byte)0xe7,
- (byte)0x17, (byte)0x97, (byte)0x57, (byte)0xd7, (byte)0x37, (byte)0xb7, (byte)0x77, (byte)0xf7,
- (byte)0x0f, (byte)0x8f, (byte)0x4f, (byte)0xcf, (byte)0x2f, (byte)0xaf, (byte)0x6f, (byte)0xef,
- (byte)0x1f, (byte)0x9f, (byte)0x5f, (byte)0xdf, (byte)0x3f, (byte)0xbf, (byte)0x7f, (byte)0xff
- };
-
- /** Reverses the bits in the array.
- * @param data data to reverse bits
- */
- public static void ReverseBits(byte data[]) {
- for (int k = 0; k < data.length; ++k)
- data[k] = bitReversal[(int)data[k] & 0xff];
- }
-
- ImgCCITT(Image image) {
- super(image);
- }
-
- /** Creates an Image with CCITT compression.
- *
- * @param width the exact width of the image
- * @param height the exact height of the image
- * @param reverseBits reverses the bits in <code>data</code>.
- * Bit 0 is swapped with bit 7 and so on
- * @param typeCCITT the type of compression in <code>data</code>. It can be
- * CCITTG4, CCITTG31D, CCITTG32D
- * @param parameters parameters associated with this stream. Possible values are
- * CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFLINE and CCITT_ENDOFBLOCK or a
- * combination of them
- * @param data the image data
- * @throws BadElementException on error
- */
-
- public ImgCCITT(int width, int height, boolean reverseBits, int typeCCITT, int parameters, byte[] data) throws BadElementException{
- super((URL)null);
- if (typeCCITT != CCITTG4 && typeCCITT != CCITTG3_1D && typeCCITT != CCITTG3_2D)
- throw new BadElementException("The CCITT compression type must be CCITTG4, CCITTG3_1D or CCITTG3_2D");
- if (reverseBits)
- ReverseBits(data);
- type = IMGRAW;
- scaledHeight = height;
- setTop(scaledHeight);
- scaledWidth = width;
- setRight(scaledWidth);
- colorspace = parameters;
- bpc = typeCCITT;
- rawData = data;
- plainWidth = width();
- plainHeight = height();
- }
-}
diff --git a/LibrarySource/com/lowagie/text/ImgPostscript.java b/LibrarySource/com/lowagie/text/ImgPostscript.java
deleted file mode 100644
index a2f173c..0000000
--- a/LibrarySource/com/lowagie/text/ImgPostscript.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * $Id: ImgWMF.java,v 1.45 2004/12/14 12:14:31 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.io.*;
-import java.net.*;
-import com.lowagie.text.pdf.*;
-import com.lowagie.text.pdf.codec.postscript.*;
-import java.util.StringTokenizer;
-
-/**
- * An <CODE>ImgPostscript</CODE> is the representation of an EPS
- * that has to be inserted into the document
- *
- * @see Element
- * @see Image
- */
-
-public class ImgPostscript
-extends Image
-implements Element {
-
- // Constructors
-
- ImgPostscript(Image image) {
- super(image);
- }
-
- /**
- * Constructs an <CODE>ImgPostscript</CODE>-object, using an <VAR>url</VAR>.
- *
- * @param url the <CODE>URL</CODE> where the image can be found
- * @throws BadElementException on error
- * @throws IOException on error
- */
-
- public ImgPostscript(URL url) throws BadElementException, IOException {
- super(url);
- processParameters();
- }
-
- /**
- * Constructs an <CODE>ImgPostscript</CODE>-object, using a <VAR>filename</VAR>.
- *
- * @param filename a <CODE>String</CODE>-representation of the file that contains the image.
- * @throws BadElementException on error
- * @throws MalformedURLException on error
- * @throws IOException on error
- */
-
- public ImgPostscript(String filename) throws BadElementException,
- MalformedURLException, IOException {
- this(Image.toURL(filename));
- }
-
- /**
- * Constructs an <CODE>ImgPostscript</CODE>-object from memory.
- *
- * @param img the memory image
- * @throws BadElementException on error
- * @throws IOException on error
- */
-
- public ImgPostscript(byte[] img) throws BadElementException, IOException {
- super( (URL)null);
- rawData = img;
- originalData = img;
- processParameters();
- }
-
- /**
- * This method checks if the image is a valid Postscript and processes some parameters.
- * @throws BadElementException
- * @throws IOException
- */
-
- private void processParameters() throws BadElementException, IOException {
- type = IMGTEMPLATE;
- originalType = ORIGINAL_PS;
- InputStream is = null;
- try {
- String errorID;
- if (rawData == null) {
- is = url.openStream();
- errorID = url.toString();
- }
- else {
- is = new java.io.ByteArrayInputStream(rawData);
- errorID = "Byte array";
- }
- String boundingbox=null;
- Reader r = new BufferedReader(new InputStreamReader(is));
- // StreamTokenizer st = new StreamTokenizer(r);
- while (r.ready()) {
- char c;
- StringBuffer sb = new StringBuffer();
- while ( (c = ( (char) r.read())) != '\n') {
- sb.append(c);
- }
- //System.out.println("<<" + sb.toString() + ">>");
- if (sb.toString().startsWith("%%BoundingBox:")) {
- boundingbox = sb.toString();
-
- }
- if (sb.toString().startsWith("%%TemplateBox:")) {
- boundingbox = sb.toString();
- }
- if (sb.toString().startsWith("%%EndComments")) {
- break;
- }
-
- }
- if(boundingbox==null)return;
- StringTokenizer st=new StringTokenizer(boundingbox,": \r\n");
- st.nextElement();
- String xx1=st.nextToken();
- String yy1=st.nextToken();
- String xx2=st.nextToken();
- String yy2=st.nextToken();
-
- int left = Integer.parseInt(xx1);
- int top = Integer.parseInt(yy1);
- int right = Integer.parseInt(xx2);
- int bottom = Integer.parseInt(yy2);
- int inch = 1;
- dpiX = 72;
- dpiY = 72;
- scaledHeight = (float) (bottom - top) / inch *1f;
- scaledHeight=800;
- setTop(scaledHeight);
- scaledWidth = (float) (right - left) / inch * 1f;
- scaledWidth=800;
- setRight(scaledWidth);
- }
- finally {
- if (is != null) {
- is.close();
- }
- plainWidth = width();
- plainHeight = height();
- }
- }
-
- /** Reads the Postscript into a template.
- * @param template the template to read to
- * @throws IOException on error
- * @throws DocumentException on error
- */
- public void readPostscript(PdfTemplate template) throws IOException,
- DocumentException {
- setTemplateData(template);
- template.setWidth(width());
- template.setHeight(height());
- InputStream is = null;
- try {
- if (rawData == null) {
- is = url.openStream();
- }
- else {
- is = new java.io.ByteArrayInputStream(rawData);
- }
- MetaDoPS meta = new MetaDoPS(is, template);
- meta.readAll();
- }
- finally {
- if (is != null) {
- is.close();
- }
- }
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/ImgRaw.java b/LibrarySource/com/lowagie/text/ImgRaw.java
deleted file mode 100644
index 5332b6f..0000000
--- a/LibrarySource/com/lowagie/text/ImgRaw.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * $Id: ImgRaw.java,v 1.29 2002/08/23 08:59:32 blowagie Exp $
- * $Name: $
- *
- * Copyright 2000, 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.net.URL;
-
-/**
- * Raw Image data that has to be inserted into the document
- *
- * @see Element
- * @see Image
- *
- * @author Paulo Soares
- */
-
-public class ImgRaw extends Image implements Element {
-
- ImgRaw(Image image) {
- super(image);
- }
-
-/** Creats an Image in raw mode.
- *
- * @param width the exact width of the image
- * @param height the exact height of the image
- * @param components 1,3 or 4 for GrayScale, RGB and CMYK
- * @param bpc bits per component. Must be 1,2,4 or 8
- * @param data the image data
- * @throws BadElementException on error
- */
-
- public ImgRaw(int width, int height, int components, int bpc, byte[] data) throws BadElementException{
- super((URL)null);
- type = IMGRAW;
- scaledHeight = height;
- setTop(scaledHeight);
- scaledWidth = width;
- setRight(scaledWidth);
- if (components != 1 && components != 3 && components != 4)
- throw new BadElementException("Components must be 1, 3, or 4.");
- if (bpc != 1 && bpc != 2 && bpc != 4 && bpc != 8)
- throw new BadElementException("Bits-per-component must be 1, 2, 4, or 8.");
- colorspace = components;
- this.bpc = bpc;
- rawData = data;
- plainWidth = width();
- plainHeight = height();
- }
-}
diff --git a/LibrarySource/com/lowagie/text/ImgTemplate.java b/LibrarySource/com/lowagie/text/ImgTemplate.java
deleted file mode 100644
index 222b883..0000000
--- a/LibrarySource/com/lowagie/text/ImgTemplate.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * $Id: ImgTemplate.java,v 1.20 2002/08/23 08:59:32 blowagie Exp $
- * $Name: $
- *
- * Copyright 2000, 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.net.URL;
-import com.lowagie.text.pdf.PdfTemplate;
-
-/**
- * PdfTemplate that has to be inserted into the document
- *
- * @see Element
- * @see Image
- *
- * @author Paulo Soares
- */
-
-public class ImgTemplate extends Image implements Element {
-
- ImgTemplate(Image image) {
- super(image);
- }
-
- /** Creats an Image from a PdfTemplate.
- *
- * @param template the PdfTemplate
- * @throws BadElementException on error
- */
- public ImgTemplate(PdfTemplate template) throws BadElementException{
- super((URL)null);
- if (template == null)
- throw new BadElementException("The template can not be null.");
- if (template.getType() == PdfTemplate.TYPE_PATTERN)
- throw new BadElementException("A pattern can not be used as a template to create an image.");
- type = IMGTEMPLATE;
- scaledHeight = template.getHeight();
- setTop(scaledHeight);
- scaledWidth = template.getWidth();
- setRight(scaledWidth);
- setTemplateData(template);
- plainWidth = width();
- plainHeight = height();
- }
-}
diff --git a/LibrarySource/com/lowagie/text/ImgWMF.java b/LibrarySource/com/lowagie/text/ImgWMF.java
deleted file mode 100644
index 438776b..0000000
--- a/LibrarySource/com/lowagie/text/ImgWMF.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * $Id: ImgWMF.java,v 1.45 2004/12/14 12:14:31 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.io.InputStream;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import com.lowagie.text.pdf.codec.wmf.InputMeta;
-import com.lowagie.text.pdf.codec.wmf.MetaDo;
-import com.lowagie.text.pdf.*;
-
-/**
- * An <CODE>ImgWMF</CODE> is the representation of a windows metafile
- * that has to be inserted into the document
- *
- * @see Element
- * @see Image
- */
-
-public class ImgWMF extends Image implements Element {
-
- // Constructors
-
- ImgWMF(Image image) {
- super(image);
- }
-
- /**
- * Constructs an <CODE>ImgWMF</CODE>-object, using an <VAR>url</VAR>.
- *
- * @param url the <CODE>URL</CODE> where the image can be found
- * @throws BadElementException on error
- * @throws IOException on error
- */
-
- public ImgWMF(URL url) throws BadElementException, IOException {
- super(url);
- processParameters();
- }
-
- /**
- * Constructs an <CODE>ImgWMF</CODE>-object, using a <VAR>filename</VAR>.
- *
- * @param filename a <CODE>String</CODE>-representation of the file that contains the image.
- * @throws BadElementException on error
- * @throws MalformedURLException on error
- * @throws IOException on error
- */
-
- public ImgWMF(String filename) throws BadElementException, MalformedURLException, IOException {
- this(Image.toURL(filename));
- }
-
- /**
- * Constructs an <CODE>ImgWMF</CODE>-object from memory.
- *
- * @param img the memory image
- * @throws BadElementException on error
- * @throws IOException on error
- */
-
- public ImgWMF(byte[] img) throws BadElementException, IOException {
- super((URL)null);
- rawData = img;
- originalData = img;
- processParameters();
- }
-
-/**
- * This method checks if the image is a valid WMF and processes some parameters.
- * @throws BadElementException
- * @throws IOException
- */
-
- private void processParameters() throws BadElementException, IOException {
- type = IMGTEMPLATE;
- originalType = ORIGINAL_WMF;
- InputStream is = null;
- try {
- String errorID;
- if (rawData == null){
- is = url.openStream();
- errorID = url.toString();
- }
- else{
- is = new java.io.ByteArrayInputStream(rawData);
- errorID = "Byte array";
- }
- InputMeta in = new InputMeta(is);
- if (in.readInt() != 0x9AC6CDD7) {
- throw new BadElementException(errorID + " is not a valid placeable windows metafile.");
- }
- in.readWord();
- int left = in.readShort();
- int top = in.readShort();
- int right = in.readShort();
- int bottom = in.readShort();
- int inch = in.readWord();
- dpiX = 72;
- dpiY = 72;
- scaledHeight = (float)(bottom - top) / inch * 72f;
- setTop(scaledHeight);
- scaledWidth = (float)(right - left) / inch * 72f;
- setRight(scaledWidth);
- }
- finally {
- if (is != null) {
- is.close();
- }
- plainWidth = width();
- plainHeight = height();
- }
- }
-
- /** Reads the WMF into a template.
- * @param template the template to read to
- * @throws IOException on error
- * @throws DocumentException on error
- */
- public void readWMF(PdfTemplate template) throws IOException, DocumentException {
- setTemplateData(template);
- template.setWidth(width());
- template.setHeight(height());
- InputStream is = null;
- try {
- if (rawData == null){
- is = url.openStream();
- }
- else{
- is = new java.io.ByteArrayInputStream(rawData);
- }
- MetaDo meta = new MetaDo(is, template);
- meta.readAll();
- }
- finally {
- if (is != null) {
- is.close();
- }
- }
- }
-}
diff --git a/LibrarySource/com/lowagie/text/Jpeg.java b/LibrarySource/com/lowagie/text/Jpeg.java
deleted file mode 100644
index f5485c8..0000000
--- a/LibrarySource/com/lowagie/text/Jpeg.java
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- * $Id: Jpeg.java,v 1.59 2004/12/14 12:33:47 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.io.InputStream;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-/**
- * An <CODE>Jpeg</CODE> is the representation of a graphic element (JPEG)
- * that has to be inserted into the document
- *
- * @see Element
- * @see Image
- */
-
-public class Jpeg extends Image implements Element {
-
- // public static final membervariables
-
- /** This is a type of marker. */
- public static final int NOT_A_MARKER = -1;
-
- /** This is a type of marker. */
- public static final int VALID_MARKER = 0;
-
- /** Acceptable Jpeg markers. */
- public static final int[] VALID_MARKERS = {0xC0, 0xC1, 0xC2};
-
- /** This is a type of marker. */
- public static final int UNSUPPORTED_MARKER = 1;
-
- /** Unsupported Jpeg markers. */
- public static final int[] UNSUPPORTED_MARKERS = {0xC3, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCD, 0xCE, 0xCF};
-
- /** This is a type of marker. */
- public static final int NOPARAM_MARKER = 2;
-
- /** Jpeg markers without additional parameters. */
- public static final int[] NOPARAM_MARKERS = {0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0x01};
-
- /** Marker value */
- public static final int M_APP0 = 0xE0;
- /** Marker value */
- public static final int M_APPE = 0xEE;
-
- /** sequence that is used in all Jpeg files */
- public static final byte JFIF_ID[] = {0x4A, 0x46, 0x49, 0x46, 0x00};
- // Constructors
-
- Jpeg(Image image) {
- super(image);
- }
-
- /**
- * Constructs a <CODE>Jpeg</CODE>-object, using an <VAR>url</VAR>.
- *
- * @param url the <CODE>URL</CODE> where the image can be found
- * @throws BadElementException
- * @throws IOException
- */
-
- public Jpeg(URL url) throws BadElementException, IOException {
- super(url);
- processParameters();
- }
-
- /**
- * Constructs a <CODE>Jpeg</CODE>-object, using an <VAR>url</VAR>.
- *
- * @param url the <CODE>URL</CODE> where the image can be found.
- * @param width new width of the Jpeg
- * @param height new height of the Jpeg
- * @throws BadElementException
- * @throws IOException
- * @deprecated use Image.getInstance(...) to create an Image
- */
-
- public Jpeg(URL url, float width, float height) throws BadElementException, IOException {
- this(url);
- scaledWidth = width;
- scaledHeight = height;
- }
-
- /**
- * Constructs a <CODE>Jpeg</CODE>-object, using a <VAR>filename</VAR>.
- *
- * @param filename a <CODE>String</CODE>-representation of the file that contains the Image.
- * @throws BadElementException
- * @throws MalformedURLException
- * @throws IOException
- * @deprecated use Image.getInstance(...) to create an Image
- */
-
- public Jpeg(String filename) throws BadElementException, MalformedURLException, IOException {
- this(Image.toURL(filename));
- }
-
- /**
- * Constructs a <CODE>Jpeg</CODE>-object, using a <VAR>filename</VAR>.
- *
- * @param filename a <CODE>String</CODE>-representation of the file that contains the Image.
- * @param width new width of the Jpeg
- * @param height new height of the Jpeg
- * @throws BadElementException
- * @throws MalformedURLException
- * @throws IOException
- * @deprecated use Image.getInstance(...) to create an Image
- */
-
- public Jpeg(String filename, float width, float height) throws BadElementException, MalformedURLException, IOException {
- this(Image.toURL(filename), width, height);
- }
-
- /**
- * Constructs a <CODE>Jpeg</CODE>-object from memory.
- *
- * @param img the memory image
- * @throws BadElementException
- * @throws IOException
- */
-
- public Jpeg(byte[] img) throws BadElementException, IOException {
- super((URL)null);
- rawData = img;
- originalData = img;
- processParameters();
- }
-
- /**
- * Constructs a <CODE>Jpeg</CODE>-object from memory.
- *
- * @param img the memory image.
- * @param width the width you want the image to have
- * @param height the height you want the image to have
- * @throws BadElementException
- * @throws IOException
- */
-
- public Jpeg(byte[] img, float width, float height) throws BadElementException, IOException {
- this(img);
- scaledWidth = width;
- scaledHeight = height;
- }
-
- // private static methods
-
- /**
- * Reads a short from the <CODE>InputStream</CODE>.
- *
- * @param is the <CODE>InputStream</CODE>
- * @return an int
- * @throws IOException
- */
-
- private static final int getShort(InputStream is) throws IOException {
- return (is.read() << 8) + is.read();
- }
-
- /**
- * Returns a type of marker.
- *
- * @param marker an int
- * @return a type: <VAR>VALID_MARKER</CODE>, <VAR>UNSUPPORTED_MARKER</VAR> or <VAR>NOPARAM_MARKER</VAR>
- */
-
- private static final int marker(int marker) {
- for (int i = 0; i < VALID_MARKERS.length; i++) {
- if (marker == VALID_MARKERS[i]) {
- return VALID_MARKER;
- }
- }
- for (int i = 0; i < NOPARAM_MARKERS.length; i++) {
- if (marker == NOPARAM_MARKERS[i]) {
- return NOPARAM_MARKER;
- }
- }
- for (int i = 0; i < UNSUPPORTED_MARKERS.length; i++) {
- if (marker == UNSUPPORTED_MARKERS[i]) {
- return UNSUPPORTED_MARKER;
- }
- }
- return NOT_A_MARKER;
- }
-
- // private methods
-
- /**
- * This method checks if the image is a valid JPEG and processes some parameters.
- * @throws BadElementException
- * @throws IOException
- */
-
- private void processParameters() throws BadElementException, IOException {
- type = JPEG;
- originalType = ORIGINAL_JPEG;
- InputStream is = null;
- try {
- String errorID;
- if (rawData == null){
- is = url.openStream();
- errorID = url.toString();
- }
- else{
- is = new java.io.ByteArrayInputStream(rawData);
- errorID = "Byte array";
- }
- if (is.read() != 0xFF || is.read() != 0xD8) {
- throw new BadElementException(errorID + " is not a valid JPEG-file.");
- }
- boolean firstPass = true;
- int len;
- while (true) {
- int v = is.read();
- if (v < 0)
- throw new IOException("Premature EOF while reading JPG.");
- if (v == 0xFF) {
- int marker = is.read();
- if (firstPass && marker == M_APP0) {
- firstPass = false;
- len = getShort(is);
- if (len < 16) {
- skip(is, len - 2);
- continue;
- }
- byte bcomp[] = new byte[JFIF_ID.length];
- int r = is.read(bcomp);
- if (r != bcomp.length)
- throw new BadElementException(errorID + " corrupted JFIF marker.");
- boolean found = true;
- for (int k = 0; k < bcomp.length; ++k) {
- if (bcomp[k] != JFIF_ID[k]) {
- found = false;
- break;
- }
- }
- if (!found) {
- skip(is, len - 2 - bcomp.length);
- continue;
- }
- skip(is, 2);
- int units = is.read();
- int dx = getShort(is);
- int dy = getShort(is);
- if (units == 1) {
- dpiX = dx;
- dpiY = dy;
- }
- else if (units == 2) {
- dpiX = (int)((float)dx * 2.54f + 0.5f);
- dpiY = (int)((float)dy * 2.54f + 0.5f);
- }
- skip(is, len - 2 - bcomp.length - 7);
- continue;
- }
- if (marker == M_APPE) {
- len = getShort(is);
- byte[] byteappe = new byte[len];
- for (int k = 0; k < len; ++k) {
- byteappe[k] = (byte)is.read();
- }
- if (byteappe.length > 12) {
- String appe = new String(byteappe, 0, 5, "ISO-8859-1");
- if (appe.equals("Adobe")) {
- invert = true;
- }
- }
- }
- firstPass = false;
- int markertype = marker(marker);
- if (markertype == VALID_MARKER) {
- skip(is, 2);
- if (is.read() != 0x08) {
- throw new BadElementException(errorID + " must have 8 bits per component.");
- }
- scaledHeight = getShort(is);
- setTop(scaledHeight);
- scaledWidth = getShort(is);
- setRight(scaledWidth);
- colorspace = is.read();
- bpc = 8;
- break;
- }
- else if (markertype == UNSUPPORTED_MARKER) {
- throw new BadElementException(errorID + ": unsupported JPEG marker: " + marker);
- }
- else if (markertype != NOPARAM_MARKER) {
- skip(is, getShort(is) - 2);
- }
- }
- }
- }
- finally {
- if (is != null) {
- is.close();
- }
- plainWidth = width();
- plainHeight = height();
- }
- }
-}
diff --git a/LibrarySource/com/lowagie/text/List.java b/LibrarySource/com/lowagie/text/List.java
deleted file mode 100644
index e4cf8b2..0000000
--- a/LibrarySource/com/lowagie/text/List.java
+++ /dev/null
@@ -1,549 +0,0 @@
-/*
- * $Id: List.java,v 1.74 2005/04/13 09:17:14 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * A <CODE>List</CODE> contains several <CODE>ListItem</CODE>s.
- * <P>
- * <B>Example 1:</B>
- * <BLOCKQUOTE><PRE>
- * <STRONG>List list = new List(true, 20);</STRONG>
- * <STRONG>list.add(new ListItem("First line"));</STRONG>
- * <STRONG>list.add(new ListItem("The second line is longer to see what happens once the end of the line is reached. Will it start on a new line?"));</STRONG>
- * <STRONG>list.add(new ListItem("Third line"));</STRONG>
- * </PRE></BLOCKQUOTE>
- *
- * The result of this code looks like this:
- * <OL>
- * <LI>
- * First line
- * </LI>
- * <LI>
- * The second line is longer to see what happens once the end of the line is reached. Will it start on a new line?
- * </LI>
- * <LI>
- * Third line
- * </LI>
- * </OL>
- *
- * <B>Example 2:</B>
- * <BLOCKQUOTE><PRE>
- * <STRONG>List overview = new List(false, 10);</STRONG>
- * <STRONG>overview.add(new ListItem("This is an item"));</STRONG>
- * <STRONG>overview.add("This is another item");</STRONG>
- * </PRE></BLOCKQUOTE>
- *
- * The result of this code looks like this:
- * <UL>
- * <LI>
- * This is an item
- * </LI>
- * <LI>
- * This is another item
- * </LI>
- * </UL>
- *
- * @see Element
- * @see ListItem
- */
-
-public class List implements TextElementArray, MarkupAttributes {
-
- // membervariables
-
-/** This is the <CODE>ArrayList</CODE> containing the different <CODE>ListItem</CODE>s. */
- protected ArrayList list = new ArrayList();
-
-/** This variable indicates if the list has to be numbered. */
- protected boolean numbered;
- protected boolean lettered;
-
-/** This variable indicates the first number of a numbered list. */
- protected int first = 1;
- protected char firstCh = 'A';
- protected char lastCh = 'Z';
-
-/** This is the listsymbol of a list that is not numbered. */
- protected Chunk symbol = new Chunk("-");
-
-/** The indentation of this list on the left side. */
- protected float indentationLeft = 0;
-
-/** The indentation of this list on the right side. */
- protected float indentationRight = 0;
-
-/** The indentation of the listitems. */
- protected float symbolIndent;
-
-/** Contains extra markupAttributes */
- protected Properties markupAttributes;
-
- // constructors
-
-/**
- * Constructs a <CODE>List</CODE>.
- * <P>
- * Remark: the parameter <VAR>symbolIndent</VAR> is important for instance when
- * generating PDF-documents; it indicates the indentation of the listsymbol.
- * It is not important for HTML-documents.
- *
- * @param numbered a boolean
- * @param symbolIndent the indentation that has to be used for the listsymbol
- */
-
- public List(boolean numbered, float symbolIndent) {
- this.numbered = numbered;
- this.lettered = false;
- this.symbolIndent = symbolIndent;
- }
-
- /**
- * Creates a list
- * @param numbered has the list to be numbered?
- * @param lettered has the list to be 'numbered' with letters
- * @param symbolIndent the indentation of the symbol
- */
- public List(boolean numbered, boolean lettered, float symbolIndent ) {
- this.numbered = numbered;
- this.lettered = lettered;
- this.symbolIndent = symbolIndent;
- }
-
- /**
- * Returns a <CODE>List</CODE> that has been constructed taking in account
- * the value of some <VAR>attributes</VAR>.
- *
- * @param attributes Some attributes
- */
-
- public List(Properties attributes) {
- String value= (String)attributes.remove(ElementTags.LISTSYMBOL);
- if (value == null) {
- value = "-";
- }
- symbol = new Chunk(value, FontFactory.getFont(attributes));
-
- this.numbered = false;
- if ((value = (String)attributes.remove(ElementTags.NUMBERED)) != null) {
- this.numbered = new Boolean(value).booleanValue();
- if ( this.lettered && this.numbered )
- this.lettered = false;
- }
- if ((value = (String)attributes.remove(ElementTags.LETTERED)) != null) {
- this.lettered = new Boolean(value).booleanValue();
- if ( this.numbered && this.lettered )
- this.numbered = false;
- }
- this.symbolIndent = 0;
- if ((value = (String)attributes.remove(ElementTags.SYMBOLINDENT)) != null) {
- this.symbolIndent = Integer.parseInt(value);
- }
-
- if ((value = (String)attributes.remove(ElementTags.FIRST)) != null) {
- char khar = value.charAt(0);
- if ( Character.isLetter( khar ) ) {
- setFirst( khar );
- }
- else {
- setFirst(Integer.parseInt(value));
- }
- }
- if ((value = (String)attributes.remove(ElementTags.INDENTATIONLEFT)) != null) {
- setIndentationLeft(Float.valueOf(value + "f").floatValue());
- }
- if ((value = (String)attributes.remove(ElementTags.INDENTATIONRIGHT)) != null) {
- setIndentationRight(Float.valueOf(value + "f").floatValue());
- }
- if (attributes.size() > 0) setMarkupAttributes(attributes);
- }
-
- // implementation of the Element-methods
-
-/**
- * Processes the element by adding it (or the different parts) to an
- * <CODE>ElementListener</CODE>.
- *
- * @param listener an <CODE>ElementListener</CODE>
- * @return <CODE>true</CODE> if the element was processed successfully
- */
-
- public boolean process(ElementListener listener) {
- try {
- for (Iterator i = list.iterator(); i.hasNext(); ) {
- listener.add((Element) i.next());
- }
- return true;
- }
- catch(DocumentException de) {
- return false;
- }
- }
-
-/**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type() {
- return Element.LIST;
- }
-
-/**
- * Gets all the chunks in this element.
- *
- * @return an <CODE>ArrayList</CODE>
- */
-
- public ArrayList getChunks() {
- ArrayList tmp = new ArrayList();
- for (Iterator i = list.iterator(); i.hasNext(); ) {
- tmp.addAll(((Element) i.next()).getChunks());
- }
- return tmp;
- }
-
- // methods to set the membervariables
-
-/**
- * Adds an <CODE>Object</CODE> to the <CODE>List</CODE>.
- *
- * @param o the object to add.
- * @return true if adding the object succeeded
- */
-
- public boolean add(Object o) {
- if (o instanceof ListItem) {
- ListItem item = (ListItem) o;
- if (numbered || lettered) {
- Chunk chunk;
- if ( numbered )
- chunk = new Chunk(String.valueOf(first + list.size()), symbol.font());
- else
- chunk = new Chunk(nextLetter(), symbol.font());
- chunk.append(".");
- item.setListSymbol(chunk);
- }
- else {
- item.setListSymbol(symbol);
- }
- item.setIndentationLeft(symbolIndent);
- item.setIndentationRight(0);
- list.add(item);
- }
- else if (o instanceof List) {
- List nested = (List) o;
- nested.setIndentationLeft(nested.indentationLeft() + symbolIndent);
- first--;
- return list.add(nested);
- }
- else if (o instanceof String) {
- return this.add(new ListItem((String) o));
- }
- return false;
- }
-
-/**
- * Sets the indentation of this paragraph on the left side.
- *
- * @param indentation the new indentation
- */
-
- public void setIndentationLeft(float indentation) {
- this.indentationLeft = indentation;
- }
-
-/**
- * Sets the indentation of this paragraph on the right side.
- *
- * @param indentation the new indentation
- */
-
- public void setIndentationRight(float indentation) {
- this.indentationRight = indentation;
- }
-
-/**
- * Sets the number that has to come first in the list.
- *
- * @param first a number
- */
-
- public void setFirst(int first) {
- this.first = first;
- }
-
-
-/**
- * Sets the Letter that has to come first in the list.
- *
- * @param first a letter
- */
-
- public void setFirst(char first) {
- this.firstCh = first;
- if ( Character.isLowerCase( this.firstCh )) {
- this.lastCh = 'z';
- }
- else {
- this.lastCh = 'Z';
- }
- }
-
-/**
- * Sets the listsymbol.
- *
- * @param symbol a <CODE>Chunk</CODE>
- */
-
- public void setListSymbol(Chunk symbol) {
- this.symbol = symbol;
- }
-
-/**
- * Sets the listsymbol.
- * <P>
- * This is a shortcut for <CODE>setListSymbol(Chunk symbol)</CODE>.
- *
- * @param symbol a <CODE>String</CODE>
- */
-
- public void setListSymbol(String symbol) {
- this.symbol = new Chunk(symbol);
- }
-
- // methods to retrieve information
-
-/**
- * Gets all the items in the list.
- *
- * @return an <CODE>ArrayList</CODE> containing <CODE>ListItem</CODE>s.
- */
-
- public ArrayList getItems() {
- return list;
- }
-
-/**
- * Gets the size of the list.
- *
- * @return a <CODE>size</CODE>
- */
-
- public int size() {
- return list.size();
- }
-
-/**
- * Gets the leading of the first listitem.
- *
- * @return a <CODE>leading</CODE>
- */
-
- public float leading() {
- if (list.size() < 1) {
- return -1;
- }
- ListItem item = (ListItem) list.get(0);
- return item.leading();
- }
-
-/**
- * Checks if the list is numbered.
- *
- * @return <CODE>true</CODE> if the list is numbered, <CODE>false</CODE> otherwise.
- */
-
- public boolean isNumbered() {
- return numbered;
- }
-
-/**
- * Gets the symbol indentation.
- * @return the symbol indentation
- */
-
- public float symbolIndent() {
- return symbolIndent;
- }
-
-/**
- * Gets the Chunk containing the symbol.
- * @return a Chunk with a symbol
- */
-
- public Chunk symbol() {
- return symbol;
- }
-
-/**
- * Gets the first number .
- * @return a number
- */
-
- public int first() {
- return first;
- }
-
-/**
- * Gets the indentation of this paragraph on the left side.
- *
- * @return the indentation
- */
-
- public float indentationLeft() {
- return indentationLeft;
- }
-
-/**
- * Gets the indentation of this paragraph on the right side.
- *
- * @return the indentation
- */
-
- public float indentationRight() {
- return indentationRight;
- }
-
-/**
- * Checks if a given tag corresponds with the listsymbol tag of this object.
- *
- * @param tag the given tag
- * @return true if the tag corresponds
- */
-
- public static boolean isSymbol(String tag) {
- return ElementTags.LISTSYMBOL.equals(tag);
- }
-
-/**
- * Checks if a given tag corresponds with this object.
- *
- * @param tag the given tag
- * @return true if the tag corresponds
- */
-
- public static boolean isTag(String tag) {
- return ElementTags.LIST.equals(tag);
- }
-
-/**
- * Retrieves the next letter in the sequence
- *
- * @return String contains the next character (A-Z or a-z)
- */
- private String nextLetter() {
- int num_in_list = listItemsInList(); //list.size();
- int max_ival = (lastCh + 0);
- int ival = (firstCh + num_in_list);
- while ( ival > max_ival ) {
- ival -= 26;
- }
- char[] new_char = new char[1];
- new_char[0] = (char) ival;
- String ret = new String( new_char );
- return ret;
- }
-
- /**
- * Counts the number of ListItems in the list ommiting nested lists
- *
- * @return Integer number of ListItems in the list
- */
- private int listItemsInList() {
- int result = 0;
- for (Iterator i = list.iterator(); i.hasNext(); ) {
- if (!(i.next() instanceof List)) result++;
- }
- return result;
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#setMarkupAttribute(java.lang.String, java.lang.String)
- */
- public void setMarkupAttribute(String name, String value) {
- if (markupAttributes == null) markupAttributes = new Properties();
- markupAttributes.put(name, value);
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#setMarkupAttributes(java.util.Properties)
- */
- public void setMarkupAttributes(Properties markupAttributes) {
- this.markupAttributes = markupAttributes;
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttribute(java.lang.String)
- */
- public String getMarkupAttribute(String name) {
- return (markupAttributes == null) ? null : String.valueOf(markupAttributes.get(name));
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttributeNames()
- */
- public Set getMarkupAttributeNames() {
- return Chunk.getKeySet(markupAttributes);
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttributes()
- */
- public Properties getMarkupAttributes() {
- return markupAttributes;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/ListItem.java b/LibrarySource/com/lowagie/text/ListItem.java
deleted file mode 100644
index 474aeb9..0000000
--- a/LibrarySource/com/lowagie/text/ListItem.java
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * $Id: ListItem.java,v 1.78 2005/05/03 13:03:48 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.util.Properties;
-
-import com.lowagie.text.markup.MarkupTags;
-import com.lowagie.text.markup.MarkupParser;
-
-/**
- * A <CODE>ListItem</CODE> is a <CODE>Paragraph</CODE>
- * that can be added to a <CODE>List</CODE>.
- * <P>
- * <B>Example 1:</B>
- * <BLOCKQUOTE><PRE>
- * List list = new List(true, 20);
- * list.add(<STRONG>new ListItem("First line")</STRONG>);
- * list.add(<STRONG>new ListItem("The second line is longer to see what happens once the end of the line is reached. Will it start on a new line?")</STRONG>);
- * list.add(<STRONG>new ListItem("Third line")</STRONG>);
- * </PRE></BLOCKQUOTE>
- *
- * The result of this code looks like this:
- * <OL>
- * <LI>
- * First line
- * </LI>
- * <LI>
- * The second line is longer to see what happens once the end of the line is reached. Will it start on a new line?
- * </LI>
- * <LI>
- * Third line
- * </LI>
- * </OL>
- *
- * <B>Example 2:</B>
- * <BLOCKQUOTE><PRE>
- * List overview = new List(false, 10);
- * overview.add(<STRONG>new ListItem("This is an item")</STRONG>);
- * overview.add("This is another item");
- * </PRE></BLOCKQUOTE>
- *
- * The result of this code looks like this:
- * <UL>
- * <LI>
- * This is an item
- * </LI>
- * <LI>
- * This is another item
- * </LI>
- * </UL>
- *
- * @see Element
- * @see List
- * @see Paragraph
- */
-
-public class ListItem extends Paragraph implements TextElementArray, MarkupAttributes {
-
- // membervariables
-
-/** this is the symbol that wil proceed the listitem. */
- private Chunk symbol;
-
- // constructors
-
-/**
- * Constructs a <CODE>ListItem</CODE>.
- */
-
- public ListItem() {
- super();
- }
-
-/**
- * Constructs a <CODE>ListItem</CODE> with a certain leading.
- *
- * @param leading the leading
- */
-
- public ListItem(float leading) {
- super(leading);
- }
-
-/**
- * Constructs a <CODE>ListItem</CODE> with a certain <CODE>Chunk</CODE>.
- *
- * @param chunk a <CODE>Chunk</CODE>
- */
-
- public ListItem(Chunk chunk) {
- super(chunk);
- }
-
-/**
- * Constructs a <CODE>ListItem</CODE> with a certain <CODE>String</CODE>.
- *
- * @param string a <CODE>String</CODE>
- */
-
- public ListItem(String string) {
- super(string);
- }
-
-/**
- * Constructs a <CODE>ListItem</CODE> with a certain <CODE>String</CODE>
- * and a certain <CODE>Font</CODE>.
- *
- * @param string a <CODE>String</CODE>
- * @param font a <CODE>String</CODE>
- */
-
- public ListItem(String string, Font font) {
- super(string, font);
- }
-
-/**
- * Constructs a <CODE>ListItem</CODE> with a certain <CODE>Chunk</CODE>
- * and a certain leading.
- *
- * @param leading the leading
- * @param chunk a <CODE>Chunk</CODE>
- */
-
- public ListItem(float leading, Chunk chunk) {
- super(leading, chunk);
- }
-
-/**
- * Constructs a <CODE>ListItem</CODE> with a certain <CODE>String</CODE>
- * and a certain leading.
- *
- * @param leading the leading
- * @param string a <CODE>String</CODE>
- */
-
- public ListItem(float leading, String string) {
- super(leading, string);
- }
-
-/**
- * Constructs a <CODE>ListItem</CODE> with a certain leading, <CODE>String</CODE>
- * and <CODE>Font</CODE>.
- *
- * @param leading the leading
- * @param string a <CODE>String</CODE>
- * @param font a <CODE>Font</CODE>
- */
-
- public ListItem(float leading, String string, Font font) {
- super(leading, string, font);
- }
-
-/**
- * Constructs a <CODE>ListItem</CODE> with a certain <CODE>Phrase</CODE>.
- *
- * @param phrase a <CODE>Phrase</CODE>
- */
-
- public ListItem(Phrase phrase) {
- super(phrase);
- }
-
- /**
- * Returns a <CODE>ListItem</CODE> that has been constructed taking in account
- * the value of some <VAR>attributes</VAR>.
- *
- * @param attributes Some attributes
- */
-
- public ListItem(Properties attributes) {
- super("", FontFactory.getFont(attributes));
- String value;
- if ((value = (String)attributes.remove(ElementTags.ITEXT)) != null) {
- add(new Chunk(value));
- }
- if ((value = (String)attributes.remove(ElementTags.LEADING)) != null) {
- setLeading(Float.valueOf(value + "f").floatValue());
- }
- else if ((value = (String)attributes.remove(MarkupTags.CSS_KEY_LINEHEIGHT)) != null) {
- setLeading(MarkupParser.parseLength(value));
- }
- if ((value = (String)attributes.remove(ElementTags.INDENTATIONLEFT)) != null) {
- setIndentationLeft(Float.valueOf(value + "f").floatValue());
- }
- if ((value = (String)attributes.remove(ElementTags.INDENTATIONRIGHT)) != null) {
- setIndentationRight(Float.valueOf(value + "f").floatValue());
- }
- if ((value = (String)attributes.remove(ElementTags.ALIGN)) != null) {
- setAlignment(value);
- }
- if (attributes.size() > 0) setMarkupAttributes(attributes);
- }
-
- // implementation of the Element-methods
-
-/**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type() {
- return Element.LISTITEM;
- }
-
- // methods
-
-/**
- * Sets the listsymbol.
- *
- * @param symbol a <CODE>Chunk</CODE>
- */
-
- public void setListSymbol(Chunk symbol) {
- this.symbol = symbol;
- if (this.symbol.font().isStandardFont()) {
- this.symbol.setFont(font);
- }
- }
-
- // methods to retrieve information
-
-/**
- * Returns the listsymbol.
- *
- * @return a <CODE>Chunk</CODE>
- */
-
- public Chunk listSymbol() {
- return symbol;
- }
-
-/**
- * Checks if a given tag corresponds with this object.
- *
- * @param tag the given tag
- * @return true if the tag corresponds
- */
-
- public static boolean isTag(String tag) {
- return ElementTags.LISTITEM.equals(tag);
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/MarkupAttributes.java b/LibrarySource/com/lowagie/text/MarkupAttributes.java
deleted file mode 100644
index 0c0ec4d..0000000
--- a/LibrarySource/com/lowagie/text/MarkupAttributes.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright 2002 by Matt Benson.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-
-import java.util.Set;
-import java.util.Properties;
-
-
-/**
- * Defines the interface for an <CODE>Element</CODE> with markup attributes--
- * that is, random String-to-String properties for representation in markup
- * languages such as HTML and XML.
- *
- * @author <a href="mailto:orangeherbert at users.sourceforge.net">Matt Benson</a>
- */
-public interface MarkupAttributes extends com.lowagie.text.Element {
-
-/**
- * Sets the specified attribute.
- *
- * @param name <CODE>String</CODE> attribute name.
- * @param value <CODE>String</CODE> attribute value.
- */
- public void setMarkupAttribute(String name, String value);
-
-/**
- * Sets the markupAttributes.
- *
- * @param markupAttributes a <CODE>Properties</CODE>-object containing markupattributes
- */
- public void setMarkupAttributes(Properties markupAttributes);
-
-/**
- * Returns the value of the specified attribute.
- *
- * @param name <CODE>String</CODE> attribute name.
- * @return <CODE>String</CODE>.
- */
- public String getMarkupAttribute(String name);
-
-/**
- * Returns a <CODE>Set</CODE> of <CODE>String</CODE> attribute names for the
- * <CODE>MarkupAttributes</CODE> implementor.
- *
- * @return <CODE>Set</CODE>.
- */
- public Set getMarkupAttributeNames();
-
-/**
- * Return a <CODE>Properties</CODE>-object containing all the markupAttributes.
- *
- * @return <CODE>Properties</CODE>
- */
- public Properties getMarkupAttributes();
-
-}
diff --git a/LibrarySource/com/lowagie/text/Meta.java b/LibrarySource/com/lowagie/text/Meta.java
deleted file mode 100644
index 5b1a1bd..0000000
--- a/LibrarySource/com/lowagie/text/Meta.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * $Id: Meta.java,v 1.65 2005/04/13 09:17:11 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.util.ArrayList;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * This is an <CODE>Element</CODE> that contains
- * some meta information about the document.
- * <P>
- * An object of type <CODE>Meta</CODE> can not be constructed by the user.
- * Userdefined meta information should be placed in a <CODE>Header</CODE>-object.
- * <CODE>Meta</CODE> is reserved for: Subject, Keywords, Author, Title, Producer
- * and Creationdate information.
- *
- * @see Element
- * @see Header
- */
-
-public class Meta implements Element, MarkupAttributes {
-
- // membervariables
-
-/** This is the type of Meta-information this object contains. */
- private int type;
-
-/** This is the content of the Meta-information. */
- private StringBuffer content;
-
-/** Contains extra markupAttributes */
- protected Properties markupAttributes;
-
- // constructors
-
-/**
- * Constructs a <CODE>Meta</CODE>.
- *
- * @param type the type of meta-information
- * @param content the content
- */
-
- Meta(int type, String content) {
- this.type = type;
- this.content = new StringBuffer(content);
- }
-
-/**
- * Constructs a <CODE>Meta</CODE>.
- *
- * @param tag the tagname of the meta-information
- * @param content the content
- */
-
- public Meta(String tag, String content) {
- this.type = Meta.getType(tag);
- this.content = new StringBuffer(content);
- }
-
- // implementation of the Element-methods
-
-/**
- * Processes the element by adding it (or the different parts) to a
- * <CODE>ElementListener</CODE>.
- *
- * @param listener the <CODE>ElementListener</CODE>
- * @return <CODE>true</CODE> if the element was processed successfully
- */
-
- public boolean process(ElementListener listener) {
- try {
- return listener.add(this);
- }
- catch(DocumentException de) {
- return false;
- }
- }
-
-/**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type() {
- return type;
- }
-
-/**
- * Gets all the chunks in this element.
- *
- * @return an <CODE>ArrayList</CODE>
- */
-
- public ArrayList getChunks() {
- return new ArrayList();
- }
-
- // methods
-
-/**
- * appends some text to this <CODE>Meta</CODE>.
- *
- * @param string a <CODE>String</CODE>
- * @return a <CODE>StringBuffer</CODE>
- */
-
- public StringBuffer append(String string) {
- return content.append(string);
- }
-
- // methods to retrieve information
-
-/**
- * Returns the content of the meta information.
- *
- * @return a <CODE>String</CODE>
- */
-
- public String content() {
- return content.toString();
- }
-
-/**
- * Returns the name of the meta information.
- *
- * @return a <CODE>String</CODE>
- */
-
- public String name() {
- switch (type) {
- case Element.SUBJECT:
- return ElementTags.SUBJECT;
- case Element.KEYWORDS:
- return ElementTags.KEYWORDS;
- case Element.AUTHOR:
- return ElementTags.AUTHOR;
- case Element.TITLE:
- return ElementTags.TITLE;
- case Element.PRODUCER:
- return ElementTags.PRODUCER;
- case Element.CREATIONDATE:
- return ElementTags.CREATIONDATE;
- default:
- return ElementTags.UNKNOWN;
- }
- }
-
-/**
- * Returns the name of the meta information.
- *
- * @param tag iText tag for meta information
- * @return the Element value corresponding with the given tag
- */
-
- public static int getType(String tag) {
- if (ElementTags.SUBJECT.equals(tag)) {
- return Element.SUBJECT;
- }
- if (ElementTags.KEYWORDS.equals(tag)) {
- return Element.KEYWORDS;
- }
- if (ElementTags.AUTHOR.equals(tag)) {
- return Element.AUTHOR;
- }
- if (ElementTags.TITLE.equals(tag)) {
- return Element.TITLE;
- }
- if (ElementTags.PRODUCER.equals(tag)) {
- return Element.PRODUCER;
- }
- if (ElementTags.CREATIONDATE.equals(tag)) {
- return Element.CREATIONDATE;
- }
- return Element.HEADER;
- }
-
-
-/**
- * @see com.lowagie.text.MarkupAttributes#setMarkupAttribute(java.lang.String, java.lang.String)
- */
- public void setMarkupAttribute(String name, String value) {
- if (markupAttributes == null) markupAttributes = new Properties();
- markupAttributes.put(name, value);
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#setMarkupAttributes(java.util.Properties)
- */
- public void setMarkupAttributes(Properties markupAttributes) {
- this.markupAttributes = markupAttributes;
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttribute(java.lang.String)
- */
- public String getMarkupAttribute(String name) {
- return (markupAttributes == null) ? null : String.valueOf(markupAttributes.get(name));
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttributeNames()
- */
- public Set getMarkupAttributeNames() {
- return Chunk.getKeySet(markupAttributes);
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttributes()
- */
- public Properties getMarkupAttributes() {
- return markupAttributes;
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/PageSize.java b/LibrarySource/com/lowagie/text/PageSize.java
deleted file mode 100644
index 4c7ca52..0000000
--- a/LibrarySource/com/lowagie/text/PageSize.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * $Id: PageSize.java,v 1.26 2002/06/20 13:30:24 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-/**
- * The <CODE>PageSize</CODE>-object contains a number of rectangles representing the most common papersizes.
- *
- * @see Rectangle
- */
-
-public class PageSize {
-
- // membervariables
-
-/** This is the letter format */
- public static final Rectangle LETTER = new Rectangle(612,792);
-
-/** This is the note format */
- public static final Rectangle NOTE = new Rectangle(540,720);
-
-/** This is the legal format */
- public static final Rectangle LEGAL = new Rectangle(612,1008);
-
-/** This is the a0 format */
- public static final Rectangle A0 = new Rectangle(2384,3370);
-
-/** This is the a1 format */
- public static final Rectangle A1 = new Rectangle(1684,2384);
-
-/** This is the a2 format */
- public static final Rectangle A2 = new Rectangle(1190,1684);
-
-/** This is the a3 format */
- public static final Rectangle A3 = new Rectangle(842,1190);
-
-/** This is the a4 format */
- public static final Rectangle A4 = new Rectangle(595,842);
-
-/** This is the a5 format */
- public static final Rectangle A5 = new Rectangle(421,595);
-
-/** This is the a6 format */
- public static final Rectangle A6 = new Rectangle(297,421);
-
-/** This is the a7 format */
- public static final Rectangle A7 = new Rectangle(210,297);
-
-/** This is the a8 format */
- public static final Rectangle A8 = new Rectangle(148,210);
-
-/** This is the a9 format */
- public static final Rectangle A9 = new Rectangle(105,148);
-
-/** This is the a10 format */
- public static final Rectangle A10 = new Rectangle(74,105);
-
-/** This is the b0 format */
- public static final Rectangle B0 = new Rectangle(2836,4008);
-
-/** This is the b1 format */
- public static final Rectangle B1 = new Rectangle(2004,2836);
-
-/** This is the b2 format */
- public static final Rectangle B2 = new Rectangle(1418,2004);
-
-/** This is the b3 format */
- public static final Rectangle B3 = new Rectangle(1002,1418);
-
-/** This is the b4 format */
- public static final Rectangle B4 = new Rectangle(709,1002);
-
-/** This is the b5 format */
- public static final Rectangle B5 = new Rectangle(501,709);
-
-/** This is the archE format */
- public static final Rectangle ARCH_E = new Rectangle(2592,3456);
-
-/** This is the archD format */
- public static final Rectangle ARCH_D = new Rectangle(1728,2592);
-
-/** This is the archC format */
- public static final Rectangle ARCH_C = new Rectangle(1296,1728);
-
-/** This is the archB format */
- public static final Rectangle ARCH_B = new Rectangle(864,1296);
-
-/** This is the archA format */
- public static final Rectangle ARCH_A = new Rectangle(648,864);
-
-/** This is the flsa format */
- public static final Rectangle FLSA = new Rectangle(612,936);
-
-/** This is the flse format */
- public static final Rectangle FLSE = new Rectangle(612,936);
-
-/** This is the halfletter format */
- public static final Rectangle HALFLETTER = new Rectangle(396,612);
-
-/** This is the 11x17 format */
- public static final Rectangle _11X17 = new Rectangle(792,1224);
-
-/** This is the ledger format */
- public static final Rectangle LEDGER = new Rectangle(1224,792);
-}
-
diff --git a/LibrarySource/com/lowagie/text/Paragraph.java b/LibrarySource/com/lowagie/text/Paragraph.java
deleted file mode 100644
index 19c0fe0..0000000
--- a/LibrarySource/com/lowagie/text/Paragraph.java
+++ /dev/null
@@ -1,517 +0,0 @@
-/*
- * $Id: Paragraph.java,v 1.83 2005/05/03 13:03:48 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.util.Properties;
-
-import com.lowagie.text.markup.MarkupTags;
-import com.lowagie.text.markup.MarkupParser;
-
-/**
- * A <CODE>Paragraph</CODE> is a series of <CODE>Chunk</CODE>s and/or <CODE>Phrases</CODE>.
- * <P>
- * A <CODE>Paragraph</CODE> has the same qualities of a <CODE>Phrase</CODE>, but also
- * some additional layout-parameters:
- * <UL>
- * <LI>the indentation
- * <LI>the alignment of the text
- * </UL>
- *
- * Example:
- * <BLOCKQUOTE><PRE>
- * <STRONG>Paragraph p = new Paragraph("This is a paragraph",
- * FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0, 255)));</STRONG>
- * </PRE></BLOCKQUOTE>
- *
- * @see Element
- * @see Phrase
- * @see ListItem
- */
-
-public class Paragraph extends Phrase implements TextElementArray, MarkupAttributes {
-
- // membervariables
-
-/** The alignment of the text. */
- protected int alignment = Element.ALIGN_UNDEFINED;
-
-/** The indentation of this paragraph on the left side. */
- protected float indentationLeft;
-
-/** The indentation of this paragraph on the right side. */
- protected float indentationRight;
-
-/** The spacing before the paragraph. */
- protected float spacingBefore;
-
-/** The spacing after the paragraph. */
- protected float spacingAfter;
-
-/** Does the paragraph has to be kept together on 1 page. */
- protected boolean keeptogether = false;
-
- /** The text leading that is multiplied by the biggest font size in the line. */
- protected float multipliedLeading = 0;
-
- /**
- * Holds value of property firstLineIndent.
- */
- private float firstLineIndent = 0;
-
- /**
- * Holds value of property extraParagraphSpace.
- */
- private float extraParagraphSpace = 0;
-
- // constructors
-
-/**
- * Constructs a <CODE>Paragraph</CODE>.
- */
-
- public Paragraph() {
- super();
- }
-
-/**
- * Constructs a <CODE>Paragraph</CODE> with a certain leading.
- *
- * @param leading the leading
- */
-
- public Paragraph(float leading) {
- super(leading);
- }
-
-/**
- * Constructs a <CODE>Paragraph</CODE> with a certain <CODE>Chunk</CODE>.
- *
- * @param chunk a <CODE>Chunk</CODE>
- */
-
- public Paragraph(Chunk chunk) {
- super(chunk);
- }
-
-/**
- * Constructs a <CODE>Paragraph</CODE> with a certain <CODE>Chunk</CODE>
- * and a certain leading.
- *
- * @param leading the leading
- * @param chunk a <CODE>Chunk</CODE>
- */
-
- public Paragraph(float leading, Chunk chunk) {
- super(leading, chunk);
- }
-
-/**
- * Constructs a <CODE>Paragraph</CODE> with a certain <CODE>String</CODE>.
- *
- * @param string a <CODE>String</CODE>
- */
-
- public Paragraph(String string) {
- super(string);
- }
-
-/**
- * Constructs a <CODE>Paragraph</CODE> with a certain <CODE>String</CODE>
- * and a certain <CODE>Font</CODE>.
- *
- * @param string a <CODE>String</CODE>
- * @param font a <CODE>Font</CODE>
- */
-
- public Paragraph(String string, Font font) {
- super(string, font);
- }
-
-/**
- * Constructs a <CODE>Paragraph</CODE> with a certain <CODE>String</CODE>
- * and a certain leading.
- *
- * @param leading the leading
- * @param string a <CODE>String</CODE>
- */
-
- public Paragraph(float leading, String string) {
- super(leading, string);
- }
-
-/**
- * Constructs a <CODE>Paragraph</CODE> with a certain leading, <CODE>String</CODE>
- * and <CODE>Font</CODE>.
- *
- * @param leading the leading
- * @param string a <CODE>String</CODE>
- * @param font a <CODE>Font</CODE>
- */
-
- public Paragraph(float leading, String string, Font font) {
- super(leading, string, font);
- }
-
-/**
- * Constructs a <CODE>Paragraph</CODE> with a certain <CODE>Phrase</CODE>.
- *
- * @param phrase a <CODE>Phrase</CODE>
- */
-
- public Paragraph(Phrase phrase) {
- super(phrase.leading, "", phrase.font());
- super.add(phrase);
- }
-
-/**
- * Returns a <CODE>Paragraph</CODE> that has been constructed taking in account
- * the value of some <VAR>attributes</VAR>.
- *
- * @param attributes Some attributes
- */
-
- public Paragraph(Properties attributes) {
- this("", FontFactory.getFont(attributes));
- String value;
- if ((value = (String)attributes.remove(ElementTags.ITEXT)) != null) {
- Chunk chunk = new Chunk(value);
- if ((value = (String)attributes.remove(ElementTags.GENERICTAG)) != null) {
- chunk.setGenericTag(value);
- }
- add(chunk);
- }
- if ((value = (String)attributes.remove(ElementTags.ALIGN)) != null) {
- setAlignment(value);
- }
- if ((value = (String)attributes.remove(ElementTags.LEADING)) != null) {
- setLeading(Float.valueOf(value + "f").floatValue());
- }
- else if ((value = (String)attributes.remove(MarkupTags.CSS_KEY_LINEHEIGHT)) != null) {
- setLeading(MarkupParser.parseLength(value));
- }
- else {
- setLeading(16);
- }
- if ((value = (String)attributes.remove(ElementTags.INDENTATIONLEFT)) != null) {
- setIndentationLeft(Float.valueOf(value + "f").floatValue());
- }
- if ((value = (String)attributes.remove(ElementTags.INDENTATIONRIGHT)) != null) {
- setIndentationRight(Float.valueOf(value + "f").floatValue());
- }
- if ((value = (String)attributes.remove(ElementTags.KEEPTOGETHER)) != null) {
- keeptogether = new Boolean(value).booleanValue();
- }
- if (attributes.size() > 0) setMarkupAttributes(attributes);
- }
-
- // implementation of the Element-methods
-
-/**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type() {
- return Element.PARAGRAPH;
- }
-
- // methods
-
-/**
- * Adds an <CODE>Object</CODE> to the <CODE>Paragraph</CODE>.
- *
- * @param o object the object to add.
- * @return true is adding the object succeeded
- */
-
- public boolean add(Object o) {
- if (o instanceof List) {
- List list = (List) o;
- list.setIndentationLeft(list.indentationLeft() + indentationLeft);
- list.setIndentationRight(indentationRight);
- return super.add(list);
- }
- else if (o instanceof Image) {
- super.addSpecial((Image) o);
- return true;
- }
- else if (o instanceof Paragraph) {
- super.add(o);
- super.add(Chunk.NEWLINE);
- return true;
- }
- return super.add(o);
- }
-
- // setting the membervariables
-
-/**
- * Sets the alignment of this paragraph.
- *
- * @param alignment the new alignment
- */
-
- public void setAlignment(int alignment) {
- this.alignment = alignment;
- }
-
-/**
- * Sets the alignment of this paragraph.
- *
- * @param alignment the new alignment as a <CODE>String</CODE>
- */
-
- public void setAlignment(String alignment) {
- if (ElementTags.ALIGN_CENTER.equalsIgnoreCase(alignment)) {
- this.alignment = Element.ALIGN_CENTER;
- return;
- }
- if (ElementTags.ALIGN_RIGHT.equalsIgnoreCase(alignment)) {
- this.alignment = Element.ALIGN_RIGHT;
- return;
- }
- if (ElementTags.ALIGN_JUSTIFIED.equalsIgnoreCase(alignment)) {
- this.alignment = Element.ALIGN_JUSTIFIED;
- return;
- }
- if (ElementTags.ALIGN_JUSTIFIED_ALL.equalsIgnoreCase(alignment)) {
- this.alignment = Element.ALIGN_JUSTIFIED_ALL;
- return;
- }
- this.alignment = Element.ALIGN_LEFT;
- }
-
-/**
- * Sets the indentation of this paragraph on the left side.
- *
- * @param indentation the new indentation
- */
-
- public void setIndentationLeft(float indentation) {
- this.indentationLeft = indentation;
- }
-
-/**
- * Sets the indentation of this paragraph on the right side.
- *
- * @param indentation the new indentation
- */
-
- public void setIndentationRight(float indentation) {
- this.indentationRight = indentation;
- }
-
-/**
- * Sets the spacing before this paragraph.
- *
- * @param spacing the new spacing
- */
-
- public void setSpacingBefore(float spacing) {
- this.spacingBefore = spacing;
- }
-
-/**
- * Sets the spacing after this paragraph.
- *
- * @param spacing the new spacing
- */
-
- public void setSpacingAfter(float spacing) {
- this.spacingAfter = spacing;
- }
-
-/**
- * Indicates that the paragraph has to be kept together on one page.
- *
- * @param keeptogether true of the paragraph may not be split over 2 pages
- */
-
- public void setKeepTogether(boolean keeptogether) {
- this.keeptogether = keeptogether;
- }
-
-/**
- * Checks if this paragraph has to be kept together on one page.
- *
- * @return true if the paragraph may not be split over 2 pages.
- */
-
- public boolean getKeepTogether() {
- return keeptogether;
- }
-
- // methods to retrieve information
-
-/**
- * Gets the alignment of this paragraph.
- *
- * @return alignment
- */
-
- public int alignment() {
- return alignment;
- }
-
-/**
- * Gets the indentation of this paragraph on the left side.
- *
- * @return the indentation
- */
-
- public float indentationLeft() {
- return indentationLeft;
- }
-
-/**
- * Gets the indentation of this paragraph on the right side.
- *
- * @return the indentation
- */
-
- public float indentationRight() {
- return indentationRight;
- }
-
-/**
- * Gets the spacing before this paragraph.
- *
- * @return the spacing
- */
-
- public float spacingBefore() {
- return spacingBefore;
- }
-
-/**
- * Gets the spacing before this paragraph.
- *
- * @return the spacing
- */
-
- public float spacingAfter() {
- return spacingAfter;
- }
-
-/**
- * Checks if a given tag corresponds with this object.
- *
- * @param tag the given tag
- * @return true if the tag corresponds
- */
-
- public static boolean isTag(String tag) {
- return ElementTags.PARAGRAPH.equals(tag);
- }
-
- /**
- * Sets the leading fixed and variable. The resultant leading will be
- * fixedLeading+multipliedLeading*maxFontSize where maxFontSize is the
- * size of the bigest font in the line.
- * @param fixedLeading the fixed leading
- * @param multipliedLeading the variable leading
- */
- public void setLeading(float fixedLeading, float multipliedLeading) {
- this.leading = fixedLeading;
- this.multipliedLeading = multipliedLeading;
- }
-
- /**
- * @see com.lowagie.text.Phrase#setLeading(float)
- */
- public void setLeading(float fixedLeading) {
- this.leading = fixedLeading;
- this.multipliedLeading = 0;
- }
-
- /**
- * Gets the variable leading
- * @return the leading
- */
- public float getMultipliedLeading() {
- return multipliedLeading;
- }
-
- /**
- * Getter for property firstLineIndent.
- * @return Value of property firstLineIndent.
- */
- public float getFirstLineIndent() {
- return this.firstLineIndent;
- }
-
- /**
- * Setter for property firstLineIndent.
- * @param firstLineIndent New value of property firstLineIndent.
- */
- public void setFirstLineIndent(float firstLineIndent) {
- this.firstLineIndent = firstLineIndent;
- }
-
- /**
- * Getter for property extraParagraphSpace.
- * @return Value of property extraParagraphSpace.
- */
- public float getExtraParagraphSpace() {
- return this.extraParagraphSpace;
- }
-
- /**
- * Setter for property extraParagraphSpace.
- * @param extraParagraphSpace New value of property extraParagraphSpace.
- */
- public void setExtraParagraphSpace(float extraParagraphSpace) {
- this.extraParagraphSpace = extraParagraphSpace;
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/Phrase.java b/LibrarySource/com/lowagie/text/Phrase.java
deleted file mode 100644
index c00e3c2..0000000
--- a/LibrarySource/com/lowagie/text/Phrase.java
+++ /dev/null
@@ -1,595 +0,0 @@
-/*
- * $Id: Phrase.java,v 1.99 2005/04/13 09:17:10 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Set;
-
-import com.lowagie.text.markup.MarkupTags;
-import com.lowagie.text.markup.MarkupParser;
-
-/**
- * A <CODE>Phrase</CODE> is a series of <CODE>Chunk</CODE>s.
- * <P>
- * A <CODE>Phrase</CODE> has a main <CODE>Font</CODE>, but some chunks
- * within the phrase can have a <CODE>Font</CODE> that differs from the
- * main <CODE>Font</CODE>. All the <CODE>Chunk</CODE>s in a <CODE>Phrase</CODE>
- * have the same <CODE>leading</CODE>.
- * <P>
- * Example:
- * <BLOCKQUOTE><PRE>
- * // When no parameters are passed, the default leading = 16
- * <STRONG>Phrase phrase0 = new Phrase();</STRONG>
- * <STRONG>Phrase phrase1 = new Phrase("this is a phrase");</STRONG>
- * // In this example the leading is passed as a parameter
- * <STRONG>Phrase phrase2 = new Phrase(16, "this is a phrase with leading 16");</STRONG>
- * // When a Font is passed (explicitely or embedded in a chunk), the default leading = 1.5 * size of the font
- * <STRONG>Phrase phrase3 = new Phrase("this is a phrase with a red, normal font Courier, size 12", FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, new Color(255, 0, 0)));</STRONG>
- * <STRONG>Phrase phrase4 = new Phrase(new Chunk("this is a phrase"));</STRONG>
- * <STRONG>Phrase phrase5 = new Phrase(18, new Chunk("this is a phrase", FontFactory.getFont(FontFactory.HELVETICA, 16, Font.BOLD, new Color(255, 0, 0)));</STRONG>
- * </PRE></BLOCKQUOTE>
- *
- * @see Element
- * @see Chunk
- * @see Paragraph
- * @see Anchor
- */
-
-public class Phrase extends ArrayList implements TextElementArray, MarkupAttributes {
-
- // membervariables
-
-/** This is the leading of this phrase. */
- protected float leading = Float.NaN;
-
-/** This is the font of this phrase. */
- protected Font font = new Font();
-
-/** Contains extra markupAttributes */
- protected Properties markupAttributes;
-
- // constructors
-
-/**
- * Constructs a Phrase that can be used in the static getInstance() method.
- * @param dummy a dummy parameter
- */
- private Phrase(boolean dummy) {
- }
-
-/**
- * Constructs a <CODE>Phrase</CODE> without specifying a leading.
- */
-
- public Phrase() {
- this(16);
- }
-
-/**
- * Constructs a <CODE>Phrase</CODE> with a certain leading.
- *
- * @param leading the leading
- */
-
- public Phrase(float leading) {
- this.leading = leading;
- }
-
-/**
- * Constructs a <CODE>Phrase</CODE> with a certain <CODE>Chunk</CODE>.
- *
- * @param chunk a <CODE>Chunk</CODE>
- */
-
- public Phrase(Chunk chunk) {
- super.add(chunk);
- }
-
-/**
- * Constructs a <CODE>Phrase</CODE> with a certain <CODE>Chunk</CODE>
- * and a certain leading.
- *
- * @param leading the leading
- * @param chunk a <CODE>Chunk</CODE>
- */
-
- public Phrase(float leading, Chunk chunk) {
- this(leading);
- super.add(chunk);
- }
-
-/**
- * Constructs a <CODE>Phrase</CODE> with a certain <CODE>String</CODE>.
- *
- * @param string a <CODE>String</CODE>
- */
-
- public Phrase(String string) {
- this(Float.NaN, string, new Font());
- }
-
-/**
- * Constructs a <CODE>Phrase</CODE> with a certain <CODE>String</CODE> and a certain <CODE>Font</CODE>.
- *
- * @param string a <CODE>String</CODE>
- * @param font a <CODE>Font</CODE>
- */
-
- public Phrase(String string, Font font) {
- this(Float.NaN, string, font);
- this.font = font;
- }
-
-/**
- * Constructs a <CODE>Phrase</CODE> with a certain leading and a certain <CODE>String</CODE>.
- *
- * @param leading the leading
- * @param string a <CODE>String</CODE>
- */
-
- public Phrase(float leading, String string) {
- this(leading, string, new Font());
- }
-
-/**
- * Constructs a <CODE>Phrase</CODE> with a certain leading, a certain <CODE>String</CODE>
- * and a certain <CODE>Font</CODE>.
- *
- * @param leading the leading
- * @param string a <CODE>String</CODE>
- * @param font a <CODE>Font</CODE>
- */
-
- public Phrase(float leading, String string, Font font) {
- this(leading);
- this.font = font;
- /* bugfix by August Detlefsen */
- if (string != null && string.length() != 0) {
- super.add(new Chunk(string, font));
- }
- }
-
- /**
- * Gets a special kind of Phrase that changes some characters into corresponding symbols.
- * @param string
- * @return a newly constructed Phrase
- */
- public static final Phrase getInstance(String string) {
- return getInstance(16, string, new Font());
- }
-
- /**
- * Gets a special kind of Phrase that changes some characters into corresponding symbols.
- * @param leading
- * @param string
- * @return a newly constructed Phrase
- */
- public static final Phrase getInstance(int leading, String string) {
- return getInstance(leading, string, new Font());
- }
-
- /**
- * Gets a special kind of Phrase that changes some characters into corresponding symbols.
- * @param leading
- * @param string
- * @param font
- * @return a newly constructed Phrase
- */
- public static final Phrase getInstance(int leading, String string, Font font) {
- Phrase p = new Phrase(true);
- p.setLeading(leading);
- p.font = font;
- if (font.family() != Font.SYMBOL && font.family() != Font.ZAPFDINGBATS && font.getBaseFont() == null) {
- int index;
- while((index = SpecialSymbol.index(string)) > -1) {
- if (index > 0) {
- String firstPart = string.substring(0, index);
- /* bugfix [ #461272 ] CODE CHANGE REQUIRED IN Phrase.java
- by Arekh Nambiar */
- ((ArrayList)p).add(new Chunk(firstPart, font));
- string = string.substring(index);
- }
- Font symbol = new Font(Font.SYMBOL, font.size(), font.style(), font.color());
- StringBuffer buf = new StringBuffer();
- buf.append(SpecialSymbol.getCorrespondingSymbol(string.charAt(0)));
- string = string.substring(1);
- while (SpecialSymbol.index(string) == 0) {
- buf.append(SpecialSymbol.getCorrespondingSymbol(string.charAt(0)));
- string = string.substring(1);
- }
- ((ArrayList)p).add(new Chunk(buf.toString(), symbol));
- }
- }
- /* bugfix by August Detlefsen */
- if (string != null && string.length() != 0) {
- ((ArrayList)p).add(new Chunk(string, font));
- }
- return p;
- }
-
-/**
- * Returns a <CODE>Phrase</CODE> that has been constructed taking in account
- * the value of some <VAR>attributes</VAR>.
- *
- * @param attributes Some attributes
- */
-
- public Phrase(Properties attributes) {
- this("", FontFactory.getFont(attributes));
- clear();
- String value;
- if ((value = (String)attributes.remove(ElementTags.LEADING)) != null) {
- setLeading(Float.valueOf(value + "f").floatValue());
- }
- else if ((value = (String)attributes.remove(MarkupTags.CSS_KEY_LINEHEIGHT)) != null) {
- setLeading(MarkupParser.parseLength(value));
- }
- if ((value = (String)attributes.remove(ElementTags.ITEXT)) != null) {
- Chunk chunk = new Chunk(value);
- if ((value = (String)attributes.remove(ElementTags.GENERICTAG)) != null) {
- chunk.setGenericTag(value);
- }
- add(chunk);
- }
- if (attributes.size() > 0) setMarkupAttributes(attributes);
- }
-
- // implementation of the Element-methods
-
-/**
- * Processes the element by adding it (or the different parts) to an
- * <CODE>ElementListener</CODE>.
- *
- * @param listener an <CODE>ElementListener</CODE>
- * @return <CODE>true</CODE> if the element was processed successfully
- */
-
- public boolean process(ElementListener listener) {
- try {
- for (Iterator i = iterator(); i.hasNext(); ) {
- listener.add((Element) i.next());
- }
- return true;
- }
- catch(DocumentException de) {
- return false;
- }
- }
-
-/**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type() {
- return Element.PHRASE;
- }
-
-/**
- * Gets all the chunks in this element.
- *
- * @return an <CODE>ArrayList</CODE>
- */
-
- public ArrayList getChunks() {
- ArrayList tmp = new ArrayList();
- for (Iterator i = iterator(); i.hasNext(); ) {
- tmp.addAll(((Element) i.next()).getChunks());
- }
- return tmp;
- }
-
- // overriding some of the ArrayList-methods
-
-/**
- * Adds a <CODE>Chunk</CODE>, an <CODE>Anchor</CODE> or another <CODE>Phrase</CODE>
- * to this <CODE>Phrase</CODE>.
- *
- * @param index index at which the specified element is to be inserted
- * @param o an object of type <CODE>Chunk</CODE>, <CODE>Anchor</CODE> or <CODE>Phrase</CODE>
- * @throws ClassCastException when you try to add something that isn't a <CODE>Chunk</CODE>, <CODE>Anchor</CODE> or <CODE>Phrase</CODE>
- */
-
- public void add(int index, Object o) {
- try {
- Element element = (Element) o;
- if (element.type() == Element.CHUNK) {
- Chunk chunk = (Chunk) element;
- if (!font.isStandardFont()) {
- chunk.setFont(font.difference(chunk.font()));
- }
- super.add(index, chunk);
- }
- else if (element.type() == Element.PHRASE ||
- element.type() == Element.ANCHOR ||
- element.type() == Element.ANNOTATION ||
- element.type() == Element.TABLE || // line added by David Freels
- element.type() == Element.GRAPHIC) {
- super.add(index, element);
- }
- else {
- throw new ClassCastException(String.valueOf(element.type()));
- }
- }
- catch(ClassCastException cce) {
- throw new ClassCastException("Insertion of illegal Element: " + cce.getMessage());
- }
- }
-
-/**
- * Adds a <CODE>Chunk</CODE>, <CODE>Anchor</CODE> or another <CODE>Phrase</CODE>
- * to this <CODE>Phrase</CODE>.
- *
- * @param o an object of type <CODE>Chunk</CODE>, <CODE>Anchor</CODE> or <CODE>Phrase</CODE>
- * @return a boolean
- * @throws ClassCastException when you try to add something that isn't a <CODE>Chunk</CODE>, <CODE>Anchor</CODE> or <CODE>Phrase</CODE>
- */
-
- public boolean add(Object o) {
- if (o instanceof String) {
- return super.add(new Chunk((String) o, font));
- }
- try {
- Element element = (Element) o;
- switch(element.type()) {
- case Element.CHUNK:
- return addChunk((Chunk) o);
- case Element.PHRASE:
- case Element.PARAGRAPH:
- Phrase phrase = (Phrase) o;
- boolean success = true;
- Element e;
- for (Iterator i = phrase.iterator(); i.hasNext(); ) {
- e = (Element) i.next();
- if (e instanceof Chunk) {
- success &= addChunk((Chunk)e);
- }
- else {
- success &= this.add(e);
- }
- }
- return success;
- case Element.ANCHOR:
- return super.add((Anchor) o);
- case Element.ANNOTATION:
- return super.add((Annotation) o);
- case Element.TABLE: // case added by David Freels
- return super.add((Table) o);
- case Element.LIST:
- return super.add((List) o);
- case Element.GRAPHIC: // suggested by Steven Balthazor
- return super.add((Graphic) o);
- default:
- throw new ClassCastException(String.valueOf(element.type()));
- }
- }
- catch(ClassCastException cce) {
- throw new ClassCastException("Insertion of illegal Element: " + cce.getMessage());
- }
- }
-
-/**
- * Adds a Chunk.
- * <p>
- * This method is a hack to solve a problem I had with phrases that were split between chunks
- * in the wrong place.
- * @param chunk a Chunk to add to the Phrase
- * @return true if adding the Chunk succeeded
- */
-
- private synchronized boolean addChunk(Chunk chunk) {
- if (!font.isStandardFont()) {
- chunk.setFont(font.difference(chunk.font()));
- }
- if (size() > 0 && !chunk.hasAttributes()) {
- try {
- Chunk previous = (Chunk) get(size() - 1);
- if (!previous.hasAttributes() && previous.font().compareTo(chunk.font()) == 0 && !"".equals(previous.content().trim()) && !"".equals(chunk.content().trim())) {
- previous.append(chunk.content());
- return true;
- }
- }
- catch(ClassCastException cce) {
- }
- }
- return super.add(chunk);
- }
-
-/**
- * Adds a collection of <CODE>Chunk</CODE>s
- * to this <CODE>Phrase</CODE>.
- *
- * @param collection a collection of <CODE>Chunk</CODE>s, <CODE>Anchor</CODE>s and <CODE>Phrase</CODE>s.
- * @return <CODE>true</CODE> if the action succeeded, <CODE>false</CODE> if not.
- * @throws ClassCastException when you try to add something that isn't a <CODE>Chunk</CODE>, <CODE>Anchor</CODE> or <CODE>Phrase</CODE>
- */
-
- public boolean addAll(Collection collection) {
- for (Iterator iterator = collection.iterator(); iterator.hasNext(); ) {
- this.add(iterator.next());
- }
- return true;
- }
-
-/**
- * Adds a <CODE>Object</CODE> to the <CODE>Paragraph</CODE>.
- *
- * @param object the object to add.
- */
-
- protected void addSpecial(Object object) {
- super.add(object);
- }
-
- // methods
-
-/**
- * Sets the leading of this phrase.
- *
- * @param leading the new leading
- */
-
- public void setLeading(float leading) {
- this.leading = leading;
- }
-
- // methods to retrieve information
-
-/**
- * Checks is this <CODE>Phrase</CODE> contains no or 1 empty <CODE>Chunk</CODE>.
- *
- * @return <CODE>false</CODE> if the <CODE>Phrase</CODE>
- * contains more than one or more non-empty<CODE>Chunk</CODE>s.
- */
-
- public boolean isEmpty() {
- switch(size()) {
- case 0:
- return true;
- case 1:
- Element element = (Element) get(0);
- if (element.type() == Element.CHUNK && ((Chunk) element).isEmpty()) {
- return true;
- }
- return false;
- default:
- return false;
- }
- }
-
-/**
- * Checks you if the leading of this phrase is defined.
- *
- * @return true if the leading is defined
- */
-
- public boolean leadingDefined() {
- if (Float.isNaN(leading)) {
- return false;
- }
- return true;
- }
-
-/**
- * Gets the leading of this phrase.
- *
- * @return the linespacing
- */
-
- public float leading() {
- if (Float.isNaN(leading)) {
- return font.leading(1.5f);
- }
- return leading;
- }
-
-/**
- * Gets the font of the first <CODE>Chunk</CODE> that appears in this <CODE>Phrase</CODE>.
- *
- * @return a <CODE>Font</CODE>
- */
-
- public Font font() {
- return font;
- }
-
-/**
- * Checks if a given tag corresponds with this object.
- *
- * @param tag the given tag
- * @return true if the tag corresponds
- */
-
- public static boolean isTag(String tag) {
- return ElementTags.PHRASE.equals(tag);
- }
-
-
-/**
- * @see com.lowagie.text.MarkupAttributes#setMarkupAttribute(java.lang.String, java.lang.String)
- */
- public void setMarkupAttribute(String name, String value) {
- if (markupAttributes == null) markupAttributes = new Properties();
- markupAttributes.put(name, value);
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#setMarkupAttributes(java.util.Properties)
- */
- public void setMarkupAttributes(Properties markupAttributes) {
- this.markupAttributes = markupAttributes;
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttribute(java.lang.String)
- */
- public String getMarkupAttribute(String name) {
- return (markupAttributes == null) ? null : String.valueOf(markupAttributes.get(name));
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttributeNames()
- */
- public Set getMarkupAttributeNames() {
- return Chunk.getKeySet(markupAttributes);
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttributes()
- */
- public Properties getMarkupAttributes() {
- return markupAttributes;
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/Rectangle.java b/LibrarySource/com/lowagie/text/Rectangle.java
deleted file mode 100644
index 7f34133..0000000
--- a/LibrarySource/com/lowagie/text/Rectangle.java
+++ /dev/null
@@ -1,869 +0,0 @@
-/*
- * $Id: Rectangle.java,v 1.66 2005/04/13 09:17:14 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import headless.awt.Color;
-import java.util.ArrayList;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * A <CODE>Rectangle</CODE> is the representation of a geometric figure.
- *
- * Rectangles support constant width borders using {@link #setBorderWidth(float)}
- * and {@link #setBorder(int)}. They also support borders that vary in
- * width/color on each side using methods like {@link #setBorderWidthLeft(float)}
- * or {@link #setBorderColorLeft(java.awt.Color)}.
- *
- * @see Element
- * @see Table
- * @see Cell
- * @see HeaderFooter
- */
-
-public class Rectangle implements Element, MarkupAttributes {
-
- // static membervariables (concerning the presence of borders)
-
-/** This is the value that will be used as <VAR>undefined</VAR>. */
- public static final int UNDEFINED = -1;
-
-/** This represents one side of the border of the <CODE>Rectangle</CODE>. */
- public static final int TOP = 1;
-
-/** This represents one side of the border of the <CODE>Rectangle</CODE>. */
- public static final int BOTTOM = 2;
-
-/** This represents one side of the border of the <CODE>Rectangle</CODE>. */
- public static final int LEFT = 4;
-
-/** This represents one side of the border of the <CODE>Rectangle</CODE>. */
- public static final int RIGHT = 8;
-
-/** This represents a rectangle without borders. */
- public static final int NO_BORDER = 0;
-
-/** This represents a type of border. */
- public static final int BOX = TOP + BOTTOM + LEFT + RIGHT;
-
- // membervariables
-
-/** the lower left x-coordinate. */
- protected float llx;
-
-/** the lower left y-coordinate. */
- protected float lly;
-
-/** the upper right x-coordinate. */
- protected float urx;
-
-/** the upper right y-coordinate. */
- protected float ury;
-
-/** This represents the status of the 4 sides of the rectangle. */
- protected int border = UNDEFINED;
-
-/** This is the width of the border around this rectangle. */
- protected float borderWidth = UNDEFINED;
-
-/** The color of the border of this rectangle. */
- protected Color color = null;
-
-/** The color of the left border of this rectangle. */
- protected Color borderColorLeft = null;
-
-/** The color of the right border of this rectangle. */
- protected Color borderColorRight = null;
-
-/** The color of the top border of this rectangle. */
- protected Color borderColorTop = null;
-
-/** The color of the bottom border of this rectangle. */
- protected Color borderColorBottom = null;
-
-
-/** The width of the left border of this rectangle. */
- protected float borderWidthLeft = UNDEFINED;
-
-/** The width of the right border of this rectangle. */
- protected float borderWidthRight = UNDEFINED;
-
-/** The width of the top border of this rectangle. */
- protected float borderWidthTop = UNDEFINED;
-
-/** The width of the bottom border of this rectangle. */
- protected float borderWidthBottom = UNDEFINED;
-
-/** Whether variable width borders are used. */
- protected boolean useVariableBorders = false;
-
-/** This is the color of the background of this rectangle. */
- protected Color background = null;
-
-/** This is the grayscale value of the background of this rectangle. */
- protected float grayFill = 0;
-
- protected int rotation = 0;
-
-/** Contains extra markupAttributes */
- protected Properties markupAttributes;
-
- // constructors
-
-/**
- * Constructs a <CODE>Rectangle</CODE>-object.
- *
- * @param llx lower left x
- * @param lly lower left y
- * @param urx upper right x
- * @param ury upper right y
- */
-
- public Rectangle(float llx, float lly, float urx, float ury) {
- this.llx = llx;
- this.lly = lly;
- this.urx = urx;
- this.ury = ury;
- }
-
-/**
- * Constructs a <CODE>Rectangle</CODE>-object starting from the origin (0, 0).
- *
- * @param urx upper right x
- * @param ury upper right y
- */
-
- public Rectangle(float urx, float ury) {
- this(0, 0, urx, ury);
- }
-
-/**
- * Constructs a <CODE>Rectangle</CODE>-object.
- *
- * @param rect another <CODE>Rectangle</CODE>
- */
-
- public Rectangle(Rectangle rect) {
- this(rect.llx, rect.lly, rect.urx, rect.ury);
- cloneNonPositionParameters(rect);
- }
-
-/**
- * Copies all of the parameters from a <CODE>Rectangle</CODE>
- * object except the position.
- *
- * @param rect <CODE>Rectangle</CODE> to copy from
- */
-
- public void cloneNonPositionParameters(Rectangle rect) {
- this.rotation = rect.rotation;
- this.border = rect.border;
- this.borderWidth = rect.borderWidth;
- this.color = rect.color;
- this.background = rect.background;
- this.grayFill = rect.grayFill;
- this.borderColorLeft = rect.borderColorLeft;
- this.borderColorRight = rect.borderColorRight;
- this.borderColorTop = rect.borderColorTop;
- this.borderColorBottom = rect.borderColorBottom;
- this.borderWidthLeft = rect.borderWidthLeft;
- this.borderWidthRight = rect.borderWidthRight;
- this.borderWidthTop = rect.borderWidthTop;
- this.borderWidthBottom = rect.borderWidthBottom;
- this.useVariableBorders = rect.useVariableBorders;
- }
-
- // implementation of the Element interface
-
-/**
- * Processes the element by adding it (or the different parts) to an
- * <CODE>ElementListener</CODE>.
- *
- * @param listener an <CODE>ElementListener</CODE>
- * @return <CODE>true</CODE> if the element was processed successfully
- */
-
- public boolean process(ElementListener listener) {
- try {
- return listener.add(this);
- }
- catch(DocumentException de) {
- return false;
- }
- }
-
-/**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type() {
- return Element.RECTANGLE;
- }
-
-/**
- * Gets all the chunks in this element.
- *
- * @return an <CODE>ArrayList</CODE>
- */
-
- public ArrayList getChunks() {
- return new ArrayList();
- }
-
- // methods
-
- /**
- * Switches lowerleft with upperright
- */
- public void normalize() {
- if (llx > urx) {
- float a = llx;
- llx = urx;
- urx = a;
- }
- if (lly > ury) {
- float a = lly;
- lly = ury;
- ury = a;
- }
- }
-
-/**
- * Gets a Rectangle that is altered to fit on the page.
- *
- * @param top the top position
- * @param bottom the bottom position
- * @return a <CODE>Rectangle</CODE>
- */
-
- public Rectangle rectangle(float top, float bottom) {
- Rectangle tmp = new Rectangle(this);
- if (top() > top) {
- tmp.setTop(top);
- tmp.setBorder(border - (border & TOP));
- }
- if (bottom() < bottom) {
- tmp.setBottom(bottom);
- tmp.setBorder(border - (border & BOTTOM));
- }
- return tmp;
- }
-
-/**
- * Swaps the values of urx and ury and of lly and llx in order to rotate the rectangle.
- *
- * @return a <CODE>Rectangle</CODE>
- */
-
- public Rectangle rotate() {
- Rectangle rect = new Rectangle(lly, llx, ury, urx);
- rect.rotation = rotation + 90;
- rect.rotation %= 360;
- return rect;
- }
-
- // methods to set the membervariables
-
-/**
- * Sets the lower left x-coordinate.
- *
- * @param value the new value
- */
-
- public void setLeft(float value) {
- llx = value;
- }
-
-/**
- * Sets the upper right x-coordinate.
- *
- * @param value the new value
- */
-
- public void setRight(float value) {
- urx = value;
- }
-
-/**
- * Sets the upper right y-coordinate.
- *
- * @param value the new value
- */
-
- public void setTop(float value) {
- ury = value;
- }
-
-/**
- * Sets the lower left y-coordinate.
- *
- * @param value the new value
- */
-
- public void setBottom(float value) {
- lly = value;
- }
-
-/**
- * Enables/Disables the border on the specified sides. The border is specified
- * as an integer bitwise combination of the constants:
- * <CODE>LEFT, RIGHT, TOP, BOTTOM</CODE>.
- * @see #enableBorderSide(int)
- * @see #disableBorderSide(int)
- * @param value the new value
- */
-
- public void setBorder(int value) {
- border = value;
- }
-
-/**
-* Enables the border on the specified side.
-*
-* @param side the side to enable. One of <CODE>LEFT, RIGHT, TOP, BOTTOM</CODE>
-*/
- public void enableBorderSide(int side) {
- if (border == UNDEFINED) {
- border = 0;
- }
- border |= side;
- }
-
-/**
-* Disables the border on the specified side.
-*
-* @param side the side to disable. One of <CODE>LEFT, RIGHT, TOP, BOTTOM</CODE>
-*/
- public void disableBorderSide(int side) {
- if (border == UNDEFINED) {
- border = 0;
- }
- border &= ~side;
- }
-
-/**
- * Sets the borderwidth of the table.
- *
- * @param value the new value
- */
-
- public void setBorderWidth(float value) {
- borderWidth = value;
- }
-
-
-
- /**
- * Sets the color of the border.
- *
- * @param value the new value
- */
-
- public void setBorderColor(Color value) {
- color = value;
- }
-
-/**
- * Sets the value of the border color
- * @param value a color value
- */
-public void setBorderColorRight(Color value)
- {
- borderColorRight = value;
- }
-
-/**
- * Sets the value of the border color
- * @param value a color value
- */
- public void setBorderColorLeft(Color value)
- {
- borderColorLeft = value;
- }
-
- /**
- * Sets the value of the border color
- * @param value a color value
- */
- public void setBorderColorTop(Color value)
- {
- borderColorTop = value;
- }
-
- /**
- * Sets the value of the border color
- * @param value a color value
- */
- public void setBorderColorBottom(Color value)
- {
- borderColorBottom = value;
- }
-
-
-/**
- * Sets the backgroundcolor of the rectangle.
- *
- * @param value the new value
- */
-
- public void setBackgroundColor(Color value) {
- background = value;
- }
-
-/**
- * Sets the grayscale of the rectangle.
- *
- * @param value the new value
- */
-
- public void setGrayFill(float value) {
- if (value >= 0 && value <= 1.0) {
- grayFill = value;
- }
- }
-
- // methods to get the membervariables
-
-/**
- * Returns the lower left x-coordinate.
- *
- * @return the lower left x-coordinate
- */
-
- public float left() {
- return llx;
- }
-
-/**
- * Returns the upper right x-coordinate.
- *
- * @return the upper right x-coordinate
- */
-
- public float right() {
- return urx;
- }
-
-/**
- * Returns the upper right y-coordinate.
- *
- * @return the upper right y-coordinate
- */
-
- public float top() {
- return ury;
- }
-
-/**
- * Returns the lower left y-coordinate.
- *
- * @return the lower left y-coordinate
- */
-
- public float bottom() {
- return lly;
- }
-
-/**
- * Returns the lower left x-coordinate, considering a given margin.
- *
- * @param margin a margin
- * @return the lower left x-coordinate
- */
-
- public float left(float margin) {
- return llx + margin;
- }
-
-/**
- * Returns the upper right x-coordinate, considering a given margin.
- *
- * @param margin a margin
- * @return the upper right x-coordinate
- */
-
- public float right(float margin) {
- return urx - margin;
- }
-
-/**
- * Returns the upper right y-coordinate, considering a given margin.
- *
- * @param margin a margin
- * @return the upper right y-coordinate
- */
-
- public float top(float margin) {
- return ury - margin;
- }
-
-/**
- * Returns the lower left y-coordinate, considering a given margin.
- *
- * @param margin a margin
- * @return the lower left y-coordinate
- */
-
- public float bottom(float margin) {
- return lly + margin;
- }
-
-/**
- * Returns the width of the rectangle.
- *
- * @return a width
- */
-
- public float width() {
- return urx - llx;
- }
-
-/**
- * Returns the height of the rectangle.
- *
- * @return a height
- */
-
- public float height() {
- return ury - lly;
- }
-
-/**
- * Indicates if the table has borders.
- *
- * @return a boolean
- */
-
- public boolean hasBorders() {
- return (border > 0) &&
- ((borderWidth > 0) ||
- (borderWidthLeft > 0) ||
- (borderWidthRight > 0) ||
- (borderWidthTop > 0) ||
- (borderWidthBottom > 0));
- }
-
-/**
- * Indicates if the table has a some type of border.
- *
- * @param type the type of border
- * @return a boolean
- */
-
- public boolean hasBorder(int type) {
- return border != UNDEFINED && (border & type) == type;
- }
-
-/**
- * Returns the exact type of the border.
- *
- * @return a value
- */
-
- public int border() {
- return border;
- }
-
-/**
- * Gets the borderwidth.
- *
- * @return a value
- */
-
- public float borderWidth() {
- return borderWidth;
- }
-
-/**
- * Gets the color of the border.
- *
- * @return a value
- */
-
- public Color borderColor() {
- return color;
- }
-
-/**
- * Gets the backgroundcolor.
- *
- * @return a value
- */
-
- public Color backgroundColor() {
- return background;
- }
-
-/**
- * Gets the grayscale.
- *
- * @return a value
- */
-
- public float grayFill() {
- return grayFill;
- }
-
- /**
- * Gets the rotation of the rectangle
- * @return a rotation value
- */
- public int getRotation() {
- return rotation;
- }
-
-
-/**
- * @see com.lowagie.text.MarkupAttributes#setMarkupAttribute(java.lang.String, java.lang.String)
- */
- public void setMarkupAttribute(String name, String value) {
- if (markupAttributes == null) markupAttributes = new Properties();
- markupAttributes.put(name, value);
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#setMarkupAttributes(java.util.Properties)
- */
- public void setMarkupAttributes(Properties markupAttributes) {
- this.markupAttributes = markupAttributes;
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttribute(java.lang.String)
- */
- public String getMarkupAttribute(String name) {
- return (markupAttributes == null) ? null : String.valueOf(markupAttributes.get(name));
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttributeNames()
- */
- public Set getMarkupAttributeNames() {
- return Chunk.getKeySet(markupAttributes);
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttributes()
- */
- public Properties getMarkupAttributes() {
- return markupAttributes;
- }
-
-/**
- * Gets the color of a border.
- * @return a color value
- */
-public Color getBorderColorLeft()
- {
- return borderColorLeft;
- }
-
-/**
- * Gets the color of a border.
- * @return a color value
- */
- public Color getBorderColorRight()
- {
- return borderColorRight;
- }
-
- /**
- * Gets the color of a border.
- * @return a color value
- */
- public Color getBorderColorTop()
- {
- return borderColorTop;
- }
-
- /**
- * Gets the color of a border.
- * @return a color value
- */
- public Color getBorderColorBottom()
- {
- return borderColorBottom;
- }
-
- /**
- * Gets the width of a border.
- * @return a width
- */
- public float getBorderWidthLeft()
- {
- return getVariableBorderWidth( borderWidthLeft, LEFT );
- }
-
-/**
- * Sets the width of a border
- * @param borderWidthLeft a width
- */
-public void setBorderWidthLeft( float borderWidthLeft )
- {
- this.borderWidthLeft = borderWidthLeft;
- updateBorderBasedOnWidth(borderWidthLeft, LEFT);
- }
-
- /**
- * Gets the width of a border.
- * @return a width
- */
- public float getBorderWidthRight()
- {
- return getVariableBorderWidth( borderWidthRight, RIGHT );
- }
-
-/**
- * Sets the width of a border
- * @param borderWidthRight a width
- */
- public void setBorderWidthRight( float borderWidthRight )
- {
- this.borderWidthRight = borderWidthRight;
- updateBorderBasedOnWidth(borderWidthRight, RIGHT);
- }
-
- /**
- * Gets the width of a border.
- * @return a width
- */
- public float getBorderWidthTop()
- {
- return getVariableBorderWidth( borderWidthTop, TOP );
- }
-
-/**
- * Sets the width of a border
- * @param borderWidthTop a width
- */
- public void setBorderWidthTop( float borderWidthTop )
- {
- this.borderWidthTop = borderWidthTop;
- updateBorderBasedOnWidth(borderWidthTop, TOP);
- }
-
- /**
- * Gets the width of a border.
- * @return a width
- */
- public float getBorderWidthBottom()
- {
- return getVariableBorderWidth( borderWidthBottom, BOTTOM );
- }
-
-/**
- * Sets the width of a border
- * @param borderWidthBottom a width
- */
- public void setBorderWidthBottom( float borderWidthBottom )
- {
- this.borderWidthBottom = borderWidthBottom;
- updateBorderBasedOnWidth(borderWidthBottom, BOTTOM);
- }
-
-/**
- * Updates the border flag for a side based on the specified
- * width. A width of 0 will disable the border on that side.
- * Any other width enables it.
- * @param width width of border
- * @param side border side constant
- */
-
- private void updateBorderBasedOnWidth(float width, int side)
- {
- useVariableBorders = true;
- if (width > 0)
- {
- enableBorderSide(side);
- }
- else
- {
- disableBorderSide(side);
- }
- }
-
- private float getVariableBorderWidth( float variableWidthValue, int side )
- {
- if ((border & side) != 0)
- {
- return variableWidthValue != UNDEFINED ? variableWidthValue : borderWidth;
- }
- else
- {
- return 0;
- }
- }
-
-/**
- * Indicates whether variable width borders are being used.
- * Returns true if <CODE>setBorderWidthLeft, setBorderWidthRight,
- * setBorderWidthTop, or setBorderWidthBottom</CODE> has been called.
- *
- * @return true if variable width borders are in use
- *
- */
- public boolean isUseVariableBorders()
- {
- return useVariableBorders;
- }
-
-/**
- * Sets a parameter indicating if the rectangle has variable borders
- * @param useVariableBorders indication if the rectangle has variable borders
- */
-public void setUseVariableBorders(boolean useVariableBorders)
- {
- this.useVariableBorders = useVariableBorders;
- }
-
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/RomanList.java b/LibrarySource/com/lowagie/text/RomanList.java
deleted file mode 100644
index 98ab0f8..0000000
--- a/LibrarySource/com/lowagie/text/RomanList.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Copyright 2003 by Michael Niedermair.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text;
-
-/**
- *
- * A special-version of <CODE>LIST</CODE> which use roman-letters.
- *
- * @see com.lowagie.text.List
- * @version 2003-06-22
- * @author Michael Niedermair
- */
-
-public class RomanList extends List {
-
- /**
- * UpperCase or LowerCase
- */
- protected boolean romanlower;
-
- /**
- * Initialization
- *
- * @param symbolIndent indent
- */
- public RomanList(int symbolIndent) {
- super(true, symbolIndent);
- }
-
- /**
- * Initialization
- * @param romanlower roman-char in lowercase
- * @param symbolIndent indent
- */
- public RomanList(boolean romanlower, int symbolIndent) {
- super(true, symbolIndent);
- this.romanlower = romanlower;
- }
-
- /**
- * set the roman-letters to lowercase otherwise to uppercase
- *
- * @param romanlower
- */
- public void setRomanLower(boolean romanlower) {
- this.romanlower = romanlower;
- }
-
- /**
- * Checks if the list is roman-letter with lowercase
- *
- * @return <CODE>true</CODE> if the roman-letter is lowercase, <CODE>false</CODE> otherwise.
- */
- public boolean isRomanLower() {
- return romanlower;
- }
-
- /**
- * Adds an <CODE>Object</CODE> to the <CODE>List</CODE>.
- *
- * @param o the object to add.
- * @return true if adding the object succeeded
- */
- public boolean add(Object o) {
- if (o instanceof ListItem) {
- ListItem item = (ListItem) o;
- Chunk chunk;
- if (romanlower)
- chunk = new Chunk(toRomanLowerCase(first + list.size()), symbol.font());
- else
- chunk = new Chunk(toRomanUppercase(first + list.size()), symbol.font());
- chunk.append(".");
- item.setListSymbol(chunk);
- item.setIndentationLeft(symbolIndent);
- item.setIndentationRight(0);
- list.add(item);
- } else if (o instanceof List) {
- List nested = (List) o;
- nested.setIndentationLeft(nested.indentationLeft() + symbolIndent);
- first--;
- return list.add(nested);
- } else if (o instanceof String) {
- return this.add(new ListItem((String) o));
- }
- return false;
- }
-
- // ****************************************************************************************
-
- /*
- * Wandelt eine Integer-Zahl in r�mische Schreibweise um
- *
- * Regeln: http://de.wikipedia.org/wiki/R%F6mische_Ziffern
- *
- * 1. Die Ziffern werden addiert, wobei sie von gro� nach klein sortiert sind:
- *
- * XVII = 10+5+1+1=17
- *
- * 2. Eine kleinere Ziffer, die links von einer gr��eren steht, wird abgezogen:
- *
- * IV = 5-1=4
- * CM = 1000-100=900
- *
- * 3. Maximal drei gleiche Ziffern stehen nebeneinander (Ausnahme: IIII auf Zifferblaettern von Uhren):
- *
- * XL = 40 (und nicht XXXX)
- * IX = 9 (und nicht VIIII)
- * Diese "Subtraktionsschreibweise" ist erst im Mittelalter allgemein gebr�uchlich geworden.
- * Vorher wurde oft "IIII" f�r "4" geshrieben.
- *
- * 4. Bei mehreren m�glichen Schreibweisen wird in der Regel der k�rzesten der Vorzug gegeben:
- *
- * IC = 99 (auch LXLIX)
- * IL = 49 (auch XLIX oder sogar XLVIV)
- * Andererseits gibt es die Vorschrift, nach der ein Symbol, das einen Wert von 10n darstellt,
- * nicht einem Symbol, das einen Wert von 10(n+1) darstellt, direkt voranstehen darf.
- * Nach dieser Regel w�re die Schreibweise "XCIX" f�r "99" der Schreibweise "IC" vorzuziehen.
- *
- * 5. Die r�mischen Zahlen V, L und D k�nnen nicht gr��eren Zahlen voran gestellt werden:
- *
- * XCV = 95 (nicht VC)
- *
- * Zahlen �ber 3000 werden dargestellt durch Einkastung der Tausender: |IX|LIV=9054
- *
- *
- * Zahlen gr��er als 3.000.000 werden durch Doppelstrich etc. dargestellt.
- */
-
- /**
- * Array with Roman digits.
- */
- private static final RomanDigit[] roman =
- {
- new RomanDigit('m', 1000, false),
- new RomanDigit('d', 500, false),
- new RomanDigit('c', 100, true),
- new RomanDigit('l', 50, false),
- new RomanDigit('x', 10, true),
- new RomanDigit('v', 5, false),
- new RomanDigit('i', 1, true)};
-
- /**
- * changes an int into a lower case roman number.
- * @param number the original number
- * @return the roman number (lower case)
- */
- public static String toRoman(int number) {
- return toRomanLowerCase(number);
- }
-
- /**
- * Changes an int into an upper case roman number.
- * @param number the original number
- * @return the roman number (upper case)
- */
- public static String toRomanUppercase(int number) {
- return toRomanLowerCase(number).toUpperCase();
- }
-
- /**
- * Changes an int into a lower case roman number.
- * @param number the original number
- * @return the roman number (lower case)
- */
- public static String toRomanLowerCase(int number) {
-
- // Buffer
- StringBuffer buf = new StringBuffer();
-
- // kleiner 0 ? Vorzeichen festlegen
- if (number < 0) {
- buf.append('-');
- number = -number;
- }
-
- // gr��er 3000
- if (number > 3000) {
- // rekursiver Aufruf (ohne tausender-Bereich)
- buf.append('|');
- buf.append(toRomanLowerCase(number / 1000));
- buf.append('|');
- // tausender-Bereich
- number = number - (number / 1000) * 1000;
- }
-
- // Schleife
- int pos = 0;
- while (true) {
- // roman-array durchlaufen
- RomanDigit dig = roman[pos];
-
- // solange Zahl gr��er roman-Wert
- while (number >= dig.value) {
- // Zeichen hinzuf�gen
- buf.append(dig.digit);
- // Wert des Zeichens abziehen
- number -= dig.value;
- }
-
- // Abbruch
- if (number <= 0) {
- break;
- }
- // pre=false suchen (ab Stelle pos)
- int j = pos;
- while (!roman[++j].pre);
-
- // neuer Wert gr��er
- if (number + roman[j].value >= dig.value) {
- // hinzuf�gen
- buf.append(roman[j].digit).append(dig.digit);
- // Wert vom Rest abziehen
- number -= dig.value - roman[j].value;
- }
- pos++;
- }
- return buf.toString();
- }
-
- /**
- * Helper class for Roman Digits
- */
- private static class RomanDigit {
-
- /** part of a roman number */
- public char digit;
-
- /** value of the roman digit */
- public int value;
-
- /** can the digit be used as a prefix */
- public boolean pre;
-
- /**
- * Constructs a roman digit
- * @param digit the roman digit
- * @param value the value
- * @param pre can it be used as a prefix
- */
- RomanDigit(char digit, int value, boolean pre) {
- this.digit = digit;
- this.value = value;
- this.pre = pre;
- }
- }
-
-}
diff --git a/LibrarySource/com/lowagie/text/Row.java b/LibrarySource/com/lowagie/text/Row.java
deleted file mode 100644
index 08308b1..0000000
--- a/LibrarySource/com/lowagie/text/Row.java
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- * $Id: Row.java,v 1.63 2005/04/13 09:17:11 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU LIBRARY GENERAL PUBLIC LICENSE for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.util.ArrayList;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * A <CODE>Row</CODE> is part of a <CODE>Table</CODE>
- * and contains some <CODE>Cells</CODE>.
- * <P>
- * All <CODE>Row</CODE>s are constructed by a <CODE>Table</CODE>-object.
- * You don't have to construct any <CODE>Row</CODE> yourself.
- * In fact you can't construct a <CODE>Row</CODE> outside the package.
- * <P>
- * Since a <CODE>Cell</CODE> can span several rows and/or columns
- * a row can contain reserved space without any content.
- *
- * @see Element
- * @see Cell
- * @see Table
- */
-
-public class Row implements Element, MarkupAttributes {
-
- // membervariables
-
-/** id of a null element in a Row*/
- public static final int NULL = 0;
-
-/** id of the Cell element in a Row*/
- public static final int CELL = 1;
-
-/** id of the Table element in a Row*/
- public static final int TABLE = 2;
-
-/** This is the number of columns in the <CODE>Row</CODE>. */
- protected int columns;
-
-/** This is a valid position the <CODE>Row</CODE>. */
- protected int currentColumn;
-
-/** This is the array that keeps track of reserved cells. */
- protected boolean[] reserved;
-
-/** This is the array of Objects (<CODE>Cell</CODE> or <CODE>Table</CODE>). */
- protected Object[] cells;
-
-/** This is the vertical alignment. */
- protected int horizontalAlignment;
-
-/** This is the vertical alignment. */
- protected int verticalAlignment;
-
-/** Contains extra markupAttributes */
- protected Properties markupAttributes;
-
- // constructors
-
-/**
- * Constructs a <CODE>Row</CODE> with a certain number of <VAR>columns</VAR>.
- *
- * @param columns a number of columns
- */
-
- protected Row(int columns) {
- this.columns = columns;
- reserved = new boolean[columns];
- cells = new Object[columns];
- currentColumn = 0;
- }
-
- // implementation of the Element-methods
-
-/**
- * Processes the element by adding it (or the different parts) to a
- * <CODE>ElementListener</CODE>.
- *
- * @param listener an <CODE>ElementListener</CODE>
- * @return <CODE>true</CODE> if the element was processed successfully
- */
-
- public boolean process(ElementListener listener) {
- try {
- return listener.add(this);
- }
- catch(DocumentException de) {
- return false;
- }
- }
-
-/**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type() {
- return Element.ROW;
- }
-
-/**
- * Gets all the chunks in this element.
- *
- * @return an <CODE>ArrayList</CODE>
- */
-
- public ArrayList getChunks() {
- return new ArrayList();
- }
-
-/**
- * Returns a <CODE>Row</CODE> that is a copy of this <CODE>Row</CODE>
- * in which a certain column has been deleted.
- *
- * @param column the number of the column to delete
- */
-
- void deleteColumn(int column) {
- if ((column >= columns) || (column < 0)) {
- throw new IndexOutOfBoundsException("getCell at illegal index : " + column);
- }
- columns--;
- boolean newReserved[] = new boolean[columns];
- Object newCells[] = new Cell[columns];
-
- for (int i = 0; i < column; i++) {
- newReserved[i] = reserved[i];
- newCells[i] = cells[i];
- if (newCells[i] != null && (i + ((Cell) newCells[i]).colspan() > column)) {
- ((Cell) newCells[i]).setColspan(((Cell) cells[i]).colspan() - 1);
- }
- }
- for (int i = column; i < columns; i++) {
- newReserved[i] = reserved[i + 1];
- newCells[i] = cells[i + 1];
- }
- if (cells[column] != null && ((Cell) cells[column]).colspan() > 1) {
- newCells[column] = cells[column];
- ((Cell) newCells[column]).setColspan(((Cell) newCells[column]).colspan() - 1);
- }
- reserved = newReserved;
- cells = newCells;
- }
-
- // methods
-
-/**
- * Adds a <CODE>Cell</CODE> to the <CODE>Row</CODE>.
- *
- * @param element the element to add (currently only Cells and Tables supported)
- * @return the column position the <CODE>Cell</CODE> was added,
- * or <CODE>-1</CODE> if the <CODE>element</CODE> couldn't be added.
- */
-
- int addElement(Object element) {
- return addElement(element, currentColumn);
- }
-
-/**
- * Adds an element to the <CODE>Row</CODE> at the position given.
- *
- * @param element the element to add. (currently only Cells and Tables supported
- * @param column the position where to add the cell.
- * @return the column position the <CODE>Cell</CODE> was added,
- * or <CODE>-1</CODE> if the <CODE>Cell</CODE> couldn't be added.
- */
-
- int addElement(Object element, int column) {
- if (element == null) throw new NullPointerException("addCell - null argument");
- if ((column < 0) || (column > columns)) throw new IndexOutOfBoundsException("addCell - illegal column argument");
- if ( !((getObjectID(element) == CELL) || (getObjectID(element) == TABLE)) ) throw new IllegalArgumentException("addCell - only Cells or Tables allowed");
-
- int lColspan = ( (Cell.class.isInstance(element)) ? ((Cell) element).colspan() : 1);
-
- if ( reserve(column, lColspan) == false ) {
- return -1;
- }
-
- cells[column] = element;
- currentColumn += lColspan - 1;
-
- return column;
- }
-
-/**
- * Puts <CODE>Cell</CODE> to the <CODE>Row</CODE> at the position given, doesn't reserve colspan.
- *
- * @param aElement the cell to add.
- * @param column the position where to add the cell.
- */
-
- void setElement(Object aElement, int column) {
- if (reserved[column] == true) throw new IllegalArgumentException("setElement - position already taken");
-
- cells[column] = aElement;
- if (aElement != null) {
- reserved[column] = true;
- }
- }
-
-/**
- * Reserves a <CODE>Cell</CODE> in the <CODE>Row</CODE>.
- *
- * @param column the column that has to be reserved.
- * @return <CODE>true</CODE> if the column was reserved, <CODE>false</CODE> if not.
- */
-
- boolean reserve(int column) {
- return reserve(column, 1);
- }
-
-
-/**
- * Reserves a <CODE>Cell</CODE> in the <CODE>Row</CODE>.
- *
- * @param column the column that has to be reserved.
- * @param size the number of columns
- * @return <CODE>true</CODE> if the column was reserved, <CODE>false</CODE> if not.
- */
-
- boolean reserve(int column, int size) {
- if ((column < 0) || ((column + size) > columns)) throw new IndexOutOfBoundsException("reserve - incorrect column/size");
-
- for(int i=column; i < column + size; i++)
- {
- if (reserved[i] == true) {
- // undo reserve
- for(int j=i; j >= column; j--) {
- reserved[i] = false;
- }
- return false;
- }
- reserved[i] = true;
- }
- return true;
- }
-
-/**
- * Sets the horizontal alignment.
- *
- * @param value the new value
- */
-
- public void setHorizontalAlignment(int value) {
- horizontalAlignment = value;
- }
-
-/**
- * Sets the vertical alignment.
- *
- * @param value the new value
- */
-
- public void setVerticalAlignment(int value) {
- verticalAlignment = value;
- }
-
- // methods to retrieve information
-
-/**
- * Returns true/false when this position in the <CODE>Row</CODE> has been reserved, either filled or through a colspan of an Element.
- *
- * @param column the column.
- * @return <CODE>true</CODE> if the column was reserved, <CODE>false</CODE> if not.
- */
-
- boolean isReserved(int column) {
- return reserved[column];
- }
-
-/**
- * Returns the type-id of the element in a Row.
- *
- * @param column the column of which you'd like to know the type
- * @return the type-id of the element in the row
- */
-
- int getElementID(int column) {
- if (cells[column] == null) return NULL;
- else if (Cell.class.isInstance(cells[column])) return CELL;
- else if (Table.class.isInstance(cells[column])) return TABLE;
-
- return -1;
- }
-
-
-/**
- * Returns the type-id of an Object.
- *
- * @param element the object of which you'd like to know the type-id, -1 if invalid
- * @return the type-id of an object
- */
-
- int getObjectID(Object element) {
- if (element == null) return NULL;
- else if (Cell.class.isInstance(element)) return CELL;
- else if (Table.class.isInstance(element)) return TABLE;
-
- return -1;
- }
-
-
-/**
- * Gets a <CODE>Cell</CODE> or <CODE>Table</CODE> from a certain column.
- *
- * @param column the column the <CODE>Cell/Table</CODE> is in.
- * @return the <CODE>Cell</CODE>,<CODE>Table</CODE> or <VAR>Object</VAR> if the column was
- * reserved or null if empty.
- */
-
- public Object getCell(int column) {
- if ((column < 0) || (column > columns)) {
- throw new IndexOutOfBoundsException("getCell at illegal index :" + column + " max is " + columns);
- }
- return cells[column];
- }
-
-/**
- * Checks if the row is empty.
- *
- * @return <CODE>true</CODE> if none of the columns is reserved.
- */
-
- public boolean isEmpty() {
- for (int i = 0; i < columns; i++) {
- if (cells[i] != null) {
- return false;
- }
- }
- return true;
- }
-
-/**
- * Gets the index of the current, valid position
- *
- * @return a value
- */
-
- int validPosition() {
- return currentColumn;
- }
-
-/**
- * Gets the number of columns.
- *
- * @return a value
- */
-
- public int columns() {
- return columns;
- }
-
-/**
- * Gets the horizontal alignment.
- *
- * @return a value
- */
-
- public int horizontalAlignment() {
- return horizontalAlignment;
- }
-
-/**
- * Gets the vertical alignment.
- *
- * @return a value
- */
-
- public int verticalAlignment() {
- return verticalAlignment;
- }
-
-/**
- * Checks if a given tag corresponds with this object.
- *
- * @param tag the given tag
- * @return true if the tag corresponds
- */
-
- public static boolean isTag(String tag) {
- return ElementTags.ROW.equals(tag);
- }
-
-
-/**
- * @see com.lowagie.text.MarkupAttributes#setMarkupAttribute(java.lang.String, java.lang.String)
- */
- public void setMarkupAttribute(String name, String value) {
- if (markupAttributes == null) markupAttributes = new Properties();
- markupAttributes.put(name, value);
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#setMarkupAttributes(java.util.Properties)
- */
- public void setMarkupAttributes(Properties markupAttributes) {
- this.markupAttributes = markupAttributes;
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttribute(java.lang.String)
- */
- public String getMarkupAttribute(String name) {
- return (markupAttributes == null) ? null : String.valueOf(markupAttributes.get(name));
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttributeNames()
- */
- public Set getMarkupAttributeNames() {
- return Chunk.getKeySet(markupAttributes);
- }
-
-/**
- * @see com.lowagie.text.MarkupAttributes#getMarkupAttributes()
- */
- public Properties getMarkupAttributes() {
- return markupAttributes;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/Section.java b/LibrarySource/com/lowagie/text/Section.java
deleted file mode 100644
index 9ab0753..0000000
--- a/LibrarySource/com/lowagie/text/Section.java
+++ /dev/null
@@ -1,660 +0,0 @@
-/*
- * $Id: Section.java,v 1.78 2004/12/14 11:52:50 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Properties;
-
-/**
- * A <CODE>Section</CODE> is a part of a <CODE>Document</CODE> containing
- * other <CODE>Section</CODE>s, <CODE>Paragraph</CODE>s, <CODE>List</CODE>
- * and/or <CODE>Table</CODE>s.
- * <P>
- * Remark: you can not construct a <CODE>Section</CODE> yourself.
- * You will have to ask an instance of <CODE>Section</CODE> to the
- * <CODE>Chapter</CODE> or <CODE>Section</CODE> to which you want to
- * add the new <CODE>Section</CODE>.
- * <P>
- * Example:
- * <BLOCKQUOTE><PRE>
- * Paragraph title2 = new Paragraph("This is Chapter 2", FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0, 255)));
- * Chapter chapter2 = new Chapter(title2, 2);
- * Paragraph someText = new Paragraph("This is some text");
- * chapter2.add(someText);
- * Paragraph title21 = new Paragraph("This is Section 1 in Chapter 2", FontFactory.getFont(FontFactory.HELVETICA, 16, Font.BOLD, new Color(255, 0, 0)));
- * <STRONG>Section section1 = chapter2.addSection(title21);</STRONG>
- * Paragraph someSectionText = new Paragraph("This is some silly paragraph in a chapter and/or section. It contains some text to test the functionality of Chapters and Section.");
- * <STRONG>section1.add(someSectionText);</STRONG>
- * Paragraph title211 = new Paragraph("This is SubSection 1 in Section 1 in Chapter 2", FontFactory.getFont(FontFactory.HELVETICA, 14, Font.BOLD, new Color(255, 0, 0)));
- * <STRONG>Section section11 = section1.addSection(40, title211, 2);</STRONG>
- * <STRONG>section11.add(someSectionText);</STRONG>
- * </PRE></BLOCKQUOTE>
- */
-
-public class Section extends ArrayList implements TextElementArray {
-
- // membervariables
-
-/** This is the title of this section. */
- protected Paragraph title;
-
-/** This is the number of sectionnumbers that has to be shown before the section title. */
- protected int numberDepth;
-
-/** The indentation of this section on the left side. */
- protected float indentationLeft;
-
-/** The indentation of this section on the right side. */
- protected float indentationRight;
-
-/** The additional indentation of the content of this section. */
- protected float sectionIndent;
-
-/** This is the number of subsections. */
- protected int subsections = 0;
-
-/** This is the complete list of sectionnumbers of this section and the parents of this section. */
- protected ArrayList numbers = null;
-
- /** false if the bookmark children are not visible */
- protected boolean bookmarkOpen = true;
-
- /** The bookmark title if different from the content title */
- protected String bookmarkTitle;
- // constructors
-
-/**
- * Constructs a new <CODE>Section</CODE>.
- */
-
- protected Section() {
- title = new Paragraph();
- numberDepth = 1;
- }
-
-/**
- * Constructs a new <CODE>Section</CODE>.
- *
- * @param title a <CODE>Paragraph</CODE>
- * @param numberDepth the numberDepth
- */
-
- Section(Paragraph title, int numberDepth) {
- this.numberDepth = numberDepth;
- this.title = title;
- }
-
- // private methods
-
-/**
- * Sets the number of this section.
- *
- * @param number the number of this section
- * @param numbers an <CODE>ArrayList</CODE>, containing the numbers of the Parent
- */
-
- private void setNumbers(int number, ArrayList numbers) {
- this.numbers = new ArrayList();
- this.numbers.add(new Integer(number));
- this.numbers.addAll(numbers);
- }
-
- // implementation of the Element-methods
-
-/**
- * Processes the element by adding it (or the different parts) to an
- * <CODE>ElementListener</CODE>.
- *
- * @param listener the <CODE>ElementListener</CODE>
- * @return <CODE>true</CODE> if the element was processed successfully
- */
-
- public boolean process(ElementListener listener) {
- try {
- for (Iterator i = iterator(); i.hasNext(); ) {
- listener.add((Element) i.next());
- }
- return true;
- }
- catch(DocumentException de) {
- return false;
- }
- }
-
-/**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type() {
- return Element.SECTION;
- }
-
-/**
- * Gets all the chunks in this element.
- *
- * @return an <CODE>ArrayList</CODE>
- */
-
- public ArrayList getChunks() {
- ArrayList tmp = new ArrayList();
- for (Iterator i = iterator(); i.hasNext(); ) {
- tmp.addAll(((Element) i.next()).getChunks());
- }
- return tmp;
- }
-
- // overriding some of the ArrayList-methods
-
-/**
- * Adds a <CODE>Paragraph</CODE>, <CODE>List</CODE> or <CODE>Table</CODE>
- * to this <CODE>Section</CODE>.
- *
- * @param index index at which the specified element is to be inserted
- * @param o an object of type <CODE>Paragraph</CODE>, <CODE>List</CODE> or <CODE>Table</CODE>=
- * @throws ClassCastException if the object is not a <CODE>Paragraph</CODE>, <CODE>List</CODE> or <CODE>Table</CODE>
- */
-
- public void add(int index, Object o) {
- try {
- Element element = (Element) o;
- if (element.type() == Element.PARAGRAPH ||
- element.type() == Element.LIST ||
- element.type() == Element.CHUNK ||
- element.type() == Element.PHRASE ||
- element.type() == Element.ANCHOR ||
- element.type() == Element.ANNOTATION ||
- element.type() == Element.TABLE ||
- element.type() == Element.PTABLE ||
- element.type() == Element.IMGTEMPLATE ||
- element.type() == Element.JPEG ||
- element.type() == Element.IMGRAW) {
- super.add(index, element);
- }
- else {
- throw new ClassCastException(String.valueOf(element.type()));
- }
- }
- catch(ClassCastException cce) {
- throw new ClassCastException("Insertion of illegal Element: " + cce.getMessage());
- }
- }
-
-/**
- * Adds a <CODE>Paragraph</CODE>, <CODE>List</CODE>, <CODE>Table</CODE> or another <CODE>Section</CODE>
- * to this <CODE>Section</CODE>.
- *
- * @param o an object of type <CODE>Paragraph</CODE>, <CODE>List</CODE>, <CODE>Table</CODE> or another <CODE>Section</CODE>
- * @return a boolean
- * @throws ClassCastException if the object is not a <CODE>Paragraph</CODE>, <CODE>List</CODE>, <CODE>Table</CODE> or <CODE>Section</CODE>
- */
-
- public boolean add(Object o) {
- try {
- Element element = (Element) o;
- if (element.type() == Element.PARAGRAPH ||
- element.type() == Element.LIST ||
- element.type() == Element.CHUNK ||
- element.type() == Element.PHRASE ||
- element.type() == Element.ANCHOR ||
- element.type() == Element.ANNOTATION ||
- element.type() == Element.TABLE ||
- element.type() == Element.IMGTEMPLATE ||
- element.type() == Element.PTABLE ||
- element.type() == Element.JPEG ||
- element.type() == Element.IMGRAW) {
- return super.add(o);
- }
- else if (element.type() == Element.SECTION) {
- Section section = (Section) o;
- section.setNumbers(++subsections, numbers);
- return super.add(section);
- }
- else {
- throw new ClassCastException(String.valueOf(element.type()));
- }
- }
- catch(ClassCastException cce) {
- throw new ClassCastException("Insertion of illegal Element: " + cce.getMessage());
- }
- }
-
-/**
- * Adds a collection of <CODE>Element</CODE>s
- * to this <CODE>Section</CODE>.
- *
- * @param collection a collection of <CODE>Paragraph</CODE>s, <CODE>List</CODE>s and/or <CODE>Table</CODE>s
- * @return <CODE>true</CODE> if the action succeeded, <CODE>false</CODE> if not.
- * @throws ClassCastException if one of the objects isn't a <CODE>Paragraph</CODE>, <CODE>List</CODE>, <CODE>Table</CODE>
- */
-
- public boolean addAll(Collection collection) {
- for (Iterator iterator = collection.iterator(); iterator.hasNext(); ) {
- this.add(iterator.next());
- }
- return true;
- }
-
- // methods that return a Section
-
-/**
- * Creates a <CODE>Section</CODE>, adds it to this <CODE>Section</CODE> and returns it.
- *
- * @param indentation the indentation of the new section
- * @param title the title of the new section
- * @param numberDepth the numberDepth of the section
- * @return a new Section object
- */
-
- public Section addSection(float indentation, Paragraph title, int numberDepth) {
- Section section = new Section(title, numberDepth);
- section.setIndentation(indentation);
- add(section);
- return section;
- }
-
-/**
- * Creates a <CODE>Section</CODE>, adds it to this <CODE>Section</CODE> and returns it.
- *
- * @param indentation the indentation of the new section
- * @param title the title of the new section
- * @return a new Section object
- */
-
- public Section addSection(float indentation, Paragraph title) {
- Section section = new Section(title, 1);
- section.setIndentation(indentation);
- add(section);
- return section;
- }
-
-/**
- * Creates a <CODE>Section</CODE>, add it to this <CODE>Section</CODE> and returns it.
- *
- * @param title the title of the new section
- * @param numberDepth the numberDepth of the section
- * @return a new Section object
- */
-
- public Section addSection(Paragraph title, int numberDepth) {
- Section section = new Section(title, numberDepth);
- add(section);
- return section;
- }
-
-/**
- * Creates a <CODE>Section</CODE>, adds it to this <CODE>Section</CODE> and returns it.
- *
- * @param title the title of the new section
- * @return a new Section object
- */
-
- public Section addSection(Paragraph title) {
- Section section = new Section(title, 1);
- add(section);
- return section;
- }
-
-/**
- * Adds a <CODE>Section</CODE> to this <CODE>Section</CODE> and returns it.
- *
- * @param indentation the indentation of the new section
- * @param title the title of the new section
- * @param numberDepth the numberDepth of the section
- * @return a new Section object
- */
-
- public Section addSection(float indentation, String title, int numberDepth) {
- Section section = new Section(new Paragraph(title), numberDepth);
- section.setIndentation(indentation);
- add(section);
- return section;
- }
-
-/**
- * Adds a <CODE>Section</CODE> to this <CODE>Section</CODE> and returns it.
- *
- * @param title the title of the new section
- * @param numberDepth the numberDepth of the section
- * @return a new Section object
- */
-
- public Section addSection(String title, int numberDepth) {
- Section section = new Section(new Paragraph(title), numberDepth);
- add(section);
- return section;
- }
-
-/**
- * Adds a <CODE>Section</CODE> to this <CODE>Section</CODE> and returns it.
- *
- * @param indentation the indentation of the new section
- * @param title the title of the new section
- * @return a new Section object
- */
-
- public Section addSection(float indentation, String title) {
- Section section = new Section(new Paragraph(title), 1);
- section.setIndentation(indentation);
- add(section);
- return section;
- }
-
-/**
- * Adds a <CODE>Section</CODE> to this <CODE>Section</CODE> and returns it.
- *
- * @param title the title of the new section
- * @return a new Section object
- */
-
- public Section addSection(String title) {
- Section section = new Section(new Paragraph(title), 1);
- add(section);
- return section;
- }
-
-/**
- * Creates a given <CODE>Section</CODE> following a set of attributes and adds it to this one.
- *
- * @param attributes the attributes
- * @return a Section
- */
-
- public Section addSection(Properties attributes) {
- Section section = new Section(new Paragraph(""), 1);
- String value;
- if ((value = (String)attributes.remove(ElementTags.NUMBER)) != null) {
- subsections = Integer.parseInt(value) - 1;
- }
- section.set(attributes);
- add(section);
- return section;
- }
-
-
- // public methods
-
-/**
- * Alters the attributes of this <CODE>Section</CODE>.
- *
- * @param attributes the attributes
- */
-
- public void set(Properties attributes) {
- String value;
- if ((value = (String)attributes.remove(ElementTags.NUMBERDEPTH)) != null) {
- setNumberDepth(Integer.parseInt(value));
- }
- if ((value = (String)attributes.remove(ElementTags.INDENT)) != null) {
- setIndentation(Float.valueOf(value + "f").floatValue());
- }
- if ((value = (String)attributes.remove(ElementTags.INDENTATIONLEFT)) != null) {
- setIndentationLeft(Float.valueOf(value + "f").floatValue());
- }
- if ((value = (String)attributes.remove(ElementTags.INDENTATIONRIGHT)) != null) {
- setIndentationRight(Float.valueOf(value + "f").floatValue());
- }
- }
-
-/**
- * Sets the title of this section.
- *
- * @param title the new title
- */
-
- public void setTitle(Paragraph title) {
- this.title = title;
- }
-
-/**
- * Sets the depth of the sectionnumbers that will be shown preceding the title.
- * <P>
- * If the numberdepth is 0, the sections will not be numbered. If the numberdepth
- * is 1, the section will be numbered with their own number. If the numberdepth is
- * higher (for instance x > 1), the numbers of x - 1 parents will be shown.
- *
- * @param numberDepth the new numberDepth
- */
-
- public void setNumberDepth(int numberDepth) {
- this.numberDepth = numberDepth;
- }
-
-/**
- * Sets the indentation of this <CODE>Section</CODE> on the left side.
- *
- * @param indentation the indentation
- */
-
- public void setIndentationLeft(float indentation) {
- indentationLeft = indentation;
- }
-
-/**
- * Sets the indentation of this <CODE>Section</CODE> on the right side.
- *
- * @param indentation the indentation
- */
-
- public void setIndentationRight(float indentation) {
- indentationRight = indentation;
- }
-
-/**
- * Sets the indentation of the content of this <CODE>Section</CODE>.
- *
- * @param indentation the indentation
- */
-
- public void setIndentation(float indentation) {
- sectionIndent = indentation;
- }
-
- // methods to retrieve information
-
-/**
- * Checks if this object is a <CODE>Chapter</CODE>.
- *
- * @return <CODE>true</CODE> if it is a <CODE>Chapter</CODE>,
- * <CODE>false</CODE> if it is a <CODE>Section</CODE>.
- */
-
- public boolean isChapter() {
- return type() == Element.CHAPTER;
- }
-
-/**
- * Checks if this object is a <CODE>Section</CODE>.
- *
- * @return <CODE>true</CODE> if it is a <CODE>Section</CODE>,
- * <CODE>false</CODE> if it is a <CODE>Chapter</CODE>.
- */
-
- public boolean isSection() {
- return type() == Element.SECTION;
- }
-
-/**
- * Returns the numberdepth of this <CODE>Section</CODE>.
- *
- * @return the numberdepth
- */
-
- public int numberDepth() {
- return numberDepth;
- }
-
-/**
- * Returns the indentation of this <CODE>Section</CODE> on the left side.
- *
- * @return the indentation
- */
-
- public float indentationLeft() {
- return indentationLeft;
- }
-
-/**
- * Returns the indentation of this <CODE>Section</CODE> on the right side.
- *
- * @return the indentation
- */
-
- public float indentationRight() {
- return indentationRight;
- }
-
-/**
- * Returns the indentation of the content of this <CODE>Section</CODE>.
- *
- * @return the indentation
- */
-
- public float indentation() {
- return sectionIndent;
- }
-
-/**
- * Returns the depth of this section.
- *
- * @return the depth
- */
-
- public int depth() {
- return numbers.size();
- }
-
-/**
- * Returns the title, preceeded by a certain number of sectionnumbers.
- *
- * @return a <CODE>Paragraph</CODE>
- */
-
- public Paragraph title() {
- if (title == null) {
- return null;
- }
- int depth = Math.min(numbers.size(), numberDepth);
- if (depth < 1) {
- return title;
- }
- StringBuffer buf = new StringBuffer(" ");
- for (int i = 0; i < depth; i++) {
- buf.insert(0, ".");
- buf.insert(0, ((Integer) numbers.get(i)).intValue());
- }
- Paragraph result = new Paragraph(title);
- result.setMarkupAttributes(title.getMarkupAttributes());
- result.add(0, new Chunk(buf.toString(), title.font()));
- return result;
- }
-
-/**
- * Checks if a given tag corresponds with a title tag for this object.
- *
- * @param tag the given tag
- * @return true if the tag corresponds
- */
-
- public static boolean isTitle(String tag) {
- return ElementTags.TITLE.equals(tag);
- }
-
-/**
- * Checks if a given tag corresponds with this object.
- *
- * @param tag the given tag
- * @return true if the tag corresponds
- */
-
- public static boolean isTag(String tag) {
- return ElementTags.SECTION.equals(tag);
- }
-
- /** Getter for property bookmarkOpen.
- * @return Value of property bookmarkOpen.
- */
- public boolean isBookmarkOpen() {
- return bookmarkOpen;
- }
-
- /** Setter for property bookmarkOpen.
- * @param bookmarkOpen false if the bookmark children are not
- * visible.
- */
- public void setBookmarkOpen(boolean bookmarkOpen) {
- this.bookmarkOpen = bookmarkOpen;
- }
-
- /**
- * Gets the bookmark title.
- * @return the bookmark title
- */
- public Paragraph getBookmarkTitle() {
- if (bookmarkTitle == null)
- return title();
- else
- return new Paragraph(bookmarkTitle);
- }
-
- /**
- * Sets the bookmark title. The bookmark title is the same as the section title but
- * can be changed with this method.
- * @param bookmarkTitle the bookmark title
- */
- public void setBookmarkTitle(String bookmarkTitle) {
- this.bookmarkTitle = bookmarkTitle;
- }
-
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/SpecialSymbol.java b/LibrarySource/com/lowagie/text/SpecialSymbol.java
deleted file mode 100644
index 7d32101..0000000
--- a/LibrarySource/com/lowagie/text/SpecialSymbol.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * $Id: SpecialSymbol.java,v 1.1 2004/12/23 09:14:47 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-/**
- * This class contains the symbols that correspond with special symbols.
- * <P>
- * When you construct a <CODE>Phrase</CODE> with Phrase.getInstance using a <CODE>String</CODE>,
- * this <CODE>String</CODE> can contain special Symbols. These are characters with an int value
- * between 913 and 937 (except 930) and between 945 and 969. With this class the value of the
- * corresponding character of the Font Symbol, can be retrieved.
- *
- * @see Phrase
- *
- * @author Bruno Lowagie
- * @author Evelyne De Cordier
- */
-
-public class SpecialSymbol {
-
-/**
- * Returns the first occurrence of a special symbol in a <CODE>String</CODE>.
- *
- * @param string a <CODE>String</CODE>
- * @return an index of -1 if no special symbol was found
- */
-
- public static int index(String string) {
- int length = string.length();
- for (int i = 0; i < length; i++) {
- if (getCorrespondingSymbol(string.charAt(i)) != ' ') {
- return i;
- }
- }
- return -1;
- }
-
-/**
- * Gets a chunk with a symbol character.
- * @param c a character that has to be changed into a symbol
- * @param font Font if there is no SYMBOL character corresponding with c
- * @return a SYMBOL version of a character
- */
-
- public static Chunk get(char c, Font font) {
- char greek = SpecialSymbol.getCorrespondingSymbol(c);
- if (greek == ' ') {
- return new Chunk(String.valueOf(c), font);
- }
- Font symbol = new Font(Font.SYMBOL, font.size(), font.style(), font.color());
- String s = String.valueOf(greek);
- return new Chunk(s, symbol);
- }
-
-/**
- * Looks for the corresponding symbol in the font Symbol.
- *
- * @param c the original ASCII-char
- * @return the corresponding symbol in font Symbol
- */
-
- public static char getCorrespondingSymbol(char c) {
- switch(c) {
- case 913:
- return 'A'; // ALFA
- case 914:
- return 'B'; // BETA
- case 915:
- return 'G'; // GAMMA
- case 916:
- return 'D'; // DELTA
- case 917:
- return 'E'; // EPSILON
- case 918:
- return 'Z'; // ZETA
- case 919:
- return 'H'; // ETA
- case 920:
- return 'Q'; // THETA
- case 921:
- return 'I'; // IOTA
- case 922:
- return 'K'; // KAPPA
- case 923:
- return 'L'; // LAMBDA
- case 924:
- return 'M'; // MU
- case 925:
- return 'N'; // NU
- case 926:
- return 'X'; // XI
- case 927:
- return 'O'; // OMICRON
- case 928:
- return 'P'; // PI
- case 929:
- return 'R'; // RHO
- case 931:
- return 'S'; // SIGMA
- case 932:
- return 'T'; // TAU
- case 933:
- return 'U'; // UPSILON
- case 934:
- return 'J'; // PHI
- case 935:
- return 'C'; // CHI
- case 936:
- return 'Y'; // PSI
- case 937:
- return 'W'; // OMEGA
- case 945:
- return 'a'; // alfa
- case 946:
- return 'b'; // beta
- case 947:
- return 'g'; // gamma
- case 948:
- return 'd'; // delta
- case 949:
- return 'e'; // epsilon
- case 950:
- return 'z'; // zeta
- case 951:
- return 'h'; // eta
- case 952:
- return 'q'; // theta
- case 953:
- return 'i'; // iota
- case 954:
- return 'k'; // kappa
- case 955:
- return 'l'; // lambda
- case 956:
- return 'm'; // mu
- case 957:
- return 'n'; // nu
- case 958:
- return 'x'; // xi
- case 959:
- return 'o'; // omicron
- case 960:
- return 'p'; // pi
- case 961:
- return 'r'; // rho
- case 962:
- return 's'; // sigma
- case 963:
- return 's'; // sigma
- case 964:
- return 't'; // tau
- case 965:
- return 'u'; // upsilon
- case 966:
- return 'j'; // phi
- case 967:
- return 'c'; // chi
- case 968:
- return 'y'; // psi
- case 969:
- return 'w'; // omega
- default:
- return ' ';
- }
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/SplitCharacter.java b/LibrarySource/com/lowagie/text/SplitCharacter.java
deleted file mode 100644
index b40753d..0000000
--- a/LibrarySource/com/lowagie/text/SplitCharacter.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * $Id: SplitCharacter.java,v 1.12 2002/06/20 13:30:25 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 by Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import com.lowagie.text.pdf.PdfChunk;
-
-/** Interface for customizing the split character.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-
-public interface SplitCharacter {
-
- /**
- * Returns <CODE>true</CODE> if the character can split a line. The splitting implementation
- * is free to look ahead or look behind characters to make a decision.
- * <p>
- * The default implementation is:
- * <p>
- * <pre>
- * public boolean isSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck) {
- * char c;
- * if (ck == null)
- * c = cc[current];
- * else
- * c = ck[Math.min(current, ck.length - 1)].getUnicodeEquivalent(cc[current]);
- * if (c <= ' ' || c == '-') {
- * return true;
- * }
- * if (c < 0x2e80)
- * return false;
- * return ((c >= 0x2e80 && c < 0xd7a0)
- * || (c >= 0xf900 && c < 0xfb00)
- * || (c >= 0xfe30 && c < 0xfe50)
- * || (c >= 0xff61 && c < 0xffa0));
- * }
- * </pre>
- * @param start the lower limit of <CODE>cc</CODE> inclusive
- * @param current the pointer to the character in <CODE>cc</CODE>
- * @param end the upper limit of <CODE>cc</CODE> exclusive
- * @param cc an array of characters at least <CODE>end</CODE> sized
- * @param ck an array of <CODE>PdfChunk</CODE>. The main use is to be able to call
- * {@link PdfChunk#getUnicodeEquivalent(char)}. It may be <CODE>null</CODE>
- * or shorter than <CODE>end</CODE>. If <CODE>null</CODE> no convertion takes place.
- * If shorter than <CODE>end</CODE> the last element is used
- * @return <CODE>true</CODE> if the character(s) can split a line
- */
-
- public boolean isSplitCharacter(int start, int current, int end, char cc[], PdfChunk ck[]);
-}
-
diff --git a/LibrarySource/com/lowagie/text/StringCompare.java b/LibrarySource/com/lowagie/text/StringCompare.java
deleted file mode 100644
index f98811c..0000000
--- a/LibrarySource/com/lowagie/text/StringCompare.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * $Id: StringCompare.java,v 1.22 2002/07/09 10:41:40 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * Copyright (c) 2000 Volker Richert
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.util.Comparator;
-
-/**
- * This class was used in the 1.1-version of iText (by Volker Richert).
- * Paulo Soares suggested I should add it to the original library, so
- * that in the future it would be easier to port it to the JDK1.1.x.
- */
-
-public class StringCompare implements Comparator {
-
-/**
- * Compares 2 objects.
- *
- * @param o1 a first object
- * @param o2 a second object
- * @return a value
- * @throws ClassCastException if the objects aren't Strings
- */
-
- public int compare(Object o1, Object o2) {
- return ((String)o1).compareTo((String)o2);
- }
-
-}
diff --git a/LibrarySource/com/lowagie/text/Table.java b/LibrarySource/com/lowagie/text/Table.java
deleted file mode 100644
index 00ab697..0000000
--- a/LibrarySource/com/lowagie/text/Table.java
+++ /dev/null
@@ -1,1952 +0,0 @@
-/*
- * $Id: Table.java,v 1.132 2005/05/03 11:58:52 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU LIBRARY GENERAL PUBLIC LICENSE for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- *
- * Some methods in this class were contributed by Geert Poels, Kris Jespers and
- * Steve Ogryzek. Check the CVS repository.
- */
-
-package com.lowagie.text;
-
-import headless.awt.Color;
-import headless.awt.Dimension;
-import headless.awt.Point;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-import com.lowagie.text.markup.*;
-import com.lowagie.text.pdf.PdfContentByte;
-import com.lowagie.text.pdf.PdfPCell;
-import com.lowagie.text.pdf.PdfPTable;
-import com.lowagie.text.pdf.PdfPTableEvent;
-
-import java.text.DecimalFormat;
-/**
- * A <CODE>Table</CODE> is a <CODE>Rectangle</CODE> that contains <CODE>Cell</CODE>s,
- * ordered in some kind of matrix.
- * <P>
- * Tables that span multiple pages are cut into different parts automatically.
- * If you want a table header to be repeated on every page, you may not forget to
- * mark the end of the header section by using the method <CODE>endHeaders()</CODE>.
- * <P>
- * The matrix of a table is not necessarily an m x n-matrix. It can contain holes
- * or cells that are bigger than the unit. Believe me or not, but it took some serious
- * thinking to make this as userfriendly as possible. I hope you wil find the result
- * quite simple (I love simple solutions, especially for complex problems).
- * I didn't want it to be something as complex as the Java <CODE>GridBagLayout</CODE>.
- * <P>
- * Example:
- * <BLOCKQUOTE><PRE>
- * // Remark: You MUST know the number of columns when constructing a Table.
- * // The number of rows is not important.
- * <STRONG>Table table = new Table(3);</STRONG>
- * <STRONG>table.setBorderWidth(1);</STRONG>
- * <STRONG>table.setBorderColor(new Color(0, 0, 255));</STRONG>
- * <STRONG>table.setPadding(5);</STRONG>
- * <STRONG>table.setSpacing(5);</STRONG>
- * Cell cell = new Cell("header");
- * cell.setHeader(true);
- * cell.setColspan(3);
- * <STRONG>table.addCell(cell);</STRONG>
- * <STRONG>table.endHeaders();</STRONG>
- * cell = new Cell("example cell with colspan 1 and rowspan 2");
- * cell.setRowspan(2);
- * cell.setBorderColor(new Color(255, 0, 0));
- * <STRONG>table.addCell(cell);</STRONG>
- * <STRONG>table.addCell("1.1");</STRONG>
- * <STRONG>table.addCell("2.1");</STRONG>
- * <STRONG>table.addCell("1.2");</STRONG>
- * <STRONG>table.addCell("2.2");</STRONG>
- * <STRONG>table.addCell("cell test1");</STRONG>
- * cell = new Cell("big cell");
- * cell.setRowspan(2);
- * cell.setColspan(2);
- * <STRONG>table.addCell(cell);</STRONG>
- * <STRONG>table.addCell("cell test2");</STRONG>
- * </PRE></BLOCKQUOTE>
- * The result of this code is a table:
- * <TABLE ALIGN="Center" BORDER="1" BORDERCOLOR="#0000ff" CELLPADDING="5" CELLSPACING="5">
- * <TR ALIGN="Left" VALIGN="Left">
- * <TH ALIGN="Left" COLSPAN="3" VALIGN="Left">
- * header
- * </TH>
- * </TR>
- * <TR ALIGN="Left" VALIGN="Left">
- * <TD ALIGN="Left" BORDERCOLOR="#ff0000" ROWSPAN="2" VALIGN="Left">
- * example cell with colspan 1 and rowspan 2
- * </TD>
- * <TD ALIGN="Left" VALIGN="Left">
- * 1.1
- * </TD>
- * <TD ALIGN="Left" VALIGN="Left">
- * 2.1
- * </TD>
- * </TR>
- * <TR ALIGN="Left" VALIGN="Left">
- * <TD ALIGN="Left" VALIGN="Left">
- * 1.2
- * </TD>
- * <TD ALIGN="Left" VALIGN="Left">
- * 2.2
- * </TD>
- * </TR>
- * <TR ALIGN="Left" VALIGN="Left">
- * <TD ALIGN="Left" VALIGN="Left">
- * cell test1
- * </TD>
- * <TD ALIGN="Left" COLSPAN="2" ROWSPAN="2" VALIGN="Left">
- * big cell
- * </TD>
- * </TR>
- * <TR ALIGN="Left" VALIGN="Left">
- * <TD ALIGN="Left" VALIGN="Left">
- * cell test2
- * </TD>
- * </TR>
- * </TABLE>
- *
- * @see Rectangle
- * @see Element
- * @see Row
- * @see Cell
- */
-
-public class Table extends Rectangle implements Element, MarkupAttributes {
-
- // membervariables
-
- // these variables contain the data of the table
-
- /** This is the number of columns in the <CODE>Table</CODE>. */
- private int columns;
-
- // this is the current Position in the table
- private Point curPosition = new Point(0, 0);
-
- /** This is the list of <CODE>Row</CODE>s. */
- private ArrayList rows = new ArrayList();
-
- // these variables contain the layout of the table
-
- /** This Empty Cell contains the DEFAULT layout of each Cell added with the method addCell(String content). */
- private Cell defaultLayout = new Cell(true);
-
- /** This is the number of the last row of the table headers. */
- private int lastHeaderRow = -1;
-
- /** This is the horizontal alignment. */
- private int alignment = Element.ALIGN_CENTER;
-
- /** This is cellpadding. */
- private float cellpadding;
-
- /** This is cellspacing. */
- private float cellspacing;
-
- /** This is the width of the table (in percent of the available space). */
- private float widthPercentage = 80;
-
- // member variable added by Evelyne De Cordier
- /** This is the width of the table (in pixels). */
- private String absWidth = "";
-
- /** This is an array containing the widths (in percentages) of every column. */
- private float[] widths;
-
- /** Boolean to track errors (some checks will be performed) */
- boolean mDebug = false;
-
- /** Boolean to track if a table was inserted (to avoid unnecessary computations afterwards) */
- boolean mTableInserted = false;
-
- /**
- * Boolean to automatically fill empty cells before a table is rendered
- * (takes CPU so may be set to false in case of certainty)
- */
- boolean mAutoFillEmptyCells = false;
-
- /** If true this table may not be split over two pages. */
- boolean tableFitsPage = false;
-
- /** If true cells may not be split over two pages. */
- boolean cellsFitPage = false;
-
- /** This is the offset of the table. */
- float offset = Float.NaN;
-
- /** contains the attributes that are added to each odd (or even) row */
- protected Hashtable alternatingRowAttributes = null;
-
- /** if you want to generate tables the old way, set this value to false. */
- protected boolean convert2pdfptable = false;
-
- // constructors
-
- /**
- * Constructs a <CODE>Table</CODE> with a certain number of columns.
- *
- * @param columns The number of columns in the table
- * @throws BadElementException if the creator was called with less than 1 column
- */
-
- public Table(int columns) throws BadElementException {
- this(columns, 1);
- }
-
- /**
- * Constructs a <CODE>Table</CODE> with a certain number of columns
- * and a certain number of <CODE>Row</CODE>s.
- *
- * @param columns The number of columns in the table
- * @param rows The number of rows
- * @throws BadElementException if the creator was called with less than 1 column
- */
-
- public Table(int columns, int rows) throws BadElementException {
- // a Rectangle is create with BY DEFAULT a border with a width of 1
- super(0, 0, 0, 0);
- setBorder(BOX);
- setBorderWidth(1);
- defaultLayout.setBorder(BOX);
-
- // a table should have at least 1 column
- if (columns <= 0) {
- throw new BadElementException("A table should have at least 1 column.");
- }
- this.columns = columns;
-
- // a certain number of rows are created
- for (int i = 0; i < rows; i++) {
- this.rows.add(new Row(columns));
- }
- curPosition = new Point(0, 0);
-
- // the DEFAULT widths are calculated
- widths = new float[columns];
- float width = 100f / columns;
- for (int i = 0; i < columns; i++) {
- widths[i] = width;
- }
- }
-
- /**
- * Returns a <CODE>Table</CODE> that has been constructed taking in account
- * the value of some <VAR>attributes</VAR>.
- *
- * @param attributes Some attributes
- */
-
- public Table(Properties attributes) {
- // a Rectangle is create with BY DEFAULT a border with a width of 1
- super(0, 0, 0, 0);
- setBorder(BOX);
- setBorderWidth(1);
- defaultLayout.setBorder(BOX);
-
- String value = (String)attributes.remove(ElementTags.COLUMNS);
- if (value == null) {
- columns = 1;
- }
- else {
- columns = Integer.parseInt(value);
- if (columns <= 0) {
- columns = 1;
- }
- }
-
- rows.add(new Row(columns));
- curPosition.setLocation(0, curPosition.y);
-
- if ((value = (String)attributes.remove(ElementTags.LASTHEADERROW)) != null) {
- setLastHeaderRow(Integer.parseInt(value));
- }
- if ((value = (String)attributes.remove(ElementTags.ALIGN)) != null) {
- setAlignment(value);
- }
- if ((value = (String)attributes.remove(ElementTags.CELLSPACING)) != null) {
- setSpacing(Float.valueOf(value + "f").floatValue());
- }
- if ((value = (String)attributes.remove(ElementTags.CELLPADDING)) != null) {
- setPadding(Float.valueOf(value + "f").floatValue());
- }
- if ((value = (String)attributes.remove(ElementTags.OFFSET)) != null) {
- setOffset(Float.valueOf(value + "f").floatValue());
- }
- if ((value = (String)attributes.remove(ElementTags.WIDTH)) != null) {
- if (value.endsWith("%"))
- setWidth(Float.valueOf(value.substring(0, value.length() - 1) + "f").floatValue());
- else
- setAbsWidth(value);
- }
- widths = new float[columns];
- for (int i = 0; i < columns; i++) {
- widths[i] = 0;
- }
- if ((value = (String)attributes.remove(ElementTags.WIDTHS)) != null) {
- StringTokenizer widthTokens = new StringTokenizer(value, ";");
- int i = 0;
- while (widthTokens.hasMoreTokens()) {
- value = (String) widthTokens.nextToken();
- widths[i] = Float.valueOf(value + "f").floatValue();
- i++;
- }
- columns = i;
- }
- if ((value = (String)attributes.remove(ElementTags.TABLEFITSPAGE)) != null) {
- tableFitsPage = new Boolean(value).booleanValue();
- }
- if ((value = (String)attributes.remove(ElementTags.CELLSFITPAGE)) != null) {
- cellsFitPage = new Boolean(value).booleanValue();
- }
- if ((value = (String)attributes.remove(ElementTags.BORDERWIDTH)) != null) {
- setBorderWidth(Float.valueOf(value + "f").floatValue());
- }
- int border = 0;
- if ((value = (String)attributes.remove(ElementTags.LEFT)) != null) {
- if (new Boolean(value).booleanValue()) border |= Rectangle.LEFT;
- }
- if ((value = (String)attributes.remove(ElementTags.RIGHT)) != null) {
- if (new Boolean(value).booleanValue()) border |= Rectangle.RIGHT;
- }
- if ((value = (String)attributes.remove(ElementTags.TOP)) != null) {
- if (new Boolean(value).booleanValue()) border |= Rectangle.TOP;
- }
- if ((value = (String)attributes.remove(ElementTags.BOTTOM)) != null) {
- if (new Boolean(value).booleanValue()) border |= Rectangle.BOTTOM;
- }
- setBorder(border);
- String r = (String)attributes.remove(ElementTags.RED);
- String g = (String)attributes.remove(ElementTags.GREEN);
- String b = (String)attributes.remove(ElementTags.BLUE);
- if (r != null || g != null || b != null) {
- int red = 0;
- int green = 0;
- int blue = 0;
- if (r != null) red = Integer.parseInt(r);
- if (g != null) green = Integer.parseInt(g);
- if (b != null) blue = Integer.parseInt(b);
- setBorderColor(new Color(red, green, blue));
- }
- else if ((value = attributes.getProperty(ElementTags.BORDERCOLOR)) != null) {
- setBorderColor(MarkupParser.decodeColor(value));
- }
- r = (String)attributes.remove(ElementTags.BGRED);
- g = (String)attributes.remove(ElementTags.BGGREEN);
- b = (String)attributes.remove(ElementTags.BGBLUE);
- if (r != null || g != null || b != null) {
- int red = 0;
- int green = 0;
- int blue = 0;
- if (r != null) red = Integer.parseInt(r);
- if (g != null) green = Integer.parseInt(g);
- if (b != null) blue = Integer.parseInt(b);
- setBackgroundColor(new Color(red, green, blue));
- }
- else if ((value = (String)attributes.remove(ElementTags.BACKGROUNDCOLOR)) != null) {
- setBackgroundColor(MarkupParser.decodeColor(value));
- }
- if ((value = (String)attributes.remove(ElementTags.GRAYFILL)) != null) {
- setGrayFill(Float.valueOf(value + "f").floatValue());
- }
- if (attributes.size() > 0) setMarkupAttributes(attributes);
- }
-
- // implementation of the Element-methods
-
- /**
- * Processes the element by adding it (or the different parts) to an
- * <CODE>ElementListener</CODE>.
- *
- * @param listener an <CODE>ElementListener</CODE>
- * @return <CODE>true</CODE> if the element was processed successfully
- */
-
- public boolean process(ElementListener listener) {
- try {
- return listener.add(this);
- }
- catch(DocumentException de) {
- return false;
- }
- }
-
- /**
- * Performs extra checks when executing table code (currently only when cells are added).
- * @param aDebug
- */
- public void setDebug(boolean aDebug) {
- mDebug = aDebug;
- }
-
- /**
- * Sets the default layout of the Table to
- * the provided Cell
- * @param value a cell with all the defaults
- */
- public void setDefaultLayout(Cell value) {
- defaultLayout = value;
- }
-
- /**
- * Enables/disables automatic insertion of empty cells before table is rendered. (default = false)
- * As some people may want to create a table, fill only a couple of the cells and don't bother with
- * investigating which empty ones need to be added, this default behaviour may be very welcome.
- * Disabling is recommended to increase speed. (empty cells should be added through extra code then)
- *
- * @param aDoAutoFill enable/disable autofill
- */
-
- public void setAutoFillEmptyCells(boolean aDoAutoFill) {
- mAutoFillEmptyCells = aDoAutoFill;
- }
-
- /**
- * Allows you to control when a page break occurs.
- * <P>
- * When a table doesn't fit a page, it is split in two parts.
- * If you want to avoid this, you should set the <VAR>tableFitsPage</VAR> value to true.
- *
- * @param fitPage enter true if you don't want to split cells
- */
-
- public void setTableFitsPage(boolean fitPage) {
- this.tableFitsPage = fitPage;
- if (fitPage) setCellsFitPage(true);
- }
-
- /**
- * Allows you to control when a page break occurs.
- * <P>
- * When a cell doesn't fit a page, it is split in two parts.
- * If you want to avoid this, you should set the <VAR>cellsFitPage</VAR> value to true.
- *
- * @param fitPage enter true if you don't want to split cells
- */
-
- public void setCellsFitPage(boolean fitPage) {
- this.cellsFitPage = fitPage;
- }
-
- /**
- * Checks if this <CODE>Table</CODE> has to fit a page.
- *
- * @return true if the table may not be split
- */
-
- public boolean hasToFitPageTable() {
- return tableFitsPage;
- }
-
- /**
- * Checks if the cells of this <CODE>Table</CODE> have to fit a page.
- *
- * @return true if the cells may not be split
- */
-
- public boolean hasToFitPageCells() {
- return cellsFitPage;
- }
-
- /**
- * Sets the offset of this table.
- *
- * Normally a newline is added before you add a Table object.
- * This newline uses the current leading.
- * If you want to control the space between the table and the previous
- * element yourself, you have to set the offset of this table.
- *
- * @param offset the space between this table and the previous object.
- */
-
- public void setOffset(float offset) {
- this.offset = offset;
- }
-
- /**
- * Gets the offset of this table.
- *
- * @return the space between this table and the previous element.
- */
-
- public float getOffset() {
- return offset;
- }
-
- /**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type() {
- return Element.TABLE;
- }
-
- /**
- * Gets all the chunks in this element.
- *
- * @return an <CODE>ArrayList</CODE>
- */
-
- public ArrayList getChunks() {
- return new ArrayList();
- }
-
- // methods to add content to the table
-
- /**
- * Adds a <CODE>Cell</CODE> to the <CODE>Table</CODE> at a certain row and column.
- *
- * @param aCell The <CODE>Cell</CODE> to add
- * @param row The row where the <CODE>Cell</CODE> will be added
- * @param column The column where the <CODE>Cell</CODE> will be added
- * @throws BadElementException
- */
-
- public void addCell(Cell aCell, int row, int column) throws BadElementException {
- addCell(aCell, new Point(row,column));
- }
-
- /**
- * Adds a <CODE>Cell</CODE> to the <CODE>Table</CODE> at a certain location.
- *
- * @param aCell The <CODE>Cell</CODE> to add
- * @param aLocation The location where the <CODE>Cell</CODE> will be added
- * @throws BadElementException
- */
-
- public void addCell(Cell aCell, Point aLocation) throws BadElementException {
- if (aCell == null) throw new NullPointerException("addCell - cell has null-value");
- if (aLocation == null) throw new NullPointerException("addCell - point has null-value");
- if (aCell.isTable()) insertTable((Table)aCell.getElements().next(), aLocation);
- if (mDebug == true) {
- if (aLocation.x < 0) throw new BadElementException("row coordinate of location must be >= 0");
- if ((aLocation.y <= 0) && (aLocation.y > columns)) throw new BadElementException("column coordinate of location must be >= 0 and < nr of columns");
- if (!isValidLocation(aCell, aLocation)) throw new BadElementException("Adding a cell at the location (" + aLocation.x + "," + aLocation.y + ") with a colspan of " + aCell.colspan() + " and a rowspan of " + aCell.rowspan() + " is illegal (beyond boundaries/overlapping).");
- }
- if (aCell.border() == UNDEFINED) aCell.setBorder(defaultLayout.border());
- aCell.fill();
- placeCell(rows, aCell, aLocation);
- setCurrentLocationToNextValidPosition(aLocation);
- }
-
-
- /**
- * Adds a <CODE>Cell</CODE> to the <CODE>Table</CODE>.
- *
- * @param cell a <CODE>Cell</CODE>
- */
-
- public void addCell(Cell cell) {
- try {
- addCell(cell, curPosition);
- }
- catch(BadElementException bee) {
- // don't add the cell
- }
- }
-
- /**
- * Adds a <CODE>Cell</CODE> to the <CODE>Table</CODE>.
- * <P>
- * This is a shortcut for <CODE>addCell(Cell cell)</CODE>.
- * The <CODE>Phrase</CODE> will be converted to a <CODE>Cell</CODE>.
- *
- * @param content a <CODE>Phrase</CODE>
- * @throws BadElementException this should never happen
- */
-
- public void addCell(Phrase content) throws BadElementException {
- addCell(content, curPosition);
- }
-
- /**
- * Adds a <CODE>Cell</CODE> to the <CODE>Table</CODE>.
- * <P>
- * This is a shortcut for <CODE>addCell(Cell cell, Point location)</CODE>.
- * The <CODE>Phrase</CODE> will be converted to a <CODE>Cell</CODE>.
- *
- * @param content a <CODE>Phrase</CODE>
- * @param location a <CODE>Point</CODE>
- * @throws BadElementException this should never happen
- */
-
- public void addCell(Phrase content, Point location) throws BadElementException {
- Cell cell = new Cell(content);
- cell.setBorder(defaultLayout.border());
- cell.setBorderWidth(defaultLayout.borderWidth());
- cell.setBorderColor(defaultLayout.borderColor());
- cell.setBackgroundColor(defaultLayout.backgroundColor());
- cell.setGrayFill(defaultLayout.grayFill());
- cell.setHorizontalAlignment(defaultLayout.horizontalAlignment());
- cell.setVerticalAlignment(defaultLayout.verticalAlignment());
- cell.setColspan(defaultLayout.colspan());
- cell.setRowspan(defaultLayout.rowspan());
- addCell(cell, location);
- }
-
- /**
- * Adds a <CODE>Cell</CODE> to the <CODE>Table</CODE>.
- * <P>
- * This is a shortcut for <CODE>addCell(Cell cell)</CODE>.
- * The <CODE>String</CODE> will be converted to a <CODE>Cell</CODE>.
- *
- * @param content a <CODE>String</CODE>
- * @throws BadElementException this should never happen
- */
-
- public void addCell(String content) throws BadElementException {
- addCell(new Phrase(content), curPosition);
- }
-
- /**
- * Adds a <CODE>Cell</CODE> to the <CODE>Table</CODE>.
- * <P>
- * This is a shortcut for <CODE>addCell(Cell cell, Point location)</CODE>.
- * The <CODE>String</CODE> will be converted to a <CODE>Cell</CODE>.
- *
- * @param content a <CODE>String</CODE>
- * @param location a <CODE>Point</CODE>
- * @throws BadElementException this should never happen
- */
-
- public void addCell(String content, Point location) throws BadElementException {
- addCell(new Phrase(content), location);
- }
-
- /**
- * To put a table within the existing table at the current position
- * generateTable will of course re-arrange the widths of the columns.
- *
- * @param aTable the table you want to insert
- */
-
- public void insertTable(Table aTable) {
- if (aTable == null) throw new NullPointerException("insertTable - table has null-value");
- insertTable(aTable, curPosition);
- }
-
- /**
- * To put a table within the existing table at the given position
- * generateTable will of course re-arrange the widths of the columns.
- *
- * @param aTable The <CODE>Table</CODE> to add
- * @param row The row where the <CODE>Cell</CODE> will be added
- * @param column The column where the <CODE>Cell</CODE> will be added
- */
-
- public void insertTable(Table aTable, int row, int column) {
- if (aTable == null) throw new NullPointerException("insertTable - table has null-value");
- insertTable(aTable, new Point(row, column));
- }
-
- /**
- * To put a table within the existing table at the given position
- * generateTable will of course re-arrange the widths of the columns.
- *
- * @param aTable the table you want to insert
- * @param aLocation a <CODE>Point</CODE>
- */
- public void insertTable(Table aTable, Point aLocation) {
-
- if (aTable == null) throw new NullPointerException("insertTable - table has null-value");
- if (aLocation == null) throw new NullPointerException("insertTable - point has null-value");
- mTableInserted = true;
- aTable.complete();
- if (mDebug == true) {
- if (aLocation.y > columns) System.err.println("insertTable -- wrong columnposition("+ aLocation.y + ") of location; max =" + columns);
- }
- int rowCount = aLocation.x + 1 - rows.size();
- int i = 0;
- if ( rowCount > 0 ) { //create new rows ?
- for (; i < rowCount; i++) {
- rows.add(new Row(columns));
- }
- }
-
- ((Row) rows.get(aLocation.x)).setElement(aTable,aLocation.y);
-
- setCurrentLocationToNextValidPosition(aLocation);
- }
-
-/**
- * Will fill empty cells with valid blank <CODE>Cell</CODE>s
- */
-
- public void complete() {
- if (mTableInserted == true) {
- mergeInsertedTables(); // integrate tables in the table
- mTableInserted = false;
- }
- if (mAutoFillEmptyCells == true) {
- fillEmptyMatrixCells();
- }
- if (alternatingRowAttributes != null) {
- Properties even = new Properties();
- Properties odd = new Properties();
- String name;
- String[] value;
- for (Iterator iterator = alternatingRowAttributes.keySet().iterator(); iterator.hasNext(); ) {
- name = String.valueOf(iterator.next());
- value = (String[])alternatingRowAttributes.get(name);
- even.setProperty(name, value[0]);
- odd.setProperty(name, value[1]);
- }
- Row row;
- for (int i = lastHeaderRow + 1; i < rows.size(); i++) {
- row = (Row)rows.get(i);
- row.setMarkupAttributes(i % 2 == 0 ? even : odd);
- }
- }
- }
-
- /**
- * Changes the border in the default layout of the <CODE>Cell</CODE>s
- * added with method <CODE>addCell(String content)</CODE>.
- *
- * @param value the new border value
- */
-
- public void setDefaultCellBorder(int value) {
- defaultLayout.setBorder(value);
- }
-
- /**
- * Changes the width of the borders in the default layout of the <CODE>Cell</CODE>s
- * added with method <CODE>addCell(String content)</CODE>.
- *
- * @param value the new width
- */
-
- public void setDefaultCellBorderWidth(float value) {
- defaultLayout.setBorderWidth(value);
- }
-
- /**
- * Changes the bordercolor in the default layout of the <CODE>Cell</CODE>s
- * added with method <CODE>addCell(String content)</CODE>.
- *
- * @param color the new color
- */
-
- public void setDefaultCellBorderColor(Color color) {
- defaultLayout.setBorderColor(color);
- }
-
- /**
- * Changes the backgroundcolor in the default layout of the <CODE>Cell</CODE>s
- * added with method <CODE>addCell(String content)</CODE>.
- *
- * @param color the new color
- */
-
- public void setDefaultCellBackgroundColor(Color color) {
- defaultLayout.setBackgroundColor(color);
- }
-
- /**
- * Changes the grayfill in the default layout of the <CODE>Cell</CODE>s
- * added with method <CODE>addCell(String content)</CODE>.
- *
- * @param value the new value
- */
-
- public void setDefaultCellGrayFill(float value) {
- if (value >= 0 && value <= 1) {
- defaultLayout.setGrayFill(value);
- }
- }
-
- /**
- * Changes the horizontalAlignment in the default layout of the <CODE>Cell</CODE>s
- * added with method <CODE>addCell(String content)</CODE>.
- *
- * @param value the new alignment value
- */
-
- public void setDefaultHorizontalAlignment(int value) {
- defaultLayout.setHorizontalAlignment(value);
- }
-
- /**
- * Changes the verticalAlignment in the default layout of the <CODE>Cell</CODE>s
- * added with method <CODE>addCell(String content)</CODE>.
- *
- * @param value the new alignment value
- */
-
- public void setDefaultVerticalAlignment(int value) {
- defaultLayout.setVerticalAlignment(value);
- }
-
- /**
- * Changes the rowspan in the default layout of the <CODE>Cell</CODE>s
- * added with method <CODE>addCell(String content)</CODE>.
- *
- * @param value the new rowspan value
- */
-
- public void setDefaultRowspan(int value) {
- defaultLayout.setRowspan(value);
- }
-
- /**
- * Changes the colspan in the default layout of the <CODE>Cell</CODE>s
- * added with method <CODE>addCell(String content)</CODE>.
- *
- * @param value the new colspan value
- */
-
- public void setDefaultColspan(int value) {
- defaultLayout.setColspan(value);
- }
-
- // methods
-
- /**
- * Sets the unset cell properties to be the table defaults.
- *
- * @param aCell The cell to set to table defaults as necessary.
- */
-
- private void assumeTableDefaults(Cell aCell) {
-
- if (aCell.border() == Rectangle.UNDEFINED) {
- aCell.setBorder(defaultLayout.border());
- }
- if (aCell.borderWidth() == Rectangle.UNDEFINED) {
- aCell.setBorderWidth(defaultLayout.borderWidth());
- }
- if (aCell.borderColor() == null) {
- aCell.setBorderColor(defaultLayout.borderColor());
- }
- if (aCell.backgroundColor() == null) {
- aCell.setBackgroundColor(defaultLayout.backgroundColor());
- }
- if (aCell.grayFill() == Rectangle.UNDEFINED) {
- aCell.setGrayFill(defaultLayout.grayFill());
- }
- if (aCell.horizontalAlignment() == Element.ALIGN_UNDEFINED) {
- aCell.setHorizontalAlignment(defaultLayout.horizontalAlignment());
- }
- if (aCell.verticalAlignment() == Element.ALIGN_UNDEFINED) {
- aCell.setVerticalAlignment(defaultLayout.verticalAlignment());
- }
- }
-
- /**
- * Deletes a column in this table.
- *
- * @param column the number of the column that has to be deleted
- * @throws BadElementException
- */
-
- public void deleteColumn(int column) throws BadElementException {
- float newWidths[] = new float[--columns];
- for (int i = 0; i < column; i++) {
- newWidths[i] = widths[i];
- }
- for (int i = column; i < columns; i++) {
- newWidths[i] = widths[i + 1];
- }
- setWidths(newWidths);
- for (int i = 0; i < columns; i++) {
- newWidths[i] = widths[i];
- }
- widths = newWidths;
- Row row;
- int size = rows.size();
- for (int i = 0; i < size; i++) {
- row = (Row) rows.get(i);
- row.deleteColumn(column);
- rows.set(i, row);
- }
- if (column == columns) {
- curPosition.setLocation(curPosition.x+1, 0);
- }
- }
-
- /**
- * Deletes a row.
- *
- * @param row the number of the row to delete
- * @return boolean <CODE>true</CODE> if the row was deleted; <CODE>false</CODE> if not
- */
-
- public boolean deleteRow(int row) {
- if (row < 0 || row >= rows.size()) {
- return false;
- }
- rows.remove(row);
- curPosition.setLocation(curPosition.x-1, curPosition.y);
- return true;
- }
-
- /**
- * Deletes all rows in this table.
- * (contributed by dperezcar at fcc.es)
- */
-
- public void deleteAllRows() {
- rows.clear();
- rows.add(new Row(columns));
- curPosition.setLocation(0, 0);
- lastHeaderRow = -1;
- }
-
- /**
- * Deletes the last row in this table.
- *
- * @return boolean <CODE>true</CODE> if the row was deleted; <CODE>false</CODE> if not
- */
-
- public boolean deleteLastRow() {
- return deleteRow(rows.size() - 1);
- }
-
- /**
- * Marks the last row of the table headers.
- *
- * @return the number of the last row of the table headers
- */
-
- public int endHeaders() {
- /* patch sep 8 2001 Francesco De Milato */
- lastHeaderRow = curPosition.x - 1;
- return lastHeaderRow;
- }
-
- // methods to set the membervariables
-
- /**
- * Sets the horizontal alignment.
- *
- * @param value the new value
- */
-
- public void setLastHeaderRow(int value) {
- lastHeaderRow = value;
- }
-
- /**
- * Sets the horizontal alignment.
- *
- * @param value the new value
- */
-
- public void setAlignment(int value) {
- alignment = value;
- }
-
- /**
- * Sets the alignment of this paragraph.
- *
- * @param alignment the new alignment as a <CODE>String</CODE>
- */
-
- public void setAlignment(String alignment) {
- if (ElementTags.ALIGN_LEFT.equalsIgnoreCase(alignment)) {
- this.alignment = Element.ALIGN_LEFT;
- return;
- }
- if (ElementTags.RIGHT.equalsIgnoreCase(alignment)) {
- this.alignment = Element.ALIGN_RIGHT;
- return;
- }
- this.alignment = Element.ALIGN_CENTER;
- }
-
- /**
- * Sets the cellpadding.
- *
- * @param value the new value
- */
-
- public void setSpaceInsideCell(float value) {
- cellpadding = value;
- }
-
- /**
- * Sets the cellspacing.
- *
- * @param value the new value
- */
-
- public void setSpaceBetweenCells(float value) {
- cellspacing = value;
- }
-
- /**
- * Sets the cellpadding.
- *
- * @param value the new value
- */
-
- public void setPadding(float value) {
- cellpadding = value;
- }
-
- /**
- * Sets the cellspacing.
- *
- * @param value the new value
- */
-
- public void setSpacing(float value) {
- cellspacing = value;
- }
-
- /**
- * Sets the cellspacing (the meaning of cellpadding and cellspacing was inverted by mistake).
- *
- * @param value the new value
- * @deprecated use setSpacing instead
- */
-
- public void setCellpadding(float value) {
- cellspacing = value;
- }
-
- /**
- * Sets the cellpadding (the meaning of cellpadding and cellspacing was inverted by mistake).
- *
- * @param value the new value
- * @deprecated use setPadding instead
- */
-
- public void setCellspacing(float value) {
- cellpadding = value;
- }
-
- /**
- * Sets the width of this table (in percentage of the available space).
- *
- * @param width the width
- */
-
- public void setWidth(float width) {
- this.widthPercentage = width;
- }
-
- /**
- * Sets the width of this table (in percentage of the available space).
- *
- * @param width the width
- */
-
- public void setAbsWidth(String width) {
- this.absWidth = width;
- }
-
- /**
- * Sets the widths of the different columns (percentages).
- * <P>
- * You can give up relative values of borderwidths.
- * The sum of these values will be considered 100%.
- * The values will be recalculated as percentages of this sum.
- * <P>
- * example:
- * <BLOCKQUOTE><PRE>
- * float[] widths = {2, 1, 1};
- * <STRONG>table.setWidths(widths)</STRONG>
- * </PRE></BLOCKQUOTE>
- * The widths will be: a width of 50% for the first column,
- * 25% for the second and third column.
- *
- * @param widths an array with values
- * @throws BadElementException
- */
-
- public void setWidths(float[] widths) throws BadElementException {
- if (widths.length != columns) {
- throw new BadElementException("Wrong number of columns.");
- }
-
- // The sum of all values is 100%
- float hundredPercent = 0;
- for (int i = 0; i < columns; i++) {
- hundredPercent += widths[i];
- }
-
- // The different percentages are calculated
- float width;
- this.widths[columns - 1] = 100;
- for (int i = 0; i < columns - 1; i++) {
- width = (100.0f * widths[i]) / hundredPercent;
- this.widths[i] = width;
- this.widths[columns - 1] -= width;
- }
- }
-
- /**
- * Sets the widths of the different columns (percentages).
- * <P>
- * You can give up relative values of borderwidths.
- * The sum of these values will be considered 100%.
- * The values will be recalculated as percentages of this sum.
- *
- * @param widths an array with values
- * @throws DocumentException
- */
-
- public void setWidths(int[] widths) throws DocumentException {
- float tb[] = new float[widths.length];
- for (int k = 0; k < widths.length; ++k)
- tb[k] = widths[k];
- setWidths(tb);
- }
- // methods to retrieve the membervariables
-
- /**
- * Gets the number of columns.
- *
- * @return a value
- */
-
- public int columns() {
- return columns;
- }
-
- /**
- * Gets the number of rows in this <CODE>Table</CODE>.
- *
- * @return the number of rows in this <CODE>Table</CODE>
- */
-
- public int size() {
- return rows.size();
- }
-
- /**
- * Gets the proportional widths of the columns in this <CODE>Table</CODE>.
- *
- * @return the proportional widths of the columns in this <CODE>Table</CODE>
- */
-
- public float[] getProportionalWidths() {
- return widths;
- }
-
- /**
- * Gets an <CODE>Iterator</CODE> of all the <CODE>Row</CODE>s.
- *
- * @return an <CODE>Iterator</CODE>
- */
-
- public Iterator iterator() {
- return rows.iterator();
- }
-
- /**
- * Gets the horizontal alignment.
- *
- * @return a value
- */
-
- public int alignment() {
- return alignment;
- }
-
- /**
- * Gets the cellpadding.
- *
- * @return a value
- */
-
- public float cellpadding() {
- return cellpadding;
- }
-
- /**
- * Gets the cellspacing.
- *
- * @return a value
- */
-
- public float cellspacing() {
- return cellspacing;
- }
-
- /**
- * Gets the table width (a percentage).
- *
- * @return the table width
- */
-
- public float widthPercentage() {
- return widthPercentage;
- }
-
- /**
- * Gets the table width (in pixels).
- *
- * @return the table width
- */
-
- public String absWidth() {
- return absWidth;
- }
-
- /**
- * Gets the first number of the row that doesn't contain headers.
- *
- * @return a rownumber
- */
-
- public int firstDataRow() {
- return lastHeaderRow + 1;
- }
-
- /**
- * Gets the last number of the rows that contain headers.
- *
- * @return a rownumber
- */
- public int lastHeaderRow() {
- return this.lastHeaderRow;
- }
-
- /**
- * Gets the dimension of this table
- *
- * @return dimension
- */
-
- public Dimension getDimension() {
- return new Dimension(columns, rows.size());
- }
-
- /**
- * returns the element at the position row, column
- * (Cast to Cell or Table)
- *
- * @param row
- * @param column
- * @return dimension
- */
-
- public Object getElement(int row, int column) {
- return ((Row) rows.get(row)).getCell(column);
- }
-
- /**
- * Integrates all added tables and recalculates column widths.
- */
-
- private void mergeInsertedTables() {
- int i=0, j=0;
- float [] lNewWidths = null;
- int [] lDummyWidths = new int[columns]; // to keep track in how many new cols this one will be split
- float[][] lDummyColumnWidths = new float[columns][]; // bugfix Tony Copping
- int [] lDummyHeights = new int[rows.size()]; // to keep track in how many new rows this one will be split
- ArrayList newRows = null;
- boolean isTable=false;
- int lTotalRows = 0, lTotalColumns = 0;
- int lNewMaxRows = 0, lNewMaxColumns = 0;
-
- Table lDummyTable = null;
-
- // first we'll add new columns when needed
- // check one column at a time, find maximum needed nr of cols
- // Search internal tables and find one with max columns
- for (j=0; j < columns; j++) {
- lNewMaxColumns = 1; // value to hold in how many columns the current one will be split
- float [] tmpWidths = null;
- for (i=0; i < rows.size(); i++) {
- if ( Table.class.isInstance(((Row) rows.get(i)).getCell(j)) ) {
- isTable=true;
- lDummyTable = ((Table) ((Row) rows.get(i)).getCell(j));
- if( tmpWidths == null) {
- tmpWidths = lDummyTable.widths;
- lNewMaxColumns=tmpWidths.length;
- }
- else {
- int cols = lDummyTable.getDimension().width;
- float [] tmpWidthsN = new float[ cols * tmpWidths.length];
- float tpW=0, btW=0, totW=0;
- int tpI=0, btI=0, totI=0;
- tpW+=tmpWidths[0];
- btW+=lDummyTable.widths[0];
- while( tpI<tmpWidths.length && btI<cols) {
- if( btW>tpW) {
- tmpWidthsN[totI] = tpW-totW;
- tpI++;
- if(tpI<tmpWidths.length) {
- tpW+=tmpWidths[tpI];
- }
- }
- else {
- tmpWidthsN[totI] = btW-totW;
- btI++;
- if( btW == tpW) {
- tpI++;
- if(tpI<tmpWidths.length) {
- tpW+=tmpWidths[tpI];
- }
- }
- if(btI<cols) {
- btW+=lDummyTable.widths[btI];
- }
- }
- totW+=tmpWidthsN[totI];
- totI++;
- }
- /*if( tpI<tmpWidths.length)
- {
- System.arraycopy(tmpWidths, tpI, tmpWidthsN, totI, tmpWidths.length-tpI);
- totI +=tmpWidths.length-tpI;
- }
- else if(btI<cols)
- {
- System.arraycopy(lDummyTable.widths, btI, tmpWidthsN, totI, lDummyTable.widths.length-btI);
- totI +=lDummyTable.widths.length-btI; }*/
- tmpWidths = new float[totI];
- System.arraycopy(tmpWidthsN, 0, tmpWidths, 0, totI);
- lNewMaxColumns=totI;
- }
- /*if ( lDummyTable.getDimension().width > lNewMaxColumns )
- {
- lNewMaxColumns = lDummyTable.getDimension().width;
- lDummyColumnWidths[j] = lDummyTable.widths; // bugfix Tony Copping
- }*/
- }
- }
- lDummyColumnWidths[j] = tmpWidths;
- lTotalColumns += lNewMaxColumns;
- lDummyWidths [j] = lNewMaxColumns;
- }
-
- // next we'll add new rows when needed
- for (i=0; i < rows.size(); i++) {
- lNewMaxRows = 1; // holds value in how many rows the current one will be split
- for (j=0; j < columns; j++) {
- if ( Table.class.isInstance(((Row) rows.get(i)).getCell(j)) ) {
- isTable=true;
- lDummyTable = (Table) ((Row) rows.get(i)).getCell(j);
- if ( lDummyTable.getDimension().height > lNewMaxRows ) {
- lNewMaxRows = lDummyTable.getDimension().height;
- }
- }
- }
- lTotalRows += lNewMaxRows;
- lDummyHeights [i] = lNewMaxRows;
- }
-
- if ( (lTotalColumns != columns) || (lTotalRows != rows.size()) || isTable) // NO ADJUSTMENT
- {
- // ** WIDTH
- // set correct width for new columns
- // divide width over new nr of columns
- // Take new max columns of internal table and work out widths for each col
- lNewWidths = new float [lTotalColumns];
- int lDummy = 0;
- for (int tel=0; tel < widths.length;tel++) {
- if ( lDummyWidths[tel] != 1) {
- // divide
- for (int tel2 = 0; tel2 < lDummyWidths[tel]; tel2++) {
- // lNewWidths[lDummy] = widths[tel] / lDummyWidths[tel];
- lNewWidths[lDummy] = widths[tel] * lDummyColumnWidths[tel][tel2] / 100f; // bugfix Tony Copping
- lDummy++;
- }
- }
- else {
- lNewWidths[lDummy] = widths[tel];
- lDummy++;
- }
- }
-
- // ** FILL OUR NEW TABLE
- // generate new table
- // set new widths
- // copy old values
- newRows = new ArrayList(lTotalRows);
- for (i = 0; i < lTotalRows; i++) {
- newRows.add(new Row(lTotalColumns));
- }
- int lDummyRow = 0, lDummyColumn = 0; // to remember where we are in the new, larger table
- Object lDummyElement = null;
- for (i=0; i < rows.size(); i++) {
- lDummyColumn = 0;
- lNewMaxRows = 1;
- for (j=0; j < columns; j++) {
- if ( Table.class.isInstance(((Row) rows.get(i)).getCell(j)) ) // copy values from embedded table
- {
- lDummyTable = (Table) ((Row) rows.get(i)).getCell(j);
-
- // Work out where columns in table table correspond to columns in current table
- int colMap[] = new int[lDummyTable.widths.length+1];
- int cb=0, ct=0;
-
- for( ; cb<lDummyTable.widths.length;cb++) {
- colMap[cb] = lDummyColumn+ct;
-
- float wb;
- wb = lDummyTable.widths[cb];
-
- float wt=0;
- while( ct<lDummyWidths[j]) {
- wt+=lDummyColumnWidths[j][ct++];
- if(convertWidth(wb)==convertWidth(wt)) break;
- }
-
- /* if(convertWidth(wb)==convertWidth(wt) == false) {
- System.out.println( "error w !=w2");
- } */
- }
- colMap[cb] = lDummyColumn+ct;
-
- // need to change this to work out how many cols to span
- for (int k=0; k < lDummyTable.getDimension().height; k++) {
- for (int l=0; l < lDummyTable.getDimension().width; l++) {
- int yy=l;
- lDummyElement = lDummyTable.getElement(k,l);
- if (lDummyElement != null) {
- int col=lDummyColumn+l;
-
- if ( Cell.class.isInstance(lDummyElement) ) {
- Cell lDummyC = (Cell)lDummyElement;
- // Find col to add cell in and set col span
- col = colMap[l];
- int ot = colMap[l+lDummyC.colspan()];
-
- lDummyC.setColspan(ot-col);
- }
-
- ((Row) newRows.get(k + lDummyRow)).addElement(lDummyElement,col); // use addElement to set reserved status ok in row
- }
- }
- }
- }
- else // copy others values
- {
- Object aElement = getElement(i,j);
-
- if ( Cell.class.isInstance(aElement) ) {
-
- // adjust spans for cell
- ((Cell) aElement).setRowspan(((Cell) ((Row) rows.get(i)).getCell(j)).rowspan() + lDummyHeights[i] - 1);
- ((Cell) aElement).setColspan(((Cell) ((Row) rows.get(i)).getCell(j)).colspan() + lDummyWidths[j] - 1);
-
- // most likely this cell covers a larger area because of the row/cols splits : define not-to-be-filled cells
- placeCell(newRows,((Cell) aElement), new Point(lDummyRow,lDummyColumn));
- }
- }
- lDummyColumn += lDummyWidths[j];
- }
- lDummyRow += lDummyHeights[i];
- }
-
- // Set our new matrix
- columns = lTotalColumns;
- rows = newRows;
- this.widths = lNewWidths;
- }
- }
-
- /**
- * adds new<CODE>Cell</CODE>'s to empty/null spaces.
- */
-
- private void fillEmptyMatrixCells() {
- try {
- for (int i=0; i < rows.size(); i++) {
- for (int j=0; j < columns; j++) {
- if ( ((Row) rows.get(i)).isReserved(j) == false) {
- addCell(defaultLayout, new Point(i, j));
- }
- }
- }
- }
- catch(BadElementException bee) {
- throw new ExceptionConverter(bee);
- }
- }
-
- /**
- * check if <CODE>Cell</CODE> 'fits' the table.
- * <P>
- * <UL><LI>rowspan/colspan not beyond borders
- * <LI>spanned cell don't overlap existing cells</UL>
- *
- * @param aCell the cell that has to be checked
- * @param aLocation the location where the cell has to be placed
- * @return true if the location was valid
- */
- private boolean isValidLocation(Cell aCell, Point aLocation) {
- // rowspan not beyond last column
- if ( aLocation.x < rows.size() ) // if false : new location is already at new, not-yet-created area so no check
- {
- if ((aLocation.y + aCell.colspan()) > columns) {
- return false;
- }
-
- int difx = ((rows.size() - aLocation.x) > aCell.rowspan()) ? aCell.rowspan() : rows.size() - aLocation.x;
- int dify = ((columns - aLocation.y) > aCell.colspan()) ? aCell.colspan() : columns - aLocation.y;
- // no other content at cells targetted by rowspan/colspan
- for (int i=aLocation.x; i < (aLocation.x + difx); i++) {
- for (int j=aLocation.y; j < (aLocation.y + dify); j++) {
- if ( ((Row) rows.get(i)).isReserved(j) == true ) {
- return false;
- }
- }
- }
- }
- else {
- if ((aLocation.y + aCell.colspan()) > columns) {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * Inserts a Cell in a cell-array and reserves cells defined by row-/colspan.
- *
- * @param someRows some rows
- * @param aCell the cell that has to be inserted
- * @param aPosition the position where the cell has to be placed
- */
-
- private void placeCell(ArrayList someRows, Cell aCell, Point aPosition) {
- int i;
- Row row = null;
- int lColumns = ((Row) someRows.get(0)).columns();
- int rowCount = aPosition.x + aCell.rowspan() - someRows.size();
- assumeTableDefaults(aCell);
- if ( (aPosition.x + aCell.rowspan()) > someRows.size() ) //create new rows ?
- {
- for (i = 0; i < rowCount; i++) {
- row = new Row(lColumns);
- someRows.add(row);
- }
- }
-
- // reserve cell in rows below
- for (i = aPosition.x + 1; i < (aPosition.x + aCell.rowspan()); i++) {
- if ( !((Row) someRows.get(i)).reserve(aPosition.y, aCell.colspan())) {
-
- // should be impossible to come here :-)
- throw new RuntimeException("addCell - error in reserve");
- }
- }
- row = (Row) someRows.get(aPosition.x);
- row.addElement(aCell, aPosition.y);
-
- }
-
- /**
- * Gives you the posibility to add columns.
- *
- * @param aColumns the number of columns to add
- */
-
- public void addColumns(int aColumns) {
- ArrayList newRows = new ArrayList(rows.size());
-
- int newColumns = columns + aColumns;
- Row row;
- for (int i = 0; i < rows.size(); i++) {
- row = new Row(newColumns);
- for (int j = 0; j < columns; j++) {
- row.setElement(((Row) rows.get(i)).getCell(j) ,j);
- }
- for (int j = columns; j < newColumns && i < curPosition.x; j++) {
- row.setElement(defaultLayout, j);
- }
- newRows.add(row);
- }
-
- // applied 1 column-fix; last column needs to have a width of 0
- float [] newWidths = new float[newColumns];
- for (int j = 0; j < columns; j++) {
- newWidths[j] = widths[j];
- }
- for (int j = columns; j < newColumns ; j++) {
- newWidths[j] = 0;
- }
- columns = newColumns;
- widths = newWidths;
- rows = newRows;
- }
-
- /**
- * Gets an array with the positions of the borders between every column.
- * <P>
- * This method translates the widths expressed in percentages into the
- * x-coordinate of the borders of the columns on a real document.
- *
- * @param left this is the position of the first border at the left (cellpadding not included)
- * @param totalWidth this is the space between the first border at the left
- * and the last border at the right (cellpadding not included)
- * @return an array with borderpositions
- */
-
- public float[] getWidths(float left, float totalWidth) {
- // for x columns, there are x+1 borders
- float[] w = new float[columns + 1];
- // the border at the left is calculated
- switch(alignment) {
- case Element.ALIGN_LEFT:
- w[0] = left;
- break;
- case Element.ALIGN_RIGHT:
- w[0] = left + (totalWidth * (100 - widthPercentage)) / 100;
- break;
- case Element.ALIGN_CENTER:
- default:
- w[0] = left + (totalWidth * (100 - widthPercentage)) / 200;
- }
- // the total available width is changed
- totalWidth = (totalWidth * widthPercentage) / 100;
- // the inner borders are calculated
- for (int i = 1; i < columns; i++) {
- w[i] = w[i - 1] + (widths[i - 1] * totalWidth / 100);
- }
- // the border at the right is calculated
- w[columns] = w[0] + totalWidth;
- return w;
- }
-
- /**
- * Sets current col/row to valid(empty) pos after addCell/Table
- * @param aLocation a location in the Table
- */
- private void setCurrentLocationToNextValidPosition(Point aLocation) {
- // set latest location to next valid position
- int i, j;
- i = aLocation.x;
- j = aLocation.y;
- do {
- if ( (j + 1) == columns ) { // goto next row
- i++;
- j = 0;
- }
- else {
- j++;
- }
- }
- while (
- (i < rows.size()) && (j < columns) && (((Row) rows.get(i)).isReserved(j) == true)
- );
- curPosition = new Point(i, j);
- }
-
-
-
- /**
- * Checks if a given tag corresponds with this object.
- *
- * @param tag the given tag
- * @return true if the tag corresponds
- */
-
- public static boolean isTag(String tag) {
- return ElementTags.TABLE.equals(tag);
- }
-
- /**
- * Allows clients to set up alternating attributes for each Row in the Table.
- * <P>
- * This code was contributed by Matt Benson.
- *
- * @param name the name of the attribute
- * @param value0 the value of the attribute for even rows
- * @param value1 the value of the attribute for odd rows
- */
- public void setAlternatingRowAttribute(String name, String value0, String value1) {
- if (value0 == null || value1 == null) {
- throw new NullPointerException("MarkupTable#setAlternatingRowAttribute(): null values are not permitted.");
- }
- if (alternatingRowAttributes == null) alternatingRowAttributes = new Hashtable();
-
- // we could always use new Arrays but this is big enough
- String[] value = (String[])(alternatingRowAttributes.get(name));
- if (value == null) value = new String[2];
- value[0] = value0;
- value[1] = value1;
- alternatingRowAttributes.put(name, value);
- }
-
- /**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @return NA
- */
- public float top() {
- throw new UnsupportedOperationException("Dimensions of a Table can't be calculated. See the FAQ.");
- }
-
- /**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @return NA
- */
- public float bottom() {
- throw new UnsupportedOperationException("Dimensions of a Table can't be calculated. See the FAQ.");
- }
-
- /**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @return NA
- */
- public float left() {
- throw new UnsupportedOperationException("Dimensions of a Table can't be calculated. See the FAQ.");
- }
-
- /**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @return NA
- */
- public float right() {
- throw new UnsupportedOperationException("Dimensions of a Table can't be calculated. See the FAQ.");
- }
-
- /**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @param margin NA
- * @return NA
- */
- public float top(int margin) {
- throw new UnsupportedOperationException("Dimensions of a Table can't be calculated. See the FAQ.");
- }
-
- /**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @param margin NA
- * @return NA
- */
- public float bottom(int margin) {
- throw new UnsupportedOperationException("Dimensions of a Table can't be calculated. See the FAQ.");
- }
-
- /**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @param margin NA
- * @return NA
- */
- public float left(int margin) {
- throw new UnsupportedOperationException("Dimensions of a Table can't be calculated. See the FAQ.");
- }
-
- /**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @param margin NA
- * @return NA
- */
- public float right(int margin) {
- throw new UnsupportedOperationException("Dimensions of a Table can't be calculated. See the FAQ.");
- }
-
- /**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @param value NA
- */
- public void setTop(int value) {
- throw new UnsupportedOperationException("Dimensions of a Table are attributed automagically. See the FAQ.");
- }
-
- /**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @param value NA
- */
- public void setBottom(int value) {
- throw new UnsupportedOperationException("Dimensions of a Table are attributed automagically. See the FAQ.");
- }
-
- /**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @param value NA
- */
- public void setLeft(int value) {
- throw new UnsupportedOperationException("Dimensions of a Table are attributed automagically. See the FAQ.");
- }
-
- /**
- * This method throws an <CODE>UnsupportedOperationException</CODE>.
- * @param value NA
- */
- public void setRight(int value) {
- throw new UnsupportedOperationException("Dimensions of a Table are attributed automagically. See the FAQ.");
- }
-
- /**
- * Returns the next row 0-based index where a new cell would be added.
- * (contributed by dperezcar at fcc.es)
- * @return x coordinate for the next row
- */
- public int getNextRow() {
- return curPosition.x;
- }
-
- /**
- * Returns the next column 0-based index where a new cell would be added.
- * (contributed by dperezcar at fcc.es)
- * @return y coordinate for the next row
- */
- public int getNextColumn() {
- return curPosition.y;
- }
-
- private static final double convertWidth( double val) {
- if( val == 0) {
- return 0;
- }
- try {
- String tmp = widthFormat.format( val);
- Number result = widthFormat.parse( tmp);
-
- return result.doubleValue();
- }
- catch( java.text.ParseException pe) {
- throw new RuntimeException( "Could not convert double to width for val:" + val);
- }
- }
-
- private static DecimalFormat widthFormat = new DecimalFormat( "0.00");
-
- /**
- * Create a PdfPTable based on this Table object.
- * @return a PdfPTable object
- * @throws BadElementException
- */
- public PdfPTable createPdfPTable() throws BadElementException {
- if (!convert2pdfptable) {
- throw new BadElementException("No error, just an old style table");
- }
- setAutoFillEmptyCells(true);
- complete();
- PdfPTable pdfptable = new PdfPTable(widths);
- pdfptable.setTableEvent(new BorderEvent(this));
- pdfptable.setHeaderRows(lastHeaderRow + 1);
- pdfptable.setSplitLate(cellsFitPage);
- if (!Float.isNaN(offset)) {
- pdfptable.setSpacingBefore(offset);
- }
- pdfptable.setHorizontalAlignment(alignment);
- if (absWidth.length() > 0) {
- try {
- pdfptable.setTotalWidth(Float.parseFloat(absWidth));
- }
- catch(Exception e1) {
- try {
- pdfptable.setTotalWidth((float)Integer.parseInt(absWidth));
- }
- catch(Exception e2) {
- pdfptable.setWidthPercentage(widthPercentage);
- }
- }
- }
- else {
- pdfptable.setWidthPercentage(widthPercentage);
- }
- Row row;
- for (Iterator iterator = iterator(); iterator.hasNext(); ) {
- row = (Row) iterator.next();
- Element cell;
- PdfPCell pcell;
- for (int i = 0; i < row.columns(); i++) {
- if ((cell = (Element)row.getCell(i)) != null) {
- if (cell instanceof Table) {
- pcell = new PdfPCell(((Table)cell).createPdfPTable());
- }
- else if (cell instanceof Cell) {
- pcell = ((Cell)cell).createPdfPCell();
- pcell.setPadding(cellpadding);
- }
- else {
- pcell = new PdfPCell();
- }
- pdfptable.addCell(pcell);
- }
- }
- }
- return pdfptable;
- }
-
- /**
- * Method to check if the Table should be converted to a PdfPTable or not.
- * @return false if the table should be handled the oldfashioned way.
- */
- public boolean isConvert2pdfptable() {
- return convert2pdfptable;
- }
- /**
- * If set to true, iText will try to convert the Table to a PdfPTable.
- * @param convert2pdfptable true if you want iText to try to convert the Table to a PdfPTable
- */
- public void setConvert2pdfptable(boolean convert2pdfptable) {
- this.convert2pdfptable = convert2pdfptable;
- }
-
- /**
- * Event class to draw the Border of a Table when converted to a PdfPTable.
- */
- public class BorderEvent implements PdfPTableEvent {
- private Rectangle rectangle;
- /**
- * The Table that has to get a Border.
- * @param table
- */
- public BorderEvent(Table table) {
- this.rectangle = table;
- }
- /**
- * @see com.lowagie.text.pdf.PdfPTableEvent#tableLayout(com.lowagie.text.pdf.PdfPTable, float[][], float[], int, int, com.lowagie.text.pdf.PdfContentByte[])
- */
- public void tableLayout(PdfPTable table, float[][] widths, float[] heights, int headerRows, int rowStart, PdfContentByte[] canvases) {
- float[] width = widths[0];
- Rectangle rect = new Rectangle(width[0], heights[heights.length - 1], width[width.length - 1], heights[0]);
- rect.cloneNonPositionParameters(rectangle);
- canvases[PdfPTable.BACKGROUNDCANVAS].rectangle(rect);
- rect.setBackgroundColor(null);
- canvases[PdfPTable.LINECANVAS].rectangle(rect);
- }
- }
-}
diff --git a/LibrarySource/com/lowagie/text/TextElementArray.java b/LibrarySource/com/lowagie/text/TextElementArray.java
deleted file mode 100644
index 6b8560c..0000000
--- a/LibrarySource/com/lowagie/text/TextElementArray.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * $Id: TextElementArray.java,v 1.27 2002/06/20 13:30:25 blowagie Exp $
- * $Name: $
- *
- * Copyright (c) 1999, 2000, 2001, 2002 Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-/**
- * Interface for a text element to which other objects can be added.
- *
- * @see Phrase
- * @see Paragraph
- * @see Section
- * @see ListItem
- * @see Chapter
- * @see Anchor
- * @see Cell
- */
-
-public interface TextElementArray extends Element {
-
- /**
- * Adds an object to the <CODE>TextElementArray</CODE>.
- *
- * @param o an object that has to be added
- * @return <CODE>true</CODE> if the addition succeeded; <CODE>false</CODE> otherwise
- */
-
- public boolean add(Object o);
-}
diff --git a/LibrarySource/com/lowagie/text/Watermark.java b/LibrarySource/com/lowagie/text/Watermark.java
deleted file mode 100644
index bda93fa..0000000
--- a/LibrarySource/com/lowagie/text/Watermark.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * $Id: Watermark.java,v 1.52 2004/12/14 11:52:47 blowagie Exp $
- * $Name: $
- *
- * Copyright 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text;
-
-import java.net.MalformedURLException;
-
-/**
- * A <CODE>Watermark</CODE> is a graphic element (GIF or JPEG)
- * that is shown on a certain position on each page.
- *
- * @see Element
- * @see Jpeg
- */
-
-public class Watermark extends Image implements Element {
-
- // membervariables
-
-/** This is the offset in x-direction of the Watermark. */
- private float offsetX = 0;
-
-/** This is the offset in y-direction of the Watermark. */
- private float offsetY = 0;
-
- // Constructors
-
-/**
- * Constructs a <CODE>Watermark</CODE>-object, using an <CODE>Image</CODE>.
- *
- * @param image an <CODE>Image</CODE>-object
- * @param offsetX the offset in x-direction
- * @param offsetY the offset in y-direction
- * @throws MalformedURLException
- */
-
- public Watermark(Image image, float offsetX, float offsetY) throws MalformedURLException {
- super(image);
- this.offsetX = offsetX;
- this.offsetY = offsetY;
- }
-
- // implementation of the Element interface
-
-/**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type() {
- return type;
- }
-
- // methods to retrieve information
-
-/**
- * Returns the offset in x direction.
- *
- * @return an offset
- */
-
- public float offsetX() {
- return offsetX;
- }
-
-/**
- * Returns the offset in y direction.
- *
- * @return an offset
- */
-
- public float offsetY() {
- return offsetY;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/ZapfDingbatsList.java b/LibrarySource/com/lowagie/text/ZapfDingbatsList.java
deleted file mode 100644
index 033a0c7..0000000
--- a/LibrarySource/com/lowagie/text/ZapfDingbatsList.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright 2003 by Michael Niedermair.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text;
-
-/**
- *
- * A special-version of <CODE>LIST</CODE> whitch use zapfdingbats-letters.
- *
- * @see com.lowagie.text.List
- * @version 2003-06-22
- * @author Michael Niedermair
- */
-
-public class ZapfDingbatsList extends List {
-
- /**
- * char-number in zapfdingbats
- */
- protected int zn;
-
- /**
- * Creates a ZapfDingbatsList
- *
- * @param zn a char-number
- * @param symbolIndent indent
- */
- public ZapfDingbatsList(int zn, int symbolIndent) {
- super(true, symbolIndent);
- this.zn = zn;
- float fontsize = symbol.font().size();
- symbol.setFont(FontFactory.getFont(FontFactory.ZAPFDINGBATS, fontsize, Font.NORMAL));
- }
-
- /**
- * set the char-number
- * @param zn a char-number
- */
- public void setCharNumber(int zn) {
- this.zn = zn;
- }
-
- /**
- * get the char-number
- *
- * @return char-number
- */
- public int getCharNumber() {
- return zn;
- }
-
- /**
- * Adds an <CODE>Object</CODE> to the <CODE>List</CODE>.
- *
- * @param o the object to add.
- * @return true if adding the object succeeded
- */
- public boolean add(Object o) {
- if (o instanceof ListItem) {
- ListItem item = (ListItem) o;
- Chunk chunk = new Chunk((char)zn, symbol.font());
- item.setListSymbol(chunk);
- item.setIndentationLeft(symbolIndent);
- item.setIndentationRight(0);
- list.add(item);
- } else if (o instanceof List) {
- List nested = (List) o;
- nested.setIndentationLeft(nested.indentationLeft() + symbolIndent);
- first--;
- return list.add(nested);
- } else if (o instanceof String) {
- return this.add(new ListItem((String) o));
- }
- return false;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/ZapfDingbatsNumberList.java b/LibrarySource/com/lowagie/text/ZapfDingbatsNumberList.java
deleted file mode 100644
index 7ca1b06..0000000
--- a/LibrarySource/com/lowagie/text/ZapfDingbatsNumberList.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright 2003 by Michael Niedermair.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text;
-
-/**
- *
- * A special-version of <CODE>LIST</CODE> whitch use zapfdingbats-numbers (1..10).
- *
- * @see com.lowagie.text.List
- * @version 2003-06-22
- * @author Michael Niedermair
- */
-
-public class ZapfDingbatsNumberList extends List {
-
- /**
- * which type
- */
- protected int type;
-
- /**
- * Creates a ZapdDingbatsNumberList
- * @param type the type of list
- * @param symbolIndent indent
- */
- public ZapfDingbatsNumberList(int type, int symbolIndent) {
- super(true, symbolIndent);
- this.type = type;
- float fontsize = symbol.font().size();
- symbol.setFont(FontFactory.getFont(FontFactory.ZAPFDINGBATS, fontsize, Font.NORMAL));
- }
-
- /**
- * set the type
- *
- * @param type
- */
- public void setType(int type) {
- this.type = type;
- }
-
- /**
- * get the type
- *
- * @return char-number
- */
- public int getType() {
- return type;
- }
-
- /**
- * Adds an <CODE>Object</CODE> to the <CODE>List</CODE>.
- *
- * @param o the object to add.
- * @return true if adding the object succeeded
- */
- public boolean add(Object o) {
- if (o instanceof ListItem) {
- ListItem item = (ListItem) o;
- Chunk chunk;
- switch (type ) {
- case 0:
- chunk = new Chunk((char)(first + list.size() + 171), symbol.font());
- break;
- case 1:
- chunk = new Chunk((char)(first + list.size() + 181), symbol.font());
- break;
- case 2:
- chunk = new Chunk((char)(first + list.size() + 191), symbol.font());
- break;
- default:
- chunk = new Chunk((char)(first + list.size() + 201), symbol.font());
- }
- item.setListSymbol(chunk);
- item.setIndentationLeft(symbolIndent);
- item.setIndentationRight(0);
- list.add(item);
- } else if (o instanceof List) {
- List nested = (List) o;
- nested.setIndentationLeft(nested.indentationLeft() + symbolIndent);
- first--;
- return list.add(nested);
- } else if (o instanceof String) {
- return this.add(new ListItem((String) o));
- }
- return false;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/html/HtmlEncoder.java b/LibrarySource/com/lowagie/text/html/HtmlEncoder.java
deleted file mode 100644
index 994b270..0000000
--- a/LibrarySource/com/lowagie/text/html/HtmlEncoder.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * $Id: HtmlEncoder.java,v 1.24 2002/08/27 11:07:11 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.html;
-
-import headless.awt.Color;
-
-import com.lowagie.text.Element;
-
-/**
- * This class converts a <CODE>String</CODE> to the HTML-format of a String.
- * <P>
- * To convert the <CODE>String</CODE>, each character is examined:
- * <UL>
- * <LI>ASCII-characters from 000 till 031 are represented as &#xxx;<BR>
- * (with xxx = the value of the character)
- * <LI>ASCII-characters from 032 t/m 127 are represented by the character itself, except for:
- * <UL>
- * <LI>'\n' becomes <BR>\n
- * <LI>" becomes "
- * <LI>& becomes &
- * <LI>< becomes <
- * <LI>> becomes >
- * </UL>
- * <LI>ASCII-characters from 128 till 255 are represented as &#xxx;<BR>
- * (with xxx = the value of the character)
- * </UL>
- * <P>
- * Example:
- * <P><BLOCKQUOTE><PRE>
- * String htmlPresentation = HtmlEncoder.encode("Marie-Thérèse Sørensen");
- * </PRE></BLOCKQUOTE><P>
- * for more info: see O'Reilly; "HTML: The Definitive Guide" (page 164)
- *
- * @author mario.maccarini at rug.ac.be
- */
-
-public class HtmlEncoder {
-
- // membervariables
-
-/** List with the HTML translation of all the characters. */
- private static final String[] htmlCode = new String[256];
-
- static {
- for (int i = 0; i < 10; i++) {
- htmlCode[i] = "�" + i + ";";
- }
-
- for (int i = 10; i < 32; i++) {
- htmlCode[i] = "�" + i + ";";
- }
-
- for (int i = 32; i < 128; i++) {
- htmlCode[i] = String.valueOf((char)i);
- }
-
- // Special characters
- htmlCode['\t'] = "\t";
- htmlCode['\n'] = "<" + HtmlTags.NEWLINE + " />\n";
- htmlCode['\"'] = """; // double quote
- htmlCode['&'] = "&"; // ampersand
- htmlCode['<'] = "<"; // lower than
- htmlCode['>'] = ">"; // greater than
-
- for (int i = 128; i < 256; i++) {
- htmlCode[i] = "&#" + i + ";";
- }
- }
-
-
- // constructors
-
-/**
- * This class will never be constructed.
- * <P>
- * HtmlEncoder only contains static methods.
- */
-
- private HtmlEncoder () { }
-
- // methods
-
-/**
- * Converts a <CODE>String</CODE> to the HTML-format of this <CODE>String</CODE>.
- *
- * @param string The <CODE>String</CODE> to convert
- * @return a <CODE>String</CODE>
- */
-
- public static String encode(String string) {
- int n = string.length();
- char character;
- StringBuffer buffer = new StringBuffer();
- // loop over all the characters of the String.
- for (int i = 0; i < n; i++) {
- character = string.charAt(i);
- // the Htmlcode of these characters are added to a StringBuffer one by one
- if (character < 256) {
- buffer.append(htmlCode[character]);
- }
- else {
- // Improvement posted by Joachim Eyrich
- buffer.append("&#").append((int)character).append(";");
- }
- }
- return buffer.toString().trim();
- }
-
-/**
- * Converts a <CODE>Color</CODE> into a HTML representation of this <CODE>Color</CODE>.
- *
- * @param color the <CODE>Color</CODE> that has to be converted.
- * @return the HTML representation of this <COLOR>Color</COLOR>
- */
-
- public static String encode(Color color) {
- StringBuffer buffer = new StringBuffer("#");
- if (color.getRed() < 16) {
- buffer.append('0');
- }
- buffer.append(Integer.toString(color.getRed(), 16));
- if (color.getGreen() < 16) {
- buffer.append('0');
- }
- buffer.append(Integer.toString(color.getGreen(), 16));
- if (color.getBlue() < 16) {
- buffer.append('0');
- }
- buffer.append(Integer.toString(color.getBlue(), 16));
- return buffer.toString();
- }
-
-/**
- * Translates the alignment value.
- *
- * @param alignment the alignment value
- * @return the translated value
- */
-
- public static String getAlignment(int alignment) {
- switch(alignment) {
- case Element.ALIGN_LEFT:
- return HtmlTags.ALIGN_LEFT;
- case Element.ALIGN_CENTER:
- return HtmlTags.ALIGN_CENTER;
- case Element.ALIGN_RIGHT:
- return HtmlTags.ALIGN_RIGHT;
- case Element.ALIGN_JUSTIFIED:
- case Element.ALIGN_JUSTIFIED_ALL:
- return HtmlTags.ALIGN_JUSTIFIED;
- case Element.ALIGN_TOP:
- return HtmlTags.ALIGN_TOP;
- case Element.ALIGN_MIDDLE:
- return HtmlTags.ALIGN_MIDDLE;
- case Element.ALIGN_BOTTOM:
- return HtmlTags.ALIGN_BOTTOM;
- case Element.ALIGN_BASELINE:
- return HtmlTags.ALIGN_BASELINE;
- default:
- return "";
- }
- }
-}
diff --git a/LibrarySource/com/lowagie/text/html/HtmlTags.java b/LibrarySource/com/lowagie/text/html/HtmlTags.java
deleted file mode 100644
index 4ff2f91..0000000
--- a/LibrarySource/com/lowagie/text/html/HtmlTags.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * $Id: HtmlTags.java,v 1.69 2005/05/03 14:43:58 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.html;
-
-/**
- * A class that contains all the possible tagnames and their attributes.
- */
-
-public class HtmlTags {
-
-/** the root tag. */
- public static final String HTML = "html";
-
-/** the head tag */
- public static final String HEAD = "head";
-
-/** This is a possible HTML attribute for the HEAD tag. */
- public static final String CONTENT = "content";
-
-/** the meta tag */
- public static final String META = "meta";
-
-/** attribute of the root tag */
- public static final String SUBJECT = "subject";
-
-/** attribute of the root tag */
- public static final String KEYWORDS = "keywords";
-
-/** attribute of the root tag */
- public static final String AUTHOR = "author";
-
-/** the title tag. */
- public static final String TITLE = "title";
-
-/** the script tag. */
- public static final String SCRIPT = "script";
-
-/** This is a possible HTML attribute for the SCRIPT tag. */
- public static final String LANGUAGE = "language";
-
-/** This is a possible value for the LANGUAGE attribute. */
- public static final String JAVASCRIPT = "JavaScript";
-
-/** the body tag. */
- public static final String BODY = "body";
-
-/** This is a possible HTML attribute for the BODY tag */
- public static final String JAVASCRIPT_ONLOAD = "onLoad";
-
-/** This is a possible HTML attribute for the BODY tag */
- public static final String JAVASCRIPT_ONUNLOAD = "onUnLoad";
-
-/** This is a possible HTML attribute for the BODY tag. */
- public static final String TOPMARGIN = "topmargin";
-
-/** This is a possible HTML attribute for the BODY tag. */
- public static final String BOTTOMMARGIN = "bottommargin";
-
-/** This is a possible HTML attribute for the BODY tag. */
- public static final String LEFTMARGIN = "leftmargin";
-
-/** This is a possible HTML attribute for the BODY tag. */
- public static final String RIGHTMARGIN = "rightmargin";
-
- // Phrases, Anchors, Lists and Paragraphs
-
-/** the chunk tag */
- public static final String CHUNK = "font";
-
-/** the phrase tag */
- public static final String CODE = "code";
-
-/** the phrase tag */
- public static final String VAR = "var";
-
-/** the anchor tag */
- public static final String ANCHOR = "a";
-
-/** the list tag */
- public static final String ORDEREDLIST = "ol";
-
-/** the list tag */
- public static final String UNORDEREDLIST = "ul";
-
-/** the listitem tag */
- public static final String LISTITEM = "li";
-
-/** the paragraph tag */
- public static final String PARAGRAPH = "p";
-
-/** attribute of anchor tag */
- public static final String NAME = "name";
-
-/** attribute of anchor tag */
- public static final String REFERENCE = "href";
-
-/** attribute of anchor tag */
- public static final String[] H = new String[6];
- static {
- H[0] = "h1";
- H[1] = "h2";
- H[2] = "h3";
- H[3] = "h4";
- H[4] = "h5";
- H[5] = "h6";
- }
-
- // Chunks
-
-/** attribute of the chunk tag */
- public static final String FONT = "face";
-
-/** attribute of the chunk tag */
- public static final String SIZE = "point-size";
-
-/** attribute of the chunk/table/cell tag */
- public static final String COLOR = "color";
-
-/** some phrase tag */
- public static final String EM = "em";
-
-/** some phrase tag */
- public static final String I = "i";
-
-/** some phrase tag */
- public static final String STRONG = "strong";
-
-/** some phrase tag */
- public static final String B = "b";
-
-/** some phrase tag */
- public static final String S = "s";
-
-/** some phrase tag */
- public static final String U = "u";
-
-/** some phrase tag */
- public static final String SUB = "sub";
-
-/** some phrase tag */
- public static final String SUP = "sup";
-
-/** the possible value of a tag */
- public static final String HORIZONTALRULE = "hr";
-
- // tables/cells
-
-/** the table tag */
- public static final String TABLE = "table";
-
-/** the cell tag */
- public static final String ROW = "tr";
-
-/** the cell tag */
- public static final String CELL = "td";
-
-/** attribute of the cell tag */
- public static final String HEADERCELL = "th";
-
-/** attribute of the table tag */
- public static final String COLUMNS = "cols";
-
-/** attribute of the table tag */
- public static final String CELLPADDING = "cellpadding";
-
-/** attribute of the table tag */
- public static final String CELLSPACING = "cellspacing";
-
-/** attribute of the cell tag */
- public static final String COLSPAN = "colspan";
-
-/** attribute of the cell tag */
- public static final String ROWSPAN = "rowspan";
-
-/** attribute of the cell tag */
- public static final String NOWRAP = "nowrap";
-
-/** attribute of the table/cell tag */
- public static final String BORDERWIDTH = "border";
-
-/** attribute of the table/cell tag */
- public static final String WIDTH = "width";
-
-/** attribute of the table/cell tag */
- public static final String BACKGROUNDCOLOR = "bgcolor";
-
-/** attribute of the table/cell tag */
- public static final String BORDERCOLOR = "bordercolor";
-
-/** attribute of paragraph/image/table tag */
- public static final String ALIGN = "align";
-
-/** attribute of chapter/section/paragraph/table/cell tag */
- public static final String LEFT = "left";
-
-/** attribute of chapter/section/paragraph/table/cell tag */
- public static final String RIGHT = "right";
-
-/** attribute of the cell tag */
- public static final String HORIZONTALALIGN = "align";
-
-/** attribute of the cell tag */
- public static final String VERTICALALIGN = "valign";
-
-/** attribute of the table/cell tag */
- public static final String TOP = "top";
-
-/** attribute of the table/cell tag */
- public static final String BOTTOM = "bottom";
-
- // Misc
-
-/** the image tag */
- public static final String IMAGE = "img";
-
-/** attribute of the image tag */
- public static final String URL = "src";
-
-/** attribute of the image tag */
- public static final String ALT = "alt";
-
-/** attribute of the image tag */
- public static final String PLAINWIDTH = "width";
-
-/** attribute of the image tag */
- public static final String PLAINHEIGHT = "height";
-
-/** the newpage tag */
- public static final String NEWLINE = "br";
-
- // alignment attribute values
-
-/** the possible value of an alignment attribute */
- public static final String ALIGN_LEFT = "Left";
-
-/** the possible value of an alignment attribute */
- public static final String ALIGN_CENTER = "Center";
-
-/** the possible value of an alignment attribute */
- public static final String ALIGN_RIGHT = "Right";
-
-/** the possible value of an alignment attribute */
- public static final String ALIGN_JUSTIFIED = "Justify";
-
-/** the possible value of an alignment attribute */
- public static final String ALIGN_TOP = "Top";
-
-/** the possible value of an alignment attribute */
- public static final String ALIGN_MIDDLE = "Middle";
-
-/** the possible value of an alignment attribute */
- public static final String ALIGN_BOTTOM = "Bottom";
-
-/** the possible value of an alignment attribute */
- public static final String ALIGN_BASELINE = "Baseline";
-
-/** the possible value of an alignment attribute */
- public static final String DEFAULT = "Default";
-
- /** The DIV tag. */
- public static final String DIV = "div";
-
- /** The SPAN tag. */
- public static final String SPAN = "span";
- /** The LINK tag. */
- public static final String LINK = "link";
-
- /** This is a possible HTML attribute for the LINK tag. */
- public static final String TEXT_CSS = "text/css";
-
- /** This is a possible HTML attribute for the LINK tag. */
- public static final String REL = "rel";
-
- /** This is used for inline css style information */
- public static final String STYLE = "style";
-
- /** This is a possible HTML attribute for the LINK tag. */
- public static final String TYPE = "type";
-
- /** This is a possible HTML attribute. */
- public static final String STYLESHEET = "stylesheet";
-
-}
diff --git a/LibrarySource/com/lowagie/text/html/HtmlWriter.java b/LibrarySource/com/lowagie/text/html/HtmlWriter.java
deleted file mode 100644
index 7df77dc..0000000
--- a/LibrarySource/com/lowagie/text/html/HtmlWriter.java
+++ /dev/null
@@ -1,1084 +0,0 @@
-/*
- * $Id: HtmlWriter.java,v 1.104 2005/05/03 14:43:59 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU LIBRARY GENERAL PUBLIC LICENSE for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.html;
-
-import java.io.OutputStream;
-import java.io.IOException;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Stack;
-import java.util.EmptyStackException;
-
-import com.lowagie.text.*;
-import com.lowagie.text.markup.MarkupTags;
-
-/**
- * A <CODE>DocWriter</CODE> class for HTML.
- * <P>
- * An <CODE>HtmlWriter</CODE> can be added as a <CODE>DocListener</CODE>
- * to a certain <CODE>Document</CODE> by getting an instance.
- * Every <CODE>Element</CODE> added to the original <CODE>Document</CODE>
- * will be written to the <CODE>OutputStream</CODE> of this <CODE>HtmlWriter</CODE>.
- * <P>
- * Example:
- * <BLOCKQUOTE><PRE>
- * // creation of the document with a certain size and certain margins
- * Document document = new Document(PageSize.A4, 50, 50, 50, 50);
- * try {
- * // this will write HTML to the Standard OutputStream
- * <STRONG>HtmlWriter.getInstance(document, System.out);</STRONG>
- * // this will write HTML to a file called text.html
- * <STRONG>HtmlWriter.getInstance(document, new FileOutputStream("text.html"));</STRONG>
- * // this will write HTML to for instance the OutputStream of a HttpServletResponse-object
- * <STRONG>HtmlWriter.getInstance(document, response.getOutputStream());</STRONG>
- * }
- * catch(DocumentException de) {
- * System.err.println(de.getMessage());
- * }
- * // this will close the document and all the OutputStreams listening to it
- * <STRONG>document.close();</CODE>
- * </PRE></BLOCKQUOTE>
- */
-
-public class HtmlWriter extends DocWriter implements DocListener {
-
- // static membervariables (tags)
-
-/** This is a possible HTML-tag. */
- public static final byte[] BEGINCOMMENT = getISOBytes("<!-- ");
-
-/** This is a possible HTML-tag. */
- public static final byte[] ENDCOMMENT = getISOBytes(" -->");
-
-/** This is a possible HTML-tag. */
- public static final String NBSP = " ";
-
- // membervariables
-
-/** This is the current font of the HTML. */
- protected Stack currentfont = new Stack();
-
-/** This is the standard font of the HTML. */
- protected Font standardfont = new Font();
-
-/** This is a path for images. */
- protected String imagepath = null;
-
-/** Stores the page number. */
- protected int pageN = 0;
-
-/** This is the textual part of a header */
- protected HeaderFooter header = null;
-
-/** This is the textual part of the footer */
- protected HeaderFooter footer = null;
-
- // constructor
-
-/**
- * Constructs a <CODE>HtmlWriter</CODE>.
- *
- * @param doc The <CODE>Document</CODE> that has to be written as HTML
- * @param os The <CODE>OutputStream</CODE> the writer has to write to.
- */
-
- protected HtmlWriter(Document doc, OutputStream os) {
- super(doc, os);
-
- document.addDocListener(this);
- this.pageN = document.getPageNumber();
- try {
- os.write(LT);
- os.write(getISOBytes(HtmlTags.HTML));
- os.write(GT);
- os.write(NEWLINE);
- os.write(TAB);
- os.write(LT);
- os.write(getISOBytes(HtmlTags.HEAD));
- os.write(GT);
- }
- catch(IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- }
-
- // get an instance of the HtmlWriter
-
-/**
- * Gets an instance of the <CODE>HtmlWriter</CODE>.
- *
- * @param document The <CODE>Document</CODE> that has to be written
- * @param os The <CODE>OutputStream</CODE> the writer has to write to.
- * @return a new <CODE>HtmlWriter</CODE>
- */
-
- public static HtmlWriter getInstance(Document document, OutputStream os) {
- return new HtmlWriter(document, os);
- }
-
- // implementation of the DocListener methods
-
-/**
- * Signals that an new page has to be started.
- *
- * @return <CODE>true</CODE> if this action succeeded, <CODE>false</CODE> if not.
- * @throws DocumentException when a document isn't open yet, or has been closed
- */
-
- public boolean newPage() throws DocumentException {
- try {
- writeStart(HtmlTags.DIV);
- write(" ");
- write(HtmlTags.STYLE);
- write("=\"");
- writeCssProperty(MarkupTags.CSS_KEY_PAGE_BREAK_BEFORE, MarkupTags.CSS_VALUE_ALWAYS);
- write("\" /");
- os.write(GT);
- }
- catch(IOException ioe) {
- throw new DocumentException(ioe);
- }
- return true;
- }
-
-/**
- * Signals that an <CODE>Element</CODE> was added to the <CODE>Document</CODE>.
- *
- * @param element a high level object that has to be translated to HTML
- * @return <CODE>true</CODE> if the element was added, <CODE>false</CODE> if not.
- * @throws DocumentException when a document isn't open yet, or has been closed
- */
-
- public boolean add(Element element) throws DocumentException {
- if (pause) {
- return false;
- }
- try {
-
- switch(element.type()) {
- case Element.HEADER:
- try {
- Header h = (Header) element;
- if (HtmlTags.STYLESHEET.equals(h.name())) {
- writeLink(h);
- }
- else if (HtmlTags.JAVASCRIPT.equals(h.name())) {
- writeJavaScript(h);
- }
- else {
- writeHeader(h);
- }
- }
- catch(ClassCastException cce) {
- }
- return true;
- case Element.SUBJECT:
- case Element.KEYWORDS:
- case Element.AUTHOR:
- Meta meta = (Meta) element;
- writeHeader(meta);
- return true;
- case Element.TITLE:
- addTabs(2);
- writeStart(HtmlTags.TITLE);
- os.write(GT);
- addTabs(3);
- write(HtmlEncoder.encode(((Meta)element).content()));
- addTabs(2);
- writeEnd(HtmlTags.TITLE);
- return true;
- case Element.CREATOR:
- writeComment("Creator: " + HtmlEncoder.encode(((Meta)element).content()));
- return true;
- case Element.PRODUCER:
- writeComment("Producer: " + HtmlEncoder.encode(((Meta)element).content()));
- return true;
- case Element.CREATIONDATE:
- writeComment("Creationdate: " + HtmlEncoder.encode(((Meta)element).content()));
- return true;
- default:
- write(element, 2);
- return true;
- }
- }
- catch(IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- }
-
-/**
- * Signals that the <CODE>Document</CODE> has been opened and that
- * <CODE>Elements</CODE> can be added.
- * <P>
- * The <CODE>HEAD</CODE>-section of the HTML-document is written.
- */
-
- public void open() {
- super.open();
- try {
- writeComment("Producer: iTextXML by lowagie.com");
- writeComment("CreationDate: " + new Date().toString());
- addTabs(1);
- writeEnd(HtmlTags.HEAD);
- addTabs(1);
- writeStart(HtmlTags.BODY);
- if (document.leftMargin() > 0) {
- write(HtmlTags.LEFTMARGIN, String.valueOf(document.leftMargin()));
- }
- if (document.rightMargin() > 0) {
- write(HtmlTags.RIGHTMARGIN, String.valueOf(document.rightMargin()));
- }
- if (document.topMargin() > 0) {
- write(HtmlTags.TOPMARGIN, String.valueOf(document.topMargin()));
- }
- if (document.bottomMargin() > 0) {
- write(HtmlTags.BOTTOMMARGIN, String.valueOf(document.bottomMargin()));
- }
- if (pageSize.backgroundColor() != null) {
- write(HtmlTags.BACKGROUNDCOLOR, HtmlEncoder.encode(pageSize.backgroundColor()));
- }
- if (document.getJavaScript_onLoad() != null) {
- write(HtmlTags.JAVASCRIPT_ONLOAD, HtmlEncoder.encode(document.getJavaScript_onLoad()));
- }
- if (document.getJavaScript_onUnLoad() != null) {
- write(HtmlTags.JAVASCRIPT_ONUNLOAD, HtmlEncoder.encode(document.getJavaScript_onUnLoad()));
- }
- if (document.getHtmlStyleClass() != null) {
- write(MarkupTags.HTML_ATTR_CSS_CLASS, document.getHtmlStyleClass());
- }
- os.write(GT);
- initHeader(); // line added by David Freels
- }
- catch(IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- }
-
-/**
- * Signals that the <CODE>Document</CODE> was closed and that no other
- * <CODE>Elements</CODE> will be added.
- */
-
- public void close() {
- try {
- initFooter(); // line added by David Freels
- addTabs(1);
- writeEnd(HtmlTags.BODY);
- os.write(NEWLINE);
- writeEnd(HtmlTags.HTML);
- super.close();
- }
- catch(IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- }
-
- // some protected methods
-
-/**
- * Adds the header to the top of the </CODE>Document</CODE>
- */
-
- protected void initHeader() {
- if (header != null) {
- try {
- add(header.paragraph());
- }
- catch(Exception e) {
- throw new ExceptionConverter(e);
- }
- }
- }
-
-/**
- * Adds the header to the top of the </CODE>Document</CODE>
- */
-
- protected void initFooter() {
- if (footer != null) {
- try {
- // Set the page number. HTML has no notion of a page, so it should always
- // add up to 1
- footer.setPageNumber(pageN + 1);
- add(footer.paragraph());
- }
- catch(Exception e) {
- throw new ExceptionConverter(e);
- }
- }
- }
-
-/**
- * Writes a Metatag in the header.
- *
- * @param meta the element that has to be written
- * @throws IOException
- */
-
- protected void writeHeader(Meta meta) throws IOException {
- addTabs(2);
- writeStart(HtmlTags.META);
- switch(meta.type()) {
- case Element.HEADER:
- write(HtmlTags.NAME, ((Header) meta).name());
- break;
- case Element.SUBJECT:
- write(HtmlTags.NAME, HtmlTags.SUBJECT);
- break;
- case Element.KEYWORDS:
- write(HtmlTags.NAME, HtmlTags.KEYWORDS);
- break;
- case Element.AUTHOR:
- write(HtmlTags.NAME, HtmlTags.AUTHOR);
- break;
- }
- write(HtmlTags.CONTENT, HtmlEncoder.encode(meta.content()));
- writeEnd();
- }
-
-/**
- * Writes a link in the header.
- *
- * @param header the element that has to be written
- * @throws IOException
- */
-
- protected void writeLink(Header header) throws IOException {
- addTabs(2);
- writeStart(HtmlTags.LINK);
- write(HtmlTags.REL, header.name());
- write(HtmlTags.TYPE, HtmlTags.TEXT_CSS);
- write(HtmlTags.REFERENCE, header.content());
- writeEnd();
- }
-
-/**
- * Writes a JavaScript section or, if the markup attribute HtmlTags.URL is set, a JavaScript reference in the header.
- *
- * @param header the element that has to be written
- * @throws IOException
- */
-
- protected void writeJavaScript(Header header) throws IOException {
- addTabs(2);
- writeStart(HtmlTags.SCRIPT);
- write(HtmlTags.LANGUAGE, HtmlTags.JAVASCRIPT);
- if (header.getMarkupAttribute(HtmlTags.URL) != null) {
- /* JavaScript reference example:
- *
- * <script language="JavaScript" src="/myPath/MyFunctions.js"/>
- */
- write(HtmlTags.URL, header.getMarkupAttribute(HtmlTags.URL));
- os.write(GT);
- writeEnd(HtmlTags.SCRIPT);
- }
- else {
- /* JavaScript coding convention:
- *
- * <script language="JavaScript" type="text/javascript">
- * <!--
- * // ... JavaScript methods ...
- * //-->
- * </script>
- */
- write(HtmlTags.TYPE, MarkupTags.HTML_VALUE_JAVASCRIPT);
- os.write(GT);
- addTabs(2);
- write(new String(BEGINCOMMENT) + "\n");
- write(header.content());
- addTabs(2);
- write("//" + new String(ENDCOMMENT));
- addTabs(2);
- writeEnd(HtmlTags.SCRIPT);
- }
- }
-
-/**
- * Writes some comment.
- * <P>
- * This method writes some comment.
- *
- * @param comment the comment that has to be written
- * @throws IOException
- */
-
- protected void writeComment(String comment) throws IOException {
- addTabs(2);
- os.write(BEGINCOMMENT);
- write(comment);
- os.write(ENDCOMMENT);
- }
-
- // public methods
-
-/**
- * Changes the standardfont.
- *
- * @param standardfont The font
- */
-
- public void setStandardFont(Font standardfont) {
- this.standardfont = standardfont;
- }
-
-/**
- * Checks if a given font is the same as the font that was last used.
- *
- * @param font the font of an object
- * @return true if the font differs
- */
-
- public boolean isOtherFont(Font font) {
- try {
- Font cFont = (Font) currentfont.peek();
- if (cFont.compareTo(font) == 0) return false;
- return true;
- }
- catch(EmptyStackException ese) {
- if (standardfont.compareTo(font) == 0) return false;
- return true;
- }
- }
-
-/**
- * Sets the basepath for images.
- * <P>
- * This is especially useful if you add images using a file,
- * rather than an URL. In PDF there is no problem, since
- * the images are added inline, but in HTML it is sometimes
- * necessary to use a relative path or a special path to some
- * images directory.
- *
- * @param imagepath the new imagepath
- */
-
- public void setImagepath(String imagepath) {
- this.imagepath = imagepath;
- }
-
-/**
- * Resets the imagepath.
- */
-
- public void resetImagepath() {
- imagepath = null;
- }
-
-/**
- * Changes the header of this document.
- *
- * @param header the new header
- */
-
- public void setHeader(HeaderFooter header) {
- this.header = header;
- }
-
-/**
- * Changes the footer of this document.
- *
- * @param footer the new footer
- */
-
- public void setFooter(HeaderFooter footer) {
- this.footer = footer;
- }
-
-/**
- * Signals that a <CODE>String</CODE> was added to the <CODE>Document</CODE>.
- *
- * @param string a String to add to the HTML
- * @return <CODE>true</CODE> if the string was added, <CODE>false</CODE> if not.
- * @throws DocumentException when a document isn't open yet, or has been closed
- */
-
- public boolean add(String string) throws DocumentException{
- if (pause) {
- return false;
- }
- try
- {
- write(string);
- return true;
- }
- catch(IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- }
-
-/**
- * Writes the HTML representation of an element.
- *
- * @param element the element
- * @param indent the indentation
- * @throws IOException
- */
-
- protected void write(Element element, int indent) throws IOException {
- Properties styleAttributes = null;
- switch(element.type()) {
- case Element.CHUNK:
- {
- Chunk chunk = (Chunk) element;
- // if the chunk contains an image, return the image representation
- Image image = chunk.getImage();
- if (image != null) {
- write(image, indent);
- return;
- }
-
- if (chunk.isEmpty()) return;
- HashMap attributes = chunk.getAttributes();
- if (attributes != null && attributes.get(Chunk.NEWPAGE) != null) {
- return;
- }
- // This doesn't seem to work:
- //if (attributes != null && attributes.get(Chunk.SUBSUPSCRIPT) != null) {
- // float p = (((Float)attributes.get(Chunk.SUBSUPSCRIPT)).floatValue() * 100f) / chunk.font().size();
- // styleAttributes = new Properties();
- // styleAttributes.setProperty(MarkupTags.CSS_VERTICALALIGN, "" + p + "%");
- //}
- boolean tag = isOtherFont(chunk.font()) || hasMarkupAttributes(chunk) || styleAttributes != null;
- if (tag) {
- // start span tag
- addTabs(indent);
- writeStart(HtmlTags.SPAN);
- if (isOtherFont(chunk.font())) {
- write(chunk.font(), styleAttributes);
- }
- if (hasMarkupAttributes(chunk)) {
- writeMarkupAttributes((MarkupAttributes)chunk);
- }
- os.write(GT);
- }
- if (attributes != null && attributes.get(Chunk.SUBSUPSCRIPT) != null) {
- // start sup or sub tag
- if (((Float)attributes.get(Chunk.SUBSUPSCRIPT)).floatValue() > 0) {
- writeStart(HtmlTags.SUP);
- }
- else {
- writeStart(HtmlTags.SUB);
- }
- os.write(GT);
- }
- // contents
- write(HtmlEncoder.encode(chunk.content()));
- if (attributes != null && attributes.get(Chunk.SUBSUPSCRIPT) != null) {
- // end sup or sub tag
- os.write(LT);
- os.write(FORWARD);
- if (((Float)attributes.get(Chunk.SUBSUPSCRIPT)).floatValue() > 0) {
- write(HtmlTags.SUP);
- }
- else {
- write(HtmlTags.SUB);
- }
- os.write(GT);
- }
- if (tag) {
- // end tag
- writeEnd(MarkupTags.HTML_TAG_SPAN);
- }
- return;
- }
- case Element.PHRASE:
- {
- Phrase phrase = (Phrase) element;
- styleAttributes = new Properties();
- if (phrase.leadingDefined()) styleAttributes.setProperty(MarkupTags.CSS_KEY_LINEHEIGHT, String.valueOf(phrase.leading()) + "pt");
-
- // start tag
- addTabs(indent);
- writeStart(MarkupTags.HTML_TAG_SPAN);
- if (hasMarkupAttributes(phrase)) {
- writeMarkupAttributes((MarkupAttributes)phrase);
- }
- write(phrase.font(), styleAttributes);
- os.write(GT);
- currentfont.push(phrase.font());
- // contents
- for (Iterator i = phrase.iterator(); i.hasNext(); ) {
- write((Element) i.next(), indent + 1);
- }
- // end tag
- addTabs(indent);
- writeEnd(MarkupTags.HTML_TAG_SPAN);
- currentfont.pop();
- return;
- }
- case Element.ANCHOR:
- {
- Anchor anchor = (Anchor) element;
- styleAttributes = new Properties();
- if (anchor.leadingDefined()) styleAttributes.setProperty(MarkupTags.CSS_KEY_LINEHEIGHT, String.valueOf(anchor.leading()) + "pt");
-
- // start tag
- addTabs(indent);
- writeStart(HtmlTags.ANCHOR);
- if (anchor.name() != null) {
- write(HtmlTags.NAME, anchor.name());
- }
- if (anchor.reference() != null) {
- write(HtmlTags.REFERENCE, anchor.reference());
- }
- if (hasMarkupAttributes(anchor)) {
- writeMarkupAttributes((MarkupAttributes)anchor);
- }
- write(anchor.font(), styleAttributes);
- os.write(GT);
- currentfont.push(anchor.font());
- // contents
- for (Iterator i = anchor.iterator(); i.hasNext(); ) {
- write((Element) i.next(), indent + 1);
- }
- // end tag
- addTabs(indent);
- writeEnd(HtmlTags.ANCHOR);
- currentfont.pop();
- return;
- }
- case Element.PARAGRAPH:
- {
- Paragraph paragraph = (Paragraph) element;
- styleAttributes = new Properties();
- if (paragraph.leadingDefined()) styleAttributes.setProperty(MarkupTags.CSS_KEY_LINEHEIGHT, String.valueOf(paragraph.leading()) + "pt");
- // start tag
- addTabs(indent);
- writeStart(HtmlTags.DIV);
- if (hasMarkupAttributes(paragraph)) {
- writeMarkupAttributes((MarkupAttributes)paragraph);
- }
- String alignment = HtmlEncoder.getAlignment(paragraph.alignment());
- if (!"".equals(alignment)) {
- write(HtmlTags.ALIGN, alignment);
- }
- write(paragraph.font(), styleAttributes);
- os.write(GT);
- currentfont.push(paragraph.font());
- // contents
- for (Iterator i = paragraph.iterator(); i.hasNext(); ) {
- write((Element) i.next(), indent + 1);
- }
- // end tag
- addTabs(indent);
- writeEnd(HtmlTags.DIV);
- currentfont.pop();
- return;
- }
- case Element.SECTION:
- case Element.CHAPTER:
- {
- // part of the start tag + contents
- writeSection((Section) element, indent);
- return;
- }
- case Element.LIST:
- {
- List list = (List) element;
- // start tag
- addTabs(indent);
- if (list.isNumbered()) {
- writeStart(HtmlTags.ORDEREDLIST);
- }
- else {
- writeStart(HtmlTags.UNORDEREDLIST);
- }
- if (hasMarkupAttributes(list)) {
- writeMarkupAttributes((MarkupAttributes)list);
- }
- os.write(GT);
- // contents
- for (Iterator i = list.getItems().iterator(); i.hasNext(); ) {
- write((Element) i.next(), indent + 1);
- }
- // end tag
- addTabs(indent);
- if (list.isNumbered()) {
- writeEnd(HtmlTags.ORDEREDLIST);
- }
- else {
- writeEnd(HtmlTags.UNORDEREDLIST);
- }
- return;
- }
- case Element.LISTITEM:
- {
- ListItem listItem = (ListItem) element;
- styleAttributes = new Properties();
- if (listItem.leadingDefined()) styleAttributes.setProperty(MarkupTags.CSS_KEY_LINEHEIGHT, String.valueOf(listItem.leading()) + "pt");
-
- // start tag
- addTabs(indent);
- writeStart(HtmlTags.LISTITEM);
- if (hasMarkupAttributes(listItem)) {
- writeMarkupAttributes((MarkupAttributes)listItem);
- }
- write(listItem.font(), styleAttributes);
- os.write(GT);
- currentfont.push(listItem.font());
- // contents
- for (Iterator i = listItem.iterator(); i.hasNext(); ) {
- write((Element) i.next(), indent + 1);
- }
- // end tag
- addTabs(indent);
- writeEnd(HtmlTags.LISTITEM);
- currentfont.pop();
- return;
- }
- case Element.CELL:
- {
- Cell cell = (Cell) element;
-
- // start tag
- addTabs(indent);
- if (cell.header()) {
- writeStart(HtmlTags.HEADERCELL);
- }
- else {
- writeStart(HtmlTags.CELL);
- }
- if (hasMarkupAttributes(cell)) {
- writeMarkupAttributes((MarkupAttributes)cell);
- }
- if (cell.borderWidth() != Rectangle.UNDEFINED) {
- write(HtmlTags.BORDERWIDTH, String.valueOf(cell.borderWidth()));
- }
- if (cell.borderColor() != null) {
- write(HtmlTags.BORDERCOLOR, HtmlEncoder.encode(cell.borderColor()));
- }
- if (cell.backgroundColor() != null) {
- write(HtmlTags.BACKGROUNDCOLOR, HtmlEncoder.encode(cell.backgroundColor()));
- }
- String alignment = HtmlEncoder.getAlignment(cell.horizontalAlignment());
- if (!"".equals(alignment)) {
- write(HtmlTags.HORIZONTALALIGN, alignment);
- }
- alignment = HtmlEncoder.getAlignment(cell.verticalAlignment());
- if (!"".equals(alignment)) {
- write(HtmlTags.VERTICALALIGN, alignment);
- }
- if (cell.cellWidth() != null) {
- write(HtmlTags.WIDTH, cell.cellWidth());
- }
- if (cell.colspan() != 1) {
- write(HtmlTags.COLSPAN, String.valueOf(cell.colspan()));
- }
- if (cell.rowspan() != 1) {
- write(HtmlTags.ROWSPAN, String.valueOf(cell.rowspan()));
- }
- if (cell.noWrap()) {
- write(HtmlTags.NOWRAP, String.valueOf(true));
- }
- os.write(GT);
- // contents
- if (cell.isEmpty()) {
- write(NBSP);
- } else {
- for (Iterator i = cell.getElements(); i.hasNext(); ) {
- write((Element) i.next(), indent + 1);
- }
- }
- // end tag
- addTabs(indent);
- if (cell.header()) {
- writeEnd(HtmlTags.HEADERCELL);
- }
- else {
- writeEnd(HtmlTags.CELL);
- }
- return;
- }
- case Element.ROW:
- {
- Row row = (Row) element;
-
- // start tag
- addTabs(indent);
- writeStart(HtmlTags.ROW);
- if (hasMarkupAttributes(row)) {
- writeMarkupAttributes((MarkupAttributes)row);
- }
- os.write(GT);
- // contents
- Element cell;
- for (int i = 0; i < row.columns(); i++) {
- if ((cell = (Element)row.getCell(i)) != null) {
- write(cell, indent + 1);
- }
- }
- // end tag
- addTabs(indent);
- writeEnd(HtmlTags.ROW);
- return;
- }
- case Element.TABLE:
- {
- Table table = (Table) element;
- table.complete();
- // start tag
- addTabs(indent);
- writeStart(HtmlTags.TABLE);
- if (hasMarkupAttributes(table)) {
- writeMarkupAttributes((MarkupAttributes)table);
- }
- os.write(SPACE);
- write(HtmlTags.WIDTH);
- os.write(EQUALS);
- os.write(QUOTE);
- if (! "".equals(table.absWidth())){
- write(table.absWidth());
- }
- else{
- write(String.valueOf(table.widthPercentage()));
- write("%");
- }
- os.write(QUOTE);
- String alignment = HtmlEncoder.getAlignment(table.alignment());
- if (!"".equals(alignment)) {
- write(HtmlTags.ALIGN, alignment);
- }
- write(HtmlTags.CELLPADDING, String.valueOf(table.cellpadding()));
- write(HtmlTags.CELLSPACING, String.valueOf(table.cellspacing()));
- if (table.borderWidth() != Rectangle.UNDEFINED) {
- write(HtmlTags.BORDERWIDTH, String.valueOf(table.borderWidth()));
- }
- if (table.borderColor() != null) {
- write(HtmlTags.BORDERCOLOR, HtmlEncoder.encode(table.borderColor()));
- }
- if (table.backgroundColor() != null) {
- write(HtmlTags.BACKGROUNDCOLOR, HtmlEncoder.encode(table.backgroundColor()));
- }
- os.write(GT);
- // contents
- Row row;
- for (Iterator iterator = table.iterator(); iterator.hasNext(); ) {
- row = (Row) iterator.next();
- write(row, indent + 1);
- }
- // end tag
- addTabs(indent);
- writeEnd(HtmlTags.TABLE);
- return;
- }
- case Element.ANNOTATION:
- {
- Annotation annotation = (Annotation) element;
- writeComment(annotation.title() + ": " + annotation.content());
- if (hasMarkupAttributes(annotation)) {
- os.write(BEGINCOMMENT);
- writeMarkupAttributes((MarkupAttributes)annotation);
- os.write(ENDCOMMENT);
- }
- return;
- }
- case Element.IMGRAW:
- case Element.JPEG:
- case Element.IMGTEMPLATE:
- {
- Image image = (Image) element;
- if (image.url() == null) {
- return;
- }
-
- // start tag
- addTabs(indent);
- writeStart(HtmlTags.IMAGE);
- String path = image.url().toString();
- if (imagepath != null) {
- if (path.indexOf("/") > 0) {
- path = imagepath + path.substring(path.lastIndexOf("/") + 1);
- }
- else {
- path = imagepath + path;
- }
- }
- write(HtmlTags.URL, path);
- if ((image.alignment() & Image.LEFT) > 0) {
- write(HtmlTags.ALIGN, HtmlTags.ALIGN_LEFT);
- }
- else if ((image.alignment() & Image.RIGHT) > 0) {
- write(HtmlTags.ALIGN, HtmlTags.ALIGN_RIGHT);
- }
- else if ((image.alignment() & Image.MIDDLE) > 0) {
- write(HtmlTags.ALIGN, HtmlTags.ALIGN_MIDDLE);
- }
- if (image.alt() != null) {
- write(HtmlTags.ALT, image.alt());
- }
- write(HtmlTags.PLAINWIDTH, String.valueOf(image.scaledWidth()));
- write(HtmlTags.PLAINHEIGHT, String.valueOf(image.scaledHeight()));
- if (hasMarkupAttributes(image)){
- writeMarkupAttributes((MarkupAttributes)image);
- }
- writeEnd();
- return;
- }
-
- default:
- return;
- }
- }
-
-/**
- * Writes the HTML representation of a section.
- *
- * @param section the section to write
- * @param indent the indentation
- * @throws IOException
- */
-
- protected void writeSection(Section section, int indent) throws IOException {
- if (section.title() != null) {
- int depth = section.depth() - 1;
- if (depth > 5) {
- depth = 5;
- }
- Properties styleAttributes = new Properties();
- if (section.title().leadingDefined()) styleAttributes.setProperty(MarkupTags.CSS_KEY_LINEHEIGHT, String.valueOf(section.title().leading()) + "pt");
- // start tag
- addTabs(indent);
- writeStart(HtmlTags.H[depth]);
- write(section.title().font(), styleAttributes);
- String alignment = HtmlEncoder.getAlignment(section.title().alignment());
- if (!"".equals(alignment)) {
- write(HtmlTags.ALIGN, alignment);
- }
- if (hasMarkupAttributes(section.title())) {
- writeMarkupAttributes((MarkupAttributes)section.title());
- }
- os.write(GT);
- currentfont.push(section.title().font());
- // contents
- for (Iterator i = section.title().iterator(); i.hasNext(); ) {
- write((Element)i.next(), indent + 1);
- }
- // end tag
- addTabs(indent);
- writeEnd(HtmlTags.H[depth]);
- currentfont.pop();
- }
- for (Iterator i = section.iterator(); i.hasNext(); ) {
- write((Element) i.next(), indent);
- }
- }
-
- /**
- * Writes the representation of a <CODE>Font</CODE>.
- *
- * @param font a <CODE>Font</CODE>
- * @param styleAttributes the style of the font
- * @throws IOException
- */
-
- protected void write(Font font, Properties styleAttributes) throws IOException {
- if (font == null || !isOtherFont(font) /* || styleAttributes == null*/) return;
- write(" ");
- write(HtmlTags.STYLE);
- write("=\"");
- if (styleAttributes != null) {
- String key;
- for (Enumeration e = styleAttributes.propertyNames(); e.hasMoreElements(); ) {
- key = (String)e.nextElement();
- writeCssProperty(key, styleAttributes.getProperty(key));
- }
- }
- if (isOtherFont(font)) {
- writeCssProperty(MarkupTags.CSS_KEY_FONTFAMILY, font.getFamilyname());
-
- if (font.size() != Font.UNDEFINED) {
- writeCssProperty(MarkupTags.CSS_KEY_FONTSIZE, String.valueOf(font.size()) + "pt");
- }
- if (font.color() != null) {
- writeCssProperty(MarkupTags.CSS_KEY_COLOR, HtmlEncoder.encode(font.color()));
- }
-
- int fontstyle = font.style();
- if (fontstyle != Font.UNDEFINED && fontstyle != Font.NORMAL) {
- switch (fontstyle & Font.BOLDITALIC) {
- case Font.BOLD:
- writeCssProperty(MarkupTags.CSS_KEY_FONTWEIGHT, MarkupTags.CSS_VALUE_BOLD);
- break;
- case Font.ITALIC:
- writeCssProperty(MarkupTags.CSS_KEY_FONTSTYLE, MarkupTags.CSS_VALUE_ITALIC);
- break;
- case Font.BOLDITALIC:
- writeCssProperty(MarkupTags.CSS_KEY_FONTWEIGHT, MarkupTags.CSS_VALUE_BOLD);
- writeCssProperty(MarkupTags.CSS_KEY_FONTSTYLE, MarkupTags.CSS_VALUE_ITALIC);
- break;
- }
-
- // CSS only supports one decoration tag so if both are specified
- // only one of the two will display
- if ((fontstyle & Font.UNDERLINE) > 0) {
- writeCssProperty(MarkupTags.CSS_KEY_TEXTDECORATION, MarkupTags.CSS_VALUE_UNDERLINE);
- }
- if ((fontstyle & Font.STRIKETHRU) > 0) {
- writeCssProperty(MarkupTags.CSS_KEY_TEXTDECORATION, MarkupTags.CSS_VALUE_LINETHROUGH);
- }
- }
- }
- write("\"");
- }
-
- /**
- * Writes out a CSS property.
- * @param prop a CSS property
- * @param value the value of the CSS property
- * @throws IOException
- */
- protected void writeCssProperty(String prop, String value) throws IOException {
- write(new StringBuffer(prop).append(": ").append(value).append("; ").toString());
- }
-}
diff --git a/LibrarySource/com/lowagie/text/html/simpleparser/ChainedProperties.java b/LibrarySource/com/lowagie/text/html/simpleparser/ChainedProperties.java
deleted file mode 100644
index eb5097a..0000000
--- a/LibrarySource/com/lowagie/text/html/simpleparser/ChainedProperties.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright 2004 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.html.simpleparser;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-public class ChainedProperties {
-
- public final static int fontSizes[] = {8, 10, 12, 14, 18, 24, 36};
- public ArrayList chain = new ArrayList();
-
- /** Creates a new instance of ChainedProperties */
- public ChainedProperties() {
- }
-
- public String getProperty(String key) {
- for (int k = chain.size() - 1; k >= 0; --k) {
- Object obj[] = (Object[])chain.get(k);
- HashMap prop = (HashMap)obj[1];
- String ret = (String)prop.get(key);
- if (ret != null)
- return ret;
- }
- return null;
- }
-
- public boolean hasProperty(String key) {
- for (int k = chain.size() - 1; k >= 0; --k) {
- Object obj[] = (Object[])chain.get(k);
- HashMap prop = (HashMap)obj[1];
- if (prop.containsKey(key))
- return true;
- }
- return false;
- }
-
- public void addToChain(String key, HashMap prop) {
- // adjust the font size
- String value = (String)prop.get("size");
- if (value != null) {
- if (value.endsWith("px")) {
- prop.put("size", value.substring(0, value.length() - 2));
- }
- else {
- int s = 0;
- if (value.startsWith("+") || value.startsWith("-")) {
- String old = getProperty("basefontsize");
- if (old == null)
- old = "12";
- float f = Float.valueOf(old).floatValue();
- int c = (int)f;
- for (int k = fontSizes.length - 1; k >= 0; --k) {
- if (c >= fontSizes[k]) {
- s = k;
- break;
- }
- }
- int inc = Integer.parseInt(value.startsWith("+") ? value.substring(1) : value);
- s += inc;
- }
- else
- s = Integer.parseInt(value) - 1;
- if (s < 0)
- s = 0;
- else if (s >= fontSizes.length)
- s = fontSizes.length - 1;
- prop.put("size", Integer.toString(fontSizes[s]));
- }
- }
- chain.add(new Object[]{key, prop});
- }
-
- public void removeChain(String key) {
- for (int k = chain.size() - 1; k >= 0; --k) {
- if (key.equals(((Object[])chain.get(k))[0])) {
- chain.remove(k);
- return;
- }
- }
- }
-}
diff --git a/LibrarySource/com/lowagie/text/html/simpleparser/FactoryProperties.java b/LibrarySource/com/lowagie/text/html/simpleparser/FactoryProperties.java
deleted file mode 100644
index c375c1c..0000000
--- a/LibrarySource/com/lowagie/text/html/simpleparser/FactoryProperties.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright 2004 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.html.simpleparser;
-
-import com.lowagie.text.*;
-import com.lowagie.text.pdf.*;
-import java.util.HashMap;
-import java.util.StringTokenizer;
-import headless.awt.Color;
-
-/**
- *
- * @author psoares
- */
-public class FactoryProperties {
-
- /** Creates a new instance of FactoryProperties */
- public FactoryProperties() {
- }
-
- public static Chunk createChunk(String text, ChainedProperties props) {
- Chunk ck = new Chunk(text, getFont(props));
- if (props.hasProperty("sub"))
- ck.setTextRise(-6);
- else if (props.hasProperty("sup"))
- ck.setTextRise(6);
- return ck;
- }
-
- public static Paragraph createParagraph(HashMap props) {
- Paragraph p = new Paragraph();
- String value = (String)props.get("align");
- if (value != null) {
- if (value.equalsIgnoreCase("center"))
- p.setAlignment(Element.ALIGN_CENTER);
- else if (value.equalsIgnoreCase("right"))
- p.setAlignment(Element.ALIGN_RIGHT);
- else if (value.equalsIgnoreCase("justify"))
- p.setAlignment(Element.ALIGN_JUSTIFIED);
- }
- p.setLeading(0, 1.5f);
- return p;
- }
-
- public static Paragraph createParagraph(ChainedProperties props) {
- Paragraph p = new Paragraph();
- String value = props.getProperty("align");
- if (value != null) {
- if (value.equalsIgnoreCase("center"))
- p.setAlignment(Element.ALIGN_CENTER);
- else if (value.equalsIgnoreCase("right"))
- p.setAlignment(Element.ALIGN_RIGHT);
- else if (value.equalsIgnoreCase("justify"))
- p.setAlignment(Element.ALIGN_JUSTIFIED);
- }
- p.setLeading(0, 1.5f);
- return p;
- }
-
- public static Font getFont(ChainedProperties props) {
- String face = props.getProperty("face");
- if (face != null) {
- StringTokenizer tok = new StringTokenizer(face, ",");
- while (tok.hasMoreTokens()) {
- face = tok.nextToken().trim();
- if (FontFactory.isRegistered(face))
- break;
- }
- }
- int style = 0;
- if (props.hasProperty("i"))
- style |= Font.ITALIC;
- if (props.hasProperty("b"))
- style |= Font.BOLD;
- if (props.hasProperty("u"))
- style |= Font.UNDERLINE;
- String value = props.getProperty("size");
- float size = 12;
- if (value != null)
- size = Float.valueOf(value).floatValue();
- Color color = decodeColor(props.getProperty("color"));
- return FontFactory.getFont(face, BaseFont.WINANSI, true, size, style, color);
- }
-
- public static Color decodeColor(String s) {
- if (s == null)
- return null;
- s = s.toLowerCase().trim();
- Color c = (Color)colorTable.get(s);
- if (c != null)
- return c;
- try {
- if (s.startsWith("#"))
- return new Color(Integer.parseInt(s.substring(1), 16));
- }
- catch (Exception e) {
- }
- return null;
- }
-
- public static HashMap colorTable = new HashMap();
- public static HashMap followTags = new HashMap();
- static {
- followTags.put("i", "i");
- followTags.put("b", "b");
- followTags.put("u", "u");
- followTags.put("sub", "sub");
- followTags.put("sup", "sup");
- followTags.put("em", "i");
- followTags.put("strong", "b");
-
- colorTable.put("black", new Color(0x000000));
- colorTable.put("green", new Color(0x008000));
- colorTable.put("silver", new Color(0xC0C0C0));
- colorTable.put("lime", new Color(0x00FF00));
- colorTable.put("gray", new Color(0x808080));
- colorTable.put("olive", new Color(0x808000));
- colorTable.put("white", new Color(0xFFFFFF));
- colorTable.put("yellow", new Color(0xFFFF00));
- colorTable.put("maroon", new Color(0x800000));
- colorTable.put("navy", new Color(0x000080));
- colorTable.put("red", new Color(0xFF0000));
- colorTable.put("blue", new Color(0x0000FF));
- colorTable.put("purple", new Color(0x800080));
- colorTable.put("teal", new Color(0x008080));
- colorTable.put("fuchsia", new Color(0xFF00FF));
- colorTable.put("aqua", new Color(0x00FFFF));
- }
-}
diff --git a/LibrarySource/com/lowagie/text/html/simpleparser/HTMLWorker.java b/LibrarySource/com/lowagie/text/html/simpleparser/HTMLWorker.java
deleted file mode 100644
index f5a0f07..0000000
--- a/LibrarySource/com/lowagie/text/html/simpleparser/HTMLWorker.java
+++ /dev/null
@@ -1,500 +0,0 @@
-/*
- * Copyright 2004 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.html.simpleparser;
-
-import com.lowagie.text.*;
-import com.lowagie.text.pdf.*;
-import java.util.Stack;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.StringTokenizer;
-import java.io.IOException;
-import java.io.Reader;
-
-public class HTMLWorker implements SimpleXMLDocHandler, DocListener {
-
- public ArrayList objectList;
- public DocListener document;
- public Paragraph currentParagraph;
- public ChainedProperties cprops = new ChainedProperties();
- public Stack stack = new Stack();
- public boolean pendingP = false;
- public boolean pendingTR = false;
- public boolean pendingTD = false;
- public boolean pendingLI = false;
- public StyleSheet style = new StyleSheet();
- public boolean isPRE = false;
- public Stack tableState = new Stack();
- public boolean skipText = false;
-
- /** Creates a new instance of HTMLWorker */
- public HTMLWorker(DocListener document) {
- this.document = document;
- }
-
- public void setStyleSheet(StyleSheet style) {
- this.style = style;
- }
-
- public void parse(Reader reader) throws IOException {
- SimpleXMLParser.parse(this, null, reader, true);
- }
-
- public static ArrayList parseToList(Reader reader, StyleSheet style) throws IOException {
- HTMLWorker worker = new HTMLWorker(null);
- if (style != null)
- worker.style = style;
- worker.document = worker;
- worker.objectList = new ArrayList();
- worker.parse(reader);
- return worker.objectList;
- }
-
- public void endDocument() {
- try {
- for (int k = 0; k < stack.size(); ++k)
- document.add((Element)stack.elementAt(k));
- if (currentParagraph != null)
- document.add(currentParagraph);
- currentParagraph = null;
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- public void startDocument() {
- HashMap h = new HashMap();
- style.applyStyle("body", h);
- cprops.addToChain("body", h);
- }
-
- public void startElement(String tag, HashMap h) {
- if (!tagsSupported.containsKey(tag))
- return;
- style.applyStyle(tag, h);
- String follow = (String)FactoryProperties.followTags.get(tag);
- if (follow != null) {
- HashMap prop = new HashMap();
- prop.put(follow, null);
- cprops.addToChain(follow, prop);
- return;
- }
- if (tag.equals("a")) {
- cprops.addToChain(tag, h);
- if (currentParagraph == null)
- currentParagraph = new Paragraph();
- stack.push(currentParagraph);
- currentParagraph = new Paragraph();
- return;
- }
- if (tag.equals("br")) {
- if (currentParagraph == null)
- currentParagraph = new Paragraph();
- currentParagraph.add(FactoryProperties.createChunk("\n", cprops));
- return;
- }
- if (tag.equals("font") || tag.equals("span")) {
- cprops.addToChain(tag, h);
- return;
- }
- endElement("p");
- if (tag.equals("h1") || tag.equals("h2") || tag.equals("h3") || tag.equals("h4") || tag.equals("h5") || tag.equals("h6")) {
- if (!h.containsKey("size"))
- h.put("size", tag.substring(1));
- cprops.addToChain(tag, h);
- return;
- }
- if (tag.equals("ul")) {
- if (pendingLI)
- endElement("li");
- skipText = true;
- cprops.addToChain(tag, h);
- com.lowagie.text.List list = new com.lowagie.text.List(false, 10);
- list.setListSymbol("\u2022");
- stack.push(list);
- return;
- }
- if (tag.equals("ol")) {
- if (pendingLI)
- endElement("li");
- skipText = true;
- cprops.addToChain(tag, h);
- com.lowagie.text.List list = new com.lowagie.text.List(true, 10);
- stack.push(list);
- return;
- }
- if (tag.equals("li")) {
- if (pendingLI)
- endElement("li");
- skipText = false;
- pendingLI = true;
- cprops.addToChain(tag, h);
- stack.push(new com.lowagie.text.ListItem());
- return;
- }
- if (tag.equals("div") || tag.equals("body")) {
- cprops.addToChain(tag, h);
- return;
- }
- if (tag.equals("pre")) {
- if (!h.containsKey("face")) {
- h.put("face", "Courier");
- }
- cprops.addToChain(tag, h);
- isPRE = true;
- return;
- }
- if (tag.equals("p")) {
- cprops.addToChain(tag, h);
- currentParagraph = FactoryProperties.createParagraph(h);
- return;
- }
- if (tag.equals("tr")) {
- if (pendingTR)
- endElement("tr");
- skipText = true;
- pendingTR = true;
- cprops.addToChain("tr", h);
- return;
- }
- if (tag.equals("td") || tag.equals("th")) {
- if (pendingTD)
- endElement(tag);
- skipText = false;
- pendingTD = true;
- cprops.addToChain("td", h);
- stack.push(new IncCell(tag, cprops));
- return;
- }
- if (tag.equals("table")) {
- cprops.addToChain("table", h);
- IncTable table = new IncTable(h);
- stack.push(table);
- tableState.push(new boolean[]{pendingTR, pendingTD});
- pendingTR = pendingTD = false;
- skipText = true;
- return;
- }
- }
-
- public void endElement(String tag) {
- if (!tagsSupported.containsKey(tag))
- return;
- try {
- String follow = (String)FactoryProperties.followTags.get(tag);
- if (follow != null) {
- cprops.removeChain(follow);
- return;
- }
- if (tag.equals("font") || tag.equals("span")) {
- cprops.removeChain(tag);
- return;
- }
- if (tag.equals("a")) {
- String href = cprops.getProperty("href");
- if (currentParagraph == null)
- currentParagraph = new Paragraph();
- if (href != null) {
- ArrayList chunks = currentParagraph.getChunks();
- for (int k = 0; k < chunks.size(); ++k) {
- Chunk ck = (Chunk)chunks.get(k);
- ck.setAnchor(href);
- }
- }
- Paragraph tmp = (Paragraph)stack.pop();
- Phrase tmp2 = new Phrase();
- tmp2.add(currentParagraph);
- tmp.add(tmp2);
- currentParagraph = tmp;
- cprops.removeChain("a");
- return;
- }
- if (tag.equals("br")) {
- return;
- }
- if (currentParagraph != null) {
- if (stack.empty())
- document.add(currentParagraph);
- else {
- Object obj = stack.pop();
- if (obj instanceof TextElementArray) {
- TextElementArray current = (TextElementArray)obj;
- current.add(currentParagraph);
- }
- stack.push(obj);
- }
- }
- currentParagraph = null;
- if (tag.equals("ul") || tag.equals("ol")) {
- if (pendingLI)
- endElement("li");
- skipText = false;
- cprops.removeChain(tag);
- if (stack.empty())
- return;
- Object obj = stack.pop();
- if (!(obj instanceof com.lowagie.text.List)) {
- stack.push(obj);
- return;
- }
- if (stack.empty())
- document.add((Element)obj);
- else
- ((TextElementArray)stack.peek()).add(obj);
- return;
- }
- if (tag.equals("li")) {
- pendingLI = false;
- skipText = true;
- cprops.removeChain(tag);
- if (stack.empty())
- return;
- Object obj = stack.pop();
- if (!(obj instanceof ListItem)) {
- stack.push(obj);
- return;
- }
- if (stack.empty()) {
- document.add((Element)obj);
- return;
- }
- Object list = stack.pop();
- if (!(list instanceof com.lowagie.text.List)) {
- stack.push(list);
- return;
- }
- ListItem item = (ListItem)obj;
- ((com.lowagie.text.List)list).add(item);
- ArrayList cks = item.getChunks();
- if (cks.size() > 0)
- item.listSymbol().setFont(((Chunk)cks.get(0)).font());
- stack.push(list);
- return;
- }
- if (tag.equals("div") || tag.equals("body")) {
- cprops.removeChain(tag);
- return;
- }
- if (tag.equals("pre")) {
- cprops.removeChain(tag);
- isPRE = false;
- return;
- }
- if (tag.equals("p")) {
- cprops.removeChain(tag);
- pendingP = false;
- return;
- }
- if (tag.equals("h1") || tag.equals("h2") || tag.equals("h3") || tag.equals("h4") || tag.equals("h5") || tag.equals("h6")) {
- cprops.removeChain(tag);
- return;
- }
- if (tag.equals("table")) {
- if (pendingTR)
- endElement("tr");
- cprops.removeChain("table");
- IncTable table = (IncTable) stack.pop();
- PdfPTable tb = table.buildTable();
- tb.setSplitRows(true);
- if (stack.empty())
- document.add(tb);
- else
- ((TextElementArray)stack.peek()).add(tb);
- boolean state[] = (boolean[])tableState.pop();
- pendingTR = state[0];
- pendingTD = state[1];
- skipText = false;
- return;
- }
- if (tag.equals("tr")) {
- if (pendingTD)
- endElement("td");
- pendingTR = false;
- cprops.removeChain("tr");
- ArrayList cells = new ArrayList();
- IncTable table = null;
- while (true) {
- Object obj = stack.pop();
- if (obj instanceof IncCell) {
- cells.add(((IncCell)obj).getCell());
- }
- if (obj instanceof IncTable) {
- table = (IncTable)obj;
- break;
- }
- }
- table.addCols(cells);
- table.endRow();
- stack.push(table);
- skipText = true;
- return;
- }
- if (tag.equals("td") || tag.equals("th")) {
- pendingTD = false;
- cprops.removeChain("td");
- skipText = true;
- return;
- }
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- public void text(String str) {
- if (skipText)
- return;
- String content = str;
- if (isPRE) {
- if (currentParagraph == null)
- currentParagraph = new Paragraph();
- currentParagraph.add(FactoryProperties.createChunk(content, cprops));
- return;
- }
- if (content.trim().length() == 0 && content.indexOf(' ') < 0) {
- return;
- }
-
- StringBuffer buf = new StringBuffer();
- int len = content.length();
- char character;
- boolean newline = false;
- for (int i = 0; i < len; i++) {
- switch(character = content.charAt(i)) {
- case ' ':
- if (!newline) {
- buf.append(character);
- }
- break;
- case '\n':
- if (i > 0) {
- newline = true;
- buf.append(' ');
- }
- break;
- case '\r':
- break;
- case '\t':
- break;
- default:
- newline = false;
- buf.append(character);
- }
- }
- if (currentParagraph == null)
- currentParagraph = FactoryProperties.createParagraph(cprops);
- currentParagraph.add(FactoryProperties.createChunk(buf.toString(), cprops));
- }
-
- public boolean add(Element element) throws DocumentException {
- objectList.add(element);
- return true;
- }
-
- public boolean add(Watermark watermark) {
- return true;
- }
-
- public void clearTextWrap() throws DocumentException {
- }
-
- public void close() {
- }
-
- public boolean newPage() throws DocumentException {
- return true;
- }
-
- public void open() {
- }
-
- public void removeWatermark() {
- }
-
- public void resetFooter() {
- }
-
- public void resetHeader() {
- }
-
- public void resetPageCount() {
- }
-
- public void setFooter(HeaderFooter footer) {
- }
-
- public void setHeader(HeaderFooter header) {
- }
-
- public boolean setMarginMirroring(boolean marginMirroring) {
- return true;
- }
-
- public boolean setMargins(float marginLeft, float marginRight, float marginTop, float marginBottom) {
- return true;
- }
-
- public void setPageCount(int pageN) {
- }
-
- public boolean setPageSize(Rectangle pageSize) {
- return true;
- }
-
- public static final String tagsSupportedString = "ol ul li a pre font span br p div body table td th tr i b u sub sup em strong"
- + " h1 h2 h3 h4 h5 h6";
-
- public static final HashMap tagsSupported = new HashMap();
-
- static {
- StringTokenizer tok = new StringTokenizer(tagsSupportedString);
- while (tok.hasMoreTokens())
- tagsSupported.put(tok.nextToken(), null);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/html/simpleparser/IncCell.java b/LibrarySource/com/lowagie/text/html/simpleparser/IncCell.java
deleted file mode 100644
index 8c67264..0000000
--- a/LibrarySource/com/lowagie/text/html/simpleparser/IncCell.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright 2004 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.html.simpleparser;
-
-import com.lowagie.text.*;
-import com.lowagie.text.pdf.*;
-import java.util.ArrayList;
-/**
- *
- * @author psoares
- */
-public class IncCell implements TextElementArray {
-
- public ArrayList chunks = new ArrayList();
- public PdfPCell cell;
-
- /** Creates a new instance of IncCell */
- public IncCell(String tag, ChainedProperties props) {
- cell = new PdfPCell((Phrase)null);
- String value = props.getProperty("colspan");
- if (value != null)
- cell.setColspan(Integer.parseInt(value));
- value = props.getProperty("align");
- if (tag.equals("th"))
- cell.setHorizontalAlignment(Element.ALIGN_CENTER);
- if (value != null) {
- if ("center".equalsIgnoreCase(value))
- cell.setHorizontalAlignment(Element.ALIGN_CENTER);
- else if ("right".equalsIgnoreCase(value))
- cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
- else if ("left".equalsIgnoreCase(value))
- cell.setHorizontalAlignment(Element.ALIGN_LEFT);
- else if ("justify".equalsIgnoreCase(value))
- cell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
- }
- value = props.getProperty("valign");
- cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
- if (value != null) {
- if ("top".equalsIgnoreCase(value))
- cell.setVerticalAlignment(Element.ALIGN_TOP);
- else if ("bottom".equalsIgnoreCase(value))
- cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
- }
- value = props.getProperty("border");
- float border = 0;
- if (value != null)
- border = Float.valueOf(value).floatValue();
- cell.setBorderWidth(border);
- value = props.getProperty("cellpadding");
- if (value != null)
- cell.setPadding(Float.valueOf(value).floatValue());
- cell.setUseDescender(true);
- value = props.getProperty("bgcolor");
- cell.setBackgroundColor(FactoryProperties.decodeColor(value));
- }
-
- public boolean add(Object o) {
- if (!(o instanceof Element))
- return false;
- cell.addElement((Element)o);
- return true;
- }
-
- public ArrayList getChunks() {
- return chunks;
- }
-
- public boolean process(ElementListener listener) {
- return true;
- }
-
- public int type() {
- return 0;
- }
-
- public PdfPCell getCell() {
- return cell;
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/html/simpleparser/IncTable.java b/LibrarySource/com/lowagie/text/html/simpleparser/IncTable.java
deleted file mode 100644
index 757f499..0000000
--- a/LibrarySource/com/lowagie/text/html/simpleparser/IncTable.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright 2004 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.html.simpleparser;
-
-import com.lowagie.text.pdf.*;
-import java.util.HashMap;
-import java.util.ArrayList;
-import java.util.Collections;
-
-/**
- *
- * @author psoares
- */
-public class IncTable {
- public HashMap props = new HashMap();
- public ArrayList rows = new ArrayList();
- public ArrayList cols;
- /** Creates a new instance of IncTable */
- public IncTable(HashMap props) {
- this.props.putAll(props);
- }
-
- public void addCol(PdfPCell cell) {
- if (cols == null)
- cols = new ArrayList();
- cols.add(cell);
- }
-
- public void addCols(ArrayList ncols) {
- if (cols == null)
- cols = new ArrayList(ncols);
- else
- cols.addAll(ncols);
- }
-
- public void endRow() {
- if (cols != null) {
- Collections.reverse(cols);
- rows.add(cols);
- cols = null;
- }
- }
-
- public ArrayList getRows() {
- return rows;
- }
-
- public PdfPTable buildTable() {
- if (rows.size() == 0)
- return new PdfPTable(1);
- int ncol = 0;
- ArrayList c0 = (ArrayList)rows.get(0);
- for (int k = 0; k < c0.size(); ++k) {
- ncol += ((PdfPCell)c0.get(k)).getColspan();
- }
- PdfPTable table = new PdfPTable(ncol);
- String width = (String)props.get("width");
- if (width == null)
- table.setWidthPercentage(100);
- else {
- if (width.endsWith("%"))
- table.setWidthPercentage(Float.valueOf(width.substring(0, width.length() - 1)).floatValue());
- else {
- table.setTotalWidth(Float.valueOf(width).floatValue());
- table.setLockedWidth(true);
- }
- }
- for (int row = 0; row < rows.size(); ++row) {
- ArrayList col = (ArrayList)rows.get(row);
- for (int k = 0; k < col.size(); ++k) {
- table.addCell((PdfPCell)col.get(k));
- }
- }
- return table;
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/html/simpleparser/StyleSheet.java b/LibrarySource/com/lowagie/text/html/simpleparser/StyleSheet.java
deleted file mode 100644
index 1b84b12..0000000
--- a/LibrarySource/com/lowagie/text/html/simpleparser/StyleSheet.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright 2004 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.html.simpleparser;
-
-import java.util.HashMap;
-
-public class StyleSheet {
-
- public HashMap classMap = new HashMap();
- public HashMap tagMap = new HashMap();
-
- /** Creates a new instance of StyleSheet */
- public StyleSheet() {
- }
-
- public void applyStyle(String tag, HashMap props) {
- HashMap map = (HashMap)tagMap.get(tag.toLowerCase());
- if (map != null) {
- HashMap temp = new HashMap(map);
- temp.putAll(props);
- props.putAll(temp);
- }
- String cm = (String)props.get("class");
- if (cm == null)
- return;
- map = (HashMap)classMap.get(cm.toLowerCase());
- if (map == null)
- return;
- props.remove("class");
- HashMap temp = new HashMap(map);
- temp.putAll(props);
- props.putAll(temp);
- }
-
- private void applyMap(HashMap map, HashMap props) {
-
- }
-
- public void loadStyle(String style, HashMap props) {
- classMap.put(style.toLowerCase(), props);
- }
-
- public void loadStyle(String style, String key, String value) {
- style = style.toLowerCase();
- HashMap props = (HashMap)classMap.get(style);
- if (props == null) {
- props = new HashMap();
- classMap.put(style, props);
- }
- props.put(key, value);
- }
-
- public void loadTagStyle(String tag, HashMap props) {
- tagMap.put(tag.toLowerCase(), props);
- }
-
- public void loadTagStyle(String tag, String key, String value) {
- tag = tag.toLowerCase();
- HashMap props = (HashMap)tagMap.get(tag);
- if (props == null) {
- props = new HashMap();
- tagMap.put(tag, props);
- }
- props.put(key, value);
- }
-
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/markup/MarkupParser.java b/LibrarySource/com/lowagie/text/markup/MarkupParser.java
deleted file mode 100644
index e7b7e3d..0000000
--- a/LibrarySource/com/lowagie/text/markup/MarkupParser.java
+++ /dev/null
@@ -1,567 +0,0 @@
-/*
- * $Id: MarkupParser.java,v 1.50 2005/05/03 13:04:18 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.markup;
-
-import headless.awt.Color;
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.util.HashMap;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-import com.lowagie.text.Element;
-import com.lowagie.text.Font;
-import com.lowagie.text.FontFactory;
-import com.lowagie.text.Paragraph;
-import com.lowagie.text.Phrase;
-import com.lowagie.text.Rectangle;
-
-/**
- * This class is a HashMap that contains selectors (String) and styles (a Properties object).
- * Given a tag and its attributes (id/class), this class can return an iText object with the according style.
- *
- * @author blowagie
- */
-public class MarkupParser extends HashMap {
- /**
- * HashMap with styles for each known combination of tag/id/class.
- * The key is a String-combination, the value a Properties object.
- */
- protected HashMap stylecache = new HashMap();
- /**
- * HashMap with fonts for each known combination of tag/id/class.
- * The key is the same String-combination used for the stylecache.
- */
- protected HashMap fontcache = new HashMap();
-
-// processing CSS
-
- /**
- * Creates new MarkupParser
- * @param file the path to a CSS file.
- */
-
- // the toString() addition in the rethrow in this constructor was added 4 May 2005
- // to allow compilation by Code Warrior. Peter E. Midford peteremidford at yahoo.com
- public MarkupParser(String file) {
- super();
- try {
- FileReader reader = new FileReader(file);
- BufferedReader br = new BufferedReader(reader);
- StringBuffer buf = new StringBuffer();
- String line;
- while ((line = br.readLine()) != null) {
- buf.append(line.trim());
- }
- String string = buf.toString();
- string = removeComment(string, "/*", "*/");
- StringTokenizer tokenizer = new StringTokenizer(string, "}");
- String tmp;
- int pos;
- String selector;
- String attributes;
- while (tokenizer.hasMoreTokens()) {
- tmp = tokenizer.nextToken();
- pos = tmp.indexOf("{");
- if (pos > 0) {
- selector = tmp.substring(0, pos).trim();
- attributes = tmp.substring(pos + 1).trim();
- if (attributes.endsWith("}")) attributes = attributes.substring(0, attributes.length() - 1);
- put(selector, parseAttributes(attributes));
- }
- }
- }
- catch(Exception e) {
- throw new RuntimeException(e.toString()); //toString() added to allow compilation
- }
- }
-
- /**
- * Removes the comments sections of a String.
- * @param string the original String
- * @param startComment the String that marks the start of a Comment section
- * @param endComment the String that marks the end of a Comment section.
- * @return the String stripped of its comment section
- */
- public static String removeComment(String string, String startComment,
- String endComment) {
- StringBuffer result = new StringBuffer();
- int pos = 0;
- int end = endComment.length();
- int start = string.indexOf(startComment, pos);
- while (start > -1) {
- result.append(string.substring(pos, start));
- pos = string.indexOf(endComment, start) + end;
- start = string.indexOf(startComment, pos);
- }
- result.append(string.substring(pos));
- return result.toString();
- }
-
- /**
- * This method parses a String with attributes and returns a Properties
- * object.
- *
- * @param string
- * a String of this form: 'key1="value1"; key2="value2";...
- * keyN="valueN" '
- * @return a Properties object
- */
- public static Properties parseAttributes(String string) {
- Properties result = new Properties();
- if (string == null)
- return result;
- StringTokenizer keyValuePairs = new StringTokenizer(string, ";");
- StringTokenizer keyValuePair;
- String key;
- String value;
- while (keyValuePairs.hasMoreTokens()) {
- keyValuePair = new StringTokenizer(keyValuePairs.nextToken(), ":");
- if (keyValuePair.hasMoreTokens())
- key = keyValuePair.nextToken().trim();
- else
- continue;
- if (keyValuePair.hasMoreTokens())
- value = keyValuePair.nextToken().trim();
- else
- continue;
- if (value.startsWith("\""))
- value = value.substring(1);
- if (value.endsWith("\""))
- value = value.substring(0, value.length() - 1);
- result.setProperty(key, value);
- }
- return result;
- }
-
-// reading attributevalues
-
- /**
- * Parses a length.
- *
- * @param string
- * a length in the form of an optional + or -, followed by a
- * number and a unit.
- * @return a float
- */
-
- public static float parseLength(String string) {
- int pos = 0;
- int length = string.length();
- boolean ok = true;
- while (ok && pos < length) {
- switch (string.charAt(pos)) {
- case '+':
- case '-':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case '.':
- pos++;
- break;
- default:
- ok = false;
- }
- }
- if (pos == 0)
- return 0f;
- if (pos == length)
- return Float.valueOf(string + "f").floatValue();
- float f = Float.valueOf(string.substring(0, pos) + "f").floatValue();
- string = string.substring(pos);
- // inches
- if (string.startsWith("in")) {
- return f * 72f;
- }
- // centimeters
- if (string.startsWith("cm")) {
- return (f / 2.54f) * 72f;
- }
- // millimeters
- if (string.startsWith("mm")) {
- return (f / 25.4f) * 72f;
- }
- // picas
- if (string.startsWith("pc")) {
- return f * 12f;
- }
- // default: we assume the length was measured in points
- return f;
- }
-
- /**
- * Converts a <CODE>Color</CODE> into a HTML representation of this <CODE>
- * Color</CODE>.
- *
- * @param color
- * the <CODE>Color</CODE> that has to be converted.
- * @return the HTML representation of this <COLOR>Color </COLOR>
- */
-
- public static Color decodeColor(String color) {
- int red = 0;
- int green = 0;
- int blue = 0;
- try {
- red = Integer.parseInt(color.substring(1, 3), 16);
- green = Integer.parseInt(color.substring(3, 5), 16);
- blue = Integer.parseInt(color.substring(5), 16);
- } catch (Exception sioobe) {
- // empty on purpose
- }
- return new Color(red, green, blue);
- }
-
-// helper methods
-
- /**
- * Generates a key for an tag/id/class combination and adds the style attributes to the stylecache.
- * @param attributes a Properties object with the tagname and the attributes of the tag.
- * @return a key
- */
- private String getKey(Properties attributes) {
- String tag = attributes.getProperty(MarkupTags.ITEXT_TAG);
- String id = attributes.getProperty(MarkupTags.HTML_ATTR_CSS_ID);
- String cl = attributes.getProperty(MarkupTags.HTML_ATTR_CSS_CLASS);
- if (id == null) {
- id = "";
- }
- else {
- id = "#" + id;
- }
- if (cl == null) {
- cl = "";
- }
- else {
- cl = "." + cl;
- }
- String key = tag + id + cl;
- if (!stylecache.containsKey(key) && key.length() > 0) {
- Properties props = new Properties();
- Properties tagprops = (Properties)get(tag);
- Properties idprops = (Properties)get(id);
- Properties clprops = (Properties)get(cl);
- Properties tagidprops = (Properties)get(tag + id);
- Properties tagclprops = (Properties)get(tag + cl);
- if (tagprops != null) props.putAll(tagprops);
- if (idprops != null) props.putAll(idprops);
- if (clprops != null) props.putAll(clprops);
- if (tagidprops != null) props.putAll(tagidprops);
- if (tagclprops != null) props.putAll(tagclprops);
- stylecache.put(key, props);
- }
- return key;
- }
-
-// getting the objects based on the tag and its attributes
-
- /** Returns pagebreak information.
- * @param attributes
- * @return true if a page break is needed before the tag
- */
- public boolean getPageBreakBefore(Properties attributes) {
- String key = getKey(attributes);
- Properties styleattributes = (Properties)stylecache.get(key);
- if (styleattributes != null && MarkupTags.CSS_VALUE_ALWAYS.equals(styleattributes.getProperty(MarkupTags.CSS_KEY_PAGE_BREAK_BEFORE))) {
- return true;
- }
- return false;
- }
-
- /** Returns pagebreak information.
- * @param attributes
- * @return true if a page break is needed after the tag
- */
- public boolean getPageBreakAfter(Properties attributes) {
- String key = getKey(attributes);
- Properties styleattributes = (Properties)stylecache.get(key);
- if (styleattributes != null && MarkupTags.CSS_VALUE_ALWAYS.equals(styleattributes.getProperty(MarkupTags.CSS_KEY_PAGE_BREAK_AFTER))) {
- return true;
- }
- return false;
- }
-
- /**
- * Returns an object based on a tag and its attributes.
- * @param attributes a Properties object with the tagname and the attributes of the tag.
- * @return an iText object
- */
- public Element getObject(Properties attributes) {
- String key = getKey(attributes);
- Properties styleattributes = (Properties)stylecache.get(key);
- if (styleattributes != null && MarkupTags.CSS_VALUE_HIDDEN.equals(styleattributes.get(MarkupTags.CSS_KEY_VISIBILITY))) {
- return null;
- }
- String display = styleattributes.getProperty(MarkupTags.CSS_KEY_DISPLAY);
- Element element = null;
- if (MarkupTags.CSS_VALUE_INLINE.equals(display)) {
- element = retrievePhrase(getFont(attributes), styleattributes);
- }
- else if (MarkupTags.CSS_VALUE_BLOCK.equals(display)) {
- element = retrieveParagraph(getFont(attributes), styleattributes);
- }
- else if (MarkupTags.CSS_VALUE_LISTITEM.equals(display)) {
- element = retrieveListItem(getFont(attributes), styleattributes);
- }
- else if (MarkupTags.CSS_VALUE_TABLECELL.equals(display)) {
- element = retrieveTableCell(getFont(attributes), styleattributes);
- }
- else if (MarkupTags.CSS_VALUE_TABLE.equals(display)) {
- element = retrieveTable(styleattributes);
- }
- return element;
- }
-
- /**
- * Returns a font based on the ID and CLASS attributes of a tag.
- * @param attributes a Properties object with the tagname and the attributes of the tag.
- * @return an iText Font;
- */
- public Font getFont(Properties attributes) {
- String key = getKey(attributes);
- Font f = (Font)fontcache.get(key);
- if (f != null) {
- return f;
- }
- else {
- Properties styleattributes = (Properties)stylecache.get(key);
- f = retrieveFont(styleattributes);
- fontcache.put(key, f);
- }
- return f;
- }
-
- /**
- * Returns a rectangle based on the width and height attributes of a tag,
- * can be overridden by the ID and CLASS attributes.
- * @param attrs the attributes that came with the tag
- * @return an iText Rectangle object
- */
- public Rectangle getRectangle(Properties attrs) {
- String width = null;
- String height = null;
- String key = getKey(attrs);
- Properties styleattributes = (Properties)stylecache.get(key);
- if (styleattributes != null) {
- width = styleattributes.getProperty(MarkupTags.HTML_ATTR_WIDTH);
- height = styleattributes.getProperty(MarkupTags.HTML_ATTR_HEIGHT);
- }
- if (width == null) width = attrs.getProperty(MarkupTags.HTML_ATTR_WIDTH);
- if (height == null) height = attrs.getProperty(MarkupTags.HTML_ATTR_HEIGHT);
- if (width == null || height == null) return null;
- return new Rectangle(parseLength(width), parseLength(height));
- }
-
-// retrieving objects based on the styleAttributes
-
- /**
- * Retrieves a Phrase based on some style attributes.
- * @param font
- * @param styleattributes a Properties object containing keys and values
- * @return an iText Phrase object
- */
- public Element retrievePhrase(Font font, Properties styleattributes) {
- Phrase p = new Phrase("", font);
- if (styleattributes == null) return p;
- String leading = styleattributes.getProperty(MarkupTags.CSS_KEY_LINEHEIGHT);
- if (leading != null) {
- if (leading.endsWith("%")) {
- p.setLeading(p.font().size() * (parseLength(leading) / 100f));
- }
- else {
- p.setLeading(parseLength(leading));
- }
- }
- return p;
- }
-
- /**
- * Retrieves a Paragraph based on some style attributes.
- * @param font
- * @param styleattributes a Properties object containing keys and values
- * @return an iText Paragraph object
- */
- public Element retrieveParagraph(Font font, Properties styleattributes) {
- Paragraph p = new Paragraph((Phrase)retrievePhrase(font, styleattributes));
- if (styleattributes == null) return p;
- String margin = styleattributes.getProperty(MarkupTags.CSS_KEY_MARGIN);
- float f;
- if (margin != null) {
- f = parseLength(margin);
- p.setIndentationLeft(f);
- p.setIndentationRight(f);
- p.setSpacingBefore(f);
- p.setSpacingAfter(f);
- }
- margin = styleattributes.getProperty(MarkupTags.CSS_KEY_MARGINLEFT);
- if (margin != null) {
- f = parseLength(margin);
- p.setIndentationLeft(f);
- }
- margin = styleattributes.getProperty(MarkupTags.CSS_KEY_MARGINRIGHT);
- if (margin != null) {
- f = parseLength(margin);
- p.setIndentationRight(f);
- }
- margin = styleattributes.getProperty(MarkupTags.CSS_KEY_MARGINTOP);
- if (margin != null) {
- f = parseLength(margin);
- p.setSpacingBefore(f);
- }
- margin = styleattributes.getProperty(MarkupTags.CSS_KEY_MARGINBOTTOM);
- if (margin != null) {
- f = parseLength(margin);
- p.setSpacingAfter(f);
- }
- String align = styleattributes.getProperty(MarkupTags.CSS_KEY_TEXTALIGN);
- if (MarkupTags.CSS_VALUE_TEXTALIGNLEFT.equals(align)) {
- p.setAlignment(Element.ALIGN_LEFT);
- }
- else if (MarkupTags.CSS_VALUE_TEXTALIGNRIGHT.equals(align)) {
- p.setAlignment(Element.ALIGN_RIGHT);
- }
- else if (MarkupTags.CSS_VALUE_TEXTALIGNCENTER.equals(align)) {
- p.setAlignment(Element.ALIGN_CENTER);
- }
- else if (MarkupTags.CSS_VALUE_TEXTALIGNJUSTIFY.equals(align)) {
- p.setAlignment(Element.ALIGN_JUSTIFIED);
- }
- return p;
- }
-
- /**
- * Gets a table based on the styleattributes.
- * @param styleattributes
- * @return an iText Table
- */
- private Element retrieveTable(Properties styleattributes) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * Returns a Cell based on the styleattributes.
- * @param font
- * @param styleattributes
- * @return an iText Cell
- */
- private Element retrieveTableCell(Font font, Properties styleattributes) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * Returns a ListItem based on the styleattributes.
- * @param font
- * @param styleattributes
- * @return an iText ListItem
- */
- private Element retrieveListItem(Font font, Properties styleattributes) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * Retrieves a font from the FontFactory based on some style attributes.
- * Looks for the font-family, font-size, font-weight, font-style and color.
- * Takes the default encoding and embedded value.
- * @param styleAttributes a Properties object containing keys and values
- * @return an iText Font object
- */
-
- public Font retrieveFont(Properties styleAttributes) {
- String fontname = null;
- String encoding = FontFactory.defaultEncoding;
- boolean embedded = FontFactory.defaultEmbedding;
- float size = Font.UNDEFINED;
- int style = Font.NORMAL;
- Color color = null;
- String value = (String)styleAttributes.get(MarkupTags.CSS_KEY_FONTFAMILY);
- if (value != null) {
- if (value.indexOf(",") == -1) {
- fontname = value.trim();
- }
- else {
- String tmp;
- while (value.indexOf(",") != -1) {
- tmp = value.substring(0, value.indexOf(",")).trim();
- if (FontFactory.isRegistered(tmp)) {
- fontname = tmp;
- break;
- }
- else {
- value = value.substring(value.indexOf(",") + 1);
- }
- }
- }
- }
- if ((value = (String)styleAttributes.get(MarkupTags.CSS_KEY_FONTSIZE)) != null) {
- size = MarkupParser.parseLength(value);
- }
- if ((value = (String)styleAttributes.get(MarkupTags.CSS_KEY_FONTWEIGHT)) != null) {
- style |= Font.getStyleValue(value);
- }
- if ((value = (String)styleAttributes.get(MarkupTags.CSS_KEY_FONTSTYLE)) != null) {
- style |= Font.getStyleValue(value);
- }
- if ((value = (String)styleAttributes.get(MarkupTags.CSS_KEY_COLOR)) != null) {
- color = MarkupParser.decodeColor(value);
- }
- return FontFactory.getFont(fontname, encoding, embedded, size, style, color);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/markup/MarkupTags.java b/LibrarySource/com/lowagie/text/markup/MarkupTags.java
deleted file mode 100644
index fd1b193..0000000
--- a/LibrarySource/com/lowagie/text/markup/MarkupTags.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * $Id: MarkupTags.java,v 1.50 2005/05/03 14:44:38 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.markup;
-
-/**
- * A class that contains all the possible tagnames and their attributes.
- */
-
-public class MarkupTags {
-
- // iText specific
-
- /** the key for any tag */
- public static final String ITEXT_TAG = "tag";
-
- // HTML tags
-
- /** the markup for the body part of a file */
- public static final String HTML_TAG_BODY = "body";
-
- /** The DIV tag. */
- public static final String HTML_TAG_DIV = "div";
-
- /** This is a possible HTML-tag. */
- public static final String HTML_TAG_LINK = "link";
-
- /** The SPAN tag. */
- public static final String HTML_TAG_SPAN = "span";
-
- // HTML attributes
-
- /** the height attribute. */
- public static final String HTML_ATTR_HEIGHT = "height";
-
- /** the hyperlink reference attribute. */
- public static final String HTML_ATTR_HREF = "href";
-
- /** This is a possible HTML attribute for the LINK tag. */
- public static final String HTML_ATTR_REL = "rel";
-
- /** This is used for inline css style information */
- public static final String HTML_ATTR_STYLE = "style";
-
- /** This is a possible HTML attribute for the LINK tag. */
- public static final String HTML_ATTR_TYPE = "type";
-
- /** This is a possible HTML attribute. */
- public static final String HTML_ATTR_STYLESHEET = "stylesheet";
-
- /** the width attribute. */
- public static final String HTML_ATTR_WIDTH = "width";
-
- /** attribute for specifying externally defined CSS class */
- public static final String HTML_ATTR_CSS_CLASS = "class";
-
- /** The ID attribute. */
- public static final String HTML_ATTR_CSS_ID = "id";
-
- // HTML values
-
- /** This is a possible value for the language attribute (SCRIPT tag). */
- public static final String HTML_VALUE_JAVASCRIPT = "text/javascript";
-
- /** This is a possible HTML attribute for the LINK tag. */
- public static final String HTML_VALUE_CSS = "text/css";
-
- // CSS keys
-
- /** the CSS tag for background color */
- public static final String CSS_KEY_BGCOLOR = "background-color";
-
- /** the CSS tag for text color */
- public static final String CSS_KEY_COLOR = "color";
-
- /** CSS key that indicate the way something has to be displayed */
- public static final String CSS_KEY_DISPLAY = "display";
-
- /** the CSS tag for the font family */
- public static final String CSS_KEY_FONTFAMILY = "font-family";
-
- /** the CSS tag for the font size */
- public static final String CSS_KEY_FONTSIZE = "font-size";
-
- /** the CSS tag for the font style */
- public static final String CSS_KEY_FONTSTYLE = "font-style";
-
- /** the CSS tag for the font weight */
- public static final String CSS_KEY_FONTWEIGHT = "font-weight";
-
- /** the CSS tag for text decorations */
- public static final String CSS_KEY_LINEHEIGHT = "line-height";
-
- /** the CSS tag for the margin of an object */
- public static final String CSS_KEY_MARGIN = "margin";
-
- /** the CSS tag for the margin of an object */
- public static final String CSS_KEY_MARGINLEFT = "margin-left";
-
- /** the CSS tag for the margin of an object */
- public static final String CSS_KEY_MARGINRIGHT = "margin-right";
-
- /** the CSS tag for the margin of an object */
- public static final String CSS_KEY_MARGINTOP = "margin-top";
-
- /** the CSS tag for the margin of an object */
- public static final String CSS_KEY_MARGINBOTTOM = "margin-bottom";
-
- /** the CSS tag for adding a page break when the document is printed */
- public static final String CSS_KEY_PAGE_BREAK_AFTER = "page-break-after";
-
- /** the CSS tag for adding a page break when the document is printed */
- public static final String CSS_KEY_PAGE_BREAK_BEFORE = "page-break-before";
-
- /** the CSS tag for the horizontal alignment of an object */
- public static final String CSS_KEY_TEXTALIGN = "text-align";
-
- /** the CSS tag for text decorations */
- public static final String CSS_KEY_TEXTDECORATION = "text-decoration";
-
- /** the CSS tag for text decorations */
- public static final String CSS_KEY_VERTICALALIGN = "vertical-align";
-
- /** the CSS tag for the visibility of objects */
- public static final String CSS_KEY_VISIBILITY = "visibility";
-
- // CSS values
-
- /** value for the CSS tag for adding a page break when the document is printed */
- public static final String CSS_VALUE_ALWAYS = "always";
-
- /** A possible value for the DISPLAY key */
- public static final String CSS_VALUE_BLOCK = "block";
-
- /** a CSS value for text font weight */
- public static final String CSS_VALUE_BOLD = "bold";
-
- /** the value if you want to hide objects. */
- public static final String CSS_VALUE_HIDDEN = "hidden";
-
- /** A possible value for the DISPLAY key */
- public static final String CSS_VALUE_INLINE = "inline";
-
- /** a CSS value for text font style */
- public static final String CSS_VALUE_ITALIC = "italic";
-
- /** a CSS value for text decoration */
- public static final String CSS_VALUE_LINETHROUGH = "line-through";
-
- /** A possible value for the DISPLAY key */
- public static final String CSS_VALUE_LISTITEM = "list-item";
-
- /** a CSS value */
- public static final String CSS_VALUE_NONE = "none";
-
- /** a CSS value */
- public static final String CSS_VALUE_NORMAL = "normal";
-
- /** a CSS value for text font style */
- public static final String CSS_VALUE_OBLIQUE = "oblique";
-
- /** A possible value for the DISPLAY key */
- public static final String CSS_VALUE_TABLE = "table";
-
- /** A possible value for the DISPLAY key */
- public static final String CSS_VALUE_TABLEROW = "table-row";
-
- /** A possible value for the DISPLAY key */
- public static final String CSS_VALUE_TABLECELL = "table-cell";
-
- /** the CSS value for a horizontal alignment of an object */
- public static final String CSS_VALUE_TEXTALIGNLEFT = "left";
-
- /** the CSS value for a horizontal alignment of an object */
- public static final String CSS_VALUE_TEXTALIGNRIGHT = "right";
-
- /** the CSS value for a horizontal alignment of an object */
- public static final String CSS_VALUE_TEXTALIGNCENTER = "center";
-
- /** the CSS value for a horizontal alignment of an object */
- public static final String CSS_VALUE_TEXTALIGNJUSTIFY = "justify";
-
- /** a CSS value for text decoration */
- public static final String CSS_VALUE_UNDERLINE = "underline";
-
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/ArabicLigaturizer.java b/LibrarySource/com/lowagie/text/pdf/ArabicLigaturizer.java
deleted file mode 100644
index acf451b..0000000
--- a/LibrarySource/com/lowagie/text/pdf/ArabicLigaturizer.java
+++ /dev/null
@@ -1,772 +0,0 @@
-/*
- * Copyright 2003 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-/** Shape arabic characters. This code was converted from a C version
- * at www.pango.org.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class ArabicLigaturizer {
-
- static boolean isVowel(char s) {
- return ((s >= 0x064B) && (s <= 0x0655)) || (s == 0x0670);
- }
-
- static char charshape(char s, int which)
- /* which 0=isolated 1=final 2=initial 3=medial */
- {
- int l, r, m;
- if ((s >= 0x0621) && (s <= 0x06D3)) {
- l = 0;
- r = chartable.length - 1;
- while (l <= r) {
- m = (l + r) / 2;
- if (s == chartable[m][0]) {
- return chartable[m][which + 1];
- }
- else if (s < chartable[m][0]) {
- r = m - 1;
- }
- else {
- l = m + 1;
- }
- }
- }
- else if (s >= 0xfef5 && s <= 0xfefb)
- return (char)(s + which);
- return s;
- }
-
- static int shapecount(char s) {
- int l, r, m;
- if ((s >= 0x0621) && (s <= 0x06D3) && !isVowel(s)) {
- l = 0;
- r = chartable.length - 1;
- while (l <= r) {
- m = (l + r) / 2;
- if (s == chartable[m][0]) {
- return chartable[m].length - 1;
- }
- else if (s < chartable[m][0]) {
- r = m - 1;
- }
- else {
- l = m + 1;
- }
- }
- }
- else if (s == ZWJ) {
- return 4;
- }
- return 1;
- }
-
- static int ligature(char newchar, charstruct oldchar) {
- /* 0 == no ligature possible; 1 == vowel; 2 == two chars; 3 == Lam+Alef */
- int retval = 0;
-
- if (oldchar.basechar == 0)
- return 0;
- if (isVowel(newchar)) {
- retval = 1;
- if ((oldchar.vowel != 0) && (newchar != SHADDA)) {
- retval = 2; /* we eliminate the old vowel .. */
- }
- switch (newchar) {
- case SHADDA:
- if (oldchar.mark1 == 0) {
- oldchar.mark1 = SHADDA;
- }
- else {
- return 0; /* no ligature possible */
- }
- break;
- case HAMZABELOW:
- switch (oldchar.basechar) {
- case ALEF:
- oldchar.basechar = ALEFHAMZABELOW;
- retval = 2;
- break;
- case LAM_ALEF:
- oldchar.basechar = LAM_ALEFHAMZABELOW;
- retval = 2;
- break;
- default:
- oldchar.mark1 = HAMZABELOW;
- break;
- }
- break;
- case HAMZAABOVE:
- switch (oldchar.basechar) {
- case ALEF:
- oldchar.basechar = ALEFHAMZA;
- retval = 2;
- break;
- case LAM_ALEF:
- oldchar.basechar = LAM_ALEFHAMZA;
- retval = 2;
- break;
- case WAW:
- oldchar.basechar = WAWHAMZA;
- retval = 2;
- break;
- case YEH:
- case ALEFMAKSURA:
- case FARSIYEH:
- oldchar.basechar = YEHHAMZA;
- retval = 2;
- break;
- default: /* whatever sense this may make .. */
- oldchar.mark1 = HAMZAABOVE;
- break;
- }
- break;
- case MADDA:
- switch (oldchar.basechar) {
- case ALEF:
- oldchar.basechar = ALEFMADDA;
- retval = 2;
- break;
- }
- break;
- default:
- oldchar.vowel = newchar;
- break;
- }
- if (retval == 1) {
- oldchar.lignum++;
- }
- return retval;
- }
- if (oldchar.vowel != 0) { /* if we already joined a vowel, we can't join a Hamza */
- return 0;
- }
-
- switch (oldchar.basechar) {
- case LAM:
- switch (newchar) {
- case ALEF:
- oldchar.basechar = LAM_ALEF;
- oldchar.numshapes = 2;
- retval = 3;
- break;
- case ALEFHAMZA:
- oldchar.basechar = LAM_ALEFHAMZA;
- oldchar.numshapes = 2;
- retval = 3;
- break;
- case ALEFHAMZABELOW:
- oldchar.basechar = LAM_ALEFHAMZABELOW;
- oldchar.numshapes = 2;
- retval = 3;
- break;
- case ALEFMADDA:
- oldchar.basechar = LAM_ALEFMADDA;
- oldchar.numshapes = 2;
- retval = 3;
- break;
- }
- break;
- case 0:
- oldchar.basechar = newchar;
- oldchar.numshapes = shapecount(newchar);
- retval = 1;
- break;
- }
- return retval;
- }
-
- static void copycstostring(StringBuffer string, charstruct s, int level) {
- /* s is a shaped charstruct; i is the index into the string */
- if (s.basechar == 0)
- return;
-
- string.append(s.basechar);
- s.lignum--;
- if (s.mark1 != 0) {
- if ((level & ar_novowel) == 0) {
- string.append(s.mark1);
- s.lignum--;
- }
- else {
- s.lignum--;
- }
- }
- if (s.vowel != 0) {
- if ((level & ar_novowel) == 0) {
- string.append(s.vowel);
- s.lignum--;
- }
- else { /* vowel elimination */
- s.lignum--;
- }
- }
-// while (s.lignum > 0) { /* NULL-insertion for Langbox-font */
-// string[i] = 0;
-// i++;
-// (s.lignum)--;
-// }
-// return i;
- }
-
- // return len
- static void doublelig(StringBuffer string, int level)
- /* Ok. We have presentation ligatures in our font. */
- {
- int len;
- int olen = len = string.length();
- int j = 0, si = 1;
- char lapresult;
-
- while (si < olen) {
- lapresult = 0;
- if ((level & ar_composedtashkeel) != 0) {
- switch (string.charAt(j)) {
- case SHADDA:
- switch (string.charAt(si)) {
- case KASRA:
- lapresult = 0xFC62;
- break;
- case FATHA:
- lapresult = 0xFC60;
- break;
- case DAMMA:
- lapresult = 0xFC61;
- break;
- case 0x064C:
- lapresult = 0xFC5E;
- break;
- case 0x064D:
- lapresult = 0xFC5F;
- break;
- }
- break;
- case KASRA:
- if (string.charAt(si) == SHADDA)
- lapresult = 0xFC62;
- break;
- case FATHA:
- if (string.charAt(si) == SHADDA)
- lapresult = 0xFC60;
- break;
- case DAMMA:
- if (string.charAt(si) == SHADDA)
- lapresult = 0xFC61;
- break;
- }
- }
-
- if ((level & ar_lig) != 0) {
- switch (string.charAt(j)) {
- case 0xFEDF: /* LAM initial */
- switch (string.charAt(si)) {
- case 0xFE9E:
- lapresult = 0xFC3F;
- break; /* JEEM final */
- case 0xFEA0:
- lapresult = 0xFCC9;
- break; /* JEEM medial */
- case 0xFEA2:
- lapresult = 0xFC40;
- break; /* HAH final */
- case 0xFEA4:
- lapresult = 0xFCCA;
- break; /* HAH medial */
- case 0xFEA6:
- lapresult = 0xFC41;
- break; /* KHAH final */
- case 0xFEA8:
- lapresult = 0xFCCB;
- break; /* KHAH medial */
- case 0xFEE2:
- lapresult = 0xFC42;
- break; /* MEEM final */
- case 0xFEE4:
- lapresult = 0xFCCC;
- break; /* MEEM medial */
- }
- break;
- case 0xFE97: /* TEH inital */
- switch (string.charAt(si)) {
- case 0xFEA0:
- lapresult = 0xFCA1;
- break; /* JEEM medial */
- case 0xFEA4:
- lapresult = 0xFCA2;
- break; /* HAH medial */
- case 0xFEA8:
- lapresult = 0xFCA3;
- break; /* KHAH medial */
- }
- break;
- case 0xFE91: /* BEH inital */
- switch (string.charAt(si)) {
- case 0xFEA0:
- lapresult = 0xFC9C;
- break; /* JEEM medial */
- case 0xFEA4:
- lapresult = 0xFC9D;
- break; /* HAH medial */
- case 0xFEA8:
- lapresult = 0xFC9E;
- break; /* KHAH medial */
- }
- break;
- case 0xFEE7: /* NOON inital */
- switch (string.charAt(si)) {
- case 0xFEA0:
- lapresult = 0xFCD2;
- break; /* JEEM initial */
- case 0xFEA4:
- lapresult = 0xFCD3;
- break; /* HAH medial */
- case 0xFEA8:
- lapresult = 0xFCD4;
- break; /* KHAH medial */
- }
- break;
-
- case 0xFEE8: /* NOON medial */
- switch (string.charAt(si)) {
- case 0xFEAE:
- lapresult = 0xFC8A;
- break; /* REH final */
- case 0xFEB0:
- lapresult = 0xFC8B;
- break; /* ZAIN final */
- }
- break;
- case 0xFEE3: /* MEEM initial */
- switch (string.charAt(si)) {
- case 0xFEA0:
- lapresult = 0xFCCE;
- break; /* JEEM medial */
- case 0xFEA4:
- lapresult = 0xFCCF;
- break; /* HAH medial */
- case 0xFEA8:
- lapresult = 0xFCD0;
- break; /* KHAH medial */
- case 0xFEE4:
- lapresult = 0xFCD1;
- break; /* MEEM medial */
- }
- break;
-
- case 0xFED3: /* FEH initial */
- switch (string.charAt(si)) {
- case 0xFEF2:
- lapresult = 0xFC32;
- break; /* YEH final */
- }
- break;
-
- default:
- break;
- } /* end switch string[si] */
- }
- if (lapresult != 0) {
- string.setCharAt(j, lapresult);
- len--;
- si++; /* jump over one character */
- /* we'll have to change this, too. */
- }
- else {
- j++;
- string.setCharAt(j, string.charAt(si));
- si++;
- }
- }
- string.setLength(len);
- }
-
- static boolean connects_to_left(charstruct a) {
- return a.numshapes > 2;
- }
-
- static void shape(char text[], StringBuffer string, int level) {
- /* string is assumed to be empty and big enough.
- * text is the original text.
- * This routine does the basic arabic reshaping.
- * *len the number of non-null characters.
- *
- * Note: We have to unshape each character first!
- */
- int j = 0;
- int join;
- int which;
- char nextletter;
-
- int p = 0; /* initialize for output */
- charstruct oldchar = new charstruct();
- charstruct curchar = new charstruct();
- while (p < text.length) {
- nextletter = text[p++];
- //nextletter = unshape (nextletter);
-
- join = ligature(nextletter, curchar);
- if (join == 0) { /* shape curchar */
- int nc = shapecount(nextletter);
- //(*len)++;
- if (nc == 1) {
- which = 0; /* final or isolated */
- }
- else {
- which = 2; /* medial or initial */
- }
- if (connects_to_left(oldchar)) {
- which++;
- }
-
- which = which % (curchar.numshapes);
- curchar.basechar = charshape(curchar.basechar, which);
-
- /* get rid of oldchar */
- copycstostring(string, oldchar, level);
- oldchar = curchar; /* new values in oldchar */
-
- /* init new curchar */
- curchar = new charstruct();
- curchar.basechar = nextletter;
- curchar.numshapes = nc;
- curchar.lignum++;
- // (*len) += unligature (&curchar, level);
- }
- else if (join == 1) {
- }
- // else
- // {
- // (*len) += unligature (&curchar, level);
- // }
- // p = g_utf8_next_char (p);
- }
-
- /* Handle last char */
- if (connects_to_left(oldchar))
- which = 1;
- else
- which = 0;
- which = which % (curchar.numshapes);
- curchar.basechar = charshape(curchar.basechar, which);
-
- /* get rid of oldchar */
- copycstostring(string, oldchar, level);
- copycstostring(string, curchar, level);
- }
-
- static int arabic_shape(char src[], int srcoffset, int srclength, char dest[], int destoffset, int destlength, int level) {
- char str[] = new char[srclength];
- for (int k = srclength + srcoffset - 1; k >= srcoffset; --k)
- str[k - srcoffset] = src[k];
- StringBuffer string = new StringBuffer(srclength);
- shape(str, string, level);
- if ((level & (ar_composedtashkeel | ar_lig)) != 0)
- doublelig(string, level);
-// string.reverse();
- System.arraycopy(string.toString().toCharArray(), 0, dest, destoffset, string.length());
- return string.length();
- }
-
- static void processNumbers(char text[], int offset, int length, int options) {
- int limit = offset + length;
- if ((options & DIGITS_MASK) != 0) {
- char digitBase = '\u0030'; // European digits
- switch (options & DIGIT_TYPE_MASK) {
- case DIGIT_TYPE_AN:
- digitBase = '\u0660'; // Arabic-Indic digits
- break;
-
- case DIGIT_TYPE_AN_EXTENDED:
- digitBase = '\u06f0'; // Eastern Arabic-Indic digits (Persian and Urdu)
- break;
-
- default:
- break;
- }
-
- switch (options & DIGITS_MASK) {
- case DIGITS_EN2AN: {
- int digitDelta = digitBase - '\u0030';
- for (int i = offset; i < limit; ++i) {
- char ch = text[i];
- if (ch <= '\u0039' && ch >= '\u0030') {
- text[i] += digitDelta;
- }
- }
- }
- break;
-
- case DIGITS_AN2EN: {
- char digitTop = (char)(digitBase + 9);
- int digitDelta = '\u0030' - digitBase;
- for (int i = offset; i < limit; ++i) {
- char ch = text[i];
- if (ch <= digitTop && ch >= digitBase) {
- text[i] += digitDelta;
- }
- }
- }
- break;
-
- case DIGITS_EN2AN_INIT_LR:
- shapeToArabicDigitsWithContext(text, 0, length, digitBase, false);
- break;
-
- case DIGITS_EN2AN_INIT_AL:
- shapeToArabicDigitsWithContext(text, 0, length, digitBase, true);
- break;
-
- default:
- break;
- }
- }
- }
-
- static void shapeToArabicDigitsWithContext(char[] dest, int start, int length, char digitBase, boolean lastStrongWasAL) {
- digitBase -= '0'; // move common adjustment out of loop
-
- int limit = start + length;
- for(int i = start; i < limit; ++i) {
- char ch = dest[i];
- switch (BidiOrder.getDirection(ch)) {
- case BidiOrder.L:
- case BidiOrder.R:
- lastStrongWasAL = false;
- break;
- case BidiOrder.AL:
- lastStrongWasAL = true;
- break;
- case BidiOrder.EN:
- if (lastStrongWasAL && ch <= '\u0039') {
- dest[i] = (char)(ch + digitBase);
- }
- break;
- default:
- break;
- }
- }
- }
-
- private static final char ALEF = 0x0627;
- private static final char ALEFHAMZA = 0x0623;
- private static final char ALEFHAMZABELOW = 0x0625;
- private static final char ALEFMADDA = 0x0622;
- private static final char LAM = 0x0644;
- private static final char HAMZA = 0x0621;
- private static final char TATWEEL = 0x0640;
- private static final char ZWJ = 0x200D;
-
- private static final char HAMZAABOVE = 0x0654;
- private static final char HAMZABELOW = 0x0655;
-
- private static final char WAWHAMZA = 0x0624;
- private static final char YEHHAMZA = 0x0626;
- private static final char WAW = 0x0648;
- private static final char ALEFMAKSURA = 0x0649;
- private static final char YEH = 0x064A;
- private static final char FARSIYEH = 0x06CC;
-
- private static final char SHADDA = 0x0651;
- private static final char KASRA = 0x0650;
- private static final char FATHA = 0x064E;
- private static final char DAMMA = 0x064F;
- private static final char MADDA = 0x0653;
-
- private static final char LAM_ALEF = 0xFEFB;
- private static final char LAM_ALEFHAMZA = 0xFEF7;
- private static final char LAM_ALEFHAMZABELOW = 0xFEF9;
- private static final char LAM_ALEFMADDA = 0xFEF5;
-
- private static final char chartable[][] = {
- {0x0621, 0xFE80}, /* HAMZA */
- {0x0622, 0xFE81, 0xFE82}, /* ALEF WITH MADDA ABOVE */
- {0x0623, 0xFE83, 0xFE84}, /* ALEF WITH HAMZA ABOVE */
- {0x0624, 0xFE85, 0xFE86}, /* WAW WITH HAMZA ABOVE */
- {0x0625, 0xFE87, 0xFE88}, /* ALEF WITH HAMZA BELOW */
- {0x0626, 0xFE89, 0xFE8A, 0xFE8B, 0xFE8C}, /* YEH WITH HAMZA ABOVE */
- {0x0627, 0xFE8D, 0xFE8E}, /* ALEF */
- {0x0628, 0xFE8F, 0xFE90, 0xFE91, 0xFE92}, /* BEH */
- {0x0629, 0xFE93, 0xFE94}, /* TEH MARBUTA */
- {0x062A, 0xFE95, 0xFE96, 0xFE97, 0xFE98}, /* TEH */
- {0x062B, 0xFE99, 0xFE9A, 0xFE9B, 0xFE9C}, /* THEH */
- {0x062C, 0xFE9D, 0xFE9E, 0xFE9F, 0xFEA0}, /* JEEM */
- {0x062D, 0xFEA1, 0xFEA2, 0xFEA3, 0xFEA4}, /* HAH */
- {0x062E, 0xFEA5, 0xFEA6, 0xFEA7, 0xFEA8}, /* KHAH */
- {0x062F, 0xFEA9, 0xFEAA}, /* DAL */
- {0x0630, 0xFEAB, 0xFEAC}, /* THAL */
- {0x0631, 0xFEAD, 0xFEAE}, /* REH */
- {0x0632, 0xFEAF, 0xFEB0}, /* ZAIN */
- {0x0633, 0xFEB1, 0xFEB2, 0xFEB3, 0xFEB4}, /* SEEN */
- {0x0634, 0xFEB5, 0xFEB6, 0xFEB7, 0xFEB8}, /* SHEEN */
- {0x0635, 0xFEB9, 0xFEBA, 0xFEBB, 0xFEBC}, /* SAD */
- {0x0636, 0xFEBD, 0xFEBE, 0xFEBF, 0xFEC0}, /* DAD */
- {0x0637, 0xFEC1, 0xFEC2, 0xFEC3, 0xFEC4}, /* TAH */
- {0x0638, 0xFEC5, 0xFEC6, 0xFEC7, 0xFEC8}, /* ZAH */
- {0x0639, 0xFEC9, 0xFECA, 0xFECB, 0xFECC}, /* AIN */
- {0x063A, 0xFECD, 0xFECE, 0xFECF, 0xFED0}, /* GHAIN */
- {0x0640, 0x0640, 0x0640, 0x0640, 0x0640}, /* TATWEEL */
- {0x0641, 0xFED1, 0xFED2, 0xFED3, 0xFED4}, /* FEH */
- {0x0642, 0xFED5, 0xFED6, 0xFED7, 0xFED8}, /* QAF */
- {0x0643, 0xFED9, 0xFEDA, 0xFEDB, 0xFEDC}, /* KAF */
- {0x0644, 0xFEDD, 0xFEDE, 0xFEDF, 0xFEE0}, /* LAM */
- {0x0645, 0xFEE1, 0xFEE2, 0xFEE3, 0xFEE4}, /* MEEM */
- {0x0646, 0xFEE5, 0xFEE6, 0xFEE7, 0xFEE8}, /* NOON */
- {0x0647, 0xFEE9, 0xFEEA, 0xFEEB, 0xFEEC}, /* HEH */
- {0x0648, 0xFEED, 0xFEEE}, /* WAW */
- {0x0649, 0xFEEF, 0xFEF0, 0xFBE8, 0xFBE9}, /* ALEF MAKSURA */
- {0x064A, 0xFEF1, 0xFEF2, 0xFEF3, 0xFEF4}, /* YEH */
- {0x0671, 0xFB50, 0xFB51}, /* ALEF WASLA */
- {0x0679, 0xFB66, 0xFB67, 0xFB68, 0xFB69}, /* TTEH */
- {0x067A, 0xFB5E, 0xFB5F, 0xFB60, 0xFB61}, /* TTEHEH */
- {0x067B, 0xFB52, 0xFB53, 0xFB54, 0xFB55}, /* BEEH */
- {0x067E, 0xFB56, 0xFB57, 0xFB58, 0xFB59}, /* PEH */
- {0x067F, 0xFB62, 0xFB63, 0xFB64, 0xFB65}, /* TEHEH */
- {0x0680, 0xFB5A, 0xFB5B, 0xFB5C, 0xFB5D}, /* BEHEH */
- {0x0683, 0xFB76, 0xFB77, 0xFB78, 0xFB79}, /* NYEH */
- {0x0684, 0xFB72, 0xFB73, 0xFB74, 0xFB75}, /* DYEH */
- {0x0686, 0xFB7A, 0xFB7B, 0xFB7C, 0xFB7D}, /* TCHEH */
- {0x0687, 0xFB7E, 0xFB7F, 0xFB80, 0xFB81}, /* TCHEHEH */
- {0x0688, 0xFB88, 0xFB89}, /* DDAL */
- {0x068C, 0xFB84, 0xFB85}, /* DAHAL */
- {0x068D, 0xFB82, 0xFB83}, /* DDAHAL */
- {0x068E, 0xFB86, 0xFB87}, /* DUL */
- {0x0691, 0xFB8C, 0xFB8D}, /* RREH */
- {0x0698, 0xFB8A, 0xFB8B}, /* JEH */
- {0x06A4, 0xFB6A, 0xFB6B, 0xFB6C, 0xFB6D}, /* VEH */
- {0x06A6, 0xFB6E, 0xFB6F, 0xFB70, 0xFB71}, /* PEHEH */
- {0x06A9, 0xFB8E, 0xFB8F, 0xFB90, 0xFB91}, /* KEHEH */
- {0x06AD, 0xFBD3, 0xFBD4, 0xFBD5, 0xFBD6}, /* NG */
- {0x06AF, 0xFB92, 0xFB93, 0xFB94, 0xFB95}, /* GAF */
- {0x06B1, 0xFB9A, 0xFB9B, 0xFB9C, 0xFB9D}, /* NGOEH */
- {0x06B3, 0xFB96, 0xFB97, 0xFB98, 0xFB99}, /* GUEH */
- {0x06BA, 0xFB9E, 0xFB9F}, /* NOON GHUNNA */
- {0x06BB, 0xFBA0, 0xFBA1, 0xFBA2, 0xFBA3}, /* RNOON */
- {0x06BE, 0xFBAA, 0xFBAB, 0xFBAC, 0xFBAD}, /* HEH DOACHASHMEE */
- {0x06C0, 0xFBA4, 0xFBA5}, /* HEH WITH YEH ABOVE */
- {0x06C1, 0xFBA6, 0xFBA7, 0xFBA8, 0xFBA9}, /* HEH GOAL */
- {0x06C5, 0xFBE0, 0xFBE1}, /* KIRGHIZ OE */
- {0x06C6, 0xFBD9, 0xFBDA}, /* OE */
- {0x06C7, 0xFBD7, 0xFBD8}, /* U */
- {0x06C8, 0xFBDB, 0xFBDC}, /* YU */
- {0x06C9, 0xFBE2, 0xFBE3}, /* KIRGHIZ YU */
- {0x06CB, 0xFBDE, 0xFBDF}, /* VE */
- {0x06CC, 0xFBFC, 0xFBFD, 0xFBFE, 0xFBFF}, /* FARSI YEH */
- {0x06D0, 0xFBE4, 0xFBE5, 0xFBE6, 0xFBE7}, /* E */
- {0x06D2, 0xFBAE, 0xFBAF}, /* YEH BARREE */
- {0x06D3, 0xFBB0, 0xFBB1} /* YEH BARREE WITH HAMZA ABOVE */
- };
-
- public static final int ar_nothing = 0x0;
- public static final int ar_novowel = 0x1;
- public static final int ar_composedtashkeel = 0x4;
- public static final int ar_lig = 0x8;
- /**
- * Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits.
- */
- public static final int DIGITS_EN2AN = 0x20;
-
- /**
- * Digit shaping option: Replace Arabic-Indic digits by European digits (U+0030...U+0039).
- */
- public static final int DIGITS_AN2EN = 0x40;
-
- /**
- * Digit shaping option:
- * Replace European digits (U+0030...U+0039) by Arabic-Indic digits
- * if the most recent strongly directional character
- * is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC).
- * The initial state at the start of the text is assumed to be not an Arabic,
- * letter, so European digits at the start of the text will not change.
- * Compare to DIGITS_ALEN2AN_INIT_AL.
- */
- public static final int DIGITS_EN2AN_INIT_LR = 0x60;
-
- /**
- * Digit shaping option:
- * Replace European digits (U+0030...U+0039) by Arabic-Indic digits
- * if the most recent strongly directional character
- * is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC).
- * The initial state at the start of the text is assumed to be an Arabic,
- * letter, so European digits at the start of the text will change.
- * Compare to DIGITS_ALEN2AN_INT_LR.
- */
- public static final int DIGITS_EN2AN_INIT_AL = 0x80;
-
- /** Not a valid option value. */
- private static final int DIGITS_RESERVED = 0xa0;
-
- /**
- * Bit mask for digit shaping options.
- */
- public static final int DIGITS_MASK = 0xe0;
-
- /**
- * Digit type option: Use Arabic-Indic digits (U+0660...U+0669).
- */
- public static final int DIGIT_TYPE_AN = 0;
-
- /**
- * Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9).
- */
- public static final int DIGIT_TYPE_AN_EXTENDED = 0x100;
-
- /**
- * Bit mask for digit type options.
- */
- public static final int DIGIT_TYPE_MASK = 0x0100; // 0x3f00?
-
- static class charstruct {
- char basechar;
- char mark1; /* has to be initialized to zero */
- char vowel;
- int lignum; /* is a ligature with lignum aditional characters */
- int numshapes = 1;
- };
-
-
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/AsianFontMapper.java b/LibrarySource/com/lowagie/text/pdf/AsianFontMapper.java
deleted file mode 100644
index b86c6de..0000000
--- a/LibrarySource/com/lowagie/text/pdf/AsianFontMapper.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2004 by Takenori.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import headless.awt.Font;
-
-import com.lowagie.text.pdf.BaseFont;
-import com.lowagie.text.pdf.DefaultFontMapper;
-
-public class AsianFontMapper extends DefaultFontMapper {
-
- public static String ChineseSimplifiedFont = "STSong-Light";
- public static String ChineseSimplifiedEncoding_H = "UniGB-UCS2-H";
- public static String ChineseSimplifiedEncoding_V = "UniGB-UCS2-V";
-
- public static String ChineseTraditionalFont_MHei = "MHei-Medium";
- public static String ChineseTraditionalFont_MSung = "MSung-Light";
- public static String ChineseTraditionalEncoding_H = "UniCNS-UCS2-H";
- public static String ChineseTraditionalEncoding_V = "UniCNS-UCS2-V";
-
- public static String JapaneseFont_Go = "HeiseiKakuGo-W5";
- public static String JapaneseFont_Min = "HeiseiMin-W3";
- public static String JapaneseEncoding_H = "UniJIS-UCS2-H";
- public static String JapaneseEncoding_V = "UniJIS-UCS2-V";
- public static String JapaneseEncoding_HW_H = "UniJIS-UCS2-HW-H";
- public static String JapaneseEncoding_HW_V = "UniJIS-UCS2-HW-V";
-
- public static String KoreanFont_GoThic = "HYGoThic-Medium";
- public static String KoreanFont_SMyeongJo = "HYSMyeongJo-Medium";
- public static String KoreanEncoding_H = "UniKS-UCS2-H";
- public static String KoreanEncoding_V = "UniKS-UCS2-V";
-
- private String defaultFont;
- private String encoding;
-
- public AsianFontMapper(String font, String encoding) {
- super();
-
- this.defaultFont = font;
- this.encoding = encoding;
- }
-
- public BaseFont awtToPdf(Font font) {
- try {
- BaseFontParameters p = getBaseFontParameters(font.getFontName());
- if (p != null){
- return BaseFont.createFont(p.fontName, p.encoding, p.embedded, p.cached, p.ttfAfm, p.pfb);
- }else{
- return BaseFont.createFont(defaultFont, encoding, true);
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- return null;
-
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/BadPdfFormatException.java b/LibrarySource/com/lowagie/text/pdf/BadPdfFormatException.java
deleted file mode 100644
index 39a7250..0000000
--- a/LibrarySource/com/lowagie/text/pdf/BadPdfFormatException.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * $Id: BadPdfFormatException.java,v 1.22 2002/06/18 13:59:39 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/**
- * Signals that a bad PDF format has been used to construct a <CODE>PdfObject</CODE>.
- *
- * @see PdfException
- * @see PdfBoolean
- * @see PdfNumber
- * @see PdfString
- * @see PdfName
- * @see PdfDictionary
- * @see PdfFont
- */
-
-public class BadPdfFormatException extends PdfException {
-
- // constructors
-
-/**
- * Constructs a <CODE>BadPdfFormatException</CODE> whithout a message.
- */
-
- BadPdfFormatException() {
- super();
- }
-
-/**
- * Constructs a <code>BadPdfFormatException</code> with a message.
- *
- * @param message a message describing the exception
- */
-
- BadPdfFormatException(String message) {
- super(message);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/BaseField.java b/LibrarySource/com/lowagie/text/pdf/BaseField.java
deleted file mode 100644
index fbe2593..0000000
--- a/LibrarySource/com/lowagie/text/pdf/BaseField.java
+++ /dev/null
@@ -1,686 +0,0 @@
-/*
- * Copyright 2005 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- *
- * Mesquite specific changes/deletions copyright 2005 Peter E. Midford
- * peteremidford at yahoo.com. Mesquite itself is copyright 1997-2005 by W. and D.
- * Maddison and licensed under the LGPL.
- *
- */
-
-package com.lowagie.text.pdf;
-
-import headless.awt.Color;
-import com.lowagie.text.Element;
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.Rectangle;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.HashMap;
-
-/** Common field variables.
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public abstract class BaseField {
-
- /** A thin border with 1 point width. */
- public static final float BORDER_WIDTH_THIN = 1;
- /** A medium border with 2 point width. */
- public static final float BORDER_WIDTH_MEDIUM = 2;
- /** A thick border with 3 point width. */
- public static final float BORDER_WIDTH_THICK = 3;
- /** The field is visible. */
- public static final int VISIBLE = 0;
- /** The field is hidden. */
- public static final int HIDDEN = 1;
- /** The field is visible but does not print. */
- public static final int VISIBLE_BUT_DOES_NOT_PRINT = 2;
- /** The field is hidden but is printable. */
- public static final int HIDDEN_BUT_PRINTABLE = 3;
- /** The user may not change the value of the field. */
- public static final int READ_ONLY = 1;
- /** The field must have a value at the time it is exported by a submit-form
- * action.
- */
- public static final int REQUIRED = 2;
- /** The field may contain multiple lines of text.
- * This flag is only meaningful with text fields.
- */
- public static final int MULTILINE = 4;
- /** The field will not scroll (horizontally for single-line
- * fields, vertically for multiple-line fields) to accommodate more text
- * than will fit within its annotation rectangle. Once the field is full, no
- * further text will be accepted.
- */
- public static final int DO_NOT_SCROLL = 8;
- /** The field is intended for entering a secure password that should
- * not be echoed visibly to the screen.
- */
- public static final int PASSWORD = 16;
- /** The text entered in the field represents the pathname of
- * a file whose contents are to be submitted as the value of the field.
- */
- public static final int FILE_SELECTION = 32;
- /** The text entered in the field will not be spell-checked.
- * This flag is meaningful only in text fields and in combo
- * fields with the <CODE>EDIT</CODE> flag set.
- */
- public static final int DO_NOT_SPELL_CHECK = 64;
- /** If set the combo box includes an editable text box as well as a drop list; if
- * clear, it includes only a drop list.
- * This flag is only meaningful with combo fields.
- */
- public static final int EDIT = 128;
-
- /**
- * combo box flag.
- */
- public static final int COMB = 256;
-
- protected float borderWidth = BORDER_WIDTH_THIN;
- protected int borderStyle = PdfBorderDictionary.STYLE_SOLID;
- protected Color borderColor;
- protected Color backgroundColor;
- protected Color textColor;
- protected BaseFont font;
- protected float fontSize = 0;
- protected int alignment = Element.ALIGN_LEFT;
- protected PdfWriter writer;
- protected String text;
- protected Rectangle box;
-
- /** Holds value of property rotation. */
- protected int rotation = 0;
-
- /** Holds value of property visibility. */
- protected int visibility;
-
- /** Holds value of property fieldName. */
- protected String fieldName;
-
- /** Holds value of property options. */
- protected int options;
-
- /** Holds value of property maxCharacterLength. */
- protected int maxCharacterLength;
-
- private final static HashMap fieldKeys = new HashMap();
-
- static {
- Integer one = new Integer(1);
- fieldKeys.put(PdfName.AA, one);
- fieldKeys.put(PdfName.FT, one);
- fieldKeys.put(PdfName.TU, one);
- fieldKeys.put(PdfName.TM, one);
- fieldKeys.put(PdfName.FF, one);
- fieldKeys.put(PdfName.V, one);
- fieldKeys.put(PdfName.DV, one);
- fieldKeys.put(PdfName.DS, one);
- fieldKeys.put(PdfName.RV, one);
- fieldKeys.put(PdfName.OPT, one);
- fieldKeys.put(PdfName.MAXLEN, one);
- fieldKeys.put(PdfName.TI, one);
- fieldKeys.put(PdfName.I, one);
- fieldKeys.put(PdfName.LOCK, one);
- fieldKeys.put(PdfName.SV, one);
- //fieldKeys.putAll(PdfCopyFieldsImp.fieldKeys); // removed for Mesquite support 25 September 2005 P. E. Midford
- fieldKeys.put(PdfName.T, one);
- }
- /** Creates a new <CODE>TextField</CODE>.
- * @param writer the document <CODE>PdfWriter</CODE>
- * @param box the field location and dimensions
- * @param fieldName the field name. If <CODE>null</CODE> only the widget keys
- * will be included in the field allowing it to be used as a kid field.
- */
- public BaseField(PdfWriter writer, Rectangle box, String fieldName) {
- this.writer = writer;
- this.box = box;
- this.fieldName = fieldName;
- }
-
- protected BaseFont getRealFont() throws IOException, DocumentException {
- if (font == null)
- return BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, false);
- else
- return font;
- }
-
- protected PdfAppearance getBorderAppearance() throws IOException, DocumentException {
- PdfAppearance app = writer.getDirectContent().createAppearance(box.width(), box.height());
- switch (rotation) {
- case 90:
- app.setMatrix(0, 1, -1, 0, box.height(), 0);
- break;
- case 180:
- app.setMatrix(-1, 0, 0, -1, box.width(), box.height());
- break;
- case 270:
- app.setMatrix(0, -1, 1, 0, 0, box.width());
- break;
- }
- // background
- if (backgroundColor != null) {
- app.setColorFill(backgroundColor);
- app.rectangle(0, 0, box.width(), box.height());
- app.fill();
- }
- // border
- if (borderStyle == PdfBorderDictionary.STYLE_UNDERLINE) {
- if (borderWidth != 0 && borderColor != null) {
- app.setColorStroke(borderColor);
- app.setLineWidth(borderWidth);
- app.moveTo(0, borderWidth / 2);
- app.lineTo(box.width(), borderWidth / 2);
- app.stroke();
- }
- }
- else if (borderStyle == PdfBorderDictionary.STYLE_BEVELED) {
- if (borderWidth != 0 && borderColor != null) {
- app.setColorStroke(borderColor);
- app.setLineWidth(borderWidth);
- app.rectangle(borderWidth / 2, borderWidth / 2, box.width() - borderWidth, box.height() - borderWidth);
- app.stroke();
- }
- // beveled
- Color actual = backgroundColor;
- if (actual == null)
- actual = Color.white;
- app.setGrayFill(1);
- drawTopFrame(app);
- app.setColorFill(actual.darker());
- drawBottomFrame(app);
- }
- else if (borderStyle == PdfBorderDictionary.STYLE_INSET) {
- if (borderWidth != 0 && borderColor != null) {
- app.setColorStroke(borderColor);
- app.setLineWidth(borderWidth);
- app.rectangle(borderWidth / 2, borderWidth / 2, box.width() - borderWidth, box.height() - borderWidth);
- app.stroke();
- }
- // inset
- app.setGrayFill(0.5f);
- drawTopFrame(app);
- app.setGrayFill(0.75f);
- drawBottomFrame(app);
- }
- else {
- if (borderWidth != 0 && borderColor != null) {
- if (borderStyle == PdfBorderDictionary.STYLE_DASHED)
- app.setLineDash(3, 0);
- app.setColorStroke(borderColor);
- app.setLineWidth(borderWidth);
- app.rectangle(borderWidth / 2, borderWidth / 2, box.width() - borderWidth, box.height() - borderWidth);
- app.stroke();
- if ((options & COMB) != 0 && maxCharacterLength > 1) {
- float step = box.width() / maxCharacterLength;
- float yb = borderWidth / 2;
- float yt = box.height() - borderWidth / 2;
- for (int k = 1; k < maxCharacterLength; ++k) {
- float x = step * k;
- app.moveTo(x, yb);
- app.lineTo(x, yt);
- }
- app.stroke();
- }
- }
- }
- return app;
- }
-
- protected static ArrayList getHardBreaks(String text) {
- ArrayList arr = new ArrayList();
- char cs[] = text.toCharArray();
- int len = cs.length;
- StringBuffer buf = new StringBuffer();
- for (int k = 0; k < len; ++k) {
- char c = cs[k];
- if (c == '\r') {
- if (k + 1 < len && cs[k + 1] == '\n')
- ++k;
- arr.add(buf.toString());
- buf = new StringBuffer();
- }
- else if (c == '\n') {
- arr.add(buf.toString());
- buf = new StringBuffer();
- }
- else
- buf.append(c);
- }
- arr.add(buf.toString());
- return arr;
- }
-
- protected static void trimRight(StringBuffer buf) {
- int len = buf.length();
- while (true) {
- if (len == 0)
- return;
- if (buf.charAt(--len) != ' ')
- return;
- buf.setLength(len);
- }
- }
-
- protected static ArrayList breakLines(ArrayList breaks, BaseFont font, float fontSize, float width) {
- ArrayList lines = new ArrayList();
- StringBuffer buf = new StringBuffer();
- for (int ck = 0; ck < breaks.size(); ++ck) {
- buf.setLength(0);
- float w = 0;
- char cs[] = ((String)breaks.get(ck)).toCharArray();
- int len = cs.length;
- // 0 inline first, 1 inline, 2 spaces
- int state = 0;
- int lastspace = -1;
- char c = 0;
- int refk = 0;
- for (int k = 0; k < len; ++k) {
- c = cs[k];
- switch (state) {
- case 0:
- w += font.getWidthPoint(c, fontSize);
- buf.append(c);
- if (w > width) {
- w = 0;
- if (buf.length() > 1) {
- --k;
- buf.setLength(buf.length() - 1);
- }
- lines.add(buf.toString());
- buf.setLength(0);
- refk = k;
- if (c == ' ')
- state = 2;
- else
- state = 1;
- }
- else {
- if (c != ' ')
- state = 1;
- }
- break;
- case 1:
- w += font.getWidthPoint(c, fontSize);
- buf.append(c);
- if (c == ' ')
- lastspace = k;
- if (w > width) {
- w = 0;
- if (lastspace >= 0) {
- k = lastspace;
- buf.setLength(lastspace - refk);
- trimRight(buf);
- lines.add(buf.toString());
- buf.setLength(0);
- refk = k;
- lastspace = -1;
- state = 2;
- }
- else {
- if (buf.length() > 1) {
- --k;
- buf.setLength(buf.length() - 1);
- }
- lines.add(buf.toString());
- buf.setLength(0);
- refk = k;
- if (c == ' ')
- state = 2;
- }
- }
- break;
- case 2:
- if (c != ' ') {
- w = 0;
- --k;
- state = 1;
- }
- break;
- }
- }
- trimRight(buf);
- lines.add(buf.toString());
- }
- return lines;
- }
-
- private void drawTopFrame(PdfAppearance app) {
- app.moveTo(borderWidth, borderWidth);
- app.lineTo(borderWidth, box.height() - borderWidth);
- app.lineTo(box.width() - borderWidth, box.height() - borderWidth);
- app.lineTo(box.width() - 2 * borderWidth, box.height() - 2 * borderWidth);
- app.lineTo(2 * borderWidth, box.height() - 2 * borderWidth);
- app.lineTo(2 * borderWidth, 2 * borderWidth);
- app.lineTo(borderWidth, borderWidth);
- app.fill();
- }
-
- private void drawBottomFrame(PdfAppearance app) {
- app.moveTo(borderWidth, borderWidth);
- app.lineTo(box.width() - borderWidth, borderWidth);
- app.lineTo(box.width() - borderWidth, box.height() - borderWidth);
- app.lineTo(box.width() - 2 * borderWidth, box.height() - 2 * borderWidth);
- app.lineTo(box.width() - 2 * borderWidth, 2 * borderWidth);
- app.lineTo(2 * borderWidth, 2 * borderWidth);
- app.lineTo(borderWidth, borderWidth);
- app.fill();
- }
- /** Gets the border width in points.
- * @return the border width in points
- */
- public float getBorderWidth() {
- return this.borderWidth;
- }
-
- /** Sets the border width in points. To eliminate the border
- * set the border color to <CODE>null</CODE>.
- * @param borderWidth the border width in points
- */
- public void setBorderWidth(float borderWidth) {
- this.borderWidth = borderWidth;
- }
-
- /** Gets the border style.
- * @return the border style
- */
- public int getBorderStyle() {
- return this.borderStyle;
- }
-
- /** Sets the border style. The styles are found in <CODE>PdfBorderDictionary</CODE>
- * and can be <CODE>STYLE_SOLID</CODE>, <CODE>STYLE_DASHED</CODE>,
- * <CODE>STYLE_BEVELED</CODE>, <CODE>STYLE_INSET</CODE> and
- * <CODE>STYLE_UNDERLINE</CODE>.
- * @param borderStyle the border style
- */
- public void setBorderStyle(int borderStyle) {
- this.borderStyle = borderStyle;
- }
-
- /** Gets the border color.
- * @return the border color
- */
- public Color getBorderColor() {
- return this.borderColor;
- }
-
- /** Sets the border color. Set to <CODE>null</CODE> to remove
- * the border.
- * @param borderColor the border color
- */
- public void setBorderColor(Color borderColor) {
- this.borderColor = borderColor;
- }
-
- /** Gets the background color.
- * @return the background color
- */
- public Color getBackgroundColor() {
- return this.backgroundColor;
- }
-
- /** Sets the background color. Set to <CODE>null</CODE> for
- * transparent background.
- * @param backgroundColor the background color
- */
- public void setBackgroundColor(Color backgroundColor) {
- this.backgroundColor = backgroundColor;
- }
-
- /** Gets the text color.
- * @return the text color
- */
- public Color getTextColor() {
- return this.textColor;
- }
-
- /** Sets the text color. If <CODE>null</CODE> the color used
- * will be black.
- * @param textColor the text color
- */
- public void setTextColor(Color textColor) {
- this.textColor = textColor;
- }
-
- /** Gets the text font.
- * @return the text font
- */
- public BaseFont getFont() {
- return this.font;
- }
-
- /** Sets the text font. If <CODE>null</CODE> then Helvetica
- * will be used.
- * @param font the text font
- */
- public void setFont(BaseFont font) {
- this.font = font;
- }
-
- /** Gets the font size.
- * @return the font size
- */
- public float getFontSize() {
- return this.fontSize;
- }
-
- /** Sets the font size. If 0 then auto-sizing will be used but
- * only for text fields.
- * @param fontSize the font size
- */
- public void setFontSize(float fontSize) {
- this.fontSize = fontSize;
- }
-
- /** Gets the text horizontal alignment.
- * @return the text horizontal alignment
- */
- public int getAlignment() {
- return this.alignment;
- }
-
- /** Sets the text horizontal alignment. It can be <CODE>Element.ALIGN_LEFT</CODE>,
- * <CODE>Element.ALIGN_CENTER</CODE> and <CODE>Element.ALIGN_RIGHT</CODE>.
- * @param alignment the text horizontal alignment
- */
- public void setAlignment(int alignment) {
- this.alignment = alignment;
- }
-
- /** Gets the text.
- * @return the text
- */
- public String getText() {
- return this.text;
- }
-
- /** Sets the text for text fields.
- * @param text the text
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /** Gets the field dimension and position.
- * @return the field dimension and position
- */
- public Rectangle getBox() {
- return this.box;
- }
-
- /** Sets the field dimension and position.
- * @param box the field dimension and position
- */
- public void setBox(Rectangle box) {
- this.box = box;
- }
-
- /** Gets the field rotation.
- * @return the field rotation
- */
- public int getRotation() {
- return this.rotation;
- }
-
- /** Sets the field rotation. This value should be the same as
- * the page rotation where the field will be shown.
- * @param rotation the field rotation
- */
- public void setRotation(int rotation) {
- if (rotation % 90 != 0)
- throw new IllegalArgumentException("Rotation must be a multiple of 90.");
- rotation %= 360;
- if (rotation < 0)
- rotation += 360;
- this.rotation = rotation;
- }
-
- /** Convenience method to set the field rotation the same as the
- * page rotation.
- * @param page the page
- */
- public void setRotationFromPage(Rectangle page) {
- setRotation(page.getRotation());
- }
-
- /** Gets the field visibility flag.
- * @return the field visibility flag
- */
- public int getVisibility() {
- return this.visibility;
- }
-
- /** Sets the field visibility flag. This flags can be one of
- * <CODE>VISIBLE</CODE>, <CODE>HIDDEN</CODE>, <CODE>VISIBLE_BUT_DOES_NOT_PRINT</CODE>
- * and <CODE>HIDDEN_BUT_PRINTABLE</CODE>.
- * @param visibility field visibility flag
- */
- public void setVisibility(int visibility) {
- this.visibility = visibility;
- }
-
- /** Gets the field name.
- * @return the field name
- */
- public String getFieldName() {
- return this.fieldName;
- }
-
- /** Sets the field name.
- * @param fieldName the field name. If <CODE>null</CODE> only the widget keys
- * will be included in the field allowing it to be used as a kid field.
- */
- public void setFieldName(String fieldName) {
- this.fieldName = fieldName;
- }
-
- /** Gets the option flags.
- * @return the option flags
- */
- public int getOptions() {
- return this.options;
- }
-
- /** Sets the option flags. The option flags can be a combination by oring of
- * <CODE>READ_ONLY</CODE>, <CODE>REQUIRED</CODE>,
- * <CODE>MULTILINE</CODE>, <CODE>DO_NOT_SCROLL</CODE>,
- * <CODE>PASSWORD</CODE>, <CODE>FILE_SELECTION</CODE>,
- * <CODE>DO_NOT_SPELL_CHECK</CODE> and <CODE>EDIT</CODE>.
- * @param options the option flags
- */
- public void setOptions(int options) {
- this.options = options;
- }
-
- /** Gets the maximum length of the field�s text, in characters.
- * @return the maximum length of the field�s text, in characters.
- */
- public int getMaxCharacterLength() {
- return this.maxCharacterLength;
- }
-
- /** Sets the maximum length of the field�s text, in characters.
- * It is only meaningful for text fields.
- * @param maxCharacterLength the maximum length of the field�s text, in characters
- */
- public void setMaxCharacterLength(int maxCharacterLength) {
- this.maxCharacterLength = maxCharacterLength;
- }
-
- /**
- * Getter for property writer.
- * @return Value of property writer.
- */
- public PdfWriter getWriter() {
- return writer;
- }
-
- /**
- * Setter for property writer.
- * @param writer New value of property writer.
- */
- public void setWriter(PdfWriter writer) {
- this.writer = writer;
- }
-
- /**
- * Moves the field keys from <CODE>from</CODE> to <CODE>to</CODE>. The moved keys
- * are removed from <CODE>from</CODE>.
- * @param from the source
- * @param to the destination. It may be <CODE>null</CODE>
- */
- public static void moveFields(PdfDictionary from, PdfDictionary to) {
- for (Iterator i = from.getKeys().iterator(); i.hasNext();) {
- PdfName key = (PdfName)i.next();
- if (fieldKeys.containsKey(key)) {
- if (to != null)
- to.put(key, from.get(key));
- i.remove();
- }
- }
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/BaseFont.java b/LibrarySource/com/lowagie/text/pdf/BaseFont.java
deleted file mode 100644
index ddedefe..0000000
--- a/LibrarySource/com/lowagie/text/pdf/BaseFont.java
+++ /dev/null
@@ -1,1094 +0,0 @@
-/*
- * $Id: BaseFont.java,v 1.65 2005/04/05 12:48:09 blowagie Exp $
- * $Name: $
- *
- * Copyright 2000, 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-import java.io.*;
-import com.lowagie.text.DocumentException;
-import java.util.HashMap;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-/**
- * Base class for the several font types supported
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-
-public abstract class BaseFont {
-
- /** This is a possible value of a base 14 type 1 font */
- public static final String COURIER = "Courier";
-
- /** This is a possible value of a base 14 type 1 font */
- public static final String COURIER_BOLD = "Courier-Bold";
-
- /** This is a possible value of a base 14 type 1 font */
- public static final String COURIER_OBLIQUE = "Courier-Oblique";
-
- /** This is a possible value of a base 14 type 1 font */
- public static final String COURIER_BOLDOBLIQUE = "Courier-BoldOblique";
-
- /** This is a possible value of a base 14 type 1 font */
- public static final String HELVETICA = "Helvetica";
-
- /** This is a possible value of a base 14 type 1 font */
- public static final String HELVETICA_BOLD = "Helvetica-Bold";
-
- /** This is a possible value of a base 14 type 1 font */
- public static final String HELVETICA_OBLIQUE = "Helvetica-Oblique";
-
- /** This is a possible value of a base 14 type 1 font */
- public static final String HELVETICA_BOLDOBLIQUE = "Helvetica-BoldOblique";
-
- /** This is a possible value of a base 14 type 1 font */
- public static final String SYMBOL = "Symbol";
-
- /** This is a possible value of a base 14 type 1 font */
- public static final String TIMES_ROMAN = "Times-Roman";
-
- /** This is a possible value of a base 14 type 1 font */
- public static final String TIMES_BOLD = "Times-Bold";
-
- /** This is a possible value of a base 14 type 1 font */
- public static final String TIMES_ITALIC = "Times-Italic";
-
- /** This is a possible value of a base 14 type 1 font */
- public static final String TIMES_BOLDITALIC = "Times-BoldItalic";
-
- /** This is a possible value of a base 14 type 1 font */
- public static final String ZAPFDINGBATS = "ZapfDingbats";
-
- /** The maximum height above the baseline reached by glyphs in this
- * font, excluding the height of glyphs for accented characters.
- */
- public static final int ASCENT = 1;
- /** The y coordinate of the top of flat capital letters, measured from
- * the baseline.
- */
- public static final int CAPHEIGHT = 2;
- /** The maximum depth below the baseline reached by glyphs in this
- * font. The value is a negative number.
- */
- public static final int DESCENT = 3;
- /** The angle, expressed in degrees counterclockwise from the vertical,
- * of the dominant vertical strokes of the font. The value is
- * negative for fonts that slope to the right, as almost all italic fonts do.
- */
- public static final int ITALICANGLE = 4;
- /** The lower left x glyph coordinate.
- */
- public static final int BBOXLLX = 5;
- /** The lower left y glyph coordinate.
- */
- public static final int BBOXLLY = 6;
- /** The upper right x glyph coordinate.
- */
- public static final int BBOXURX = 7;
- /** The upper right y glyph coordinate.
- */
- public static final int BBOXURY = 8;
-
- /** java.awt.Font property */
- public static final int AWT_ASCENT = 9;
- /** java.awt.Font property */
- public static final int AWT_DESCENT = 10;
- /** java.awt.Font property */
- public static final int AWT_LEADING = 11;
- /** java.awt.Font property */
- public static final int AWT_MAXADVANCE = 12;
-
- /** The font is Type 1.
- */
- public static final int FONT_TYPE_T1 = 0;
- /** The font is True Type with a standard encoding.
- */
- public static final int FONT_TYPE_TT = 1;
- /** The font is CJK.
- */
- public static final int FONT_TYPE_CJK = 2;
- /** The font is True Type with a Unicode encoding.
- */
- public static final int FONT_TYPE_TTUNI = 3;
- /** A font already inside the document.
- */
- public static final int FONT_TYPE_DOCUMENT = 4;
- /** The Unicode encoding with horizontal writing.
- */
- public static final String IDENTITY_H = "Identity-H";
- /** The Unicode encoding with vertical writing.
- */
- public static final String IDENTITY_V = "Identity-V";
-
- /** A possible encoding. */
- public static final String CP1250 = "Cp1250";
-
- /** A possible encoding. */
- public static final String CP1252 = "Cp1252";
-
- /** A possible encoding. */
- public static final String CP1257 = "Cp1257";
-
- /** A possible encoding. */
- public static final String WINANSI = "Cp1252";
-
- /** A possible encoding. */
- public static final String MACROMAN = "MacRoman";
-
-
-/** if the font has to be embedded */
- public static final boolean EMBEDDED = true;
-
-/** if the font doesn't have to be embedded */
- public static final boolean NOT_EMBEDDED = false;
-/** if the font has to be cached */
- public static final boolean CACHED = true;
-/** if the font doesn't have to be cached */
- public static final boolean NOT_CACHED = false;
-
- /** The path to the font resources. */
- public static final String RESOURCE_PATH = "com/lowagie/text/pdf/fonts/";
- /** The fake CID code that represents a newline. */
- public static final char CID_NEWLINE = '\u7fff';
-
- /** The font type.
- */
- int fontType;
-/** a not defined character in a custom PDF encoding */
- public static final String notdef = ".notdef";
-
-/** table of characters widths for this encoding */
- protected int widths[] = new int[256];
-
-/** encoding names */
- protected String differences[] = new String[256];
-/** same as differences but with the unicode codes */
- protected char unicodeDifferences[] = new char[256];
-
- protected int charBBoxes[][] = new int[256][];
-/** encoding used with this font */
- protected String encoding;
-
-/** true if the font is to be embedded in the PDF */
- protected boolean embedded;
-
-/**
- * true if the font must use it's built in encoding. In that case the
- * <CODE>encoding</CODE> is only used to map a char to the position inside
- * the font, not to the expected char name.
- */
- protected boolean fontSpecific = true;
-
-/** cache for the fonts already used. */
- protected static HashMap fontCache = new HashMap();
-
-/** list of the 14 built in fonts. */
- protected static final HashMap BuiltinFonts14 = new HashMap();
-
- /** Forces the output of the width array. Only matters for the 14
- * built-in fonts.
- */
- protected boolean forceWidthsOutput = false;
-
- /** Converts <CODE>char</CODE> directly to <CODE>byte</CODE>
- * by casting.
- */
- protected boolean directTextToByte = false;
-
- /** Indicates if all the glyphs and widths for that particular
- * encoding should be included in the document.
- */
- protected boolean subset = true;
-
- protected boolean fastWinansi = false;
-
- static {
- BuiltinFonts14.put(COURIER, PdfName.COURIER);
- BuiltinFonts14.put(COURIER_BOLD, PdfName.COURIER_BOLD);
- BuiltinFonts14.put(COURIER_BOLDOBLIQUE, PdfName.COURIER_BOLDOBLIQUE);
- BuiltinFonts14.put(COURIER_OBLIQUE, PdfName.COURIER_OBLIQUE);
- BuiltinFonts14.put(HELVETICA, PdfName.HELVETICA);
- BuiltinFonts14.put(HELVETICA_BOLD, PdfName.HELVETICA_BOLD);
- BuiltinFonts14.put(HELVETICA_BOLDOBLIQUE, PdfName.HELVETICA_BOLDOBLIQUE);
- BuiltinFonts14.put(HELVETICA_OBLIQUE, PdfName.HELVETICA_OBLIQUE);
- BuiltinFonts14.put(SYMBOL, PdfName.SYMBOL);
- BuiltinFonts14.put(TIMES_ROMAN, PdfName.TIMES_ROMAN);
- BuiltinFonts14.put(TIMES_BOLD, PdfName.TIMES_BOLD);
- BuiltinFonts14.put(TIMES_BOLDITALIC, PdfName.TIMES_BOLDITALIC);
- BuiltinFonts14.put(TIMES_ITALIC, PdfName.TIMES_ITALIC);
- BuiltinFonts14.put(ZAPFDINGBATS, PdfName.ZAPFDINGBATS);
- }
-
- /** Generates the PDF stream with the Type1 and Truetype fonts returning
- * a PdfStream.
- */
- static class StreamFont extends PdfStream {
-
- /** Generates the PDF stream with the Type1 and Truetype fonts returning
- * a PdfStream.
- * @param contents the content of the stream
- * @param lengths an array of int that describes the several lengths of each part of the font
- * @throws DocumentException error in the stream compression
- */
- public StreamFont(byte contents[], int lengths[]) throws DocumentException {
- try {
- bytes = contents;
- put(PdfName.LENGTH, new PdfNumber(bytes.length));
- for (int k = 0; k < lengths.length; ++k) {
- put(new PdfName("Length" + (k + 1)), new PdfNumber(lengths[k]));
- }
- flateCompress();
- }
- catch (Exception e) {
- throw new DocumentException(e);
- }
- }
-
- /**
- * Generates the PDF stream for a font.
- * @param contents the content of a stream
- * @param subType the subtype of the font.
- * @throws DocumentException
- */
- public StreamFont(byte contents[], String subType) throws DocumentException {
- try {
- bytes = contents;
- put(PdfName.LENGTH, new PdfNumber(bytes.length));
- if (subType != null)
- put(PdfName.SUBTYPE, new PdfName(subType));
- flateCompress();
- }
- catch (Exception e) {
- throw new DocumentException(e);
- }
- }
- }
-
- /**
- *Creates new BaseFont
- */
- protected BaseFont() {
- }
-
- /** Creates a new font. This font can be one of the 14 built in types,
- * a Type1 font referred by an AFM file, a TrueType font (simple or collection) or a CJK font from the
- * Adobe Asian Font Pack. TrueType fonts and CJK fonts can have an optional style modifier
- * appended to the name. These modifiers are: Bold, Italic and BoldItalic. An
- * example would be "STSong-Light,Bold". Note that this modifiers do not work if
- * the font is embedded. Fonts in TrueType collections are addressed by index such as "msgothic.ttc,1".
- * This would get the second font (indexes start at 0), in this case "MS PGothic".
- * <P>
- * The fonts are cached and if they already exist they are extracted from the cache,
- * not parsed again.
- * <P>
- * This method calls:<br>
- * <PRE>
- * createFont(name, encoding, embedded, true, null, null);
- * </PRE>
- * @param name the name of the font or it's location on file
- * @param encoding the encoding to be applied to this font
- * @param embedded true if the font is to be embedded in the PDF
- * @return returns a new font. This font may come from the cache
- * @throws DocumentException the font is invalid
- * @throws IOException the font file could not be read
- */
- public static BaseFont createFont(String name, String encoding, boolean embedded) throws DocumentException, IOException {
- return createFont(name, encoding, embedded, true, null, null);
- }
-
- /** Creates a new font. This font can be one of the 14 built in types,
- * a Type1 font referred by an AFM file, a TrueType font (simple or collection) or a CJK font from the
- * Adobe Asian Font Pack. TrueType fonts and CJK fonts can have an optional style modifier
- * appended to the name. These modifiers are: Bold, Italic and BoldItalic. An
- * example would be "STSong-Light,Bold". Note that this modifiers do not work if
- * the font is embedded. Fonts in TrueType collections are addressed by index such as "msgothic.ttc,1".
- * This would get the second font (indexes start at 0), in this case "MS PGothic".
- * <P>
- * The fonts may or may not be cached depending on the flag <CODE>cached</CODE>.
- * If the <CODE>byte</CODE> arrays are present the font will be
- * read from them instead of the name. The name is still required to identify
- * the font type.
- * @param name the name of the font or it's location on file
- * @param encoding the encoding to be applied to this font
- * @param embedded true if the font is to be embedded in the PDF
- * @param cached true if the font comes from the cache or is added to
- * the cache if new, false if the font is always created new
- * @param ttfAfm the true type font or the afm in a byte array
- * @param pfb the pfb in a byte array
- * @return returns a new font. This font may come from the cache but only if cached
- * is true, otherwise it will always be created new
- * @throws DocumentException the font is invalid
- * @throws IOException the font file could not be read
- */
- public static BaseFont createFont(String name, String encoding, boolean embedded, boolean cached, byte ttfAfm[], byte pfb[]) throws DocumentException, IOException {
- String nameBase = getBaseName(name);
- encoding = normalizeEncoding(encoding);
- boolean isBuiltinFonts14 = BuiltinFonts14.containsKey(name);
- boolean isCJKFont = isBuiltinFonts14 ? false : CJKFont.isCJKFont(nameBase, encoding);
- if (isBuiltinFonts14 || isCJKFont)
- embedded = false;
- else if (encoding.equals(IDENTITY_H) || encoding.equals(IDENTITY_V))
- embedded = true;
- BaseFont fontFound = null;
- BaseFont fontBuilt = null;
- String key = name + "\n" + encoding + "\n" + embedded;
- if (cached) {
- synchronized (fontCache) {
- fontFound = (BaseFont)fontCache.get(key);
- }
- if (fontFound != null)
- return fontFound;
- }
- if (isBuiltinFonts14 || name.toLowerCase().endsWith(".afm") || name.toLowerCase().endsWith(".pfm")) {
- fontBuilt = new Type1Font(name, encoding, embedded, ttfAfm, pfb);
- fontBuilt.fastWinansi = encoding.equals(CP1252);
- }
- else if (nameBase.toLowerCase().endsWith(".ttf") || nameBase.toLowerCase().endsWith(".otf") || nameBase.toLowerCase().indexOf(".ttc,") > 0) {
- if (encoding.equals(IDENTITY_H) || encoding.equals(IDENTITY_V))
- fontBuilt = new TrueTypeFontUnicode(name, encoding, embedded, ttfAfm);
- else {
- fontBuilt = new TrueTypeFont(name, encoding, embedded, ttfAfm);
- fontBuilt.fastWinansi = encoding.equals(CP1252);
- }
- }
- else if (isCJKFont)
- fontBuilt = new CJKFont(name, encoding, embedded);
- else
- throw new DocumentException("Font '" + name + "' with '" + encoding + "' is not recognized.");
- if (cached) {
- synchronized (fontCache) {
- fontFound = (BaseFont)fontCache.get(key);
- if (fontFound != null)
- return fontFound;
- fontCache.put(key, fontBuilt);
- }
- }
- return fontBuilt;
- }
-
- /**
- * Creates a font based on an existing document font. The created font font may not
- * behave as expected, depending on the encoding or subset.
- * @param fontRef the reference to the document font
- * @return the font
- */
- public static BaseFont createFont(PRIndirectReference fontRef) {
- return new DocumentFont(fontRef);
- }
-
- /**
- * Gets the name without the modifiers Bold, Italic or BoldItalic.
- * @param name the full name of the font
- * @return the name without the modifiers Bold, Italic or BoldItalic
- */
- protected static String getBaseName(String name) {
- if (name.endsWith(",Bold"))
- return name.substring(0, name.length() - 5);
- else if (name.endsWith(",Italic"))
- return name.substring(0, name.length() - 7);
- else if (name.endsWith(",BoldItalic"))
- return name.substring(0, name.length() - 11);
- else
- return name;
- }
-
- /**
- * Normalize the encoding names. "winansi" is changed to "Cp1252" and
- * "macroman" is changed to "MacRoman".
- * @param enc the encoding to be normalized
- * @return the normalized encoding
- */
- protected static String normalizeEncoding(String enc) {
- if (enc.equals("winansi") || enc.equals(""))
- return CP1252;
- else if (enc.equals("macroman"))
- return MACROMAN;
- else
- return enc;
- }
-
- /**
- * Creates the <CODE>widths</CODE> and the <CODE>differences</CODE> arrays
- */
- protected void createEncoding() {
- if (fontSpecific) {
- for (int k = 0; k < 256; ++k) {
- widths[k] = getRawWidth(k, null);
- charBBoxes[k] = getRawCharBBox(k, null);
- }
- }
- else {
- String s;
- String name;
- char c;
- byte b[] = new byte[1];
- for (int k = 0; k < 256; ++k) {
- b[0] = (byte)k;
- s = PdfEncodings.convertToString(b, encoding);
- if (s.length() > 0) {
- c = s.charAt(0);
- }
- else {
- c = '?';
- }
- name = GlyphList.unicodeToName((int)c);
- if (name == null)
- name = notdef;
- differences[k] = name;
- unicodeDifferences[k] = c;
- widths[k] = getRawWidth((int)c, name);
- charBBoxes[k] = getRawCharBBox((int)c, name);
- }
- }
- }
-
- /**
- * Gets the width from the font according to the Unicode char <CODE>c</CODE>
- * or the <CODE>name</CODE>. If the <CODE>name</CODE> is null it's a symbolic font.
- * @param c the unicode char
- * @param name the glyph name
- * @return the width of the char
- */
- abstract int getRawWidth(int c, String name);
-
- /**
- * Gets the kerning between two Unicode chars.
- * @param char1 the first char
- * @param char2 the second char
- * @return the kerning to be applied in normalized 1000 units
- */
- public abstract int getKerning(char char1, char char2);
-
- /**
- * Sets the kerning between two Unicode chars.
- * @param char1 the first char
- * @param char2 the second char
- * @param kern the kerning to apply in normalized 1000 units
- * @return <code>true</code> if the kerning was applied, <code>false</code> otherwise
- */
- public abstract boolean setKerning(char char1, char char2, int kern);
-
- /**
- * Gets the width of a <CODE>char</CODE> in normalized 1000 units.
- * @param char1 the unicode <CODE>char</CODE> to get the width of
- * @return the width in normalized 1000 units
- */
- public int getWidth(char char1) {
- if (fastWinansi) {
- if (char1 < 128 || (char1 >= 160 && char1 <= 255))
- return widths[char1];
- return widths[PdfEncodings.winansi.get(char1)];
- }
- return getWidth(new String(new char[]{char1}));
- }
-
- /**
- * Gets the width of a <CODE>String</CODE> in normalized 1000 units.
- * @param text the <CODE>String</CODE> to get the witdth of
- * @return the width in normalized 1000 units
- */
- public int getWidth(String text) {
- int total = 0;
- if (fastWinansi) {
- int len = text.length();
- for (int k = 0; k < len; ++k) {
- char char1 = text.charAt(k);
- if (char1 < 128 || (char1 >= 160 && char1 <= 255))
- total += widths[char1];
- else
- total += widths[PdfEncodings.winansi.get(char1)];
- }
- return total;
- }
- else {
- byte mbytes[] = convertToBytes(text);
- for (int k = 0; k < mbytes.length; ++k)
- total += widths[0xff & mbytes[k]];
- }
- return total;
- }
-
-/**
- * Gets the descent of a <CODE>String</CODE> in normalized 1000 units. The descent will always be
- * less than or equal to zero even if all the characters have an higher descent.
- * @param text the <CODE>String</CODE> to get the descent of
- * @return the dexcent in normalized 1000 units
- */
- public int getDescent(String text) {
- int min = 0;
- char chars[] = text.toCharArray();
- for (int k = 0; k < chars.length; ++k) {
- int bbox[] = getCharBBox(chars[k]);
- if (bbox != null && bbox[1] < min)
- min = bbox[1];
- }
- return min;
- }
-
-/**
- * Gets the ascent of a <CODE>String</CODE> in normalized 1000 units. The ascent will always be
- * greater than or equal to zero even if all the characters have a lower ascent.
- * @param text the <CODE>String</CODE> to get the ascent of
- * @return the ascent in normalized 1000 units
- */
- public int getAscent(String text) {
- int max = 0;
- char chars[] = text.toCharArray();
- for (int k = 0; k < chars.length; ++k) {
- int bbox[] = getCharBBox(chars[k]);
- if (bbox != null && bbox[3] > max)
- max = bbox[3];
- }
- return max;
- }
-
-/**
- * Gets the descent of a <CODE>String</CODE> in points. The descent will always be
- * less than or equal to zero even if all the characters have an higher descent.
- * @param text the <CODE>String</CODE> to get the descent of
- * @param fontSize the size of the font
- * @return the dexcent in points
- */
- public float getDescentPoint(String text, float fontSize)
- {
- return (float)getDescent(text) * 0.001f * fontSize;
- }
-
-/**
- * Gets the ascent of a <CODE>String</CODE> in points. The ascent will always be
- * greater than or equal to zero even if all the characters have a lower ascent.
- * @param text the <CODE>String</CODE> to get the ascent of
- * @param fontSize the size of the font
- * @return the ascent in points
- */
- public float getAscentPoint(String text, float fontSize)
- {
- return (float)getAscent(text) * 0.001f * fontSize;
- }
-// ia>
-
- /**
- * Gets the width of a <CODE>String</CODE> in points taking kerning
- * into account.
- * @param text the <CODE>String</CODE> to get the witdth of
- * @param fontSize the font size
- * @return the width in points
- */
- public float getWidthPointKerned(String text, float fontSize) {
- float size = (float)getWidth(text) * 0.001f * fontSize;
- if (!hasKernPairs())
- return size;
- int len = text.length() - 1;
- int kern = 0;
- char c[] = text.toCharArray();
- for (int k = 0; k < len; ++k) {
- kern += getKerning(c[k], c[k + 1]);
- }
- return size + kern * 0.001f * fontSize;
- }
-
- /**
- * Gets the width of a <CODE>String</CODE> in points.
- * @param text the <CODE>String</CODE> to get the witdth of
- * @param fontSize the font size
- * @return the width in points
- */
- public float getWidthPoint(String text, float fontSize) {
- return (float)getWidth(text) * 0.001f * fontSize;
- }
-
- /**
- * Gets the width of a <CODE>char</CODE> in points.
- * @param char1 the <CODE>char</CODE> to get the witdth of
- * @param fontSize the font size
- * @return the width in points
- */
- public float getWidthPoint(char char1, float fontSize) {
- return getWidth(char1) * 0.001f * fontSize;
- }
-
- /**
- * Converts a <CODE>String</CODE> to a </CODE>byte</CODE> array according
- * to the font's encoding.
- * @param text the <CODE>String</CODE> to be converted
- * @return an array of <CODE>byte</CODE> representing the conversion according to the font's encoding
- */
- byte[] convertToBytes(String text) {
- if (directTextToByte)
- return PdfEncodings.convertToBytes(text, null);
- return PdfEncodings.convertToBytes(text, encoding);
- }
-
- /** Outputs to the writer the font dictionaries and streams.
- * @param writer the writer for this document
- * @param ref the font indirect reference
- * @param params several parameters that depend on the font type
- * @throws IOException on error
- * @throws DocumentException error in generating the object
- */
- abstract void writeFont(PdfWriter writer, PdfIndirectReference ref, Object params[]) throws DocumentException, IOException;
-
- /** Gets the encoding used to convert <CODE>String</CODE> into <CODE>byte[]</CODE>.
- * @return the encoding name
- */
- public String getEncoding() {
- return encoding;
- }
-
- /** Gets the font parameter identified by <CODE>key</CODE>. Valid values
- * for <CODE>key</CODE> are <CODE>ASCENT</CODE>, <CODE>AWT_ASCENT</CODE>, <CODE>CAPHEIGHT</CODE>,
- * <CODE>DESCENT</CODE>, <CODE>AWT_DESCENT</CODE>,
- * <CODE>ITALICANGLE</CODE>, <CODE>BBOXLLX</CODE>, <CODE>BBOXLLY</CODE>, <CODE>BBOXURX</CODE>
- * and <CODE>BBOXURY</CODE>.
- * @param key the parameter to be extracted
- * @param fontSize the font size in points
- * @return the parameter in points
- */
- public abstract float getFontDescriptor(int key, float fontSize);
-
- /** Gets the font type. The font types can be: FONT_TYPE_T1,
- * FONT_TYPE_TT, FONT_TYPE_CJK and FONT_TYPE_TTUNI.
- * @return the font type
- */
- public int getFontType() {
- return fontType;
- }
-
- /** Gets the embedded flag.
- * @return <CODE>true</CODE> if the font is embedded.
- */
- public boolean isEmbedded() {
- return embedded;
- }
-
- /** Gets the symbolic flag of the font.
- * @return <CODE>true</CODE> if the font is symbolic
- */
- public boolean isFontSpecific() {
- return fontSpecific;
- }
-
- /** Creates a unique subset prefix to be added to the font name when the font is embedded and subset.
- * @return the subset prefix
- */
- public static String createSubsetPrefix() {
- String s = "";
- for (int k = 0; k < 6; ++k)
- s += (char)(Math.random() * 26 + 'A');
- return s + "+";
- }
-
- /** Gets the Unicode character corresponding to the byte output to the pdf stream.
- * @param index the byte index
- * @return the Unicode character
- */
- char getUnicodeDifferences(int index) {
- return unicodeDifferences[index];
- }
-
- /** Gets the postscript font name.
- * @return the postscript font name
- */
- public abstract String getPostscriptFontName();
-
- /**
- * Sets the font name that will appear in the pdf font dictionary.
- * Use with care as it can easily make a font unreadable if not embedded.
- * @param name the new font name
- */
- public abstract void setPostscriptFontName(String name);
-
- /** Gets the full name of the font. If it is a True Type font
- * each array element will have {Platform ID, Platform Encoding ID,
- * Language ID, font name}. The interpretation of this values can be
- * found in the Open Type specification, chapter 2, in the 'name' table.<br>
- * For the other fonts the array has a single element with {"", "", "",
- * font name}.
- * @return the full name of the font
- */
- public abstract String[][] getFullFontName();
-
- /** Gets the full name of the font. If it is a True Type font
- * each array element will have {Platform ID, Platform Encoding ID,
- * Language ID, font name}. The interpretation of this values can be
- * found in the Open Type specification, chapter 2, in the 'name' table.<br>
- * For the other fonts the array has a single element with {"", "", "",
- * font name}.
- * @param name the name of the font
- * @param encoding the encoding of the font
- * @param ttfAfm the true type font or the afm in a byte array
- * @throws DocumentException on error
- * @throws IOException on error
- * @return the full name of the font
- */
- public static String[][] getFullFontName(String name, String encoding, byte ttfAfm[]) throws DocumentException, IOException {
- String nameBase = getBaseName(name);
- BaseFont fontBuilt = null;
- if (nameBase.toLowerCase().endsWith(".ttf") || nameBase.toLowerCase().endsWith(".otf") || nameBase.toLowerCase().indexOf(".ttc,") > 0)
- fontBuilt = new TrueTypeFont(name, CP1252, false, ttfAfm, true);
- else
- fontBuilt = createFont(name, encoding, false, false, ttfAfm, null);
- return fontBuilt.getFullFontName();
- }
-
- /** Gets all the names from the font. Only the required tables are read.
- * @param name the name of the font
- * @param encoding the encoding of the font
- * @param ttfAfm the true type font or the afm in a byte array
- * @throws DocumentException on error
- * @throws IOException on error
- * @return an array of Object[] built with {getPostscriptFontName(), getFamilyFontName(), getFullFontName()}
- */
- public static Object[] getAllFontNames(String name, String encoding, byte ttfAfm[]) throws DocumentException, IOException {
- String nameBase = getBaseName(name);
- BaseFont fontBuilt = null;
- if (nameBase.toLowerCase().endsWith(".ttf") || nameBase.toLowerCase().endsWith(".otf") || nameBase.toLowerCase().indexOf(".ttc,") > 0)
- fontBuilt = new TrueTypeFont(name, CP1252, false, ttfAfm, true);
- else
- fontBuilt = createFont(name, encoding, false, false, ttfAfm, null);
- return new Object[]{fontBuilt.getPostscriptFontName(), fontBuilt.getFamilyFontName(), fontBuilt.getFullFontName()};
- }
-
- /** Gets the family name of the font. If it is a True Type font
- * each array element will have {Platform ID, Platform Encoding ID,
- * Language ID, font name}. The interpretation of this values can be
- * found in the Open Type specification, chapter 2, in the 'name' table.<br>
- * For the other fonts the array has a single element with {"", "", "",
- * font name}.
- * @return the family name of the font
- */
- public abstract String[][] getFamilyFontName();
-
- /** Gets the code pages supported by the font. This has only meaning
- * with True Type fonts.
- * @return the code pages supported by the font
- */
- public String[] getCodePagesSupported() {
- return new String[0];
- }
-
- /** Enumerates the postscript font names present inside a
- * True Type Collection.
- * @param ttcFile the file name of the font
- * @throws DocumentException on error
- * @throws IOException on error
- * @return the postscript font names
- */
- public static String[] enumerateTTCNames(String ttcFile) throws DocumentException, IOException {
- return new EnumerateTTC(ttcFile).getNames();
- }
-
- /** Enumerates the postscript font names present inside a
- * True Type Collection.
- * @param ttcArray the font as a <CODE>byte</CODE> array
- * @throws DocumentException on error
- * @throws IOException on error
- * @return the postscript font names
- */
- public static String[] enumerateTTCNames(byte ttcArray[]) throws DocumentException, IOException {
- return new EnumerateTTC(ttcArray).getNames();
- }
-
- /** Gets the font width array.
- * @return the font width array
- */
- public int[] getWidths() {
- return widths;
- }
-
- /** Gets the array with the names of the characters.
- * @return the array with the names of the characters
- */
- public String[] getDifferences() {
- return differences;
- }
-
- /** Gets the array with the unicode characters.
- * @return the array with the unicode characters
- */
- public char[] getUnicodeDifferences() {
- return unicodeDifferences;
- }
-
- /** Gets the state of the property.
- * @return value of property forceWidthsOutput
- */
- public boolean isForceWidthsOutput() {
- return forceWidthsOutput;
- }
-
- /** Set to <CODE>true</CODE> to force the generation of the
- * widths array.
- * @param forceWidthsOutput <CODE>true</CODE> to force the generation of the
- * widths array
- */
- public void setForceWidthsOutput(boolean forceWidthsOutput) {
- this.forceWidthsOutput = forceWidthsOutput;
- }
-
- /** Gets the direct conversion of <CODE>char</CODE> to <CODE>byte</CODE>.
- * @return value of property directTextToByte.
- * @see #setDirectTextToByte(boolean directTextToByte)
- */
- public boolean isDirectTextToByte() {
- return directTextToByte;
- }
-
- /** Sets the conversion of <CODE>char</CODE> directly to <CODE>byte</CODE>
- * by casting. This is a low level feature to put the bytes directly in
- * the content stream without passing through String.getBytes().
- * @param directTextToByte New value of property directTextToByte.
- */
- public void setDirectTextToByte(boolean directTextToByte) {
- this.directTextToByte = directTextToByte;
- }
-
- /** Indicates if all the glyphs and widths for that particular
- * encoding should be included in the document.
- * @return <CODE>false</CODE> to include all the glyphs and widths.
- */
- public boolean isSubset() {
- return subset;
- }
-
- /** Indicates if all the glyphs and widths for that particular
- * encoding should be included in the document. Set to <CODE>false</CODE>
- * to include all.
- * @param subset new value of property subset
- */
- public void setSubset(boolean subset) {
- this.subset = subset;
- }
-
- /** Gets the font resources.
- * @param key the full name of the resource
- * @return the <CODE>InputStream</CODE> to get the resource or
- * <CODE>null</CODE> if not found
- */
- public static InputStream getResourceStream(String key) {
- return getResourceStream(key, null);
- }
-
- /** Gets the font resources.
- * @param key the full name of the resource
- * @param loader the ClassLoader to load the resource or null to try the ones available
- * @return the <CODE>InputStream</CODE> to get the resource or
- * <CODE>null</CODE> if not found
- */
- public static InputStream getResourceStream(String key, ClassLoader loader) {
- if (key.startsWith("/"))
- key = key.substring(1);
- InputStream is = null;
- if (loader != null) {
- is = loader.getResourceAsStream(key);
- if (is != null)
- return is;
- }
- // Try to use Context Class Loader to load the properties file.
- try {
- java.lang.reflect.Method getCCL =
- Thread.class.getMethod("getContextClassLoader", new Class[0]);
- if (getCCL != null) {
- ClassLoader contextClassLoader =
- (ClassLoader)getCCL.invoke(Thread.currentThread(),
- new Object[0]);
- if (contextClassLoader != null)
- is = contextClassLoader.getResourceAsStream(key);
- }
- } catch (Throwable e) {}
-
- if (is == null) {
- is = BaseFont.class.getResourceAsStream("/" + key);
- }
- if (is == null) {
- is = ClassLoader.getSystemResourceAsStream(key);
- }
- return is;
- }
-
- /** Gets the Unicode equivalent to a CID.
- * The (inexistent) CID <FF00> is translated as '\n'.
- * It has only meaning with CJK fonts with Identity encoding.
- * @param c the CID code
- * @return the Unicode equivalent
- */
- public char getUnicodeEquivalent(char c) {
- return c;
- }
-
- /** Gets the CID code given an Unicode.
- * It has only meaning with CJK fonts.
- * @param c the Unicode
- * @return the CID equivalent
- */
- public char getCidCode(char c) {
- return c;
- }
-
- /** Checks if the font has any kerning pairs.
- * @return <CODE>true</CODE> if the font has any kerning pairs
- */
- public abstract boolean hasKernPairs();
-
- /**
- * Checks if a character exists in this font.
- * @param c the character to check
- * @return <CODE>true</CODE> if the character has a glyph,
- * <CODE>false</CODE> otherwise
- */
- public boolean charExists(char c) {
- byte b[] = convertToBytes(new String(new char[]{c}));
- return b.length > 0;
- }
-
- /**
- * Sets the character advance.
- * @param c the character
- * @param advance the character advance normalized to 1000 units
- * @return <CODE>true</CODE> if the advance was set,
- * <CODE>false</CODE> otherwise
- */
- public boolean setCharAdvance(char c, int advance) {
- byte b[] = convertToBytes(new String(new char[]{c}));
- if (b.length == 0)
- return false;
- widths[0xff & b[0]] = advance;
- return true;
- }
-
- private static void addFont(PRIndirectReference fontRef, IntHashtable hits, ArrayList fonts) {
- PdfObject obj = PdfReader.getPdfObject(fontRef);
- if (!obj.isDictionary())
- return;
- PdfDictionary font = (PdfDictionary)obj;
- PdfName subtype = (PdfName)PdfReader.getPdfObject(font.get(PdfName.SUBTYPE));
- if (!PdfName.TYPE1.equals(subtype) && !PdfName.TRUETYPE.equals(subtype))
- return;
- PdfName name = (PdfName)PdfReader.getPdfObject(font.get(PdfName.BASEFONT));
- fonts.add(new Object[]{PdfName.decodeName(name.toString()), fontRef});
- hits.put(fontRef.getNumber(), 1);
- }
-
- private static void recourseFonts(PdfDictionary page, IntHashtable hits, ArrayList fonts, int level) {
- ++level;
- if (level > 50) // in case we have an endless loop
- return;
- PdfDictionary resources = (PdfDictionary)PdfReader.getPdfObject(page.get(PdfName.RESOURCES));
- if (resources == null)
- return;
- PdfDictionary font = (PdfDictionary)PdfReader.getPdfObject(resources.get(PdfName.FONT));
- if (font != null) {
- for (Iterator it = font.getKeys().iterator(); it.hasNext();) {
- PdfObject ft = font.get((PdfName)it.next());
- if (ft == null || !ft.isIndirect())
- continue;
- int hit = ((PRIndirectReference)ft).getNumber();
- if (hits.containsKey(hit))
- continue;
- addFont((PRIndirectReference)ft, hits, fonts);
- }
- }
- PdfDictionary xobj = (PdfDictionary)PdfReader.getPdfObject(resources.get(PdfName.XOBJECT));
- if (xobj != null) {
- for (Iterator it = xobj.getKeys().iterator(); it.hasNext();) {
- recourseFonts((PdfDictionary)PdfReader.getPdfObject(xobj.get((PdfName)it.next())), hits, fonts, level);
- }
- }
- }
-
- /**
- * Gets a list of all document fonts. Each element of the <CODE>ArrayList</CODE>
- * contains a <CODE>Object[]{String,PRIndirectReference}</CODE> with the font name
- * and the indirect reference to it.
- * @param reader the document where the fonts are to be listed from
- * @return the list of fonts and references
- */
- public static ArrayList getDocumentFonts(PdfReader reader) {
- IntHashtable hits = new IntHashtable();
- ArrayList fonts = new ArrayList();
- int npages = reader.getNumberOfPages();
- for (int k = 1; k <= npages; ++k)
- recourseFonts(reader.getPageN(k), hits, fonts, 1);
- return fonts;
- }
-
- /**
- * Gets a list of the document fonts in a particular page. Each element of the <CODE>ArrayList</CODE>
- * contains a <CODE>Object[]{String,PRIndirectReference}</CODE> with the font name
- * and the indirect reference to it.
- * @param reader the document where the fonts are to be listed from
- * @param page the page to list the fonts from
- * @return the list of fonts and references
- */
- public static ArrayList getDocumentFonts(PdfReader reader, int page) {
- IntHashtable hits = new IntHashtable();
- ArrayList fonts = new ArrayList();
- recourseFonts(reader.getPageN(page), hits, fonts, 1);
- return fonts;
- }
-
- /**
- * Gets the smallest box enclosing the character contours. It will return
- * <CODE>null</CODE> if the font has not the information or the character has no
- * contours, as in the case of the space, for example. Characters with no contours may
- * also return [0,0,0,0].
- * @param c the character to get the contour bounding box from
- * @return an array of four floats with the bounding box in the format [llx,lly,urx,ury] or
- * <code>null</code>
- */
- public int[] getCharBBox(char c) {
- byte b[] = convertToBytes(new String(new char[]{c}));
- if (b.length == 0)
- return null;
- else
- return charBBoxes[b[0] & 0xff];
- }
-
- protected abstract int[] getRawCharBBox(int c, String name);
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/BidiLine.java b/LibrarySource/com/lowagie/text/pdf/BidiLine.java
deleted file mode 100644
index cc35844..0000000
--- a/LibrarySource/com/lowagie/text/pdf/BidiLine.java
+++ /dev/null
@@ -1,915 +0,0 @@
-/*
- *
- * Copyright 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.util.ArrayList;
-
-import com.lowagie.text.Chunk;
-
-/** Does all the line bidirectional processing with PdfChunk assembly.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class BidiLine {
-
- protected int runDirection;
- protected int pieceSize = 2048;
- protected char text[] = new char[pieceSize];
- protected PdfChunk detailChunks[] = new PdfChunk[pieceSize];
- protected int totalTextLength = 0;
-
- protected byte orderLevels[] = new byte[pieceSize];
- protected int indexChars[] = new int[pieceSize];
-
- protected ArrayList chunks = new ArrayList();
- protected int indexChunk = 0;
- protected int indexChunkChar = 0;
- protected int currentChar = 0;
-
- protected int storedRunDirection;
- protected char storedText[] = new char[0];
- protected PdfChunk storedDetailChunks[] = new PdfChunk[0];
- protected int storedTotalTextLength = 0;
-
- protected byte storedOrderLevels[] = new byte[0];
- protected int storedIndexChars[] = new int[0];
-
- protected int storedIndexChunk = 0;
- protected int storedIndexChunkChar = 0;
- protected int storedCurrentChar = 0;
-
- protected boolean shortStore;
-// protected ArabicShaping arabic = new ArabicShaping(ArabicShaping.LETTERS_SHAPE | ArabicShaping.LENGTH_GROW_SHRINK | ArabicShaping.TEXT_DIRECTION_LOGICAL);
- protected static final IntHashtable mirrorChars = new IntHashtable();
- protected int arabicOptions;
-
- /** Creates new BidiLine */
- public BidiLine() {
- }
-
- public BidiLine(BidiLine org) {
- runDirection = org.runDirection;
- pieceSize = org.pieceSize;
- text = (char[])org.text.clone();
- detailChunks = (PdfChunk[])org.detailChunks.clone();
- totalTextLength = org.totalTextLength;
-
- orderLevels = (byte[])org.orderLevels.clone();
- indexChars = (int[])org.indexChars.clone();
-
- chunks = new ArrayList(org.chunks);
- indexChunk = org.indexChunk;
- indexChunkChar = org.indexChunkChar;
- currentChar = org.currentChar;
-
- storedRunDirection = org.storedRunDirection;
- storedText = (char[])org.storedText.clone();
- storedDetailChunks = (PdfChunk[])org.storedDetailChunks.clone();
- storedTotalTextLength = org.storedTotalTextLength;
-
- storedOrderLevels = (byte[])org.storedOrderLevels.clone();
- storedIndexChars = (int[])org.storedIndexChars.clone();
-
- storedIndexChunk = org.storedIndexChunk;
- storedIndexChunkChar = org.storedIndexChunkChar;
- storedCurrentChar = org.storedCurrentChar;
-
- shortStore = org.shortStore;
- arabicOptions = org.arabicOptions;
- }
-
- public boolean isEmpty() {
- return (currentChar >= totalTextLength && indexChunk >= chunks.size());
- }
-
- public void clearChunks() {
- chunks.clear();
- totalTextLength = 0;
- currentChar = 0;
- }
-
- public boolean getParagraph(int runDirection) {
- this.runDirection = runDirection;
- currentChar = 0;
- totalTextLength = 0;
- boolean hasText = false;
- char c;
- char uniC;
- BaseFont bf;
- for (; indexChunk < chunks.size(); ++indexChunk) {
- PdfChunk ck = (PdfChunk)chunks.get(indexChunk);
- bf = ck.font().getFont();
- String s = ck.toString();
- int len = s.length();
- for (; indexChunkChar < len; ++indexChunkChar) {
- c = s.charAt(indexChunkChar);
- uniC = bf.getUnicodeEquivalent(c);
- if (uniC == '\r' || uniC == '\n') {
- // next condition is never true for CID
- if (uniC == '\r' && indexChunkChar + 1 < len && s.charAt(indexChunkChar + 1) == '\n')
- ++indexChunkChar;
- ++indexChunkChar;
- if (indexChunkChar >= len) {
- indexChunkChar = 0;
- ++indexChunk;
- }
- hasText = true;
- if (totalTextLength == 0)
- detailChunks[0] = ck;
- break;
- }
- addPiece(c, ck);
- }
- if (hasText)
- break;
- indexChunkChar = 0;
- }
- if (totalTextLength == 0)
- return hasText;
-
- // remove trailing WS
- totalTextLength = trimRight(0, totalTextLength - 1) + 1;
- if (totalTextLength == 0)
- return true;
-
- if (runDirection == PdfWriter.RUN_DIRECTION_LTR || runDirection == PdfWriter.RUN_DIRECTION_RTL) {
- if (orderLevels.length < totalTextLength) {
- orderLevels = new byte[pieceSize];
- indexChars = new int[pieceSize];
- }
- ArabicLigaturizer.processNumbers(text, 0, totalTextLength, arabicOptions);
- BidiOrder order = new BidiOrder(text, 0, totalTextLength, (byte)(runDirection == PdfWriter.RUN_DIRECTION_RTL ? 1 : 0));
- byte od[] = order.getLevels();
- for (int k = 0; k < totalTextLength; ++k) {
- orderLevels[k] = od[k];
- indexChars[k] = k;
- }
- doArabicShapping();
- mirrorGlyphs();
- }
- totalTextLength = trimRightEx(0, totalTextLength - 1) + 1;
- return true;
- }
-
- public void addChunk(PdfChunk chunk) {
- chunks.add(chunk);
- }
-
- public void addChunks(ArrayList chunks) {
- this.chunks.addAll(chunks);
- }
-
- public void addPiece(char c, PdfChunk chunk) {
- if (totalTextLength >= pieceSize) {
- char tempText[] = text;
- PdfChunk tempDetailChunks[] = detailChunks;
- pieceSize *= 2;
- text = new char[pieceSize];
- detailChunks = new PdfChunk[pieceSize];
- System.arraycopy(tempText, 0, text, 0, totalTextLength);
- System.arraycopy(tempDetailChunks, 0, detailChunks, 0, totalTextLength);
- }
- text[totalTextLength] = c;
- detailChunks[totalTextLength++] = chunk;
- }
-
- public void save() {
- if (indexChunk > 0) {
- if (indexChunk >= chunks.size())
- chunks.clear();
- else {
- for (--indexChunk; indexChunk >= 0; --indexChunk)
- chunks.remove(indexChunk);
- }
- indexChunk = 0;
- }
- storedRunDirection = runDirection;
- storedTotalTextLength = totalTextLength;
- storedIndexChunk = indexChunk;
- storedIndexChunkChar = indexChunkChar;
- storedCurrentChar = currentChar;
- shortStore = (currentChar < totalTextLength);
- if (!shortStore) {
- // long save
- if (storedText.length < totalTextLength) {
- storedText = new char[totalTextLength];
- storedDetailChunks = new PdfChunk[totalTextLength];
- }
- System.arraycopy(text, 0, storedText, 0, totalTextLength);
- System.arraycopy(detailChunks, 0, storedDetailChunks, 0, totalTextLength);
- }
- if (runDirection == PdfWriter.RUN_DIRECTION_LTR || runDirection == PdfWriter.RUN_DIRECTION_RTL) {
- if (storedOrderLevels.length < totalTextLength) {
- storedOrderLevels = new byte[totalTextLength];
- storedIndexChars = new int[totalTextLength];
- }
- System.arraycopy(orderLevels, currentChar, storedOrderLevels, currentChar, totalTextLength - currentChar);
- System.arraycopy(indexChars, currentChar, storedIndexChars, currentChar, totalTextLength - currentChar);
- }
- }
-
- public void restore() {
- runDirection = storedRunDirection;
- totalTextLength = storedTotalTextLength;
- indexChunk = storedIndexChunk;
- indexChunkChar = storedIndexChunkChar;
- currentChar = storedCurrentChar;
- if (!shortStore) {
- // long restore
- System.arraycopy(storedText, 0, text, 0, totalTextLength);
- System.arraycopy(storedDetailChunks, 0, detailChunks, 0, totalTextLength);
- }
- if (runDirection == PdfWriter.RUN_DIRECTION_LTR || runDirection == PdfWriter.RUN_DIRECTION_RTL) {
- System.arraycopy(storedOrderLevels, currentChar, orderLevels, currentChar, totalTextLength - currentChar);
- System.arraycopy(storedIndexChars, currentChar, indexChars, currentChar, totalTextLength - currentChar);
- }
- }
-
- public void mirrorGlyphs() {
- for (int k = 0; k < totalTextLength; ++k) {
- if ((orderLevels[k] & 1) == 1) {
- int mirror = mirrorChars.get(text[k]);
- if (mirror != 0)
- text[k] = (char)mirror;
- }
- }
- }
-
- public void doArabicShapping() {
- int src = 0;
- int dest = 0;
- for (;;) {
- while (src < totalTextLength) {
- char c = text[src];
- if (c >= 0x0600 && c <= 0x06ff)
- break;
- if (src != dest) {
- text[dest] = text[src];
- detailChunks[dest] = detailChunks[src];
- orderLevels[dest] = orderLevels[src];
- }
- ++src;
- ++dest;
- }
- if (src >= totalTextLength) {
- totalTextLength = dest;
- return;
- }
- int startArabicIdx = src;
- ++src;
- while (src < totalTextLength) {
- char c = text[src];
- if (c < 0x0600 || c > 0x06ff)
- break;
- ++src;
- }
- int arabicWordSize = src - startArabicIdx;
- int size = ArabicLigaturizer.arabic_shape(text, startArabicIdx, arabicWordSize, text, dest, arabicWordSize, arabicOptions /*PangoArabicShapping.ar_novowel PangoArabicShapping.ar_lig | PangoArabicShapping.ar_composedtashkeel*/);
- if (startArabicIdx != dest) {
- for (int k = 0; k < size; ++k) {
- detailChunks[dest] = detailChunks[startArabicIdx];
- orderLevels[dest++] = orderLevels[startArabicIdx++];
- }
- }
- else
- dest += size;
- }
- }
-
- public PdfLine processLine(float width, int alignment, int runDirection, int arabicOptions) {
- this.arabicOptions = arabicOptions;
- save();
- boolean isRTL = (runDirection == PdfWriter.RUN_DIRECTION_RTL);
- if (currentChar >= totalTextLength) {
- boolean hasText = getParagraph(runDirection);
- if (!hasText)
- return null;
- if (totalTextLength == 0) {
- ArrayList ar = new ArrayList();
- PdfChunk ck = new PdfChunk("", detailChunks[0]);
- ar.add(ck);
- return new PdfLine(0, 0, alignment, true, ar, isRTL);
- }
- }
- float originalWidth = width;
- int lastSplit = -1;
- if (currentChar != 0)
- currentChar = trimLeftEx(currentChar, totalTextLength - 1);
- int oldCurrentChar = currentChar;
- char c = 0;
- char uniC = 0;
- PdfChunk ck = null;
- float charWidth = 0;
- PdfChunk lastValidChunk = null;
- for (; currentChar < totalTextLength; ++currentChar) {
- c = text[currentChar];
- ck = detailChunks[currentChar];
- uniC = ck.getUnicodeEquivalent(c);
- if (PdfChunk.noPrint(uniC))
- continue;
- charWidth = ck.getCharWidth(c);
- if (ck.isExtSplitCharacter(oldCurrentChar, currentChar, totalTextLength, text, detailChunks))
- lastSplit = currentChar;
- if (width - charWidth < 0)
- break;
- width -= charWidth;
- lastValidChunk = ck;
- }
- if (lastValidChunk == null) {
- // not even a single char fit; must output the first char
- ++currentChar;
- return new PdfLine(0, 0, alignment, false, createArrayOfPdfChunks(currentChar - 1, currentChar - 1), isRTL);
- }
- if (currentChar >= totalTextLength) {
- // there was more line than text
- return new PdfLine(0, width, alignment, true, createArrayOfPdfChunks(oldCurrentChar, totalTextLength - 1), isRTL);
- }
- int newCurrentChar = trimRightEx(oldCurrentChar, currentChar - 1);
- if (newCurrentChar < oldCurrentChar) {
- // only WS
- return new PdfLine(0, width, alignment, false, createArrayOfPdfChunks(oldCurrentChar, currentChar - 1), isRTL);
- }
- if (newCurrentChar == currentChar - 1) { // middle of word
- HyphenationEvent he = (HyphenationEvent)lastValidChunk.getAttribute(Chunk.HYPHENATION);
- if (he != null) {
- int word[] = getWord(oldCurrentChar, newCurrentChar);
- if (word != null) {
- float testWidth = width + getWidth(word[0], currentChar - 1);
- String pre = he.getHyphenatedWordPre(new String(text, word[0], word[1] - word[0]), lastValidChunk.font().getFont(), lastValidChunk.font().size(), testWidth);
- String post = he.getHyphenatedWordPost();
- if (pre.length() > 0) {
- PdfChunk extra = new PdfChunk(pre, lastValidChunk);
- currentChar = word[1] - post.length();
- return new PdfLine(0, testWidth - lastValidChunk.font().width(pre), alignment, false, createArrayOfPdfChunks(oldCurrentChar, word[0] - 1, extra), isRTL);
- }
- }
- }
- }
- if (lastSplit == -1 || lastSplit >= newCurrentChar) {
- // no split point or split point ahead of end
- return new PdfLine(0, width + getWidth(newCurrentChar + 1, currentChar - 1), alignment, false, createArrayOfPdfChunks(oldCurrentChar, newCurrentChar), isRTL);
- }
- // standard split
- currentChar = lastSplit + 1;
- newCurrentChar = trimRightEx(oldCurrentChar, lastSplit);
- if (newCurrentChar < oldCurrentChar) {
- // only WS again
- newCurrentChar = currentChar - 1;
- }
- return new PdfLine(0, originalWidth - getWidth(oldCurrentChar, newCurrentChar), alignment, false, createArrayOfPdfChunks(oldCurrentChar, newCurrentChar), isRTL);
- }
-
- /** Gets the width of a range of characters.
- * @param startIdx the first index to calculate
- * @param lastIdx the last inclusive index to calculate
- * @return the sum of all widths
- */
- public float getWidth(int startIdx, int lastIdx) {
- char c = 0;
- char uniC;
- PdfChunk ck = null;
- float width = 0;
- for (; startIdx <= lastIdx; ++startIdx) {
- c = text[startIdx];
- ck = detailChunks[startIdx];
- uniC = ck.getUnicodeEquivalent(c);
- if (PdfChunk.noPrint(uniC))
- continue;
- width += detailChunks[startIdx].getCharWidth(c);
- }
- return width;
- }
-
- public ArrayList createArrayOfPdfChunks(int startIdx, int endIdx) {
- return createArrayOfPdfChunks(startIdx, endIdx, null);
- }
-
- public ArrayList createArrayOfPdfChunks(int startIdx, int endIdx, PdfChunk extraPdfChunk) {
- boolean bidi = (runDirection == PdfWriter.RUN_DIRECTION_LTR || runDirection == PdfWriter.RUN_DIRECTION_RTL);
- if (bidi)
- reorder(startIdx, endIdx);
- ArrayList ar = new ArrayList();
- PdfChunk refCk = detailChunks[startIdx];
- PdfChunk ck = null;
- StringBuffer buf = new StringBuffer();
- char c;
- int idx = 0;
- for (; startIdx <= endIdx; ++startIdx) {
- idx = bidi ? indexChars[startIdx] : startIdx;
- c = text[idx];
- ck = detailChunks[idx];
- if (PdfChunk.noPrint(ck.getUnicodeEquivalent(c)))
- continue;
- if (ck.isImage()) {
- if (buf.length() > 0) {
- ar.add(new PdfChunk(buf.toString(), refCk));
- buf = new StringBuffer();
- }
- ar.add(ck);
- }
- else if (ck == refCk) {
- buf.append(c);
- }
- else {
- if (buf.length() > 0) {
- ar.add(new PdfChunk(buf.toString(), refCk));
- buf = new StringBuffer();
- }
- if (!ck.isImage())
- buf.append(c);
- refCk = ck;
- }
- }
- if (buf.length() > 0) {
- ar.add(new PdfChunk(buf.toString(), refCk));
- }
- if (extraPdfChunk != null)
- ar.add(extraPdfChunk);
- return ar;
- }
-
- public int[] getWord(int startIdx, int idx) {
- int last = idx;
- int first = idx;
- // forward
- for (; last < totalTextLength; ++last) {
- if (!Character.isLetter(text[last]))
- break;
- }
- if (last == idx)
- return null;
- // backward
- for (; first >= startIdx; --first) {
- if (!Character.isLetter(text[first]))
- break;
- }
- ++first;
- return new int[]{first, last};
- }
-
- public int trimRight(int startIdx, int endIdx) {
- int idx = endIdx;
- char c;
- for (; idx >= startIdx; --idx) {
- c = detailChunks[idx].getUnicodeEquivalent(text[idx]);
- if (!isWS(c))
- break;
- }
- return idx;
- }
-
- public int trimLeft(int startIdx, int endIdx) {
- int idx = startIdx;
- char c;
- for (; idx <= endIdx; ++idx) {
- c = detailChunks[idx].getUnicodeEquivalent(text[idx]);
- if (!isWS(c))
- break;
- }
- return idx;
- }
-
- public int trimRightEx(int startIdx, int endIdx) {
- int idx = endIdx;
- char c = 0;
- for (; idx >= startIdx; --idx) {
- c = detailChunks[idx].getUnicodeEquivalent(text[idx]);
- if (!isWS(c) && !PdfChunk.noPrint(c))
- break;
- }
- return idx;
- }
-
- public int trimLeftEx(int startIdx, int endIdx) {
- int idx = startIdx;
- char c = 0;
- for (; idx <= endIdx; ++idx) {
- c = detailChunks[idx].getUnicodeEquivalent(text[idx]);
- if (!isWS(c) && !PdfChunk.noPrint(c))
- break;
- }
- return idx;
- }
-
- public void reorder(int start, int end) {
- byte maxLevel = orderLevels[start];
- byte minLevel = maxLevel;
- byte onlyOddLevels = maxLevel;
- byte onlyEvenLevels = maxLevel;
- for (int k = start + 1; k <= end; ++k) {
- byte b = orderLevels[k];
- if (b > maxLevel)
- maxLevel = b;
- else if (b < minLevel)
- minLevel = b;
- onlyOddLevels &= b;
- onlyEvenLevels |= b;
- }
- if ((onlyEvenLevels & 1) == 0) // nothing to do
- return;
- if ((onlyOddLevels & 1) == 1) { // single inversion
- flip(start, end + 1);
- return;
- }
- minLevel |= 1;
- for (; maxLevel >= minLevel; --maxLevel) {
- int pstart = start;
- for (;;) {
- for (;pstart <= end; ++pstart) {
- if (orderLevels[pstart] >= maxLevel)
- break;
- }
- if (pstart > end)
- break;
- int pend = pstart + 1;
- for (; pend <= end; ++pend) {
- if (orderLevels[pend] < maxLevel)
- break;
- }
- flip(pstart, pend);
- pstart = pend + 1;
- }
- }
- }
-
- public void flip(int start, int end) {
- int mid = (start + end) / 2;
- --end;
- for (; start < mid; ++start, --end) {
- int temp = indexChars[start];
- indexChars[start] = indexChars[end];
- indexChars[end] = temp;
- }
- }
-
- public static boolean isWS(char c) {
- return (c <= ' ');
- }
-
- static {
- mirrorChars.put(0x0028, 0x0029); // LEFT PARENTHESIS
- mirrorChars.put(0x0029, 0x0028); // RIGHT PARENTHESIS
- mirrorChars.put(0x003C, 0x003E); // LESS-THAN SIGN
- mirrorChars.put(0x003E, 0x003C); // GREATER-THAN SIGN
- mirrorChars.put(0x005B, 0x005D); // LEFT SQUARE BRACKET
- mirrorChars.put(0x005D, 0x005B); // RIGHT SQUARE BRACKET
- mirrorChars.put(0x007B, 0x007D); // LEFT CURLY BRACKET
- mirrorChars.put(0x007D, 0x007B); // RIGHT CURLY BRACKET
- mirrorChars.put(0x00AB, 0x00BB); // LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
- mirrorChars.put(0x00BB, 0x00AB); // RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
- mirrorChars.put(0x2039, 0x203A); // SINGLE LEFT-POINTING ANGLE QUOTATION MARK
- mirrorChars.put(0x203A, 0x2039); // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
- mirrorChars.put(0x2045, 0x2046); // LEFT SQUARE BRACKET WITH QUILL
- mirrorChars.put(0x2046, 0x2045); // RIGHT SQUARE BRACKET WITH QUILL
- mirrorChars.put(0x207D, 0x207E); // SUPERSCRIPT LEFT PARENTHESIS
- mirrorChars.put(0x207E, 0x207D); // SUPERSCRIPT RIGHT PARENTHESIS
- mirrorChars.put(0x208D, 0x208E); // SUBSCRIPT LEFT PARENTHESIS
- mirrorChars.put(0x208E, 0x208D); // SUBSCRIPT RIGHT PARENTHESIS
- mirrorChars.put(0x2208, 0x220B); // ELEMENT OF
- mirrorChars.put(0x2209, 0x220C); // NOT AN ELEMENT OF
- mirrorChars.put(0x220A, 0x220D); // SMALL ELEMENT OF
- mirrorChars.put(0x220B, 0x2208); // CONTAINS AS MEMBER
- mirrorChars.put(0x220C, 0x2209); // DOES NOT CONTAIN AS MEMBER
- mirrorChars.put(0x220D, 0x220A); // SMALL CONTAINS AS MEMBER
- mirrorChars.put(0x2215, 0x29F5); // DIVISION SLASH
- mirrorChars.put(0x223C, 0x223D); // TILDE OPERATOR
- mirrorChars.put(0x223D, 0x223C); // REVERSED TILDE
- mirrorChars.put(0x2243, 0x22CD); // ASYMPTOTICALLY EQUAL TO
- mirrorChars.put(0x2252, 0x2253); // APPROXIMATELY EQUAL TO OR THE IMAGE OF
- mirrorChars.put(0x2253, 0x2252); // IMAGE OF OR APPROXIMATELY EQUAL TO
- mirrorChars.put(0x2254, 0x2255); // COLON EQUALS
- mirrorChars.put(0x2255, 0x2254); // EQUALS COLON
- mirrorChars.put(0x2264, 0x2265); // LESS-THAN OR EQUAL TO
- mirrorChars.put(0x2265, 0x2264); // GREATER-THAN OR EQUAL TO
- mirrorChars.put(0x2266, 0x2267); // LESS-THAN OVER EQUAL TO
- mirrorChars.put(0x2267, 0x2266); // GREATER-THAN OVER EQUAL TO
- mirrorChars.put(0x2268, 0x2269); // [BEST FIT] LESS-THAN BUT NOT EQUAL TO
- mirrorChars.put(0x2269, 0x2268); // [BEST FIT] GREATER-THAN BUT NOT EQUAL TO
- mirrorChars.put(0x226A, 0x226B); // MUCH LESS-THAN
- mirrorChars.put(0x226B, 0x226A); // MUCH GREATER-THAN
- mirrorChars.put(0x226E, 0x226F); // [BEST FIT] NOT LESS-THAN
- mirrorChars.put(0x226F, 0x226E); // [BEST FIT] NOT GREATER-THAN
- mirrorChars.put(0x2270, 0x2271); // [BEST FIT] NEITHER LESS-THAN NOR EQUAL TO
- mirrorChars.put(0x2271, 0x2270); // [BEST FIT] NEITHER GREATER-THAN NOR EQUAL TO
- mirrorChars.put(0x2272, 0x2273); // [BEST FIT] LESS-THAN OR EQUIVALENT TO
- mirrorChars.put(0x2273, 0x2272); // [BEST FIT] GREATER-THAN OR EQUIVALENT TO
- mirrorChars.put(0x2274, 0x2275); // [BEST FIT] NEITHER LESS-THAN NOR EQUIVALENT TO
- mirrorChars.put(0x2275, 0x2274); // [BEST FIT] NEITHER GREATER-THAN NOR EQUIVALENT TO
- mirrorChars.put(0x2276, 0x2277); // LESS-THAN OR GREATER-THAN
- mirrorChars.put(0x2277, 0x2276); // GREATER-THAN OR LESS-THAN
- mirrorChars.put(0x2278, 0x2279); // NEITHER LESS-THAN NOR GREATER-THAN
- mirrorChars.put(0x2279, 0x2278); // NEITHER GREATER-THAN NOR LESS-THAN
- mirrorChars.put(0x227A, 0x227B); // PRECEDES
- mirrorChars.put(0x227B, 0x227A); // SUCCEEDS
- mirrorChars.put(0x227C, 0x227D); // PRECEDES OR EQUAL TO
- mirrorChars.put(0x227D, 0x227C); // SUCCEEDS OR EQUAL TO
- mirrorChars.put(0x227E, 0x227F); // [BEST FIT] PRECEDES OR EQUIVALENT TO
- mirrorChars.put(0x227F, 0x227E); // [BEST FIT] SUCCEEDS OR EQUIVALENT TO
- mirrorChars.put(0x2280, 0x2281); // [BEST FIT] DOES NOT PRECEDE
- mirrorChars.put(0x2281, 0x2280); // [BEST FIT] DOES NOT SUCCEED
- mirrorChars.put(0x2282, 0x2283); // SUBSET OF
- mirrorChars.put(0x2283, 0x2282); // SUPERSET OF
- mirrorChars.put(0x2284, 0x2285); // [BEST FIT] NOT A SUBSET OF
- mirrorChars.put(0x2285, 0x2284); // [BEST FIT] NOT A SUPERSET OF
- mirrorChars.put(0x2286, 0x2287); // SUBSET OF OR EQUAL TO
- mirrorChars.put(0x2287, 0x2286); // SUPERSET OF OR EQUAL TO
- mirrorChars.put(0x2288, 0x2289); // [BEST FIT] NEITHER A SUBSET OF NOR EQUAL TO
- mirrorChars.put(0x2289, 0x2288); // [BEST FIT] NEITHER A SUPERSET OF NOR EQUAL TO
- mirrorChars.put(0x228A, 0x228B); // [BEST FIT] SUBSET OF WITH NOT EQUAL TO
- mirrorChars.put(0x228B, 0x228A); // [BEST FIT] SUPERSET OF WITH NOT EQUAL TO
- mirrorChars.put(0x228F, 0x2290); // SQUARE IMAGE OF
- mirrorChars.put(0x2290, 0x228F); // SQUARE ORIGINAL OF
- mirrorChars.put(0x2291, 0x2292); // SQUARE IMAGE OF OR EQUAL TO
- mirrorChars.put(0x2292, 0x2291); // SQUARE ORIGINAL OF OR EQUAL TO
- mirrorChars.put(0x2298, 0x29B8); // CIRCLED DIVISION SLASH
- mirrorChars.put(0x22A2, 0x22A3); // RIGHT TACK
- mirrorChars.put(0x22A3, 0x22A2); // LEFT TACK
- mirrorChars.put(0x22A6, 0x2ADE); // ASSERTION
- mirrorChars.put(0x22A8, 0x2AE4); // TRUE
- mirrorChars.put(0x22A9, 0x2AE3); // FORCES
- mirrorChars.put(0x22AB, 0x2AE5); // DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE
- mirrorChars.put(0x22B0, 0x22B1); // PRECEDES UNDER RELATION
- mirrorChars.put(0x22B1, 0x22B0); // SUCCEEDS UNDER RELATION
- mirrorChars.put(0x22B2, 0x22B3); // NORMAL SUBGROUP OF
- mirrorChars.put(0x22B3, 0x22B2); // CONTAINS AS NORMAL SUBGROUP
- mirrorChars.put(0x22B4, 0x22B5); // NORMAL SUBGROUP OF OR EQUAL TO
- mirrorChars.put(0x22B5, 0x22B4); // CONTAINS AS NORMAL SUBGROUP OR EQUAL TO
- mirrorChars.put(0x22B6, 0x22B7); // ORIGINAL OF
- mirrorChars.put(0x22B7, 0x22B6); // IMAGE OF
- mirrorChars.put(0x22C9, 0x22CA); // LEFT NORMAL FACTOR SEMIDIRECT PRODUCT
- mirrorChars.put(0x22CA, 0x22C9); // RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT
- mirrorChars.put(0x22CB, 0x22CC); // LEFT SEMIDIRECT PRODUCT
- mirrorChars.put(0x22CC, 0x22CB); // RIGHT SEMIDIRECT PRODUCT
- mirrorChars.put(0x22CD, 0x2243); // REVERSED TILDE EQUALS
- mirrorChars.put(0x22D0, 0x22D1); // DOUBLE SUBSET
- mirrorChars.put(0x22D1, 0x22D0); // DOUBLE SUPERSET
- mirrorChars.put(0x22D6, 0x22D7); // LESS-THAN WITH DOT
- mirrorChars.put(0x22D7, 0x22D6); // GREATER-THAN WITH DOT
- mirrorChars.put(0x22D8, 0x22D9); // VERY MUCH LESS-THAN
- mirrorChars.put(0x22D9, 0x22D8); // VERY MUCH GREATER-THAN
- mirrorChars.put(0x22DA, 0x22DB); // LESS-THAN EQUAL TO OR GREATER-THAN
- mirrorChars.put(0x22DB, 0x22DA); // GREATER-THAN EQUAL TO OR LESS-THAN
- mirrorChars.put(0x22DC, 0x22DD); // EQUAL TO OR LESS-THAN
- mirrorChars.put(0x22DD, 0x22DC); // EQUAL TO OR GREATER-THAN
- mirrorChars.put(0x22DE, 0x22DF); // EQUAL TO OR PRECEDES
- mirrorChars.put(0x22DF, 0x22DE); // EQUAL TO OR SUCCEEDS
- mirrorChars.put(0x22E0, 0x22E1); // [BEST FIT] DOES NOT PRECEDE OR EQUAL
- mirrorChars.put(0x22E1, 0x22E0); // [BEST FIT] DOES NOT SUCCEED OR EQUAL
- mirrorChars.put(0x22E2, 0x22E3); // [BEST FIT] NOT SQUARE IMAGE OF OR EQUAL TO
- mirrorChars.put(0x22E3, 0x22E2); // [BEST FIT] NOT SQUARE ORIGINAL OF OR EQUAL TO
- mirrorChars.put(0x22E4, 0x22E5); // [BEST FIT] SQUARE IMAGE OF OR NOT EQUAL TO
- mirrorChars.put(0x22E5, 0x22E4); // [BEST FIT] SQUARE ORIGINAL OF OR NOT EQUAL TO
- mirrorChars.put(0x22E6, 0x22E7); // [BEST FIT] LESS-THAN BUT NOT EQUIVALENT TO
- mirrorChars.put(0x22E7, 0x22E6); // [BEST FIT] GREATER-THAN BUT NOT EQUIVALENT TO
- mirrorChars.put(0x22E8, 0x22E9); // [BEST FIT] PRECEDES BUT NOT EQUIVALENT TO
- mirrorChars.put(0x22E9, 0x22E8); // [BEST FIT] SUCCEEDS BUT NOT EQUIVALENT TO
- mirrorChars.put(0x22EA, 0x22EB); // [BEST FIT] NOT NORMAL SUBGROUP OF
- mirrorChars.put(0x22EB, 0x22EA); // [BEST FIT] DOES NOT CONTAIN AS NORMAL SUBGROUP
- mirrorChars.put(0x22EC, 0x22ED); // [BEST FIT] NOT NORMAL SUBGROUP OF OR EQUAL TO
- mirrorChars.put(0x22ED, 0x22EC); // [BEST FIT] DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL
- mirrorChars.put(0x22F0, 0x22F1); // UP RIGHT DIAGONAL ELLIPSIS
- mirrorChars.put(0x22F1, 0x22F0); // DOWN RIGHT DIAGONAL ELLIPSIS
- mirrorChars.put(0x22F2, 0x22FA); // ELEMENT OF WITH LONG HORIZONTAL STROKE
- mirrorChars.put(0x22F3, 0x22FB); // ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
- mirrorChars.put(0x22F4, 0x22FC); // SMALL ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
- mirrorChars.put(0x22F6, 0x22FD); // ELEMENT OF WITH OVERBAR
- mirrorChars.put(0x22F7, 0x22FE); // SMALL ELEMENT OF WITH OVERBAR
- mirrorChars.put(0x22FA, 0x22F2); // CONTAINS WITH LONG HORIZONTAL STROKE
- mirrorChars.put(0x22FB, 0x22F3); // CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
- mirrorChars.put(0x22FC, 0x22F4); // SMALL CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
- mirrorChars.put(0x22FD, 0x22F6); // CONTAINS WITH OVERBAR
- mirrorChars.put(0x22FE, 0x22F7); // SMALL CONTAINS WITH OVERBAR
- mirrorChars.put(0x2308, 0x2309); // LEFT CEILING
- mirrorChars.put(0x2309, 0x2308); // RIGHT CEILING
- mirrorChars.put(0x230A, 0x230B); // LEFT FLOOR
- mirrorChars.put(0x230B, 0x230A); // RIGHT FLOOR
- mirrorChars.put(0x2329, 0x232A); // LEFT-POINTING ANGLE BRACKET
- mirrorChars.put(0x232A, 0x2329); // RIGHT-POINTING ANGLE BRACKET
- mirrorChars.put(0x2768, 0x2769); // MEDIUM LEFT PARENTHESIS ORNAMENT
- mirrorChars.put(0x2769, 0x2768); // MEDIUM RIGHT PARENTHESIS ORNAMENT
- mirrorChars.put(0x276A, 0x276B); // MEDIUM FLATTENED LEFT PARENTHESIS ORNAMENT
- mirrorChars.put(0x276B, 0x276A); // MEDIUM FLATTENED RIGHT PARENTHESIS ORNAMENT
- mirrorChars.put(0x276C, 0x276D); // MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT
- mirrorChars.put(0x276D, 0x276C); // MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT
- mirrorChars.put(0x276E, 0x276F); // HEAVY LEFT-POINTING ANGLE QUOTATION MARK ORNAMENT
- mirrorChars.put(0x276F, 0x276E); // HEAVY RIGHT-POINTING ANGLE QUOTATION MARK ORNAMENT
- mirrorChars.put(0x2770, 0x2771); // HEAVY LEFT-POINTING ANGLE BRACKET ORNAMENT
- mirrorChars.put(0x2771, 0x2770); // HEAVY RIGHT-POINTING ANGLE BRACKET ORNAMENT
- mirrorChars.put(0x2772, 0x2773); // LIGHT LEFT TORTOISE SHELL BRACKET
- mirrorChars.put(0x2773, 0x2772); // LIGHT RIGHT TORTOISE SHELL BRACKET
- mirrorChars.put(0x2774, 0x2775); // MEDIUM LEFT CURLY BRACKET ORNAMENT
- mirrorChars.put(0x2775, 0x2774); // MEDIUM RIGHT CURLY BRACKET ORNAMENT
- mirrorChars.put(0x27D5, 0x27D6); // LEFT OUTER JOIN
- mirrorChars.put(0x27D6, 0x27D5); // RIGHT OUTER JOIN
- mirrorChars.put(0x27DD, 0x27DE); // LONG RIGHT TACK
- mirrorChars.put(0x27DE, 0x27DD); // LONG LEFT TACK
- mirrorChars.put(0x27E2, 0x27E3); // WHITE CONCAVE-SIDED DIAMOND WITH LEFTWARDS TICK
- mirrorChars.put(0x27E3, 0x27E2); // WHITE CONCAVE-SIDED DIAMOND WITH RIGHTWARDS TICK
- mirrorChars.put(0x27E4, 0x27E5); // WHITE SQUARE WITH LEFTWARDS TICK
- mirrorChars.put(0x27E5, 0x27E4); // WHITE SQUARE WITH RIGHTWARDS TICK
- mirrorChars.put(0x27E6, 0x27E7); // MATHEMATICAL LEFT WHITE SQUARE BRACKET
- mirrorChars.put(0x27E7, 0x27E6); // MATHEMATICAL RIGHT WHITE SQUARE BRACKET
- mirrorChars.put(0x27E8, 0x27E9); // MATHEMATICAL LEFT ANGLE BRACKET
- mirrorChars.put(0x27E9, 0x27E8); // MATHEMATICAL RIGHT ANGLE BRACKET
- mirrorChars.put(0x27EA, 0x27EB); // MATHEMATICAL LEFT DOUBLE ANGLE BRACKET
- mirrorChars.put(0x27EB, 0x27EA); // MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET
- mirrorChars.put(0x2983, 0x2984); // LEFT WHITE CURLY BRACKET
- mirrorChars.put(0x2984, 0x2983); // RIGHT WHITE CURLY BRACKET
- mirrorChars.put(0x2985, 0x2986); // LEFT WHITE PARENTHESIS
- mirrorChars.put(0x2986, 0x2985); // RIGHT WHITE PARENTHESIS
- mirrorChars.put(0x2987, 0x2988); // Z NOTATION LEFT IMAGE BRACKET
- mirrorChars.put(0x2988, 0x2987); // Z NOTATION RIGHT IMAGE BRACKET
- mirrorChars.put(0x2989, 0x298A); // Z NOTATION LEFT BINDING BRACKET
- mirrorChars.put(0x298A, 0x2989); // Z NOTATION RIGHT BINDING BRACKET
- mirrorChars.put(0x298B, 0x298C); // LEFT SQUARE BRACKET WITH UNDERBAR
- mirrorChars.put(0x298C, 0x298B); // RIGHT SQUARE BRACKET WITH UNDERBAR
- mirrorChars.put(0x298D, 0x2990); // LEFT SQUARE BRACKET WITH TICK IN TOP CORNER
- mirrorChars.put(0x298E, 0x298F); // RIGHT SQUARE BRACKET WITH TICK IN BOTTOM CORNER
- mirrorChars.put(0x298F, 0x298E); // LEFT SQUARE BRACKET WITH TICK IN BOTTOM CORNER
- mirrorChars.put(0x2990, 0x298D); // RIGHT SQUARE BRACKET WITH TICK IN TOP CORNER
- mirrorChars.put(0x2991, 0x2992); // LEFT ANGLE BRACKET WITH DOT
- mirrorChars.put(0x2992, 0x2991); // RIGHT ANGLE BRACKET WITH DOT
- mirrorChars.put(0x2993, 0x2994); // LEFT ARC LESS-THAN BRACKET
- mirrorChars.put(0x2994, 0x2993); // RIGHT ARC GREATER-THAN BRACKET
- mirrorChars.put(0x2995, 0x2996); // DOUBLE LEFT ARC GREATER-THAN BRACKET
- mirrorChars.put(0x2996, 0x2995); // DOUBLE RIGHT ARC LESS-THAN BRACKET
- mirrorChars.put(0x2997, 0x2998); // LEFT BLACK TORTOISE SHELL BRACKET
- mirrorChars.put(0x2998, 0x2997); // RIGHT BLACK TORTOISE SHELL BRACKET
- mirrorChars.put(0x29B8, 0x2298); // CIRCLED REVERSE SOLIDUS
- mirrorChars.put(0x29C0, 0x29C1); // CIRCLED LESS-THAN
- mirrorChars.put(0x29C1, 0x29C0); // CIRCLED GREATER-THAN
- mirrorChars.put(0x29C4, 0x29C5); // SQUARED RISING DIAGONAL SLASH
- mirrorChars.put(0x29C5, 0x29C4); // SQUARED FALLING DIAGONAL SLASH
- mirrorChars.put(0x29CF, 0x29D0); // LEFT TRIANGLE BESIDE VERTICAL BAR
- mirrorChars.put(0x29D0, 0x29CF); // VERTICAL BAR BESIDE RIGHT TRIANGLE
- mirrorChars.put(0x29D1, 0x29D2); // BOWTIE WITH LEFT HALF BLACK
- mirrorChars.put(0x29D2, 0x29D1); // BOWTIE WITH RIGHT HALF BLACK
- mirrorChars.put(0x29D4, 0x29D5); // TIMES WITH LEFT HALF BLACK
- mirrorChars.put(0x29D5, 0x29D4); // TIMES WITH RIGHT HALF BLACK
- mirrorChars.put(0x29D8, 0x29D9); // LEFT WIGGLY FENCE
- mirrorChars.put(0x29D9, 0x29D8); // RIGHT WIGGLY FENCE
- mirrorChars.put(0x29DA, 0x29DB); // LEFT DOUBLE WIGGLY FENCE
- mirrorChars.put(0x29DB, 0x29DA); // RIGHT DOUBLE WIGGLY FENCE
- mirrorChars.put(0x29F5, 0x2215); // REVERSE SOLIDUS OPERATOR
- mirrorChars.put(0x29F8, 0x29F9); // BIG SOLIDUS
- mirrorChars.put(0x29F9, 0x29F8); // BIG REVERSE SOLIDUS
- mirrorChars.put(0x29FC, 0x29FD); // LEFT-POINTING CURVED ANGLE BRACKET
- mirrorChars.put(0x29FD, 0x29FC); // RIGHT-POINTING CURVED ANGLE BRACKET
- mirrorChars.put(0x2A2B, 0x2A2C); // MINUS SIGN WITH FALLING DOTS
- mirrorChars.put(0x2A2C, 0x2A2B); // MINUS SIGN WITH RISING DOTS
- mirrorChars.put(0x2A2D, 0x2A2C); // PLUS SIGN IN LEFT HALF CIRCLE
- mirrorChars.put(0x2A2E, 0x2A2D); // PLUS SIGN IN RIGHT HALF CIRCLE
- mirrorChars.put(0x2A34, 0x2A35); // MULTIPLICATION SIGN IN LEFT HALF CIRCLE
- mirrorChars.put(0x2A35, 0x2A34); // MULTIPLICATION SIGN IN RIGHT HALF CIRCLE
- mirrorChars.put(0x2A3C, 0x2A3D); // INTERIOR PRODUCT
- mirrorChars.put(0x2A3D, 0x2A3C); // RIGHTHAND INTERIOR PRODUCT
- mirrorChars.put(0x2A64, 0x2A65); // Z NOTATION DOMAIN ANTIRESTRICTION
- mirrorChars.put(0x2A65, 0x2A64); // Z NOTATION RANGE ANTIRESTRICTION
- mirrorChars.put(0x2A79, 0x2A7A); // LESS-THAN WITH CIRCLE INSIDE
- mirrorChars.put(0x2A7A, 0x2A79); // GREATER-THAN WITH CIRCLE INSIDE
- mirrorChars.put(0x2A7D, 0x2A7E); // LESS-THAN OR SLANTED EQUAL TO
- mirrorChars.put(0x2A7E, 0x2A7D); // GREATER-THAN OR SLANTED EQUAL TO
- mirrorChars.put(0x2A7F, 0x2A80); // LESS-THAN OR SLANTED EQUAL TO WITH DOT INSIDE
- mirrorChars.put(0x2A80, 0x2A7F); // GREATER-THAN OR SLANTED EQUAL TO WITH DOT INSIDE
- mirrorChars.put(0x2A81, 0x2A82); // LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE
- mirrorChars.put(0x2A82, 0x2A81); // GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE
- mirrorChars.put(0x2A83, 0x2A84); // LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE RIGHT
- mirrorChars.put(0x2A84, 0x2A83); // GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE LEFT
- mirrorChars.put(0x2A8B, 0x2A8C); // LESS-THAN ABOVE DOUBLE-LINE EQUAL ABOVE GREATER-THAN
- mirrorChars.put(0x2A8C, 0x2A8B); // GREATER-THAN ABOVE DOUBLE-LINE EQUAL ABOVE LESS-THAN
- mirrorChars.put(0x2A91, 0x2A92); // LESS-THAN ABOVE GREATER-THAN ABOVE DOUBLE-LINE EQUAL
- mirrorChars.put(0x2A92, 0x2A91); // GREATER-THAN ABOVE LESS-THAN ABOVE DOUBLE-LINE EQUAL
- mirrorChars.put(0x2A93, 0x2A94); // LESS-THAN ABOVE SLANTED EQUAL ABOVE GREATER-THAN ABOVE SLANTED EQUAL
- mirrorChars.put(0x2A94, 0x2A93); // GREATER-THAN ABOVE SLANTED EQUAL ABOVE LESS-THAN ABOVE SLANTED EQUAL
- mirrorChars.put(0x2A95, 0x2A96); // SLANTED EQUAL TO OR LESS-THAN
- mirrorChars.put(0x2A96, 0x2A95); // SLANTED EQUAL TO OR GREATER-THAN
- mirrorChars.put(0x2A97, 0x2A98); // SLANTED EQUAL TO OR LESS-THAN WITH DOT INSIDE
- mirrorChars.put(0x2A98, 0x2A97); // SLANTED EQUAL TO OR GREATER-THAN WITH DOT INSIDE
- mirrorChars.put(0x2A99, 0x2A9A); // DOUBLE-LINE EQUAL TO OR LESS-THAN
- mirrorChars.put(0x2A9A, 0x2A99); // DOUBLE-LINE EQUAL TO OR GREATER-THAN
- mirrorChars.put(0x2A9B, 0x2A9C); // DOUBLE-LINE SLANTED EQUAL TO OR LESS-THAN
- mirrorChars.put(0x2A9C, 0x2A9B); // DOUBLE-LINE SLANTED EQUAL TO OR GREATER-THAN
- mirrorChars.put(0x2AA1, 0x2AA2); // DOUBLE NESTED LESS-THAN
- mirrorChars.put(0x2AA2, 0x2AA1); // DOUBLE NESTED GREATER-THAN
- mirrorChars.put(0x2AA6, 0x2AA7); // LESS-THAN CLOSED BY CURVE
- mirrorChars.put(0x2AA7, 0x2AA6); // GREATER-THAN CLOSED BY CURVE
- mirrorChars.put(0x2AA8, 0x2AA9); // LESS-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL
- mirrorChars.put(0x2AA9, 0x2AA8); // GREATER-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL
- mirrorChars.put(0x2AAA, 0x2AAB); // SMALLER THAN
- mirrorChars.put(0x2AAB, 0x2AAA); // LARGER THAN
- mirrorChars.put(0x2AAC, 0x2AAD); // SMALLER THAN OR EQUAL TO
- mirrorChars.put(0x2AAD, 0x2AAC); // LARGER THAN OR EQUAL TO
- mirrorChars.put(0x2AAF, 0x2AB0); // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN
- mirrorChars.put(0x2AB0, 0x2AAF); // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN
- mirrorChars.put(0x2AB3, 0x2AB4); // PRECEDES ABOVE EQUALS SIGN
- mirrorChars.put(0x2AB4, 0x2AB3); // SUCCEEDS ABOVE EQUALS SIGN
- mirrorChars.put(0x2ABB, 0x2ABC); // DOUBLE PRECEDES
- mirrorChars.put(0x2ABC, 0x2ABB); // DOUBLE SUCCEEDS
- mirrorChars.put(0x2ABD, 0x2ABE); // SUBSET WITH DOT
- mirrorChars.put(0x2ABE, 0x2ABD); // SUPERSET WITH DOT
- mirrorChars.put(0x2ABF, 0x2AC0); // SUBSET WITH PLUS SIGN BELOW
- mirrorChars.put(0x2AC0, 0x2ABF); // SUPERSET WITH PLUS SIGN BELOW
- mirrorChars.put(0x2AC1, 0x2AC2); // SUBSET WITH MULTIPLICATION SIGN BELOW
- mirrorChars.put(0x2AC2, 0x2AC1); // SUPERSET WITH MULTIPLICATION SIGN BELOW
- mirrorChars.put(0x2AC3, 0x2AC4); // SUBSET OF OR EQUAL TO WITH DOT ABOVE
- mirrorChars.put(0x2AC4, 0x2AC3); // SUPERSET OF OR EQUAL TO WITH DOT ABOVE
- mirrorChars.put(0x2AC5, 0x2AC6); // SUBSET OF ABOVE EQUALS SIGN
- mirrorChars.put(0x2AC6, 0x2AC5); // SUPERSET OF ABOVE EQUALS SIGN
- mirrorChars.put(0x2ACD, 0x2ACE); // SQUARE LEFT OPEN BOX OPERATOR
- mirrorChars.put(0x2ACE, 0x2ACD); // SQUARE RIGHT OPEN BOX OPERATOR
- mirrorChars.put(0x2ACF, 0x2AD0); // CLOSED SUBSET
- mirrorChars.put(0x2AD0, 0x2ACF); // CLOSED SUPERSET
- mirrorChars.put(0x2AD1, 0x2AD2); // CLOSED SUBSET OR EQUAL TO
- mirrorChars.put(0x2AD2, 0x2AD1); // CLOSED SUPERSET OR EQUAL TO
- mirrorChars.put(0x2AD3, 0x2AD4); // SUBSET ABOVE SUPERSET
- mirrorChars.put(0x2AD4, 0x2AD3); // SUPERSET ABOVE SUBSET
- mirrorChars.put(0x2AD5, 0x2AD6); // SUBSET ABOVE SUBSET
- mirrorChars.put(0x2AD6, 0x2AD5); // SUPERSET ABOVE SUPERSET
- mirrorChars.put(0x2ADE, 0x22A6); // SHORT LEFT TACK
- mirrorChars.put(0x2AE3, 0x22A9); // DOUBLE VERTICAL BAR LEFT TURNSTILE
- mirrorChars.put(0x2AE4, 0x22A8); // VERTICAL BAR DOUBLE LEFT TURNSTILE
- mirrorChars.put(0x2AE5, 0x22AB); // DOUBLE VERTICAL BAR DOUBLE LEFT TURNSTILE
- mirrorChars.put(0x2AEC, 0x2AED); // DOUBLE STROKE NOT SIGN
- mirrorChars.put(0x2AED, 0x2AEC); // REVERSED DOUBLE STROKE NOT SIGN
- mirrorChars.put(0x2AF7, 0x2AF8); // TRIPLE NESTED LESS-THAN
- mirrorChars.put(0x2AF8, 0x2AF7); // TRIPLE NESTED GREATER-THAN
- mirrorChars.put(0x2AF9, 0x2AFA); // DOUBLE-LINE SLANTED LESS-THAN OR EQUAL TO
- mirrorChars.put(0x2AFA, 0x2AF9); // DOUBLE-LINE SLANTED GREATER-THAN OR EQUAL TO
- mirrorChars.put(0x3008, 0x3009); // LEFT ANGLE BRACKET
- mirrorChars.put(0x3009, 0x3008); // RIGHT ANGLE BRACKET
- mirrorChars.put(0x300A, 0x300B); // LEFT DOUBLE ANGLE BRACKET
- mirrorChars.put(0x300B, 0x300A); // RIGHT DOUBLE ANGLE BRACKET
- mirrorChars.put(0x300C, 0x300D); // [BEST FIT] LEFT CORNER BRACKET
- mirrorChars.put(0x300D, 0x300C); // [BEST FIT] RIGHT CORNER BRACKET
- mirrorChars.put(0x300E, 0x300F); // [BEST FIT] LEFT WHITE CORNER BRACKET
- mirrorChars.put(0x300F, 0x300E); // [BEST FIT] RIGHT WHITE CORNER BRACKET
- mirrorChars.put(0x3010, 0x3011); // LEFT BLACK LENTICULAR BRACKET
- mirrorChars.put(0x3011, 0x3010); // RIGHT BLACK LENTICULAR BRACKET
- mirrorChars.put(0x3014, 0x3015); // LEFT TORTOISE SHELL BRACKET
- mirrorChars.put(0x3015, 0x3014); // RIGHT TORTOISE SHELL BRACKET
- mirrorChars.put(0x3016, 0x3017); // LEFT WHITE LENTICULAR BRACKET
- mirrorChars.put(0x3017, 0x3016); // RIGHT WHITE LENTICULAR BRACKET
- mirrorChars.put(0x3018, 0x3019); // LEFT WHITE TORTOISE SHELL BRACKET
- mirrorChars.put(0x3019, 0x3018); // RIGHT WHITE TORTOISE SHELL BRACKET
- mirrorChars.put(0x301A, 0x301B); // LEFT WHITE SQUARE BRACKET
- mirrorChars.put(0x301B, 0x301A); // RIGHT WHITE SQUARE BRACKET
- mirrorChars.put(0xFF08, 0xFF09); // FULLWIDTH LEFT PARENTHESIS
- mirrorChars.put(0xFF09, 0xFF08); // FULLWIDTH RIGHT PARENTHESIS
- mirrorChars.put(0xFF1C, 0xFF1E); // FULLWIDTH LESS-THAN SIGN
- mirrorChars.put(0xFF1E, 0xFF1C); // FULLWIDTH GREATER-THAN SIGN
- mirrorChars.put(0xFF3B, 0xFF3D); // FULLWIDTH LEFT SQUARE BRACKET
- mirrorChars.put(0xFF3D, 0xFF3B); // FULLWIDTH RIGHT SQUARE BRACKET
- mirrorChars.put(0xFF5B, 0xFF5D); // FULLWIDTH LEFT CURLY BRACKET
- mirrorChars.put(0xFF5D, 0xFF5B); // FULLWIDTH RIGHT CURLY BRACKET
- mirrorChars.put(0xFF5F, 0xFF60); // FULLWIDTH LEFT WHITE PARENTHESIS
- mirrorChars.put(0xFF60, 0xFF5F); // FULLWIDTH RIGHT WHITE PARENTHESIS
- mirrorChars.put(0xFF62, 0xFF63); // [BEST FIT] HALFWIDTH LEFT CORNER BRACKET
- mirrorChars.put(0xFF63, 0xFF62); // [BEST FIT] HALFWIDTH RIGHT CORNER BRACKET
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/BidiOrder.java b/LibrarySource/com/lowagie/text/pdf/BidiOrder.java
deleted file mode 100644
index 93dd829..0000000
--- a/LibrarySource/com/lowagie/text/pdf/BidiOrder.java
+++ /dev/null
@@ -1,1241 +0,0 @@
-package com.lowagie.text.pdf;
-
-/*
- *
- * Copyright 2003 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-/*
- * (C) Copyright IBM Corp. 1999, All Rights Reserved
- *
- * version 1.1
- */
-
-/**
- * Reference implementation of the Unicode 3.0 Bidi algorithm.
- *
- * <p>
- * This implementation is not optimized for performance. It is intended
- * as a reference implementation that closely follows the specification
- * of the Bidirectional Algorithm in The Unicode Standard version 3.0.
- * <p>
- * <b>Input:</b><br>
- * There are two levels of input to the algorithm, since clients may prefer
- * to supply some information from out-of-band sources rather than relying on
- * the default behavior.
- * <ol>
- * <li>unicode type array
- * <li>unicode type array, with externally supplied base line direction
- * </ol>
- * <p><b>Output:</b><br>
- * Output is separated into several stages as well, to better enable clients
- * to evaluate various aspects of implementation conformance.
- * <ol>
- * <li>levels array over entire paragraph
- * <li>reordering array over entire paragraph
- * <li>levels array over line
- * <li>reordering array over line
- * </ol>
- * Note that for conformance, algorithms are only required to generate correct
- * reordering and character directionality (odd or even levels) over a line.
- * Generating identical level arrays over a line is not required. Bidi
- * explicit format codes (LRE, RLE, LRO, RLO, PDF) and BN can be assigned
- * arbitrary levels and positions as long as the other text matches.
- * <p>
- * As the algorithm is defined to operate on a single paragraph at a time,
- * this implementation is written to handle single paragraphs. Thus
- * rule P1 is presumed by this implementation-- the data provided to the
- * implementation is assumed to be a single paragraph, and either contains no
- * 'B' codes, or a single 'B' code at the end of the input. 'B' is allowed
- * as input to illustrate how the algorithm assigns it a level.
- * <p>
- * Also note that rules L3 and L4 depend on the rendering engine that uses
- * the result of the bidi algorithm. This implementation assumes that the
- * rendering engine expects combining marks in visual order (e.g. to the
- * left of their base character in RTL runs) and that it adjust the glyphs
- * used to render mirrored characters that are in RTL runs so that they
- * render appropriately.
- *
- * @author Doug Felt
- */
-
-public final class BidiOrder {
- private byte[] initialTypes;
- private byte[] embeddings; // generated from processing format codes
- private byte paragraphEmbeddingLevel = -1; // undefined
-
- private int textLength; // for convenience
- private byte[] resultTypes; // for paragraph, not lines
- private byte[] resultLevels; // for paragraph, not lines
-
- // The bidi types
-
- /** Left-to-right*/
- public static final byte L = 0;
-
- /** Left-to-Right Embedding */
- public static final byte LRE = 1;
-
- /** Left-to-Right Override */
- public static final byte LRO = 2;
-
- /** Right-to-Left */
- public static final byte R = 3;
-
- /** Right-to-Left Arabic */
- public static final byte AL = 4;
-
- /** Right-to-Left Embedding */
- public static final byte RLE = 5;
-
- /** Right-to-Left Override */
- public static final byte RLO = 6;
-
- /** Pop Directional Format */
- public static final byte PDF = 7;
-
- /** European Number */
- public static final byte EN = 8;
-
- /** European Number Separator */
- public static final byte ES = 9;
-
- /** European Number Terminator */
- public static final byte ET = 10;
-
- /** Arabic Number */
- public static final byte AN = 11;
-
- /** Common Number Separator */
- public static final byte CS = 12;
-
- /** Non-Spacing Mark */
- public static final byte NSM = 13;
-
- /** Boundary Neutral */
- public static final byte BN = 14;
-
- /** Paragraph Separator */
- public static final byte B = 15;
-
- /** Segment Separator */
- public static final byte S = 16;
-
- /** Whitespace */
- public static final byte WS = 17;
-
- /** Other Neutrals */
- public static final byte ON = 18;
-
- /** Minimum bidi type value. */
- public static final byte TYPE_MIN = 0;
-
- /** Maximum bidi type value. */
- public static final byte TYPE_MAX = 18;
-
- //
- // Input
- //
-
- /**
- * Initialize using an array of direction types. Types range from TYPE_MIN to TYPE_MAX inclusive
- * and represent the direction codes of the characters in the text.
- *
- * @param types the types array
- */
- public BidiOrder(byte[] types) {
- validateTypes(types);
-
- this.initialTypes = (byte[])types.clone(); // client type array remains unchanged
-
- runAlgorithm();
- }
-
- /**
- * Initialize using an array of direction types and an externally supplied paragraph embedding level.
- * The embedding level may be -1, 0, or 1. -1 means to apply the default algorithm (rules P2 and P3),
- * 0 is for LTR paragraphs, and 1 is for RTL paragraphs.
- *
- * @param types the types array
- * @param paragraphEmbeddingLevel the externally supplied paragraph embedding level.
- */
- public BidiOrder(byte[] types, byte paragraphEmbeddingLevel) {
- validateTypes(types);
- validateParagraphEmbeddingLevel(paragraphEmbeddingLevel);
-
- this.initialTypes = (byte[])types.clone(); // client type array remains unchanged
- this.paragraphEmbeddingLevel = paragraphEmbeddingLevel;
-
- runAlgorithm();
- }
-
- public BidiOrder(char text[], int offset, int length, byte paragraphEmbeddingLevel) {
- initialTypes = new byte[length];
- for (int k = 0; k < length; ++k) {
- initialTypes[k] = rtypes[text[offset + k]];
- }
- validateParagraphEmbeddingLevel(paragraphEmbeddingLevel);
-
- this.paragraphEmbeddingLevel = paragraphEmbeddingLevel;
-
- runAlgorithm();
- }
-
- public final static byte getDirection(char c) {
- return rtypes[c];
- }
-
- /**
- * The algorithm.
- * Does not include line-based processing (Rules L1, L2).
- * These are applied later in the line-based phase of the algorithm.
- */
- private void runAlgorithm() {
- textLength = initialTypes.length;
-
- // Initialize output types.
- // Result types initialized to input types.
- resultTypes = (byte[])initialTypes.clone();
-
-
- // 1) determining the paragraph level
- // Rule P1 is the requirement for entering this algorithm.
- // Rules P2, P3.
- // If no externally supplied paragraph embedding level, use default.
- if (paragraphEmbeddingLevel == -1) {
- determineParagraphEmbeddingLevel();
- }
-
- // Initialize result levels to paragraph embedding level.
- resultLevels = new byte[textLength];
- setLevels(0, textLength, paragraphEmbeddingLevel);
-
- // 2) Explicit levels and directions
- // Rules X1-X8.
- determineExplicitEmbeddingLevels();
-
- // Rule X9.
- textLength = removeExplicitCodes();
-
- // Rule X10.
- // Run remainder of algorithm one level run at a time
- byte prevLevel = paragraphEmbeddingLevel;
- int start = 0;
- while (start < textLength) {
- byte level = resultLevels[start];
- byte prevType = typeForLevel(Math.max(prevLevel, level));
-
- int limit = start + 1;
- while (limit < textLength && resultLevels[limit] == level) {
- ++limit;
- }
-
- byte succLevel = limit < textLength ? resultLevels[limit] : paragraphEmbeddingLevel;
- byte succType = typeForLevel(Math.max(succLevel, level));
-
- // 3) resolving weak types
- // Rules W1-W7.
- resolveWeakTypes(start, limit, level, prevType, succType);
-
- // 4) resolving neutral types
- // Rules N1-N3.
- resolveNeutralTypes(start, limit, level, prevType, succType);
-
- // 5) resolving implicit embedding levels
- // Rules I1, I2.
- resolveImplicitLevels(start, limit, level, prevType, succType);
-
- prevLevel = level;
- start = limit;
- }
-
- // Reinsert explicit codes and assign appropriate levels to 'hide' them.
- // This is for convenience, so the resulting level array maps 1-1
- // with the initial array.
- // See the implementation suggestions section of TR#9 for guidelines on
- // how to implement the algorithm without removing and reinserting the codes.
- textLength = reinsertExplicitCodes(textLength);
- }
-
- /**
- * 1) determining the paragraph level.
- * <p>
- * Rules P2, P3.
- * <p>
- * At the end of this function, the member variable paragraphEmbeddingLevel is set to either 0 or 1.
- */
- private void determineParagraphEmbeddingLevel() {
- byte strongType = -1; // unknown
-
- // Rule P2.
- for (int i = 0; i < textLength; ++i) {
- byte t = resultTypes[i];
- if (t == L || t == AL || t == R) {
- strongType = t;
- break;
- }
- }
-
- // Rule P3.
- if (strongType == -1) { // none found
- // default embedding level when no strong types found is 0.
- paragraphEmbeddingLevel = 0;
- } else if (strongType == L) {
- paragraphEmbeddingLevel = 0;
- } else { // AL, R
- paragraphEmbeddingLevel = 1;
- }
- }
-
- /**
- * Process embedding format codes.
- * <p>
- * Calls processEmbeddings to generate an embedding array from the explicit format codes. The
- * embedding overrides in the array are then applied to the result types, and the result levels are
- * initialized.
- * @see #processEmbeddings
- */
- private void determineExplicitEmbeddingLevels() {
- embeddings = processEmbeddings(resultTypes, paragraphEmbeddingLevel);
-
- for (int i = 0; i < textLength; ++i) {
- byte level = embeddings[i];
- if ((level & 0x80) != 0) {
- level &= 0x7f;
- resultTypes[i] = typeForLevel(level);
- }
- resultLevels[i] = level;
- }
- }
-
- /**
- * Rules X9.
- * Remove explicit codes so that they may be ignored during the remainder
- * of the main portion of the algorithm. The length of the resulting text
- * is returned.
- * @return the length of the data excluding explicit codes and BN.
- */
- private int removeExplicitCodes() {
- int w = 0;
- for (int i = 0; i < textLength; ++i) {
- byte t = initialTypes[i];
- if (!(t == LRE || t == RLE || t == LRO || t == RLO || t == PDF || t == BN)) {
- embeddings[w] = embeddings[i];
- resultTypes[w] = resultTypes[i];
- resultLevels[w] = resultLevels[i];
- w++;
- }
- }
- return w; // new textLength while explicit levels are removed
- }
-
- /**
- * Reinsert levels information for explicit codes.
- * This is for ease of relating the level information
- * to the original input data. Note that the levels
- * assigned to these codes are arbitrary, they're
- * chosen so as to avoid breaking level runs.
- * @param textLength the length of the data after compression
- * @return the length of the data (original length of
- * types array supplied to constructor)
- */
- private int reinsertExplicitCodes(int textLength) {
- int r = textLength;
- for (int i = initialTypes.length; --i >= 0;) {
- byte t = initialTypes[i];
- if (t == LRE || t == RLE || t == LRO || t == RLO || t == PDF || t == BN) {
- embeddings[i] = 0;
- resultTypes[i] = t;
- resultLevels[i] = -1;
- } else {
- --textLength;
- embeddings[i] = embeddings[textLength];
- resultTypes[i] = resultTypes[textLength];
- resultLevels[i] = resultLevels[textLength];
- }
- }
-
- // now propagate forward the levels information (could have
- // propagated backward, the main thing is not to introduce a level
- // break where one doesn't already exist).
-
- if (resultLevels[0] == -1) {
- resultLevels[0] = paragraphEmbeddingLevel;
- }
- for (int i = 1; i < initialTypes.length; ++i) {
- if (resultLevels[i] == -1) {
- resultLevels[i] = resultLevels[i-1];
- }
- }
-
- // Embedding information is for informational purposes only
- // so need not be adjusted.
-
- return initialTypes.length;
- }
-
- /**
- * 2) determining explicit levels
- * Rules X1 - X8
- *
- * The interaction of these rules makes handling them a bit complex.
- * This examines resultTypes but does not modify it. It returns embedding and
- * override information in the result array. The low 7 bits are the level, the high
- * bit is set if the level is an override, and clear if it is an embedding.
- */
- private static byte[] processEmbeddings(byte[] resultTypes, byte paragraphEmbeddingLevel) {
- final int EXPLICIT_LEVEL_LIMIT = 62;
-
- int textLength = resultTypes.length;
- byte[] embeddings = new byte[textLength];
-
- // This stack will store the embedding levels and override status in a single byte
- // as described above.
- byte[] embeddingValueStack = new byte[EXPLICIT_LEVEL_LIMIT];
- int stackCounter = 0;
-
- // An LRE or LRO at level 60 is invalid, since the new level 62 is invalid. But
- // an RLE at level 60 is valid, since the new level 61 is valid. The current wording
- // of the rules requires that the RLE remain valid even if a previous LRE is invalid.
- // This keeps track of ignored LRE or LRO codes at level 60, so that the matching PDFs
- // will not try to pop the stack.
- int overflowAlmostCounter = 0;
-
- // This keeps track of ignored pushes at level 61 or higher, so that matching PDFs will
- // not try to pop the stack.
- int overflowCounter = 0;
-
- // Rule X1.
-
- // Keep the level separate from the value (level | override status flag) for ease of access.
- byte currentEmbeddingLevel = paragraphEmbeddingLevel;
- byte currentEmbeddingValue = paragraphEmbeddingLevel;
-
- // Loop through types, handling all remaining rules
- for (int i = 0; i < textLength; ++i) {
-
- embeddings[i] = currentEmbeddingValue;
-
- byte t = resultTypes[i];
-
- // Rules X2, X3, X4, X5
- switch (t) {
- case RLE:
- case LRE:
- case RLO:
- case LRO:
- // Only need to compute new level if current level is valid
- if (overflowCounter == 0) {
- byte newLevel;
- if (t == RLE || t == RLO) {
- newLevel = (byte)((currentEmbeddingLevel + 1) | 1); // least greater odd
- } else { // t == LRE || t == LRO
- newLevel = (byte)((currentEmbeddingLevel + 2) & ~1); // least greater even
- }
-
- // If the new level is valid, push old embedding level and override status
- // No check for valid stack counter, since the level check suffices.
- if (newLevel < EXPLICIT_LEVEL_LIMIT) {
- embeddingValueStack[stackCounter] = currentEmbeddingValue;
- stackCounter++;
-
- currentEmbeddingLevel = newLevel;
- if (t == LRO || t == RLO) { // override
- currentEmbeddingValue = (byte)(newLevel | 0x80);
- } else {
- currentEmbeddingValue = newLevel;
- }
-
- // Adjust level of format mark (for expositional purposes only, this gets
- // removed later).
- embeddings[i] = currentEmbeddingValue;
- break;
- }
-
- // Otherwise new level is invalid, but a valid level can still be achieved if this
- // level is 60 and we encounter an RLE or RLO further on. So record that we
- // 'almost' overflowed.
- if (currentEmbeddingLevel == 60) {
- overflowAlmostCounter++;
- break;
- }
- }
-
- // Otherwise old or new level is invalid.
- overflowCounter++;
- break;
-
- case PDF:
- // The only case where this did not actually overflow but may have almost overflowed
- // is when there was an RLE or RLO on level 60, which would result in level 61. So we
- // only test the almost overflow condition in that case.
- //
- // Also note that there may be a PDF without any pushes at all.
-
- if (overflowCounter > 0) {
- --overflowCounter;
- } else if (overflowAlmostCounter > 0 && currentEmbeddingLevel != 61) {
- --overflowAlmostCounter;
- } else if (stackCounter > 0) {
- --stackCounter;
- currentEmbeddingValue = embeddingValueStack[stackCounter];
- currentEmbeddingLevel = (byte)(currentEmbeddingValue & 0x7f);
- }
- break;
-
- case B:
- // Rule X8.
-
- // These values are reset for clarity, in this implementation B can only
- // occur as the last code in the array.
- stackCounter = 0;
- overflowCounter = 0;
- overflowAlmostCounter = 0;
- currentEmbeddingLevel = paragraphEmbeddingLevel;
- currentEmbeddingValue = paragraphEmbeddingLevel;
-
- embeddings[i] = paragraphEmbeddingLevel;
- break;
-
- default:
- break;
- }
- }
-
- return embeddings;
- }
-
-
- /**
- * 3) resolving weak types
- * Rules W1-W7.
- *
- * Note that some weak types (EN, AN) remain after this processing is complete.
- */
- private void resolveWeakTypes(int start, int limit, byte level, byte sor, byte eor) {
-
- // Rule W1.
- // Changes all NSMs.
- byte preceedingCharacterType = sor;
- for (int i = start; i < limit; ++i) {
- byte t = resultTypes[i];
- if (t == NSM) {
- resultTypes[i] = preceedingCharacterType;
- } else {
- preceedingCharacterType = t;
- }
- }
-
- // Rule W2.
- // EN does not change at the start of the run, because sor != AL.
- for (int i = start; i < limit; ++i) {
- if (resultTypes[i] == EN) {
- for (int j = i - 1; j >= start; --j) {
- byte t = resultTypes[j];
- if (t == L || t == R || t == AL) {
- if (t == AL) {
- resultTypes[i] = AN;
- }
- break;
- }
- }
- }
- }
-
- // Rule W3.
- for (int i = start; i < limit; ++i) {
- if (resultTypes[i] == AL) {
- resultTypes[i] = R;
- }
- }
-
- // Rule W4.
- // Since there must be values on both sides for this rule to have an
- // effect, the scan skips the first and last value.
- //
- // Although the scan proceeds left to right, and changes the type values
- // in a way that would appear to affect the computations later in the scan,
- // there is actually no problem. A change in the current value can only
- // affect the value to its immediate right, and only affect it if it is
- // ES or CS. But the current value can only change if the value to its
- // right is not ES or CS. Thus either the current value will not change,
- // or its change will have no effect on the remainder of the analysis.
-
- for (int i = start + 1; i < limit - 1; ++i) {
- if (resultTypes[i] == ES || resultTypes[i] == CS) {
- byte prevSepType = resultTypes[i-1];
- byte succSepType = resultTypes[i+1];
- if (prevSepType == EN && succSepType == EN) {
- resultTypes[i] = EN;
- } else if (resultTypes[i] == CS && prevSepType == AN && succSepType == AN) {
- resultTypes[i] = AN;
- }
- }
- }
-
- // Rule W5.
- for (int i = start; i < limit; ++i) {
- if (resultTypes[i] == ET) {
- // locate end of sequence
- int runstart = i;
- int runlimit = findRunLimit(runstart, limit, new byte[] { ET });
-
- // check values at ends of sequence
- byte t = runstart == start ? sor : resultTypes[runstart - 1];
-
- if (t != EN) {
- t = runlimit == limit ? eor : resultTypes[runlimit];
- }
-
- if (t == EN) {
- setTypes(runstart, runlimit, EN);
- }
-
- // continue at end of sequence
- i = runlimit;
- }
- }
-
- // Rule W6.
- for (int i = start; i < limit; ++i) {
- byte t = resultTypes[i];
- if (t == ES || t == ET || t == CS) {
- resultTypes[i] = ON;
- }
- }
-
- // Rule W7.
- for (int i = start; i < limit; ++i) {
- if (resultTypes[i] == EN) {
- // set default if we reach start of run
- byte prevStrongType = sor;
- for (int j = i - 1; j >= start; --j) {
- byte t = resultTypes[j];
- if (t == L || t == R) { // AL's have been removed
- prevStrongType = t;
- break;
- }
- }
- if (prevStrongType == L) {
- resultTypes[i] = L;
- }
- }
- }
- }
-
- /**
- * 6) resolving neutral types
- * Rules N1-N2.
- */
- private void resolveNeutralTypes(int start, int limit, byte level, byte sor, byte eor) {
-
- for (int i = start; i < limit; ++i) {
- byte t = resultTypes[i];
- if (t == WS || t == ON || t == B || t == S) {
- // find bounds of run of neutrals
- int runstart = i;
- int runlimit = findRunLimit(runstart, limit, new byte[] {B, S, WS, ON});
-
- // determine effective types at ends of run
- byte leadingType;
- byte trailingType;
-
- if (runstart == start) {
- leadingType = sor;
- } else {
- leadingType = resultTypes[runstart - 1];
- if (leadingType == L || leadingType == R) {
- // found the strong type
- } else if (leadingType == AN) {
- leadingType = R;
- } else if (leadingType == EN) {
- // Since EN's with previous strong L types have been changed
- // to L in W7, the leadingType must be R.
- leadingType = R;
- }
- }
-
- if (runlimit == limit) {
- trailingType = eor;
- } else {
- trailingType = resultTypes[runlimit];
- if (trailingType == L || trailingType == R) {
- // found the strong type
- } else if (trailingType == AN) {
- trailingType = R;
- } else if (trailingType == EN) {
- trailingType = R;
- }
- }
-
- byte resolvedType;
- if (leadingType == trailingType) {
- // Rule N1.
- resolvedType = leadingType;
- } else {
- // Rule N2.
- // Notice the embedding level of the run is used, not
- // the paragraph embedding level.
- resolvedType = typeForLevel(level);
- }
-
- setTypes(runstart, runlimit, resolvedType);
-
- // skip over run of (former) neutrals
- i = runlimit;
- }
- }
- }
-
- /**
- * 7) resolving implicit embedding levels
- * Rules I1, I2.
- */
- private void resolveImplicitLevels(int start, int limit, byte level, byte sor, byte eor) {
- if ((level & 1) == 0) { // even level
- for (int i = start; i < limit; ++i) {
- byte t = resultTypes[i];
- // Rule I1.
- if (t == L ) {
- // no change
- } else if (t == R) {
- resultLevels[i] += 1;
- } else { // t == AN || t == EN
- resultLevels[i] += 2;
- }
- }
- } else { // odd level
- for (int i = start; i < limit; ++i) {
- byte t = resultTypes[i];
- // Rule I2.
- if (t == R) {
- // no change
- } else { // t == L || t == AN || t == EN
- resultLevels[i] += 1;
- }
- }
- }
- }
-
- //
- // Output
- //
-
- public byte[] getLevels() {
- return getLevels(new int[]{textLength});
- }
-
- /**
- * Return levels array breaking lines at offsets in linebreaks. <br>
- * Rule L1.
- * <p>
- * The returned levels array contains the resolved level for each
- * bidi code passed to the constructor.
- * <p>
- * The linebreaks array must include at least one value.
- * The values must be in strictly increasing order (no duplicates)
- * between 1 and the length of the text, inclusive. The last value
- * must be the length of the text.
- *
- * @param linebreaks the offsets at which to break the paragraph
- * @return the resolved levels of the text
- */
- public byte[] getLevels(int[] linebreaks) {
-
- // Note that since the previous processing has removed all
- // P, S, and WS values from resultTypes, the values referred to
- // in these rules are the initial types, before any processing
- // has been applied (including processing of overrides).
- //
- // This example implementation has reinserted explicit format codes
- // and BN, in order that the levels array correspond to the
- // initial text. Their final placement is not normative.
- // These codes are treated like WS in this implementation,
- // so they don't interrupt sequences of WS.
-
- validateLineBreaks(linebreaks, textLength);
-
- byte[] result = (byte[])resultLevels.clone(); // will be returned to caller
-
- // don't worry about linebreaks since if there is a break within
- // a series of WS values preceeding S, the linebreak itself
- // causes the reset.
- for (int i = 0; i < result.length; ++i) {
- byte t = initialTypes[i];
- if (t == B || t == S) {
- // Rule L1, clauses one and two.
- result[i] = paragraphEmbeddingLevel;
-
- // Rule L1, clause three.
- for (int j = i - 1; j >= 0; --j) {
- if (isWhitespace(initialTypes[j])) { // including format codes
- result[j] = paragraphEmbeddingLevel;
- } else {
- break;
- }
- }
- }
- }
-
- // Rule L1, clause four.
- int start = 0;
- for (int i = 0; i < linebreaks.length; ++i) {
- int limit = linebreaks[i];
- for (int j = limit - 1; j >= start; --j) {
- if (isWhitespace(initialTypes[j])) { // including format codes
- result[j] = paragraphEmbeddingLevel;
- } else {
- break;
- }
- }
-
- start = limit;
- }
-
- return result;
- }
-
- /**
- * Return reordering array breaking lines at offsets in linebreaks.
- * <p>
- * The reordering array maps from a visual index to a logical index.
- * Lines are concatenated from left to right. So for example, the
- * fifth character from the left on the third line is
- * <pre> getReordering(linebreaks)[linebreaks[1] + 4]</pre>
- * (linebreaks[1] is the position after the last character of the
- * second line, which is also the index of the first character on the
- * third line, and adding four gets the fifth character from the left).
- * <p>
- * The linebreaks array must include at least one value.
- * The values must be in strictly increasing order (no duplicates)
- * between 1 and the length of the text, inclusive. The last value
- * must be the length of the text.
- *
- * @param linebreaks the offsets at which to break the paragraph.
- */
- public int[] getReordering(int[] linebreaks) {
- validateLineBreaks(linebreaks, textLength);
-
- byte[] levels = getLevels(linebreaks);
-
- return computeMultilineReordering(levels, linebreaks);
- }
-
- /**
- * Return multiline reordering array for a given level array.
- * Reordering does not occur across a line break.
- */
- private static int[] computeMultilineReordering(byte[] levels, int[] linebreaks) {
- int[] result = new int[levels.length];
-
- int start = 0;
- for (int i = 0; i < linebreaks.length; ++i) {
- int limit = linebreaks[i];
-
- byte[] templevels = new byte[limit - start];
- System.arraycopy(levels, start, templevels, 0, templevels.length);
-
- int[] temporder = computeReordering(templevels);
- for (int j = 0; j < temporder.length; ++j) {
- result[start + j] = temporder[j] + start;
- }
-
- start = limit;
- }
-
- return result;
- }
-
- /**
- * Return reordering array for a given level array. This reorders a single line.
- * The reordering is a visual to logical map. For example,
- * the leftmost char is string.charAt(order[0]).
- * Rule L2.
- */
- private static int[] computeReordering(byte[] levels) {
- int lineLength = levels.length;
-
- int[] result = new int[lineLength];
-
- // initialize order
- for (int i = 0; i < lineLength; ++i) {
- result[i] = i;
- }
-
- // locate highest level found on line.
- // Note the rules say text, but no reordering across line bounds is performed,
- // so this is sufficient.
- byte highestLevel = 0;
- byte lowestOddLevel = 63;
- for (int i = 0; i < lineLength; ++i) {
- byte level = levels[i];
- if (level > highestLevel) {
- highestLevel = level;
- }
- if (((level & 1) != 0) && level < lowestOddLevel) {
- lowestOddLevel = level;
- }
- }
-
- for (int level = highestLevel; level >= lowestOddLevel; --level) {
- for (int i = 0; i < lineLength; ++i) {
- if (levels[i] >= level) {
- // find range of text at or above this level
- int start = i;
- int limit = i + 1;
- while (limit < lineLength && levels[limit] >= level) {
- ++limit;
- }
-
- // reverse run
- for (int j = start, k = limit - 1; j < k; ++j, --k) {
- int temp = result[j];
- result[j] = result[k];
- result[k] = temp;
- }
-
- // skip to end of level run
- i = limit;
- }
- }
- }
-
- return result;
- }
-
- /**
- * Return the base level of the paragraph.
- */
- public byte getBaseLevel() {
- return paragraphEmbeddingLevel;
- }
-
- // --- internal utilities -------------------------------------------------
-
- /**
- * Return true if the type is considered a whitespace type for the line break rules.
- */
- private static boolean isWhitespace(byte biditype) {
- switch (biditype) {
- case LRE:
- case RLE:
- case LRO:
- case RLO:
- case PDF:
- case BN:
- case WS:
- return true;
- default:
- return false;
- }
- }
-
- /**
- * Return the strong type (L or R) corresponding to the level.
- */
- private static byte typeForLevel(int level) {
- return ((level & 0x1) == 0) ? L : R;
- }
-
- /**
- * Return the limit of the run starting at index that includes only resultTypes in validSet.
- * This checks the value at index, and will return index if that value is not in validSet.
- */
- private int findRunLimit(int index, int limit, byte[] validSet) {
- --index;
- loop:
- while (++index < limit) {
- byte t = resultTypes[index];
- for (int i = 0; i < validSet.length; ++i) {
- if (t == validSet[i]) {
- continue loop;
- }
- }
- // didn't find a match in validSet
- return index;
- }
- return limit;
- }
-
- /**
- * Return the start of the run including index that includes only resultTypes in validSet.
- * This assumes the value at index is valid, and does not check it.
- */
- private int findRunStart(int index, byte[] validSet) {
- loop:
- while (--index >= 0) {
- byte t = resultTypes[index];
- for (int i = 0; i < validSet.length; ++i) {
- if (t == validSet[i]) {
- continue loop;
- }
- }
- return index + 1;
- }
- return 0;
- }
-
- /**
- * Set resultTypes from start up to (but not including) limit to newType.
- */
- private void setTypes(int start, int limit, byte newType) {
- for (int i = start; i < limit; ++i) {
- resultTypes[i] = newType;
- }
- }
-
- /**
- * Set resultLevels from start up to (but not including) limit to newLevel.
- */
- private void setLevels(int start, int limit, byte newLevel) {
- for (int i = start; i < limit; ++i) {
- resultLevels[i] = newLevel;
- }
- }
-
- // --- input validation ---------------------------------------------------
-
- /**
- * Throw exception if type array is invalid.
- */
- private static void validateTypes(byte[] types) {
- if (types == null) {
- throw new IllegalArgumentException("types is null");
- }
- for (int i = 0; i < types.length; ++i) {
- if (types[i] < TYPE_MIN || types[i] > TYPE_MAX) {
- throw new IllegalArgumentException("illegal type value at " + i + ": " + types[i]);
- }
- }
- for (int i = 0; i < types.length - 1; ++i) {
- if (types[i] == B) {
- throw new IllegalArgumentException("B type before end of paragraph at index: " + i);
- }
- }
- }
-
- /**
- * Throw exception if paragraph embedding level is invalid. Special allowance for -1 so that
- * default processing can still be performed when using this API.
- */
- private static void validateParagraphEmbeddingLevel(byte paragraphEmbeddingLevel) {
- if (paragraphEmbeddingLevel != -1 &&
- paragraphEmbeddingLevel != 0 &&
- paragraphEmbeddingLevel != 1) {
- throw new IllegalArgumentException("illegal paragraph embedding level: " + paragraphEmbeddingLevel);
- }
- }
-
- /**
- * Throw exception if line breaks array is invalid.
- */
- private static void validateLineBreaks(int[] linebreaks, int textLength) {
- int prev = 0;
- for (int i = 0; i < linebreaks.length; ++i) {
- int next = linebreaks[i];
- if (next <= prev) {
- throw new IllegalArgumentException("bad linebreak: " + next + " at index: " + i);
- }
- prev = next;
- }
- if (prev != textLength) {
- throw new IllegalArgumentException("last linebreak must be at " + textLength);
- }
- }
-
- private static final byte rtypes[] = new byte[0x10000];
-
- private static char baseTypes[] = {
- 0, 8, (char)BN, 9, 9, (char)S, 10, 10, (char)B, 11, 11, (char)S, 12, 12, (char)WS, 13, 13, (char)B,
- 14, 27, (char)BN, 28, 30, (char)B, 31, 31, (char)S, 32, 32, (char)WS, 33, 34, (char)ON, 35, 37, (char)ET,
- 38, 42, (char)ON, 43, 43, (char)ET, 44, 44, (char)CS, 45, 45, (char)ET, 46, 46, (char)CS, 47, 47, (char)ES,
- 48, 57, (char)EN, 58, 58, (char)CS, 59, 64, (char)ON, 65, 90, (char)L, 91, 96, (char)ON, 97, 122, (char)L,
- 123, 126, (char)ON, 127, 132, (char)BN, 133, 133, (char)B, 134, 159, (char)BN, 160, 160, (char)CS,
- 161, 161, (char)ON, 162, 165, (char)ET, 166, 169, (char)ON, 170, 170, (char)L, 171, 175, (char)ON,
- 176, 177, (char)ET, 178, 179, (char)EN, 180, 180, (char)ON, 181, 181, (char)L, 182, 184, (char)ON,
- 185, 185, (char)EN, 186, 186, (char)L, 187, 191, (char)ON, 192, 214, (char)L, 215, 215, (char)ON,
- 216, 246, (char)L, 247, 247, (char)ON, 248, 696, (char)L, 697, 698, (char)ON, 699, 705, (char)L,
- 706, 719, (char)ON, 720, 721, (char)L, 722, 735, (char)ON, 736, 740, (char)L, 741, 749, (char)ON,
- 750, 750, (char)L, 751, 767, (char)ON, 768, 855, (char)NSM, 856, 860, (char)L, 861, 879, (char)NSM,
- 880, 883, (char)L, 884, 885, (char)ON, 886, 893, (char)L, 894, 894, (char)ON, 895, 899, (char)L,
- 900, 901, (char)ON, 902, 902, (char)L, 903, 903, (char)ON, 904, 1013, (char)L, 1014, 1014, (char)ON,
- 1015, 1154, (char)L, 1155, 1158, (char)NSM, 1159, 1159, (char)L, 1160, 1161, (char)NSM,
- 1162, 1417, (char)L, 1418, 1418, (char)ON, 1419, 1424, (char)L, 1425, 1441, (char)NSM,
- 1442, 1442, (char)L, 1443, 1465, (char)NSM, 1466, 1466, (char)L, 1467, 1469, (char)NSM,
- 1470, 1470, (char)R, 1471, 1471, (char)NSM, 1472, 1472, (char)R, 1473, 1474, (char)NSM,
- 1475, 1475, (char)R, 1476, 1476, (char)NSM, 1477, 1487, (char)L, 1488, 1514, (char)R,
- 1515, 1519, (char)L, 1520, 1524, (char)R, 1525, 1535, (char)L, 1536, 1539, (char)AL,
- 1540, 1547, (char)L, 1548, 1548, (char)CS, 1549, 1549, (char)AL, 1550, 1551, (char)ON,
- 1552, 1557, (char)NSM, 1558, 1562, (char)L, 1563, 1563, (char)AL, 1564, 1566, (char)L,
- 1567, 1567, (char)AL, 1568, 1568, (char)L, 1569, 1594, (char)AL, 1595, 1599, (char)L,
- 1600, 1610, (char)AL, 1611, 1624, (char)NSM, 1625, 1631, (char)L, 1632, 1641, (char)AN,
- 1642, 1642, (char)ET, 1643, 1644, (char)AN, 1645, 1647, (char)AL, 1648, 1648, (char)NSM,
- 1649, 1749, (char)AL, 1750, 1756, (char)NSM, 1757, 1757, (char)AL, 1758, 1764, (char)NSM,
- 1765, 1766, (char)AL, 1767, 1768, (char)NSM, 1769, 1769, (char)ON, 1770, 1773, (char)NSM,
- 1774, 1775, (char)AL, 1776, 1785, (char)EN, 1786, 1805, (char)AL, 1806, 1806, (char)L,
- 1807, 1807, (char)BN, 1808, 1808, (char)AL, 1809, 1809, (char)NSM, 1810, 1839, (char)AL,
- 1840, 1866, (char)NSM, 1867, 1868, (char)L, 1869, 1871, (char)AL, 1872, 1919, (char)L,
- 1920, 1957, (char)AL, 1958, 1968, (char)NSM, 1969, 1969, (char)AL, 1970, 2304, (char)L,
- 2305, 2306, (char)NSM, 2307, 2363, (char)L, 2364, 2364, (char)NSM, 2365, 2368, (char)L,
- 2369, 2376, (char)NSM, 2377, 2380, (char)L, 2381, 2381, (char)NSM, 2382, 2384, (char)L,
- 2385, 2388, (char)NSM, 2389, 2401, (char)L, 2402, 2403, (char)NSM, 2404, 2432, (char)L,
- 2433, 2433, (char)NSM, 2434, 2491, (char)L, 2492, 2492, (char)NSM, 2493, 2496, (char)L,
- 2497, 2500, (char)NSM, 2501, 2508, (char)L, 2509, 2509, (char)NSM, 2510, 2529, (char)L,
- 2530, 2531, (char)NSM, 2532, 2545, (char)L, 2546, 2547, (char)ET, 2548, 2560, (char)L,
- 2561, 2562, (char)NSM, 2563, 2619, (char)L, 2620, 2620, (char)NSM, 2621, 2624, (char)L,
- 2625, 2626, (char)NSM, 2627, 2630, (char)L, 2631, 2632, (char)NSM, 2633, 2634, (char)L,
- 2635, 2637, (char)NSM, 2638, 2671, (char)L, 2672, 2673, (char)NSM, 2674, 2688, (char)L,
- 2689, 2690, (char)NSM, 2691, 2747, (char)L, 2748, 2748, (char)NSM, 2749, 2752, (char)L,
- 2753, 2757, (char)NSM, 2758, 2758, (char)L, 2759, 2760, (char)NSM, 2761, 2764, (char)L,
- 2765, 2765, (char)NSM, 2766, 2785, (char)L, 2786, 2787, (char)NSM, 2788, 2800, (char)L,
- 2801, 2801, (char)ET, 2802, 2816, (char)L, 2817, 2817, (char)NSM, 2818, 2875, (char)L,
- 2876, 2876, (char)NSM, 2877, 2878, (char)L, 2879, 2879, (char)NSM, 2880, 2880, (char)L,
- 2881, 2883, (char)NSM, 2884, 2892, (char)L, 2893, 2893, (char)NSM, 2894, 2901, (char)L,
- 2902, 2902, (char)NSM, 2903, 2945, (char)L, 2946, 2946, (char)NSM, 2947, 3007, (char)L,
- 3008, 3008, (char)NSM, 3009, 3020, (char)L, 3021, 3021, (char)NSM, 3022, 3058, (char)L,
- 3059, 3064, (char)ON, 3065, 3065, (char)ET, 3066, 3066, (char)ON, 3067, 3133, (char)L,
- 3134, 3136, (char)NSM, 3137, 3141, (char)L, 3142, 3144, (char)NSM, 3145, 3145, (char)L,
- 3146, 3149, (char)NSM, 3150, 3156, (char)L, 3157, 3158, (char)NSM, 3159, 3259, (char)L,
- 3260, 3260, (char)NSM, 3261, 3275, (char)L, 3276, 3277, (char)NSM, 3278, 3392, (char)L,
- 3393, 3395, (char)NSM, 3396, 3404, (char)L, 3405, 3405, (char)NSM, 3406, 3529, (char)L,
- 3530, 3530, (char)NSM, 3531, 3537, (char)L, 3538, 3540, (char)NSM, 3541, 3541, (char)L,
- 3542, 3542, (char)NSM, 3543, 3632, (char)L, 3633, 3633, (char)NSM, 3634, 3635, (char)L,
- 3636, 3642, (char)NSM, 3643, 3646, (char)L, 3647, 3647, (char)ET, 3648, 3654, (char)L,
- 3655, 3662, (char)NSM, 3663, 3760, (char)L, 3761, 3761, (char)NSM, 3762, 3763, (char)L,
- 3764, 3769, (char)NSM, 3770, 3770, (char)L, 3771, 3772, (char)NSM, 3773, 3783, (char)L,
- 3784, 3789, (char)NSM, 3790, 3863, (char)L, 3864, 3865, (char)NSM, 3866, 3892, (char)L,
- 3893, 3893, (char)NSM, 3894, 3894, (char)L, 3895, 3895, (char)NSM, 3896, 3896, (char)L,
- 3897, 3897, (char)NSM, 3898, 3901, (char)ON, 3902, 3952, (char)L, 3953, 3966, (char)NSM,
- 3967, 3967, (char)L, 3968, 3972, (char)NSM, 3973, 3973, (char)L, 3974, 3975, (char)NSM,
- 3976, 3983, (char)L, 3984, 3991, (char)NSM, 3992, 3992, (char)L, 3993, 4028, (char)NSM,
- 4029, 4037, (char)L, 4038, 4038, (char)NSM, 4039, 4140, (char)L, 4141, 4144, (char)NSM,
- 4145, 4145, (char)L, 4146, 4146, (char)NSM, 4147, 4149, (char)L, 4150, 4151, (char)NSM,
- 4152, 4152, (char)L, 4153, 4153, (char)NSM, 4154, 4183, (char)L, 4184, 4185, (char)NSM,
- 4186, 5759, (char)L, 5760, 5760, (char)WS, 5761, 5786, (char)L, 5787, 5788, (char)ON,
- 5789, 5905, (char)L, 5906, 5908, (char)NSM, 5909, 5937, (char)L, 5938, 5940, (char)NSM,
- 5941, 5969, (char)L, 5970, 5971, (char)NSM, 5972, 6001, (char)L, 6002, 6003, (char)NSM,
- 6004, 6070, (char)L, 6071, 6077, (char)NSM, 6078, 6085, (char)L, 6086, 6086, (char)NSM,
- 6087, 6088, (char)L, 6089, 6099, (char)NSM, 6100, 6106, (char)L, 6107, 6107, (char)ET,
- 6108, 6108, (char)L, 6109, 6109, (char)NSM, 6110, 6127, (char)L, 6128, 6137, (char)ON,
- 6138, 6143, (char)L, 6144, 6154, (char)ON, 6155, 6157, (char)NSM, 6158, 6158, (char)WS,
- 6159, 6312, (char)L, 6313, 6313, (char)NSM, 6314, 6431, (char)L, 6432, 6434, (char)NSM,
- 6435, 6438, (char)L, 6439, 6443, (char)NSM, 6444, 6449, (char)L, 6450, 6450, (char)NSM,
- 6451, 6456, (char)L, 6457, 6459, (char)NSM, 6460, 6463, (char)L, 6464, 6464, (char)ON,
- 6465, 6467, (char)L, 6468, 6469, (char)ON, 6470, 6623, (char)L, 6624, 6655, (char)ON,
- 6656, 8124, (char)L, 8125, 8125, (char)ON, 8126, 8126, (char)L, 8127, 8129, (char)ON,
- 8130, 8140, (char)L, 8141, 8143, (char)ON, 8144, 8156, (char)L, 8157, 8159, (char)ON,
- 8160, 8172, (char)L, 8173, 8175, (char)ON, 8176, 8188, (char)L, 8189, 8190, (char)ON,
- 8191, 8191, (char)L, 8192, 8202, (char)WS, 8203, 8205, (char)BN, 8206, 8206, (char)L,
- 8207, 8207, (char)R, 8208, 8231, (char)ON, 8232, 8232, (char)WS, 8233, 8233, (char)B,
- 8234, 8234, (char)LRE, 8235, 8235, (char)RLE, 8236, 8236, (char)PDF, 8237, 8237, (char)LRO,
- 8238, 8238, (char)RLO, 8239, 8239, (char)WS, 8240, 8244, (char)ET, 8245, 8276, (char)ON,
- 8277, 8278, (char)L, 8279, 8279, (char)ON, 8280, 8286, (char)L, 8287, 8287, (char)WS,
- 8288, 8291, (char)BN, 8292, 8297, (char)L, 8298, 8303, (char)BN, 8304, 8304, (char)EN,
- 8305, 8307, (char)L, 8308, 8313, (char)EN, 8314, 8315, (char)ET, 8316, 8318, (char)ON,
- 8319, 8319, (char)L, 8320, 8329, (char)EN, 8330, 8331, (char)ET, 8332, 8334, (char)ON,
- 8335, 8351, (char)L, 8352, 8369, (char)ET, 8370, 8399, (char)L, 8400, 8426, (char)NSM,
- 8427, 8447, (char)L, 8448, 8449, (char)ON, 8450, 8450, (char)L, 8451, 8454, (char)ON,
- 8455, 8455, (char)L, 8456, 8457, (char)ON, 8458, 8467, (char)L, 8468, 8468, (char)ON,
- 8469, 8469, (char)L, 8470, 8472, (char)ON, 8473, 8477, (char)L, 8478, 8483, (char)ON,
- 8484, 8484, (char)L, 8485, 8485, (char)ON, 8486, 8486, (char)L, 8487, 8487, (char)ON,
- 8488, 8488, (char)L, 8489, 8489, (char)ON, 8490, 8493, (char)L, 8494, 8494, (char)ET,
- 8495, 8497, (char)L, 8498, 8498, (char)ON, 8499, 8505, (char)L, 8506, 8507, (char)ON,
- 8508, 8511, (char)L, 8512, 8516, (char)ON, 8517, 8521, (char)L, 8522, 8523, (char)ON,
- 8524, 8530, (char)L, 8531, 8543, (char)ON, 8544, 8591, (char)L, 8592, 8721, (char)ON,
- 8722, 8723, (char)ET, 8724, 9013, (char)ON, 9014, 9082, (char)L, 9083, 9108, (char)ON,
- 9109, 9109, (char)L, 9110, 9168, (char)ON, 9169, 9215, (char)L, 9216, 9254, (char)ON,
- 9255, 9279, (char)L, 9280, 9290, (char)ON, 9291, 9311, (char)L, 9312, 9371, (char)EN,
- 9372, 9449, (char)L, 9450, 9450, (char)EN, 9451, 9751, (char)ON, 9752, 9752, (char)L,
- 9753, 9853, (char)ON, 9854, 9855, (char)L, 9856, 9873, (char)ON, 9874, 9887, (char)L,
- 9888, 9889, (char)ON, 9890, 9984, (char)L, 9985, 9988, (char)ON, 9989, 9989, (char)L,
- 9990, 9993, (char)ON, 9994, 9995, (char)L, 9996, 10023, (char)ON, 10024, 10024, (char)L,
- 10025, 10059, (char)ON, 10060, 10060, (char)L, 10061, 10061, (char)ON, 10062, 10062, (char)L,
- 10063, 10066, (char)ON, 10067, 10069, (char)L, 10070, 10070, (char)ON, 10071, 10071, (char)L,
- 10072, 10078, (char)ON, 10079, 10080, (char)L, 10081, 10132, (char)ON, 10133, 10135, (char)L,
- 10136, 10159, (char)ON, 10160, 10160, (char)L, 10161, 10174, (char)ON, 10175, 10191, (char)L,
- 10192, 10219, (char)ON, 10220, 10223, (char)L, 10224, 11021, (char)ON, 11022, 11903, (char)L,
- 11904, 11929, (char)ON, 11930, 11930, (char)L, 11931, 12019, (char)ON, 12020, 12031, (char)L,
- 12032, 12245, (char)ON, 12246, 12271, (char)L, 12272, 12283, (char)ON, 12284, 12287, (char)L,
- 12288, 12288, (char)WS, 12289, 12292, (char)ON, 12293, 12295, (char)L, 12296, 12320, (char)ON,
- 12321, 12329, (char)L, 12330, 12335, (char)NSM, 12336, 12336, (char)ON, 12337, 12341, (char)L,
- 12342, 12343, (char)ON, 12344, 12348, (char)L, 12349, 12351, (char)ON, 12352, 12440, (char)L,
- 12441, 12442, (char)NSM, 12443, 12444, (char)ON, 12445, 12447, (char)L, 12448, 12448, (char)ON,
- 12449, 12538, (char)L, 12539, 12539, (char)ON, 12540, 12828, (char)L, 12829, 12830, (char)ON,
- 12831, 12879, (char)L, 12880, 12895, (char)ON, 12896, 12923, (char)L, 12924, 12925, (char)ON,
- 12926, 12976, (char)L, 12977, 12991, (char)ON, 12992, 13003, (char)L, 13004, 13007, (char)ON,
- 13008, 13174, (char)L, 13175, 13178, (char)ON, 13179, 13277, (char)L, 13278, 13279, (char)ON,
- 13280, 13310, (char)L, 13311, 13311, (char)ON, 13312, 19903, (char)L, 19904, 19967, (char)ON,
- 19968, 42127, (char)L, 42128, 42182, (char)ON, 42183, 64284, (char)L, 64285, 64285, (char)R,
- 64286, 64286, (char)NSM, 64287, 64296, (char)R, 64297, 64297, (char)ET, 64298, 64310, (char)R,
- 64311, 64311, (char)L, 64312, 64316, (char)R, 64317, 64317, (char)L, 64318, 64318, (char)R,
- 64319, 64319, (char)L, 64320, 64321, (char)R, 64322, 64322, (char)L, 64323, 64324, (char)R,
- 64325, 64325, (char)L, 64326, 64335, (char)R, 64336, 64433, (char)AL, 64434, 64466, (char)L,
- 64467, 64829, (char)AL, 64830, 64831, (char)ON, 64832, 64847, (char)L, 64848, 64911, (char)AL,
- 64912, 64913, (char)L, 64914, 64967, (char)AL, 64968, 65007, (char)L, 65008, 65020, (char)AL,
- 65021, 65021, (char)ON, 65022, 65023, (char)L, 65024, 65039, (char)NSM, 65040, 65055, (char)L,
- 65056, 65059, (char)NSM, 65060, 65071, (char)L, 65072, 65103, (char)ON, 65104, 65104, (char)CS,
- 65105, 65105, (char)ON, 65106, 65106, (char)CS, 65107, 65107, (char)L, 65108, 65108, (char)ON,
- 65109, 65109, (char)CS, 65110, 65118, (char)ON, 65119, 65119, (char)ET, 65120, 65121, (char)ON,
- 65122, 65123, (char)ET, 65124, 65126, (char)ON, 65127, 65127, (char)L, 65128, 65128, (char)ON,
- 65129, 65130, (char)ET, 65131, 65131, (char)ON, 65132, 65135, (char)L, 65136, 65140, (char)AL,
- 65141, 65141, (char)L, 65142, 65276, (char)AL, 65277, 65278, (char)L, 65279, 65279, (char)BN,
- 65280, 65280, (char)L, 65281, 65282, (char)ON, 65283, 65285, (char)ET, 65286, 65290, (char)ON,
- 65291, 65291, (char)ET, 65292, 65292, (char)CS, 65293, 65293, (char)ET, 65294, 65294, (char)CS,
- 65295, 65295, (char)ES, 65296, 65305, (char)EN, 65306, 65306, (char)CS, 65307, 65312, (char)ON,
- 65313, 65338, (char)L, 65339, 65344, (char)ON, 65345, 65370, (char)L, 65371, 65381, (char)ON,
- 65382, 65503, (char)L, 65504, 65505, (char)ET, 65506, 65508, (char)ON, 65509, 65510, (char)ET,
- 65511, 65511, (char)L, 65512, 65518, (char)ON, 65519, 65528, (char)L, 65529, 65531, (char)BN,
- 65532, 65533, (char)ON, 65534, 65535, (char)L};
-
- static {
- for (int k = 0; k < baseTypes.length; ++k) {
- int start = baseTypes[k];
- int end = baseTypes[++k];
- byte b = (byte)baseTypes[++k];
- while (start <= end)
- rtypes[start++] = b;
- }
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/ByteBuffer.java b/LibrarySource/com/lowagie/text/pdf/ByteBuffer.java
deleted file mode 100644
index 3232da1..0000000
--- a/LibrarySource/com/lowagie/text/pdf/ByteBuffer.java
+++ /dev/null
@@ -1,597 +0,0 @@
-/*
- * $Id: ByteBuffer.java,v 1.34 2002/06/18 13:59:39 blowagie Exp $
- * $Name: $
- *
- * Copyright 2000, 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-import java.io.UnsupportedEncodingException;
-import java.io.OutputStream;
-import java.io.IOException;
-import com.lowagie.text.DocWriter;
-
-/**
- * Acts like a <CODE>StringBuffer</CODE> but works with <CODE>byte</CODE> arrays.
- * Floating point is converted to a format suitable to the PDF.
- * @author Paulo Soares (psoares at consiste.pt)
- */
-
-public class ByteBuffer extends OutputStream {
- /** The count of bytes in the buffer. */
- protected int count;
-
- /** The buffer where the bytes are stored. */
- protected byte buf[];
-
- private static int byteCacheSize = 0;
-
- private static byte[][] byteCache = new byte[byteCacheSize][];
- public static byte ZERO = (byte)'0';
- private static final char[] chars = new char[] {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
- private static final byte[] bytes = new byte[] {48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102};
-
- /** Creates new ByteBuffer with capacity 128 */
- public ByteBuffer() {
- this(128);
- }
-
- /**
- * Creates a byte buffer with a certain capacity.
- * @param size the initial capacity
- */
- public ByteBuffer(int size) {
- if (size < 1)
- size = 128;
- buf = new byte[size];
- }
-
- /**
- * Sets the cache size.
- * <P>
- * This can only be used to increment the size.
- * If the size that is passed through is smaller than the current size, nothing happens.
- *
- * @param size the size of the cache
- */
-
- public static void setCacheSize(int size) {
- if (size > 3276700) size = 3276700;
- if (size <= byteCacheSize) return;
- byte[][] tmpCache = new byte[size][];
- for (int i = 0; i < byteCacheSize; i++) {
- tmpCache[i] = byteCache[i];
- }
- byteCache = tmpCache;
- byteCacheSize = size;
- }
-
- /**
- * You can fill the cache in advance if you want to.
- *
- * @param decimals
- */
-
- public static void fillCache(int decimals) {
- int step = 1;
- switch(decimals) {
- case 0:
- step = 100;
- break;
- case 1:
- step = 10;
- break;
- }
- for (int i = 1; i < byteCacheSize; i += step) {
- if (byteCache[i] != null) continue;
- byteCache[i] = convertToBytes(i);
- }
- }
-
- /**
- * Converts an double (multiplied by 100 and cast to an int) into an array of bytes.
- *
- * @param i the int
- * @return a bytearray
- */
-
- private static byte[] convertToBytes(int i) {
- int size = (int)Math.floor(Math.log(i) / Math.log(10));
- if (i % 100 != 0) {
- size += 2;
- }
- if (i % 10 != 0) {
- size++;
- }
- if (i < 100) {
- size++;
- if (i < 10) {
- size++;
- }
- }
- size--;
- byte[] cache = new byte[size];
- size --;
- if (i < 100) {
- cache[0] = (byte)'0';
- }
- if (i % 10 != 0) {
- cache[size--] = bytes[i % 10];
- }
- if (i % 100 != 0) {
- cache[size--] = bytes[(i / 10) % 10];
- cache[size--] = (byte)'.';
- }
- size = (int)Math.floor(Math.log(i) / Math.log(10)) - 1;
- int add = 0;
- while (add < size) {
- cache[add] = bytes[(i / (int)Math.pow(10, size - add + 1)) % 10];
- add++;
- }
- return cache;
- }
-
- /**
- * Appends an <CODE>int</CODE>. The size of the array will grow by one.
- * @param b the int to be appended
- * @return a reference to this <CODE>ByteBuffer</CODE> object
- */
- public ByteBuffer append_i(int b) {
- int newcount = count + 1;
- if (newcount > buf.length) {
- byte newbuf[] = new byte[Math.max(buf.length << 1, newcount)];
- System.arraycopy(buf, 0, newbuf, 0, count);
- buf = newbuf;
- }
- buf[count] = (byte)b;
- count = newcount;
- return this;
- }
-
- /**
- * Appends the subarray of the <CODE>byte</CODE> array. The buffer will grow by
- * <CODE>len</CODE> bytes.
- * @param b the array to be appended
- * @param off the offset to the start of the array
- * @param len the length of bytes to append
- * @return a reference to this <CODE>ByteBuffer</CODE> object
- */
- public ByteBuffer append(byte b[], int off, int len) {
- if ((off < 0) || (off > b.length) || (len < 0) ||
- ((off + len) > b.length) || ((off + len) < 0) || len == 0)
- return this;
- int newcount = count + len;
- if (newcount > buf.length) {
- byte newbuf[] = new byte[Math.max(buf.length << 1, newcount)];
- System.arraycopy(buf, 0, newbuf, 0, count);
- buf = newbuf;
- }
- System.arraycopy(b, off, buf, count, len);
- count = newcount;
- return this;
- }
-
- /**
- * Appends an array of bytes.
- * @param b the array to be appended
- * @return a reference to this <CODE>ByteBuffer</CODE> object
- */
- public ByteBuffer append(byte b[]) {
- return append(b, 0, b.length);
- }
-
- /**
- * Appends a <CODE>String</CODE> to the buffer. The <CODE>String</CODE> is
- * converted according to the encoding ISO-8859-1.
- * @param str the <CODE>String</CODE> to be appended
- * @return a reference to this <CODE>ByteBuffer</CODE> object
- */
- public ByteBuffer append(String str) {
- if (str != null)
- return append(DocWriter.getISOBytes(str));
- return this;
- }
-
- /**
- * Appends a <CODE>char</CODE> to the buffer. The <CODE>char</CODE> is
- * converted according to the encoding ISO-8859-1.
- * @param c the <CODE>char</CODE> to be appended
- * @return a reference to this <CODE>ByteBuffer</CODE> object
- */
- public ByteBuffer append(char c) {
- return append_i(c);
- }
-
- /**
- * Appends another <CODE>ByteBuffer</CODE> to this buffer.
- * @param buf the <CODE>ByteBuffer</CODE> to be appended
- * @return a reference to this <CODE>ByteBuffer</CODE> object
- */
- public ByteBuffer append(ByteBuffer buf) {
- return append(buf.buf, 0, buf.count);
- }
-
- /**
- * Appends the string representation of an <CODE>int</CODE>.
- * @param i the <CODE>int</CODE> to be appended
- * @return a reference to this <CODE>ByteBuffer</CODE> object
- */
- public ByteBuffer append(int i) {
- return append((double)i);
- }
-
- public ByteBuffer append(byte b) {
- return append_i(b);
- }
-
- public ByteBuffer appendHex(byte b) {
- append(bytes[(b >> 4) & 0x0f]);
- return append(bytes[b & 0x0f]);
- }
-
- /**
- * Appends a string representation of a <CODE>float</CODE> according
- * to the Pdf conventions.
- * @param i the <CODE>float</CODE> to be appended
- * @return a reference to this <CODE>ByteBuffer</CODE> object
- */
- public ByteBuffer append(float i) {
- return append((double)i);
- }
-
- /**
- * Appends a string representation of a <CODE>double</CODE> according
- * to the Pdf conventions.
- * @param d the <CODE>double</CODE> to be appended
- * @return a reference to this <CODE>ByteBuffer</CODE> object
- */
- public ByteBuffer append(double d) {
- append(formatDouble(d, this));
- return this;
- }
-
- /**
- * Outputs a <CODE>double</CODE> into a format suitable for the PDF.
- * @param d a double
- * @return the <CODE>String</CODE> representation of the <CODE>double</CODE>
- */
- public static String formatDouble(double d) {
- return formatDouble(d, null);
- }
-
- /**
- * Outputs a <CODE>double</CODE> into a format suitable for the PDF.
- * @param d a double
- * @return the <CODE>String</CODE> representation of the <CODE>double</CODE> if
- * <CODE>d</CODE> is <CODE>null</CODE>. If <CODE>d</CODE> is <B>not</B> <CODE>null</CODE>,
- * then the double is appended directly to the buffer and this methods returns <CODE>null</CODE>.
- */
- public static String formatDouble(double d, ByteBuffer buf) {
- boolean negative = false;
- if (Math.abs(d) < 0.000015) {
- if (buf != null) {
- buf.append((byte)ZERO);
- return null;
- } else {
- return "0";
- }
- }
- if (d < 0) {
- negative = true;
- d = -d;
- }
- if (d < 1.0) {
- d += 0.000005;
- if (d >= 1) {
- if (negative) {
- if (buf != null) {
- buf.append((byte)'-');
- buf.append((byte)'1');
- return null;
- } else {
- return "-1";
- }
- } else {
- if (buf != null) {
- buf.append((byte)'1');
- return null;
- } else {
- return "1";
- }
- }
- }
- if (buf != null) {
- int v = (int) (d * 100000);
-
- if (negative) buf.append((byte)'-');
- buf.append((byte)'0');
- buf.append((byte)'.');
-
- buf.append( (byte)(v / 10000 + ZERO) );
- if (v % 10000 != 0) {
- buf.append( (byte)((v / 1000) % 10 + ZERO) );
- if (v % 1000 != 0) {
- buf.append( (byte)((v / 100) % 10 + ZERO) );
- if (v % 100 != 0) {
- buf.append((byte)((v / 10) % 10 + ZERO) );
- if (v % 10 != 0) {
- buf.append((byte)((v) % 10 + ZERO) );
- }
- }
- }
- }
- return null;
- } else {
- int x = 100000;
- int v = (int) (d * x);
-
- StringBuffer res = new StringBuffer();
- if (negative) res.append('-');
- res.append("0.");
-
- while( v < x/10 ) {
- res.append('0');
- x /= 10;
- }
- res.append(v);
- int cut = res.length() - 1;
- while (res.charAt(cut) == '0') {
- --cut;
- }
- res.setLength(cut + 1);
- return res.toString();
- }
- } else if (d <= 32767) {
- d += 0.005;
- int v = (int) (d * 100);
-
- if (v < byteCacheSize && byteCache[v] != null) {
- if (buf != null) {
- if (negative) buf.append((byte)'-');
- buf.append(byteCache[v]);
- return null;
- } else {
- String tmp = PdfEncodings.convertToString(byteCache[v], null);
- if (negative) tmp = "-" + tmp;
- return tmp;
- }
- }
- if (buf != null) {
- if (v < byteCacheSize) {
- //create the cachebyte[]
- byte[] cache;
- int size = 0;
- if (v >= 1000000) {
- //the original number is >=10000, we need 5 more bytes
- size += 5;
- } else if (v >= 100000) {
- //the original number is >=1000, we need 4 more bytes
- size += 4;
- } else if (v >= 10000) {
- //the original number is >=100, we need 3 more bytes
- size += 3;
- } else if (v >= 1000) {
- //the original number is >=10, we need 2 more bytes
- size += 2;
- } else if (v >= 100) {
- //the original number is >=1, we need 1 more bytes
- size += 1;
- }
-
- //now we must check if we have a decimal number
- if (v % 100 != 0) {
- //yes, do not forget the "."
- size += 2;
- }
- if (v % 10 != 0) {
- size++;
- }
- cache = new byte[size];
- int add = 0;
- if (v >= 1000000) {
- cache[add++] = bytes[(v / 1000000)];
- }
- if (v >= 100000) {
- cache[add++] = bytes[(v / 100000) % 10];
- }
- if (v >= 10000) {
- cache[add++] = bytes[(v / 10000) % 10];
- }
- if (v >= 1000) {
- cache[add++] = bytes[(v / 1000) % 10];
- }
- if (v >= 100) {
- cache[add++] = bytes[(v / 100) % 10];
- }
-
- if (v % 100 != 0) {
- cache[add++] = (byte)'.';
- cache[add++] = bytes[(v / 10) % 10];
- if (v % 10 != 0) {
- cache[add++] = bytes[v % 10];
- }
- }
- byteCache[v] = cache;
- }
-
- if (negative) buf.append((byte)'-');
- if (v >= 1000000) {
- buf.append( bytes[(v / 1000000)] );
- }
- if (v >= 100000) {
- buf.append( bytes[(v / 100000) % 10] );
- }
- if (v >= 10000) {
- buf.append( bytes[(v / 10000) % 10] );
- }
- if (v >= 1000) {
- buf.append( bytes[(v / 1000) % 10] );
- }
- if (v >= 100) {
- buf.append( bytes[(v / 100) % 10] );
- }
-
- if (v % 100 != 0) {
- buf.append((byte)'.');
- buf.append( bytes[(v / 10) % 10] );
- if (v % 10 != 0) {
- buf.append( bytes[v % 10] );
- }
- }
- return null;
- } else {
- StringBuffer res = new StringBuffer();
- if (negative) res.append((char)'-');
- if (v >= 1000000) {
- res.append( chars[(v / 1000000)] );
- }
- if (v >= 100000) {
- res.append( chars[(v / 100000) % 10] );
- }
- if (v >= 10000) {
- res.append( chars[(v / 10000) % 10] );
- }
- if (v >= 1000) {
- res.append( chars[(v / 1000) % 10] );
- }
- if (v >= 100) {
- res.append( chars[(v / 100) % 10] );
- }
-
- if (v % 100 != 0) {
- res.append((char)'.');
- res.append( chars[(v / 10) % 10] );
- if (v % 10 != 0) {
- res.append( chars[v % 10] );
- }
- }
- return res.toString();
- }
- } else {
- StringBuffer res = new StringBuffer();
- if (negative) res.append('-');
- d += 0.5;
- long v = (long) d;
- return res.append(v).toString();
- }
- }
-
- /**
- * Sets the size to zero.
- */
- public void reset() {
- count = 0;
- }
-
- /**
- * Creates a newly allocated byte array. Its size is the current
- * size of this output stream and the valid contents of the buffer
- * have been copied into it.
- *
- * @return the current contents of this output stream, as a byte array.
- */
- public byte[] toByteArray() {
- byte newbuf[] = new byte[count];
- System.arraycopy(buf, 0, newbuf, 0, count);
- return newbuf;
- }
-
- /**
- * Returns the current size of the buffer.
- *
- * @return the value of the <code>count</code> field, which is the number of valid bytes in this byte buffer.
- */
- public int size() {
- return count;
- }
-
- /**
- * Converts the buffer's contents into a string, translating bytes into
- * characters according to the platform's default character encoding.
- *
- * @return String translated from the buffer's contents.
- */
- public String toString() {
- return new String(buf, 0, count);
- }
-
- /**
- * Converts the buffer's contents into a string, translating bytes into
- * characters according to the specified character encoding.
- *
- * @param enc a character-encoding name.
- * @return String translated from the buffer's contents.
- * @throws UnsupportedEncodingException
- * If the named encoding is not supported.
- */
- public String toString(String enc) throws UnsupportedEncodingException {
- return new String(buf, 0, count, enc);
- }
-
- /**
- * Writes the complete contents of this byte buffer output to
- * the specified output stream argument, as if by calling the output
- * stream's write method using <code>out.write(buf, 0, count)</code>.
- *
- * @param out the output stream to which to write the data.
- * @exception IOException if an I/O error occurs.
- */
- public void writeTo(OutputStream out) throws IOException {
- out.write(buf, 0, count);
- }
-
- public void write(int b) throws IOException {
- append((byte)b);
- }
-
- public void write(byte[] b, int off, int len) {
- append(b, off, len);
- }
-
- public byte[] getBuffer() {
- return buf;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/CFFFont.java b/LibrarySource/com/lowagie/text/pdf/CFFFont.java
deleted file mode 100644
index ac337c0..0000000
--- a/LibrarySource/com/lowagie/text/pdf/CFFFont.java
+++ /dev/null
@@ -1,1184 +0,0 @@
-/*
- *
- * Copyright 2003 Sivan Toledo
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- */
-
-/*
- * Comments by Sivan Toledo:
- * I created this class in order to add to iText the ability to utilize
- * OpenType fonts with CFF glyphs (these usually have an .otf extension).
- * The CFF font within the CFF table of the OT font might be either a CID
- * or a Type1 font. (CFF fonts may also contain multiple fonts; I do not
- * know if this is allowed in an OT table). The PDF spec, however, only
- * allow a CID font with an Identity-H or Identity-V encoding. Otherwise,
- * you are limited to an 8-bit encoding.
- * Adobe fonts come in both flavors. That is, the OTFs sometimes have
- * a CID CFF inside (for Japanese fonts), and sometimes a Type1 CFF
- * (virtually all the others, Latin/Greek/Cyrillic). So to easily use
- * all the glyphs in the latter, without creating multiple 8-bit encoding,
- * I wrote this class, whose main purpose is to convert a Type1 font inside
- * a CFF container (which might include other fonts) into a CID CFF font
- * that can be directly embeded in the PDF.
- *
- * Limitations of the current version:
- * 1. It does not extract a single CID font from a CFF that contains that
- * particular CID along with other fonts. The Adobe Japanese OTF's that
- * I have only have one font in the CFF table, so these can be
- * embeded in the PDF as is.
- * 2. It does not yet subset fonts.
- * 3. It may or may not work on CFF fonts that are not within OTF's.
- * I didn't try that. In any case, that would probably only be
- * useful for subsetting CID fonts, not for CFF Type1 fonts (I don't
- * think there are any available.
- * I plan to extend the class to support these three features at some
- * future time.
- */
-
-package com.lowagie.text.pdf;
-
-/**
- * @author stoledo
- */
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import com.lowagie.text.ExceptionConverter;
-
-public class CFFFont {
-
- static final String operatorNames[] = {
- "version", "Notice", "FullName", "FamilyName",
- "Weight", "FontBBox", "BlueValues", "OtherBlues",
- "FamilyBlues", "FamilyOtherBlues", "StdHW", "StdVW",
- "UNKNOWN_12", "UniqueID", "XUID", "charset",
- "Encoding", "CharStrings", "Private", "Subrs",
- "defaultWidthX", "nominalWidthX", "UNKNOWN_22", "UNKNOWN_23",
- "UNKNOWN_24", "UNKNOWN_25", "UNKNOWN_26", "UNKNOWN_27",
- "UNKNOWN_28", "UNKNOWN_29", "UNKNOWN_30", "UNKNOWN_31",
- "Copyright", "isFixedPitch", "ItalicAngle", "UnderlinePosition",
- "UnderlineThickness", "PaintType", "CharstringType", "FontMatrix",
- "StrokeWidth", "BlueScale", "BlueShift", "BlueFuzz",
- "StemSnapH", "StemSnapV", "ForceBold", "UNKNOWN_12_15",
- "UNKNOWN_12_16", "LanguageGroup", "ExpansionFactor", "initialRandomSeed",
- "SyntheticBase", "PostScript", "BaseFontName", "BaseFontBlend",
- "UNKNOWN_12_24", "UNKNOWN_12_25", "UNKNOWN_12_26", "UNKNOWN_12_27",
- "UNKNOWN_12_28", "UNKNOWN_12_29", "ROS", "CIDFontVersion",
- "CIDFontRevision", "CIDFontType", "CIDCount", "UIDBase",
- "FDArray", "FDSelect", "FontName"
- };
-
- static final String standardStrings[] = {
- // Automatically generated from Appendix A of the CFF specification; do
- // not edit. Size should be 391.
- ".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar",
- "percent", "ampersand", "quoteright", "parenleft", "parenright",
- "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one",
- "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon",
- "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C",
- "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R",
- "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash",
- "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c",
- "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r",
- "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright",
- "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen",
- "florin", "section", "currency", "quotesingle", "quotedblleft",
- "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash",
- "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet",
- "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright",
- "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex",
- "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla",
- "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash",
- "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe",
- "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth",
- "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar",
- "degree", "thorn", "threequarters", "twosuperior", "registered", "minus",
- "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex",
- "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute",
- "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis",
- "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve",
- "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave",
- "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis",
- "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex",
- "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave",
- "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde",
- "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute",
- "ydieresis", "zcaron", "exclamsmall", "Hungarumlautsmall",
- "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall",
- "parenleftsuperior", "parenrightsuperior", "twodotenleader",
- "onedotenleader", "zerooldstyle", "oneoldstyle", "twooldstyle",
- "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle",
- "sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior",
- "threequartersemdash", "periodsuperior", "questionsmall", "asuperior",
- "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior",
- "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior",
- "ssuperior", "tsuperior", "ff", "ffi", "ffl", "parenleftinferior",
- "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall",
- "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall",
- "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall",
- "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall",
- "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary",
- "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle",
- "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall",
- "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash",
- "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall",
- "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths",
- "seveneighths", "onethird", "twothirds", "zerosuperior", "foursuperior",
- "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior",
- "ninesuperior", "zeroinferior", "oneinferior", "twoinferior",
- "threeinferior", "fourinferior", "fiveinferior", "sixinferior",
- "seveninferior", "eightinferior", "nineinferior", "centinferior",
- "dollarinferior", "periodinferior", "commainferior", "Agravesmall",
- "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall",
- "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall",
- "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall",
- "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall",
- "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall",
- "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall",
- "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall",
- "Ydieresissmall", "001.000", "001.001", "001.002", "001.003", "Black",
- "Bold", "Book", "Light", "Medium", "Regular", "Roman", "Semibold"
- };
-
- //private String[] strings;
- public String getString(char sid) {
- if (sid < standardStrings.length) return standardStrings[sid];
- if (sid >= standardStrings.length+(stringOffsets.length-1)) return null;
- int j = sid - standardStrings.length;
- //java.lang.System.err.println("going for "+j);
- int p = getPosition();
- seek(stringOffsets[j]);
- StringBuffer s = new StringBuffer();
- for (int k=stringOffsets[j]; k<stringOffsets[j+1]; k++) {
- s.append(getCard8());
- }
- seek(p);
- return s.toString();
- }
-
- char getCard8() {
- try {
- byte i = buf.readByte();
- return (char)(i & 0xff);
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- char getCard16() {
- try {
- return buf.readChar();
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- int getOffset(int offSize) {
- int offset = 0;
- for (int i=0; i<offSize; i++) {
- offset *= 256;
- offset += getCard8();
- }
- return offset;
- }
-
- void seek(int offset) {
- try {
- buf.seek(offset);
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- short getShort() {
- try {
- return buf.readShort();
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- int getInt() {
- try {
- return buf.readInt();
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- int getPosition() {
- try {
- return buf.getFilePointer();
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
- int nextIndexOffset;
- // read the offsets in the next index
- // data structure, convert to global
- // offsets, and return them.
- // Sets the nextIndexOffset.
- int[] getIndex(int nextIndexOffset) {
- int count, indexOffSize;
-
- seek(nextIndexOffset);
- count = getCard16();
- int[] offsets = new int[count+1];
-
- if (count==0) {
- offsets[0] = -1;
- nextIndexOffset += 2;
- return offsets;
- }
-
- indexOffSize = getCard8();
-
- for (int j=0; j<=count; j++) {
- //nextIndexOffset = ofset to relative segment
- offsets[j] = nextIndexOffset
- //2-> count in the index header. 1->offset size in index header
- + 2+1
- //offset array size * offset size
- + (count+1)*indexOffSize
- //???zero <-> one base
- - 1
- // read object offset relative to object array base
- + getOffset(indexOffSize);
- }
- //nextIndexOffset = offsets[count];
- return offsets;
- }
-
- protected String key;
- protected Object[] args = new Object[48];
- protected int arg_count = 0;
-
- protected void getDictItem() {
- for (int i=0; i<arg_count; i++) args[i]=null;
- arg_count = 0;
- key = null;
- boolean gotKey = false;
-
- while (!gotKey) {
- char b0 = getCard8();
- if (b0 == 29) {
- int item = getInt();
- args[arg_count] = new Integer(item);
- arg_count++;
- //System.err.println(item+" ");
- continue;
- }
- if (b0 == 28) {
- short item = getShort();
- args[arg_count] = new Integer(item);
- arg_count++;
- //System.err.println(item+" ");
- continue;
- }
- if (b0 >= 32 && b0 <= 246) {
- byte item = (byte) (b0-139);
- args[arg_count] = new Integer(item);
- arg_count++;
- //System.err.println(item+" ");
- continue;
- }
- if (b0 >= 247 && b0 <= 250) {
- char b1 = getCard8();
- short item = (short) ((b0-247)*256+b1+108);
- args[arg_count] = new Integer(item);
- arg_count++;
- //System.err.println(item+" ");
- continue;
- }
- if (b0 >= 251 && b0 <= 254) {
- char b1 = getCard8();
- short item = (short) (-(b0-251)*256-b1-108);
- args[arg_count] = new Integer(item);
- arg_count++;
- //System.err.println(item+" ");
- continue;
- }
- if (b0 == 30) {
- String item = "";
- boolean done = false;
- char buffer = 0;
- byte avail = 0;
- int nibble = 0;
- while (!done) {
- // get a nibble
- if (avail==0) { buffer = getCard8(); avail=2; }
- if (avail==1) { nibble = (buffer / 16); avail--; }
- if (avail==2) { nibble = (buffer % 16); avail--; }
- switch (nibble) {
- case 0xa: item += "." ; break;
- case 0xb: item += "E" ; break;
- case 0xc: item += "E-"; break;
- case 0xe: item += "-" ; break;
- case 0xf: done=true ; break;
- default:
- if (nibble >= 0 && nibble <= 9)
- item += String.valueOf(nibble);
- else {
- item += "<NIBBLE ERROR: "+String.valueOf(nibble)+">";
- done = true;
- }
- break;
- }
- }
- args[arg_count] = item;
- arg_count++;
- //System.err.println(" real=["+item+"]");
- continue;
- }
- if (b0 <= 21) {
- gotKey=true;
- if (b0 != 12) key = operatorNames[b0];
- else key = operatorNames[32 + getCard8()];
- //for (int i=0; i<arg_count; i++)
- // System.err.print(args[i].toString()+" ");
- //System.err.println(key+" ;");
- continue;
- }
- }
- }
-
- /** List items for the linked list that builds the new CID font.
- */
-
- protected static abstract class Item {
- protected int myOffset = -1;
- /** remember the current offset and increment by item's size in bytes. */
- public void increment(int[] currentOffset) {
- myOffset = currentOffset[0];
- }
- /** Emit the byte stream for this item. */
- public void emit(byte[] buffer) {}
- /** Fix up cross references to this item (applies only to markers). */
- public void xref() {}
- }
-
- protected static abstract class OffsetItem extends Item {
- public int value;
- /** set the value of an offset item that was initially unknown.
- * It will be fixed up latex by a call to xref on some marker.
- */
- public void set(int offset) { this.value = offset; }
- }
-
-
- /** A range item.
- */
-
- protected static final class RangeItem extends Item {
- public int offset, length;
- private RandomAccessFileOrArray buf;
- public RangeItem(RandomAccessFileOrArray buf, int offset, int length) {
- this.offset = offset;
- this.length = length;
- this.buf = buf;
- }
- public void increment(int[] currentOffset) {
- super.increment(currentOffset);
- currentOffset[0] += length;
- }
- public void emit(byte[] buffer) {
- //System.err.println("range emit offset "+offset+" size="+length);
- try {
- buf.seek(offset);
- for (int i=myOffset; i<myOffset+length; i++)
- buffer[i] = buf.readByte();
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- //System.err.println("finished range emit");
- }
- }
-
- /** An index-offset item for the list.
- * The size denotes the required size in the CFF. A positive
- * value means that we need a specific size in bytes (for offset arrays)
- * and a negative value means that this is a dict item that uses a
- * variable-size representation.
- */
- static protected final class IndexOffsetItem extends OffsetItem {
- public final int size;
- public IndexOffsetItem(int size, int value) {this.size=size; this.value=value;}
- public IndexOffsetItem(int size) {this.size=size; }
-
- public void increment(int[] currentOffset) {
- super.increment(currentOffset);
- currentOffset[0] += size;
- }
- public void emit(byte[] buffer) {
- int i=0;
- switch (size) {
- case 4:
- buffer[myOffset+i] = (byte) ((value >>> 24) & 0xff);
- i++;
- case 3:
- buffer[myOffset+i] = (byte) ((value >>> 16) & 0xff);
- i++;
- case 2:
- buffer[myOffset+i] = (byte) ((value >>> 8) & 0xff);
- i++;
- case 1:
- buffer[myOffset+i] = (byte) ((value >>> 0) & 0xff);
- i++;
- }
- /*
- int mask = 0xff;
- for (int i=size-1; i>=0; i--) {
- buffer[myOffset+i] = (byte) (value & mask);
- mask <<= 8;
- }
- */
- }
- }
-
- static protected final class IndexBaseItem extends Item {
- public IndexBaseItem() {}
- }
-
- static protected final class IndexMarkerItem extends Item {
- private OffsetItem offItem;
- private IndexBaseItem indexBase;
- public IndexMarkerItem(OffsetItem offItem, IndexBaseItem indexBase) {
- this.offItem = offItem;
- this.indexBase = indexBase;
- }
- public void xref() {
- //System.err.println("index marker item, base="+indexBase.myOffset+" my="+this.myOffset);
- offItem.set(this.myOffset-indexBase.myOffset+1);
- }
- }
- /**
- *
- * @author orly manor
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
- static protected final class SubrMarkerItem extends Item {
- private OffsetItem offItem;
- private IndexBaseItem indexBase;
- public SubrMarkerItem(OffsetItem offItem, IndexBaseItem indexBase) {
- this.offItem = offItem;
- this.indexBase = indexBase;
- }
- public void xref() {
- //System.err.println("index marker item, base="+indexBase.myOffset+" my="+this.myOffset);
- offItem.set(this.myOffset-indexBase.myOffset);
- }
- }
-
-
- /** an unknown offset in a dictionary for the list.
- * We will fix up the offset later; for now, assume it's large.
- */
- static protected final class DictOffsetItem extends OffsetItem {
- public final int size;
- public DictOffsetItem() {this.size=5; }
-
- public void increment(int[] currentOffset) {
- super.increment(currentOffset);
- currentOffset[0] += size;
- }
- // this is incomplete!
- public void emit(byte[] buffer) {
- if (size==5) {
- buffer[myOffset] = 29;
- buffer[myOffset+1] = (byte) ((value >>> 24) & 0xff);
- buffer[myOffset+2] = (byte) ((value >>> 16) & 0xff);
- buffer[myOffset+3] = (byte) ((value >>> 8) & 0xff);
- buffer[myOffset+4] = (byte) ((value >>> 0) & 0xff);
- }
- }
- }
-
- /** Card24 item.
- */
-
- static protected final class UInt24Item extends Item {
- public int value;
- public UInt24Item(int value) {this.value=value;}
-
- public void increment(int[] currentOffset) {
- super.increment(currentOffset);
- currentOffset[0] += 3;
- }
- // this is incomplete!
- public void emit(byte[] buffer) {
- buffer[myOffset+0] = (byte) ((value >>> 16) & 0xff);
- buffer[myOffset+1] = (byte) ((value >>> 8) & 0xff);
- buffer[myOffset+2] = (byte) ((value >>> 0) & 0xff);
- }
- }
-
- /** Card32 item.
- */
-
- static protected final class UInt32Item extends Item {
- public int value;
- public UInt32Item(int value) {this.value=value;}
-
- public void increment(int[] currentOffset) {
- super.increment(currentOffset);
- currentOffset[0] += 4;
- }
- // this is incomplete!
- public void emit(byte[] buffer) {
- buffer[myOffset+0] = (byte) ((value >>> 24) & 0xff);
- buffer[myOffset+1] = (byte) ((value >>> 16) & 0xff);
- buffer[myOffset+2] = (byte) ((value >>> 8) & 0xff);
- buffer[myOffset+3] = (byte) ((value >>> 0) & 0xff);
- }
- }
-
- /** A SID or Card16 item.
- */
-
- static protected final class UInt16Item extends Item {
- public char value;
- public UInt16Item(char value) {this.value=value;}
-
- public void increment(int[] currentOffset) {
- super.increment(currentOffset);
- currentOffset[0] += 2;
- }
- // this is incomplete!
- public void emit(byte[] buffer) {
- buffer[myOffset+0] = (byte) ((value >>> 8) & 0xff);
- buffer[myOffset+1] = (byte) ((value >>> 0) & 0xff);
- }
- }
-
- /** A Card8 item.
- */
-
- static protected final class UInt8Item extends Item {
- public char value;
- public UInt8Item(char value) {this.value=value;}
-
- public void increment(int[] currentOffset) {
- super.increment(currentOffset);
- currentOffset[0] += 1;
- }
- // this is incomplete!
- public void emit(byte[] buffer) {
- buffer[myOffset+0] = (byte) ((value >>> 0) & 0xff);
- }
- }
-
- static protected final class StringItem extends Item {
- public String s;
- public StringItem(String s) {this.s=s;}
-
- public void increment(int[] currentOffset) {
- super.increment(currentOffset);
- currentOffset[0] += s.length();
- }
- public void emit(byte[] buffer) {
- for (int i=0; i<s.length(); i++)
- buffer[myOffset+i] = (byte) (s.charAt(i) & 0xff);
- }
- }
-
-
- /** A dictionary number on the list.
- * This implementation is inefficient: it doesn't use the variable-length
- * representation.
- */
-
- static protected final class DictNumberItem extends Item {
- public final int value;
- public int size = 5;
- public DictNumberItem(int value) {this.value=value;}
- public void increment(int[] currentOffset) {
- super.increment(currentOffset);
- currentOffset[0] += size;
- }
- // this is imcomplete!
- public void emit(byte[] buffer) {
- if (size==5) {
- buffer[myOffset] = 29;
- buffer[myOffset+1] = (byte) ((value >>> 24) & 0xff);
- buffer[myOffset+2] = (byte) ((value >>> 16) & 0xff);
- buffer[myOffset+3] = (byte) ((value >>> 8) & 0xff);
- buffer[myOffset+4] = (byte) ((value >>> 0) & 0xff);
- }
- }
- }
-
- /** An offset-marker item for the list.
- * It is used to mark an offset and to set the offset list item.
- */
-
- static protected final class MarkerItem extends Item {
- OffsetItem p;
- public MarkerItem(OffsetItem pointerToMarker) {p=pointerToMarker;}
- public void xref() {
- p.set(this.myOffset);
- }
- }
-
- /** a utility that creates a range item for an entire index
- *
- * @param indexOffset where the index is
- * @return a range item representing the entire index
- */
-
- protected RangeItem getEntireIndexRange(int indexOffset) {
- seek(indexOffset);
- int count = getCard16();
- if (count==0) {
- return new RangeItem(buf,indexOffset,2);
- } else {
- int indexOffSize = getCard8();
- seek(indexOffset+2+1+count*indexOffSize);
- int size = getOffset(indexOffSize)-1;
- return new RangeItem(buf,indexOffset,
- 2+1+(count+1)*indexOffSize+size);
- }
- }
-
-
- /** get a single CID font. The PDF architecture (1.4)
- * supports 16-bit strings only with CID CFF fonts, not
- * in Type-1 CFF fonts, so we convert the font to CID if
- * it is in the Type-1 format.
- * Two other tasks that we need to do are to select
- * only a single font from the CFF package (this again is
- * a PDF restriction) and to subset the CharStrings glyph
- * description.
- */
-
-
- public byte[] getCID(String fontName)
- //throws java.io.FileNotFoundException
- {
- int j;
- for (j=0; j<fonts.length; j++)
- if (fontName.equals(fonts[j].name)) break;
- if (j==fonts.length) return null;
-
- LinkedList l = new LinkedList();
-
- // copy the header
-
- seek(0);
-
- int major = getCard8();
- int minor = getCard8();
- int hdrSize = getCard8();
- int offSize = getCard8();
- nextIndexOffset = hdrSize;
-
- l.addLast(new RangeItem(buf,0,hdrSize));
-
- int nglyphs=-1, nstrings=-1;
- if ( ! fonts[j].isCID ) {
- // count the glyphs
- seek(fonts[j].charstringsOffset);
- nglyphs = getCard16();
- seek(stringIndexOffset);
- nstrings = getCard16()+standardStrings.length;
- //System.err.println("number of glyphs = "+nglyphs);
- }
-
- // create a name index
-
- l.addLast(new UInt16Item((char)1)); // count
- l.addLast(new UInt8Item((char)1)); // offSize
- l.addLast(new UInt8Item((char)1)); // first offset
- l.addLast(new UInt8Item((char)( 1+fonts[j].name.length() )));
- l.addLast(new StringItem(fonts[j].name));
-
- // create the topdict Index
-
-
- l.addLast(new UInt16Item((char)1)); // count
- l.addLast(new UInt8Item((char)2)); // offSize
- l.addLast(new UInt16Item((char)1)); // first offset
- OffsetItem topdictIndex1Ref = new IndexOffsetItem(2);
- l.addLast(topdictIndex1Ref);
- IndexBaseItem topdictBase = new IndexBaseItem();
- l.addLast(topdictBase);
-
- /*
- int maxTopdictLen = (topdictOffsets[j+1]-topdictOffsets[j])
- + 9*2 // at most 9 new keys
- + 8*5 // 8 new integer arguments
- + 3*2;// 3 new SID arguments
- */
-
- //int topdictNext = 0;
- //byte[] topdict = new byte[maxTopdictLen];
-
- OffsetItem charsetRef = new DictOffsetItem();
- OffsetItem charstringsRef = new DictOffsetItem();
- OffsetItem fdarrayRef = new DictOffsetItem();
- OffsetItem fdselectRef = new DictOffsetItem();
-
- if ( !fonts[j].isCID ) {
- // create a ROS key
- l.addLast(new DictNumberItem(nstrings));
- l.addLast(new DictNumberItem(nstrings+1));
- l.addLast(new DictNumberItem(0));
- l.addLast(new UInt8Item((char)12));
- l.addLast(new UInt8Item((char)30));
- // create a CIDCount key
- l.addLast(new DictNumberItem(nglyphs));
- l.addLast(new UInt8Item((char)12));
- l.addLast(new UInt8Item((char)34));
- // What about UIDBase (12,35)? Don't know what is it.
- // I don't think we need FontName; the font I looked at didn't have it.
- }
-
- // create an FDArray key
- l.addLast(fdarrayRef);
- l.addLast(new UInt8Item((char)12));
- l.addLast(new UInt8Item((char)36));
- // create an FDSelect key
- l.addLast(fdselectRef);
- l.addLast(new UInt8Item((char)12));
- l.addLast(new UInt8Item((char)37));
- // create an charset key
- l.addLast(charsetRef);
- l.addLast(new UInt8Item((char)15));
- // create a CharStrings key
- l.addLast(charstringsRef);
- l.addLast(new UInt8Item((char)17));
-
- seek(topdictOffsets[j]);
- while (getPosition() < topdictOffsets[j+1]) {
- int p1 = getPosition();
- getDictItem();
- int p2 = getPosition();
- if (key=="Encoding"
- || key=="Private"
- || key=="FDSelect"
- || key=="FDArray"
- || key=="charset"
- || key=="CharStrings"
- ) {
- // just drop them
- } else {
- l.add(new RangeItem(buf,p1,p2-p1));
- }
- }
-
- l.addLast(new IndexMarkerItem(topdictIndex1Ref,topdictBase));
-
- // Copy the string index and append new strings.
- // We need 3 more strings: Registry, Ordering, and a FontName for one FD.
- // The total length is at most "Adobe"+"Identity"+63 = 76
-
- if (fonts[j].isCID) {
- l.addLast(getEntireIndexRange(stringIndexOffset));
- } else {
- String fdFontName = fonts[j].name+"-OneRange";
- if (fdFontName.length() > 127)
- fdFontName = fdFontName.substring(0,127);
- String extraStrings = "Adobe"+"Identity"+fdFontName;
-
- int origStringsLen = stringOffsets[stringOffsets.length-1]
- - stringOffsets[0];
- int stringsBaseOffset = stringOffsets[0]-1;
-
- byte stringsIndexOffSize;
- if (origStringsLen+extraStrings.length() <= 0xff) stringsIndexOffSize = 1;
- else if (origStringsLen+extraStrings.length() <= 0xffff) stringsIndexOffSize = 2;
- else if (origStringsLen+extraStrings.length() <= 0xffffff) stringsIndexOffSize = 3;
- else stringsIndexOffSize = 4;
-
- l.addLast(new UInt16Item((char)((stringOffsets.length-1)+3))); // count
- l.addLast(new UInt8Item((char)stringsIndexOffSize)); // offSize
- for (int i=0; i<stringOffsets.length; i++)
- l.addLast(new IndexOffsetItem(stringsIndexOffSize,
- stringOffsets[i]-stringsBaseOffset));
- int currentStringsOffset = stringOffsets[stringOffsets.length-1]
- - stringsBaseOffset;
- //l.addLast(new IndexOffsetItem(stringsIndexOffSize,currentStringsOffset));
- currentStringsOffset += ("Adobe").length();
- l.addLast(new IndexOffsetItem(stringsIndexOffSize,currentStringsOffset));
- currentStringsOffset += ("Identity").length();
- l.addLast(new IndexOffsetItem(stringsIndexOffSize,currentStringsOffset));
- currentStringsOffset += fdFontName.length();
- l.addLast(new IndexOffsetItem(stringsIndexOffSize,currentStringsOffset));
-
- l.addLast(new RangeItem(buf,stringOffsets[0],origStringsLen));
- l.addLast(new StringItem(extraStrings));
- }
-
- // copy the global subroutine index
-
- l.addLast(getEntireIndexRange(gsubrIndexOffset));
-
- // deal with fdarray, fdselect, and the font descriptors
-
- if (fonts[j].isCID) {
- // copy the FDArray, FDSelect, charset
- } else {
- // create FDSelect
- l.addLast(new MarkerItem(fdselectRef));
- l.addLast(new UInt8Item((char)3)); // format identifier
- l.addLast(new UInt16Item((char)1)); // nRanges
-
- l.addLast(new UInt16Item((char)0)); // Range[0].firstGlyph
- l.addLast(new UInt8Item((char)0)); // Range[0].fd
-
- l.addLast(new UInt16Item((char)nglyphs)); // sentinel
-
- // recreate a new charset
- // This format is suitable only for fonts without subsetting
-
- l.addLast(new MarkerItem(charsetRef));
- l.addLast(new UInt8Item((char)2)); // format identifier
-
- l.addLast(new UInt16Item((char)1)); // first glyph in range (ignore .notdef)
- l.addLast(new UInt16Item((char)(nglyphs-1))); // nLeft
- // now all are covered, the data structure is complete.
-
- // create a font dict index (fdarray)
-
- l.addLast(new MarkerItem(fdarrayRef));
- l.addLast(new UInt16Item((char)1));
- l.addLast(new UInt8Item((char)1)); // offSize
- l.addLast(new UInt8Item((char)1)); // first offset
-
- OffsetItem privateIndex1Ref = new IndexOffsetItem(1);
- l.addLast(privateIndex1Ref);
- IndexBaseItem privateBase = new IndexBaseItem();
- l.addLast(privateBase);
-
- // looking at the PS that acrobat generates from a PDF with
- // a CFF opentype font embeded with an identity-H encoding,
- // it seems that it does not need a FontName.
- //l.addLast(new DictNumberItem((standardStrings.length+(stringOffsets.length-1)+2)));
- //l.addLast(new UInt8Item((char)12));
- //l.addLast(new UInt8Item((char)38)); // FontName
-
- l.addLast(new DictNumberItem(fonts[j].privateLength));
- OffsetItem privateRef = new DictOffsetItem();
- l.addLast(privateRef);
- l.addLast(new UInt8Item((char)18)); // Private
-
- l.addLast(new IndexMarkerItem(privateIndex1Ref,privateBase));
-
- // copy the private index & local subroutines
-
- l.addLast(new MarkerItem(privateRef));
- // copy the private dict and the local subroutines.
- // the length of the private dict seems to NOT include
- // the local subroutines.
- l.addLast(new RangeItem(buf,fonts[j].privateOffset,fonts[j].privateLength));
- if (fonts[j].privateSubrs >= 0) {
- //System.err.println("has subrs="+fonts[j].privateSubrs+" ,len="+fonts[j].privateLength);
- l.addLast(getEntireIndexRange(fonts[j].privateSubrs));
- }
- }
-
- // copy the charstring index
-
- l.addLast(new MarkerItem(charstringsRef));
- l.addLast(getEntireIndexRange(fonts[j].charstringsOffset));
-
- // now create the new CFF font
-
- int[] currentOffset = new int[1];
- currentOffset[0] = 0;
-
- Iterator listIter = l.iterator();
- while ( listIter.hasNext() ) {
- Item item = (Item) listIter.next();
- item.increment(currentOffset);
- }
-
- listIter = l.iterator();
- while ( listIter.hasNext() ) {
- Item item = (Item) listIter.next();
- item.xref();
- }
-
- int size = currentOffset[0];
- byte[] b = new byte[size];
-
- listIter = l.iterator();
- while ( listIter.hasNext() ) {
- Item item = (Item) listIter.next();
- item.emit(b);
- }
-
- return b;
- }
-
-
- public boolean isCID(String fontName) {
- int j;
- for (j=0; j<fonts.length; j++)
- if (fontName.equals(fonts[j].name)) return fonts[j].isCID;
- return false;
- }
-
- public boolean exists(String fontName) {
- int j;
- for (j=0; j<fonts.length; j++)
- if (fontName.equals(fonts[j].name)) return true;
- return false;
- }
-
-
- public String[] getNames() {
- String[] names = new String[ fonts.length ];
- for (int i=0; i<fonts.length; i++)
- names[i] = fonts[i].name;
- return names;
- }
- /**
- * A random Access File or an array
- * (contributed by orly manor)
- */
- protected RandomAccessFileOrArray buf;
- private int offSize;
-
- protected int nameIndexOffset;
- protected int topdictIndexOffset;
- protected int stringIndexOffset;
- protected int gsubrIndexOffset;
- protected int[] nameOffsets;
- protected int[] topdictOffsets;
- protected int[] stringOffsets;
- protected int[] gsubrOffsets;
-
- /**
- * @author orly manor
- * TODO Changed from private to protected by Ygal&Oren
- */
- protected final class Font {
- public String name;
- public String fullName;
- public boolean isCID = false;
- public int privateOffset = -1; // only if not CID
- public int privateLength = -1; // only if not CID
- public int privateSubrs = -1;
- public int charstringsOffset = -1;
- public int encodingOffset = -1;
- public int charsetOffset = -1;
- public int fdarrayOffset = -1; // only if CID
- public int fdselectOffset = -1; // only if CID
- public int[] fdprivateOffsets;
- public int[] fdprivateLengths;
- public int[] fdprivateSubrs;
-
- // Added by Oren & Ygal
- public int nglyphs;
- public int nstrings;
- public int CharsetLength;
- public int[] charstringsOffsets;
- public int[] charset;
- public int[] FDSelect;
- public int FDSelectLength;
- public int FDSelectFormat;
- public int CharstringType = 2;
- public int FDArrayCount;
- public int FDArrayOffsize;
- public int[] FDArrayOffsets;
- public int[] PrivateSubrsOffset;
- public int[][] PrivateSubrsOffsetsArray;
- public int[] SubrsOffsets;
- }
- // Changed from private to protected by Ygal&Oren
- protected Font[] fonts;
-
- public CFFFont(RandomAccessFileOrArray inputbuffer) {
-
- //System.err.println("CFF: nStdString = "+standardStrings.length);
- buf = inputbuffer;
- seek(0);
-
- int major, minor;
- major = getCard8();
- minor = getCard8();
-
- //System.err.println("CFF Major-Minor = "+major+"-"+minor);
-
- int hdrSize = getCard8();
-
- offSize = getCard8();
-
- //System.err.println("offSize = "+offSize);
-
- //int count, indexOffSize, indexOffset, nextOffset;
-
- nameIndexOffset = hdrSize;
- nameOffsets = getIndex(nameIndexOffset);
- topdictIndexOffset = nameOffsets[nameOffsets.length-1];
- topdictOffsets = getIndex(topdictIndexOffset);
- stringIndexOffset = topdictOffsets[topdictOffsets.length-1];
- stringOffsets = getIndex(stringIndexOffset);
- gsubrIndexOffset = stringOffsets[stringOffsets.length-1];
- gsubrOffsets = getIndex(gsubrIndexOffset);
-
- fonts = new Font[nameOffsets.length-1];
-
- // now get the name index
-
- /*
- names = new String[nfonts];
- privateOffset = new int[nfonts];
- charsetOffset = new int[nfonts];
- encodingOffset = new int[nfonts];
- charstringsOffset = new int[nfonts];
- fdarrayOffset = new int[nfonts];
- fdselectOffset = new int[nfonts];
- */
-
- for (int j=0; j<nameOffsets.length-1; j++) {
- fonts[j] = new Font();
- seek(nameOffsets[j]);
- fonts[j].name = "";
- for (int k=nameOffsets[j]; k<nameOffsets[j+1]; k++) {
- fonts[j].name += (char)getCard8();
- }
- //System.err.println("name["+j+"]=<"+fonts[j].name+">");
- }
-
- // string index
-
- //strings = new String[stringOffsets.length-1];
- /*
- System.err.println("std strings = "+standardStrings.length);
- System.err.println("fnt strings = "+(stringOffsets.length-1));
- for (char j=0; j<standardStrings.length+(stringOffsets.length-1); j++) {
- //seek(stringOffsets[j]);
- //strings[j] = "";
- //for (int k=stringOffsets[j]; k<stringOffsets[j+1]; k++) {
- // strings[j] += (char)getCard8();
- //}
- System.err.println("j="+(int)j+" <? "+(standardStrings.length+(stringOffsets.length-1)));
- System.err.println("strings["+(int)j+"]=<"+getString(j)+">");
- }
- */
-
- // top dict
-
- for (int j=0; j<topdictOffsets.length-1; j++) {
- seek(topdictOffsets[j]);
- while (getPosition() < topdictOffsets[j+1]) {
- getDictItem();
- if (key=="FullName") {
- //System.err.println("getting fullname sid = "+((Integer)args[0]).intValue());
- fonts[j].fullName = getString((char)((Integer)args[0]).intValue());
- //System.err.println("got it");
- } else if (key=="ROS")
- fonts[j].isCID = true;
- else if (key=="Private") {
- fonts[j].privateLength = ((Integer)args[0]).intValue();
- fonts[j].privateOffset = ((Integer)args[1]).intValue();
- }
- else if (key=="charset"){
- fonts[j].charsetOffset = ((Integer)args[0]).intValue();
-
- }
- else if (key=="Encoding"){
- fonts[j].encodingOffset = ((Integer)args[0]).intValue();
- ReadEncoding(fonts[j].encodingOffset);
- }
- else if (key=="CharStrings") {
- fonts[j].charstringsOffset = ((Integer)args[0]).intValue();
- //System.err.println("charstrings "+fonts[j].charstringsOffset);
- // Added by Oren & Ygal
- int p = getPosition();
- fonts[j].charstringsOffsets = getIndex(fonts[j].charstringsOffset);
- seek(p);
- } else if (key=="FDArray")
- fonts[j].fdarrayOffset = ((Integer)args[0]).intValue();
- else if (key=="FDSelect")
- fonts[j].fdselectOffset = ((Integer)args[0]).intValue();
- else if (key=="CharstringType")
- fonts[j].CharstringType = ((Integer)args[0]).intValue();
- }
-
- // private dict
- if (fonts[j].privateOffset >= 0) {
- //System.err.println("PRIVATE::");
- seek(fonts[j].privateOffset);
- while (getPosition() < fonts[j].privateOffset+fonts[j].privateLength) {
- getDictItem();
- if (key=="Subrs")
- //Add the private offset to the lsubrs since the offset is
- // relative to the begining of the PrivateDict
- fonts[j].privateSubrs = ((Integer)args[0]).intValue()+fonts[j].privateOffset;
- }
- }
-
- // fdarray index
- if (fonts[j].fdarrayOffset >= 0) {
- int[] fdarrayOffsets = getIndex(fonts[j].fdarrayOffset);
-
- fonts[j].fdprivateOffsets = new int[fdarrayOffsets.length-1];
- fonts[j].fdprivateLengths = new int[fdarrayOffsets.length-1];
-
- //System.err.println("FD Font::");
-
- for (int k=0; k<fdarrayOffsets.length-1; k++) {
- seek(fdarrayOffsets[k]);
- while (getPosition() < fdarrayOffsets[k+1])
- getDictItem();
- if (key=="Private") {
- fonts[j].fdprivateLengths[k] = ((Integer)args[0]).intValue();
- fonts[j].fdprivateOffsets[k] = ((Integer)args[1]).intValue();
- }
-
- }
- }
- }
- //System.err.println("CFF: done");
- }
-
- // ADDED BY Oren & Ygal
-
- void ReadEncoding(int nextIndexOffset){
- int format;
- seek(nextIndexOffset);
- format = getCard8();
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/CFFFontSubset.java b/LibrarySource/com/lowagie/text/pdf/CFFFontSubset.java
deleted file mode 100644
index fdc8aec..0000000
--- a/LibrarySource/com/lowagie/text/pdf/CFFFontSubset.java
+++ /dev/null
@@ -1,1633 +0,0 @@
-/*
- * $Id: CFFFontSubset.java,v 1.3 2005/02/17 09:20:54 blowagie Exp $
- * $Name: $
- *
- * Copyright 2004 Oren Manor and Ygal Blum
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999-2005 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000-2005 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.ArrayList;
-import java.io.*;
-
-/**
- * This Class subsets a CFF Type Font. The subset is preformed for CID fonts and NON CID fonts.
- * The Charstring is subseted for both types. For CID fonts only the FDArray which are used are embedded.
- * The Lsubroutines of the FDArrays used are subsetted as well. The Subroutine subset supports both Type1 and Type2
- * formatting altough only tested on Type2 Format.
- * For Non CID the Lsubroutines are subsetted. On both types the Gsubroutines is subsetted.
- * A font which was not of CID type is transformed into CID as a part of the subset process.
- * The CID synthetic creation was written by Sivan Toledo <sivan at math.tau.ac.il>
- * @author Oren Manor <manorore at post.tau.ac.il> & Ygal Blum <blumygal at post.tau.ac.il>
- */
-public class CFFFontSubset extends CFFFont {
-
- /**
- * The Strings in this array represent Type1/Type2 operator names
- */
- static final String SubrsFunctions[] = {
- "RESERVED_0","hstem","RESERVED_2","vstem","vmoveto","rlineto","hlineto","vlineto",
- "rrcurveto","RESERVED_9","callsubr","return","escape","RESERVED_13",
- "endchar","RESERVED_15","RESERVED_16","RESERVED_17","hstemhm","hintmask",
- "cntrmask","rmoveto","hmoveto","vstemhm","rcurveline","rlinecurve","vvcurveto",
- "hhcurveto","shortint","callgsubr","vhcurveto","hvcurveto"
- };
- /**
- * The Strings in this array represent Type1/Type2 escape operator names
- */
- static final String SubrsEscapeFuncs[] = {
- "RESERVED_0","RESERVED_1","RESERVED_2","and","or","not","RESERVED_6",
- "RESERVED_7","RESERVED_8","abs","add","sub","div","RESERVED_13","neg",
- "eq","RESERVED_16","RESERVED_17","drop","RESERVED_19","put","get","ifelse",
- "random","mul","RESERVED_25","sqrt","dup","exch","index","roll","RESERVED_31",
- "RESERVED_32","RESERVED_33","hflex","flex","hflex1","flex1","RESERVED_REST"
- };
-
- /**
- * A HashMap containing the glyphs used in the text after being converted
- * to glyph number by the CMap
- */
- HashMap GlyphsUsed;
- /**
- * The GlyphsUsed keys as an ArrayList
- */
- ArrayList glyphsInList;
- /**
- * A HashMap for keeping the FDArrays being used by the font
- */
- HashMap FDArrayUsed = new HashMap();
- /**
- * A HashMaps array for keeping the subroutines used in each FontDict
- */
- HashMap[] hSubrsUsed;
- /**
- * The SubroutinesUsed HashMaps as ArrayLists
- */
- ArrayList[] lSubrsUsed;
- /**
- * A HashMap for keeping the Global subroutines used in the font
- */
- HashMap hGSubrsUsed = new HashMap();
- /**
- * The Global SubroutinesUsed HashMaps as ArrayLists
- */
- ArrayList lGSubrsUsed = new ArrayList();
- /**
- * A HashMap for keeping the subroutines used in a non-cid font
- */
- HashMap hSubrsUsedNonCID = new HashMap();
- /**
- * The SubroutinesUsed HashMap as ArrayList
- */
- ArrayList lSubrsUsedNonCID = new ArrayList();
- /**
- * An array of the new Indexs for the local Subr. One index for each FontDict
- */
- byte[][] NewLSubrsIndex;
- /**
- * The new subroutines index for a non-cid font
- */
- byte[] NewSubrsIndexNonCID;
- /**
- * The new global subroutines index of the font
- */
- byte[] NewGSubrsIndex;
- /**
- * The new CharString of the font
- */
- byte[] NewCharStringsIndex;
-
- /**
- * The bias for the global subroutines
- */
- int GBias = 0;
-
- /**
- * The linked list for generating the new font stream
- */
- LinkedList OutputList;
-
- /**
- * Number of arguments to the stem operators in a subroutine calculated recursivly
- */
- int NumOfHints=0;
-
-
- /**
- * C'tor for CFFFontSubset
- * @param rf - The font file
- * @param GlyphsUsed - a HashMap that contains the glyph used in the subset
- */
- public CFFFontSubset(RandomAccessFileOrArray rf,HashMap GlyphsUsed){
- // Use CFFFont c'tor in order to parse the font file.
- super(rf);
- this.GlyphsUsed = GlyphsUsed;
- //Put the glyphs into a list
- glyphsInList = new ArrayList(GlyphsUsed.keySet());
-
-
- for (int i=0;i<fonts.length;++i)
- {
- // Read the number of glyphs in the font
- seek(fonts[i].charstringsOffset);
- fonts[i].nglyphs = getCard16();
-
- // Jump to the count field of the String Index
- seek(stringIndexOffset);
- fonts[i].nstrings = getCard16()+standardStrings.length;
-
- // For each font save the offset array of the charstring
- fonts[i].charstringsOffsets = getIndex(fonts[i].charstringsOffset);
-
- // Proces the FDSelect if exist
- if (fonts[i].fdselectOffset>=0)
- {
- // Proces the FDSelect
- readFDSelect(i);
- // Build the FDArrayUsed hashmap
- BuildFDArrayUsed(i);
- }
- if (fonts[i].isCID)
- // Build the FD Array used Hash Map
- ReadFDArray(i);
- // compute the charset length
- fonts[i].CharsetLength = CountCharset(fonts[i].charsetOffset,fonts[i].nglyphs);
- }
- }
-
- /**
- * Calculates the length of the charset according to its format
- * @param Offset The Charset Offset
- * @param NumofGlyphs Number of glyphs in the font
- * @return the length of the Charset
- */
- int CountCharset(int Offset,int NumofGlyphs){
- int format;
- int Length=0;
- seek(Offset);
- // Read the format
- format = getCard8();
- // Calc according to format
- switch (format){
- case 0:
- Length = 1+2*NumofGlyphs;
- break;
- case 1:
- Length = 1+3*CountRange(NumofGlyphs,1);
- break;
- case 2:
- Length = 1+4*CountRange(NumofGlyphs,2);
- break;
- default:
- break;
- }
- return Length;
- }
-
- /**
- * Function calculates the number of ranges in the Charset
- * @param NumofGlyphs The number of glyphs in the font
- * @param Type The format of the Charset
- * @return The number of ranges in the Charset data structure
- */
- int CountRange(int NumofGlyphs,int Type){
- int num=0;
- char Sid;
- int i=1,nLeft,Places;
- while (i<NumofGlyphs){
- num++;
- Sid = getCard16();
- if (Type==1)
- nLeft = getCard8();
- else
- nLeft = getCard16();
- i += nLeft+1;
- }
- return num;
- }
-
-
- /**
- * Read the FDSelect of the font and compute the array and its length
- * @param Font The index of the font being processed
- * @return The Processed FDSelect of the font
- */
- protected void readFDSelect(int Font)
- {
- // Restore the number of glyphs
- int NumOfGlyphs = fonts[Font].nglyphs;
- int[] FDSelect = new int[NumOfGlyphs];
- // Go to the beginning of the FDSelect
- seek(fonts[Font].fdselectOffset);
- // Read the FDSelect's format
- fonts[Font].FDSelectFormat = getCard8();
-
- switch(fonts[Font].FDSelectFormat){
- // Format==0 means each glyph has an entry that indicated
- // its FD.
- case 0:
- for (int i=0;i<NumOfGlyphs;i++)
- {
- FDSelect[i] = getCard8();
- }
- // The FDSelect's Length is one for each glyph + the format
- // for later use
- fonts[Font].FDSelectLength = fonts[Font].nglyphs+1;
- break;
- case 3:
- // Format==3 means the ranges version
- // The number of ranges
- int nRanges = getCard16();
- int l=0;
- // Read the first in the first range
- int first = getCard16();
- for (int i=0;i<nRanges;i++)
- {
- // Read the FD index
- int fd = getCard8();
- // Read the first of the next range
- int last = getCard16();
- // Calc the steps and write to the array
- int steps = last-first;
- for (int k=0;k<steps;k++)
- {
- FDSelect[l] = fd;
- l++;
- }
- // The last from this iteration is the first of the next
- first = last;
- }
- // Store the length for later use
- fonts[Font].FDSelectLength = 1+2+nRanges*3+2;
- break;
- default:
- break;
- }
- // Save the FDSelect of the font
- fonts[Font].FDSelect = FDSelect;
- }
-
- /**
- * Function reads the FDSelect and builds the FDArrayUsed HashMap According to the glyphs used
- * @param Font the Number of font being processed
- */
- protected void BuildFDArrayUsed(int Font)
- {
- int[] FDSelect = fonts[Font].FDSelect;
- // For each glyph used
- for (int i=0;i<glyphsInList.size();i++)
- {
- // Pop the glyphs index
- int glyph = ((Integer)glyphsInList.get(i)).intValue();
- // Pop the glyph's FD
- int FD = FDSelect[glyph];
- // Put the FD index into the FDArrayUsed HashMap
- FDArrayUsed.put(new Integer(FD),null);
- }
- }
-
- /**
- * Read the FDArray count, offsize and Offset array
- * @param Font
- */
- protected void ReadFDArray(int Font)
- {
- seek(fonts[Font].fdarrayOffset);
- fonts[Font].FDArrayCount = getCard16();
- fonts[Font].FDArrayOffsize = getCard8();
- // Since we will change values inside the FDArray objects
- // We increase its offsize to prevent errors
- if (fonts[Font].FDArrayOffsize < 4)
- fonts[Font].FDArrayOffsize++;
- fonts[Font].FDArrayOffsets = getIndex(fonts[Font].fdarrayOffset);
- }
-
-
- /**
- * The Process function extracts one font out of the CFF file and returns a
- * subset version of the original.
- * @param fontName - The name of the font to be taken out of the CFF
- * @return The new font stream
- * @throws IOException
- */
- public byte[] Process(String fontName)throws IOException{
- try
- {
- // Verify that the file is open
- buf.reOpen();
- // Find the Font that we will be dealing with
- int j;
- for (j=0; j<fonts.length; j++)
- if (fontName.equals(fonts[j].name)) break;
- if (j==fonts.length) return null;
-
- // Calc the bias for the global subrs
- if (gsubrIndexOffset >= 0)
- GBias = CalcBias(gsubrIndexOffset,j);
-
- // Prepare the new CharStrings Index
- BuildNewCharString(j);
- // Prepare the new Global and Local Subrs Indices
- BuildNewLGSubrs(j);
- // Build the new file
- byte[] Ret = BuildNewFile(j);
- return Ret;
- }
- finally {
- try {
- buf.close();
- }
- catch (Exception e) {
- // empty on purpose
- }
- }
- }
-
- /**
- * Function calcs bias according to the CharString type and the count
- * of the subrs
- * @param Offset The offset to the relevent subrs index
- * @param Font the font
- * @return The calculated Bias
- */
- protected int CalcBias(int Offset,int Font)
- {
- seek(Offset);
- int nSubrs = getCard16();
- // If type==1 -> bias=0
- if (fonts[Font].CharstringType == 1)
- return 0;
- // else calc according to the count
- else if (nSubrs < 1240)
- return 107;
- else if (nSubrs < 33900)
- return 1131;
- else
- return 32768;
- }
-
- /**
- *Function uses BuildNewIndex to create the new index of the subset charstrings
- * @param FontIndex the font
- * @throws IOException
- */
- protected void BuildNewCharString(int FontIndex) throws IOException
- {
- NewCharStringsIndex = BuildNewIndex(fonts[FontIndex].charstringsOffsets,GlyphsUsed);
- }
-
- /**
- * Function builds the new local & global subsrs indices. IF CID then All of
- * the FD Array lsubrs will be subsetted.
- * @param Font the font
- * @throws IOException
- */
- protected void BuildNewLGSubrs(int Font)throws IOException
- {
- // If the font is CID then the lsubrs are divided into FontDicts.
- // for each FD array the lsubrs will be subsetted.
- if(fonts[Font].isCID)
- {
- // Init the hasmap-array and the arraylist-array to hold the subrs used
- // in each private dict.
- hSubrsUsed = new HashMap[fonts[Font].fdprivateOffsets.length];
- lSubrsUsed = new ArrayList[fonts[Font].fdprivateOffsets.length];
- // A [][] which will store the byte array for each new FD Array lsubs index
- NewLSubrsIndex = new byte[fonts[Font].fdprivateOffsets.length][];
- // An array to hold the offset for each Lsubr index
- fonts[Font].PrivateSubrsOffset = new int[fonts[Font].fdprivateOffsets.length];
- // A [][] which will store the offset array for each lsubr index
- fonts[Font].PrivateSubrsOffsetsArray = new int[fonts[Font].fdprivateOffsets.length][];
-
- // Put the FDarrayUsed into a list
- ArrayList FDInList = new ArrayList(FDArrayUsed.keySet());
- // For each FD array which is used subset the lsubr
- for (int j=0;j<FDInList.size();j++)
- {
- // The FDArray index, Hash Map, Arrat List to work on
- int FD = ((Integer)FDInList.get(j)).intValue();
- hSubrsUsed[FD] = new HashMap();
- lSubrsUsed[FD] = new ArrayList();
- //Reads the private dicts looking for the subr operator and
- // store both the offest for the index and its offset array
- BuildFDSubrsOffsets(Font,FD);
- // Verify that FDPrivate has a LSubrs index
- if(fonts[Font].PrivateSubrsOffset[FD]>=0)
- {
- //Scans the Charsting data storing the used Local and Global subroutines
- // by the glyphs. Scans the Subrs recursivley.
- BuildSubrUsed(Font,FD,fonts[Font].PrivateSubrsOffset[FD],fonts[Font].PrivateSubrsOffsetsArray[FD],hSubrsUsed[FD],lSubrsUsed[FD]);
- // Builds the New Local Subrs index
- NewLSubrsIndex[FD] = BuildNewIndex(fonts[Font].PrivateSubrsOffsetsArray[FD],hSubrsUsed[FD]);
- }
- }
- }
- // If the font is not CID && the Private Subr exists then subset:
- else if (fonts[Font].privateSubrs>=0)
- {
- // Build the subrs offsets;
- fonts[Font].SubrsOffsets = getIndex(fonts[Font].privateSubrs);
- //Scans the Charsting data storing the used Local and Global subroutines
- // by the glyphs. Scans the Subrs recursivley.
- BuildSubrUsed(Font,-1,fonts[Font].privateSubrs,fonts[Font].SubrsOffsets,hSubrsUsedNonCID,lSubrsUsedNonCID);
- }
- // For all fonts susbset the Global Subroutines
- // Scan the Global Subr Hashmap recursivly on the Gsubrs
- BuildGSubrsUsed(Font);
- if (fonts[Font].privateSubrs>=0)
- // Builds the New Local Subrs index
- NewSubrsIndexNonCID = BuildNewIndex(fonts[Font].SubrsOffsets,hSubrsUsedNonCID);
- //Builds the New Global Subrs index
- NewGSubrsIndex = BuildNewIndex(gsubrOffsets,hGSubrsUsed);
- }
-
- /**
- * The function finds for the FD array processed the local subr offset and its
- * offset array.
- * @param Font the font
- * @param FD The FDARRAY processed
- */
- protected void BuildFDSubrsOffsets(int Font,int FD)
- {
- // Initiate to -1 to indicate lsubr operator present
- fonts[Font].PrivateSubrsOffset[FD] = -1;
- // Goto begining of objects
- seek(fonts[Font].fdprivateOffsets[FD]);
- // While in the same object:
- while (getPosition() < fonts[Font].fdprivateOffsets[FD]+fonts[Font].fdprivateLengths[FD])
- {
- getDictItem();
- // If the dictItem is the "Subrs" then find and store offset,
- if (key=="Subrs")
- fonts[Font].PrivateSubrsOffset[FD] = ((Integer)args[0]).intValue()+fonts[Font].fdprivateOffsets[FD];
- }
- //Read the lsub index if the lsubr was found
- if (fonts[Font].PrivateSubrsOffset[FD] >= 0)
- fonts[Font].PrivateSubrsOffsetsArray[FD] = getIndex(fonts[Font].PrivateSubrsOffset[FD]);
- }
-
- /**
- * Function uses ReadAsubr on the glyph used to build the LSubr & Gsubr HashMap.
- * The HashMap (of the lsub only) is then scaned recursivly for Lsubr & Gsubrs
- * calls.
- * @param Font the font
- * @param FD FD array processed. 0 indicates function was called by non CID font
- * @param SubrOffset the offset to the subr index to calc the bias
- * @param SubrsOffsets the offset array of the subr index
- * @param hSubr HashMap of the subrs used
- * @param lSubr ArrayList of the subrs used
- */
- protected void BuildSubrUsed(int Font,int FD,int SubrOffset,int[] SubrsOffsets,HashMap hSubr,ArrayList lSubr)
- {
-
- // Calc the Bias for the subr index
- int LBias = CalcBias(SubrOffset,Font);
-
- // For each glyph used find its GID, start & end pos
- for (int i=0;i<glyphsInList.size();i++)
- {
- int glyph = ((Integer)glyphsInList.get(i)).intValue();
- int Start = fonts[Font].charstringsOffsets[glyph];
- int End = fonts[Font].charstringsOffsets[glyph+1];
-
- // IF CID:
- if (FD >= 0)
- {
- EmptyStack();
- NumOfHints=0;
- // Using FDSELECT find the FD Array the glyph belongs to.
- int GlyphFD = fonts[Font].FDSelect[glyph];
- // If the Glyph is part of the FD being processed
- if (GlyphFD == FD)
- // Find the Subrs called by the glyph and insert to hash:
- ReadASubr(Start,End,GBias,LBias,hSubr,lSubr,SubrsOffsets);
- }
- else
- // If the font is not CID
- //Find the Subrs called by the glyph and insert to hash:
- ReadASubr(Start,End,GBias,LBias,hSubr,lSubr,SubrsOffsets);
- }
- // For all Lsubrs used, check recusrivly for Lsubr & Gsubr used
- for (int i=0;i<lSubr.size();i++)
- {
- // Pop the subr value from the hash
- int Subr = ((Integer)lSubr.get(i)).intValue();
- // Ensure the Lsubr call is valid
- if (Subr < SubrsOffsets.length-1 && Subr>=0)
- {
- // Read and process the subr
- int Start = SubrsOffsets[Subr];
- int End = SubrsOffsets[Subr+1];
- ReadASubr(Start,End,GBias,LBias,hSubr,lSubr,SubrsOffsets);
- }
- }
- }
-
- /**
- * Function scans the Glsubr used ArrayList to find recursive calls
- * to Gsubrs and adds to Hashmap & ArrayList
- * @param Font the font
- */
- protected void BuildGSubrsUsed(int Font)
- {
- int LBias = 0;
- int SizeOfNonCIDSubrsUsed = 0;
- if (fonts[Font].privateSubrs>=0)
- {
- LBias = CalcBias(fonts[Font].privateSubrs,Font);
- SizeOfNonCIDSubrsUsed = lSubrsUsedNonCID.size();
- }
-
- // For each global subr used
- for (int i=0;i<lGSubrsUsed.size();i++)
- {
- //Pop the value + check valid
- int Subr = ((Integer)lGSubrsUsed.get(i)).intValue();
- if (Subr < gsubrOffsets.length-1 && Subr>=0)
- {
- // Read the subr and process
- int Start = gsubrOffsets[Subr];
- int End = gsubrOffsets[Subr+1];
-
- if (fonts[Font].isCID)
- ReadASubr(Start,End,GBias,0,hGSubrsUsed,lGSubrsUsed,null);
- else
- {
- ReadASubr(Start,End,GBias,LBias,hSubrsUsedNonCID,lSubrsUsedNonCID,fonts[Font].SubrsOffsets);
- if (SizeOfNonCIDSubrsUsed < lSubrsUsedNonCID.size())
- {
- for (int j=SizeOfNonCIDSubrsUsed;j<lSubrsUsedNonCID.size();j++)
- {
- //Pop the value + check valid
- int LSubr = ((Integer)lSubrsUsedNonCID.get(j)).intValue();
- if (LSubr < fonts[Font].SubrsOffsets.length-1 && LSubr>=0)
- {
- // Read the subr and process
- int LStart = fonts[Font].SubrsOffsets[LSubr];
- int LEnd = fonts[Font].SubrsOffsets[LSubr+1];
- ReadASubr(LStart,LEnd,GBias,LBias,hSubrsUsedNonCID,lSubrsUsedNonCID,fonts[Font].SubrsOffsets);
- }
- }
- SizeOfNonCIDSubrsUsed = lSubrsUsedNonCID.size();
- }
- }
- }
- }
- }
-
- /**
- * The function reads a subrs (glyph info) between begin and end.
- * Adds calls to a Lsubr to the hSubr and lSubrs.
- * Adds calls to a Gsubr to the hGSubr and lGSubrs.
- * @param begin the start point of the subr
- * @param end the end point of the subr
- * @param GBias the bias of the Global Subrs
- * @param LBias the bias of the Local Subrs
- * @param hSubr the HashMap for the lSubrs
- * @param lSubr the ArrayList for the lSubrs
- */
- protected void ReadASubr(int begin,int end,int GBias,int LBias,HashMap hSubr,ArrayList lSubr,int[] LSubrsOffsets)
- {
- // Clear the stack for the subrs
- EmptyStack();
- NumOfHints = 0;
- // Goto begining of the subr
- seek(begin);
- while (getPosition() < end)
- {
- // Read the next command
- ReadCommand();
- int pos = getPosition();
- Object TopElement=null;
- if (arg_count > 0)
- TopElement = args[arg_count-1];
- int NumOfArgs = arg_count;
- // Check the modification needed on the Argument Stack according to key;
- HandelStack();
- // a call to a Lsubr
- if (key=="callsubr")
- {
- // Verify that arguments are passed
- if (NumOfArgs > 0)
- {
- // Calc the index of the Subrs
- int Subr = ((Integer)TopElement).intValue() + LBias;
- // If the subr isn't in the HashMap -> Put in
- if (!hSubr.containsKey(new Integer (Subr)))
- {
- hSubr.put(new Integer(Subr),null);
- lSubr.add(new Integer(Subr));
- }
- CalcHints(LSubrsOffsets[Subr],LSubrsOffsets[Subr+1],LBias,GBias,LSubrsOffsets);
- seek(pos);
- }
- }
- // a call to a Gsubr
- else if (key=="callgsubr")
- {
- // Verify that arguments are passed
- if (NumOfArgs > 0)
- {
- // Calc the index of the Subrs
- int Subr = ((Integer)TopElement).intValue() + GBias;
- // If the subr isn't in the HashMap -> Put in
- if (!hGSubrsUsed.containsKey(new Integer (Subr)))
- {
- hGSubrsUsed.put(new Integer(Subr),null);
- lGSubrsUsed.add(new Integer(Subr));
- }
- CalcHints(gsubrOffsets[Subr],gsubrOffsets[Subr+1],LBias,GBias,LSubrsOffsets);
- seek(pos);
- }
- }
- // A call to "stem"
- else if (key == "hstem" || key == "vstem" || key == "hstemhm" || key == "vstemhm")
- // Increment the NumOfHints by the number couples of of arguments
- NumOfHints += NumOfArgs/2;
- // A call to "mask"
- else if (key == "hintmask" || key == "cntrmask")
- {
- // Compute the size of the mask
- int SizeOfMask = NumOfHints/8;
- if (NumOfHints%8 != 0 || SizeOfMask == 0)
- SizeOfMask++;
- // Continue the pointer in SizeOfMask steps
- for (int i=0;i<SizeOfMask;i++)
- getCard8();
- }
- }
- }
-
- /**
- * Function Checks how the current operator effects the run time stack after being run
- * An operator may increase or decrease the stack size
- */
- protected void HandelStack()
- {
- // Findout what the operator does to the stack
- int StackHandel = StackOpp();
- if (StackHandel < 2)
- {
- // The operators that enlarge the stack by one
- if (StackHandel==1)
- PushStack();
- // The operators that pop the stack
- else
- {
- // Abs value for the for loop
- StackHandel *= -1;
- for (int i=0;i<StackHandel;i++)
- PopStack();
- }
-
- }
- // All other flush the stack
- else
- EmptyStack();
- }
-
- /**
- * Function checks the key and return the change to the stack after the operator
- * @return The change in the stack. 2-> flush the stack
- */
- protected int StackOpp()
- {
- if (key == "ifelse")
- return -3;
- if (key == "roll" || key == "put")
- return -2;
- if (key == "callsubr" || key == "callgsubr" || key == "add" || key == "sub" ||
- key == "div" || key == "mul" || key == "drop" || key == "and" ||
- key == "or" || key == "eq")
- return -1;
- if (key == "abs" || key == "neg" || key == "sqrt" || key == "exch" ||
- key == "index" || key == "get" || key == "not" || key == "return")
- return 0;
- if (key == "random" || key == "dup")
- return 1;
- return 2;
- }
-
- /**
- * Empty the Type2 Stack
- *
- */
- protected void EmptyStack()
- {
- // Null the arguments
- for (int i=0; i<arg_count; i++) args[i]=null;
- arg_count = 0;
- }
-
- /**
- * Pop one element from the stack
- *
- */
- protected void PopStack()
- {
- if (arg_count>0)
- {
- args[arg_count-1]=null;
- arg_count--;
- }
- }
-
- /**
- * Add an item to the stack
- *
- */
- protected void PushStack()
- {
- arg_count++;
- }
-
- /**
- * The function reads the next command after the file pointer is set
- */
- protected void ReadCommand()
- {
- key = null;
- boolean gotKey = false;
- // Until a key is found
- while (!gotKey) {
- // Read the first Char
- char b0 = getCard8();
- // decode according to the type1/type2 format
- if (b0 == 28) // the two next bytes represent a short int;
- {
- int first = getCard8();
- int second = getCard8();
- args[arg_count] = new Integer(first<<8 | second);
- arg_count++;
- continue;
- }
- if (b0 >= 32 && b0 <= 246) // The byte read is the byte;
- {
- args[arg_count] = new Integer(b0 - 139);
- arg_count++;
- continue;
- }
- if (b0 >= 247 && b0 <= 250) // The byte read and the next byte constetute a short int
- {
- int w = getCard8();
- args[arg_count] = new Integer((b0-247)*256 + w + 108);
- arg_count++;
- continue;
- }
- if (b0 >= 251 && b0 <= 254)// Same as above except negative
- {
- int w = getCard8();
- args[arg_count] = new Integer(-(b0-251)*256 - w - 108);
- arg_count++;
- continue;
- }
- if (b0 == 255)// The next for bytes represent a double.
- {
- int first = getCard8();
- int second = getCard8();
- int third = getCard8();
- int fourth = getCard8();
- args[arg_count] = new Integer(first<<24 | second<<16 | third<<8 | fourth);
- arg_count++;
- continue;
- }
- if (b0<=31 && b0 != 28) // An operator was found.. Set Key.
- {
- gotKey=true;
- // 12 is an escape command therefor the next byte is a part
- // of this command
- if (b0 == 12)
- {
- int b1 = getCard8();
- if (b1>SubrsEscapeFuncs.length-1)
- b1 = SubrsEscapeFuncs.length-1;
- key = SubrsEscapeFuncs[b1];
- }
- else
- key = SubrsFunctions[b0];
- continue;
- }
- }
- }
-
- /**
- * The function reads the subroutine and returns the number of the hint in it.
- * If a call to another subroutine is found the function calls recursively.
- * @param begin the start point of the subr
- * @param end the end point of the subr
- * @param LBias the bias of the Local Subrs
- * @param GBias the bias of the Global Subrs
- * @param LSubrsOffsets The Offsets array of the subroutines
- * @return The number of hints in the subroutine read.
- */
- protected int CalcHints(int begin,int end,int LBias,int GBias,int[] LSubrsOffsets)
- {
- // Goto begining of the subr
- seek(begin);
- while (getPosition() < end)
- {
- // Read the next command
- ReadCommand();
- int pos = getPosition();
- Object TopElement = null;
- if (arg_count>0)
- TopElement = args[arg_count-1];
- int NumOfArgs = arg_count;
- //Check the modification needed on the Argument Stack according to key;
- HandelStack();
- // a call to a Lsubr
- if (key=="callsubr")
- {
- if (NumOfArgs>0)
- {
- int Subr = ((Integer)TopElement).intValue() + LBias;
- CalcHints(LSubrsOffsets[Subr],LSubrsOffsets[Subr+1],LBias,GBias,LSubrsOffsets);
- seek(pos);
- }
- }
- // a call to a Gsubr
- else if (key=="callgsubr")
- {
- if (NumOfArgs>0)
- {
- int Subr = ((Integer)TopElement).intValue() + GBias;
- CalcHints(gsubrOffsets[Subr],gsubrOffsets[Subr+1],LBias,GBias,LSubrsOffsets);
- seek(pos);
- }
- }
- // A call to "stem"
- else if (key == "hstem" || key == "vstem" || key == "hstemhm" || key == "vstemhm")
- // Increment the NumOfHints by the number couples of of arguments
- NumOfHints += NumOfArgs/2;
- // A call to "mask"
- else if (key == "hintmask" || key == "cntrmask")
- {
- // Compute the size of the mask
- int SizeOfMask = NumOfHints/8;
- if (NumOfHints%8 != 0 || SizeOfMask == 0)
- SizeOfMask++;
- // Continue the pointer in SizeOfMask steps
- for (int i=0;i<SizeOfMask;i++)
- getCard8();
- }
- }
- return NumOfHints;
- }
-
-
- /**
- * Function builds the new offset array, object array and assembles the index.
- * used for creating the glyph and subrs subsetted index
- * @param Offsets the offset array of the original index
- * @param Used the hashmap of the used objects
- * @return the new index subset version
- * @throws IOException
- */
- protected byte[] BuildNewIndex(int[] Offsets,HashMap Used) throws IOException
- {
- int Offset=0;
- int[] NewOffsets = new int[Offsets.length];
- // Build the Offsets Array for the Subset
- for (int i=0;i<Offsets.length;++i)
- {
- NewOffsets[i] = Offset;
- // If the object in the offset is also present in the used
- // HashMap then increment the offset var by its size
- if (Used.containsKey(new Integer(i)))
- Offset += Offsets[i+1] - Offsets[i];
- // Else the same offset is kept in i+1.
- }
- // Offset var determines the size of the object array
- byte[] NewObjects = new byte[Offset];
- // Build the new Object array
- for (int i=0;i<Offsets.length-1;++i)
- {
- int start = NewOffsets[i];
- int end = NewOffsets[i+1];
- // If start != End then the Object is used
- // So, we will copy the object data from the font file
- if (start != end)
- {
- // All offsets are Global Offsets relative to the begining of the font file.
- // Jump the file pointer to the start address to read from.
- buf.seek(Offsets[i]);
- // Read from the buffer and write into the array at start.
- buf.readFully(NewObjects, start, end-start);
- }
- }
- // Use AssembleIndex to build the index from the offset & object arrays
- return AssembleIndex(NewOffsets,NewObjects);
- }
-
- /**
- * Function creates the new index, inserting the count,offsetsize,offset array
- * and object array.
- * @param NewOffsets the subsetted offset array
- * @param NewObjects the subsetted object array
- * @return the new index created
- */
- protected byte[] AssembleIndex(int[] NewOffsets,byte[] NewObjects)
- {
- // Calc the index' count field
- char Count = (char)(NewOffsets.length-1);
- // Calc the size of the object array
- int Size = NewOffsets[NewOffsets.length-1];
- // Calc the Offsize
- byte Offsize;
- if (Size <= 0xff) Offsize = 1;
- else if (Size <= 0xffff) Offsize = 2;
- else if (Size <= 0xffffff) Offsize = 3;
- else Offsize = 4;
- // The byte array for the new index. The size is calc by
- // Count=2, Offsize=1, OffsetArray = Offsize*(Count+1), The object array
- byte[] NewIndex = new byte[2+1+Offsize*(Count+1)+NewObjects.length];
- // The counter for writing
- int Place = 0;
- // Write the count field
- NewIndex[Place++] = (byte) ((Count >>> 8) & 0xff);
- NewIndex[Place++] = (byte) ((Count >>> 0) & 0xff);
- // Write the offsize field
- NewIndex[Place++] = Offsize;
- // Write the offset array according to the offsize
- for (int i=0;i<NewOffsets.length;i++)
- {
- // The value to be written
- int Num = NewOffsets[i]-NewOffsets[0]+1;
- // Write in bytes according to the offsize
- switch (Offsize) {
- case 4:
- NewIndex[Place++] = (byte) ((Num >>> 24) & 0xff);
- case 3:
- NewIndex[Place++] = (byte) ((Num >>> 16) & 0xff);
- case 2:
- NewIndex[Place++] = (byte) ((Num >>> 8) & 0xff);
- case 1:
- NewIndex[Place++] = (byte) ((Num >>> 0) & 0xff);
- }
- }
- // Write the new object array one by one
- for (int i=0;i<NewObjects.length;i++)
- {
- NewIndex[Place++] = NewObjects[i];
- }
- // Return the new index
- return NewIndex;
- }
-
- /**
- * The function builds the new output stream according to the subset process
- * @param Font the font
- * @return the subseted font stream
- * @throws IOException
- */
- protected byte[] BuildNewFile(int Font)throws IOException
- {
- // Prepare linked list for new font components
- OutputList = new LinkedList();
-
- // copy the header of the font
- CopyHeader();
-
- // create a name index
- BuildIndexHeader(1,1,1);
- OutputList.addLast(new UInt8Item((char)( 1+fonts[Font].name.length() )));
- OutputList.addLast(new StringItem(fonts[Font].name));
-
- // create the topdict Index
- BuildIndexHeader(1,2,1);
- OffsetItem topdictIndex1Ref = new IndexOffsetItem(2);
- OutputList.addLast(topdictIndex1Ref);
- IndexBaseItem topdictBase = new IndexBaseItem();
- OutputList.addLast(topdictBase);
-
- // Initialise the Dict Items for later use
- OffsetItem charsetRef = new DictOffsetItem();
- OffsetItem charstringsRef = new DictOffsetItem();
- OffsetItem fdarrayRef = new DictOffsetItem();
- OffsetItem fdselectRef = new DictOffsetItem();
- OffsetItem privateRef = new DictOffsetItem();
-
- // If the font is not CID create the following keys
- if ( !fonts[Font].isCID ) {
- // create a ROS key
- OutputList.addLast(new DictNumberItem(fonts[Font].nstrings));
- OutputList.addLast(new DictNumberItem(fonts[Font].nstrings+1));
- OutputList.addLast(new DictNumberItem(0));
- OutputList.addLast(new UInt8Item((char)12));
- OutputList.addLast(new UInt8Item((char)30));
- // create a CIDCount key
- OutputList.addLast(new DictNumberItem(fonts[Font].nglyphs));
- OutputList.addLast(new UInt8Item((char)12));
- OutputList.addLast(new UInt8Item((char)34));
- // Sivan's comments
- // What about UIDBase (12,35)? Don't know what is it.
- // I don't think we need FontName; the font I looked at didn't have it.
- }
- // Go to the TopDict of the font being processed
- seek(topdictOffsets[Font]);
- // Run untill the end of the TopDict
- while (getPosition() < topdictOffsets[Font+1]) {
- int p1 = getPosition();
- getDictItem();
- int p2 = getPosition();
- // The encoding key is disregarded since CID has no encoding
- if (key=="Encoding"
- // These keys will be added manualy by the process.
- || key=="Private"
- || key=="FDSelect"
- || key=="FDArray"
- || key=="charset"
- || key=="CharStrings"
- ) {
- }else {
- //OtherWise copy key "as is" to the output list
- OutputList.add(new RangeItem(buf,p1,p2-p1));
- }
- }
- // Create the FDArray, FDSelect, Charset and CharStrings Keys
- CreateKeys(fdarrayRef,fdselectRef,charsetRef,charstringsRef);
-
- // Mark the end of the top dict area
- OutputList.addLast(new IndexMarkerItem(topdictIndex1Ref,topdictBase));
-
- // Copy the string index
-
- if (fonts[Font].isCID)
- OutputList.addLast(getEntireIndexRange(stringIndexOffset));
- // If the font is not CID we need to append new strings.
- // We need 3 more strings: Registry, Ordering, and a FontName for one FD.
- // The total length is at most "Adobe"+"Identity"+63 = 76
- else
- CreateNewStringIndex(Font);
-
- // copy the new subsetted global subroutine index
- OutputList.addLast(new RangeItem(new RandomAccessFileOrArray(NewGSubrsIndex),0,NewGSubrsIndex.length));
-
- // deal with fdarray, fdselect, and the font descriptors
- // If the font is CID:
- if (fonts[Font].isCID) {
- // copy the FDArray, FDSelect, charset
-
- // Copy FDSelect
- // Mark the beginning
- OutputList.addLast(new MarkerItem(fdselectRef));
- // If an FDSelect exists copy it
- if (fonts[Font].fdselectOffset>=0)
- OutputList.addLast(new RangeItem(buf,fonts[Font].fdselectOffset,fonts[Font].FDSelectLength));
- // Else create a new one
- else
- CreateFDSelect(fdselectRef,fonts[Font].nglyphs);
-
- // Copy the Charset
- // Mark the beginning and copy entirly
- OutputList.addLast(new MarkerItem(charsetRef));
- OutputList.addLast(new RangeItem(buf,fonts[Font].charsetOffset,fonts[Font].CharsetLength));
-
- // Copy the FDArray
- // If an FDArray exists
- if (fonts[Font].fdarrayOffset>=0)
- {
- // Mark the beginning
- OutputList.addLast(new MarkerItem(fdarrayRef));
- // Build a new FDArray with its private dicts and their LSubrs
- Reconstruct(Font);
- }
- else
- // Else create a new one
- CreateFDArray(fdarrayRef,privateRef,Font);
-
- }
- // If the font is not CID
- else
- {
- // create FDSelect
- CreateFDSelect(fdselectRef,fonts[Font].nglyphs);
- // recreate a new charset
- CreateCharset(charsetRef,fonts[Font].nglyphs);
- // create a font dict index (fdarray)
- CreateFDArray(fdarrayRef,privateRef,Font);
- }
-
- // if a private dict exists insert its subsetted version
- if (fonts[Font].privateOffset>=0)
- {
- // Mark the beginning of the private dict
- IndexBaseItem PrivateBase = new IndexBaseItem();
- OutputList.addLast(PrivateBase);
- OutputList.addLast(new MarkerItem(privateRef));
-
- OffsetItem Subr = new DictOffsetItem();
- // Build and copy the new private dict
- CreateNonCIDPrivate(Font,Subr);
- // Copy the new LSubrs index
- CreateNonCIDSubrs(Font,PrivateBase,Subr);
- }
-
- // copy the charstring index
- OutputList.addLast(new MarkerItem(charstringsRef));
-
- // Add the subsetted charstring
- OutputList.addLast(new RangeItem(new RandomAccessFileOrArray(NewCharStringsIndex),0,NewCharStringsIndex.length));
-
- // now create the new CFF font
- int[] currentOffset = new int[1];
- currentOffset[0] = 0;
- // Count and save the offset for each item
- Iterator listIter = OutputList.iterator();
- while ( listIter.hasNext() ) {
- Item item = (Item) listIter.next();
- item.increment(currentOffset);
- }
- // Compute the Xref for each of the offset items
- listIter = OutputList.iterator();
- while ( listIter.hasNext() ) {
- Item item = (Item) listIter.next();
- item.xref();
- }
-
- int size = currentOffset[0];
- byte[] b = new byte[size];
-
- // Emit all the items into the new byte array
- listIter = OutputList.iterator();
- while ( listIter.hasNext() ) {
- Item item = (Item) listIter.next();
- item.emit(b);
- }
- // Return the new stream
- return b;
- }
-
- /**
- * Function Copies the header from the original fileto the output list
- */
- protected void CopyHeader()
- {
- seek(0);
- int major = getCard8();
- int minor = getCard8();
- int hdrSize = getCard8();
- int offSize = getCard8();
- nextIndexOffset = hdrSize;
- OutputList.addLast(new RangeItem(buf,0,hdrSize));
- }
-
- /**
- * Function Build the header of an index
- * @param Count the count field of the index
- * @param Offsize the offsize field of the index
- * @param First the first offset of the index
- */
- protected void BuildIndexHeader(int Count,int Offsize,int First)
- {
- // Add the count field
- OutputList.addLast(new UInt16Item((char)Count)); // count
- // Add the offsize field
- OutputList.addLast(new UInt8Item((char)Offsize)); // offSize
- // Add the first offset according to the offsize
- switch(Offsize){
- case 1:
- OutputList.addLast(new UInt8Item((char)First)); // first offset
- break;
- case 2:
- OutputList.addLast(new UInt16Item((char)First)); // first offset
- break;
- case 3:
- OutputList.addLast(new UInt24Item((char)First)); // first offset
- break;
- case 4:
- OutputList.addLast(new UInt32Item((char)First)); // first offset
- break;
- default:
- break;
- }
- }
-
- /**
- * Function adds the keys into the TopDict
- * @param fdarrayRef OffsetItem for the FDArray
- * @param fdselectRef OffsetItem for the FDSelect
- * @param charsetRef OffsetItem for the CharSet
- * @param charstringsRef OffsetItem for the CharString
- */
- protected void CreateKeys(OffsetItem fdarrayRef,OffsetItem fdselectRef,OffsetItem charsetRef,OffsetItem charstringsRef)
- {
- // create an FDArray key
- OutputList.addLast(fdarrayRef);
- OutputList.addLast(new UInt8Item((char)12));
- OutputList.addLast(new UInt8Item((char)36));
- // create an FDSelect key
- OutputList.addLast(fdselectRef);
- OutputList.addLast(new UInt8Item((char)12));
- OutputList.addLast(new UInt8Item((char)37));
- // create an charset key
- OutputList.addLast(charsetRef);
- OutputList.addLast(new UInt8Item((char)15));
- // create a CharStrings key
- OutputList.addLast(charstringsRef);
- OutputList.addLast(new UInt8Item((char)17));
- }
-
- /**
- * Function takes the original string item and adds the new strings
- * to accomodate the CID rules
- * @param Font the font
- */
- protected void CreateNewStringIndex(int Font)
- {
- String fdFontName = fonts[Font].name+"-OneRange";
- if (fdFontName.length() > 127)
- fdFontName = fdFontName.substring(0,127);
- String extraStrings = "Adobe"+"Identity"+fdFontName;
-
- int origStringsLen = stringOffsets[stringOffsets.length-1]
- - stringOffsets[0];
- int stringsBaseOffset = stringOffsets[0]-1;
-
- byte stringsIndexOffSize;
- if (origStringsLen+extraStrings.length() <= 0xff) stringsIndexOffSize = 1;
- else if (origStringsLen+extraStrings.length() <= 0xffff) stringsIndexOffSize = 2;
- else if (origStringsLen+extraStrings.length() <= 0xffffff) stringsIndexOffSize = 3;
- else stringsIndexOffSize = 4;
-
- OutputList.addLast(new UInt16Item((char)((stringOffsets.length-1)+3))); // count
- OutputList.addLast(new UInt8Item((char)stringsIndexOffSize)); // offSize
- for (int i=0; i<stringOffsets.length; i++)
- OutputList.addLast(new IndexOffsetItem(stringsIndexOffSize,
- stringOffsets[i]-stringsBaseOffset));
- int currentStringsOffset = stringOffsets[stringOffsets.length-1]
- - stringsBaseOffset;
- //l.addLast(new IndexOffsetItem(stringsIndexOffSize,currentStringsOffset));
- currentStringsOffset += ("Adobe").length();
- OutputList.addLast(new IndexOffsetItem(stringsIndexOffSize,currentStringsOffset));
- currentStringsOffset += ("Identity").length();
- OutputList.addLast(new IndexOffsetItem(stringsIndexOffSize,currentStringsOffset));
- currentStringsOffset += fdFontName.length();
- OutputList.addLast(new IndexOffsetItem(stringsIndexOffSize,currentStringsOffset));
-
- OutputList.addLast(new RangeItem(buf,stringOffsets[0],origStringsLen));
- OutputList.addLast(new StringItem(extraStrings));
- }
-
- /**
- * Function creates new FDSelect for non-CID fonts.
- * The FDSelect built uses a single range for all glyphs
- * @param fdselectRef OffsetItem for the FDSelect
- * @param nglyphs the number of glyphs in the font
- */
- protected void CreateFDSelect(OffsetItem fdselectRef,int nglyphs)
- {
- OutputList.addLast(new MarkerItem(fdselectRef));
- OutputList.addLast(new UInt8Item((char)3)); // format identifier
- OutputList.addLast(new UInt16Item((char)1)); // nRanges
-
- OutputList.addLast(new UInt16Item((char)0)); // Range[0].firstGlyph
- OutputList.addLast(new UInt8Item((char)0)); // Range[0].fd
-
- OutputList.addLast(new UInt16Item((char)nglyphs)); // sentinel
- }
-
- /**
- * Function creates new CharSet for non-CID fonts.
- * The CharSet built uses a single range for all glyphs
- * @param charsetRef OffsetItem for the CharSet
- * @param nglyphs the number of glyphs in the font
- */
- protected void CreateCharset(OffsetItem charsetRef,int nglyphs)
- {
- OutputList.addLast(new MarkerItem(charsetRef));
- OutputList.addLast(new UInt8Item((char)2)); // format identifier
- OutputList.addLast(new UInt16Item((char)1)); // first glyph in range (ignore .notdef)
- OutputList.addLast(new UInt16Item((char)(nglyphs-1))); // nLeft
- }
-
- /**
- * Function creates new FDArray for non-CID fonts.
- * The FDArray built has only the "Private" operator that points to the font's
- * original private dict
- * @param fdarrayRef OffsetItem for the FDArray
- * @param privateRef OffsetItem for the Private Dict
- * @param Font the font
- */
- protected void CreateFDArray(OffsetItem fdarrayRef,OffsetItem privateRef,int Font)
- {
- OutputList.addLast(new MarkerItem(fdarrayRef));
- // Build the header (count=offsize=first=1)
- BuildIndexHeader(1,1,1);
-
- // Mark
- OffsetItem privateIndex1Ref = new IndexOffsetItem(1);
- OutputList.addLast(privateIndex1Ref);
- IndexBaseItem privateBase = new IndexBaseItem();
- // Insert the private operands and operator
- OutputList.addLast(privateBase);
- // Calc the new size of the private after subsetting
- // Origianl size
- int NewSize = fonts[Font].privateLength;
- // Calc the original size of the Subr offset in the private
- int OrgSubrsOffsetSize = CalcSubrOffsetSize(fonts[Font].privateOffset,fonts[Font].privateLength);
- // Increase the ptivate's size
- if (OrgSubrsOffsetSize != 0)
- NewSize += 5-OrgSubrsOffsetSize;
- OutputList.addLast(new DictNumberItem(NewSize));
- OutputList.addLast(privateRef);
- OutputList.addLast(new UInt8Item((char)18)); // Private
-
- OutputList.addLast(new IndexMarkerItem(privateIndex1Ref,privateBase));
- }
-
- /**
- * Function reconstructs the FDArray, PrivateDict and LSubr for CID fonts
- * @param Font the font
- * @throws IOException
- */
- void Reconstruct(int Font)throws IOException
- {
- // Init for later use
- OffsetItem[] fdPrivate = new DictOffsetItem[fonts[Font].FDArrayOffsets.length-1];
- IndexBaseItem[] fdPrivateBase = new IndexBaseItem[fonts[Font].fdprivateOffsets.length];
- OffsetItem[] fdSubrs = new DictOffsetItem[fonts[Font].fdprivateOffsets.length];
- // Reconstruct each type
- ReconstructFDArray(Font,fdPrivate);
- ReconstructPrivateDict(Font,fdPrivate,fdPrivateBase,fdSubrs);
- ReconstructPrivateSubrs(Font,fdPrivateBase,fdSubrs);
- }
-
- /**
- * Function subsets the FDArray and builds the new one with new offsets
- * @param Font The font
- * @param fdPrivate OffsetItem Array (one for each FDArray)
- * @throws IOException
- */
- void ReconstructFDArray(int Font,OffsetItem[] fdPrivate)throws IOException
- {
- // Build the header of the index
- BuildIndexHeader(fonts[Font].FDArrayCount,fonts[Font].FDArrayOffsize,1);
-
- // For each offset create an Offset Item
- OffsetItem[] fdOffsets = new IndexOffsetItem[fonts[Font].FDArrayOffsets.length-1];
- for (int i=0;i<fonts[Font].FDArrayOffsets.length-1;i++)
- {
- fdOffsets[i] = new IndexOffsetItem(fonts[Font].FDArrayOffsize);
- OutputList.addLast(fdOffsets[i]);
- }
-
- // Declare beginning of the object array
- IndexBaseItem fdArrayBase = new IndexBaseItem();
- OutputList.addLast(fdArrayBase);
-
- // For each object check if that FD is used.
- // if is used build a new one by changing the private object
- // Else do nothing
- // At the end of each object mark its ending (Even if wasn't written)
- for (int k=0; k<fonts[Font].FDArrayOffsets.length-1; k++) {
- if (FDArrayUsed.containsKey(new Integer (k)))
- {
- // Goto begining of objects
- seek(fonts[Font].FDArrayOffsets[k]);
- while (getPosition() < fonts[Font].FDArrayOffsets[k+1])
- {
- int p1 = getPosition();
- getDictItem();
- int p2 = getPosition();
- // If the dictItem is the "Private" then compute and copy length,
- // use marker for offset and write operator number
- if (key=="Private") {
- // Save the original length of the private dict
- int NewSize = ((Integer)args[0]).intValue();
- // Save the size of the offset to the subrs in that private
- int OrgSubrsOffsetSize = CalcSubrOffsetSize(fonts[Font].fdprivateOffsets[k],fonts[Font].fdprivateLengths[k]);
- // Increase the private's length accordingly
- if (OrgSubrsOffsetSize != 0)
- NewSize += 5-OrgSubrsOffsetSize;
- // Insert the new size, OffsetItem and operator key number
- OutputList.addLast(new DictNumberItem(NewSize));
- fdPrivate[k] = new DictOffsetItem();
- OutputList.addLast(fdPrivate[k]);
- OutputList.addLast(new UInt8Item((char)18)); // Private
- // Go back to place
- seek(p2);
- }
- // Else copy the entire range
- else // other than private
- OutputList.addLast(new RangeItem(buf,p1,p2-p1));
- }
- }
- // Mark the ending of the object (even if wasn't written)
- OutputList.addLast(new IndexMarkerItem(fdOffsets[k],fdArrayBase));
- }
- }
- /**
- * Function Adds the new private dicts (only for the FDs used) to the list
- * @param Font the font
- * @param fdPrivate OffsetItem array one element for each private
- * @param fdPrivateBase IndexBaseItem array one element for each private
- * @param fdSubrs OffsetItem array one element for each private
- * @throws IOException
- */
- void ReconstructPrivateDict(int Font,OffsetItem[] fdPrivate,IndexBaseItem[] fdPrivateBase,
- OffsetItem[] fdSubrs)throws IOException
- {
-
- // For each fdarray private dict check if that FD is used.
- // if is used build a new one by changing the subrs offset
- // Else do nothing
- for (int i=0;i<fonts[Font].fdprivateOffsets.length;i++)
- {
- if (FDArrayUsed.containsKey(new Integer (i)))
- {
- // Mark beginning
- OutputList.addLast(new MarkerItem(fdPrivate[i]));
- fdPrivateBase[i] = new IndexBaseItem();
- OutputList.addLast(fdPrivateBase[i]);
- // Goto begining of objects
- seek(fonts[Font].fdprivateOffsets[i]);
- while (getPosition() < fonts[Font].fdprivateOffsets[i]+fonts[Font].fdprivateLengths[i])
- {
- int p1 = getPosition();
- getDictItem();
- int p2 = getPosition();
- // If the dictItem is the "Subrs" then,
- // use marker for offset and write operator number
- if (key=="Subrs") {
- fdSubrs[i] = new DictOffsetItem();
- OutputList.addLast(fdSubrs[i]);
- OutputList.addLast(new UInt8Item((char)19)); // Subrs
- }
- // Else copy the entire range
- else
- OutputList.addLast(new RangeItem(buf,p1,p2-p1));
- }
- }
- }
- }
-
- /**
- * Function Adds the new LSubrs dicts (only for the FDs used) to the list
- * @param Font The index of the font
- * @param fdPrivateBase The IndexBaseItem array for the linked list
- * @param fdSubrs OffsetItem array for the linked list
- * @throws IOException
- */
-
- void ReconstructPrivateSubrs(int Font,IndexBaseItem[] fdPrivateBase,
- OffsetItem[] fdSubrs)throws IOException
- {
- // For each private dict
- for (int i=0;i<fonts[Font].fdprivateLengths.length;i++)
- {
- // If that private dict's Subrs are used insert the new LSubrs
- // computed earlier
- if (fdSubrs[i]!= null && fonts[Font].PrivateSubrsOffset[i] >= 0)
- {
- OutputList.addLast(new SubrMarkerItem(fdSubrs[i],fdPrivateBase[i]));
- OutputList.addLast(new RangeItem(new RandomAccessFileOrArray(NewLSubrsIndex[i]),0,NewLSubrsIndex[i].length));
- }
- }
- }
-
- /**
- * Calculates how many byte it took to write the offset for the subrs in a specific
- * private dict.
- * @param Offset The Offset for the private dict
- * @param Size The size of the private dict
- * @return The size of the offset of the subrs in the private dict
- */
- int CalcSubrOffsetSize(int Offset,int Size)
- {
- // Set the size to 0
- int OffsetSize = 0;
- // Go to the beginning of the private dict
- seek(Offset);
- // Go until the end of the private dict
- while (getPosition() < Offset+Size)
- {
- int p1 = getPosition();
- getDictItem();
- int p2 = getPosition();
- // When reached to the subrs offset
- if (key=="Subrs") {
- // The Offsize (minus the subrs key)
- OffsetSize = p2-p1-1;
- }
- // All other keys are ignored
- }
- // return the size
- return OffsetSize;
- }
-
- /**
- * Function computes the size of an index
- * @param indexOffset The offset for the computed index
- * @return The size of the index
- */
- protected int countEntireIndexRange(int indexOffset)
- {
- // Go to the beginning of the index
- seek(indexOffset);
- // Read the count field
- int count = getCard16();
- // If count==0 -> size=2
- if (count==0)
- return 2;
- else
- {
- // Read the offsize field
- int indexOffSize = getCard8();
- // Go to the last element of the offset array
- seek(indexOffset+2+1+count*indexOffSize);
- // The size of the object array is the value of the last element-1
- int size = getOffset(indexOffSize)-1;
- // Return the size of the entire index
- return 2+1+(count+1)*indexOffSize+size;
- }
- }
-
- /**
- * The function creates a private dict for a font that was not CID
- * All the keys are copied as is except for the subrs key
- * @param Font the font
- * @param Subr The OffsetItem for the subrs of the private
- */
- void CreateNonCIDPrivate(int Font,OffsetItem Subr)
- {
- // Go to the beginning of the private dict and read untill the end
- seek(fonts[Font].privateOffset);
- while (getPosition() < fonts[Font].privateOffset+fonts[Font].privateLength)
- {
- int p1 = getPosition();
- getDictItem();
- int p2 = getPosition();
- // If the dictItem is the "Subrs" then,
- // use marker for offset and write operator number
- if (key=="Subrs") {
- OutputList.addLast(Subr);
- OutputList.addLast(new UInt8Item((char)19)); // Subrs
- }
- // Else copy the entire range
- else
- OutputList.addLast(new RangeItem(buf,p1,p2-p1));
- }
- }
-
- /**
- * the function marks the beginning of the subrs index and adds the subsetted subrs
- * index to the output list.
- * @param Font the font
- * @param PrivateBase IndexBaseItem for the private that's referencing to the subrs
- * @param Subrs OffsetItem for the subrs
- * @throws IOException
- */
- void CreateNonCIDSubrs(int Font,IndexBaseItem PrivateBase,OffsetItem Subrs)throws IOException
- {
- // Mark the beginning of the Subrs index
- OutputList.addLast(new SubrMarkerItem(Subrs,PrivateBase));
- // Put the subsetted new subrs index
- OutputList.addLast(new RangeItem(new RandomAccessFileOrArray(NewSubrsIndexNonCID),0,NewSubrsIndexNonCID.length));
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/CJKFont.java b/LibrarySource/com/lowagie/text/pdf/CJKFont.java
deleted file mode 100644
index 1f8d335..0000000
--- a/LibrarySource/com/lowagie/text/pdf/CJKFont.java
+++ /dev/null
@@ -1,626 +0,0 @@
-/*
- * $Id: CJKFont.java,v 1.29 2002/07/09 11:28:22 blowagie Exp $
- * $Name: $
- *
- * Copyright 2000, 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.DocumentException;
-import java.io.*;
-import java.util.HashMap;
-import java.util.Properties;
-import java.util.Hashtable;
-import java.util.StringTokenizer;
-import java.util.Enumeration;
-
-/**
- * Creates a CJK font compatible with the fonts in the Adobe Asian font Pack.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-
-class CJKFont extends BaseFont {
- /** The encoding used in the PDF document for CJK fonts
- */
- static final String CJK_ENCODING = "UnicodeBigUnmarked";
- private static final int FIRST = 0;
- private static final int BRACKET = 1;
- private static final int SERIAL = 2;
- private static final int V1Y = 880;
-
- static Properties cjkFonts = new Properties();
- static Properties cjkEncodings = new Properties();
- static Hashtable allCMaps = new Hashtable();
- static Hashtable allFonts = new Hashtable();
- private static boolean propertiesLoaded = false;
-
- /** The font name */
- private String fontName;
- /** The style modifier */
- private String style = "";
- /** The CMap name associated with this font */
- private String CMap;
-
- private boolean cidDirect = false;
-
- private char[] translationMap;
- private IntHashtable vMetrics;
- private IntHashtable hMetrics;
- private HashMap fontDesc;
- private boolean vertical = false;
-
- private static void loadProperties() {
- if (propertiesLoaded)
- return;
- synchronized (allFonts) {
- if (propertiesLoaded)
- return;
- try {
- InputStream is = getResourceStream(RESOURCE_PATH + "cjkfonts.properties");
- cjkFonts.load(is);
- is.close();
- is = getResourceStream(RESOURCE_PATH + "cjkencodings.properties");
- cjkEncodings.load(is);
- is.close();
- }
- catch (Exception e) {
- cjkFonts = new Properties();
- cjkEncodings = new Properties();
- }
- propertiesLoaded = true;
- }
- }
-
- /** Creates a CJK font.
- * @param fontName the name of the font
- * @param enc the encoding of the font
- * @param emb always <CODE>false</CODE>. CJK font and not embedded
- * @throws DocumentException on error
- * @throws IOException on error
- */
- CJKFont(String fontName, String enc, boolean emb) throws DocumentException, IOException {
- loadProperties();
- fontType = FONT_TYPE_CJK;
- String nameBase = getBaseName(fontName);
- if (!isCJKFont(nameBase, enc))
- throw new DocumentException("Font '" + fontName + "' with '" + enc + "' encoding is not a CJK font.");
- if (nameBase.length() < fontName.length()) {
- style = fontName.substring(nameBase.length());
- fontName = nameBase;
- }
- this.fontName = fontName;
- encoding = CJK_ENCODING;
- vertical = enc.endsWith("V");
- CMap = enc;
- if (enc.startsWith("Identity-")) {
- cidDirect = true;
- String s = cjkFonts.getProperty(fontName);
- s = s.substring(0, s.indexOf('_'));
- char c[] = (char[])allCMaps.get(s);
- if (c == null) {
- c = readCMap(s);
- if (c == null)
- throw new DocumentException("The cmap " + s + " does not exist as a resource.");
- c[CID_NEWLINE] = '\n';
- allCMaps.put(s, c);
- }
- translationMap = c;
- }
- else {
- char c[] = (char[])allCMaps.get(enc);
- if (c == null) {
- String s = cjkEncodings.getProperty(enc);
- if (s == null)
- throw new DocumentException("The resource cjkencodings.properties does not contain the encoding " + enc);
- StringTokenizer tk = new StringTokenizer(s);
- String nt = tk.nextToken();
- c = (char[])allCMaps.get(nt);
- if (c == null) {
- c = readCMap(nt);
- allCMaps.put(nt, c);
- }
- if (tk.hasMoreTokens()) {
- String nt2 = tk.nextToken();
- char m2[] = readCMap(nt2);
- for (int k = 0; k < 0x10000; ++k) {
- if (m2[k] == 0)
- m2[k] = c[k];
- }
- allCMaps.put(enc, m2);
- c = m2;
- }
- }
- translationMap = c;
- }
- fontDesc = (HashMap)allFonts.get(fontName);
- if (fontDesc == null) {
- fontDesc = readFontProperties(fontName);
- allFonts.put(fontName, fontDesc);
- }
- hMetrics = (IntHashtable)fontDesc.get("W");
- vMetrics = (IntHashtable)fontDesc.get("W2");
- }
-
- /** Checks if its a valid CJK font.
- * @param fontName the font name
- * @param enc the encoding
- * @return <CODE>true</CODE> if it is CJK font
- */
- public static boolean isCJKFont(String fontName, String enc) {
- loadProperties();
- String encodings = cjkFonts.getProperty(fontName);
- return (encodings != null && (enc.equals("Identity-H") || enc.equals("Identity-V") || encodings.indexOf("_" + enc + "_") >= 0));
- }
-
- public int getWidth(String text) {
- int total = 0;
- for (int k = 0; k < text.length(); ++k) {
- int c = text.charAt(k);
- if (!cidDirect)
- c = translationMap[c];
- int v;
- if (vertical)
- v = vMetrics.get(c);
- else
- v = hMetrics.get(c);
- if (v > 0)
- total += v;
- else
- total += 1000;
- }
- return total;
- }
-
- int getRawWidth(int c, String name) {
- return 0;
- }
-
- public int getKerning(char char1, char char2) {
- return 0;
- }
-
- private PdfDictionary getFontDescriptor() {
- PdfDictionary dic = new PdfDictionary(PdfName.FONTDESCRIPTOR);
- dic.put(PdfName.ASCENT, new PdfLiteral((String)fontDesc.get("Ascent")));
- dic.put(PdfName.CAPHEIGHT, new PdfLiteral((String)fontDesc.get("CapHeight")));
- dic.put(PdfName.DESCENT, new PdfLiteral((String)fontDesc.get("Descent")));
- dic.put(PdfName.FLAGS, new PdfLiteral((String)fontDesc.get("Flags")));
- dic.put(PdfName.FONTBBOX, new PdfLiteral((String)fontDesc.get("FontBBox")));
- dic.put(PdfName.FONTNAME, new PdfName(fontName + style));
- dic.put(PdfName.ITALICANGLE, new PdfLiteral((String)fontDesc.get("ItalicAngle")));
- dic.put(PdfName.STEMV, new PdfLiteral((String)fontDesc.get("StemV")));
- PdfDictionary pdic = new PdfDictionary();
- pdic.put(PdfName.PANOSE, new PdfString((String)fontDesc.get("Panose"), null));
- dic.put(PdfName.STYLE, pdic);
- return dic;
- }
-
- private PdfDictionary getCIDFont(PdfIndirectReference fontDescriptor, IntHashtable cjkTag) {
- PdfDictionary dic = new PdfDictionary(PdfName.FONT);
- dic.put(PdfName.SUBTYPE, PdfName.CIDFONTTYPE0);
- dic.put(PdfName.BASEFONT, new PdfName(fontName + style));
- dic.put(PdfName.FONTDESCRIPTOR, fontDescriptor);
- int keys[] = cjkTag.toOrderedKeys();
- String w = convertToHCIDMetrics(keys, hMetrics);
- if (w != null)
- dic.put(PdfName.W, new PdfLiteral(w));
- if (vertical) {
- w = convertToVCIDMetrics(keys, vMetrics, hMetrics);;
- if (w != null)
- dic.put(PdfName.W2, new PdfLiteral(w));
- }
- else
- dic.put(PdfName.DW, new PdfNumber(1000));
- PdfDictionary cdic = new PdfDictionary();
- cdic.put(PdfName.REGISTRY, new PdfString((String)fontDesc.get("Registry"), null));
- cdic.put(PdfName.ORDERING, new PdfString((String)fontDesc.get("Ordering"), null));
- cdic.put(PdfName.SUPPLEMENT, new PdfLiteral((String)fontDesc.get("Supplement")));
- dic.put(PdfName.CIDSYSTEMINFO, cdic);
- return dic;
- }
-
- private PdfDictionary getFontBaseType(PdfIndirectReference CIDFont) {
- PdfDictionary dic = new PdfDictionary(PdfName.FONT);
- dic.put(PdfName.SUBTYPE, PdfName.TYPE0);
- String name = fontName;
- if (style.length() > 0)
- name += "-" + style.substring(1);
- name += "-" + CMap;
- dic.put(PdfName.BASEFONT, new PdfName(name));
- dic.put(PdfName.ENCODING, new PdfName(CMap));
- dic.put(PdfName.DESCENDANTFONTS, new PdfArray(CIDFont));
- return dic;
- }
-
- void writeFont(PdfWriter writer, PdfIndirectReference ref, Object params[]) throws DocumentException, IOException {
- IntHashtable cjkTag = (IntHashtable)params[0];
- PdfIndirectReference ind_font = null;
- PdfObject pobj = null;
- PdfIndirectObject obj = null;
- pobj = getFontDescriptor();
- if (pobj != null){
- obj = writer.addToBody(pobj);
- ind_font = obj.getIndirectReference();
- }
- pobj = getCIDFont(ind_font, cjkTag);
- if (pobj != null){
- obj = writer.addToBody(pobj);
- ind_font = obj.getIndirectReference();
- }
- pobj = getFontBaseType(ind_font);
- writer.addToBody(pobj, ref);
- }
-
- private float getDescNumber(String name) {
- return Integer.parseInt((String)fontDesc.get(name));
- }
-
- private float getBBox(int idx) {
- String s = (String)fontDesc.get("FontBBox");
- StringTokenizer tk = new StringTokenizer(s, " []\r\n\t\f");
- String ret = tk.nextToken();
- for (int k = 0; k < idx; ++k)
- ret = tk.nextToken();
- return Integer.parseInt(ret);
- }
-
- /** Gets the font parameter identified by <CODE>key</CODE>. Valid values
- * for <CODE>key</CODE> are <CODE>ASCENT</CODE>, <CODE>CAPHEIGHT</CODE>, <CODE>DESCENT</CODE>
- * and <CODE>ITALICANGLE</CODE>.
- * @param key the parameter to be extracted
- * @param fontSize the font size in points
- * @return the parameter in points
- */
- public float getFontDescriptor(int key, float fontSize) {
- switch (key) {
- case AWT_ASCENT:
- case ASCENT:
- return getDescNumber("Ascent") * fontSize / 1000;
- case CAPHEIGHT:
- return getDescNumber("CapHeight") * fontSize / 1000;
- case AWT_DESCENT:
- case DESCENT:
- return getDescNumber("Descent") * fontSize / 1000;
- case ITALICANGLE:
- return getDescNumber("ItalicAngle");
- case BBOXLLX:
- return fontSize * getBBox(0) / 1000;
- case BBOXLLY:
- return fontSize * getBBox(1) / 1000;
- case BBOXURX:
- return fontSize * getBBox(2) / 1000;
- case BBOXURY:
- return fontSize * getBBox(3) / 1000;
- case AWT_LEADING:
- return 0;
- case AWT_MAXADVANCE:
- return fontSize * (getBBox(2) - getBBox(0)) / 1000;
- }
- return 0;
- }
-
- public String getPostscriptFontName() {
- return fontName;
- }
-
- /** Gets the full name of the font. If it is a True Type font
- * each array element will have {Platform ID, Platform Encoding ID,
- * Language ID, font name}. The interpretation of this values can be
- * found in the Open Type specification, chapter 2, in the 'name' table.<br>
- * For the other fonts the array has a single element with {"", "", "",
- * font name}.
- * @return the full name of the font
- */
- public String[][] getFullFontName() {
- return new String[][]{{"", "", "", fontName}};
- }
-
- /** Gets the family name of the font. If it is a True Type font
- * each array element will have {Platform ID, Platform Encoding ID,
- * Language ID, font name}. The interpretation of this values can be
- * found in the Open Type specification, chapter 2, in the 'name' table.<br>
- * For the other fonts the array has a single element with {"", "", "",
- * font name}.
- * @return the family name of the font
- */
- public String[][] getFamilyFontName() {
- return getFullFontName();
- }
-
- static char[] readCMap(String name) {
- try {
- name = name + ".cmap";
- InputStream is = getResourceStream(RESOURCE_PATH + name);
- char c[] = new char[0x10000];
- for (int k = 0; k < 0x10000; ++k)
- c[k] = (char)((is.read() << 8) + is.read());
- return c;
- }
- catch (Exception e) {
- // empty on purpose
- }
- return null;
- }
-
- static IntHashtable createMetric(String s) {
- IntHashtable h = new IntHashtable();
- StringTokenizer tk = new StringTokenizer(s);
- while (tk.hasMoreTokens()) {
- int n1 = Integer.parseInt(tk.nextToken());
- h.put(n1, Integer.parseInt(tk.nextToken()));
- }
- return h;
- }
-
- static String convertToHCIDMetrics(int keys[], IntHashtable h) {
- if (keys.length == 0)
- return null;
- int lastCid = 0;
- int lastValue = 0;
- int start;
- for (start = 0; start < keys.length; ++start) {
- lastCid = keys[start];
- lastValue = h.get(lastCid);
- if (lastValue != 0) {
- ++start;
- break;
- }
- }
- if (lastValue == 0)
- return null;
- StringBuffer buf = new StringBuffer();
- buf.append('[');
- buf.append(lastCid);
- int state = FIRST;
- for (int k = start; k < keys.length; ++k) {
- int cid = keys[k];
- int value = h.get(cid);
- if (value == 0)
- continue;
- switch (state) {
- case FIRST: {
- if (cid == lastCid + 1 && value == lastValue) {
- state = SERIAL;
- }
- else if (cid == lastCid + 1) {
- state = BRACKET;
- buf.append('[').append(lastValue);
- }
- else {
- buf.append('[').append(lastValue).append(']').append(cid);
- }
- break;
- }
- case BRACKET: {
- if (cid == lastCid + 1 && value == lastValue) {
- state = SERIAL;
- buf.append(']').append(lastCid);
- }
- else if (cid == lastCid + 1) {
- buf.append(' ').append(lastValue);
- }
- else {
- state = FIRST;
- buf.append(' ').append(lastValue).append(']').append(cid);
- }
- break;
- }
- case SERIAL: {
- if (cid != lastCid + 1 || value != lastValue) {
- buf.append(' ').append(lastCid).append(' ').append(lastValue).append(' ').append(cid);
- state = FIRST;
- }
- break;
- }
- }
- lastValue = value;
- lastCid = cid;
- }
- switch (state) {
- case FIRST: {
- buf.append('[').append(lastValue).append("]]");
- break;
- }
- case BRACKET: {
- buf.append(' ').append(lastValue).append("]]");
- break;
- }
- case SERIAL: {
- buf.append(' ').append(lastCid).append(' ').append(lastValue).append(']');
- break;
- }
- }
- return buf.toString();
- }
-
- static String convertToVCIDMetrics(int keys[], IntHashtable v, IntHashtable h) {
- if (keys.length == 0)
- return null;
- int lastCid = 0;
- int lastValue = 0;
- int lastHValue = 0;
- int start;
- for (start = 0; start < keys.length; ++start) {
- lastCid = keys[start];
- lastValue = v.get(lastCid);
- if (lastValue != 0) {
- ++start;
- break;
- }
- else
- lastHValue = h.get(lastCid);
- }
- if (lastValue == 0)
- return null;
- if (lastHValue == 0)
- lastHValue = 1000;
- StringBuffer buf = new StringBuffer();
- buf.append('[');
- buf.append(lastCid);
- int state = FIRST;
- for (int k = start; k < keys.length; ++k) {
- int cid = keys[k];
- int value = v.get(cid);
- if (value == 0)
- continue;
- int hValue = h.get(lastCid);
- if (hValue == 0)
- hValue = 1000;
- switch (state) {
- case FIRST: {
- if (cid == lastCid + 1 && value == lastValue && hValue == lastHValue) {
- state = SERIAL;
- }
- else {
- buf.append(' ').append(lastCid).append(' ').append(-lastValue).append(' ').append(lastHValue / 2).append(' ').append(V1Y).append(' ').append(cid);
- }
- break;
- }
- case SERIAL: {
- if (cid != lastCid + 1 || value != lastValue || hValue != lastHValue) {
- buf.append(' ').append(lastCid).append(' ').append(-lastValue).append(' ').append(lastHValue / 2).append(' ').append(V1Y).append(' ').append(cid);
- state = FIRST;
- }
- break;
- }
- }
- lastValue = value;
- lastCid = cid;
- lastHValue = hValue;
- }
- buf.append(' ').append(lastCid).append(' ').append(-lastValue).append(' ').append(lastHValue / 2).append(' ').append(V1Y).append(" ]");
- return buf.toString();
- }
-
- static HashMap readFontProperties(String name) {
- try {
- name += ".properties";
- InputStream is = getResourceStream(RESOURCE_PATH + name);
- Properties p = new Properties();
- p.load(is);
- is.close();
- IntHashtable W = createMetric(p.getProperty("W"));
- p.remove("W");
- IntHashtable W2 = createMetric(p.getProperty("W2"));
- p.remove("W2");
- HashMap map = new HashMap();
- for (Enumeration e = p.keys(); e.hasMoreElements();) {
- Object obj = e.nextElement();
- map.put(obj, p.getProperty((String)obj));
- }
- map.put("W", W);
- map.put("W2", W2);
- return map;
- }
- catch (Exception e) {
- // empty on purpose
- }
- return null;
- }
-
- public char getUnicodeEquivalent(char c) {
- if (cidDirect)
- return translationMap[c];
- return c;
- }
-
- public char getCidCode(char c) {
- if (cidDirect)
- return c;
- return translationMap[c];
- }
-
- /** Checks if the font has any kerning pairs.
- * @return always <CODE>false</CODE>
- */
- public boolean hasKernPairs() {
- return false;
- }
-
- /**
- * Checks if a character exists in this font.
- * @param c the character to check
- * @return <CODE>true</CODE> if the character has a glyph,
- * <CODE>false</CODE> otherwise
- */
- public boolean charExists(char c) {
- return translationMap[c] != 0;
- }
-
- /**
- * Sets the character advance.
- * @param c the character
- * @param advance the character advance normalized to 1000 units
- * @return <CODE>true</CODE> if the advance was set,
- * <CODE>false</CODE> otherwise. Will always return <CODE>false</CODE>
- */
- public boolean setCharAdvance(char c, int advance) {
- return false;
- }
-
- /**
- * Sets the font name that will appear in the pdf font dictionary.
- * Use with care as it can easily make a font unreadable if not embedded.
- * @param name the new font name
- */
- public void setPostscriptFontName(String name) {
- fontName = name;
- }
-
- public boolean setKerning(char char1, char char2, int kern) {
- return false;
- }
-
- public int[] getCharBBox(char c) {
- return null;
- }
-
- protected int[] getRawCharBBox(int c, String name) {
- return null;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/CMYKColor.java b/LibrarySource/com/lowagie/text/pdf/CMYKColor.java
deleted file mode 100644
index 5b57346..0000000
--- a/LibrarySource/com/lowagie/text/pdf/CMYKColor.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * $Id: CMYKColor.java,v 1.43 2005/05/02 11:12:44 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/**
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class CMYKColor extends ExtendedColor {
-
- float cyan;
- float magenta;
- float yellow;
- float black;
-
- /**
- * Constructs a CMYK Color beased on 4 colorvalues (values are integers from 0 to 255).
- * @param intCyan
- * @param intMagenta
- * @param intYellow
- * @param intBlack
- */
- public CMYKColor(int intCyan, int intMagenta, int intYellow, int intBlack) {
- this((float)intCyan / 255f, (float)intMagenta / 255f, (float)intYellow / 255f, (float)intBlack / 255f);
- }
-
- /**
- * Construct a CMYK Color.
- * @param floatCyan
- * @param floatMagenta
- * @param floatYellow
- * @param floatBlack
- */
- public CMYKColor(float floatCyan, float floatMagenta, float floatYellow, float floatBlack) {
- super(TYPE_CMYK, 1f - floatCyan - floatBlack, 1f - floatMagenta - floatBlack, 1f - floatYellow - floatBlack);
- cyan = normalize(floatCyan);
- magenta = normalize(floatMagenta);
- yellow = normalize(floatYellow);
- black = normalize(floatBlack);
- }
-
- /**
- * @return the cyan value
- */
- public float getCyan() {
- return cyan;
- }
-
- /**
- * @return the magenta value
- */
- public float getMagenta() {
- return magenta;
- }
-
- /**
- * @return the yellow value
- */
- public float getYellow() {
- return yellow;
- }
-
- /**
- * @return the black value
- */
- public float getBlack() {
- return black;
- }
-
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/ColorDetails.java b/LibrarySource/com/lowagie/text/pdf/ColorDetails.java
deleted file mode 100644
index affcd34..0000000
--- a/LibrarySource/com/lowagie/text/pdf/ColorDetails.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * $Id: ColorDetails.java,v 1.11 2002/06/20 13:06:47 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.IOException;
-/** Each spotcolor in the document will have an instance of this class
- *
- * @author Phillip Pan (phillip at formstar.com)
- */
-class ColorDetails {
-
- /** The indirect reference to this color
- */
- PdfIndirectReference indirectReference;
- /** The color name that appears in the document body stream
- */
- PdfName colorName;
- /** The color
- */
- PdfSpotColor spotcolor;
-
- /** Each spot color used in a document has an instance of this class.
- * @param colorName the color name
- * @param indirectReference the indirect reference to the font
- * @param scolor the <CODE>PDfSpotColor</CODE>
- */
- ColorDetails(PdfName colorName, PdfIndirectReference indirectReference, PdfSpotColor scolor) {
- this.colorName = colorName;
- this.indirectReference = indirectReference;
- this.spotcolor = scolor;
- }
-
- /** Gets the indirect reference to this color.
- * @return the indirect reference to this color
- */
- PdfIndirectReference getIndirectReference() {
- return indirectReference;
- }
-
- /** Gets the color name as it appears in the document body.
- * @return the color name
- */
- PdfName getColorName() {
- return colorName;
- }
-
- /** Gets the <CODE>SpotColor</CODE> object.
- * @return the <CODE>PdfSpotColor</CODE>
- */
- PdfObject getSpotColor(PdfWriter writer) throws IOException {
- return spotcolor.getSpotObject(writer);
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/ColumnText.java b/LibrarySource/com/lowagie/text/pdf/ColumnText.java
deleted file mode 100644
index ff48eea..0000000
--- a/LibrarySource/com/lowagie/text/pdf/ColumnText.java
+++ /dev/null
@@ -1,1420 +0,0 @@
-/*
- * $Id: ColumnText.java,v 1.58 2005/01/11 14:14:58 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.Stack;
-import java.util.Iterator;
-import com.lowagie.text.Phrase;
-import com.lowagie.text.Chunk;
-import com.lowagie.text.Paragraph;
-import com.lowagie.text.Graphic;
-import com.lowagie.text.ListItem;
-import com.lowagie.text.Element;
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.ExceptionConverter;
-import com.lowagie.text.Image;
-
-/**
- * Formats text in a columnwise form. The text is bound
- * on the left and on the right by a sequence of lines. This allows the column
- * to have any shape, not only rectangular.
- * <P>
- * Several parameters can be set like the first paragraph line indent and
- * extra space between paragraphs.
- * <P>
- * A call to the method <CODE>go</CODE> will return one of the following
- * situations: the column ended or the text ended.
- * <P>
- * I the column ended, a new column definition can be loaded with the method
- * <CODE>setColumns</CODE> and the method <CODE>go</CODE> can be called again.
- * <P>
- * If the text ended, more text can be loaded with <CODE>addText</CODE>
- * and the method <CODE>go</CODE> can be called again.<BR>
- * The only limitation is that one or more complete paragraphs must be loaded
- * each time.
- * <P>
- * Full bidirectional reordering is supported. If the run direction is
- * <CODE>PdfWriter.RUN_DIRECTION_RTL</CODE> the meaning of the horizontal
- * alignments and margins is mirrored.
- * @author Paulo Soares (psoares at consiste.pt)
- */
-
-public class ColumnText {
- /** Eliminate the arabic vowels */
- public static final int AR_NOVOWEL = ArabicLigaturizer.ar_novowel;
- /** Compose the tashkeel in the ligatures. */
- public static final int AR_COMPOSEDTASHKEEL = ArabicLigaturizer.ar_composedtashkeel;
- /** Do some extra double ligatures. */
- public static final int AR_LIG = ArabicLigaturizer.ar_lig;
- /**
- * Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits.
- */
- public static final int DIGITS_EN2AN = ArabicLigaturizer.DIGITS_EN2AN;
-
- /**
- * Digit shaping option: Replace Arabic-Indic digits by European digits (U+0030...U+0039).
- */
- public static final int DIGITS_AN2EN = ArabicLigaturizer.DIGITS_AN2EN;
-
- /**
- * Digit shaping option:
- * Replace European digits (U+0030...U+0039) by Arabic-Indic digits
- * if the most recent strongly directional character
- * is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC).
- * The initial state at the start of the text is assumed to be not an Arabic,
- * letter, so European digits at the start of the text will not change.
- * Compare to DIGITS_ALEN2AN_INIT_AL.
- */
- public static final int DIGITS_EN2AN_INIT_LR = ArabicLigaturizer.DIGITS_EN2AN_INIT_LR;
-
- /**
- * Digit shaping option:
- * Replace European digits (U+0030...U+0039) by Arabic-Indic digits
- * if the most recent strongly directional character
- * is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC).
- * The initial state at the start of the text is assumed to be an Arabic,
- * letter, so European digits at the start of the text will change.
- * Compare to DIGITS_ALEN2AN_INT_LR.
- */
- public static final int DIGITS_EN2AN_INIT_AL = ArabicLigaturizer.DIGITS_EN2AN_INIT_AL;
-
- /**
- * Digit type option: Use Arabic-Indic digits (U+0660...U+0669).
- */
- public static final int DIGIT_TYPE_AN = ArabicLigaturizer.DIGIT_TYPE_AN;
-
- /**
- * Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9).
- */
- public static final int DIGIT_TYPE_AN_EXTENDED = ArabicLigaturizer.DIGIT_TYPE_AN_EXTENDED;
-
- protected int runDirection = PdfWriter.RUN_DIRECTION_DEFAULT;
-
- /** the space char ratio */
- public static final float GLOBAL_SPACE_CHAR_RATIO = 0;
-
- /** Signals that there is no more text available. */
- public static final int NO_MORE_TEXT = 1;
-
- /** Signals that there is no more column. */
- public static final int NO_MORE_COLUMN = 2;
-
- /** The column is valid. */
- protected static final int LINE_STATUS_OK = 0;
-
- /** The line is out the column limits. */
- protected static final int LINE_STATUS_OFFLIMITS = 1;
-
- /** The line cannot fit this column position. */
- protected static final int LINE_STATUS_NOLINE = 2;
-
- /** Upper bound of the column. */
- protected float maxY;
-
- /** Lower bound of the column. */
- protected float minY;
-
- protected float leftX;
-
- protected float rightX;
-
- /** The column alignment. Default is left alignment. */
- protected int alignment = Element.ALIGN_LEFT;
-
- /** The left column bound. */
- protected ArrayList leftWall;
-
- /** The right column bound. */
- protected ArrayList rightWall;
-
- /** The chunks that form the text. */
-// protected ArrayList chunks = new ArrayList();
- protected BidiLine bidiLine;
-
- /** The current y line location. Text will be written at this line minus the leading. */
- protected float yLine;
-
- /** The leading for the current line. */
- protected float currentLeading = 16;
-
- /** The fixed text leading. */
- protected float fixedLeading = 16;
-
- /** The text leading that is multiplied by the biggest font size in the line. */
- protected float multipliedLeading = 0;
-
- /** The <CODE>PdfContent</CODE> where the text will be written to. */
- protected PdfContentByte canvas;
-
- /** The line status when trying to fit a line to a column. */
- protected int lineStatus;
-
- /** The first paragraph line indent. */
- protected float indent = 0;
-
- /** The following paragraph lines indent. */
- protected float followingIndent = 0;
-
- /** The right paragraph lines indent. */
- protected float rightIndent = 0;
-
- /** The extra space between paragraphs. */
- protected float extraParagraphSpace = 0;
-
- /** The width of the line when the column is defined as a simple rectangle. */
- protected float rectangularWidth = -1;
-
- protected boolean rectangularMode = false;
- /** Holds value of property spaceCharRatio. */
- private float spaceCharRatio = GLOBAL_SPACE_CHAR_RATIO;
-
- private boolean lastWasNewline = true;
-
- /** Holds value of property linesWritten. */
- private int linesWritten;
-
- private float firstLineY;
- private boolean firstLineYDone = false;
-
- /** Holds value of property arabicOptions. */
- private int arabicOptions = 0;
-
- protected float descender;
-
- protected boolean composite = false;
-
- protected ColumnText compositeColumn;
-
- protected LinkedList compositeElements;
-
- protected int listIdx = 0;
-
- private boolean splittedRow;
-
- protected Phrase waitPhrase;
-
- /** if true, first line height is adjusted so that the max ascender touches the top */
- private boolean useAscender = false;
-
- /**
- * Creates a <CODE>ColumnText</CODE>.
- * @param canvas the place where the text will be written to. Can
- * be a template.
- */
- public ColumnText(PdfContentByte canvas) {
- this.canvas = canvas;
- }
-
- /** Creates an independent duplicated of the instance <CODE>org</CODE>.
- * @param org the original <CODE>ColumnText</CODE>
- * @return the duplicated
- */
- public static ColumnText duplicate(ColumnText org) {
- ColumnText ct = new ColumnText(null);
- ct.setACopy(org);
- return ct;
- }
-
- /** Makes this instance an independent copy of <CODE>org</CODE>.
- * @param org the original <CODE>ColumnText</CODE>
- * @return itself
- */
- public ColumnText setACopy(ColumnText org) {
- setSimpleVars(org);
- if (org.bidiLine != null)
- bidiLine = new BidiLine(org.bidiLine);
- return this;
- }
-
- protected void setSimpleVars(ColumnText org) {
- maxY = org.maxY;
- minY = org.minY;
- alignment = org.alignment;
- leftWall = null;
- if (org.leftWall != null)
- leftWall = new ArrayList(org.leftWall);
- rightWall = null;
- if (org.rightWall != null)
- rightWall = new ArrayList(org.rightWall);
- yLine = org.yLine;
- currentLeading = org.currentLeading;
- fixedLeading = org.fixedLeading;
- multipliedLeading = org.multipliedLeading;
- canvas = org.canvas;
- lineStatus = org.lineStatus;
- indent = org.indent;
- followingIndent = org.followingIndent;
- rightIndent = org.rightIndent;
- extraParagraphSpace = org.extraParagraphSpace;
- rectangularWidth = org.rectangularWidth;
- rectangularMode = org.rectangularMode;
- spaceCharRatio = org.spaceCharRatio;
- lastWasNewline = org.lastWasNewline;
- linesWritten = org.linesWritten;
- arabicOptions = org.arabicOptions;
- runDirection = org.runDirection;
- descender = org.descender;
- composite = org.composite;
- splittedRow = org.splittedRow;
- if (org.composite) {
- compositeElements = new LinkedList(org.compositeElements);
- if (splittedRow) {
- PdfPTable table = (PdfPTable)compositeElements.getFirst();
- compositeElements.set(0, new PdfPTable(table));
- }
- if (org.compositeColumn != null)
- compositeColumn = duplicate(org.compositeColumn);
- }
- listIdx = org.listIdx;
- firstLineY = org.firstLineY;
- leftX = org.leftX;
- rightX = org.rightX;
- firstLineYDone = org.firstLineYDone;
- waitPhrase = org.waitPhrase;
- useAscender = org.useAscender;
- }
-
- private void addWaitingPhrase() {
- if (bidiLine == null && waitPhrase != null) {
- bidiLine = new BidiLine();
- for (Iterator j = waitPhrase.getChunks().iterator(); j.hasNext();) {
- bidiLine.addChunk(new PdfChunk((Chunk)j.next(), null));
- }
- waitPhrase = null;
- }
- }
-
- /**
- * Adds a <CODE>Phrase</CODE> to the current text array.
- * Will not have any effect if addElement() was called before.
- * @param phrase the text
- */
- public void addText(Phrase phrase) {
- if (phrase == null || composite)
- return;
- addWaitingPhrase();
- if (bidiLine == null) {
- waitPhrase = phrase;
- return;
- }
- for (Iterator j = phrase.getChunks().iterator(); j.hasNext();) {
- bidiLine.addChunk(new PdfChunk((Chunk)j.next(), null));
- }
- }
-
- /**
- * Replaces the current text array with this <CODE>Phrase</CODE>.
- * Anything added previously with addElement() is lost.
- * @param phrase the text
- */
- public void setText(Phrase phrase) {
- bidiLine = null;
- composite = false;
- compositeColumn = null;
- compositeElements = null;
- listIdx = 0;
- splittedRow = false;
- waitPhrase = phrase;
- }
-
- /**
- * Adds a <CODE>Chunk</CODE> to the current text array.
- * Will not have any effect if addElement() was called before.
- * @param chunk the text
- */
- public void addText(Chunk chunk) {
- if (chunk == null || composite)
- return;
- addText(new Phrase(chunk));
- }
-
- /**
- * Adds an element. Elements supported are <CODE>Paragraph</CODE>,
- * <CODE>List</CODE>, <CODE>PdfPTable</CODE>, <CODE>Image</CODE> and
- * <CODE>Graphic</CODE>.
- * <p>
- * It removes all the text placed with <CODE>addText()</CODE>.
- * @param element the <CODE>Element</CODE>
- */
- public void addElement(Element element) {
- if (element == null)
- return;
- if (element instanceof Image) {
- Image img = (Image)element;
- PdfPTable t = new PdfPTable(1);
- float w = img.getWidthPercentage();
- if (w == 0) {
- t.setTotalWidth(img.scaledWidth());
- t.setLockedWidth(true);
- }
- else
- t.setWidthPercentage(w);
- t.setSpacingAfter(img.spacingAfter());
- t.setSpacingBefore(img.spacingBefore());
- PdfPCell c = new PdfPCell(img, true);
- c.setPadding(0);
- c.setBorder(img.border());
- c.setBorderColor(img.borderColor());
- c.setBorderWidth(img.borderWidth());
- c.setBackgroundColor(img.backgroundColor());
- c.setGrayFill(img.grayFill());
- t.addCell(c);
- element = t;
- }
- if (element.type() == Element.CHUNK) {
- element = new Paragraph((Chunk)element);
- }
- else if (element.type() == Element.PHRASE) {
- element = new Paragraph((Phrase)element);
- }
- if (element.type() != Element.PARAGRAPH && element.type() != Element.LIST && element.type() != Element.PTABLE && element.type() != Element.GRAPHIC)
- throw new IllegalArgumentException("Element not allowed.");
- if (!composite) {
- composite = true;
- compositeElements = new LinkedList();
- bidiLine = null;
- waitPhrase = null;
- }
- compositeElements.add(element);
- }
-
- /**
- * Converts a sequence of lines representing one of the column bounds into
- * an internal format.
- * <p>
- * Each array element will contain a <CODE>float[4]</CODE> representing
- * the line x = ax + b.
- * @param cLine the column array
- * @return the converted array
- */
- protected ArrayList convertColumn(float cLine[]) {
- if (cLine.length < 4)
- throw new RuntimeException("No valid column line found.");
- ArrayList cc = new ArrayList();
- for (int k = 0; k < cLine.length - 2; k += 2) {
- float x1 = cLine[k];
- float y1 = cLine[k + 1];
- float x2 = cLine[k + 2];
- float y2 = cLine[k + 3];
- if (y1 == y2)
- continue;
- // x = ay + b
- float a = (x1 - x2) / (y1 - y2);
- float b = x1 - a * y1;
- float r[] = new float[4];
- r[0] = Math.min(y1, y2);
- r[1] = Math.max(y1, y2);
- r[2] = a;
- r[3] = b;
- cc.add(r);
- maxY = Math.max(maxY, r[1]);
- minY = Math.min(minY, r[0]);
- }
- if (cc.size() == 0)
- throw new RuntimeException("No valid column line found.");
- return cc;
- }
-
- /**
- * Finds the intersection between the <CODE>yLine</CODE> and the column. It will
- * set the <CODE>lineStatus</CODE> apropriatly.
- * @param wall the column to intersect
- * @return the x coordinate of the intersection
- */
- protected float findLimitsPoint(ArrayList wall) {
- lineStatus = LINE_STATUS_OK;
- if (yLine < minY || yLine > maxY) {
- lineStatus = LINE_STATUS_OFFLIMITS;
- return 0;
- }
- for (int k = 0; k < wall.size(); ++k) {
- float r[] = (float[])wall.get(k);
- if (yLine < r[0] || yLine > r[1])
- continue;
- return r[2] * yLine + r[3];
- }
- lineStatus = LINE_STATUS_NOLINE;
- return 0;
- }
-
- /**
- * Finds the intersection between the <CODE>yLine</CODE> and the two
- * column bounds. It will set the <CODE>lineStatus</CODE> apropriatly.
- * @return a <CODE>float[2]</CODE>with the x coordinates of the intersection
- */
- protected float[] findLimitsOneLine() {
- float x1 = findLimitsPoint(leftWall);
- if (lineStatus == LINE_STATUS_OFFLIMITS || lineStatus == LINE_STATUS_NOLINE)
- return null;
- float x2 = findLimitsPoint(rightWall);
- if (lineStatus == LINE_STATUS_NOLINE)
- return null;
- return new float[]{x1, x2};
- }
-
- /**
- * Finds the intersection between the <CODE>yLine</CODE>,
- * the <CODE>yLine-leading</CODE>and the two
- * column bounds. It will set the <CODE>lineStatus</CODE> apropriatly.
- * @return a <CODE>float[4]</CODE>with the x coordinates of the intersection
- */
- protected float[] findLimitsTwoLines() {
- boolean repeat = false;
- for (;;) {
- if (repeat && currentLeading == 0)
- return null;
- repeat = true;
- float x1[] = findLimitsOneLine();
- if (lineStatus == LINE_STATUS_OFFLIMITS)
- return null;
- yLine -= currentLeading;
- if (lineStatus == LINE_STATUS_NOLINE) {
- continue;
- }
- float x2[] = findLimitsOneLine();
- if (lineStatus == LINE_STATUS_OFFLIMITS)
- return null;
- if (lineStatus == LINE_STATUS_NOLINE) {
- yLine -= currentLeading;
- continue;
- }
- if (x1[0] >= x2[1] || x2[0] >= x1[1])
- continue;
- return new float[]{x1[0], x1[1], x2[0], x2[1]};
- }
- }
-
- /**
- * Sets the columns bounds. Each column bound is described by a
- * <CODE>float[]</CODE> with the line points [x1,y1,x2,y2,...].
- * The array must have at least 4 elements.
- * @param leftLine the left column bound
- * @param rightLine the right column bound
- */
- public void setColumns(float leftLine[], float rightLine[]) {
- maxY = -10e20f;
- minY = 10e20f;
- rightWall = convertColumn(rightLine);
- leftWall = convertColumn(leftLine);
- rectangularWidth = -1;
- rectangularMode = false;
- }
-
- /**
- * Simplified method for rectangular columns.
- * @param phrase a <CODE>Phrase</CODE>
- * @param llx the lower left x corner
- * @param lly the lower left y corner
- * @param urx the upper right x corner
- * @param ury the upper right y corner
- * @param leading the leading
- * @param alignment the column alignment
- */
- public void setSimpleColumn(Phrase phrase, float llx, float lly, float urx, float ury, float leading, int alignment) {
- addText(phrase);
- setSimpleColumn(llx, lly, urx, ury, leading, alignment);
- }
-
- /**
- * Simplified method for rectangular columns.
- * @param llx the lower left x corner
- * @param lly the lower left y corner
- * @param urx the upper right x corner
- * @param ury the upper right y corner
- * @param leading the leading
- * @param alignment the column alignment
- */
- public void setSimpleColumn(float llx, float lly, float urx, float ury, float leading, int alignment) {
- setLeading(leading);
- this.alignment = alignment;
- setSimpleColumn(llx, lly, urx, ury);
- }
-
- /**
- * Simplified method for rectangular columns.
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- */
- public void setSimpleColumn(float llx, float lly, float urx, float ury) {
- leftX = Math.min(llx, urx);
- maxY = Math.max(lly, ury);
- minY = Math.min(lly, ury);
- rightX = Math.max(llx, urx);
- yLine = maxY;
- rectangularWidth = rightX - leftX;
- if (rectangularWidth < 0)
- rectangularWidth = 0;
- rectangularMode = true;
- }
- /**
- * Sets the leading to fixed
- * @param leading the leading
- */
- public void setLeading(float leading) {
- fixedLeading = leading;
- multipliedLeading = 0;
- }
-
- /**
- * Sets the leading fixed and variable. The resultant leading will be
- * fixedLeading+multipliedLeading*maxFontSize where maxFontSize is the
- * size of the bigest font in the line.
- * @param fixedLeading the fixed leading
- * @param multipliedLeading the variable leading
- */
- public void setLeading(float fixedLeading, float multipliedLeading) {
- this.fixedLeading = fixedLeading;
- this.multipliedLeading = multipliedLeading;
- }
-
- /**
- * Gets the fixed leading
- * @return the leading
- */
- public float getLeading() {
- return fixedLeading;
- }
-
- /**
- * Gets the variable leading
- * @return the leading
- */
- public float getMultipliedLeading() {
- return multipliedLeading;
- }
-
- /**
- * Sets the yLine. The line will be written to yLine-leading.
- * @param yLine the yLine
- */
- public void setYLine(float yLine) {
- this.yLine = yLine;
- }
-
- /**
- * Gets the yLine.
- * @return the yLine
- */
- public float getYLine() {
- return yLine;
- }
-
- /**
- * Sets the alignment.
- * @param alignment the alignment
- */
- public void setAlignment(int alignment) {
- this.alignment = alignment;
- }
-
- /**
- * Gets the alignment.
- * @return the alignment
- */
- public int getAlignment() {
- return alignment;
- }
-
- /**
- * Sets the first paragraph line indent.
- * @param indent the indent
- */
- public void setIndent(float indent) {
- this.indent = indent;
- lastWasNewline = true;
- }
-
- /**
- * Gets the first paragraph line indent.
- * @return the indent
- */
- public float getIndent() {
- return indent;
- }
-
- /**
- * Sets the following paragraph lines indent.
- * @param indent the indent
- */
- public void setFollowingIndent(float indent) {
- this.followingIndent = indent;
- lastWasNewline = true;
- }
-
- /**
- * Gets the following paragraph lines indent.
- * @return the indent
- */
- public float getFollowingIndent() {
- return followingIndent;
- }
-
- /**
- * Sets the right paragraph lines indent.
- * @param indent the indent
- */
- public void setRightIndent(float indent) {
- this.rightIndent = indent;
- lastWasNewline = true;
- }
-
- /**
- * Gets the right paragraph lines indent.
- * @return the indent
- */
- public float getRightIndent() {
- return rightIndent;
- }
-
- /**
- * Outputs the lines to the document. It is equivalent to <CODE>go(false)</CODE>.
- * @return returns the result of the operation. It can be <CODE>NO_MORE_TEXT</CODE>
- * and/or <CODE>NO_MORE_COLUMN</CODE>
- * @throws DocumentException on error
- */
- public int go() throws DocumentException {
- return go(false);
- }
-
- /**
- * Outputs the lines to the document. The output can be simulated.
- * @param simulate <CODE>true</CODE> to simulate the writting to the document
- * @return returns the result of the operation. It can be <CODE>NO_MORE_TEXT</CODE>
- * and/or <CODE>NO_MORE_COLUMN</CODE>
- * @throws DocumentException on error
- */
- public int go(boolean simulate) throws DocumentException {
- if (composite)
- return goComposite(simulate);
- addWaitingPhrase();
- if (bidiLine == null)
- return NO_MORE_TEXT;
- descender = 0;
- linesWritten = 0;
- boolean dirty = false;
- float ratio = spaceCharRatio;
- Object currentValues[] = new Object[2];
- PdfFont currentFont = null;
- Float lastBaseFactor = new Float(0);
- currentValues[1] = lastBaseFactor;
- PdfDocument pdf = null;
- PdfContentByte graphics = null;
- PdfContentByte text = null;
- firstLineY = Float.NaN;
- int localRunDirection = PdfWriter.RUN_DIRECTION_NO_BIDI;
- if (runDirection != PdfWriter.RUN_DIRECTION_DEFAULT)
- localRunDirection = runDirection;
- if (canvas != null) {
- graphics = canvas;
- pdf = canvas.getPdfDocument();
- text = canvas.getDuplicate();
- }
- else if (!simulate)
- throw new NullPointerException("ColumnText.go with simulate==false and text==null.");
- if (!simulate) {
- if (ratio == GLOBAL_SPACE_CHAR_RATIO)
- ratio = text.getPdfWriter().getSpaceCharRatio();
- else if (ratio < 0.001f)
- ratio = 0.001f;
- }
- float firstIndent = 0;
-
- int status = 0;
- if (rectangularMode) {
- for (;;) {
- firstIndent = (lastWasNewline ? indent : followingIndent);
- if (rectangularWidth <= firstIndent + rightIndent) {
- status = NO_MORE_COLUMN;
- if (bidiLine.isEmpty())
- status |= NO_MORE_TEXT;
- break;
- }
- if (bidiLine.isEmpty()) {
- status = NO_MORE_TEXT;
- break;
- }
- PdfLine line = bidiLine.processLine(rectangularWidth - firstIndent - rightIndent, alignment, localRunDirection, arabicOptions);
- if (line == null) {
- status = NO_MORE_TEXT;
- break;
- }
- float maxSize = line.getMaxSizeSimple();
- if (isUseAscender() && Float.isNaN(firstLineY)) {
- currentLeading = line.getAscender();
- }
- else {
- currentLeading = fixedLeading + maxSize * multipliedLeading;
- }
- if (yLine > maxY || yLine - currentLeading < minY ) {
- status = NO_MORE_COLUMN;
- bidiLine.restore();
- break;
- }
- yLine -= currentLeading;
- if (!simulate && !dirty) {
- text.beginText();
- dirty = true;
- }
- if (Float.isNaN(firstLineY)) {
- firstLineY = yLine;
- }
- if (!simulate) {
- currentValues[0] = currentFont;
- text.setTextMatrix(leftX + (line.isRTL() ? rightIndent : firstIndent) + line.indentLeft(), yLine);
- pdf.writeLineToContent(line, text, graphics, currentValues, ratio);
- currentFont = (PdfFont)currentValues[0];
- }
- lastWasNewline = line.isNewlineSplit();
- yLine -= line.isNewlineSplit() ? extraParagraphSpace : 0;
- ++linesWritten;
- descender = line.getDescender();
- }
- }
- else {
- currentLeading = fixedLeading;
- for (;;) {
- firstIndent = (lastWasNewline ? indent : followingIndent);
- float yTemp = yLine;
- float xx[] = findLimitsTwoLines();
- if (xx == null) {
- status = NO_MORE_COLUMN;
- if (bidiLine.isEmpty())
- status |= NO_MORE_TEXT;
- yLine = yTemp;
- break;
- }
- if (bidiLine.isEmpty()) {
- status = NO_MORE_TEXT;
- yLine = yTemp;
- break;
- }
- float x1 = Math.max(xx[0], xx[2]);
- float x2 = Math.min(xx[1], xx[3]);
- if (x2 - x1 <= firstIndent + rightIndent)
- continue;
- if (!simulate && !dirty) {
- text.beginText();
- dirty = true;
- }
- PdfLine line = bidiLine.processLine(x2 - x1 - firstIndent - rightIndent, alignment, localRunDirection, arabicOptions);
- if (line == null) {
- status = NO_MORE_TEXT;
- yLine = yTemp;
- break;
- }
- if (!simulate) {
- currentValues[0] = currentFont;
- text.setTextMatrix(x1 + (line.isRTL() ? rightIndent : firstIndent) + line.indentLeft(), yLine);
- pdf.writeLineToContent(line, text, graphics, currentValues, ratio);
- currentFont = (PdfFont)currentValues[0];
- }
- lastWasNewline = line.isNewlineSplit();
- yLine -= line.isNewlineSplit() ? extraParagraphSpace : 0;
- ++linesWritten;
- descender = line.getDescender();
- }
- }
- if (dirty) {
- text.endText();
- canvas.add(text);
- }
- return status;
- }
-
- /**
- * Sets the extra space between paragraphs.
- * @return the extra space between paragraphs
- */
- public float getExtraParagraphSpace() {
- return extraParagraphSpace;
- }
-
- /**
- * Sets the extra space between paragraphs.
- * @param extraParagraphSpace the extra space between paragraphs
- */
- public void setExtraParagraphSpace(float extraParagraphSpace) {
- this.extraParagraphSpace = extraParagraphSpace;
- }
-
- /**
- * Clears the chunk array. A call to <CODE>go()</CODE> will always return
- * NO_MORE_TEXT.
- */
- public void clearChunks() {
- if (bidiLine != null)
- bidiLine.clearChunks();
- }
-
- /** Gets the space/character extra spacing ratio for
- * fully justified text.
- * @return the space/character extra spacing ratio
- */
- public float getSpaceCharRatio() {
- return spaceCharRatio;
- }
-
- /** Sets the ratio between the extra word spacing and the extra character spacing
- * when the text is fully justified.
- * Extra word spacing will grow <CODE>spaceCharRatio</CODE> times more than extra character spacing.
- * If the ratio is <CODE>PdfWriter.NO_SPACE_CHAR_RATIO</CODE> then the extra character spacing
- * will be zero.
- * @param spaceCharRatio the ratio between the extra word spacing and the extra character spacing
- */
- public void setSpaceCharRatio(float spaceCharRatio) {
- this.spaceCharRatio = spaceCharRatio;
- }
-
- /** Sets the run direction.
- * @param runDirection the run direction
- */
- public void setRunDirection(int runDirection) {
- if (runDirection < PdfWriter.RUN_DIRECTION_DEFAULT || runDirection > PdfWriter.RUN_DIRECTION_RTL)
- throw new RuntimeException("Invalid run direction: " + runDirection);
- this.runDirection = runDirection;
- }
-
- /** Gets the run direction.
- * @return the run direction
- */
- public int getRunDirection() {
- return runDirection;
- }
-
- /** Gets the number of lines written.
- * @return the number of lines written
- */
- public int getLinesWritten() {
- return this.linesWritten;
- }
-
- /** Gets the arabic shaping options.
- * @return the arabic shaping options
- */
- public int getArabicOptions() {
- return this.arabicOptions;
- }
-
- /** Sets the arabic shaping options. The option can be AR_NOVOWEL,
- * AR_COMPOSEDTASHKEEL and AR_LIG.
- * @param arabicOptions the arabic shaping options
- */
- public void setArabicOptions(int arabicOptions) {
- this.arabicOptions = arabicOptions;
- }
-
- /** Gets the biggest descender value of the last line written.
- * @return the biggest descender value of the last line written
- */
- public float getDescender() {
- return descender;
- }
-
- /** Gets the width that the line will occupy after writing.
- * Only the width of the first line is returned.
- * @param phrase the <CODE>Phrase</CODE> containing the line
- * @param runDirection the run direction
- * @param arabicOptions the options for the arabic shaping
- * @return the width of the line
- */
- public static float getWidth(Phrase phrase, int runDirection, int arabicOptions) {
- ColumnText ct = new ColumnText(null);
- ct.addText(phrase);
- ct.addWaitingPhrase();
- PdfLine line = ct.bidiLine.processLine(20000, Element.ALIGN_LEFT, runDirection, arabicOptions);
- if (line == null)
- return 0;
- else
- return 20000 - line.widthLeft();
- }
-
- /** Gets the width that the line will occupy after writing.
- * Only the width of the first line is returned.
- * @param phrase the <CODE>Phrase</CODE> containing the line
- * @return the width of the line
- */
- public static float getWidth(Phrase phrase) {
- return getWidth(phrase, PdfWriter.RUN_DIRECTION_NO_BIDI, 0);
- }
-
- /** Shows a line of text. Only the first line is written.
- * @param canvas where the text is to be written to
- * @param alignment the alignment. It is not influenced by the run direction
- * @param phrase the <CODE>Phrase</CODE> with the text
- * @param x the x reference position
- * @param y the y reference position
- * @param rotation the rotation to be applied in degrees counterclockwise
- * @param runDirection the run direction
- * @param arabicOptions the options for the arabic shaping
- */
- public static void showTextAligned(PdfContentByte canvas, int alignment, Phrase phrase, float x, float y, float rotation, int runDirection, int arabicOptions) {
- if (alignment != Element.ALIGN_LEFT && alignment != Element.ALIGN_CENTER
- && alignment != Element.ALIGN_RIGHT)
- alignment = Element.ALIGN_LEFT;
- canvas.saveState();
- ColumnText ct = new ColumnText(canvas);
- if (rotation == 0) {
- if (alignment == Element.ALIGN_LEFT)
- ct.setSimpleColumn(phrase, x, y - 1, 20000 + x, y + 2, 2, alignment);
- else if (alignment == Element.ALIGN_RIGHT)
- ct.setSimpleColumn(phrase, x-20000, y-1, x, y+2, 2, alignment);
- else
- ct.setSimpleColumn(phrase, x-20000, y-1, x+20000, y+2, 2, alignment);
- }
- else {
- double alpha = rotation * Math.PI / 180.0;
- float cos = (float)Math.cos(alpha);
- float sin = (float)Math.sin(alpha);
- canvas.concatCTM(cos, sin, -sin, cos, x, y);
- if (alignment == Element.ALIGN_LEFT)
- ct.setSimpleColumn(phrase, 0, -1, 20000, 2, 2, alignment);
- else if (alignment == Element.ALIGN_RIGHT)
- ct.setSimpleColumn(phrase, -20000, -1, 0, 2, 2, alignment);
- else
- ct.setSimpleColumn(phrase, -20000, -1, 20000, 2, 2, alignment);
- }
- if (runDirection == PdfWriter.RUN_DIRECTION_RTL) {
- if (alignment == Element.ALIGN_LEFT)
- alignment = Element.ALIGN_RIGHT;
- else if (alignment == Element.ALIGN_RIGHT)
- alignment = Element.ALIGN_LEFT;
- }
- ct.setAlignment(alignment);
- ct.setArabicOptions(arabicOptions);
- ct.setRunDirection(runDirection);
- try {
- ct.go();
- }
- catch (DocumentException e) {
- throw new ExceptionConverter(e);
- }
- canvas.restoreState();
- }
-
- /** Shows a line of text. Only the first line is written.
- * @param canvas where the text is to be written to
- * @param alignment the alignment
- * @param phrase the <CODE>Phrase</CODE> with the text
- * @param x the x reference position
- * @param y the y reference position
- * @param rotation the rotation to be applied in degrees counterclockwise
- */
- public static void showTextAligned(PdfContentByte canvas, int alignment, Phrase phrase, float x, float y, float rotation) {
- showTextAligned(canvas, alignment, phrase, x, y, rotation, PdfWriter.RUN_DIRECTION_NO_BIDI, 0);
- }
-
- protected int goComposite(boolean simulate) throws DocumentException {
- if (!rectangularMode)
- throw new DocumentException("Irregular columns are not supported in composite mode.");
- linesWritten = 0;
- descender = 0;
- boolean firstPass = true;
- main_loop:
- while (true) {
- if (compositeElements.isEmpty())
- return NO_MORE_TEXT;
- Element element = (Element)compositeElements.getFirst();
- if (element.type() == Element.PARAGRAPH) {
- Paragraph para = (Paragraph)element;
- int status = 0;
- for (int keep = 0; keep < 2; ++keep) {
- float lastY = yLine;
- boolean createHere = false;
- if (compositeColumn == null) {
- compositeColumn = new ColumnText(canvas);
- compositeColumn.setUseAscender(firstPass ? useAscender : false);
- compositeColumn.setAlignment(para.alignment());
- compositeColumn.setIndent(para.indentationLeft() + para.getFirstLineIndent());
- compositeColumn.setExtraParagraphSpace(para.getExtraParagraphSpace());
- compositeColumn.setFollowingIndent(para.indentationLeft());
- compositeColumn.setRightIndent(para.indentationRight());
- compositeColumn.setLeading(para.leading(), para.getMultipliedLeading());
- compositeColumn.setRunDirection(runDirection);
- compositeColumn.setArabicOptions(arabicOptions);
- compositeColumn.setSpaceCharRatio(spaceCharRatio);
- compositeColumn.addText(para);
- if (!firstPass) {
- yLine -= para.spacingBefore();
- }
- createHere = true;
- }
- compositeColumn.leftX = leftX;
- compositeColumn.rightX = rightX;
- compositeColumn.yLine = yLine;
- compositeColumn.rectangularWidth = rectangularWidth;
- compositeColumn.rectangularMode = rectangularMode;
- compositeColumn.minY = minY;
- compositeColumn.maxY = maxY;
- boolean keepCandidate = (para.getKeepTogether() && createHere && !firstPass);
- status = compositeColumn.go(simulate || (keepCandidate && keep == 0));
- if ((status & NO_MORE_TEXT) == 0 && keepCandidate) {
- compositeColumn = null;
- yLine = lastY;
- return NO_MORE_COLUMN;
- }
- if (simulate || !keepCandidate)
- break;
- if (keep == 0) {
- compositeColumn = null;
- yLine = lastY;
- }
- }
- firstPass = false;
- yLine = compositeColumn.yLine;
- linesWritten += compositeColumn.linesWritten;
- descender = compositeColumn.descender;
- if ((status & NO_MORE_TEXT) != 0) {
- compositeColumn = null;
- compositeElements.removeFirst();
- yLine -= para.spacingAfter();
- }
- if ((status & NO_MORE_COLUMN) != 0) {
- return NO_MORE_COLUMN;
- }
- }
- else if (element.type() == Element.LIST) {
- com.lowagie.text.List list = (com.lowagie.text.List)element;
- ArrayList items = list.getItems();
- ListItem item = null;
- float listIndentation = list.indentationLeft();
- int count = 0;
- Stack stack = new Stack();
- for (int k = 0; k < items.size(); ++k) {
- Object obj = items.get(k);
- if (obj instanceof ListItem) {
- if (count == listIdx) {
- item = (ListItem)obj;
- break;
- }
- else ++count;
- }
- else if (obj instanceof com.lowagie.text.List) {
- stack.push(new Object[]{list, new Integer(k), new Float(listIndentation)});
- list = (com.lowagie.text.List)obj;
- items = list.getItems();
- listIndentation += list.indentationLeft();
- k = -1;
- continue;
- }
- if (k == items.size() - 1) {
- if (!stack.isEmpty()) {
- Object objs[] = (Object[])stack.pop();
- list = (com.lowagie.text.List)objs[0];
- items = list.getItems();
- k = ((Integer)objs[1]).intValue();
- listIndentation = ((Float)objs[2]).floatValue();
- }
- }
- }
- int status = 0;
- for (int keep = 0; keep < 2; ++keep) {
- float lastY = yLine;
- boolean createHere = false;
- if (compositeColumn == null) {
- if (item == null) {
- listIdx = 0;
- compositeElements.removeFirst();
- continue main_loop;
- }
- compositeColumn = new ColumnText(canvas);
- compositeColumn.setUseAscender(firstPass ? useAscender : false);
- compositeColumn.setAlignment(item.alignment());
- compositeColumn.setIndent(item.indentationLeft() + listIndentation + item.getFirstLineIndent());
- compositeColumn.setExtraParagraphSpace(item.getExtraParagraphSpace());
- compositeColumn.setFollowingIndent(compositeColumn.getIndent());
- compositeColumn.setRightIndent(item.indentationRight() + list.indentationRight());
- compositeColumn.setLeading(item.leading(), item.getMultipliedLeading());
- compositeColumn.setRunDirection(runDirection);
- compositeColumn.setArabicOptions(arabicOptions);
- compositeColumn.setSpaceCharRatio(spaceCharRatio);
- compositeColumn.addText(item);
- if (!firstPass) {
- yLine -= item.spacingBefore();
- }
- createHere = true;
- }
- compositeColumn.leftX = leftX;
- compositeColumn.rightX = rightX;
- compositeColumn.yLine = yLine;
- compositeColumn.rectangularWidth = rectangularWidth;
- compositeColumn.rectangularMode = rectangularMode;
- compositeColumn.minY = minY;
- compositeColumn.maxY = maxY;
- boolean keepCandidate = (item.getKeepTogether() && createHere && !firstPass);
- status = compositeColumn.go(simulate || (keepCandidate && keep == 0));
- if ((status & NO_MORE_TEXT) == 0 && keepCandidate) {
- compositeColumn = null;
- yLine = lastY;
- return NO_MORE_COLUMN;
- }
- if (simulate || !keepCandidate)
- break;
- if (keep == 0) {
- compositeColumn = null;
- yLine = lastY;
- }
- }
- firstPass = false;
- yLine = compositeColumn.yLine;
- linesWritten += compositeColumn.linesWritten;
- descender = compositeColumn.descender;
- if (!Float.isNaN(compositeColumn.firstLineY) && !compositeColumn.firstLineYDone) {
- if (!simulate)
- showTextAligned(canvas, Element.ALIGN_LEFT, new Phrase(item.listSymbol()), compositeColumn.leftX + listIndentation, compositeColumn.firstLineY, 0);
- compositeColumn.firstLineYDone = true;
- }
- if ((status & NO_MORE_TEXT) != 0) {
- compositeColumn = null;
- ++listIdx;
- yLine -= item.spacingAfter();
- }
- if ((status & NO_MORE_COLUMN) != 0) {
- return NO_MORE_COLUMN;
- }
- }
- else if (element.type() == Element.PTABLE) {
- if (yLine < minY || yLine > maxY)
- return NO_MORE_COLUMN;
- PdfPTable table = (PdfPTable)element;
- if (table.size() <= table.getHeaderRows()) {
- compositeElements.removeFirst();
- continue;
- }
- float yTemp = yLine;
- float yLineWrite = yLine;
- if (!firstPass && listIdx == 0) {
- yTemp -= table.spacingBefore();
- yLineWrite = yTemp;
- }
- currentLeading = 0;
- if (yTemp < minY || yTemp > maxY)
- return NO_MORE_COLUMN;
- float x1 = leftX;
- float tableWidth;
- if (table.isLockedWidth())
- tableWidth = table.getTotalWidth();
- else {
- tableWidth = rectangularWidth * table.getWidthPercentage() / 100f;
- table.setTotalWidth(tableWidth);
- }
- int k;
- boolean skipHeader = (!firstPass && table.isSkipFirstHeader() && listIdx <= table.getHeaderRows());
- if (!skipHeader) {
- yTemp -= table.getHeaderHeight();
- if (yTemp < minY || yTemp > maxY) {
- if (firstPass) {
- compositeElements.removeFirst();
- continue;
- }
- return NO_MORE_COLUMN;
- }
- }
- if (listIdx < table.getHeaderRows())
- listIdx = table.getHeaderRows();
- for (k = listIdx; k < table.size(); ++k) {
- float rowHeight = table.getRowHeight(k);
- if (yTemp - rowHeight < minY)
- break;
- yTemp -= rowHeight;
- }
- if (k < table.size()) {
- if (table.isSplitRows() && (!table.isSplitLate() || (k == listIdx && firstPass))) {
- if (!splittedRow) {
- splittedRow = true;
- table = new PdfPTable(table);
- compositeElements.set(0, table);
- ArrayList rows = table.getRows();
- for (int i = table.getHeaderRows(); i < listIdx; ++i)
- rows.set(i, null);
- }
- float h = yTemp - minY;
- PdfPRow newRow = table.getRow(k).splitRow(h);
- if (newRow == null) {
- if (k == listIdx)
- return NO_MORE_COLUMN;
- }
- else {
- yTemp = minY;
- table.getRows().add(++k, newRow);
- }
- }
- else if (!table.isSplitRows() && k == listIdx && firstPass) {
- compositeElements.removeFirst();
- splittedRow = false;
- continue;
- }
- else if (k == listIdx && !firstPass && (!table.isSplitRows() || table.isSplitLate())) {
- return NO_MORE_COLUMN;
- }
- }
- firstPass = false;
- if (!simulate) {
- switch (table.getHorizontalAlignment()) {
- case Element.ALIGN_LEFT:
- break;
- case Element.ALIGN_RIGHT:
- x1 += rectangularWidth - tableWidth;
- break;
- default:
- x1 += (rectangularWidth - tableWidth) / 2f;
- }
- PdfPTable nt = PdfPTable.shallowCopy(table);
- ArrayList rows = table.getRows();
- ArrayList sub = nt.getRows();
- if (!skipHeader) {
- for (int j = 0; j < table.getHeaderRows(); ++j)
- sub.add(rows.get(j));
- }
- else
- nt.setHeaderRows(0);
- for (int j = listIdx; j < k; ++j)
- sub.add(rows.get(j));
- float rowHeight = 0;
- if (table.isExtendLastRow()) {
- PdfPRow last = (PdfPRow)sub.get(sub.size() - 1);
- rowHeight = last.getMaxHeights();
- last.setMaxHeights(yTemp - minY + rowHeight);
- yTemp = minY;
- }
- nt.writeSelectedRows(0, -1, x1, yLineWrite, canvas);
- if (table.isExtendLastRow()) {
- PdfPRow last = (PdfPRow)sub.get(sub.size() - 1);
- last.setMaxHeights(rowHeight);
- }
- }
- else if (table.isExtendLastRow() && minY > PdfPRow.BOTTOM_LIMIT)
- yTemp = minY;
- yLine = yTemp;
- if (k >= table.size()) {
- yLine -= table.spacingAfter();
- compositeElements.removeFirst();
- splittedRow = false;
- listIdx = 0;
- }
- else {
- if (splittedRow) {
- ArrayList rows = table.getRows();
- for (int i = listIdx; i < k; ++i)
- rows.set(i, null);
- }
- listIdx = k;
- return NO_MORE_COLUMN;
- }
- }
- else if (element.type() == Element.GRAPHIC) {
- if (!simulate) {
- Graphic gr = (Graphic)element;
- ByteBuffer bf = gr.getInternalBuffer();
- ByteBuffer store = null;
- if (bf.size() > 0) {
- store = new ByteBuffer();
- store.append(bf);
- bf.reset();
- }
- gr.processAttributes(leftX, minY, rightX, maxY, yLine);
- canvas.add(gr);
- bf.reset();
- if (store != null) {
- bf.append(store);
- }
- }
- compositeElements.removeFirst();
- }
- else
- compositeElements.removeFirst();
- }
- }
-
- /**
- * Gets the canvas.
- * @return a PdfContentByte.
- */
- public PdfContentByte getCanvas() {
- return canvas;
- }
-
- /**
- * Sets the canvas.
- * @param canvas
- */
- public void setCanvas(PdfContentByte canvas) {
- this.canvas = canvas;
- if (compositeColumn != null)
- compositeColumn.setCanvas(canvas);
- }
-
- /**
- * Checks if the element has a height of 0.
- * @return true or false
- */
- public boolean zeroHeightElement() {
- return composite == true && compositeElements.size() > 0 && ((Element)compositeElements.getFirst()).type() == Element.GRAPHIC;
- }
-
- /**
- * Checks if UseAscender is enabled/disabled.
- * @return true is the adjustment of the first line height is based on max ascender.
- */
- public boolean isUseAscender() {
- return useAscender;
- }
-
- /**
- * Enables/Disables adjustment of first line height based on max ascender.
- * @param use enable adjustment if true
- */
- public void setUseAscender(boolean use) {
- useAscender = use;
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/DefaultFontMapper.java b/LibrarySource/com/lowagie/text/pdf/DefaultFontMapper.java
deleted file mode 100644
index 363a0b3..0000000
--- a/LibrarySource/com/lowagie/text/pdf/DefaultFontMapper.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * Copyright 2004 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import headless.awt.Font;
-import com.lowagie.text.ExceptionConverter;
-import java.util.HashMap;
-import java.io.File;
-/** Default class to map awt fonts to BaseFont.
- * @author Paulo Soares (psoares at consiste.pt)
- */
-
-public class DefaultFontMapper implements FontMapper {
-
- /** A representation of BaseFont parameters.
- */
- public static class BaseFontParameters {
- /** The font name.
- */
- public String fontName;
- /** The encoding for that font.
- */
- public String encoding;
- /** The embedding for that font.
- */
- public boolean embedded;
- /** Whether the font is cached of not.
- */
- public boolean cached;
- /** The font bytes for ttf and afm.
- */
- public byte ttfAfm[];
- /** The font bytes for pfb.
- */
- public byte pfb[];
-
- /** Constructs default BaseFont parameters.
- * @param fontName the font name or location
- */
- public BaseFontParameters(String fontName) {
- this.fontName = fontName;
- encoding = BaseFont.CP1252;
- embedded = BaseFont.EMBEDDED;
- cached = BaseFont.CACHED;
- }
- }
-
- /** Maps aliases to names.
- */
- private HashMap aliases = new HashMap();
- /** Maps names to BaseFont parameters.
- */
- private HashMap mapper = new HashMap();
- /**
- * Returns a BaseFont which can be used to represent the given AWT Font
- *
- * @param font the font to be converted
- * @return a BaseFont which has similar properties to the provided Font
- */
-
- public BaseFont awtToPdf(Font font) {
- try {
- BaseFontParameters p = getBaseFontParameters(font.getFontName());
- if (p != null)
- return BaseFont.createFont(p.fontName, p.encoding, p.embedded, p.cached, p.ttfAfm, p.pfb);
- String fontKey = null;
- String logicalName = font.getName();
-
- if (logicalName.equalsIgnoreCase("DialogInput") || logicalName.equalsIgnoreCase("Monospaced") || logicalName.equalsIgnoreCase("Courier")) {
-
- if (font.isItalic()) {
- if (font.isBold()) {
- fontKey = BaseFont.COURIER_BOLDOBLIQUE;
-
- } else {
- fontKey = BaseFont.COURIER_OBLIQUE;
- }
-
- } else {
- if (font.isBold()) {
- fontKey = BaseFont.COURIER_BOLD;
-
- } else {
- fontKey = BaseFont.COURIER;
- }
- }
-
- } else if (logicalName.equalsIgnoreCase("Serif") || logicalName.equalsIgnoreCase("TimesRoman")) {
-
- if (font.isItalic()) {
- if (font.isBold()) {
- fontKey = BaseFont.TIMES_BOLDITALIC;
-
- } else {
- fontKey = BaseFont.TIMES_ITALIC;
- }
-
- } else {
- if (font.isBold()) {
- fontKey = BaseFont.TIMES_BOLD;
-
- } else {
- fontKey = BaseFont.TIMES_ROMAN;
- }
- }
-
- } else { // default, this catches Dialog and SansSerif
-
- if (font.isItalic()) {
- if (font.isBold()) {
- fontKey = BaseFont.HELVETICA_BOLDOBLIQUE;
-
- } else {
- fontKey = BaseFont.HELVETICA_OBLIQUE;
- }
-
- } else {
- if (font.isBold()) {
- fontKey = BaseFont.HELVETICA_BOLD;
- } else {
- fontKey = BaseFont.HELVETICA;
- }
- }
- }
- return BaseFont.createFont(fontKey, BaseFont.CP1252, false);
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- /**
- * Returns an AWT Font which can be used to represent the given BaseFont
- *
- * @param font the font to be converted
- * @param size the desired point size of the resulting font
- * @return a Font which has similar properties to the provided BaseFont
- */
-
- public Font pdfToAwt(BaseFont font, int size) {
- String names[][] = font.getFullFontName();
- if (names.length == 1)
- return new Font(names[0][3], 0, size);
- String name10 = null;
- String name3x = null;
- for (int k = 0; k < names.length; ++k) {
- String name[] = names[k];
- if (name[0].equals("1") && name[1].equals("0"))
- name10 = name[3];
- else if (name[2].equals("1033")) {
- name3x = name[3];
- break;
- }
- }
- String finalName = name3x;
- if (finalName == null)
- finalName = name10;
- if (finalName == null)
- finalName = names[0][3];
- return new Font(finalName, 0, size);
- }
-
- /** Maps a name to a BaseFont parameter.
- * @param awtName the name
- * @param parameters the BaseFont parameter
- */
- public void putName(String awtName, BaseFontParameters parameters) {
- mapper.put(awtName, parameters);
- }
-
- /** Maps an alias to a name.
- * @param alias the alias
- * @param awtName the name
- */
- public void putAlias(String alias, String awtName) {
- aliases.put(alias, awtName);
- }
-
- /** Looks for a BaseFont parameter associated with a name.
- * @param name the name
- * @return the BaseFont parameter or <CODE>null</CODE> if not found.
- */
- public BaseFontParameters getBaseFontParameters(String name) {
- String alias = (String)aliases.get(name);
- if (alias == null)
- return (BaseFontParameters)mapper.get(name);
- BaseFontParameters p = (BaseFontParameters)mapper.get(alias);
- if (p == null)
- return (BaseFontParameters)mapper.get(name);
- else
- return p;
- }
-
- /**
- * Inserts the names in this map.
- * @param allNames the returned value of calling {@link BaseFont#getAllFontNames(String, String, byte[])}
- * @param path the full path to the font
- */
- public void insertNames(Object allNames[], String path) {
- String names[][] = (String[][])allNames[2];
- String main = null;
- for (int k = 0; k < names.length; ++k) {
- String name[] = names[k];
- if (name[2].equals("1033")) {
- main = name[3];
- break;
- }
- }
- if (main == null)
- main = names[0][3];
- BaseFontParameters p = new BaseFontParameters(path);
- mapper.put(main, p);
- for (int k = 0; k < names.length; ++k) {
- aliases.put(names[k][3], main);
- }
- aliases.put((String)allNames[0], main);
- }
-
- /** Inserts all the fonts recognized by iText in the
- * <CODE>directory</CODE> into the map. The encoding
- * will be <CODE>BaseFont.CP1252</CODE> but can be
- * changed later.
- * @param dir the directory to scan
- * @return the number of files processed
- */
- public int insertDirectory(String dir) {
- File file = new File(dir);
- if (!file.exists() || !file.isDirectory())
- return 0;
- File files[] = file.listFiles();
- int count = 0;
- for (int k = 0; k < files.length; ++k) {
- file = files[k];
- String name = file.getPath().toLowerCase();
- try {
- if (name.endsWith(".ttf") || name.endsWith(".otf") || name.endsWith(".afm")) {
- Object allNames[] = BaseFont.getAllFontNames(file.getPath(), BaseFont.CP1252, null);
- insertNames(allNames, file.getPath());
- ++count;
- }
- else if (name.endsWith(".ttc")) {
- String ttcs[] = BaseFont.enumerateTTCNames(file.getPath());
- for (int j = 0; j < ttcs.length; ++j) {
- String nt = file.getPath() + "," + j;
- Object allNames[] = BaseFont.getAllFontNames(nt, BaseFont.CP1252, null);
- insertNames(allNames, nt);
- }
- ++count;
- }
- }
- catch (Exception e) {
- }
- }
- return count;
- }
-
- public HashMap getMapper() {
- return mapper;
- }
-
- public HashMap getAliases() {
- return aliases;
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/DocumentFont.java b/LibrarySource/com/lowagie/text/pdf/DocumentFont.java
deleted file mode 100644
index 23de88d..0000000
--- a/LibrarySource/com/lowagie/text/pdf/DocumentFont.java
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * Copyright 2004 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import java.io.IOException;
-import java.util.ArrayList;
-
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.ExceptionConverter;
-
-/**
- *
- * @author psoares
- */
-public class DocumentFont extends BaseFont {
-
- String fontName;
- PRIndirectReference refFont;
- PdfDictionary font;
- IntHashtable uni2byte = new IntHashtable();
- float Ascender = 800;
- float CapHeight = 700;
- float Descender = -200;
- float ItalicAngle = 0;
- float llx = -50;
- float lly = -200;
- float urx = 100;
- float ury = 900;
-
- BaseFont cjkMirror;
-
- String cjkNames[] = {"HeiseiMin-W3", "HeiseiKakuGo-W5", "STSong-Light", "MHei-Medium",
- "MSung-Light", "HYGoThic-Medium", "HYSMyeongJo-Medium", "MSungStd-Light", "STSongStd-Light",
- "HYSMyeongJoStd-Medium", "KozMinPro-Regular"};
-
- String cjkEncs[] = {"UniJIS-UCS2-H", "UniJIS-UCS2-H", "UniGB-UCS2-H", "UniCNS-UCS2-H",
- "UniCNS-UCS2-H", "UniKS-UCS2-H", "UniKS-UCS2-H", "UniCNS-UCS2-H", "UniGB-UCS2-H",
- "UniKS-UCS2-H", "UniJIS-UCS2-H"};
-
- static final int stdEnc[] = {
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 32,33,34,35,36,37,38,8217,40,41,42,43,44,45,46,47,
- 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
- 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
- 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
- 8216,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
- 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,161,162,163,8260,165,402,167,164,39,8220,171,8249,8250,64257,64258,
- 0,8211,8224,8225,183,0,182,8226,8218,8222,8221,187,8230,8240,0,191,
- 0,96,180,710,732,175,728,729,168,0,730,184,0,733,731,711,
- 8212,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,198,0,170,0,0,0,0,321,216,338,186,0,0,0,0,
- 0,230,0,0,0,305,0,0,322,248,339,223,0,0,0,0};
-
- /** Creates a new instance of DocumentFont */
- DocumentFont(PRIndirectReference refFont) {
- encoding = "";
- fontSpecific = false;
- this.refFont = refFont;
- fontType = FONT_TYPE_DOCUMENT;
- font = (PdfDictionary)PdfReader.getPdfObject(refFont);
- fontName = PdfName.decodeName(((PdfName)PdfReader.getPdfObject(font.get(PdfName.BASEFONT))).toString());
- PdfName subType = (PdfName)PdfReader.getPdfObject(font.get(PdfName.SUBTYPE));
- if (PdfName.TYPE1.equals(subType) || PdfName.TRUETYPE.equals(subType))
- doType1TT();
- else {
- for (int k = 0; k < cjkNames.length; ++k) {
- if (fontName.startsWith(cjkNames[k])) {
- fontName = cjkNames[k];
- try {
- cjkMirror = BaseFont.createFont(fontName, cjkEncs[k], false);
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- return;
- }
- }
- }
- }
-
- public void doType1TT() {
- PdfObject enc = PdfReader.getPdfObject(font.get(PdfName.ENCODING));
- if (enc == null)
- fillEncoding(null);
- else {
- if (enc.isName())
- fillEncoding((PdfName)enc);
- else {
- PdfDictionary encDic = (PdfDictionary)enc;
- enc = PdfReader.getPdfObject(encDic.get(PdfName.BASEENCODING));
- if (enc == null)
- fillEncoding(null);
- else
- fillEncoding((PdfName)enc);
- PdfArray diffs = (PdfArray)PdfReader.getPdfObject(encDic.get(PdfName.DIFFERENCES));
- if (diffs != null) {
- ArrayList dif = diffs.getArrayList();
- int currentNumber = 0;
- for (int k = 0; k < dif.size(); ++k) {
- PdfObject obj = (PdfObject)dif.get(k);
- if (obj.isNumber())
- currentNumber = ((PdfNumber)obj).intValue();
- else {
- int c[] = GlyphList.nameToUnicode(PdfName.decodeName(((PdfName)obj).toString()));
- if (c != null && c.length > 0)
- uni2byte.put(c[0], currentNumber);
- ++currentNumber;
- }
- }
- }
- }
- }
- PdfArray newWidths = (PdfArray)PdfReader.getPdfObject(font.get(PdfName.WIDTHS));
- PdfNumber first = (PdfNumber)PdfReader.getPdfObject(font.get(PdfName.FIRSTCHAR));
- PdfNumber last = (PdfNumber)PdfReader.getPdfObject(font.get(PdfName.LASTCHAR));
- if (BuiltinFonts14.containsKey(fontName)) {
- BaseFont bf;
- try {
- bf = BaseFont.createFont(fontName, WINANSI, false);
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- int e[] = uni2byte.toOrderedKeys();
- for (int k = 0; k < e.length; ++k) {
- int n = uni2byte.get(e[k]);
- widths[n] = bf.getRawWidth(n, GlyphList.unicodeToName(e[k]));
- }
- Ascender = bf.getFontDescriptor(ASCENT, 1000);
- CapHeight = bf.getFontDescriptor(CAPHEIGHT, 1000);
- Descender = bf.getFontDescriptor(DESCENT, 1000);
- ItalicAngle = bf.getFontDescriptor(ITALICANGLE, 1000);
- llx = bf.getFontDescriptor(BBOXLLX, 1000);
- lly = bf.getFontDescriptor(BBOXLLY, 1000);
- urx = bf.getFontDescriptor(BBOXURX, 1000);
- ury = bf.getFontDescriptor(BBOXURY, 1000);
- }
- if (first != null && last != null && newWidths != null) {
- int f = ((PdfNumber)first).intValue();
- ArrayList ar = ((PdfArray)newWidths).getArrayList();
- for (int k = 0; k < ar.size(); ++k) {
- widths[f + k] = ((PdfNumber)ar.get(k)).intValue();
- }
- }
- fillFontDesc();
- }
-
- void fillFontDesc() {
- PdfDictionary fontDesc = (PdfDictionary)PdfReader.getPdfObject(font.get(PdfName.FONTDESCRIPTOR));
- if (fontDesc == null)
- return;
- PdfNumber v = (PdfNumber)PdfReader.getPdfObject(fontDesc.get(PdfName.ASCENT));
- if (v != null)
- Ascender = v.floatValue();
- v = (PdfNumber)PdfReader.getPdfObject(fontDesc.get(PdfName.CAPHEIGHT));
- if (v != null)
- CapHeight = v.floatValue();
- v = (PdfNumber)PdfReader.getPdfObject(fontDesc.get(PdfName.DESCENT));
- if (v != null)
- Descender = v.floatValue();
- v = (PdfNumber)PdfReader.getPdfObject(fontDesc.get(PdfName.ITALICANGLE));
- if (v != null)
- ItalicAngle = v.floatValue();
- PdfArray bbox = (PdfArray)PdfReader.getPdfObject(fontDesc.get(PdfName.FONTBBOX));
- if (bbox != null) {
- ArrayList ar = bbox.getArrayList();
- llx = ((PdfNumber)ar.get(0)).floatValue();
- lly = ((PdfNumber)ar.get(1)).floatValue();
- urx = ((PdfNumber)ar.get(2)).floatValue();
- ury = ((PdfNumber)ar.get(3)).floatValue();
- if (llx > urx) {
- float t = llx;
- llx = urx;
- urx = t;
- }
- if (lly > ury) {
- float t = lly;
- lly = ury;
- ury = t;
- }
- }
- }
-
- void fillEncoding(PdfName encoding) {
- if (PdfName.MAC_ROMAN_ENCODING.equals(encoding) || PdfName.WIN_ANSI_ENCODING.equals(encoding)) {
- byte b[] = new byte[256];
- for (int k = 0; k < 256; ++k)
- b[k] = (byte)k;
- String enc = WINANSI;
- if (PdfName.MAC_ROMAN_ENCODING.equals(encoding))
- enc = MACROMAN;
- String cv = PdfEncodings.convertToString(b, enc);
- char arr[] = cv.toCharArray();
- for (int k = 0; k < 256; ++k)
- uni2byte.put(arr[k], k);
- }
- else {
- for (int k = 0; k < 256; ++k)
- uni2byte.put(stdEnc[k], k);
- }
- }
-
- /** Gets the family name of the font. If it is a True Type font
- * each array element will have {Platform ID, Platform Encoding ID,
- * Language ID, font name}. The interpretation of this values can be
- * found in the Open Type specification, chapter 2, in the 'name' table.<br>
- * For the other fonts the array has a single element with {"", "", "",
- * font name}.
- * @return the family name of the font
- *
- */
- public String[][] getFamilyFontName() {
- return null;
- }
-
- /** Gets the font parameter identified by <CODE>key</CODE>. Valid values
- * for <CODE>key</CODE> are <CODE>ASCENT</CODE>, <CODE>CAPHEIGHT</CODE>, <CODE>DESCENT</CODE>,
- * <CODE>ITALICANGLE</CODE>, <CODE>BBOXLLX</CODE>, <CODE>BBOXLLY</CODE>, <CODE>BBOXURX</CODE>
- * and <CODE>BBOXURY</CODE>.
- * @param key the parameter to be extracted
- * @param fontSize the font size in points
- * @return the parameter in points
- *
- */
- public float getFontDescriptor(int key, float fontSize) {
- if (cjkMirror != null)
- return cjkMirror.getFontDescriptor(key, fontSize);
- switch (key) {
- case AWT_ASCENT:
- case ASCENT:
- return Ascender * fontSize / 1000;
- case CAPHEIGHT:
- return CapHeight * fontSize / 1000;
- case AWT_DESCENT:
- case DESCENT:
- return Descender * fontSize / 1000;
- case ITALICANGLE:
- return ItalicAngle;
- case BBOXLLX:
- return llx * fontSize / 1000;
- case BBOXLLY:
- return lly * fontSize / 1000;
- case BBOXURX:
- return urx * fontSize / 1000;
- case BBOXURY:
- return ury * fontSize / 1000;
- case AWT_LEADING:
- return 0;
- case AWT_MAXADVANCE:
- return (urx - llx) * fontSize / 1000;
- }
- return 0;
- }
-
- /** Gets the full name of the font. If it is a True Type font
- * each array element will have {Platform ID, Platform Encoding ID,
- * Language ID, font name}. The interpretation of this values can be
- * found in the Open Type specification, chapter 2, in the 'name' table.<br>
- * For the other fonts the array has a single element with {"", "", "",
- * font name}.
- * @return the full name of the font
- *
- */
- public String[][] getFullFontName() {
- return null;
- }
-
- /** Gets the kerning between two Unicode chars.
- * @param char1 the first char
- * @param char2 the second char
- * @return the kerning to be applied
- *
- */
- public int getKerning(char char1, char char2) {
- return 0;
- }
-
- /** Gets the postscript font name.
- * @return the postscript font name
- *
- */
- public String getPostscriptFontName() {
- return fontName;
- }
-
- /** Gets the width from the font according to the Unicode char <CODE>c</CODE>
- * or the <CODE>name</CODE>. If the <CODE>name</CODE> is null it's a symbolic font.
- * @param c the unicode char
- * @param name the glyph name
- * @return the width of the char
- *
- */
- int getRawWidth(int c, String name) {
- return 0;
- }
-
- /** Checks if the font has any kerning pairs.
- * @return <CODE>true</CODE> if the font has any kerning pairs
- *
- */
- public boolean hasKernPairs() {
- return false;
- }
-
- /** Outputs to the writer the font dictionaries and streams.
- * @param writer the writer for this document
- * @param ref the font indirect reference
- * @param params several parameters that depend on the font type
- * @throws IOException on error
- * @throws DocumentException error in generating the object
- *
- */
- void writeFont(PdfWriter writer, PdfIndirectReference ref, Object[] params) throws DocumentException, IOException {
- }
-
- public int getWidth(String text) {
- if (cjkMirror != null)
- return cjkMirror.getWidth(text);
- else
- return super.getWidth(text);
- }
-
- byte[] convertToBytes(String text) {
- if (cjkMirror != null)
- return PdfEncodings.convertToBytes(text, CJKFont.CJK_ENCODING);
- else {
- char cc[] = text.toCharArray();
- byte b[] = new byte[cc.length];
- for (int k = 0; k < cc.length; ++k)
- b[k] = (byte)uni2byte.get(cc[k]);
- return b;
- }
- }
-
- PdfIndirectReference getIndirectReference() {
- return refFont;
- }
-
- public boolean charExists(char c) {
- if (cjkMirror != null)
- return cjkMirror.charExists(c);
- else
- return super.charExists(c);
- }
-
- /**
- * Sets the font name that will appear in the pdf font dictionary.
- * It does nothing in this case as the font is already in the document.
- * @param name the new font name
- */
- public void setPostscriptFontName(String name) {
- }
-
- public boolean setKerning(char char1, char char2, int kern) {
- return false;
- }
-
- public int[] getCharBBox(char c) {
- return null;
- }
-
- protected int[] getRawCharBBox(int c, String name) {
- return null;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/EnumerateTTC.java b/LibrarySource/com/lowagie/text/pdf/EnumerateTTC.java
deleted file mode 100644
index 517fe23..0000000
--- a/LibrarySource/com/lowagie/text/pdf/EnumerateTTC.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * $Id: EnumerateTTC.java,v 1.13 2002/06/20 13:04:40 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.*;
-import java.util.HashMap;
-import com.lowagie.text.DocumentException;
-/** Enumerates all the fonts inside a True Type Collection.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-class EnumerateTTC extends TrueTypeFont{
-
- protected String[] names;
-
- EnumerateTTC(String ttcFile) throws DocumentException, IOException {
- fileName = ttcFile;
- rf = new RandomAccessFileOrArray(ttcFile);
- findNames();
- }
-
- EnumerateTTC(byte ttcArray[]) throws DocumentException, IOException {
- fileName = "Byte array TTC";
- rf = new RandomAccessFileOrArray(ttcArray);
- findNames();
- }
-
- void findNames() throws DocumentException, IOException {
- tables = new HashMap();
-
- try {
- String mainTag = readStandardString(4);
- if (!mainTag.equals("ttcf"))
- throw new DocumentException(fileName + " is not a valid TTC file.");
- rf.skipBytes(4);
- int dirCount = rf.readInt();
- names = new String[dirCount];
- int dirPos = rf.getFilePointer();
- for (int dirIdx = 0; dirIdx < dirCount; ++dirIdx) {
- tables.clear();
- rf.seek(dirPos);
- rf.skipBytes(dirIdx * 4);
- directoryOffset = rf.readInt();
- rf.seek(directoryOffset);
- if (rf.readInt() != 0x00010000)
- throw new DocumentException(fileName + " is not a valid TTF file.");
- int num_tables = rf.readUnsignedShort();
- rf.skipBytes(6);
- for (int k = 0; k < num_tables; ++k) {
- String tag = readStandardString(4);
- rf.skipBytes(4);
- int table_location[] = new int[2];
- table_location[0] = rf.readInt();
- table_location[1] = rf.readInt();
- tables.put(tag, table_location);
- }
- names[dirIdx] = getBaseFont();
- }
- }
- finally {
- if (rf != null)
- rf.close();
- }
- }
-
- String[] getNames() {
- return names;
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/ExtendedColor.java b/LibrarySource/com/lowagie/text/pdf/ExtendedColor.java
deleted file mode 100644
index 2e4fc57..0000000
--- a/LibrarySource/com/lowagie/text/pdf/ExtendedColor.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * $Id: ExtendedColor.java,v 1.43 2005/03/29 14:08:15 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import headless.awt.Color;
-/**
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class ExtendedColor extends Color{
-
- /** a type of extended color. */
- public static final int TYPE_RGB = 0;
- /** a type of extended color. */
- public static final int TYPE_GRAY = 1;
- /** a type of extended color. */
- public static final int TYPE_CMYK = 2;
- /** a type of extended color. */
- public static final int TYPE_SEPARATION = 3;
- /** a type of extended color. */
- public static final int TYPE_PATTERN = 4;
- /** a type of extended color. */
- public static final int TYPE_SHADING = 5;
-
- protected int type;
-
- /**
- * Constructs an extended color of a certain type.
- * @param type
- */
- public ExtendedColor(int type) {
- super(0, 0, 0);
- this.type = type;
- }
-
- /**
- * Constructs an extended color of a certain type and a certain color.
- * @param type
- * @param red
- * @param green
- * @param blue
- */
- public ExtendedColor(int type, float red, float green, float blue) {
- super(normalize(red), normalize(green), normalize(blue));
- this.type = type;
- }
-
- /**
- * Gets the type of this color.
- * @return one of the types (see constants)
- */
- public int getType() {
- return type;
- }
-
- /**
- * Gets the type of a given color.
- * @param color
- * @return one of the types (see constants)
- */
- public static int getType(Color color) {
- if (color instanceof ExtendedColor)
- return ((ExtendedColor)color).getType();
- return TYPE_RGB;
- }
-
- static final float normalize(float value) {
- if (value < 0)
- return 0;
- if (value > 1)
- return 1;
- return value;
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/ExtraEncoding.java b/LibrarySource/com/lowagie/text/pdf/ExtraEncoding.java
deleted file mode 100644
index cbdb4b6..0000000
--- a/LibrarySource/com/lowagie/text/pdf/ExtraEncoding.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2003 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/**
- * Classes implementing this interface can create custom encodings or
- * replace existing ones. It is used in the context of <code>PdfEncoding</code>.
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public interface ExtraEncoding {
-
- /**
- * Converts an Unicode string to a byte array according to some encoding.
- * @param text the Unicode string
- * @param encoding the requested encoding. It's mainly of use if the same class
- * supports more than one encoding.
- * @return the conversion or <CODE>null</CODE> if no conversion is supported
- */
- public byte[] charToByte(String text, String encoding);
-
- /**
- * Converts a byte array to an Unicode string according to some encoding.
- * @param b the input byte array
- * @param encoding the requested encoding. It's mainly of use if the same class
- * supports more than one encoding.
- * @return the conversion or <CODE>null</CODE> if no conversion is supported
- */
- public String byteToChar(byte b[], String encoding);
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/FdfReader.java b/LibrarySource/com/lowagie/text/pdf/FdfReader.java
deleted file mode 100644
index f97129a..0000000
--- a/LibrarySource/com/lowagie/text/pdf/FdfReader.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright 2003 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.ArrayList;
-import java.net.URL;
-/** Reads an FDF form and makes the fields available
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class FdfReader extends PdfReader {
-
- HashMap fields;
- String fileSpec;
- PdfName encoding;
-
- /** Reads an FDF form.
- * @param filename the file name of the form
- * @throws IOException on error
- */
- public FdfReader(String filename) throws IOException {
- super(filename);
- }
-
- /** Reads an FDF form.
- * @param pdfIn the byte array with the form
- * @throws IOException on error
- */
- public FdfReader(byte pdfIn[]) throws IOException {
- super(pdfIn);
- }
-
- /** Reads an FDF form.
- * @param url the URL of the document
- * @throws IOException on error
- */
- public FdfReader(URL url) throws IOException {
- super(url);
- }
-
- /** Reads an FDF form.
- * @param is the <CODE>InputStream</CODE> containing the document. The stream is read to the
- * end but is not closed
- * @throws IOException on error
- */
- public FdfReader(InputStream is) throws IOException {
- super(is);
- }
-
- protected void readPdf() throws IOException {
- fields = new HashMap();
- try {
- tokens.checkFdfHeader();
- rebuildXref();
- readDocObj();
- }
- finally {
- try {
- tokens.close();
- }
- catch (Exception e) {
- // empty on purpose
- }
- }
- readFields();
- }
-
- protected void kidNode(PdfDictionary merged, String name) {
- PdfArray kids = (PdfArray)getPdfObject(merged.get(PdfName.KIDS));
- if (kids == null || kids.getArrayList().size() == 0) {
- if (name.length() > 0)
- name = name.substring(1);
- fields.put(name, merged);
- }
- else {
- merged.remove(PdfName.KIDS);
- ArrayList ar = kids.getArrayList();
- for (int k = 0; k < ar.size(); ++k) {
- PdfDictionary dic = new PdfDictionary();
- dic.merge(merged);
- PdfDictionary newDic = (PdfDictionary)getPdfObject((PdfObject)ar.get(k));
- PdfString t = (PdfString)getPdfObject(newDic.get(PdfName.T));
- String newName = name;
- if (t != null)
- newName += "." + t.toUnicodeString();
- dic.merge(newDic);
- dic.remove(PdfName.T);
- kidNode(dic, newName);
- }
- }
- }
-
- protected void readFields() throws IOException {
- catalog = (PdfDictionary)getPdfObject(trailer.get(PdfName.ROOT));
- PdfDictionary fdf = (PdfDictionary)getPdfObject(catalog.get(PdfName.FDF));
- PdfString fs = (PdfString)getPdfObject(fdf.get(PdfName.F));
- if (fs != null)
- fileSpec = fs.toUnicodeString();
- PdfArray fld = (PdfArray)getPdfObject(fdf.get(PdfName.FIELDS));
- if (fld == null)
- return;
- encoding = (PdfName)getPdfObject(fdf.get(PdfName.ENCODING));
- PdfDictionary merged = new PdfDictionary();
- merged.put(PdfName.KIDS, fld);
- kidNode(merged, "");
- }
-
- /** Gets all the fields. The map is keyed by the fully qualified
- * field name and the value is a merged <CODE>PdfDictionary</CODE>
- * with the field content.
- * @return all the fields
- */
- public HashMap getFields() {
- return fields;
- }
-
- /** Gets the field dictionary.
- * @param name the fully qualified field name
- * @return the field dictionary
- */
- public PdfDictionary getField(String name) {
- return (PdfDictionary)fields.get(name);
- }
-
- /** Gets the field value or <CODE>null</CODE> if the field does not
- * exist or has no value defined.
- * @param name the fully qualified field name
- * @return the field value or <CODE>null</CODE>
- */
- public String getFieldValue(String name) {
- PdfDictionary field = (PdfDictionary)fields.get(name);
- if (field == null)
- return null;
- PdfObject v = getPdfObject(field.get(PdfName.V));
- if (v == null)
- return null;
- if (v.isName())
- return PdfName.decodeName(((PdfName)v).toString());
- else if (v.isString()) {
- PdfString vs = (PdfString)v;
- if (encoding == null || vs.getEncoding() != null)
- return vs.toUnicodeString();
- byte b[] = vs.getBytes();
- if (b.length >= 2 && b[0] == (byte)254 && b[1] == (byte)255)
- return vs.toUnicodeString();
- try {
- if (encoding.equals(PdfName.SHIFT_JIS))
- return new String(b, "SJIS");
- else if (encoding.equals(PdfName.UHC))
- return new String(b, "MS949");
- else if (encoding.equals(PdfName.GBK))
- return new String(b, "GBK");
- else if (encoding.equals(PdfName.BIGFIVE))
- return new String(b, "Big5");
- }
- catch (Exception e) {
- }
- return vs.toUnicodeString();
- }
- return null;
- }
-
- /** Gets the PDF file specification contained in the FDF.
- * @return the PDF file specification contained in the FDF
- */
- public String getFileSpec() {
- return fileSpec;
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/FontDetails.java b/LibrarySource/com/lowagie/text/pdf/FontDetails.java
deleted file mode 100644
index 39dc804..0000000
--- a/LibrarySource/com/lowagie/text/pdf/FontDetails.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * $Id: FontDetails.java,v 1.12 2002/06/18 13:59:40 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.ExceptionConverter;
-import java.util.HashMap;
-import java.io.UnsupportedEncodingException;
-/** Each font in the document will have an instance of this class
- * where the characters used will be represented.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-class FontDetails {
-
- /** The indirect reference to this font
- */
- PdfIndirectReference indirectReference;
- /** The font name that appears in the document body stream
- */
- PdfName fontName;
- /** The font
- */
- BaseFont baseFont;
- /** The font if its an instance of <CODE>TrueTypeFontUnicode</CODE>
- */
- TrueTypeFontUnicode ttu;
-
- CJKFont cjkFont;
- /** The array used with single byte encodings
- */
- byte shortTag[];
- /** The map used with double byte encodings. The key is Integer(glyph) and the
- * value is int[]{glyph, width, Unicode code}
- */
- HashMap longTag;
-
- IntHashtable cjkTag;
- /** The font type
- */
- int fontType;
- /** <CODE>true</CODE> if the font is symbolic
- */
- boolean symbolic;
- /** Indicates if all the glyphs and widths for that particular
- * encoding should be included in the document.
- */
- protected boolean subset = true;
- /** Each font used in a document has an instance of this class.
- * This class stores the characters used in the document and other
- * specifics unique to the current working document.
- * @param fontName the font name
- * @param indirectReference the indirect reference to the font
- * @param baseFont the <CODE>BaseFont</CODE>
- */
- FontDetails(PdfName fontName, PdfIndirectReference indirectReference, BaseFont baseFont) {
- this.fontName = fontName;
- this.indirectReference = indirectReference;
- this.baseFont = baseFont;
- fontType = baseFont.getFontType();
- switch (fontType) {
- case BaseFont.FONT_TYPE_T1:
- case BaseFont.FONT_TYPE_TT:
- shortTag = new byte[256];
- break;
- case BaseFont.FONT_TYPE_CJK:
- cjkTag = new IntHashtable();
- cjkFont = (CJKFont)baseFont;
- break;
- case BaseFont.FONT_TYPE_TTUNI:
- longTag = new HashMap();
- ttu = (TrueTypeFontUnicode)baseFont;
- symbolic = baseFont.isFontSpecific();
- break;
- }
- }
-
- /** Gets the indirect reference to this font.
- * @return the indirect reference to this font
- */
- PdfIndirectReference getIndirectReference() {
- return indirectReference;
- }
-
- /** Gets the font name as it appears in the document body.
- * @return the font name
- */
- PdfName getFontName() {
- return fontName;
- }
-
- /** Gets the <CODE>BaseFont</CODE> of this font.
- * @return the <CODE>BaseFont</CODE> of this font
- */
- BaseFont getBaseFont() {
- return baseFont;
- }
-
- /** Converts the text into bytes to be placed in the document.
- * The conversion is done according to the font and the encoding and the characters
- * used are stored.
- * @param text the text to convert
- * @return the conversion
- */
- byte[] convertToBytes(String text) {
- byte b[] = null;
- switch (fontType) {
- case BaseFont.FONT_TYPE_T1:
- case BaseFont.FONT_TYPE_TT: {
- b = baseFont.convertToBytes(text);
- int len = b.length;
- for (int k = 0; k < len; ++k)
- shortTag[((int)b[k]) & 0xff] = 1;
- break;
- }
- case BaseFont.FONT_TYPE_CJK: {
- int len = text.length();
- for (int k = 0; k < len; ++k)
- cjkTag.put(cjkFont.getCidCode(text.charAt(k)), 0);
- b = baseFont.convertToBytes(text);
- break;
- }
- case BaseFont.FONT_TYPE_DOCUMENT: {
- b = baseFont.convertToBytes(text);
- break;
- }
- case BaseFont.FONT_TYPE_TTUNI: {
- try {
- int len = text.length();
- int metrics[] = null;
- char glyph[] = new char[len];
- int i = 0;
- if (symbolic) {
- b = PdfEncodings.convertToBytes(text, "symboltt");
- len = b.length;
- for (int k = 0; k < len; ++k) {
- metrics = ttu.getMetricsTT(b[k] & 0xff);
- if (metrics == null)
- continue;
- longTag.put(new Integer(metrics[0]), new int[]{metrics[0], metrics[1], ttu.getUnicodeDifferences(b[k] & 0xff)});
- glyph[i++] = (char)metrics[0];
- }
- }
- else {
- for (int k = 0; k < len; ++k) {
- char c = text.charAt(k);
- metrics = ttu.getMetricsTT(c);
- if (metrics == null)
- continue;
- int m0 = metrics[0];
- Integer gl = new Integer(m0);
- if (!longTag.containsKey(gl))
- longTag.put(gl, new int[]{m0, metrics[1], c});
- glyph[i++] = (char)m0;
- }
- }
- String s = new String(glyph, 0, i);
- b = s.getBytes(CJKFont.CJK_ENCODING);
- }
- catch (UnsupportedEncodingException e) {
- throw new ExceptionConverter(e);
- }
- break;
- }
- }
- return b;
- }
-
- /** Writes the font definition to the document.
- * @param writer the <CODE>PdfWriter</CODE> of this document
- */
- void writeFont(PdfWriter writer) {
- try {
- switch (fontType) {
- case BaseFont.FONT_TYPE_T1:
- case BaseFont.FONT_TYPE_TT: {
- int firstChar;
- int lastChar;
- if (subset) {
- for (firstChar = 0; firstChar < 256; ++firstChar) {
- if (shortTag[firstChar] != 0)
- break;
- }
- for (lastChar = 255; lastChar >= firstChar; --lastChar) {
- if (shortTag[lastChar] != 0)
- break;
- }
- if (firstChar > 255) {
- firstChar = 255;
- lastChar = 255;
- }
- }
- else {
- for (int k = 0; k < shortTag.length; ++k)
- shortTag[k] = 1;
- firstChar = 0;
- lastChar = shortTag.length - 1;
- }
- baseFont.writeFont(writer, indirectReference, new Object[]{new Integer(firstChar), new Integer(lastChar), shortTag});
- break;
- }
- case BaseFont.FONT_TYPE_CJK:
- baseFont.writeFont(writer, indirectReference, new Object[]{cjkTag});
- break;
- case BaseFont.FONT_TYPE_TTUNI:
- baseFont.writeFont(writer, indirectReference, new Object[]{longTag});
- break;
- }
- }
- catch(Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- /** Indicates if all the glyphs and widths for that particular
- * encoding should be included in the document.
- * @return <CODE>false</CODE> to include all the glyphs and widths.
- */
- public boolean isSubset() {
- return subset;
- }
-
- /** Indicates if all the glyphs and widths for that particular
- * encoding should be included in the document. Set to <CODE>false</CODE>
- * to include all.
- * @param subset new value of property subset
- */
- public void setSubset(boolean subset) {
- this.subset = subset;
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/FontMapper.java b/LibrarySource/com/lowagie/text/pdf/FontMapper.java
deleted file mode 100644
index 2d6b197..0000000
--- a/LibrarySource/com/lowagie/text/pdf/FontMapper.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2002 by Jeremy Bowman <bowmanjm at attbi.com>.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import headless.awt.Font;
-
-/**
- * A FontMapper implementation handles mappings between AWT Fonts and PDF
- * fonts. An interface is used instead of a fixed class because there isn't
- * an exact correlation between the font types, so each application is free
- * to define a mapping which is appropriate for it.
- */
-
-public interface FontMapper {
-
- /**
- * Returns a BaseFont which can be used to represent the given AWT Font
- *
- * @param font the font to be converted
- * @return a BaseFont which has similar properties to the provided Font
- */
-
- public BaseFont awtToPdf(Font font);
-
- /**
- * Returns an AWT Font which can be used to represent the given BaseFont
- *
- * @param font the font to be converted
- * @param size the desired point size of the resulting font
- * @return a Font which has similar properties to the provided BaseFont
- */
-
- public Font pdfToAwt(BaseFont font, int size);
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/FontSelector.java b/LibrarySource/com/lowagie/text/pdf/FontSelector.java
deleted file mode 100644
index f10215f..0000000
--- a/LibrarySource/com/lowagie/text/pdf/FontSelector.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright 2003 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import java.util.ArrayList;
-import com.lowagie.text.*;
-
-/** Selects the appropriate fonts that contain the glyphs needed to
- * render text correctly. The fonts are checked in order until the
- * character is found.
- * <p>
- * The built in fonts "Symbol" and "ZapfDingbats", if used, have a special encoding
- * to allow the characters to be referred by Unicode.
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class FontSelector {
-
- protected ArrayList fonts = new ArrayList();
-
- /**
- * Adds a <CODE>Font</CODE> to be searched for valid characters.
- * @param font the <CODE>Font</CODE>
- */
- public void addFont(Font font) {
- if (font.getBaseFont() != null) {
- fonts.add(font);
- return;
- }
- BaseFont bf = font.getCalculatedBaseFont(true);
- Font f2 = new Font(bf, font.size(), font.getCalculatedStyle(), font.color());
- fonts.add(f2);
- }
-
- /**
- * Process the text so that it will render with a combination of fonts
- * if needed.
- * @param text the text
- * @return a <CODE>Phrase</CODE> with one or more chunks
- */
- public Phrase process(String text) {
- int fsize = fonts.size();
- if (fsize == 0)
- throw new IndexOutOfBoundsException("No font is defined.");
- char cc[] = text.toCharArray();
- int len = cc.length;
- StringBuffer sb = new StringBuffer();
- Font font = null;
- int lastidx = -1;
- Phrase ret = new Phrase();
- for (int k = 0; k < len; ++k) {
- char c = cc[k];
- if (c == '\n' || c == '\r') {
- sb.append(c);
- continue;
- }
- for (int f = 0; f < fsize; ++f) {
- font = (Font)fonts.get(f);
- if (font.getBaseFont().charExists(c)) {
- if (lastidx == f)
- sb.append(c);
- else {
- if (sb.length() > 0 && lastidx != -1) {
- Chunk ck = new Chunk(sb.toString(), (Font)fonts.get(lastidx));
- ret.add(ck);
- sb = new StringBuffer();
- }
- sb.append(c);
- lastidx = f;
- }
- break;
- }
- }
- }
- if (sb.length() > 0) {
- Chunk ck = new Chunk(sb.toString(), (Font)fonts.get(lastidx));
- ret.add(ck);
- }
- return ret;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/GlyphList.java b/LibrarySource/com/lowagie/text/pdf/GlyphList.java
deleted file mode 100644
index 2f76917..0000000
--- a/LibrarySource/com/lowagie/text/pdf/GlyphList.java
+++ /dev/null
@@ -1,2200 +0,0 @@
-/*
- * $Id: GlyphList.java,v 1.20 2002/06/18 13:59:40 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.util.HashMap;
-
-public class GlyphList
-{
- private static HashMap unicode2names = new HashMap();
- private static HashMap names2unicode = new HashMap();
-
- private static final int unicode[] =
- {
- 0x0041,
- 0x00C6,
- 0x01FC,
- 0xF7E6,
- 0x00C1,
- 0xF7E1,
- 0x0102,
- 0x00C2,
- 0xF7E2,
- 0xF6C9,
- 0xF7B4,
- 0x00C4,
- 0xF7E4,
- 0x00C0,
- 0xF7E0,
- 0x0391,
- 0x0386,
- 0x0100,
- 0x0104,
- 0x00C5,
- 0x01FA,
- 0xF7E5,
- 0xF761,
- 0x00C3,
- 0xF7E3,
- 0x0042,
- 0x0392,
- 0xF6F4,
- 0xF762,
- 0x0043,
- 0x0106,
- 0xF6CA,
- 0xF6F5,
- 0x010C,
- 0x00C7,
- 0xF7E7,
- 0x0108,
- 0x010A,
- 0xF7B8,
- 0x03A7,
- 0xF6F6,
- 0xF763,
- 0x0044,
- 0x010E,
- 0x0110,
- 0x2206,
- 0x0394,
- 0xF6CB,
- 0xF6CC,
- 0xF6CD,
- 0xF7A8,
- 0xF6F7,
- 0xF764,
- 0x0045,
- 0x00C9,
- 0xF7E9,
- 0x0114,
- 0x011A,
- 0x00CA,
- 0xF7EA,
- 0x00CB,
- 0xF7EB,
- 0x0116,
- 0x00C8,
- 0xF7E8,
- 0x0112,
- 0x014A,
- 0x0118,
- 0x0395,
- 0x0388,
- 0xF765,
- 0x0397,
- 0x0389,
- 0x00D0,
- 0xF7F0,
- 0x20AC,
- 0x0046,
- 0xF766,
- 0x0047,
- 0x0393,
- 0x011E,
- 0x01E6,
- 0x011C,
- 0x0122,
- 0x0120,
- 0xF6CE,
- 0xF760,
- 0xF767,
- 0x0048,
- 0x25CF,
- 0x25AA,
- 0x25AB,
- 0x25A1,
- 0x0126,
- 0x0124,
- 0xF768,
- 0xF6CF,
- 0xF6F8,
- 0x0049,
- 0x0132,
- 0x00CD,
- 0xF7ED,
- 0x012C,
- 0x00CE,
- 0xF7EE,
- 0x00CF,
- 0xF7EF,
- 0x0130,
- 0x2111,
- 0x00CC,
- 0xF7EC,
- 0x012A,
- 0x012E,
- 0x0399,
- 0x03AA,
- 0x038A,
- 0xF769,
- 0x0128,
- 0x004A,
- 0x0134,
- 0xF76A,
- 0x004B,
- 0x039A,
- 0x0136,
- 0xF76B,
- 0x004C,
- 0xF6BF,
- 0x0139,
- 0x039B,
- 0x013D,
- 0x013B,
- 0x013F,
- 0x0141,
- 0xF6F9,
- 0xF76C,
- 0x004D,
- 0xF6D0,
- 0xF7AF,
- 0xF76D,
- 0x039C,
- 0x004E,
- 0x0143,
- 0x0147,
- 0x0145,
- 0xF76E,
- 0x00D1,
- 0xF7F1,
- 0x039D,
- 0x004F,
- 0x0152,
- 0xF6FA,
- 0x00D3,
- 0xF7F3,
- 0x014E,
- 0x00D4,
- 0xF7F4,
- 0x00D6,
- 0xF7F6,
- 0xF6FB,
- 0x00D2,
- 0xF7F2,
- 0x01A0,
- 0x0150,
- 0x014C,
- 0x2126,
- 0x03A9,
- 0x038F,
- 0x039F,
- 0x038C,
- 0x00D8,
- 0x01FE,
- 0xF7F8,
- 0xF76F,
- 0x00D5,
- 0xF7F5,
- 0x0050,
- 0x03A6,
- 0x03A0,
- 0x03A8,
- 0xF770,
- 0x0051,
- 0xF771,
- 0x0052,
- 0x0154,
- 0x0158,
- 0x0156,
- 0x211C,
- 0x03A1,
- 0xF6FC,
- 0xF772,
- 0x0053,
- 0x250C,
- 0x2514,
- 0x2510,
- 0x2518,
- 0x253C,
- 0x252C,
- 0x2534,
- 0x251C,
- 0x2524,
- 0x2500,
- 0x2502,
- 0x2561,
- 0x2562,
- 0x2556,
- 0x2555,
- 0x2563,
- 0x2551,
- 0x2557,
- 0x255D,
- 0x255C,
- 0x255B,
- 0x255E,
- 0x255F,
- 0x255A,
- 0x2554,
- 0x2569,
- 0x2566,
- 0x2560,
- 0x2550,
- 0x256C,
- 0x2567,
- 0x2568,
- 0x2564,
- 0x2565,
- 0x2559,
- 0x2558,
- 0x2552,
- 0x2553,
- 0x256B,
- 0x256A,
- 0x015A,
- 0x0160,
- 0xF6FD,
- 0x015E,
- 0xF6C1,
- 0x015C,
- 0x0218,
- 0x03A3,
- 0xF773,
- 0x0054,
- 0x03A4,
- 0x0166,
- 0x0164,
- 0x0162,
- 0x021A,
- 0x0398,
- 0x00DE,
- 0xF7FE,
- 0xF6FE,
- 0xF774,
- 0x0055,
- 0x00DA,
- 0xF7FA,
- 0x016C,
- 0x00DB,
- 0xF7FB,
- 0x00DC,
- 0xF7FC,
- 0x00D9,
- 0xF7F9,
- 0x01AF,
- 0x0170,
- 0x016A,
- 0x0172,
- 0x03A5,
- 0x03D2,
- 0x03AB,
- 0x038E,
- 0x016E,
- 0xF775,
- 0x0168,
- 0x0056,
- 0xF776,
- 0x0057,
- 0x1E82,
- 0x0174,
- 0x1E84,
- 0x1E80,
- 0xF777,
- 0x0058,
- 0x039E,
- 0xF778,
- 0x0059,
- 0x00DD,
- 0xF7FD,
- 0x0176,
- 0x0178,
- 0xF7FF,
- 0x1EF2,
- 0xF779,
- 0x005A,
- 0x0179,
- 0x017D,
- 0xF6FF,
- 0x017B,
- 0x0396,
- 0xF77A,
- 0x0061,
- 0x00E1,
- 0x0103,
- 0x00E2,
- 0x00B4,
- 0x0301,
- 0x00E4,
- 0x00E6,
- 0x01FD,
- 0x2015,
- 0x0410,
- 0x0411,
- 0x0412,
- 0x0413,
- 0x0414,
- 0x0415,
- 0x0401,
- 0x0416,
- 0x0417,
- 0x0418,
- 0x0419,
- 0x041A,
- 0x041B,
- 0x041C,
- 0x041D,
- 0x041E,
- 0x041F,
- 0x0420,
- 0x0421,
- 0x0422,
- 0x0423,
- 0x0424,
- 0x0425,
- 0x0426,
- 0x0427,
- 0x0428,
- 0x0429,
- 0x042A,
- 0x042B,
- 0x042C,
- 0x042D,
- 0x042E,
- 0x042F,
- 0x0490,
- 0x0402,
- 0x0403,
- 0x0404,
- 0x0405,
- 0x0406,
- 0x0407,
- 0x0408,
- 0x0409,
- 0x040A,
- 0x040B,
- 0x040C,
- 0x040E,
- 0xF6C4,
- 0xF6C5,
- 0x0430,
- 0x0431,
- 0x0432,
- 0x0433,
- 0x0434,
- 0x0435,
- 0x0451,
- 0x0436,
- 0x0437,
- 0x0438,
- 0x0439,
- 0x043A,
- 0x043B,
- 0x043C,
- 0x043D,
- 0x043E,
- 0x043F,
- 0x0440,
- 0x0441,
- 0x0442,
- 0x0443,
- 0x0444,
- 0x0445,
- 0x0446,
- 0x0447,
- 0x0448,
- 0x0449,
- 0x044A,
- 0x044B,
- 0x044C,
- 0x044D,
- 0x044E,
- 0x044F,
- 0x0491,
- 0x0452,
- 0x0453,
- 0x0454,
- 0x0455,
- 0x0456,
- 0x0457,
- 0x0458,
- 0x0459,
- 0x045A,
- 0x045B,
- 0x045C,
- 0x045E,
- 0x040F,
- 0x0462,
- 0x0472,
- 0x0474,
- 0xF6C6,
- 0x045F,
- 0x0463,
- 0x0473,
- 0x0475,
- 0xF6C7,
- 0xF6C8,
- 0x04D9,
- 0x200E,
- 0x200F,
- 0x200D,
- 0x066A,
- 0x060C,
- 0x0660,
- 0x0661,
- 0x0662,
- 0x0663,
- 0x0664,
- 0x0665,
- 0x0666,
- 0x0667,
- 0x0668,
- 0x0669,
- 0x061B,
- 0x061F,
- 0x0621,
- 0x0622,
- 0x0623,
- 0x0624,
- 0x0625,
- 0x0626,
- 0x0627,
- 0x0628,
- 0x0629,
- 0x062A,
- 0x062B,
- 0x062C,
- 0x062D,
- 0x062E,
- 0x062F,
- 0x0630,
- 0x0631,
- 0x0632,
- 0x0633,
- 0x0634,
- 0x0635,
- 0x0636,
- 0x0637,
- 0x0638,
- 0x0639,
- 0x063A,
- 0x0640,
- 0x0641,
- 0x0642,
- 0x0643,
- 0x0644,
- 0x0645,
- 0x0646,
- 0x0648,
- 0x0649,
- 0x064A,
- 0x064B,
- 0x064C,
- 0x064D,
- 0x064E,
- 0x064F,
- 0x0650,
- 0x0651,
- 0x0652,
- 0x0647,
- 0x06A4,
- 0x067E,
- 0x0686,
- 0x0698,
- 0x06AF,
- 0x0679,
- 0x0688,
- 0x0691,
- 0x06BA,
- 0x06D2,
- 0x06D5,
- 0x20AA,
- 0x05BE,
- 0x05C3,
- 0x05D0,
- 0x05D1,
- 0x05D2,
- 0x05D3,
- 0x05D4,
- 0x05D5,
- 0x05D6,
- 0x05D7,
- 0x05D8,
- 0x05D9,
- 0x05DA,
- 0x05DB,
- 0x05DC,
- 0x05DD,
- 0x05DE,
- 0x05DF,
- 0x05E0,
- 0x05E1,
- 0x05E2,
- 0x05E3,
- 0x05E4,
- 0x05E5,
- 0x05E6,
- 0x05E7,
- 0x05E8,
- 0x05E9,
- 0x05EA,
- 0xFB2A,
- 0xFB2B,
- 0xFB4B,
- 0xFB1F,
- 0x05F0,
- 0x05F1,
- 0x05F2,
- 0xFB35,
- 0x05B4,
- 0x05B5,
- 0x05B6,
- 0x05BB,
- 0x05B8,
- 0x05B7,
- 0x05B0,
- 0x05B2,
- 0x05B1,
- 0x05B3,
- 0x05C2,
- 0x05C1,
- 0x05B9,
- 0x05BC,
- 0x05BD,
- 0x05BF,
- 0x05C0,
- 0x02BC,
- 0x2105,
- 0x2113,
- 0x2116,
- 0x202C,
- 0x202D,
- 0x202E,
- 0x200C,
- 0x066D,
- 0x02BD,
- 0x00E0,
- 0x2135,
- 0x03B1,
- 0x03AC,
- 0x0101,
- 0x0026,
- 0xF726,
- 0x2220,
- 0x2329,
- 0x232A,
- 0x0387,
- 0x0105,
- 0x2248,
- 0x00E5,
- 0x01FB,
- 0x2194,
- 0x21D4,
- 0x21D3,
- 0x21D0,
- 0x21D2,
- 0x21D1,
- 0x2193,
- 0xF8E7,
- 0x2190,
- 0x2192,
- 0x2191,
- 0x2195,
- 0x21A8,
- 0xF8E6,
- 0x005E,
- 0x007E,
- 0x002A,
- 0x2217,
- 0xF6E9,
- 0x0040,
- 0x00E3,
- 0x0062,
- 0x005C,
- 0x007C,
- 0x03B2,
- 0x2588,
- 0xF8F4,
- 0x007B,
- 0xF8F3,
- 0xF8F2,
- 0xF8F1,
- 0x007D,
- 0xF8FE,
- 0xF8FD,
- 0xF8FC,
- 0x005B,
- 0xF8F0,
- 0xF8EF,
- 0xF8EE,
- 0x005D,
- 0xF8FB,
- 0xF8FA,
- 0xF8F9,
- 0x02D8,
- 0x00A6,
- 0xF6EA,
- 0x2022,
- 0x0063,
- 0x0107,
- 0x02C7,
- 0x21B5,
- 0x010D,
- 0x00E7,
- 0x0109,
- 0x010B,
- 0x00B8,
- 0x00A2,
- 0xF6DF,
- 0xF7A2,
- 0xF6E0,
- 0x03C7,
- 0x25CB,
- 0x2297,
- 0x2295,
- 0x02C6,
- 0x2663,
- 0x003A,
- 0x20A1,
- 0x002C,
- 0xF6C3,
- 0xF6E1,
- 0xF6E2,
- 0x2245,
- 0x00A9,
- 0xF8E9,
- 0xF6D9,
- 0x00A4,
- 0xF6D1,
- 0xF6D2,
- 0xF6D4,
- 0xF6D5,
- 0x0064,
- 0x2020,
- 0x2021,
- 0xF6D3,
- 0xF6D6,
- 0x010F,
- 0x0111,
- 0x00B0,
- 0x03B4,
- 0x2666,
- 0x00A8,
- 0xF6D7,
- 0xF6D8,
- 0x0385,
- 0x00F7,
- 0x2593,
- 0x2584,
- 0x0024,
- 0xF6E3,
- 0xF724,
- 0xF6E4,
- 0x20AB,
- 0x02D9,
- 0x0323,
- 0x0131,
- 0xF6BE,
- 0x22C5,
- 0xF6EB,
- 0x0065,
- 0x00E9,
- 0x0115,
- 0x011B,
- 0x00EA,
- 0x00EB,
- 0x0117,
- 0x00E8,
- 0x0038,
- 0x2088,
- 0xF738,
- 0x2078,
- 0x2208,
- 0x2026,
- 0x0113,
- 0x2014,
- 0x2205,
- 0x2013,
- 0x014B,
- 0x0119,
- 0x03B5,
- 0x03AD,
- 0x003D,
- 0x2261,
- 0x212E,
- 0xF6EC,
- 0x03B7,
- 0x03AE,
- 0x00F0,
- 0x0021,
- 0x203C,
- 0x00A1,
- 0xF7A1,
- 0xF721,
- 0x2203,
- 0x0066,
- 0x2640,
- 0xFB00,
- 0xFB03,
- 0xFB04,
- 0xFB01,
- 0x2012,
- 0x25A0,
- 0x25AC,
- 0x0035,
- 0x215D,
- 0x2085,
- 0xF735,
- 0x2075,
- 0xFB02,
- 0x0192,
- 0x0034,
- 0x2084,
- 0xF734,
- 0x2074,
- 0x2044,
- 0x2215,
- 0x20A3,
- 0x0067,
- 0x03B3,
- 0x011F,
- 0x01E7,
- 0x011D,
- 0x0123,
- 0x0121,
- 0x00DF,
- 0x2207,
- 0x0060,
- 0x0300,
- 0x003E,
- 0x2265,
- 0x00AB,
- 0x00BB,
- 0x2039,
- 0x203A,
- 0x0068,
- 0x0127,
- 0x0125,
- 0x2665,
- 0x0309,
- 0x2302,
- 0x02DD,
- 0x002D,
- 0x00AD,
- 0xF6E5,
- 0xF6E6,
- 0x0069,
- 0x00ED,
- 0x012D,
- 0x00EE,
- 0x00EF,
- 0x00EC,
- 0x0133,
- 0x012B,
- 0x221E,
- 0x222B,
- 0x2321,
- 0xF8F5,
- 0x2320,
- 0x2229,
- 0x25D8,
- 0x25D9,
- 0x263B,
- 0x012F,
- 0x03B9,
- 0x03CA,
- 0x0390,
- 0x03AF,
- 0xF6ED,
- 0x0129,
- 0x006A,
- 0x0135,
- 0x006B,
- 0x03BA,
- 0x0137,
- 0x0138,
- 0x006C,
- 0x013A,
- 0x03BB,
- 0x013E,
- 0x013C,
- 0x0140,
- 0x003C,
- 0x2264,
- 0x258C,
- 0x20A4,
- 0xF6C0,
- 0x2227,
- 0x00AC,
- 0x2228,
- 0x017F,
- 0x25CA,
- 0x0142,
- 0xF6EE,
- 0x2591,
- 0x006D,
- 0x00AF,
- 0x02C9,
- 0x2642,
- 0x2212,
- 0x2032,
- 0xF6EF,
- 0x00B5,
- 0x03BC,
- 0x00D7,
- 0x266A,
- 0x266B,
- 0x006E,
- 0x0144,
- 0x0149,
- 0x0148,
- 0x0146,
- 0x0039,
- 0x2089,
- 0xF739,
- 0x2079,
- 0x2209,
- 0x2260,
- 0x2284,
- 0x207F,
- 0x00F1,
- 0x03BD,
- 0x0023,
- 0x006F,
- 0x00F3,
- 0x014F,
- 0x00F4,
- 0x00F6,
- 0x0153,
- 0x02DB,
- 0x00F2,
- 0x01A1,
- 0x0151,
- 0x014D,
- 0x03C9,
- 0x03D6,
- 0x03CE,
- 0x03BF,
- 0x03CC,
- 0x0031,
- 0x2024,
- 0x215B,
- 0xF6DC,
- 0x00BD,
- 0x2081,
- 0xF731,
- 0x00BC,
- 0x00B9,
- 0x2153,
- 0x25E6,
- 0x00AA,
- 0x00BA,
- 0x221F,
- 0x00F8,
- 0x01FF,
- 0xF6F0,
- 0x00F5,
- 0x0070,
- 0x00B6,
- 0x0028,
- 0xF8ED,
- 0xF8EC,
- 0x208D,
- 0x207D,
- 0xF8EB,
- 0x0029,
- 0xF8F8,
- 0xF8F7,
- 0x208E,
- 0x207E,
- 0xF8F6,
- 0x2202,
- 0x0025,
- 0x002E,
- 0x00B7,
- 0x2219,
- 0xF6E7,
- 0xF6E8,
- 0x22A5,
- 0x2030,
- 0x20A7,
- 0x03C6,
- 0x03D5,
- 0x03C0,
- 0x002B,
- 0x00B1,
- 0x211E,
- 0x220F,
- 0x2282,
- 0x2283,
- 0x221D,
- 0x03C8,
- 0x0071,
- 0x003F,
- 0x00BF,
- 0xF7BF,
- 0xF73F,
- 0x0022,
- 0x201E,
- 0x201C,
- 0x201D,
- 0x2018,
- 0x201B,
- 0x2019,
- 0x201A,
- 0x0027,
- 0x0072,
- 0x0155,
- 0x221A,
- 0xF8E5,
- 0x0159,
- 0x0157,
- 0x2286,
- 0x2287,
- 0x00AE,
- 0xF8E8,
- 0xF6DA,
- 0x2310,
- 0x03C1,
- 0x02DA,
- 0xF6F1,
- 0x2590,
- 0xF6DD,
- 0x0073,
- 0x015B,
- 0x0161,
- 0x015F,
- 0xF6C2,
- 0x015D,
- 0x0219,
- 0x2033,
- 0x00A7,
- 0x003B,
- 0x0037,
- 0x215E,
- 0x2087,
- 0xF737,
- 0x2077,
- 0x2592,
- 0x03C3,
- 0x03C2,
- 0x223C,
- 0x0036,
- 0x2086,
- 0xF736,
- 0x2076,
- 0x002F,
- 0x263A,
- 0x0020,
- 0x00A0,
- 0x2660,
- 0xF6F2,
- 0x00A3,
- 0x220B,
- 0x2211,
- 0x263C,
- 0x0074,
- 0x03C4,
- 0x0167,
- 0x0165,
- 0x0163,
- 0x021B,
- 0x2234,
- 0x03B8,
- 0x03D1,
- 0x00FE,
- 0x0033,
- 0x215C,
- 0x2083,
- 0xF733,
- 0x00BE,
- 0xF6DE,
- 0x00B3,
- 0x02DC,
- 0x0303,
- 0x0384,
- 0x2122,
- 0xF8EA,
- 0xF6DB,
- 0x25BC,
- 0x25C4,
- 0x25BA,
- 0x25B2,
- 0xF6F3,
- 0x0032,
- 0x2025,
- 0x2082,
- 0xF732,
- 0x00B2,
- 0x2154,
- 0x0075,
- 0x00FA,
- 0x016D,
- 0x00FB,
- 0x00FC,
- 0x00F9,
- 0x01B0,
- 0x0171,
- 0x016B,
- 0x005F,
- 0x2017,
- 0x222A,
- 0x2200,
- 0x0173,
- 0x2580,
- 0x03C5,
- 0x03CB,
- 0x03B0,
- 0x03CD,
- 0x016F,
- 0x0169,
- 0x0076,
- 0x0077,
- 0x1E83,
- 0x0175,
- 0x1E85,
- 0x2118,
- 0x1E81,
- 0x0078,
- 0x03BE,
- 0x0079,
- 0x00FD,
- 0x0177,
- 0x00FF,
- 0x00A5,
- 0x1EF3,
- 0x007A,
- 0x017A,
- 0x017E,
- 0x017C,
- 0x0030,
- 0x2080,
- 0xF730,
- 0x2070,
- 0x03B6
- };
-
- private static final String names[] =
- {
- "A",
- "AE",
- "AEacute",
- "AEsmall",
- "Aacute",
- "Aacutesmall",
- "Abreve",
- "Acircumflex",
- "Acircumflexsmall",
- "Acute",
- "Acutesmall",
- "Adieresis",
- "Adieresissmall",
- "Agrave",
- "Agravesmall",
- "Alpha",
- "Alphatonos",
- "Amacron",
- "Aogonek",
- "Aring",
- "Aringacute",
- "Aringsmall",
- "Asmall",
- "Atilde",
- "Atildesmall",
- "B",
- "Beta",
- "Brevesmall",
- "Bsmall",
- "C",
- "Cacute",
- "Caron",
- "Caronsmall",
- "Ccaron",
- "Ccedilla",
- "Ccedillasmall",
- "Ccircumflex",
- "Cdotaccent",
- "Cedillasmall",
- "Chi",
- "Circumflexsmall",
- "Csmall",
- "D",
- "Dcaron",
- "Dcroat",
- "Delta",
- "Delta",
- "Dieresis",
- "DieresisAcute",
- "DieresisGrave",
- "Dieresissmall",
- "Dotaccentsmall",
- "Dsmall",
- "E",
- "Eacute",
- "Eacutesmall",
- "Ebreve",
- "Ecaron",
- "Ecircumflex",
- "Ecircumflexsmall",
- "Edieresis",
- "Edieresissmall",
- "Edotaccent",
- "Egrave",
- "Egravesmall",
- "Emacron",
- "Eng",
- "Eogonek",
- "Epsilon",
- "Epsilontonos",
- "Esmall",
- "Eta",
- "Etatonos",
- "Eth",
- "Ethsmall",
- "Euro",
- "F",
- "Fsmall",
- "G",
- "Gamma",
- "Gbreve",
- "Gcaron",
- "Gcircumflex",
- "Gcommaaccent",
- "Gdotaccent",
- "Grave",
- "Gravesmall",
- "Gsmall",
- "H",
- "H18533",
- "H18543",
- "H18551",
- "H22073",
- "Hbar",
- "Hcircumflex",
- "Hsmall",
- "Hungarumlaut",
- "Hungarumlautsmall",
- "I",
- "IJ",
- "Iacute",
- "Iacutesmall",
- "Ibreve",
- "Icircumflex",
- "Icircumflexsmall",
- "Idieresis",
- "Idieresissmall",
- "Idotaccent",
- "Ifraktur",
- "Igrave",
- "Igravesmall",
- "Imacron",
- "Iogonek",
- "Iota",
- "Iotadieresis",
- "Iotatonos",
- "Ismall",
- "Itilde",
- "J",
- "Jcircumflex",
- "Jsmall",
- "K",
- "Kappa",
- "Kcommaaccent",
- "Ksmall",
- "L",
- "LL",
- "Lacute",
- "Lambda",
- "Lcaron",
- "Lcommaaccent",
- "Ldot",
- "Lslash",
- "Lslashsmall",
- "Lsmall",
- "M",
- "Macron",
- "Macronsmall",
- "Msmall",
- "Mu",
- "N",
- "Nacute",
- "Ncaron",
- "Ncommaaccent",
- "Nsmall",
- "Ntilde",
- "Ntildesmall",
- "Nu",
- "O",
- "OE",
- "OEsmall",
- "Oacute",
- "Oacutesmall",
- "Obreve",
- "Ocircumflex",
- "Ocircumflexsmall",
- "Odieresis",
- "Odieresissmall",
- "Ogoneksmall",
- "Ograve",
- "Ogravesmall",
- "Ohorn",
- "Ohungarumlaut",
- "Omacron",
- "Omega",
- "Omega",
- "Omegatonos",
- "Omicron",
- "Omicrontonos",
- "Oslash",
- "Oslashacute",
- "Oslashsmall",
- "Osmall",
- "Otilde",
- "Otildesmall",
- "P",
- "Phi",
- "Pi",
- "Psi",
- "Psmall",
- "Q",
- "Qsmall",
- "R",
- "Racute",
- "Rcaron",
- "Rcommaaccent",
- "Rfraktur",
- "Rho",
- "Ringsmall",
- "Rsmall",
- "S",
- "SF010000",
- "SF020000",
- "SF030000",
- "SF040000",
- "SF050000",
- "SF060000",
- "SF070000",
- "SF080000",
- "SF090000",
- "SF100000",
- "SF110000",
- "SF190000",
- "SF200000",
- "SF210000",
- "SF220000",
- "SF230000",
- "SF240000",
- "SF250000",
- "SF260000",
- "SF270000",
- "SF280000",
- "SF360000",
- "SF370000",
- "SF380000",
- "SF390000",
- "SF400000",
- "SF410000",
- "SF420000",
- "SF430000",
- "SF440000",
- "SF450000",
- "SF460000",
- "SF470000",
- "SF480000",
- "SF490000",
- "SF500000",
- "SF510000",
- "SF520000",
- "SF530000",
- "SF540000",
- "Sacute",
- "Scaron",
- "Scaronsmall",
- "Scedilla",
- "Scedilla",
- "Scircumflex",
- "Scommaaccent",
- "Sigma",
- "Ssmall",
- "T",
- "Tau",
- "Tbar",
- "Tcaron",
- "Tcommaaccent",
- "Tcommaaccent",
- "Theta",
- "Thorn",
- "Thornsmall",
- "Tildesmall",
- "Tsmall",
- "U",
- "Uacute",
- "Uacutesmall",
- "Ubreve",
- "Ucircumflex",
- "Ucircumflexsmall",
- "Udieresis",
- "Udieresissmall",
- "Ugrave",
- "Ugravesmall",
- "Uhorn",
- "Uhungarumlaut",
- "Umacron",
- "Uogonek",
- "Upsilon",
- "Upsilon1",
- "Upsilondieresis",
- "Upsilontonos",
- "Uring",
- "Usmall",
- "Utilde",
- "V",
- "Vsmall",
- "W",
- "Wacute",
- "Wcircumflex",
- "Wdieresis",
- "Wgrave",
- "Wsmall",
- "X",
- "Xi",
- "Xsmall",
- "Y",
- "Yacute",
- "Yacutesmall",
- "Ycircumflex",
- "Ydieresis",
- "Ydieresissmall",
- "Ygrave",
- "Ysmall",
- "Z",
- "Zacute",
- "Zcaron",
- "Zcaronsmall",
- "Zdotaccent",
- "Zeta",
- "Zsmall",
- "a",
- "aacute",
- "abreve",
- "acircumflex",
- "acute",
- "acutecomb",
- "adieresis",
- "ae",
- "aeacute",
- "afii00208",
- "afii10017",
- "afii10018",
- "afii10019",
- "afii10020",
- "afii10021",
- "afii10022",
- "afii10023",
- "afii10024",
- "afii10025",
- "afii10026",
- "afii10027",
- "afii10028",
- "afii10029",
- "afii10030",
- "afii10031",
- "afii10032",
- "afii10033",
- "afii10034",
- "afii10035",
- "afii10036",
- "afii10037",
- "afii10038",
- "afii10039",
- "afii10040",
- "afii10041",
- "afii10042",
- "afii10043",
- "afii10044",
- "afii10045",
- "afii10046",
- "afii10047",
- "afii10048",
- "afii10049",
- "afii10050",
- "afii10051",
- "afii10052",
- "afii10053",
- "afii10054",
- "afii10055",
- "afii10056",
- "afii10057",
- "afii10058",
- "afii10059",
- "afii10060",
- "afii10061",
- "afii10062",
- "afii10063",
- "afii10064",
- "afii10065",
- "afii10066",
- "afii10067",
- "afii10068",
- "afii10069",
- "afii10070",
- "afii10071",
- "afii10072",
- "afii10073",
- "afii10074",
- "afii10075",
- "afii10076",
- "afii10077",
- "afii10078",
- "afii10079",
- "afii10080",
- "afii10081",
- "afii10082",
- "afii10083",
- "afii10084",
- "afii10085",
- "afii10086",
- "afii10087",
- "afii10088",
- "afii10089",
- "afii10090",
- "afii10091",
- "afii10092",
- "afii10093",
- "afii10094",
- "afii10095",
- "afii10096",
- "afii10097",
- "afii10098",
- "afii10099",
- "afii10100",
- "afii10101",
- "afii10102",
- "afii10103",
- "afii10104",
- "afii10105",
- "afii10106",
- "afii10107",
- "afii10108",
- "afii10109",
- "afii10110",
- "afii10145",
- "afii10146",
- "afii10147",
- "afii10148",
- "afii10192",
- "afii10193",
- "afii10194",
- "afii10195",
- "afii10196",
- "afii10831",
- "afii10832",
- "afii10846",
- "afii299",
- "afii300",
- "afii301",
- "afii57381",
- "afii57388",
- "afii57392",
- "afii57393",
- "afii57394",
- "afii57395",
- "afii57396",
- "afii57397",
- "afii57398",
- "afii57399",
- "afii57400",
- "afii57401",
- "afii57403",
- "afii57407",
- "afii57409",
- "afii57410",
- "afii57411",
- "afii57412",
- "afii57413",
- "afii57414",
- "afii57415",
- "afii57416",
- "afii57417",
- "afii57418",
- "afii57419",
- "afii57420",
- "afii57421",
- "afii57422",
- "afii57423",
- "afii57424",
- "afii57425",
- "afii57426",
- "afii57427",
- "afii57428",
- "afii57429",
- "afii57430",
- "afii57431",
- "afii57432",
- "afii57433",
- "afii57434",
- "afii57440",
- "afii57441",
- "afii57442",
- "afii57443",
- "afii57444",
- "afii57445",
- "afii57446",
- "afii57448",
- "afii57449",
- "afii57450",
- "afii57451",
- "afii57452",
- "afii57453",
- "afii57454",
- "afii57455",
- "afii57456",
- "afii57457",
- "afii57458",
- "afii57470",
- "afii57505",
- "afii57506",
- "afii57507",
- "afii57508",
- "afii57509",
- "afii57511",
- "afii57512",
- "afii57513",
- "afii57514",
- "afii57519",
- "afii57534",
- "afii57636",
- "afii57645",
- "afii57658",
- "afii57664",
- "afii57665",
- "afii57666",
- "afii57667",
- "afii57668",
- "afii57669",
- "afii57670",
- "afii57671",
- "afii57672",
- "afii57673",
- "afii57674",
- "afii57675",
- "afii57676",
- "afii57677",
- "afii57678",
- "afii57679",
- "afii57680",
- "afii57681",
- "afii57682",
- "afii57683",
- "afii57684",
- "afii57685",
- "afii57686",
- "afii57687",
- "afii57688",
- "afii57689",
- "afii57690",
- "afii57694",
- "afii57695",
- "afii57700",
- "afii57705",
- "afii57716",
- "afii57717",
- "afii57718",
- "afii57723",
- "afii57793",
- "afii57794",
- "afii57795",
- "afii57796",
- "afii57797",
- "afii57798",
- "afii57799",
- "afii57800",
- "afii57801",
- "afii57802",
- "afii57803",
- "afii57804",
- "afii57806",
- "afii57807",
- "afii57839",
- "afii57841",
- "afii57842",
- "afii57929",
- "afii61248",
- "afii61289",
- "afii61352",
- "afii61573",
- "afii61574",
- "afii61575",
- "afii61664",
- "afii63167",
- "afii64937",
- "agrave",
- "aleph",
- "alpha",
- "alphatonos",
- "amacron",
- "ampersand",
- "ampersandsmall",
- "angle",
- "angleleft",
- "angleright",
- "anoteleia",
- "aogonek",
- "approxequal",
- "aring",
- "aringacute",
- "arrowboth",
- "arrowdblboth",
- "arrowdbldown",
- "arrowdblleft",
- "arrowdblright",
- "arrowdblup",
- "arrowdown",
- "arrowhorizex",
- "arrowleft",
- "arrowright",
- "arrowup",
- "arrowupdn",
- "arrowupdnbse",
- "arrowvertex",
- "asciicircum",
- "asciitilde",
- "asterisk",
- "asteriskmath",
- "asuperior",
- "at",
- "atilde",
- "b",
- "backslash",
- "bar",
- "beta",
- "block",
- "braceex",
- "braceleft",
- "braceleftbt",
- "braceleftmid",
- "bracelefttp",
- "braceright",
- "bracerightbt",
- "bracerightmid",
- "bracerighttp",
- "bracketleft",
- "bracketleftbt",
- "bracketleftex",
- "bracketlefttp",
- "bracketright",
- "bracketrightbt",
- "bracketrightex",
- "bracketrighttp",
- "breve",
- "brokenbar",
- "bsuperior",
- "bullet",
- "c",
- "cacute",
- "caron",
- "carriagereturn",
- "ccaron",
- "ccedilla",
- "ccircumflex",
- "cdotaccent",
- "cedilla",
- "cent",
- "centinferior",
- "centoldstyle",
- "centsuperior",
- "chi",
- "circle",
- "circlemultiply",
- "circleplus",
- "circumflex",
- "club",
- "colon",
- "colonmonetary",
- "comma",
- "commaaccent",
- "commainferior",
- "commasuperior",
- "congruent",
- "copyright",
- "copyrightsans",
- "copyrightserif",
- "currency",
- "cyrBreve",
- "cyrFlex",
- "cyrbreve",
- "cyrflex",
- "d",
- "dagger",
- "daggerdbl",
- "dblGrave",
- "dblgrave",
- "dcaron",
- "dcroat",
- "degree",
- "delta",
- "diamond",
- "dieresis",
- "dieresisacute",
- "dieresisgrave",
- "dieresistonos",
- "divide",
- "dkshade",
- "dnblock",
- "dollar",
- "dollarinferior",
- "dollaroldstyle",
- "dollarsuperior",
- "dong",
- "dotaccent",
- "dotbelowcomb",
- "dotlessi",
- "dotlessj",
- "dotmath",
- "dsuperior",
- "e",
- "eacute",
- "ebreve",
- "ecaron",
- "ecircumflex",
- "edieresis",
- "edotaccent",
- "egrave",
- "eight",
- "eightinferior",
- "eightoldstyle",
- "eightsuperior",
- "element",
- "ellipsis",
- "emacron",
- "emdash",
- "emptyset",
- "endash",
- "eng",
- "eogonek",
- "epsilon",
- "epsilontonos",
- "equal",
- "equivalence",
- "estimated",
- "esuperior",
- "eta",
- "etatonos",
- "eth",
- "exclam",
- "exclamdbl",
- "exclamdown",
- "exclamdownsmall",
- "exclamsmall",
- "existential",
- "f",
- "female",
- "ff",
- "ffi",
- "ffl",
- "fi",
- "figuredash",
- "filledbox",
- "filledrect",
- "five",
- "fiveeighths",
- "fiveinferior",
- "fiveoldstyle",
- "fivesuperior",
- "fl",
- "florin",
- "four",
- "fourinferior",
- "fouroldstyle",
- "foursuperior",
- "fraction",
- "fraction",
- "franc",
- "g",
- "gamma",
- "gbreve",
- "gcaron",
- "gcircumflex",
- "gcommaaccent",
- "gdotaccent",
- "germandbls",
- "gradient",
- "grave",
- "gravecomb",
- "greater",
- "greaterequal",
- "guillemotleft",
- "guillemotright",
- "guilsinglleft",
- "guilsinglright",
- "h",
- "hbar",
- "hcircumflex",
- "heart",
- "hookabovecomb",
- "house",
- "hungarumlaut",
- "hyphen",
- "hyphen",
- "hypheninferior",
- "hyphensuperior",
- "i",
- "iacute",
- "ibreve",
- "icircumflex",
- "idieresis",
- "igrave",
- "ij",
- "imacron",
- "infinity",
- "integral",
- "integralbt",
- "integralex",
- "integraltp",
- "intersection",
- "invbullet",
- "invcircle",
- "invsmileface",
- "iogonek",
- "iota",
- "iotadieresis",
- "iotadieresistonos",
- "iotatonos",
- "isuperior",
- "itilde",
- "j",
- "jcircumflex",
- "k",
- "kappa",
- "kcommaaccent",
- "kgreenlandic",
- "l",
- "lacute",
- "lambda",
- "lcaron",
- "lcommaaccent",
- "ldot",
- "less",
- "lessequal",
- "lfblock",
- "lira",
- "ll",
- "logicaland",
- "logicalnot",
- "logicalor",
- "longs",
- "lozenge",
- "lslash",
- "lsuperior",
- "ltshade",
- "m",
- "macron",
- "macron",
- "male",
- "minus",
- "minute",
- "msuperior",
- "mu",
- "mu",
- "multiply",
- "musicalnote",
- "musicalnotedbl",
- "n",
- "nacute",
- "napostrophe",
- "ncaron",
- "ncommaaccent",
- "nine",
- "nineinferior",
- "nineoldstyle",
- "ninesuperior",
- "notelement",
- "notequal",
- "notsubset",
- "nsuperior",
- "ntilde",
- "nu",
- "numbersign",
- "o",
- "oacute",
- "obreve",
- "ocircumflex",
- "odieresis",
- "oe",
- "ogonek",
- "ograve",
- "ohorn",
- "ohungarumlaut",
- "omacron",
- "omega",
- "omega1",
- "omegatonos",
- "omicron",
- "omicrontonos",
- "one",
- "onedotenleader",
- "oneeighth",
- "onefitted",
- "onehalf",
- "oneinferior",
- "oneoldstyle",
- "onequarter",
- "onesuperior",
- "onethird",
- "openbullet",
- "ordfeminine",
- "ordmasculine",
- "orthogonal",
- "oslash",
- "oslashacute",
- "osuperior",
- "otilde",
- "p",
- "paragraph",
- "parenleft",
- "parenleftbt",
- "parenleftex",
- "parenleftinferior",
- "parenleftsuperior",
- "parenlefttp",
- "parenright",
- "parenrightbt",
- "parenrightex",
- "parenrightinferior",
- "parenrightsuperior",
- "parenrighttp",
- "partialdiff",
- "percent",
- "period",
- "periodcentered",
- "periodcentered",
- "periodinferior",
- "periodsuperior",
- "perpendicular",
- "perthousand",
- "peseta",
- "phi",
- "phi1",
- "pi",
- "plus",
- "plusminus",
- "prescription",
- "product",
- "propersubset",
- "propersuperset",
- "proportional",
- "psi",
- "q",
- "question",
- "questiondown",
- "questiondownsmall",
- "questionsmall",
- "quotedbl",
- "quotedblbase",
- "quotedblleft",
- "quotedblright",
- "quoteleft",
- "quotereversed",
- "quoteright",
- "quotesinglbase",
- "quotesingle",
- "r",
- "racute",
- "radical",
- "radicalex",
- "rcaron",
- "rcommaaccent",
- "reflexsubset",
- "reflexsuperset",
- "registered",
- "registersans",
- "registerserif",
- "revlogicalnot",
- "rho",
- "ring",
- "rsuperior",
- "rtblock",
- "rupiah",
- "s",
- "sacute",
- "scaron",
- "scedilla",
- "scedilla",
- "scircumflex",
- "scommaaccent",
- "second",
- "section",
- "semicolon",
- "seven",
- "seveneighths",
- "seveninferior",
- "sevenoldstyle",
- "sevensuperior",
- "shade",
- "sigma",
- "sigma1",
- "similar",
- "six",
- "sixinferior",
- "sixoldstyle",
- "sixsuperior",
- "slash",
- "smileface",
- "space",
- "space",
- "spade",
- "ssuperior",
- "sterling",
- "suchthat",
- "summation",
- "sun",
- "t",
- "tau",
- "tbar",
- "tcaron",
- "tcommaaccent",
- "tcommaaccent",
- "therefore",
- "theta",
- "theta1",
- "thorn",
- "three",
- "threeeighths",
- "threeinferior",
- "threeoldstyle",
- "threequarters",
- "threequartersemdash",
- "threesuperior",
- "tilde",
- "tildecomb",
- "tonos",
- "trademark",
- "trademarksans",
- "trademarkserif",
- "triagdn",
- "triaglf",
- "triagrt",
- "triagup",
- "tsuperior",
- "two",
- "twodotenleader",
- "twoinferior",
- "twooldstyle",
- "twosuperior",
- "twothirds",
- "u",
- "uacute",
- "ubreve",
- "ucircumflex",
- "udieresis",
- "ugrave",
- "uhorn",
- "uhungarumlaut",
- "umacron",
- "underscore",
- "underscoredbl",
- "union",
- "universal",
- "uogonek",
- "upblock",
- "upsilon",
- "upsilondieresis",
- "upsilondieresistonos",
- "upsilontonos",
- "uring",
- "utilde",
- "v",
- "w",
- "wacute",
- "wcircumflex",
- "wdieresis",
- "weierstrass",
- "wgrave",
- "x",
- "xi",
- "y",
- "yacute",
- "ycircumflex",
- "ydieresis",
- "yen",
- "ygrave",
- "z",
- "zacute",
- "zcaron",
- "zdotaccent",
- "zero",
- "zeroinferior",
- "zerooldstyle",
- "zerosuperior",
- "zeta"
- };
-
- static
- {
- for (int k = 0; k < unicode.length; ++k)
- {
- Integer num = new Integer(unicode[k]);
- unicode2names.put(num, names[k]);
- int code[] = (int[])names2unicode.get(names[k]);
- if (code == null)
- {
- names2unicode.put(names[k], new int[]{unicode[k]});
- }
- else
- {
- int code2[] = new int[code.length + 1];
- System.arraycopy(code, 0, code2, 0, code.length);
- code2[code.length] = unicode[k];
- names2unicode.put(names[k], code2);
- }
- }
- }
-
- public static int[] nameToUnicode(String name)
- {
- return (int[])names2unicode.get(name);
- }
-
- public static String unicodeToName(int num)
- {
- return (String)unicode2names.get(new Integer(num));
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/GrayColor.java b/LibrarySource/com/lowagie/text/pdf/GrayColor.java
deleted file mode 100644
index d94493d..0000000
--- a/LibrarySource/com/lowagie/text/pdf/GrayColor.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * $Id: GrayColor.java,v 1.10 2002/06/18 13:59:40 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/**
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class GrayColor extends ExtendedColor {
-
- float gray;
-
- public GrayColor(int intGray) {
- this((float)intGray / 255f);
- }
-
- public GrayColor(float floatGray) {
- super(TYPE_GRAY, floatGray, floatGray, floatGray);
- gray = normalize(floatGray);
- }
-
- public float getGray() {
- return gray;
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/HyphenationAuto.java b/LibrarySource/com/lowagie/text/pdf/HyphenationAuto.java
deleted file mode 100644
index 7b4507e..0000000
--- a/LibrarySource/com/lowagie/text/pdf/HyphenationAuto.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.pdf.hyphenation.Hyphenator;
-import com.lowagie.text.pdf.hyphenation.Hyphenation;
-
-/** Hyphenates words automatically accordingly to the language and country.
- * The hyphenator engine was taken from FOP and uses the TEX patterns. If a language
- * is not provided and a TEX pattern for it exists, it can be easily adapted.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class HyphenationAuto implements HyphenationEvent {
-
- /** The hyphenator engine.
- */
- protected Hyphenator hyphenator;
- /** The second part of the hyphenated word.
- */
- protected String post;
-
- /** Creates a new hyphenation instance usable in <CODE>Chunk</CODE>.
- * @param lang the language ("en" for english, for example)
- * @param country the country ("GB" for Great-Britain or "none" for no country, for example)
- * @param leftMin the minimun number of letters before the hyphen
- * @param rightMin the minimun number of letters after the hyphen
- */
- public HyphenationAuto(String lang, String country, int leftMin, int rightMin) {
- hyphenator = new Hyphenator(lang, country, leftMin, rightMin);
- }
-
- /** Gets the hyphen symbol.
- * @return the hyphen symbol
- */
- public String getHyphenSymbol() {
- return "-";
- }
-
- /** Hyphenates a word and returns the first part of it. To get
- * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
- * @param word the word to hyphenate
- * @param font the font used by this word
- * @param fontSize the font size used by this word
- * @param remainingWidth the width available to fit this word in
- * @return the first part of the hyphenated word including
- * the hyphen symbol, if any
- */
- public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
- post = word;
- String hyphen = getHyphenSymbol();
- float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
- if (hyphenWidth > remainingWidth)
- return "";
- Hyphenation hyphenation = hyphenator.hyphenate(word);
- if (hyphenation == null) {
- return "";
- }
- int len = hyphenation.length();
- int k;
- for (k = 0; k < len; ++k) {
- if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
- break;
- }
- --k;
- if (k < 0)
- return "";
- post = hyphenation.getPostHyphenText(k);
- return hyphenation.getPreHyphenText(k) + hyphen;
- }
-
- /** Gets the second part of the hyphenated word. Must be called
- * after <CODE>getHyphenatedWordPre()</CODE>.
- * @return the second part of the hyphenated word
- */
- public String getHyphenatedWordPost() {
- return post;
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/HyphenationEvent.java b/LibrarySource/com/lowagie/text/pdf/HyphenationEvent.java
deleted file mode 100644
index 68bf40d..0000000
--- a/LibrarySource/com/lowagie/text/pdf/HyphenationEvent.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/** Called by <code>Chunk</code> to hyphenate a word.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public interface HyphenationEvent {
-
- /** Gets the hyphen symbol.
- * @return the hyphen symbol
- */
- public String getHyphenSymbol();
-
- /** Hyphenates a word and returns the first part of it. To get
- * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
- * @param word the word to hyphenate
- * @param font the font used by this word
- * @param fontSize the font size used by this word
- * @param remainingWidth the width available to fit this word in
- * @return the first part of the hyphenated word including
- * the hyphen symbol, if any
- */
- public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth);
-
- /** Gets the second part of the hyphenated word. Must be called
- * after <CODE>getHyphenatedWordPre()</CODE>.
- * @return the second part of the hyphenated word
- */
- public String getHyphenatedWordPost();
-}
-
-
diff --git a/LibrarySource/com/lowagie/text/pdf/IntHashtable.java b/LibrarySource/com/lowagie/text/pdf/IntHashtable.java
deleted file mode 100644
index 66d720a..0000000
--- a/LibrarySource/com/lowagie/text/pdf/IntHashtable.java
+++ /dev/null
@@ -1,339 +0,0 @@
-// IntHashtable - a Hashtable that uses ints as the keys
-//
-// This is 90% based on JavaSoft's java.util.Hashtable.
-//
-// Visit the ACME Labs Java page for up-to-date versions of this and other
-// fine Java utilities: http://www.acme.com/java/
-
-package com.lowagie.text.pdf;
-
-import java.util.Arrays;
-import java.util.NoSuchElementException;
-import java.util.Iterator;
-
-/// A Hashtable that uses ints as the keys.
-// <P>
-// Use just like java.util.Hashtable, except that the keys must be ints.
-// This is much faster than creating a new Integer for each access.
-// <P>
-// <A HREF="/resources/classes/Acme/IntHashtable.java">Fetch the software.</A><BR>
-// <A HREF="/resources/classes/Acme.tar.gz">Fetch the entire Acme package.</A>
-// <P>
-// @see java.util.Hashtable
-
-public class IntHashtable implements Cloneable {
- /// The hash table data.
- private IntHashtableEntry table[];
-
- /// The total number of entries in the hash table.
- private int count;
-
- /// Rehashes the table when count exceeds this threshold.
- private int threshold;
-
- /// The load factor for the hashtable.
- private float loadFactor;
-
- /// Constructs a new, empty hashtable with the specified initial
- // capacity and the specified load factor.
- // @param initialCapacity the initial number of buckets
- // @param loadFactor a number between 0.0 and 1.0, it defines
- // the threshold for rehashing the hashtable into
- // a bigger one.
- // @exception IllegalArgumentException If the initial capacity
- // is less than or equal to zero.
- // @exception IllegalArgumentException If the load factor is
- // less than or equal to zero.
- public IntHashtable( int initialCapacity, float loadFactor ) {
- if ( initialCapacity <= 0 || loadFactor <= 0.0 )
- throw new IllegalArgumentException();
- this.loadFactor = loadFactor;
- table = new IntHashtableEntry[initialCapacity];
- threshold = (int) ( initialCapacity * loadFactor );
- }
-
- /// Constructs a new, empty hashtable with the specified initial
- // capacity.
- // @param initialCapacity the initial number of buckets
- public IntHashtable( int initialCapacity ) {
- this( initialCapacity, 0.75f );
- }
-
- /// Constructs a new, empty hashtable. A default capacity and load factor
- // is used. Note that the hashtable will automatically grow when it gets
- // full.
- public IntHashtable() {
- this( 101, 0.75f );
- }
-
- /// Returns the number of elements contained in the hashtable.
- public int size() {
- return count;
- }
-
- /// Returns true if the hashtable contains no elements.
- public boolean isEmpty() {
- return count == 0;
- }
-
- /// Returns true if the specified object is an element of the hashtable.
- // This operation is more expensive than the containsKey() method.
- // @param value the value that we are looking for
- // @exception NullPointerException If the value being searched
- // for is equal to null.
- // @see IntHashtable#containsKey
- public boolean contains( int value ) {
- IntHashtableEntry tab[] = table;
- for ( int i = tab.length ; i-- > 0 ; ) {
- for ( IntHashtableEntry e = tab[i] ; e != null ; e = e.next ) {
- if ( e.value == value )
- return true;
- }
- }
- return false;
- }
-
- /// Returns true if the collection contains an element for the key.
- // @param key the key that we are looking for
- // @see IntHashtable#contains
- public boolean containsKey( int key ) {
- IntHashtableEntry tab[] = table;
- int hash = key;
- int index = ( hash & 0x7FFFFFFF ) % tab.length;
- for ( IntHashtableEntry e = tab[index] ; e != null ; e = e.next ) {
- if ( e.hash == hash && e.key == key )
- return true;
- }
- return false;
- }
-
- /// Gets the object associated with the specified key in the
- // hashtable.
- // @param key the specified key
- // @returns the element for the key or null if the key
- // is not defined in the hash table.
- // @see IntHashtable#put
- public int get( int key ) {
- IntHashtableEntry tab[] = table;
- int hash = key;
- int index = ( hash & 0x7FFFFFFF ) % tab.length;
- for ( IntHashtableEntry e = tab[index] ; e != null ; e = e.next ) {
- if ( e.hash == hash && e.key == key )
- return e.value;
- }
- return 0;
- }
-
- /// Rehashes the content of the table into a bigger table.
- // This method is called automatically when the hashtable's
- // size exceeds the threshold.
- protected void rehash() {
- int oldCapacity = table.length;
- IntHashtableEntry oldTable[] = table;
-
- int newCapacity = oldCapacity * 2 + 1;
- IntHashtableEntry newTable[] = new IntHashtableEntry[newCapacity];
-
- threshold = (int) ( newCapacity * loadFactor );
- table = newTable;
-
- for ( int i = oldCapacity ; i-- > 0 ; ) {
- for ( IntHashtableEntry old = oldTable[i] ; old != null ; ) {
- IntHashtableEntry e = old;
- old = old.next;
-
- int index = ( e.hash & 0x7FFFFFFF ) % newCapacity;
- e.next = newTable[index];
- newTable[index] = e;
- }
- }
- }
-
- /// Puts the specified element into the hashtable, using the specified
- // key. The element may be retrieved by doing a get() with the same key.
- // The key and the element cannot be null.
- // @param key the specified key in the hashtable
- // @param value the specified element
- // @exception NullPointerException If the value of the element
- // is equal to null.
- // @see IntHashtable#get
- // @return the old value of the key, or null if it did not have one.
- public int put( int key, int value ) {
- // Makes sure the key is not already in the hashtable.
- IntHashtableEntry tab[] = table;
- int hash = key;
- int index = ( hash & 0x7FFFFFFF ) % tab.length;
- for ( IntHashtableEntry e = tab[index] ; e != null ; e = e.next ) {
- if ( e.hash == hash && e.key == key ) {
- int old = e.value;
- e.value = value;
- return old;
- }
- }
-
- if ( count >= threshold ) {
- // Rehash the table if the threshold is exceeded.
- rehash();
- return put( key, value );
- }
-
- // Creates the new entry.
- IntHashtableEntry e = new IntHashtableEntry();
- e.hash = hash;
- e.key = key;
- e.value = value;
- e.next = tab[index];
- tab[index] = e;
- ++count;
- return 0;
- }
-
- /// Removes the element corresponding to the key. Does nothing if the
- // key is not present.
- // @param key the key that needs to be removed
- // @return the value of key, or null if the key was not found.
- public int remove( int key ) {
- IntHashtableEntry tab[] = table;
- int hash = key;
- int index = ( hash & 0x7FFFFFFF ) % tab.length;
- for ( IntHashtableEntry e = tab[index], prev = null ; e != null ; prev = e, e = e.next ) {
- if ( e.hash == hash && e.key == key ) {
- if ( prev != null )
- prev.next = e.next;
- else
- tab[index] = e.next;
- --count;
- return e.value;
- }
- }
- return 0;
- }
-
- /// Clears the hash table so that it has no more elements in it.
- public void clear() {
- IntHashtableEntry tab[] = table;
- for ( int index = tab.length; --index >= 0; )
- tab[index] = null;
- count = 0;
- }
-
- public Object clone() {
- try {
- IntHashtable t = (IntHashtable)super.clone();
- t.table = new IntHashtableEntry[table.length];
- for (int i = table.length ; i-- > 0 ; ) {
- t.table[i] = (table[i] != null)
- ? (IntHashtableEntry)table[i].clone() : null;
- }
- return t;
- } catch (CloneNotSupportedException e) {
- // this shouldn't happen, since we are Cloneable
- throw new InternalError();
- }
- }
-
- public int[] toOrderedKeys() {
- int res[] = getKeys();
- Arrays.sort(res);
- return res;
- }
-
- public int[] getKeys() {
- int res[] = new int[count];
- int ptr = 0;
- int index = table.length;
- IntHashtableEntry entry = null;
- while (true) {
- if (entry == null)
- while ((index-- > 0) && ((entry = table[index]) == null));
- if (entry == null)
- break;
- IntHashtableEntry e = entry;
- entry = e.next;
- res[ptr++] = e.key;
- }
- return res;
- }
-
- public int getOneKey() {
- if (count == 0)
- return 0;
- int index = table.length;
- IntHashtableEntry entry = null;
- while ((index-- > 0) && ((entry = table[index]) == null));
- if (entry == null)
- return 0;
- return entry.key;
- }
-
- static class IntHashtableEntry {
- int hash;
- int key;
- int value;
- IntHashtableEntry next;
-
- public int getKey() {
- return key;
- }
-
- public int getValue() {
- return value;
- }
-
- protected Object clone() {
- IntHashtableEntry entry = new IntHashtableEntry();
- entry.hash = hash;
- entry.key = key;
- entry.value = value;
- entry.next = (next != null) ? (IntHashtableEntry)next.clone() : null;
- return entry;
- }
- }
-
- public Iterator getEntryIterator() {
- return new IntHashtableIterator(table);
- }
-
- static class IntHashtableIterator implements Iterator {
- // boolean keys;
- int index;
- IntHashtableEntry table[];
- IntHashtableEntry entry;
-
- IntHashtableIterator(IntHashtableEntry table[] /* , boolean keys */) {
- this.table = table;
- // this.keys = keys;
- this.index = table.length;
- }
-
- public boolean hasNext() {
- if (entry != null) {
- return true;
- }
- while (index-- > 0) {
- if ((entry = table[index]) != null) {
- return true;
- }
- }
- return false;
- }
-
- public Object next() {
- if (entry == null) {
- while ((index-- > 0) && ((entry = table[index]) == null));
- }
- if (entry != null) {
- IntHashtableEntry e = entry;
- entry = e.next;
- return entry;
- }
- throw new NoSuchElementException("IntHashtableIterator");
- }
-
- public void remove() {
- throw new UnsupportedOperationException("remove() not supported.");
- }
-
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/LZWDecoder.java b/LibrarySource/com/lowagie/text/pdf/LZWDecoder.java
deleted file mode 100644
index aaffad3..0000000
--- a/LibrarySource/com/lowagie/text/pdf/LZWDecoder.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (c) 2001 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * -Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * -Redistribution in binary form must reproduct the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
- * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
- * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
- * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
- * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
- * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
- * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
- * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
- * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that Software is not designed,licensed or intended for use in
- * the design, construction, operation or maintenance of any nuclear facility.
- *
- * Adapted from the JAI codecs TIFFLZWDecoder.
- */
-package com.lowagie.text.pdf;
-import java.io.OutputStream;
-import java.io.IOException;
-import com.lowagie.text.ExceptionConverter;
-/**
- * A class for performing LZW decoding.
- *
- *
- */
-public class LZWDecoder {
-
- byte stringTable[][];
- byte data[] = null;
- OutputStream uncompData;
- int tableIndex, bitsToGet = 9;
- int bytePointer, bitPointer;
- int nextData = 0;
- int nextBits = 0;
-
- int andTable[] = {
- 511,
- 1023,
- 2047,
- 4095
- };
-
- public LZWDecoder() {
- }
-
- /**
- * Method to decode LZW compressed data.
- *
- * @param data The compressed data.
- * @param uncompData Array to return the uncompressed data in.
- */
- public void decode(byte data[], OutputStream uncompData) {
-
- if(data[0] == (byte)0x00 && data[1] == (byte)0x01) {
- throw new RuntimeException("LZW flavour not supported.");
- }
-
- initializeStringTable();
-
- this.data = data;
- this.uncompData = uncompData;
-
- // Initialize pointers
- bytePointer = 0;
- bitPointer = 0;
-
- nextData = 0;
- nextBits = 0;
-
- int code, oldCode = 0;
- byte string[];
-
- while ((code = getNextCode()) != 257) {
-
- if (code == 256) {
-
- initializeStringTable();
- code = getNextCode();
-
- if (code == 257) {
- break;
- }
-
- writeString(stringTable[code]);
- oldCode = code;
-
- } else {
-
- if (code < tableIndex) {
-
- string = stringTable[code];
-
- writeString(string);
- addStringToTable(stringTable[oldCode], string[0]);
- oldCode = code;
-
- } else {
-
- string = stringTable[oldCode];
- string = composeString(string, string[0]);
- writeString(string);
- addStringToTable(string);
- oldCode = code;
- }
- }
- }
- }
-
-
- /**
- * Initialize the string table.
- */
- public void initializeStringTable() {
-
- stringTable = new byte[8192][];
-
- for (int i=0; i<256; i++) {
- stringTable[i] = new byte[1];
- stringTable[i][0] = (byte)i;
- }
-
- tableIndex = 258;
- bitsToGet = 9;
- }
-
- /**
- * Write out the string just uncompressed.
- */
- public void writeString(byte string[]) {
- try {
- uncompData.write(string);
- }
- catch (IOException e) {
- throw new ExceptionConverter(e);
- }
- }
-
- /**
- * Add a new string to the string table.
- */
- public void addStringToTable(byte oldString[], byte newString) {
- int length = oldString.length;
- byte string[] = new byte[length + 1];
- System.arraycopy(oldString, 0, string, 0, length);
- string[length] = newString;
-
- // Add this new String to the table
- stringTable[tableIndex++] = string;
-
- if (tableIndex == 511) {
- bitsToGet = 10;
- } else if (tableIndex == 1023) {
- bitsToGet = 11;
- } else if (tableIndex == 2047) {
- bitsToGet = 12;
- }
- }
-
- /**
- * Add a new string to the string table.
- */
- public void addStringToTable(byte string[]) {
-
- // Add this new String to the table
- stringTable[tableIndex++] = string;
-
- if (tableIndex == 511) {
- bitsToGet = 10;
- } else if (tableIndex == 1023) {
- bitsToGet = 11;
- } else if (tableIndex == 2047) {
- bitsToGet = 12;
- }
- }
-
- /**
- * Append <code>newString</code> to the end of <code>oldString</code>.
- */
- public byte[] composeString(byte oldString[], byte newString) {
- int length = oldString.length;
- byte string[] = new byte[length + 1];
- System.arraycopy(oldString, 0, string, 0, length);
- string[length] = newString;
-
- return string;
- }
-
- // Returns the next 9, 10, 11 or 12 bits
- public int getNextCode() {
- // Attempt to get the next code. The exception is caught to make
- // this robust to cases wherein the EndOfInformation code has been
- // omitted from a strip. Examples of such cases have been observed
- // in practice.
- try {
- nextData = (nextData << 8) | (data[bytePointer++] & 0xff);
- nextBits += 8;
-
- if (nextBits < bitsToGet) {
- nextData = (nextData << 8) | (data[bytePointer++] & 0xff);
- nextBits += 8;
- }
-
- int code =
- (nextData >> (nextBits - bitsToGet)) & andTable[bitsToGet-9];
- nextBits -= bitsToGet;
-
- return code;
- } catch(ArrayIndexOutOfBoundsException e) {
- // Strip not terminated as expected: return EndOfInformation code.
- return 257;
- }
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/MultiColumnText.java b/LibrarySource/com/lowagie/text/pdf/MultiColumnText.java
deleted file mode 100644
index 6b3c38b..0000000
--- a/LibrarySource/com/lowagie/text/pdf/MultiColumnText.java
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * $Id: MultiColumnText.java,v 1.12 2005/04/06 08:54:17 blowagie Exp $
- * $Name: $
- *
- * Copyright 2004 Steve Appling
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999-2005 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000-2005 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.*;
-
-import java.util.ArrayList;
-
-/**
- * Formats content into one or more columns bounded by a
- * rectangle. The columns may be simple rectangles or
- * more complicated shapes. Add all of the columns before
- * adding content. Column continuation is supported. A MultiColumnText object may be added to
- * a document using <CODE>Document.add</CODE>.
- * @author Steve Appling
- */
-public class MultiColumnText implements Element {
-
- /** special constant for automatic calculation of height */
- public static final float AUTOMATIC = -1f;
-
- /**
- * total desiredHeight of columns. If <CODE>AUTOMATIC</CODE>, this means fill pages until done.
- * This may be larger than one page
- */
- private float desiredHeight;
-
- /**
- * total height of element written out so far
- */
- private float totalHeight;
-
- /**
- * true if all the text could not be written out due to height restriction
- */
- private boolean overflow;
-
- /**
- * Top of the columns - y position on starting page.
- * If <CODE>AUTOMATIC</CODE>, it means current y position when added to document
- */
- private float top;
-
- /**
- * used to store the y position of the bottom of the page
- */
- private float pageBottom;
-
- /**
- * ColumnText object used to do all the real work. This same object is used for all columns
- */
- private ColumnText columnText;
-
- /**
- * Array of <CODE>ColumnDef</CODE> objects used to define the columns
- */
- private ArrayList columnDefs;
-
- /**
- * true if all columns are simple (rectangular)
- */
- private boolean simple = true;
-
- private int currentColumn = 0;
-
- private float nextY = AUTOMATIC;
-
- private boolean columnsRightToLeft = false;
-
- private PdfDocument document;
- /**
- * Default constructor. Sets height to <CODE>AUTOMATIC</CODE>.
- * Columns will repeat on each page as necessary to accomodate content length.
- */
- public MultiColumnText() {
- this(AUTOMATIC);
- }
-
- /**
- * Construct a MultiColumnText container of the specified height.
- * If height is <CODE>AUTOMATIC</CODE>, fill complete pages until done.
- * If a specific height is used, it may span one or more pages.
- *
- * @param height
- */
- public MultiColumnText(float height) {
- columnDefs = new ArrayList();
- desiredHeight = height;
- top = AUTOMATIC;
- // canvas will be set later
- columnText = new ColumnText(null);
- totalHeight = 0f;
- }
-
- /**
- * Indicates that all of the text did not fit in the
- * specified height. Note that isOverflow will return
- * false before the MultiColumnText object has been
- * added to the document. It will always be false if
- * the height is AUTOMATIC.
- *
- * @return true if there is still space left in the column
- */
- public boolean isOverflow() {
- return overflow;
- }
-
- /**
- * Copy the parameters from the specified ColumnText to use
- * when rendering. Parameters like <CODE>setArabicOptions</CODE>
- * must be set in this way.
- *
- * @param sourceColumn
- */
- public void useColumnParams(ColumnText sourceColumn) {
- // note that canvas will be overwritten later
- columnText.setSimpleVars(sourceColumn);
- }
-
- /**
- * Add a new column. The parameters are limits for each column
- * wall in the format of a sequence of points (x1,y1,x2,y2,...).
- *
- * @param left limits for left column
- * @param right limits for right column
- */
- public void addColumn(float[] left, float[] right) {
- ColumnDef nextDef = new ColumnDef(left, right);
- simple = nextDef.isSimple();
- columnDefs.add(nextDef);
- }
-
- /**
- * Add a simple rectangular column with specified left
- * and right x position boundaries.
- *
- * @param left left boundary
- * @param right right boundary
- */
- public void addSimpleColumn(float left, float right) {
- ColumnDef newCol = new ColumnDef(left, right);
- columnDefs.add(newCol);
- }
-
- /**
- * Add the specified number of evenly spaced rectangular columns.
- * Columns will be seperated by the specified gutterWidth.
- *
- * @param left left boundary of first column
- * @param right right boundary of last column
- * @param gutterWidth width of gutter spacing between columns
- * @param numColumns number of columns to add
- */
- public void addRegularColumns(float left, float right, float gutterWidth, int numColumns) {
- float currX = left;
- float width = right - left;
- float colWidth = (width - (gutterWidth * (numColumns - 1))) / numColumns;
- for (int i = 0; i < numColumns; i++) {
- addSimpleColumn(currX, currX + colWidth);
- currX += colWidth + gutterWidth;
- }
- }
-
- /**
- * Add an element to be rendered in a column.
- * Note that you can only add a <CODE>Phrase</CODE>
- * or a <CODE>Chunk</CODE> if the columns are
- * not all simple. This is an underlying restriction in
- * {@link com.lowagie.text.pdf.ColumnText}
- *
- * @param element element to add
- * @throws DocumentException if element can't be added
- */
- public void addElement(Element element) throws DocumentException {
- if (simple) {
- columnText.addElement(element);
- } else if (element instanceof Phrase) {
- columnText.addText((Phrase) element);
- } else if (element instanceof Chunk) {
- columnText.addText((Chunk) element);
- } else {
- throw new DocumentException("Can't add " + element.getClass() + " to MultiColumnText with complex columns");
- }
- }
-
-
- /**
- * Write out the columns. After writing, use
- * {@link #isOverflow()} to see if all text was written.
- * @param canvas PdfContentByte to write with
- * @param document document to write to (only used to get page limit info)
- * @param documentY starting y position to begin writing at
- * @return the current height (y position) after writing the columns
- * @throws DocumentException on error
- */
- public float write(PdfContentByte canvas, PdfDocument document, float documentY) throws DocumentException {
- this.document = document;
- columnText.setCanvas(canvas);
- if (columnDefs.size() == 0) {
- throw new DocumentException("MultiColumnText has no columns");
- }
- overflow = false;
- pageBottom = document.bottom();
- float currentHeight = 0;
- boolean done = false;
- try {
- while (!done) {
- if (nextY == AUTOMATIC) {
- nextY = documentY;
- }
- if (top == AUTOMATIC) {
- top = documentY; // shouldn't I be able to get this from the document?
- }
-
- ColumnDef currentDef = (ColumnDef) columnDefs.get(getCurrentColumn());
- columnText.setYLine(top);
-
- float[] left = currentDef.resolvePositions(Rectangle.LEFT);
- float[] right = currentDef.resolvePositions(Rectangle.RIGHT);
- currentHeight = Math.max(currentHeight, getHeight(left, right));
-
- if (currentDef.isSimple()) {
- columnText.setSimpleColumn(left[2], left[3], right[0], right[1]);
- } else {
- columnText.setColumns(left, right);
- }
-
- int result = columnText.go();
- if ((result & ColumnText.NO_MORE_TEXT) != 0) {
- done = true;
- top = columnText.getYLine();
- } else if (shiftCurrentColumn()) {
- top = nextY;
- } else { // check if we are done because of height
- totalHeight += currentHeight;
-
- if ((desiredHeight != AUTOMATIC) && (totalHeight >= desiredHeight)) {
- overflow = true;
- break;
- } else { // need to start new page and reset the columns
- newPage();
- currentHeight = 0;
- }
- }
- }
- } catch (DocumentException ex) {
- ex.printStackTrace();
- throw ex;
- }
- return currentHeight;
- }
-
- private void newPage() throws DocumentException {
- resetCurrentColumn();
- top = nextY = AUTOMATIC;
- if (document != null) {
- document.newPage();
- }
- }
-
- /**
- * Figure out the height of a column from the border extents
- *
- * @param left left border
- * @param right right border
- * @return height
- */
- private float getHeight(float[] left, float[] right) {
- float max = Float.MIN_VALUE;
- float min = Float.MAX_VALUE;
- for (int i = 0; i < left.length; i += 2) {
- min = Math.min(min, left[i + 1]);
- max = Math.max(max, left[i + 1]);
- }
- for (int i = 0; i < right.length; i += 2) {
- min = Math.min(min, right[i + 1]);
- max = Math.max(max, right[i + 1]);
- }
- return max - min;
- }
-
-
- /**
- * Processes the element by adding it to an
- * <CODE>ElementListener</CODE>.
- *
- * @param listener an <CODE>ElementListener</CODE>
- * @return <CODE>true</CODE> if the element was processed successfully
- */
- public boolean process(ElementListener listener) {
- try {
- return listener.add(this);
- } catch (DocumentException de) {
- return false;
- }
- }
-
- /**
- * Gets the type of the text element.
- *
- * @return a type
- */
-
- public int type() {
- return Element.MULTI_COLUMN_TEXT;
- }
-
- /**
- * Returns null - not used
- *
- * @return null
- */
-
- public ArrayList getChunks() {
- return null;
- }
-
- /**
- * Calculates the appropriate y position for the bottom
- * of the columns on this page.
- *
- * @return the y position of the bottom of the columns
- */
- private float getColumnBottom() {
- if (desiredHeight == AUTOMATIC) {
- return pageBottom;
- } else {
- return Math.max(top - (desiredHeight - totalHeight), pageBottom);
- }
- }
-
- /**
- * Moves the text insertion point to the beginning of the next column, issuing a page break if
- * needed.
- * @throws DocumentException on error
- */
- public void nextColumn() throws DocumentException {
- currentColumn = (currentColumn + 1) % columnDefs.size();
- top = nextY;
- if (currentColumn == 0) {
- newPage();
- }
- }
-
- /**
- * Gets the current column.
- * @return the current column
- */
- public int getCurrentColumn() {
- if (columnsRightToLeft) {
- return (columnDefs.size() - currentColumn - 1);
- }
- return currentColumn;
- }
-
- /**
- * Resets the current column.
- */
- public void resetCurrentColumn() {
- currentColumn = 0;
- }
-
- /**
- * Shifts the current column.
- * @return true if the currentcolumn has changed
- */
- public boolean shiftCurrentColumn() {
- if (currentColumn + 1 < columnDefs.size()) {
- currentColumn++;
- return true;
- }
- return false;
- }
-
- /**
- * Sets the direction of the columns.
- * @param direction true = right2left; false = left2right
- */
- public void setColumnsRightToLeft(boolean direction) {
- columnsRightToLeft = direction;
- }
-
- /**
- * Inner class used to define a column
- */
- private class ColumnDef {
- private float[] left;
- private float[] right;
-
- ColumnDef(float[] newLeft, float[] newRight) {
- left = newLeft;
- right = newRight;
- }
-
- ColumnDef(float leftPosition, float rightPosition) {
- left = new float[4];
- left[0] = leftPosition; // x1
- left[1] = top; // y1
- left[2] = leftPosition; // x2
- if (desiredHeight == AUTOMATIC || top == AUTOMATIC) {
- left[3] = AUTOMATIC;
- } else {
- left[3] = top - desiredHeight;
- }
-
- right = new float[4];
- right[0] = rightPosition; // x1
- right[1] = top; // y1
- right[2] = rightPosition; // x2
- if (desiredHeight == AUTOMATIC || top == AUTOMATIC) {
- right[3] = AUTOMATIC;
- } else {
- right[3] = top - desiredHeight;
- }
- }
-
- /**
- * Resolves the positions for the specified side of the column
- * into real numbers once the top of the column is known.
- *
- * @param side either <CODE>Rectangle.LEFT</CODE>
- * or <CODE>Rectangle.RIGHT</CODE>
- * @return the array of floats for the side
- */
- float[] resolvePositions(int side) {
- if (side == Rectangle.LEFT) {
- return resolvePositions(left);
- } else {
- return resolvePositions(right);
- }
- }
-
- private float[] resolvePositions(float[] positions) {
- if (!isSimple()) {
- return positions;
- }
- if (top == AUTOMATIC) {
- // this is bad - must be programmer error
- throw new RuntimeException("resolvePositions called with top=AUTOMATIC (-1). " +
- "Top position must be set befure lines can be resolved");
- }
- positions[1] = top;
- positions[3] = getColumnBottom();
- return positions;
- }
-
- /**
- * Checks if column definition is a simple rectangle
- * @return true if it is a simple column
- */
- private boolean isSimple() {
- return (left.length == 4 && right.length == 4) && (left[0] == left[2] && right[0] == right[2]);
- }
-
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/OutputStreamCounter.java b/LibrarySource/com/lowagie/text/pdf/OutputStreamCounter.java
deleted file mode 100644
index 74f8188..0000000
--- a/LibrarySource/com/lowagie/text/pdf/OutputStreamCounter.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright 2004 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-import java.io.OutputStream;
-import java.io.IOException;
-
-/**
- *
- * @author psoares
- */
-public class OutputStreamCounter extends OutputStream {
-
- protected OutputStream out;
- protected int counter = 0;
-
- /** Creates a new instance of OutputStreamCounter */
- public OutputStreamCounter(OutputStream out) {
- this.out = out;
- }
-
- /** Closes this output stream and releases any system resources
- * associated with this stream. The general contract of <code>close</code>
- * is that it closes the output stream. A closed stream cannot perform
- * output operations and cannot be reopened.
- * <p>
- * The <code>close</code> method of <code>OutputStream</code> does nothing.
- *
- * @exception IOException if an I/O error occurs.
- *
- */
- public void close() throws IOException {
- out.close();
- }
-
- /** Flushes this output stream and forces any buffered output bytes
- * to be written out. The general contract of <code>flush</code> is
- * that calling it is an indication that, if any bytes previously
- * written have been buffered by the implementation of the output
- * stream, such bytes should immediately be written to their
- * intended destination.
- * <p>
- * The <code>flush</code> method of <code>OutputStream</code> does nothing.
- *
- * @exception IOException if an I/O error occurs.
- *
- */
- public void flush() throws IOException {
- out.flush();
- }
-
- /** Writes <code>b.length</code> bytes from the specified byte array
- * to this output stream. The general contract for <code>write(b)</code>
- * is that it should have exactly the same effect as the call
- * <code>write(b, 0, b.length)</code>.
- *
- * @param b the data.
- * @exception IOException if an I/O error occurs.
- * @see java.io.OutputStream#write(byte[], int, int)
- *
- */
- public void write(byte[] b) throws IOException {
- counter += b.length;
- out.write(b);
- }
-
- /** Writes the specified byte to this output stream. The general
- * contract for <code>write</code> is that one byte is written
- * to the output stream. The byte to be written is the eight
- * low-order bits of the argument <code>b</code>. The 24
- * high-order bits of <code>b</code> are ignored.
- * <p>
- * Subclasses of <code>OutputStream</code> must provide an
- * implementation for this method.
- *
- * @param b the <code>byte</code>.
- * @exception IOException if an I/O error occurs. In particular,
- * an <code>IOException</code> may be thrown if the
- * output stream has been closed.
- *
- */
- public void write(int b) throws IOException {
- ++counter;
- out.write(b);
- }
-
- /** Writes <code>len</code> bytes from the specified byte array
- * starting at offset <code>off</code> to this output stream.
- * The general contract for <code>write(b, off, len)</code> is that
- * some of the bytes in the array <code>b</code> are written to the
- * output stream in order; element <code>b[off]</code> is the first
- * byte written and <code>b[off+len-1]</code> is the last byte written
- * by this operation.
- * <p>
- * The <code>write</code> method of <code>OutputStream</code> calls
- * the write method of one argument on each of the bytes to be
- * written out. Subclasses are encouraged to override this method and
- * provide a more efficient implementation.
- * <p>
- * If <code>b</code> is <code>null</code>, a
- * <code>NullPointerException</code> is thrown.
- * <p>
- * If <code>off</code> is negative, or <code>len</code> is negative, or
- * <code>off+len</code> is greater than the length of the array
- * <code>b</code>, then an <tt>IndexOutOfBoundsException</tt> is thrown.
- *
- * @param b the data.
- * @param off the start offset in the data.
- * @param len the number of bytes to write.
- * @exception IOException if an I/O error occurs. In particular,
- * an <code>IOException</code> is thrown if the output
- * stream is closed.
- *
- */
- public void write(byte[] b, int off, int len) throws IOException {
- counter += len;
- out.write(b, off, len);
- }
-
- public int getCounter() {
- return counter;
- }
-
- public void resetCounter() {
- counter = 0;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PRIndirectReference.java b/LibrarySource/com/lowagie/text/pdf/PRIndirectReference.java
deleted file mode 100644
index 89f4365..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PRIndirectReference.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * $Id: PRIndirectReference.java,v 1.12 2002/07/09 11:28:22 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-import java.io.OutputStream;
-import java.io.IOException;
-
-public class PRIndirectReference extends PdfIndirectReference {
-
- protected PdfReader reader;
- // membervariables
-
- // constructors
-
-/**
- * Constructs a <CODE>PdfIndirectReference</CODE>.
- *
- * @param reader a <CODE>PdfReader</CODE>
- * @param number the object number.
- * @param generation the generation number.
- */
-
- PRIndirectReference(PdfReader reader, int number, int generation) {
- type = INDIRECT;
- this.number = number;
- this.generation = generation;
- this.reader = reader;
- }
-
-/**
- * Constructs a <CODE>PdfIndirectReference</CODE>.
- *
- * @param reader a <CODE>PdfReader</CODE>
- * @param number the object number.
- */
-
- PRIndirectReference(PdfReader reader, int number) {
- this(reader, number, 0);
- }
-
- // methods
-
- public void toPdf(PdfWriter writer, OutputStream os) throws IOException {
- int n = writer.getNewObjectNumber(reader, number, generation);
- os.write(PdfEncodings.convertToBytes(new StringBuffer().append(n).append(" 0 R").toString(), null));
- }
-
- public PdfReader getReader() {
- return reader;
- }
-
- public void setNumber(int number, int generation) {
- this.number = number;
- this.generation = generation;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PRStream.java b/LibrarySource/com/lowagie/text/pdf/PRStream.java
deleted file mode 100644
index 2514d99..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PRStream.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * $Id: PRStream.java,v 1.12 2002/06/20 13:30:25 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.*;
-import com.lowagie.text.ExceptionConverter;
-import java.util.zip.DeflaterOutputStream;
-import com.lowagie.text.Document;
-import java.io.OutputStream;
-import java.io.IOException;
-
-public class PRStream extends PdfStream {
-
- protected PdfReader reader;
- protected int offset;
- protected int length;
-
- //added by ujihara for decryption
- protected int objNum = 0;
- protected int objGen = 0;
-
- public PRStream(PRStream stream, PdfDictionary newDic) {
- reader = stream.reader;
- offset = stream.offset;
- length = stream.length;
- compressed = stream.compressed;
- streamBytes = stream.streamBytes;
- bytes = stream.bytes;
- objNum = stream.objNum;
- objGen = stream.objGen;
- if (newDic != null)
- putAll(newDic);
- else
- hashMap.putAll(stream.hashMap);
- }
-
- public PRStream(PRStream stream, PdfDictionary newDic, PdfReader reader) {
- this(stream, newDic);
- this.reader = reader;
- }
-
- public PRStream(PdfReader reader, int offset) {
- this.reader = reader;
- this.offset = offset;
- }
-
- public PRStream(PdfReader reader, byte conts[]) {
- this.reader = reader;
- this.offset = -1;
- if (Document.compress) {
- try {
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- DeflaterOutputStream zip = new DeflaterOutputStream(stream);
- zip.write(conts);
- zip.close();
- bytes = stream.toByteArray();
- }
- catch (IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- put(PdfName.FILTER, PdfName.FLATEDECODE);
- }
- else
- bytes = conts;
- setLength(bytes.length);
- }
-
- /**Sets the data associated with the stream
- * @param data raw data, decrypted and uncompressed.
- */
- public void setData(byte[] data) {
- remove(PdfName.FILTER);
- this.offset = -1;
- if (Document.compress) {
- try {
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- DeflaterOutputStream zip = new DeflaterOutputStream(stream);
- zip.write(data);
- zip.close();
- bytes = stream.toByteArray();
- }
- catch (IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- put(PdfName.FILTER, PdfName.FLATEDECODE);
- }
- else
- bytes = data;
- setLength(bytes.length);
- }
-
- public void setLength(int length) {
- this.length = length;
- put(PdfName.LENGTH, new PdfNumber(length));
- }
-
- public int getOffset() {
- return offset;
- }
-
- public int getLength() {
- return length;
- }
-
- public PdfReader getReader() {
- return reader;
- }
-
- public byte[] getBytes() {
- return bytes;
- }
-
- public void setObjNum(int objNum, int objGen) {
- this.objNum = objNum;
- this.objGen = objGen;
- }
-
- int getObjNum() {
- return objNum;
- }
-
- int getObjGen() {
- return objGen;
- }
-
- public void toPdf(PdfWriter writer, OutputStream os) throws IOException {
- superToPdf(writer, os);
- os.write(STARTSTREAM);
- if (length > 0) {
- PdfEncryption crypto = null;
- if (writer != null)
- crypto = writer.getEncryption();
- if (offset < 0) {
- if (crypto == null)
- os.write(bytes);
- else {
- crypto.prepareKey();
- byte buf[] = new byte[length];
- System.arraycopy(bytes, 0, buf, 0, length);
- crypto.encryptRC4(buf);
- os.write(buf);
- }
- }
- else {
- byte buf[] = new byte[Math.min(length, 4092)];
- RandomAccessFileOrArray file = writer.getReaderFile(reader);
- boolean isOpen = file.isOpen();
- try {
- file.seek(offset);
- int size = length;
-
- //added by ujihara for decryption
- PdfEncryption decrypt = reader.getDecrypt();
- if (decrypt != null) {
- decrypt.setHashKey(objNum, objGen);
- decrypt.prepareKey();
- }
-
- if (crypto != null)
- crypto.prepareKey();
- while (size > 0) {
- int r = file.read(buf, 0, Math.min(size, buf.length));
- size -= r;
-
- if (decrypt != null)
- decrypt.encryptRC4(buf, 0, r); //added by ujihara for decryption
-
- if (crypto != null)
- crypto.encryptRC4(buf, 0, r);
- os.write(buf, 0, r);
- }
- }
- finally {
- if (!isOpen)
- try{file.close();}catch(Exception e){}
- }
- }
- }
- os.write(ENDSTREAM);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PRTokeniser.java b/LibrarySource/com/lowagie/text/pdf/PRTokeniser.java
deleted file mode 100644
index 67d7141..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PRTokeniser.java
+++ /dev/null
@@ -1,587 +0,0 @@
-/*
- * $Id: PRTokeniser.java,v 1.15 2002/06/20 13:30:25 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.*;
-/**
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class PRTokeniser {
-
- public static final int TK_NUMBER = 1;
- public static final int TK_STRING = 2;
- public static final int TK_NAME = 3;
- public static final int TK_COMMENT = 4;
- public static final int TK_START_ARRAY = 5;
- public static final int TK_END_ARRAY = 6;
- public static final int TK_START_DIC = 7;
- public static final int TK_END_DIC = 8;
- public static final int TK_REF = 9;
- public static final int TK_OTHER = 10;
- public static final boolean delims[] = {
- true, true, false, false, false, false, false, false, false, false,
- true, true, false, true, true, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, true, false, false, false, false, true, false,
- false, true, true, false, false, false, false, false, true, false,
- false, false, false, false, false, false, false, false, false, false,
- false, true, false, true, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, true, false, true, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false};
-
- static final String EMPTY = "";
-
-
- protected RandomAccessFileOrArray file;
- protected int type;
- protected String stringValue;
- protected int reference;
- protected int generation;
- protected boolean hexString;
-
- private static final int LINE_SEGMENT_SIZE = 256;
-
- public PRTokeniser(String filename) throws IOException {
- file = new RandomAccessFileOrArray(filename);
- }
-
- public PRTokeniser(byte pdfIn[]) {
- file = new RandomAccessFileOrArray(pdfIn);
- }
-
- public PRTokeniser(RandomAccessFileOrArray file) {
- this.file = file;
- }
-
- public void seek(int pos) throws IOException {
- file.seek(pos);
- }
-
- public int getFilePointer() throws IOException {
- return file.getFilePointer();
- }
-
- public void close() throws IOException {
- file.close();
- }
-
- public int length() throws IOException {
- return file.length();
- }
-
- public int read() throws IOException {
- return file.read();
- }
-
- public RandomAccessFileOrArray getSafeFile() {
- return new RandomAccessFileOrArray(file);
- }
-
- public RandomAccessFileOrArray getFile() {
- return file;
- }
-
- public String readString(int size) throws IOException {
- StringBuffer buf = new StringBuffer();
- int ch;
- while ((size--) > 0) {
- ch = file.read();
- if (ch == -1)
- break;
- buf.append((char)ch);
- }
- return buf.toString();
- }
-
- public static final boolean isWhitespace(int ch) {
- return (ch == 0 || ch == 9 || ch == 10 || ch == 12 || ch == 13 || ch == 32);
- }
-
- public static final boolean isDelimiter(int ch) {
- return (ch == '(' || ch == ')' || ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '/' || ch == '%');
- }
-
- public static final boolean isDelimiterWhitespace(int ch) {
- return delims[ch + 1];
- }
-
- public int getTokenType() {
- return type;
- }
-
- public String getStringValue() {
- return stringValue;
- }
-
- public int getReference() {
- return reference;
- }
-
- public int getGeneration() {
- return generation;
- }
-
- public void backOnePosition(int ch) throws IOException {
- if (ch != -1)
- file.pushBack((byte)ch);
- }
-
- public void throwError(String error) throws IOException {
- throw new IOException(error + " at file pointer " + file.getFilePointer());
- }
-
- public char checkPdfHeader() throws IOException {
- file.setStartOffset(0);
- String str = readString(1024);
- int idx = str.indexOf("%PDF-1.");
- if (idx < 0)
- throw new IOException("PDF header signature not found.");
- file.setStartOffset(idx);
- return str.charAt(idx + 7);
- }
-
- public void checkFdfHeader() throws IOException {
- file.setStartOffset(0);
- String str = readString(1024);
- int idx = str.indexOf("%FDF-1.2");
- if (idx < 0)
- throw new IOException("FDF header signature not found.");
- file.setStartOffset(idx);
- }
-
- public int getStartxref() throws IOException {
- int size = Math.min(1024, file.length());
- int pos = file.length() - size;
- file.seek(pos);
- String str = readString(1024);
- int idx = str.lastIndexOf("startxref");
- if (idx < 0)
- throw new IOException("PDF startxref not found.");
- return pos + idx;
- }
-
- public static int getHex(int v) {
- if (v >= '0' && v <= '9')
- return v - '0';
- if (v >= 'A' && v <= 'F')
- return v - 'A' + 10;
- if (v >= 'a' && v <= 'f')
- return v - 'a' + 10;
- return -1;
- }
-
- public void nextValidToken() throws IOException {
- int level = 0;
- String n1 = null;
- String n2 = null;
- int ptr = 0;
- while (nextToken()) {
- if (type == TK_COMMENT)
- continue;
- switch (level) {
- case 0:
- {
- if (type != TK_NUMBER)
- return;
- ptr = file.getFilePointer();
- n1 = stringValue;
- ++level;
- break;
- }
- case 1:
- {
- if (type != TK_NUMBER) {
- file.seek(ptr);
- type = TK_NUMBER;
- stringValue = n1;
- return;
- }
- n2 = stringValue;
- ++level;
- break;
- }
- default:
- {
- if (type != TK_OTHER || !stringValue.equals("R")) {
- file.seek(ptr);
- type = TK_NUMBER;
- stringValue = n1;
- return;
- }
- type = TK_REF;
- reference = Integer.valueOf(n1).intValue();
- generation = Integer.valueOf(n2).intValue();
- return;
- }
- }
- }
- throwError("Unexpected end of file");
- }
-
- public boolean nextToken() throws IOException {
- StringBuffer outBuf = null;
- stringValue = EMPTY;
- int ch = 0;
- do {
- ch = file.read();
- } while (ch != -1 && isWhitespace(ch));
- if (ch == -1)
- return false;
- switch (ch) {
- case '[':
- type = TK_START_ARRAY;
- break;
- case ']':
- type = TK_END_ARRAY;
- break;
- case '/':
- {
- outBuf = new StringBuffer();
- type = TK_NAME;
- while (true) {
- ch = file.read();
- if (delims[ch + 1])
- break;
- if (ch == '#') {
- ch = (getHex(file.read()) << 4) + getHex(file.read());
- }
- outBuf.append((char)ch);
- }
- backOnePosition(ch);
- break;
- }
- case '>':
- ch = file.read();
- if (ch != '>')
- throwError("'>' not expected");
- type = TK_END_DIC;
- break;
- case '<':
- {
- int v1 = file.read();
- if (v1 == '<') {
- type = TK_START_DIC;
- break;
- }
- outBuf = new StringBuffer();
- type = TK_STRING;
- hexString = true;
- int v2 = 0;
- while (true) {
- while (isWhitespace(v1))
- v1 = file.read();
- if (v1 == '>')
- break;
- v1 = getHex(v1);
- if (v1 < 0)
- break;
- v2 = file.read();
- while (isWhitespace(v2))
- v2 = file.read();
- if (v2 == '>') {
- ch = v1 << 4;
- outBuf.append((char)ch);
- break;
- }
- v2 = getHex(v2);
- if (v2 < 0)
- break;
- ch = (v1 << 4) + v2;
- outBuf.append((char)ch);
- v1 = file.read();
- }
- if (v1 < 0 || v2 < 0)
- throwError("Error reading string");
- break;
- }
- case '%':
- type = TK_COMMENT;
- do {
- ch = file.read();
- } while (ch != -1 && ch != '\r' && ch != '\n');
- break;
- case '(':
- {
- outBuf = new StringBuffer();
- type = TK_STRING;
- hexString = false;
- int nesting = 0;
- while (true) {
- ch = file.read();
- if (ch == -1)
- break;
- if (ch == '(') {
- ++nesting;
- }
- else if (ch == ')') {
- --nesting;
- }
- else if (ch == '\\') {
- boolean lineBreak = false;
- ch = file.read();
- switch (ch) {
- case 'n':
- ch = '\n';
- break;
- case 'r':
- ch = '\r';
- break;
- case 't':
- ch = '\t';
- break;
- case 'b':
- ch = '\b';
- break;
- case 'f':
- ch = '\f';
- break;
- case '(':
- case ')':
- case '\\':
- break;
- case '\r':
- lineBreak = true;
- ch = file.read();
- if (ch != '\n')
- backOnePosition(ch);
- break;
- case '\n':
- lineBreak = true;
- break;
- default:
- {
- if (ch < '0' || ch > '7') {
- break;
- }
- int octal = ch - '0';
- ch = file.read();
- if (ch < '0' || ch > '7') {
- backOnePosition(ch);
- ch = octal;
- break;
- }
- octal = (octal << 3) + ch - '0';
- ch = file.read();
- if (ch < '0' || ch > '7') {
- backOnePosition(ch);
- ch = octal;
- break;
- }
- octal = (octal << 3) + ch - '0';
- ch = octal & 0xff;
- break;
- }
- }
- if (lineBreak)
- continue;
- if (ch < 0)
- break;
- }
- else if (ch == '\r') {
- ch = file.read();
- if (ch < 0)
- break;
- if (ch != '\n') {
- backOnePosition(ch);
- ch = '\n';
- }
- }
- if (nesting == -1)
- break;
- outBuf.append((char)ch);
- }
- if (ch == -1)
- throwError("Error reading string");
- break;
- }
- default:
- {
- outBuf = new StringBuffer();
- if (ch == '-' || ch == '+' || ch == '.' || (ch >= '0' && ch <= '9')) {
- type = TK_NUMBER;
- do {
- outBuf.append((char)ch);
- ch = file.read();
- } while (ch != -1 && ((ch >= '0' && ch <= '9') || ch == '.'));
- }
- else {
- type = TK_OTHER;
- do {
- outBuf.append((char)ch);
- ch = file.read();
- } while (!delims[ch + 1]);
- }
- backOnePosition(ch);
- break;
- }
- }
- if (outBuf != null)
- stringValue = outBuf.toString();
- return true;
- }
-
- public int intValue() {
- return Integer.valueOf(stringValue).intValue();
- }
-
- public boolean readLineSegment(byte input[]) throws IOException {
- int c = -1;
- boolean eol = false;
- int ptr = 0;
- int len = input.length;
- // ssteward, pdftk-1.10, 040922:
- // skip initial whitespace; added this because PdfReader.rebuildXref()
- // assumes that line provided by readLineSegment does not have init. whitespace;
- if ( ptr < len ) {
- while ( isWhitespace( (c = read()) ) );
- }
- while ( !eol && ptr < len ) {
- switch (c) {
- case -1:
- case '\n':
- eol = true;
- break;
- case '\r':
- eol = true;
- int cur = getFilePointer();
- if ((read()) != '\n') {
- seek(cur);
- }
- break;
- default:
- input[ptr++] = (byte)c;
- break;
- }
-
- // break loop? do it before we read() again
- if( eol || len <= ptr ) {
- break;
- }
- else {
- c = read();
- }
- }
- if (ptr >= len) {
- eol = false;
- while (!eol) {
- switch (c = read()) {
- case -1:
- case '\n':
- eol = true;
- break;
- case '\r':
- eol = true;
- int cur = getFilePointer();
- if ((read()) != '\n') {
- seek(cur);
- }
- break;
- }
- }
- }
-
- if ((c == -1) && (ptr == 0)) {
- return false;
- }
- if (ptr + 2 <= len) {
- input[ptr++] = (byte)' ';
- input[ptr] = (byte)'X';
- }
- return true;
- }
-
- public static int[] checkObjectStart(byte line[]) {
- try {
- PRTokeniser tk = new PRTokeniser(line);
- int num = 0;
- int gen = 0;
- if (!tk.nextToken() || tk.getTokenType() != TK_NUMBER)
- return null;
- num = tk.intValue();
- if (!tk.nextToken() || tk.getTokenType() != TK_NUMBER)
- return null;
- gen = tk.intValue();
- if (!tk.nextToken())
- return null;
- if (!tk.getStringValue().equals("obj"))
- return null;
- return new int[]{num, gen};
- }
- catch (Exception ioe) {
- // empty on purpose
- }
- return null;
- }
-
- public boolean isHexString() {
- return this.hexString;
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PageResources.java b/LibrarySource/com/lowagie/text/pdf/PageResources.java
deleted file mode 100644
index 2583220..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PageResources.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright 2003 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import java.util.HashMap;
-import java.util.Iterator;
-
-class PageResources {
-
- protected PdfDictionary fontDictionary = new PdfDictionary();
- protected PdfDictionary xObjectDictionary = new PdfDictionary();
- protected PdfDictionary colorDictionary = new PdfDictionary();
- protected PdfDictionary patternDictionary = new PdfDictionary();
- protected PdfDictionary shadingDictionary = new PdfDictionary();
- protected PdfDictionary extGStateDictionary = new PdfDictionary();
- protected PdfDictionary LayerDictionary = new PdfDictionary();
- protected HashMap forbiddenNames;
- protected PdfDictionary originalResources;
- protected int namePtr[] = {0};
- protected HashMap usedNames;
-
- PageResources() {
- }
-
- void setOriginalResources(PdfDictionary resources, int newNamePtr[]) {
- if (newNamePtr != null)
- namePtr = newNamePtr;
- originalResources = resources;
- forbiddenNames = new HashMap();
- usedNames = new HashMap();
- if (resources == null)
- return;
- for (Iterator i = resources.getKeys().iterator(); i.hasNext();) {
- PdfObject sub = PdfReader.getPdfObject(resources.get((PdfName)i.next()));
- if (sub.isDictionary()) {
- PdfDictionary dic = (PdfDictionary)sub;
- for (Iterator j = dic.getKeys().iterator(); j.hasNext();) {
- forbiddenNames.put(j.next(), null);
- }
- }
- }
- }
-
- PdfName translateName(PdfName name) {
- PdfName translated = name;
- if (forbiddenNames != null) {
- translated = (PdfName)usedNames.get(name);
- if (translated == null) {
- while (true) {
- translated = new PdfName("Xi" + (namePtr[0]++));
- if (!forbiddenNames.containsKey(translated))
- break;
- }
- usedNames.put(name, translated);
- }
- }
- return translated;
- }
-
- PdfName addFont(PdfName name, PdfIndirectReference reference) {
- name = translateName(name);
- fontDictionary.put(name, reference);
- return name;
- }
-
- PdfName addXObject(PdfName name, PdfIndirectReference reference) {
- name = translateName(name);
- xObjectDictionary.put(name, reference);
- return name;
- }
-
- PdfName addColor(PdfName name, PdfIndirectReference reference) {
- name = translateName(name);
- colorDictionary.put(name, reference);
- return name;
- }
-
- void addDefaultColor(PdfName name, PdfObject obj) {
- if (obj == null || obj.isNull())
- colorDictionary.remove(name);
- else
- colorDictionary.put(name, obj);
- }
-
- void addDefaultColor(PdfDictionary dic) {
- colorDictionary.merge(dic);
- }
-
- void addDefaultColorDiff(PdfDictionary dic) {
- colorDictionary.mergeDifferent(dic);
- }
-
- PdfName addShading(PdfName name, PdfIndirectReference reference) {
- name = translateName(name);
- shadingDictionary.put(name, reference);
- return name;
- }
-
- PdfName addPattern(PdfName name, PdfIndirectReference reference) {
- name = translateName(name);
- patternDictionary.put(name, reference);
- return name;
- }
-
- PdfName addExtGState(PdfName name, PdfIndirectReference reference) {
- name = translateName(name);
- extGStateDictionary.put(name, reference);
- return name;
- }
-
- PdfName addLayer(PdfName name, PdfIndirectReference reference) {
- name = translateName(name);
- LayerDictionary.put(name, reference);
- return name;
- }
-
- PdfDictionary getResources() {
- PdfResources resources = new PdfResources();
- if (originalResources != null)
- resources.putAll(originalResources);
- resources.put(PdfName.PROCSET, new PdfLiteral("[/PDF /Text /ImageB /ImageC /ImageI]"));
- resources.add(PdfName.FONT, fontDictionary);
- resources.add(PdfName.XOBJECT, xObjectDictionary);
- resources.add(PdfName.COLORSPACE, colorDictionary);
- resources.add(PdfName.PATTERN, patternDictionary);
- resources.add(PdfName.SHADING, shadingDictionary);
- resources.add(PdfName.EXTGSTATE, extGStateDictionary);
- resources.add(PdfName.PROPERTIES, LayerDictionary);
- return resources;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PatternColor.java b/LibrarySource/com/lowagie/text/pdf/PatternColor.java
deleted file mode 100644
index 9db2624..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PatternColor.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2004 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-/** Represents a pattern. Can be used in high-level constructs (Paragraph, Cell, etc.).
- */
-public class PatternColor extends ExtendedColor {
- /**
- * The actual pattern.
- */
- PdfPatternPainter painter;
-
- /** Creates a color representing a pattern.
- * @param painter the actual pattern
- */
- public PatternColor(PdfPatternPainter painter) {
- super(TYPE_PATTERN, .5f, .5f, .5f);
- this.painter = painter;
- }
-
- /** Gets the pattern.
- * @return the pattern
- */
- public PdfPatternPainter getPainter() {
- return this.painter;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfAcroForm.java b/LibrarySource/com/lowagie/text/pdf/PdfAcroForm.java
deleted file mode 100644
index 071b600..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfAcroForm.java
+++ /dev/null
@@ -1,744 +0,0 @@
-/*
- * $Id: PdfAcroForm.java,v 1.44 2005/03/30 10:10:58 blowagie Exp $
- * $Name: $
- *
- * Copyright 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.util.Iterator;
-import java.util.HashMap;
-
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.ExceptionConverter;
-
-/**
- * Each PDF document can contain maximum 1 AcroForm.
- */
-
-public class PdfAcroForm extends PdfDictionary {
-
- private PdfWriter writer;
-
-
- /** This is a map containing FieldTemplates. */
- private HashMap fieldTemplates = new HashMap();
-
- /** This is an array containing DocumentFields. */
- private PdfArray documentFields = new PdfArray();
-
- /** This is an array containing the calculationorder of the fields. */
- private PdfArray calculationOrder = new PdfArray();
-
- /** Contains the signature flags. */
- private int sigFlags = 0;
-
- /** Creates new PdfAcroForm
- * @param writer*/
- PdfAcroForm(PdfWriter writer) {
- super();
- this.writer = writer;
- }
-
- /**
- * Adds fieldTemplates.
- * @param ft
- */
-
- void addFieldTemplates(HashMap ft) {
- fieldTemplates.putAll(ft);
- }
-
- /**
- * Adds documentFields.
- * @param ref
- */
-
- void addDocumentField(PdfIndirectReference ref) {
- documentFields.add(ref);
- }
-
- /**
- * Checks if the Acroform is valid
- * @return true if the Acroform is valid
- */
-
- boolean isValid() {
- if (documentFields.size() == 0) return false;
- put(PdfName.FIELDS, documentFields);
- if (sigFlags != 0)
- put(PdfName.SIGFLAGS, new PdfNumber(sigFlags));
- if (calculationOrder.size() > 0)
- put(PdfName.CO, calculationOrder);
- if (fieldTemplates.size() == 0) return true;
- PdfDictionary dic = new PdfDictionary();
- for (Iterator it = fieldTemplates.keySet().iterator(); it.hasNext();) {
- PdfTemplate template = (PdfTemplate)it.next();
- PdfFormField.mergeResources(dic, (PdfDictionary)template.getResources());
- }
- put(PdfName.DR, dic);
- PdfDictionary fonts = (PdfDictionary)dic.get(PdfName.FONT);
- if (fonts != null) {
- put(PdfName.DA, new PdfString("/Helv 0 Tf 0 g "));
- writer.eliminateFontSubset(fonts);
- }
- return true;
- }
-
- /**
- * Adds an object to the calculationOrder.
- * @param formField
- */
-
- public void addCalculationOrder(PdfFormField formField) {
- calculationOrder.add(formField.getIndirectReference());
- }
-
- /**
- * Sets the signature flags.
- * @param f
- */
-
- public void setSigFlags(int f) {
- sigFlags |= f;
- }
-
- /**
- * Adds a formfield to the AcroForm.
- * @param formField
- */
-
- public void addFormField(PdfFormField formField) {
- writer.addAnnotation(formField);
- }
-
- /**
- * @param name
- * @param caption
- * @param value
- * @param url
- * @param font
- * @param fontSize
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @return a PdfFormField
- */
- public PdfFormField addHtmlPostButton(String name, String caption, String value, String url, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) {
- PdfAction action = PdfAction.createSubmitForm(url, null, PdfAction.SUBMIT_HTML_FORMAT);
- PdfFormField button = new PdfFormField(writer, llx, lly, urx, ury, action);
- setButtonParams(button, PdfFormField.FF_PUSHBUTTON, name, value);
- drawButton(button, caption, font, fontSize, llx, lly, urx, ury);
- addFormField(button);
- return button;
- }
-
- /**
- * @param name
- * @param caption
- * @param value
- * @param font
- * @param fontSize
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @return a PdfFormField
- */
- public PdfFormField addResetButton(String name, String caption, String value, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) {
- PdfAction action = PdfAction.createResetForm(null, 0);
- PdfFormField button = new PdfFormField(writer, llx, lly, urx, ury, action);
- setButtonParams(button, PdfFormField.FF_PUSHBUTTON, name, value);
- drawButton(button, caption, font, fontSize, llx, lly, urx, ury);
- addFormField(button);
- return button;
- }
-
- /**
- * @param name
- * @param value
- * @param url
- * @param appearance
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @return a PdfFormField
- */
- public PdfFormField addMap(String name, String value, String url, PdfContentByte appearance, float llx, float lly, float urx, float ury) {
- PdfAction action = PdfAction.createSubmitForm(url, null, PdfAction.SUBMIT_HTML_FORMAT | PdfAction.SUBMIT_COORDINATES);
- PdfFormField button = new PdfFormField(writer, llx, lly, urx, ury, action);
- setButtonParams(button, PdfFormField.FF_PUSHBUTTON, name, null);
- PdfContentByte cb = writer.getDirectContent();
- PdfAppearance pa = cb.createAppearance(urx - llx, ury - lly);
- pa.add(appearance);
- button.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, pa);
- addFormField(button);
- return button;
- }
-
- /**
- * @param button
- * @param characteristics
- * @param name
- * @param value
- */
- public void setButtonParams(PdfFormField button, int characteristics, String name, String value) {
- button.setButton(characteristics);
- button.setFlags(PdfAnnotation.FLAGS_PRINT);
- button.setPage();
- button.setFieldName(name);
- if (value != null) button.setValueAsString(value);
- }
-
- /**
- * @param button
- * @param caption
- * @param font
- * @param fontSize
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- */
- public void drawButton(PdfFormField button, String caption, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) {
- PdfContentByte cb = writer.getDirectContent();
- PdfAppearance pa = cb.createAppearance(urx - llx, ury - lly);
- pa.drawButton(0f, 0f, urx - llx, ury - lly, caption, font, fontSize);
- button.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, pa);
- }
-
- /**
- * @param name
- * @param value
- * @return a PdfFormField
- */
- public PdfFormField addHiddenField(String name, String value) {
- PdfFormField hidden = PdfFormField.createEmpty(writer);
- hidden.setFieldName(name);
- hidden.setValueAsName(value);
- addFormField(hidden);
- return hidden;
- }
-
- /**
- * @param name
- * @param text
- * @param font
- * @param fontSize
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @return a PdfFormField
- */
- public PdfFormField addSingleLineTextField(String name, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) {
- PdfFormField field = PdfFormField.createTextField(writer, PdfFormField.SINGLELINE, PdfFormField.PLAINTEXT, 0);
- setTextFieldParams(field, text, name, llx, lly, urx, ury);
- drawSingleLineOfText(field, text, font, fontSize, llx, lly, urx, ury);
- addFormField(field);
- return field;
- }
-
- /**
- * @param name
- * @param text
- * @param font
- * @param fontSize
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @return a PdfFormField
- */
- public PdfFormField addMultiLineTextField(String name, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) {
- PdfFormField field = PdfFormField.createTextField(writer, PdfFormField.MULTILINE, PdfFormField.PLAINTEXT, 0);
- setTextFieldParams(field, text, name, llx, lly, urx, ury);
- drawMultiLineOfText(field, text, font, fontSize, llx, lly, urx, ury);
- addFormField(field);
- return field;
- }
-
- /**
- * @param name
- * @param text
- * @param font
- * @param fontSize
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @return PdfFormField
- */
- public PdfFormField addSingleLinePasswordField(String name, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) {
- PdfFormField field = PdfFormField.createTextField(writer, PdfFormField.SINGLELINE, PdfFormField.PASSWORD, 0);
- setTextFieldParams(field, text, name, llx, lly, urx, ury);
- drawSingleLineOfText(field, text, font, fontSize, llx, lly, urx, ury);
- addFormField(field);
- return field;
- }
-
- /**
- * @param field
- * @param text
- * @param name
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- */
- public void setTextFieldParams(PdfFormField field, String text, String name, float llx, float lly, float urx, float ury) {
- field.setWidget(new Rectangle(llx, lly, urx, ury), PdfAnnotation.HIGHLIGHT_INVERT);
- field.setValueAsString(text);
- field.setDefaultValueAsString(text);
- field.setFieldName(name);
- field.setFlags(PdfAnnotation.FLAGS_PRINT);
- field.setPage();
- }
-
- /**
- * @param field
- * @param text
- * @param font
- * @param fontSize
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- */
- public void drawSingleLineOfText(PdfFormField field, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) {
- PdfContentByte cb = writer.getDirectContent();
- PdfAppearance tp = cb.createAppearance(urx - llx, ury - lly);
- PdfAppearance tp2 = (PdfAppearance)tp.getDuplicate();
- tp2.setFontAndSize(font, fontSize);
- tp2.resetRGBColorFill();
- field.setDefaultAppearanceString(tp2);
- tp.drawTextField(0f, 0f, urx - llx, ury - lly);
- tp.beginVariableText();
- tp.saveState();
- tp.rectangle(3f, 3f, urx - llx - 6f, ury - lly - 6f);
- tp.clip();
- tp.newPath();
- tp.beginText();
- tp.setFontAndSize(font, fontSize);
- tp.resetRGBColorFill();
- tp.setTextMatrix(4, (ury - lly) / 2 - (fontSize * 0.3f));
- tp.showText(text);
- tp.endText();
- tp.restoreState();
- tp.endVariableText();
- field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp);
- }
-
- /**
- * @param field
- * @param text
- * @param font
- * @param fontSize
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- */
- public void drawMultiLineOfText(PdfFormField field, String text, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) {
- PdfContentByte cb = writer.getDirectContent();
- PdfAppearance tp = cb.createAppearance(urx - llx, ury - lly);
- PdfAppearance tp2 = (PdfAppearance)tp.getDuplicate();
- tp2.setFontAndSize(font, fontSize);
- tp2.resetRGBColorFill();
- field.setDefaultAppearanceString(tp2);
- tp.drawTextField(0f, 0f, urx - llx, ury - lly);
- tp.beginVariableText();
- tp.saveState();
- tp.rectangle(3f, 3f, urx - llx - 6f, ury - lly - 6f);
- tp.clip();
- tp.newPath();
- tp.beginText();
- tp.setFontAndSize(font, fontSize);
- tp.resetRGBColorFill();
- tp.setTextMatrix(4, 5);
- java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(text, "\n");
- float yPos = ury - lly;
- while (tokenizer.hasMoreTokens()) {
- yPos -= fontSize * 1.2f;
- tp.showTextAligned(PdfContentByte.ALIGN_LEFT, tokenizer.nextToken(), 3, yPos, 0);
- }
- tp.endText();
- tp.restoreState();
- tp.endVariableText();
- field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp);
- }
-
- /**
- * @param name
- * @param value
- * @param status
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @return a PdfFormField
- */
- public PdfFormField addCheckBox(String name, String value, boolean status, float llx, float lly, float urx, float ury) {
- PdfFormField field = PdfFormField.createCheckBox(writer);
- setCheckBoxParams(field, name, value, status, llx, lly, urx, ury);
- drawCheckBoxAppearences(field, value, llx, lly, urx, ury);
- addFormField(field);
- return field;
- }
-
- /**
- * @param field
- * @param name
- * @param value
- * @param status
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- */
- public void setCheckBoxParams(PdfFormField field, String name, String value, boolean status, float llx, float lly, float urx, float ury) {
- field.setWidget(new Rectangle(llx, lly, urx, ury), PdfAnnotation.HIGHLIGHT_TOGGLE);
- field.setFieldName(name);
- if (status) {
- field.setValueAsName(value);
- field.setAppearanceState(value);
- }
- else {
- field.setValueAsName("Off");
- field.setAppearanceState("Off");
- }
- field.setFlags(PdfAnnotation.FLAGS_PRINT);
- field.setPage();
- field.setBorderStyle(new PdfBorderDictionary(1, PdfBorderDictionary.STYLE_SOLID));
- }
-
- /**
- * @param field
- * @param value
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- */
- public void drawCheckBoxAppearences(PdfFormField field, String value, float llx, float lly, float urx, float ury) {
- BaseFont font = null;
- try {
- font = BaseFont.createFont(BaseFont.ZAPFDINGBATS, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
- }
- catch(Exception e) {
- throw new ExceptionConverter(e);
- }
- float size = (ury - lly);
- PdfContentByte cb = writer.getDirectContent();
- PdfAppearance tpOn = cb.createAppearance(urx - llx, ury - lly);
- PdfAppearance tp2 = (PdfAppearance)tpOn.getDuplicate();
- tp2.setFontAndSize(font, size);
- tp2.resetRGBColorFill();
- field.setDefaultAppearanceString(tp2);
- tpOn.drawTextField(0f, 0f, urx - llx, ury - lly);
- tpOn.saveState();
- tpOn.resetRGBColorFill();
- tpOn.beginText();
- tpOn.setFontAndSize(font, size);
- tpOn.showTextAligned(PdfContentByte.ALIGN_CENTER, "4", (urx - llx) / 2, (ury - lly) / 2 - (size * 0.3f), 0);
- tpOn.endText();
- tpOn.restoreState();
- field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, value, tpOn);
- PdfAppearance tpOff = cb.createAppearance(urx - llx, ury - lly);
- tpOff.drawTextField(0f, 0f, urx - llx, ury - lly);
- field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpOff);
- }
-
- /**
- * @param name
- * @param defaultValue
- * @param noToggleToOff
- * @return a PdfFormField
- */
- public PdfFormField getRadioGroup(String name, String defaultValue, boolean noToggleToOff) {
- PdfFormField radio = PdfFormField.createRadioButton(writer, noToggleToOff);
- radio.setFieldName(name);
- radio.setValueAsName(defaultValue);
- return radio;
- }
-
- /**
- * @param radiogroup
- */
- public void addRadioGroup(PdfFormField radiogroup) {
- addFormField(radiogroup);
- }
-
- /**
- * @param radiogroup
- * @param value
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @return a PdfFormField
- */
- public PdfFormField addRadioButton(PdfFormField radiogroup, String value, float llx, float lly, float urx, float ury) {
- PdfFormField radio = PdfFormField.createEmpty(writer);
- radio.setWidget(new Rectangle(llx, lly, urx, ury), PdfAnnotation.HIGHLIGHT_TOGGLE);
- String name = ((PdfName)radiogroup.get(PdfName.V)).toString().substring(1);
- if (name.equals(value)) {
- radio.setAppearanceState(value);
- }
- else {
- radio.setAppearanceState("Off");
- }
- drawRadioAppearences(radio, value, llx, lly, urx, ury);
- radiogroup.addKid(radio);
- return radio;
- }
-
- /**
- * @param field
- * @param value
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- */
- public void drawRadioAppearences(PdfFormField field, String value, float llx, float lly, float urx, float ury) {
- PdfContentByte cb = writer.getDirectContent();
- PdfAppearance tpOn = cb.createAppearance(urx - llx, ury - lly);
- tpOn.drawRadioField(0f, 0f, urx - llx, ury - lly, true);
- field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, value, tpOn);
- PdfAppearance tpOff = cb.createAppearance(urx - llx, ury - lly);
- tpOff.drawRadioField(0f, 0f, urx - llx, ury - lly, false);
- field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpOff);
- }
-
- /**
- * @param name
- * @param options
- * @param defaultValue
- * @param font
- * @param fontSize
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @return a PdfFormField
- */
- public PdfFormField addSelectList(String name, String[] options, String defaultValue, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) {
- PdfFormField choice = PdfFormField.createList(writer, options, 0);
- setChoiceParams(choice, name, defaultValue, llx, lly, urx, ury);
- StringBuffer text = new StringBuffer();
- for (int i = 0; i < options.length; i++) {
- text.append(options[i]).append("\n");
- }
- drawMultiLineOfText(choice, text.toString(), font, fontSize, llx, lly, urx, ury);
- addFormField(choice);
- return choice;
- }
-
- /**
- * @param name
- * @param options
- * @param defaultValue
- * @param font
- * @param fontSize
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @return a PdfFormField
- */
- public PdfFormField addSelectList(String name, String[][] options, String defaultValue, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) {
- PdfFormField choice = PdfFormField.createList(writer, options, 0);
- setChoiceParams(choice, name, defaultValue, llx, lly, urx, ury);
- StringBuffer text = new StringBuffer();
- for (int i = 0; i < options.length; i++) {
- text.append(options[i][1]).append("\n");
- }
- drawMultiLineOfText(choice, text.toString(), font, fontSize, llx, lly, urx, ury);
- addFormField(choice);
- return choice;
- }
-
- /**
- * @param name
- * @param options
- * @param defaultValue
- * @param editable
- * @param font
- * @param fontSize
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @return a PdfFormField
- */
- public PdfFormField addComboBox(String name, String[] options, String defaultValue, boolean editable, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) {
- PdfFormField choice = PdfFormField.createCombo(writer, editable, options, 0);
- setChoiceParams(choice, name, defaultValue, llx, lly, urx, ury);
- if (defaultValue == null) {
- defaultValue = options[0];
- }
- drawSingleLineOfText(choice, defaultValue, font, fontSize, llx, lly, urx, ury);
- addFormField(choice);
- return choice;
- }
-
- /**
- * @param name
- * @param options
- * @param defaultValue
- * @param editable
- * @param font
- * @param fontSize
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @return a PdfFormField
- */
- public PdfFormField addComboBox(String name, String[][] options, String defaultValue, boolean editable, BaseFont font, float fontSize, float llx, float lly, float urx, float ury) {
- PdfFormField choice = PdfFormField.createCombo(writer, editable, options, 0);
- setChoiceParams(choice, name, defaultValue, llx, lly, urx, ury);
- String value = null;
- for (int i = 0; i < options.length; i++) {
- if (options[i][0].equals(defaultValue)) {
- value = options[i][1];
- break;
- }
- }
- if (value == null) {
- value = options[0][1];
- }
- drawSingleLineOfText(choice, value, font, fontSize, llx, lly, urx, ury);
- addFormField(choice);
- return choice;
- }
-
- /**
- * @param field
- * @param name
- * @param defaultValue
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- */
- public void setChoiceParams(PdfFormField field, String name, String defaultValue, float llx, float lly, float urx, float ury) {
- field.setWidget(new Rectangle(llx, lly, urx, ury), PdfAnnotation.HIGHLIGHT_INVERT);
- if (defaultValue != null) {
- field.setValueAsString(defaultValue);
- field.setDefaultValueAsString(defaultValue);
- }
- field.setFieldName(name);
- field.setFlags(PdfAnnotation.FLAGS_PRINT);
- field.setPage();
- field.setBorderStyle(new PdfBorderDictionary(2, PdfBorderDictionary.STYLE_SOLID));
- }
-
- /**
- * @param name
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @return a PdfFormField
- */
- public PdfFormField addSignature(String name,
- float llx, float lly, float urx, float ury) {
- PdfFormField signature = PdfFormField.createSignature(writer);
- setSignatureParams(signature, name, llx, lly, urx, ury);
- drawSignatureAppearences(signature, llx, lly, urx, ury);
- addFormField(signature);
- return signature;
- }
-
- /**
- * @param field
- * @param name
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- */
- public void setSignatureParams(PdfFormField field, String name,
- float llx, float lly, float urx, float ury) {
- field.setWidget(new Rectangle(llx, lly, urx, ury), PdfAnnotation.HIGHLIGHT_INVERT);
- field.setFieldName(name);
- field.setFlags(PdfAnnotation.FLAGS_PRINT);
- field.setPage();
- field.setMKBorderColor(java.awt.Color.black);
- field.setMKBackgroundColor(java.awt.Color.white);
- }
-
- /**
- * @param field
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- */
- public void drawSignatureAppearences(PdfFormField field,
- float llx, float lly, float urx, float ury) {
- PdfContentByte cb = writer.getDirectContent();
- PdfAppearance tp = cb.createAppearance(urx - llx, ury - lly);
- tp.setGrayFill(1.0f);
- tp.rectangle(0, 0, urx - llx, ury - lly);
- tp.fill();
- tp.setGrayStroke(0);
- tp.setLineWidth(1);
- tp.rectangle(0.5f, 0.5f, urx - llx - 0.5f, ury - lly - 0.5f);
- tp.closePathStroke();
- tp.saveState();
- tp.rectangle(1, 1, urx - llx - 2, ury - lly - 2);
- tp.clip();
- tp.newPath();
- tp.restoreState();
- field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp);
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfAction.java b/LibrarySource/com/lowagie/text/pdf/PdfAction.java
deleted file mode 100644
index 8442abc..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfAction.java
+++ /dev/null
@@ -1,558 +0,0 @@
-/*
- * $Id: PdfAction.java,v 1.64 2005/01/06 09:40:10 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.net.URL;
-import com.lowagie.text.ExceptionConverter;
-import java.io.IOException;
-import java.util.ArrayList;
-
-/**
- * A <CODE>PdfAction</CODE> defines an action that can be triggered from a PDF file.
- *
- * @see PdfDictionary
- */
-
-public class PdfAction extends PdfDictionary {
-
- /** A named action to go to the first page.
- */
- public static final int FIRSTPAGE = 1;
- /** A named action to go to the previous page.
- */
- public static final int PREVPAGE = 2;
- /** A named action to go to the next page.
- */
- public static final int NEXTPAGE = 3;
- /** A named action to go to the last page.
- */
- public static final int LASTPAGE = 4;
-
- /** A named action to open a print dialog.
- */
- public static final int PRINTDIALOG = 5;
-
- /** a possible submitvalue */
- public static final int SUBMIT_EXCLUDE = 1;
- /** a possible submitvalue */
- public static final int SUBMIT_INCLUDE_NO_VALUE_FIELDS = 2;
- /** a possible submitvalue */
- public static final int SUBMIT_HTML_FORMAT = 4;
- /** a possible submitvalue */
- public static final int SUBMIT_HTML_GET = 8;
- /** a possible submitvalue */
- public static final int SUBMIT_COORDINATES = 16;
- /** a possible submitvalue */
- public static final int SUBMIT_XFDF = 32;
- /** a possible submitvalue */
- public static final int SUBMIT_INCLUDE_APPEND_SAVES = 64;
- /** a possible submitvalue */
- public static final int SUBMIT_INCLUDE_ANNOTATIONS = 128;
- /** a possible submitvalue */
- public static final int SUBMIT_PDF = 256;
- /** a possible submitvalue */
- public static final int SUBMIT_CANONICAL_FORMAT = 512;
- /** a possible submitvalue */
- public static final int SUBMIT_EXCL_NON_USER_ANNOTS = 1024;
- /** a possible submitvalue */
- public static final int SUBMIT_EXCL_F_KEY = 2048;
- /** a possible submitvalue */
- public static final int SUBMIT_EMBED_FORM = 8196;
- /** a possible submitvalue */
- public static final int RESET_EXCLUDE = 1;
-
- // constructors
-
- /** Create an empty action.
- */
- public PdfAction() {
- }
-
- /**
- * Constructs a new <CODE>PdfAction</CODE> of Subtype URI.
- *
- * @param url the Url to go to
- */
-
- public PdfAction(URL url) {
- this(url.toExternalForm());
- }
-
- /**
- * Construct a new <CODE>PdfAction</CODE> of Subtype URI that accepts the x and y coordinate of the position that was clicked.
- * @param url
- * @param isMap
- */
- public PdfAction(URL url, boolean isMap) {
- this(url.toExternalForm(), isMap);
- }
-
- /**
- * Constructs a new <CODE>PdfAction</CODE> of Subtype URI.
- *
- * @param url the url to go to
- */
-
- public PdfAction(String url) {
- this(url, false);
- }
-
- /**
- * Construct a new <CODE>PdfAction</CODE> of Subtype URI that accepts the x and y coordinate of the position that was clicked.
- * @param url
- * @param isMap
- */
-
- public PdfAction(String url, boolean isMap) {
- put(PdfName.S, PdfName.URI);
- put(PdfName.URI, new PdfString(url));
- if (isMap)
- put(PdfName.ISMAP, PdfBoolean.PDFTRUE);
- }
-
- /**
- * Constructs a new <CODE>PdfAction</CODE> of Subtype GoTo.
- * @param destination the destination to go to
- */
-
- PdfAction(PdfIndirectReference destination) {
- put(PdfName.S, PdfName.GOTO);
- put(PdfName.D, destination);
- }
-
- /**
- * Constructs a new <CODE>PdfAction</CODE> of Subtype GoToR.
- * @param filename the file name to go to
- * @param name the named destination to go to
- */
-
- public PdfAction(String filename, String name) {
- put(PdfName.S, PdfName.GOTOR);
- put(PdfName.F, new PdfString(filename));
- put(PdfName.D, new PdfString(name));
- }
-
- /**
- * Constructs a new <CODE>PdfAction</CODE> of Subtype GoToR.
- * @param filename the file name to go to
- * @param page the page destination to go to
- */
-
- public PdfAction(String filename, int page) {
- put(PdfName.S, PdfName.GOTOR);
- put(PdfName.F, new PdfString(filename));
- put(PdfName.D, new PdfLiteral("[" + (page - 1) + " /FitH 10000]"));
- }
-
- /** Implements name actions. The action can be FIRSTPAGE, LASTPAGE,
- * NEXTPAGE, PREVPAGE and PRINTDIALOG.
- * @param named the named action
- */
- public PdfAction(int named) {
- put(PdfName.S, PdfName.NAMED);
- switch (named) {
- case FIRSTPAGE:
- put(PdfName.N, PdfName.FIRSTPAGE);
- break;
- case LASTPAGE:
- put(PdfName.N, PdfName.LASTPAGE);
- break;
- case NEXTPAGE:
- put(PdfName.N, PdfName.NEXTPAGE);
- break;
- case PREVPAGE:
- put(PdfName.N, PdfName.PREVPAGE);
- break;
- case PRINTDIALOG:
- put(PdfName.S, PdfName.JAVASCRIPT);
- put(PdfName.JS, new PdfString("this.print(true);\r"));
- break;
- default:
- throw new RuntimeException("Invalid named action.");
- }
- }
-
- /** Launchs an application or a document.
- * @param application the application to be launched or the document to be opened or printed.
- * @param parameters (Windows-specific) A parameter string to be passed to the application.
- * It can be <CODE>null</CODE>.
- * @param operation (Windows-specific) the operation to perform: "open" - Open a document,
- * "print" - Print a document.
- * It can be <CODE>null</CODE>.
- * @param defaultDir (Windows-specific) the default directory in standard DOS syntax.
- * It can be <CODE>null</CODE>.
- */
- public PdfAction(String application, String parameters, String operation, String defaultDir) {
- put(PdfName.S, PdfName.LAUNCH);
- if (parameters == null && operation == null && defaultDir == null)
- put(PdfName.F, new PdfString(application));
- else {
- PdfDictionary dic = new PdfDictionary();
- dic.put(PdfName.F, new PdfString(application));
- if (parameters != null)
- dic.put(PdfName.P, new PdfString(parameters));
- if (operation != null)
- dic.put(PdfName.O, new PdfString(operation));
- if (defaultDir != null)
- dic.put(PdfName.D, new PdfString(defaultDir));
- put(PdfName.WIN, dic);
- }
- }
-
- /** Launchs an application or a document.
- * @param application the application to be launched or the document to be opened or printed.
- * @param parameters (Windows-specific) A parameter string to be passed to the application.
- * It can be <CODE>null</CODE>.
- * @param operation (Windows-specific) the operation to perform: "open" - Open a document,
- * "print" - Print a document.
- * It can be <CODE>null</CODE>.
- * @param defaultDir (Windows-specific) the default directory in standard DOS syntax.
- * It can be <CODE>null</CODE>.
- * @return a Launch action
- */
- public static PdfAction createLaunch(String application, String parameters, String operation, String defaultDir) {
- return new PdfAction(application, parameters, operation, defaultDir);
- }
-
- /**Creates a Rendition action
- * @param file
- * @param fs
- * @param mimeType
- * @param ref
- * @return a Media Clip action
- * @throws IOException
- */
- public static PdfAction rendition(String file, PdfFileSpecification fs, String mimeType, PdfIndirectReference ref) throws IOException {
- PdfAction js = new PdfAction();
- js.put(PdfName.S, PdfName.RENDITION);
- js.put(PdfName.R, new PdfRendition(file, fs, mimeType));
- js.put(new PdfName("OP"), new PdfNumber(0));
- js.put(new PdfName("AN"), ref);
- return js;
- }
-
- /** Creates a JavaScript action. If the JavaScript is smaller than
- * 50 characters it will be placed as a string, otherwise it will
- * be placed as a compressed stream.
- * @param code the JavaScript code
- * @param writer the writer for this action
- * @param unicode select JavaScript unicode. Note that the internal
- * Acrobat JavaScript engine does not support unicode,
- * so this may or may not work for you
- * @return the JavaScript action
- */
- public static PdfAction javaScript(String code, PdfWriter writer, boolean unicode) {
- PdfAction js = new PdfAction();
- js.put(PdfName.S, PdfName.JAVASCRIPT);
- if (unicode && code.length() < 50) {
- js.put(PdfName.JS, new PdfString(code, PdfObject.TEXT_UNICODE));
- }
- else if (!unicode && code.length() < 100) {
- js.put(PdfName.JS, new PdfString(code));
- }
- else {
- try {
- byte b[] = PdfEncodings.convertToBytes(code, unicode ? PdfObject.TEXT_UNICODE : PdfObject.TEXT_PDFDOCENCODING);
- PdfStream stream = new PdfStream(b);
- stream.flateCompress();
- js.put(PdfName.JS, writer.addToBody(stream).getIndirectReference());
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
- return js;
- }
-
- /** Creates a JavaScript action. If the JavaScript is smaller than
- * 50 characters it will be place as a string, otherwise it will
- * be placed as a compressed stream.
- * @param code the JavaScript code
- * @param writer the writer for this action
- * @return the JavaScript action
- */
- public static PdfAction javaScript(String code, PdfWriter writer) {
- return javaScript(code, writer, false);
- }
-
- /**
- * A Hide action hides or shows an object.
- * @param obj object to hide or show
- * @param hide true is hide, false is show
- * @return a Hide Action
- */
- static PdfAction createHide(PdfObject obj, boolean hide) {
- PdfAction action = new PdfAction();
- action.put(PdfName.S, PdfName.HIDE);
- action.put(PdfName.T, obj);
- if (!hide)
- action.put(PdfName.H, PdfBoolean.PDFFALSE);
- return action;
- }
-
- /**
- * A Hide action hides or shows an annotation.
- * @param annot
- * @param hide
- * @return A Hide Action
- */
- public static PdfAction createHide(PdfAnnotation annot, boolean hide) {
- return createHide(annot.getIndirectReference(), hide);
- }
-
- /**
- * A Hide action hides or shows an annotation.
- * @param name
- * @param hide
- * @return A Hide Action
- */
- public static PdfAction createHide(String name, boolean hide) {
- return createHide(new PdfString(name), hide);
- }
-
- static PdfArray buildArray(Object names[]) {
- PdfArray array = new PdfArray();
- for (int k = 0; k < names.length; ++k) {
- Object obj = names[k];
- if (obj instanceof String)
- array.add(new PdfString((String)obj));
- else if (obj instanceof PdfAnnotation)
- array.add(((PdfAnnotation)obj).getIndirectReference());
- else
- throw new RuntimeException("The array must contain String or PdfAnnotation.");
- }
- return array;
- }
-
- /**
- * A Hide action hides or shows objects.
- * @param names
- * @param hide
- * @return A Hide Action
- */
- public static PdfAction createHide(Object names[], boolean hide) {
- return createHide(buildArray(names), hide);
- }
-
- /**
- * Creates a submit form.
- * @param file the URI to submit the form to
- * @param names the objects to submit
- * @param flags submit properties
- * @return A PdfAction
- */
- public static PdfAction createSubmitForm(String file, Object names[], int flags) {
- PdfAction action = new PdfAction();
- action.put(PdfName.S, PdfName.SUBMITFORM);
- PdfDictionary dic = new PdfDictionary();
- dic.put(PdfName.F, new PdfString(file));
- dic.put(PdfName.FS, PdfName.URL);
- action.put(PdfName.F, dic);
- if (names != null)
- action.put(PdfName.FIELDS, buildArray(names));
- action.put(PdfName.FLAGS, new PdfNumber(flags));
- return action;
- }
-
- /**
- * Creates a resetform.
- * @param names the objects to reset
- * @param flags submit properties
- * @return A PdfAction
- */
- public static PdfAction createResetForm(Object names[], int flags) {
- PdfAction action = new PdfAction();
- action.put(PdfName.S, PdfName.RESETFORM);
- if (names != null)
- action.put(PdfName.FIELDS, buildArray(names));
- action.put(PdfName.FLAGS, new PdfNumber(flags));
- return action;
- }
-
- /**
- * Creates an Import field.
- * @param file
- * @return A PdfAction
- */
- public static PdfAction createImportData(String file) {
- PdfAction action = new PdfAction();
- action.put(PdfName.S, PdfName.IMPORTDATA);
- action.put(PdfName.F, new PdfString(file));
- return action;
- }
-
- /** Add a chained action.
- * @param na the next action
- */
- public void next(PdfAction na) {
- PdfObject nextAction = get(PdfName.NEXT);
- if (nextAction == null)
- put(PdfName.NEXT, na);
- else if (nextAction.isDictionary()) {
- PdfArray array = new PdfArray(nextAction);
- array.add(na);
- put(PdfName.NEXT, array);
- }
- else {
- ((PdfArray)nextAction).add(na);
- }
- }
-
- /** Creates a GoTo action to an internal page.
- * @param page the page to go. First page is 1
- * @param dest the destination for the page
- * @param writer the writer for this action
- * @return a GoTo action
- */
- public static PdfAction gotoLocalPage(int page, PdfDestination dest, PdfWriter writer) {
- PdfIndirectReference ref = writer.getPageReference(page);
- dest.addPage(ref);
- PdfAction action = new PdfAction();
- action.put(PdfName.S, PdfName.GOTO);
- action.put(PdfName.D, dest);
- return action;
- }
-
- /**
- * Creates a GoTo action to a named destination.
- * @param dest the named destination
- * @param isName if true sets the destination as a name, if false sets it as a String
- * @return a GoToR action
- */
- public static PdfAction gotoLocalPage(String dest, boolean isName) {
- PdfAction action = new PdfAction();
- action.put(PdfName.S, PdfName.GOTO);
- if (isName)
- action.put(PdfName.D, new PdfName(dest));
- else
- action.put(PdfName.D, new PdfString(dest, null));
- return action;
- }
-
- /**
- * Creates a GoToR action to a named destination.
- * @param filename the file name to go to
- * @param dest the destination name
- * @param isName if true sets the destination as a name, if false sets it as a String
- * @param newWindow open the document in a new window if <CODE>true</CODE>, if false the current document is replaced by the new document.
- * @return a GoToR action
- */
- public static PdfAction gotoRemotePage(String filename, String dest, boolean isName, boolean newWindow) {
- PdfAction action = new PdfAction();
- action.put(PdfName.F, new PdfString(filename));
- action.put(PdfName.S, PdfName.GOTOR);
- if (isName)
- action.put(PdfName.D, new PdfName(dest));
- else
- action.put(PdfName.D, new PdfString(dest, null));
- if (newWindow)
- action.put(PdfName.NEWWINDOW, PdfBoolean.PDFTRUE);
- return action;
- }
-
- /**
- * A set-OCG-state action (PDF 1.5) sets the state of one or more optional content
- * groups.
- * @param state an array consisting of any number of sequences beginning with a <CODE>PdfName</CODE>
- * or <CODE>String</CODE> (ON, OFF, or Toggle) followed by one or more optional content group dictionaries
- * <CODE>PdfLayer</CODE> or a <CODE>PdfIndirectReference</CODE> to a <CODE>PdfLayer</CODE>.<br>
- * The array elements are processed from left to right; each name is applied
- * to the subsequent groups until the next name is encountered:
- * <ul>
- * <li>ON sets the state of subsequent groups to ON</li>
- * <li>OFF sets the state of subsequent groups to OFF</li>
- * <li>Toggle reverses the state of subsequent groups</li>
- * </ul>
- * @param preserveRB if <CODE>true</CODE>, indicates that radio-button state relationships between optional
- * content groups (as specified by the RBGroups entry in the current configuration
- * dictionary) should be preserved when the states in the
- * <CODE>state</CODE> array are applied. That is, if a group is set to ON (either by ON or Toggle) during
- * processing of the <CODE>state</CODE> array, any other groups belong to the same radio-button
- * group are turned OFF. If a group is set to OFF, there is no effect on other groups.<br>
- * If <CODE>false</CODE>, radio-button state relationships, if any, are ignored
- * @return the action
- */
- public static PdfAction setOCGstate(ArrayList state, boolean preserveRB) {
- PdfAction action = new PdfAction();
- action.put(PdfName.S, PdfName.SETOCGSTATE);
- PdfArray a = new PdfArray();
- for (int k = 0; k < state.size(); ++k) {
- Object o = state.get(k);
- if (o == null)
- continue;
- if (o instanceof PdfIndirectReference)
- a.add((PdfIndirectReference)o);
- else if (o instanceof PdfLayer)
- a.add(((PdfLayer)o).getRef());
- else if (o instanceof PdfName)
- a.add((PdfName)o);
- else if (o instanceof String) {
- PdfName name = null;
- String s = (String)o;
- if (s.equalsIgnoreCase("on"))
- name = PdfName.ON;
- else if (s.equalsIgnoreCase("off"))
- name = PdfName.OFF;
- else if (s.equalsIgnoreCase("toggle"))
- name = PdfName.TOGGLE;
- else
- throw new IllegalArgumentException("A string '" + s + " was passed in state. Only 'ON', 'OFF' and 'Toggle' are allowed.");
- a.add(name);
- }
- else
- throw new IllegalArgumentException("Invalid type was passed in state: " + o.getClass().getName());
- }
- action.put(PdfName.STATE, a);
- if (!preserveRB)
- action.put(PdfName.PRESERVERB, PdfBoolean.PDFFALSE);
- return action;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfAnnotation.java b/LibrarySource/com/lowagie/text/pdf/PdfAnnotation.java
deleted file mode 100644
index 661aa3e..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfAnnotation.java
+++ /dev/null
@@ -1,741 +0,0 @@
-/*
- * $Id: PdfAnnotation.java,v 1.57 2005/01/06 13:42:25 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.Rectangle;
-import java.util.HashMap;
-import headless.awt.Color;
-import java.io.*;
-/**
- * A <CODE>PdfAnnotation</CODE> is a note that is associated with a page.
- *
- * @see PdfDictionary
- */
-
-public class PdfAnnotation extends PdfDictionary {
- /** highlight attributename */
- public static final PdfName HIGHLIGHT_NONE = PdfName.N;
- /** highlight attributename */
- public static final PdfName HIGHLIGHT_INVERT = PdfName.I;
- /** highlight attributename */
- public static final PdfName HIGHLIGHT_OUTLINE = PdfName.O;
- /** highlight attributename */
- public static final PdfName HIGHLIGHT_PUSH = PdfName.P;
- /** highlight attributename */
- public static final PdfName HIGHLIGHT_TOGGLE = PdfName.T;
- /** flagvalue */
- public static final int FLAGS_INVISIBLE = 1;
- /** flagvalue */
- public static final int FLAGS_HIDDEN = 2;
- /** flagvalue */
- public static final int FLAGS_PRINT = 4;
- /** flagvalue */
- public static final int FLAGS_NOZOOM = 8;
- /** flagvalue */
- public static final int FLAGS_NOROTATE = 16;
- /** flagvalue */
- public static final int FLAGS_NOVIEW = 32;
- /** flagvalue */
- public static final int FLAGS_READONLY = 64;
- /** flagvalue */
- public static final int FLAGS_LOCKED = 128;
- /** flagvalue */
- public static final int FLAGS_TOGGLENOVIEW = 256;
- /** appearance attributename */
- public static final PdfName APPEARANCE_NORMAL = PdfName.N;
- /** appearance attributename */
- public static final PdfName APPEARANCE_ROLLOVER = PdfName.R;
- /** appearance attributename */
- public static final PdfName APPEARANCE_DOWN = PdfName.D;
- /** attributevalue */
- public static final PdfName AA_ENTER = PdfName.E;
- /** attributevalue */
- public static final PdfName AA_EXIT = PdfName.X;
- /** attributevalue */
- public static final PdfName AA_DOWN = PdfName.D;
- /** attributevalue */
- public static final PdfName AA_UP = PdfName.U;
- /** attributevalue */
- public static final PdfName AA_FOCUS = PdfName.FO;
- /** attributevalue */
- public static final PdfName AA_BLUR = PdfName.BL;
- /** attributevalue */
- public static final PdfName AA_JS_KEY = PdfName.K;
- /** attributevalue */
- public static final PdfName AA_JS_FORMAT = PdfName.F;
- /** attributevalue */
- public static final PdfName AA_JS_CHANGE = PdfName.V;
- /** attributevalue */
- public static final PdfName AA_JS_OTHER_CHANGE = PdfName.C;
- /** attributevalue */
- public static final int MARKUP_HIGHLIGHT = 0;
- /** attributevalue */
- public static final int MARKUP_UNDERLINE = 1;
- /** attributevalue */
- public static final int MARKUP_STRIKEOUT = 2;
-
- protected PdfWriter writer;
- protected PdfIndirectReference reference;
- protected HashMap templates;
- protected boolean form = false;
- protected boolean annotation = true;
-
- /** Holds value of property used. */
- protected boolean used = false;
-
- /** Holds value of property placeInPage. */
- private int placeInPage = -1;
-
- // constructors
- protected PdfAnnotation(PdfWriter writer, Rectangle rect) {
- this.writer = writer;
- if (rect != null)
- put(PdfName.RECT, new PdfRectangle(rect));
- }
-
-/**
- * Constructs a new <CODE>PdfAnnotation</CODE> of subtype text.
- * @param writer
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @param title
- * @param content
- */
-
- PdfAnnotation(PdfWriter writer, float llx, float lly, float urx, float ury, PdfString title, PdfString content) {
- this.writer = writer;
- put(PdfName.SUBTYPE, PdfName.TEXT);
- put(PdfName.T, title);
- put(PdfName.RECT, new PdfRectangle(llx, lly, urx, ury));
- put(PdfName.CONTENTS, content);
- }
-
-/**
- * Constructs a new <CODE>PdfAnnotation</CODE> of subtype link (Action).
- * @param writer
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @param action
- */
-
- public PdfAnnotation(PdfWriter writer, float llx, float lly, float urx, float ury, PdfAction action) {
- this.writer = writer;
- put(PdfName.SUBTYPE, PdfName.LINK);
- put(PdfName.RECT, new PdfRectangle(llx, lly, urx, ury));
- put(PdfName.A, action);
- put(PdfName.BORDER, new PdfBorderArray(0, 0, 0));
- put(PdfName.C, new PdfColor(0x00, 0x00, 0xFF));
- }
-
- /**
- * Creates a screen PdfAnnotation
- * @param writer
- * @param rect
- * @param clipTitle
- * @param fs
- * @param mimeType
- * @param playOnDisplay
- * @return a screen PdfAnnotation
- * @throws IOException
- */
- public static PdfAnnotation createScreen(PdfWriter writer, Rectangle rect, String clipTitle, PdfFileSpecification fs,
- String mimeType, boolean playOnDisplay) throws IOException {
- PdfAnnotation ann = new PdfAnnotation(writer, rect);
- ann.put(PdfName.SUBTYPE, PdfName.SCREEN);
- ann.put (PdfName.F, new PdfNumber(FLAGS_PRINT));
- ann.put(PdfName.TYPE, PdfName.ANNOT);
- ann.setPage();
- PdfIndirectReference ref = ann.getIndirectReference();
- PdfAction action = PdfAction.rendition(clipTitle,fs,mimeType, ref);
- PdfIndirectReference actionRef = writer.addToBody(action).getIndirectReference();
- // for play on display add trigger event
- if (playOnDisplay)
- {
- PdfDictionary aa = new PdfDictionary();
- aa.put(new PdfName("PV"), actionRef);
- ann.put(PdfName.AA, aa);
- }
- ann.put(PdfName.A, actionRef);
- return ann;
- }
-
- PdfIndirectReference getIndirectReference() {
- if (reference == null) {
- reference = writer.getPdfIndirectReference();
- }
- return reference;
- }
-
- /**
- * @param writer
- * @param rect
- * @param title
- * @param contents
- * @param open
- * @param icon
- * @return a PdfAnnotation
- */
- public static PdfAnnotation createText(PdfWriter writer, Rectangle rect, String title, String contents, boolean open, String icon) {
- PdfAnnotation annot = new PdfAnnotation(writer, rect);
- annot.put(PdfName.SUBTYPE, PdfName.TEXT);
- if (title != null)
- annot.put(PdfName.T, new PdfString(title, PdfObject.TEXT_UNICODE));
- if (contents != null)
- annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
- if (open)
- annot.put(PdfName.OPEN, PdfBoolean.PDFTRUE);
- if (icon != null) {
- annot.put(PdfName.NAME, new PdfName(icon));
- }
- return annot;
- }
-
- /**
- * Creates a link.
- * @param writer
- * @param rect
- * @param highlight
- * @return A PdfAnnotation
- */
- protected static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight) {
- PdfAnnotation annot = new PdfAnnotation(writer, rect);
- annot.put(PdfName.SUBTYPE, PdfName.LINK);
- if (!highlight.equals(HIGHLIGHT_INVERT))
- annot.put(PdfName.H, highlight);
- return annot;
- }
-
- /**
- * Creates an Annotation with an Action.
- * @param writer
- * @param rect
- * @param highlight
- * @param action
- * @return A PdfAnnotation
- */
- public static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight, PdfAction action) {
- PdfAnnotation annot = createLink(writer, rect, highlight);
- annot.putEx(PdfName.A, action);
- return annot;
- }
-
- /**
- * Creates an Annotation with an local destination.
- * @param writer
- * @param rect
- * @param highlight
- * @param namedDestination
- * @return A PdfAnnotation
- */
- public static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight, String namedDestination) {
- PdfAnnotation annot = createLink(writer, rect, highlight);
- annot.put(PdfName.DEST, new PdfString(namedDestination));
- return annot;
- }
-
- /**
- * Creates an Annotation with a PdfDestination.
- * @param writer
- * @param rect
- * @param highlight
- * @param page
- * @param dest
- * @return A PdfAnnotation
- */
- public static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight, int page, PdfDestination dest) {
- PdfAnnotation annot = createLink(writer, rect, highlight);
- PdfIndirectReference ref = writer.getPageReference(page);
- dest.addPage(ref);
- annot.put(PdfName.DEST, dest);
- return annot;
- }
-
- /**
- * Add some free text to the document.
- * @param writer
- * @param rect
- * @param contents
- * @param defaultAppearance
- * @return A PdfAnnotation
- */
- public static PdfAnnotation createFreeText(PdfWriter writer, Rectangle rect, String contents, PdfContentByte defaultAppearance) {
- PdfAnnotation annot = new PdfAnnotation(writer, rect);
- annot.put(PdfName.SUBTYPE, PdfName.FREETEXT);
- annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
- annot.setDefaultAppearanceString(defaultAppearance);
- return annot;
- }
-
- /**
- * Adds a line to the document. Move over the line and a tooltip is shown.
- * @param writer
- * @param rect
- * @param contents
- * @param x1
- * @param y1
- * @param x2
- * @param y2
- * @return A PdfAnnotation
- */
- public static PdfAnnotation createLine(PdfWriter writer, Rectangle rect, String contents, float x1, float y1, float x2, float y2) {
- PdfAnnotation annot = new PdfAnnotation(writer, rect);
- annot.put(PdfName.SUBTYPE, PdfName.LINE);
- annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
- PdfArray array = new PdfArray(new PdfNumber(x1));
- array.add(new PdfNumber(y1));
- array.add(new PdfNumber(x2));
- array.add(new PdfNumber(y2));
- annot.put(PdfName.L, array);
- return annot;
- }
-
- /**
- * Adds a circle or a square that shows a tooltip when you pass over it.
- * @param writer
- * @param rect
- * @param contents The tooltip
- * @param square true if you want a square, false if you want a circle
- * @return A PdfAnnotation
- */
- public static PdfAnnotation createSquareCircle(PdfWriter writer, Rectangle rect, String contents, boolean square) {
- PdfAnnotation annot = new PdfAnnotation(writer, rect);
- if (square)
- annot.put(PdfName.SUBTYPE, PdfName.SQUARE);
- else
- annot.put(PdfName.SUBTYPE, PdfName.CIRCLE);
- annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
- return annot;
- }
-
- public static PdfAnnotation createMarkup(PdfWriter writer, Rectangle rect, String contents, int type, float quadPoints[]) {
- PdfAnnotation annot = new PdfAnnotation(writer, rect);
- PdfName name = PdfName.HIGHLIGHT;
- switch (type) {
- case MARKUP_UNDERLINE:
- name = PdfName.UNDERLINE;
- break;
- case MARKUP_STRIKEOUT:
- name = PdfName.STRIKEOUT;
- break;
- }
- annot.put(PdfName.SUBTYPE, name);
- annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
- PdfArray array = new PdfArray();
- for (int k = 0; k < quadPoints.length; ++k)
- array.add(new PdfNumber(quadPoints[k]));
- annot.put(PdfName.QUADPOINTS, array);
- return annot;
- }
-
- /**
- * Adds a Stamp to your document. Move over the stamp and a tooltip is shown
- * @param writer
- * @param rect
- * @param contents
- * @param name
- * @return A PdfAnnotation
- */
- public static PdfAnnotation createStamp(PdfWriter writer, Rectangle rect, String contents, String name) {
- PdfAnnotation annot = new PdfAnnotation(writer, rect);
- annot.put(PdfName.SUBTYPE, PdfName.STAMP);
- annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
- annot.put(PdfName.NAME, new PdfName(name));
- return annot;
- }
-
- public static PdfAnnotation createInk(PdfWriter writer, Rectangle rect, String contents, float inkList[][]) {
- PdfAnnotation annot = new PdfAnnotation(writer, rect);
- annot.put(PdfName.SUBTYPE, PdfName.INK);
- annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
- PdfArray outer = new PdfArray();
- for (int k = 0; k < inkList.length; ++k) {
- PdfArray inner = new PdfArray();
- float deep[] = inkList[k];
- for (int j = 0; j < deep.length; ++j)
- inner.add(new PdfNumber(deep[j]));
- outer.add(inner);
- }
- annot.put(PdfName.INKLIST, outer);
- return annot;
- }
-
- /** Creates a file attachment annotation.
- * @param writer the <CODE>PdfWriter</CODE>
- * @param rect the dimensions in the page of the annotation
- * @param contents the file description
- * @param fileStore an array with the file. If it's <CODE>null</CODE>
- * the file will be read from the disk
- * @param file the path to the file. It will only be used if
- * <CODE>fileStore</CODE> is not <CODE>null</CODE>
- * @param fileDisplay the actual file name stored in the pdf
- * @throws IOException on error
- * @return the annotation
- */
- public static PdfAnnotation createFileAttachment(PdfWriter writer, Rectangle rect, String contents, byte fileStore[], String file, String fileDisplay) throws IOException {
- return createFileAttachment(writer, rect, contents, PdfFileSpecification.fileEmbedded(writer, file, fileDisplay, fileStore));
- }
-
- /** Creates a file attachment annotation
- * @param writer
- * @param rect
- * @param contents
- * @param fs
- * @return the annotation
- * @throws IOException
- */
- public static PdfAnnotation createFileAttachment(PdfWriter writer, Rectangle rect, String contents, PdfFileSpecification fs) throws IOException {
- PdfAnnotation annot = new PdfAnnotation(writer, rect);
- annot.put(PdfName.SUBTYPE, PdfName.FILEATTACHMENT);
- annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
- annot.put(PdfName.FS, fs.getReference());
- return annot;
- }
-
- /**
- * Adds a popup to your document.
- * @param writer
- * @param rect
- * @param contents
- * @param open
- * @return A PdfAnnotation
- */
- public static PdfAnnotation createPopup(PdfWriter writer, Rectangle rect, String contents, boolean open) {
- PdfAnnotation annot = new PdfAnnotation(writer, rect);
- annot.put(PdfName.SUBTYPE, PdfName.POPUP);
- if (contents != null)
- annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
- if (open)
- annot.put(PdfName.OPEN, PdfBoolean.PDFTRUE);
- return annot;
- }
-
- public void setDefaultAppearanceString(PdfContentByte cb) {
- byte b[] = cb.getInternalBuffer().toByteArray();
- int len = b.length;
- for (int k = 0; k < len; ++k) {
- if (b[k] == '\n')
- b[k] = 32;
- }
- put(PdfName.DA, new PdfString(b));
- }
-
- public void setFlags(int flags) {
- if (flags == 0)
- remove(PdfName.F);
- else
- put(PdfName.F, new PdfNumber(flags));
- }
-
- public void setBorder(PdfBorderArray border) {
- putDel(PdfName.BORDER, border);
- }
-
- public void setBorderStyle(PdfBorderDictionary border) {
- putDel(PdfName.BS, border);
- }
-
- /**
- * Sets the annotation's highlighting mode. The values can be
- * <CODE>HIGHLIGHT_NONE</CODE>, <CODE>HIGHLIGHT_INVERT</CODE>,
- * <CODE>HIGHLIGHT_OUTLINE</CODE> and <CODE>HIGHLIGHT_PUSH</CODE>;
- * @param highlight the annotation's highlighting mode
- */
- public void setHighlighting(PdfName highlight) {
- if (highlight.equals(HIGHLIGHT_INVERT))
- remove(PdfName.H);
- else
- put(PdfName.H, highlight);
- }
-
- public void setAppearance(PdfName ap, PdfTemplate template) {
- PdfDictionary dic = (PdfDictionary)get(PdfName.AP);
- if (dic == null)
- dic = new PdfDictionary();
- dic.put(ap, template.getIndirectReference());
- put(PdfName.AP, dic);
- if (!form)
- return;
- if (templates == null)
- templates = new HashMap();
- templates.put(template, null);
- }
-
- public void setAppearance(PdfName ap, String state, PdfTemplate template) {
- PdfDictionary dicAp = (PdfDictionary)get(PdfName.AP);
- if (dicAp == null)
- dicAp = new PdfDictionary();
-
- PdfDictionary dic;
- PdfObject obj = dicAp.get(ap);
- if (obj != null && obj.isDictionary())
- dic = (PdfDictionary)obj;
- else
- dic = new PdfDictionary();
- dic.put(new PdfName(state), template.getIndirectReference());
- dicAp.put(ap, dic);
- put(PdfName.AP, dicAp);
- if (!form)
- return;
- if (templates == null)
- templates = new HashMap();
- templates.put(template, null);
- }
-
- public void setAppearanceState(String state) {
- if (state == null) {
- remove(PdfName.AS);
- return;
- }
- put(PdfName.AS, new PdfName(state));
- }
-
- public void setColor(Color color) {
- putDel(PdfName.C, new PdfColor(color));
- }
-
- public void setTitle(String title) {
- if (title == null) {
- remove(PdfName.T);
- return;
- }
- put(PdfName.T, new PdfString(title, PdfObject.TEXT_UNICODE));
- }
-
- public void setPopup(PdfAnnotation popup) {
- put(PdfName.POPUP, popup.getIndirectReference());
- popup.put(PdfName.PARENT, getIndirectReference());
- }
-
- public void setAction(PdfAction action) {
- putDel(PdfName.A, action);
- }
-
- public void setAdditionalActions(PdfName key, PdfAction action) {
- PdfDictionary dic;
- PdfObject obj = get(PdfName.AA);
- if (obj != null && obj.isDictionary())
- dic = (PdfDictionary)obj;
- else
- dic = new PdfDictionary();
- dic.put(key, action);
- put(PdfName.AA, dic);
- }
-
- /** Getter for property used.
- * @return Value of property used.
- */
- public boolean isUsed() {
- return used;
- }
-
- /** Setter for property used.
- */
- void setUsed() {
- used = true;
- }
-
- HashMap getTemplates() {
- return templates;
- }
-
- /** Getter for property form.
- * @return Value of property form.
- */
- public boolean isForm() {
- return form;
- }
-
- /** Getter for property annotation.
- * @return Value of property annotation.
- */
- public boolean isAnnotation() {
- return annotation;
- }
-
- public void setPage(int page) {
- put(PdfName.P, writer.getPageReference(page));
- }
-
- public void setPage() {
- put(PdfName.P, writer.getCurrentPage());
- }
-
- /** Getter for property placeInPage.
- * @return Value of property placeInPage.
- */
- public int getPlaceInPage() {
- return placeInPage;
- }
-
- /** Places the annotation in a specified page that must be greater
- * or equal to the current one. With <code>PdfStamper</code> the page
- * can be any. The first page is 1.
- * @param placeInPage New value of property placeInPage.
- */
- public void setPlaceInPage(int placeInPage) {
- this.placeInPage = placeInPage;
- }
-
- public void setRotate(int v) {
- put(PdfName.ROTATE, new PdfNumber(v));
- }
-
- PdfDictionary getMK() {
- PdfDictionary mk = (PdfDictionary)get(PdfName.MK);
- if (mk == null) {
- mk = new PdfDictionary();
- put(PdfName.MK, mk);
- }
- return mk;
- }
-
- public void setMKRotation(int rotation) {
- getMK().put(PdfName.R, new PdfNumber(rotation));
- }
-
- public static PdfArray getMKColor(Color color) {
- PdfArray array = new PdfArray();
- int type = ExtendedColor.getType(color);
- switch (type) {
- case ExtendedColor.TYPE_GRAY: {
- array.add(new PdfNumber(((GrayColor)color).getGray()));
- break;
- }
- case ExtendedColor.TYPE_CMYK: {
- CMYKColor cmyk = (CMYKColor)color;
- array.add(new PdfNumber(cmyk.getCyan()));
- array.add(new PdfNumber(cmyk.getMagenta()));
- array.add(new PdfNumber(cmyk.getYellow()));
- array.add(new PdfNumber(cmyk.getBlack()));
- break;
- }
- case ExtendedColor.TYPE_SEPARATION:
- case ExtendedColor.TYPE_PATTERN:
- case ExtendedColor.TYPE_SHADING:
- throw new RuntimeException("Separations, patterns and shadings are not allowed in MK dictionary.");
- default:
- array.add(new PdfNumber(color.getRed() / 255f));
- array.add(new PdfNumber(color.getGreen() / 255f));
- array.add(new PdfNumber(color.getBlue() / 255f));
- }
- return array;
- }
-
- public void setMKBorderColor(Color color) {
- if (color == null)
- getMK().remove(PdfName.BC);
- else
- getMK().put(PdfName.BC, getMKColor(color));
- }
-
- public void setMKBackgroundColor(Color color) {
- if (color == null)
- getMK().remove(PdfName.BG);
- else
- getMK().put(PdfName.BG, getMKColor(color));
- }
-
- public void setMKNormalCaption(String caption) {
- getMK().put(PdfName.CA, new PdfString(caption, PdfObject.TEXT_UNICODE));
- }
-
- public void setMKRolloverCaption(String caption) {
- getMK().put(PdfName.RC, new PdfString(caption, PdfObject.TEXT_UNICODE));
- }
-
- public void setMKAlternateCaption(String caption) {
- getMK().put(PdfName.AC, new PdfString(caption, PdfObject.TEXT_UNICODE));
- }
-
- public void setMKNormalIcon(PdfTemplate template) {
- getMK().put(PdfName.I, template.getIndirectReference());
- }
-
- public void setMKRolloverIcon(PdfTemplate template) {
- getMK().put(PdfName.RI, template.getIndirectReference());
- }
-
- public void setMKAlternateIcon(PdfTemplate template) {
- getMK().put(PdfName.IX, template.getIndirectReference());
- }
-
- public void setMKIconFit(PdfName scale, PdfName scalingType, float leftoverLeft, float leftoverBottom, boolean fitInBounds) {
- PdfDictionary dic = new PdfDictionary();
- if (!scale.equals(PdfName.A))
- dic.put(PdfName.SW, scale);
- if (!scalingType.equals(PdfName.P))
- dic.put(PdfName.S, scalingType);
- if (leftoverLeft != 0.5f || leftoverBottom != 0.5f) {
- PdfArray array = new PdfArray(new PdfNumber(leftoverLeft));
- array.add(new PdfNumber(leftoverBottom));
- dic.put(PdfName.A, array);
- }
- if (fitInBounds)
- dic.put(PdfName.FB, PdfBoolean.PDFTRUE);
- getMK().put(PdfName.IF, dic);
- }
-
- public void setMKTextPosition(int tp) {
- getMK().put(PdfName.TP, new PdfNumber(tp));
- }
-
- /**
- * Sets the layer this annotation belongs to.
- * @param layer the layer this annotation belongs to
- */
- public void setLayer(PdfOCG layer) {
- put(PdfName.OC, layer.getRef());
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfAppearance.java b/LibrarySource/com/lowagie/text/pdf/PdfAppearance.java
deleted file mode 100644
index 1625b61..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfAppearance.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-import com.lowagie.text.Rectangle;
-import java.util.HashMap;
-
-/**
- * Implements the appearance stream to be used with form fields..
- */
-
-public class PdfAppearance extends PdfTemplate {
-
- public static final HashMap stdFieldFontNames = new HashMap();
- static {
- stdFieldFontNames.put("Courier-BoldOblique", new PdfName("CoBO"));
- stdFieldFontNames.put("Courier-Bold", new PdfName("CoBo"));
- stdFieldFontNames.put("Courier-Oblique", new PdfName("CoOb"));
- stdFieldFontNames.put("Courier", new PdfName("Cour"));
- stdFieldFontNames.put("Helvetica-BoldOblique", new PdfName("HeBO"));
- stdFieldFontNames.put("Helvetica-Bold", new PdfName("HeBo"));
- stdFieldFontNames.put("Helvetica-Oblique", new PdfName("HeOb"));
- stdFieldFontNames.put("Helvetica", new PdfName("Helv"));
- stdFieldFontNames.put("Symbol", new PdfName("Symb"));
- stdFieldFontNames.put("Times-BoldItalic", new PdfName("TiBI"));
- stdFieldFontNames.put("Times-Bold", new PdfName("TiBo"));
- stdFieldFontNames.put("Times-Italic", new PdfName("TiIt"));
- stdFieldFontNames.put("Times-Roman", new PdfName("TiRo"));
- stdFieldFontNames.put("ZapfDingbats", new PdfName("ZaDb"));
- stdFieldFontNames.put("HYSMyeongJo-Medium", new PdfName("HySm"));
- stdFieldFontNames.put("HYGoThic-Medium", new PdfName("HyGo"));
- stdFieldFontNames.put("HeiseiKakuGo-W5", new PdfName("KaGo"));
- stdFieldFontNames.put("HeiseiMin-W3", new PdfName("KaMi"));
- stdFieldFontNames.put("MHei-Medium", new PdfName("MHei"));
- stdFieldFontNames.put("MSung-Light", new PdfName("MSun"));
- stdFieldFontNames.put("STSong-Light", new PdfName("STSo"));
- stdFieldFontNames.put("MSungStd-Light", new PdfName("MSun"));
- stdFieldFontNames.put("STSongStd-Light", new PdfName("STSo"));
- stdFieldFontNames.put("HYSMyeongJoStd-Medium", new PdfName("HySm"));
- stdFieldFontNames.put("KozMinPro-Regular", new PdfName("KaMi"));
- }
-
- /**
- *Creates a <CODE>PdfAppearance</CODE>.
- */
-
- PdfAppearance() {
- super();
- separator = ' ';
- }
-
- PdfAppearance(PdfIndirectReference iref) {
- thisReference = iref;
- }
-
- /**
- * Creates new PdfTemplate
- *
- * @param wr the <CODE>PdfWriter</CODE>
- */
-
- PdfAppearance(PdfWriter wr) {
- super(wr);
- separator = ' ';
- }
-
- /**
- * Set the font and the size for the subsequent text writing.
- *
- * @param bf the font
- * @param size the font size in points
- */
- public void setFontAndSize(BaseFont bf, float size) {
- checkWriter();
- state.size = size;
- if (bf.getFontType() == BaseFont.FONT_TYPE_DOCUMENT) {
- state.fontDetails = new FontDetails(null, ((DocumentFont)bf).getIndirectReference(), bf);
- }
- else
- state.fontDetails = writer.addSimple(bf);
- PdfName psn = (PdfName)stdFieldFontNames.get(bf.getPostscriptFontName());
- if (psn == null) {
- psn = new PdfName(bf.getPostscriptFontName());
- bf.setSubset(false);
- }
- PageResources prs = getPageResources();
-// PdfName name = state.fontDetails.getFontName();
- prs.addFont(psn, state.fontDetails.getIndirectReference());
- content.append(psn.getBytes()).append(' ').append(size).append(" Tf").append_i(separator);
- }
-
- public PdfContentByte getDuplicate() {
- PdfAppearance tpl = new PdfAppearance();
- tpl.writer = writer;
- tpl.pdf = pdf;
- tpl.thisReference = thisReference;
- tpl.pageResources = pageResources;
- tpl.bBox = new Rectangle(bBox);
- tpl.group = group;
- tpl.layer = layer;
- if (matrix != null) {
- tpl.matrix = new PdfArray(matrix);
- }
- tpl.separator = separator;
- return tpl;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfArray.java b/LibrarySource/com/lowagie/text/pdf/PdfArray.java
deleted file mode 100644
index f00f468..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfArray.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * $Id: PdfArray.java,v 1.37 2003/05/02 09:01:13 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.ListIterator;
-
-/**
- * <CODE>PdfArray</CODE> is the PDF Array object.
- * <P>
- * An array is a sequence of PDF objects. An array may contain a mixture of object types.
- * An array is written as a left square bracket ([), followed by a sequence of objects,
- * followed by a right square bracket (]).<BR>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 4.6 (page 40).
- *
- * @see PdfObject
- */
-
-public class PdfArray extends PdfObject {
-
- // membervariables
-
-/** this is the actual array of PdfObjects */
- protected ArrayList arrayList;
-
- // constructors
-
-/**
- * Constructs an empty <CODE>PdfArray</CODE>-object.
- */
-
- public PdfArray() {
- super(ARRAY);
- arrayList = new ArrayList();
- }
-
-/**
- * Constructs an <CODE>PdfArray</CODE>-object, containing 1 <CODE>PdfObject</CODE>.
- *
- * @param object a <CODE>PdfObject</CODE> that has to be added to the array
- */
-
- public PdfArray(PdfObject object) {
- super(ARRAY);
- arrayList = new ArrayList();
- arrayList.add(object);
- }
-
- public PdfArray(float values[]) {
- super(ARRAY);
- arrayList = new ArrayList();
- add(values);
- }
-
- public PdfArray(int values[]) {
- super(ARRAY);
- arrayList = new ArrayList();
- add(values);
- }
-
-/**
- * Constructs an <CODE>PdfArray</CODE>-object, containing all the <CODE>PdfObject</CODE>s in a given <CODE>PdfArray</CODE>.
- *
- * @param array a <CODE>PdfArray</CODE> that has to be added to the array
- */
-
- public PdfArray(PdfArray array) {
- super(ARRAY);
- arrayList = new ArrayList(array.getArrayList());
- }
-
- // methods overriding some methods in PdfObject
-
-/**
- * Returns the PDF representation of this <CODE>PdfArray</CODE>.
- *
- * @return an array of <CODE>byte</CODE>s
- */
-
- public void toPdf(PdfWriter writer, OutputStream os) throws IOException {
- os.write('[');
-
- Iterator i = arrayList.iterator();
- PdfObject object;
- int type = 0;
- if (i.hasNext()) {
- object = (PdfObject) i.next();
- object.toPdf(writer, os);
- }
- while (i.hasNext()) {
- object = (PdfObject) i.next();
- type = object.type();
- if (type != PdfObject.ARRAY && type != PdfObject.DICTIONARY && type != PdfObject.NAME && type != PdfObject.STRING)
- os.write(' ');
- object.toPdf(writer, os);
- }
- os.write(']');
- }
-
- // methods concerning the ArrayList-membervalue
-
-/**
- * Returns an ArrayList containing <CODE>PdfObject</CODE>s.
- *
- * @return an ArrayList
- */
-
- public ArrayList getArrayList() {
- return arrayList;
- }
-
-/**
- * Returns the number of entries in the array.
- *
- * @return the size of the ArrayList
- */
-
- public int size() {
- return arrayList.size();
- }
-
-/**
- * Adds a <CODE>PdfObject</CODE> to the <CODE>PdfArray</CODE>.
- *
- * @param object <CODE>PdfObject</CODE> to add
- * @return <CODE>true</CODE>
- */
-
- public boolean add(PdfObject object) {
- return arrayList.add(object);
- }
-
- public boolean add(float values[]) {
- for (int k = 0; k < values.length; ++k)
- arrayList.add(new PdfNumber(values[k]));
- return true;
- }
-
- public boolean add(int values[]) {
- for (int k = 0; k < values.length; ++k)
- arrayList.add(new PdfNumber(values[k]));
- return true;
- }
-
-/**
- * Adds a <CODE>PdfObject</CODE> to the <CODE>PdfArray</CODE>.
- * <P>
- * The newly added object will be the first element in the <CODE>ArrayList</CODE>.
- *
- * @param object <CODE>PdfObject</CODE> to add
- */
-
- public void addFirst(PdfObject object) {
- arrayList.add(0, object);
- }
-
-/**
- * Checks if the <CODE>PdfArray</CODE> already contains a certain <CODE>PdfObject</CODE>.
- *
- * @param object <CODE>PdfObject</CODE> to check
- * @return <CODE>true</CODE>
- */
-
- public boolean contains(PdfObject object) {
- return arrayList.contains(object);
- }
-
- public ListIterator listIterator() {
- return arrayList.listIterator();
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfBoolean.java b/LibrarySource/com/lowagie/text/pdf/PdfBoolean.java
deleted file mode 100644
index 3e7f207..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfBoolean.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * $Id: PdfBoolean.java,v 1.22 2002/06/20 13:28:22 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/**
- * <CODE>PdfBoolean</CODE> is the boolean object represented by the keywords <VAR>true</VAR> or <VAR>false</VAR>.
- * <P>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 4.2 (page 37).
- *
- * @see PdfObject
- * @see BadPdfFormatException
- */
-
-public class PdfBoolean extends PdfObject {
-
- // static membervariables (possible values of a boolean object)
- public static final PdfBoolean PDFTRUE = new PdfBoolean(true);
- public static final PdfBoolean PDFFALSE = new PdfBoolean(false);
-/** A possible value of <CODE>PdfBoolean</CODE> */
- public static final String TRUE = "true";
-
-/** A possible value of <CODE>PdfBoolean</CODE> */
- public static final String FALSE = "false";
-
- // membervariables
-
-/** the boolean value of this object */
- private boolean value;
-
- // constructors
-
-/**
- * Constructs a <CODE>PdfBoolean</CODE>-object.
- *
- * @param value the value of the new <CODE>PdfObject</CODE>
- */
-
- public PdfBoolean(boolean value) {
- super(BOOLEAN);
- if (value) {
- setContent(TRUE);
- }
- else {
- setContent(FALSE);
- }
- this.value = value;
- }
-
-/**
- * Constructs a <CODE>PdfBoolean</CODE>-object.
- *
- * @param value the value of the new <CODE>PdfObject</CODE>, represented as a <CODE>String</CODE>
- *
- * @throws BadPdfFormatException thrown if the <VAR>value</VAR> isn't '<CODE>true</CODE>' or '<CODE>false</CODE>'
- */
-
- public PdfBoolean(String value) throws BadPdfFormatException {
- super(BOOLEAN, value);
- if (value.equals(TRUE)) {
- this.value = true;
- }
- else if (value.equals(FALSE)) {
- this.value = false;
- }
- else {
- throw new BadPdfFormatException("The value has to be 'true' of 'false', instead of '" + value + "'.");
- }
- }
-
- // methods returning the value of this object
-
-/**
- * Returns the primitive value of the <CODE>PdfBoolean</CODE>-object.
- *
- * @return the actual value of the object.
- */
-
- public boolean booleanValue() {
- return value;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfBorderArray.java b/LibrarySource/com/lowagie/text/pdf/PdfBorderArray.java
deleted file mode 100644
index adfbfcf..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfBorderArray.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * $Id: PdfBorderArray.java,v 1.23 2002/07/09 11:28:22 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/**
- * A <CODE>PdfBorderArray</CODE> defines the border of a <CODE>PdfAnnotation</CODE>.
- *
- * @see PdfArray
- */
-
-public class PdfBorderArray extends PdfArray {
-
- // constructors
-
-/**
- * Constructs a new <CODE>PdfBorderArray</CODE>.
- */
-
- public PdfBorderArray(float hRadius, float vRadius, float width) {
- this(hRadius, vRadius, width, null);
- }
-
-/**
- * Constructs a new <CODE>PdfBorderArray</CODE>.
- */
-
- public PdfBorderArray(float hRadius, float vRadius, float width, PdfDashPattern dash) {
- super(new PdfNumber(hRadius));
- add(new PdfNumber(vRadius));
- add(new PdfNumber(width));
- if (dash != null)
- add(dash);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfBorderDictionary.java b/LibrarySource/com/lowagie/text/pdf/PdfBorderDictionary.java
deleted file mode 100644
index a7299de..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfBorderDictionary.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * $Id: PdfBorderDictionary.java,v 1.22 2002/06/20 13:28:20 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/**
- * A <CODE>PdfBorderDictionary</CODE> define the appearance of a Border (Annotations).
- *
- * @see PdfDictionary
- */
-
-public class PdfBorderDictionary extends PdfDictionary {
-
- public static final int STYLE_SOLID = 0;
- public static final int STYLE_DASHED = 1;
- public static final int STYLE_BEVELED = 2;
- public static final int STYLE_INSET = 3;
- public static final int STYLE_UNDERLINE = 4;
- // constructors
-
-/**
- * Constructs a <CODE>PdfBorderDictionary</CODE>.
- */
-
- public PdfBorderDictionary(float borderWidth, int borderStyle, PdfDashPattern dashes) {
- put(PdfName.W, new PdfNumber(borderWidth));
- switch (borderStyle) {
- case STYLE_SOLID:
- put(PdfName.S, PdfName.S);
- break;
- case STYLE_DASHED:
- if (dashes != null)
- put(PdfName.D, dashes);
- put(PdfName.S, PdfName.D);
- break;
- case STYLE_BEVELED:
- put(PdfName.S, PdfName.B);
- break;
- case STYLE_INSET:
- put(PdfName.S, PdfName.I);
- break;
- case STYLE_UNDERLINE:
- put(PdfName.S, PdfName.U);
- break;
- default:
- throw new IllegalArgumentException("Invalid border style.");
- }
- }
-
- public PdfBorderDictionary(float borderWidth, int borderStyle) {
- this(borderWidth, borderStyle, null);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfCell.java b/LibrarySource/com/lowagie/text/pdf/PdfCell.java
deleted file mode 100644
index 9a6bf34..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfCell.java
+++ /dev/null
@@ -1,883 +0,0 @@
-/*
- * $Id: PdfCell.java,v 1.83 2004/11/15 17:39:15 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import com.lowagie.text.*;
-
-/**
- * A <CODE>PdfCell</CODE> is the PDF translation of a <CODE>Cell</CODE>.
- * <P>
- * A <CODE>PdfCell</CODE> is an <CODE>ArrayList</CODE> of <CODE>PdfLine</CODE>s.
- * <P>
- * When using variable borders ({@link com.lowagie.text.Rectangle#isUseVariableBorders isUseVariableBorders()} == true),
- * the borders are drawn completely inside the cell Rectangle
- * so that adjacent cell borders will not overlap.
- * Otherwise, the borders are drawn on top of the edges of the
- * cell Rectangle and will overlap the borders of adjacent
- * cells.
- *
- * @see com.lowagie.text.Rectangle
- * @see com.lowagie.text.Cell
- * @see PdfLine
- * @see PdfTable
- */
-
-public class PdfCell extends Rectangle {
-
- // membervariables
-
- /**
- * These are the PdfLines in the Cell.
- */
- private ArrayList lines;
-
- /**
- * These are the PdfLines in the Cell.
- */
- private PdfLine line;
-
- /**
- * These are the Images in the Cell.
- */
- private ArrayList images;
-
- /**
- * This is the leading of the lines.
- */
- private float leading;
-
- /**
- * This is the number of the row the cell is in.
- */
- private int rownumber;
-
- /**
- * This is the rowspan of the cell.
- */
- private int rowspan;
-
- /**
- * This is the cellspacing of the cell.
- */
- private float cellspacing;
-
- /**
- * This is the cellpadding of the cell.
- */
- private float cellpadding;
-
- /**
- * Indicates if this cell belongs to the header of a <CODE>PdfTable</CODE>
- */
- private boolean header = false;
-
- /**
- * This is the total height of the content of the cell. Note that the actual cell
- * height may be larger due to another cell on the row *
- */
- private float contentHeight = 0.0f;
-
- /**
- * Indicates that the largest ascender height should be used to
- * determine the height of the first line. Setting this to true can help
- * with vertical alignment problems. */
- private boolean useAscender;
-
- /**
- * Indicates that the largest descender height should be added to the height of
- * the last line (so characters like y don't dip into the border). */
- private boolean useDescender;
-
- /**
- * Adjusts the cell contents to compensate for border widths.
- */
- private boolean useBorderPadding;
-
- private int verticalAlignment;
-
- private PdfLine firstLine;
- private PdfLine lastLine;
-
- // constructors
-
- /**
- * Constructs a <CODE>PdfCell</CODE>-object.
- *
- * @param cell the original <CODE>Cell</CODE>
- * @param rownumber the number of the <CODE>Row</CODE> the <CODE>Cell</CODE> was in.
- * @param left the left border of the <CODE>PdfCell</CODE>
- * @param right the right border of the <CODE>PdfCell</CODE>
- * @param top the top border of the <CODE>PdfCell</CODE>
- * @param cellspacing the cellspacing of the <CODE>Table</CODE>
- * @param cellpadding the cellpadding of the <CODE>Table</CODE>
- */
-
- public PdfCell(Cell cell, int rownumber, float left, float right, float top, float cellspacing, float cellpadding) {
- // constructs a Rectangle (the bottomvalue will be changed afterwards)
- super(left, top, right, top);
- // copying the other Rectangle attributes from class Cell
- cloneNonPositionParameters(cell);
- this.cellpadding = cellpadding;
- this.cellspacing = cellspacing;
- this.verticalAlignment = cell.verticalAlignment();
- this.useAscender = cell.isUseAscender();
- this.useDescender = cell.isUseDescender();
- this.useBorderPadding = cell.isUseBorderPadding();
-
- // initialisation of some parameters
- PdfChunk chunk;
- Element element;
- PdfChunk overflow;
- lines = new ArrayList();
- images = new ArrayList();
- leading = cell.leading();
- int alignment = cell.horizontalAlignment();
- left += cellspacing + cellpadding;
- right -= cellspacing + cellpadding;
-
- left += getBorderWidthInside(LEFT);
- right -= getBorderWidthInside(RIGHT);
-
-
- contentHeight = 0;
-
- rowspan = cell.rowspan();
-
- ArrayList allActions;
- int aCounter;
- // we loop over all the elements of the cell
- for (Iterator i = cell.getElements(); i.hasNext();) {
- element = (Element) i.next();
- switch (element.type()) {
- case Element.JPEG:
- case Element.IMGRAW:
- case Element.IMGTEMPLATE:
- addImage((Image) element, left, right, 0.4f * leading, alignment); //
- break;
- // if the element is a list
- case Element.LIST:
- if (line != null && line.size() > 0) {
- line.resetAlignment();
- addLine(line);
- }
- allActions = new ArrayList();
- processActions(element, null, allActions);
- aCounter = 0;
- ListItem item;
- // we loop over all the listitems
- for (Iterator items = ((List) element).getItems().iterator(); items.hasNext();) {
- item = (ListItem) items.next();
- line = new PdfLine(left + item.indentationLeft(), right, alignment, item.leading());
- line.setListItem(item);
- for (Iterator j = item.getChunks().iterator(); j.hasNext();) {
- chunk = new PdfChunk((Chunk) j.next(), (PdfAction) (allActions.get(aCounter++)));
- while ((overflow = line.add(chunk)) != null) {
- addLine(line);
- line = new PdfLine(left + item.indentationLeft(), right, alignment, item.leading());
- chunk = overflow;
- }
- line.resetAlignment();
- addLine(line);
- line = new PdfLine(left + item.indentationLeft(), right, alignment, leading);
- }
- }
- line = new PdfLine(left, right, alignment, leading);
- break;
- // if the element is something else
- default:
- allActions = new ArrayList();
- processActions(element, null, allActions);
- aCounter = 0;
-
- float currentLineLeading = leading;
- float currentLeft = left;
- float currentRight = right;
- if (element instanceof Phrase) {
- currentLineLeading = ((Phrase) element).leading();
- }
- if (element instanceof Paragraph) {
- Paragraph p = (Paragraph) element;
- currentLeft += p.indentationLeft();
- currentRight -= p.indentationRight();
- }
- if (line == null) {
- line = new PdfLine(currentLeft, currentRight, alignment, currentLineLeading);
- }
- // we loop over the chunks
- ArrayList chunks = element.getChunks();
- if (chunks.isEmpty()) {
- addLine(line); // add empty line - all cells need some lines even if they are empty
- line = new PdfLine(currentLeft, currentRight, alignment, currentLineLeading);
- }
- else {
- for (Iterator j = chunks.iterator(); j.hasNext();) {
- Chunk c = (Chunk) j.next();
- chunk = new PdfChunk(c, (PdfAction) (allActions.get(aCounter++)));
- while ((overflow = line.add(chunk)) != null) {
- addLine(line);
- line = new PdfLine(currentLeft, currentRight, alignment, currentLineLeading);
- chunk = overflow;
- }
- }
- }
- // if the element is a paragraph, section or chapter, we reset the alignment and add the line
- switch (element.type()) {
- case Element.PARAGRAPH:
- case Element.SECTION:
- case Element.CHAPTER:
- line.resetAlignment();
- flushCurrentLine();
- }
- }
- }
- flushCurrentLine();
- if (lines.size() > cell.getMaxLines()) {
- while (lines.size() > cell.getMaxLines()) {
- removeLine(lines.size() - 1);
- }
- if (cell.getMaxLines() > 0) {
- String more = cell.getShowTruncation();
- if (more != null && more.length() > 0) {
- // Denote that the content has been truncated
- lastLine = (PdfLine) lines.get(lines.size() - 1);
- if (lastLine.size() >= 0) {
- PdfChunk lastChunk = lastLine.getChunk(lastLine.size() - 1);
- float moreWidth = new PdfChunk(more, lastChunk).width();
- while (lastChunk.toString().length() > 0 && lastChunk.width() + moreWidth > right - left) {
- // Remove characters to leave room for the 'more' indicator
- lastChunk.setValue(lastChunk.toString().substring(0, lastChunk.length() - 1));
- }
- lastChunk.setValue(lastChunk.toString() + more);
- } else {
- lastLine.add(new PdfChunk(new Chunk(more), null));
- }
- }
- }
- }
- // we set some additional parameters
- if (useDescender && lastLine != null) {
- contentHeight -= lastLine.getDescender();
- }
-
- // adjust first line height so that it touches the top
- if (lines.size() > 0) {
- firstLine = (PdfLine) lines.get(0);
- float firstLineRealHeight = firstLineRealHeight();
- contentHeight -= firstLine.height();
- firstLine.height = firstLineRealHeight;
- contentHeight += firstLineRealHeight;
- }
-
- float newBottom = top - contentHeight - (2f * cellpadding()) - (2f * cellspacing());
- newBottom -= getBorderWidthInside(TOP) + getBorderWidthInside(BOTTOM);
- setBottom(newBottom);
-
- this.rownumber = rownumber;
- }
-
-
-
-
- // overriding of the Rectangle methods
-
-
- /**
- * Sets the bottom of the Rectangle and determines the proper {link #verticalOffset}
- * to appropriately align the contents vertically.
- */
- public void setBottom(float value) {
- super.setBottom(value);
- float firstLineRealHeight = firstLineRealHeight();
-
- float totalHeight = ury - value; // can't use top (already compensates for cellspacing)
- float nonContentHeight = (cellpadding() * 2f) + (cellspacing() * 2f);
- nonContentHeight += getBorderWidthInside(TOP) + getBorderWidthInside(BOTTOM);
-
- float interiorHeight = totalHeight - nonContentHeight;
- float extraHeight = 0.0f;
-
- switch (verticalAlignment) {
- case Element.ALIGN_BOTTOM:
- extraHeight = interiorHeight - contentHeight;
- break;
- case Element.ALIGN_MIDDLE:
- extraHeight = (interiorHeight - contentHeight) / 2.0f;
- break;
- default: // ALIGN_TOP
- extraHeight = 0f;
- }
-
- extraHeight += cellpadding() + cellspacing();
- extraHeight += getBorderWidthInside(TOP);
- if (firstLine != null) {
- firstLine.height = firstLineRealHeight + extraHeight;
- }
- }
-
- /**
- * Returns the lower left x-coordinaat.
- *
- * @return the lower left x-coordinaat
- */
-
- public float left() {
- return super.left(cellspacing);
- }
-
- /**
- * Returns the upper right x-coordinate.
- *
- * @return the upper right x-coordinate
- */
-
- public float right() {
- return super.right(cellspacing);
- }
-
- /**
- * Returns the upper right y-coordinate.
- *
- * @return the upper right y-coordinate
- */
-
- public float top() {
- return super.top(cellspacing);
- }
-
- /**
- * Returns the lower left y-coordinate.
- *
- * @return the lower left y-coordinate
- */
-
- public float bottom() {
- return super.bottom(cellspacing);
- }
-
- // methods
-
- private void addLine(PdfLine line) {
- lines.add(line);
- contentHeight += line.height();
- lastLine = line;
- this.line = null;
- }
-
- private PdfLine removeLine(int index) {
- PdfLine oldLine = (PdfLine) lines.remove(index);
- contentHeight -= oldLine.height();
- if (index == 0) {
- if (lines.size() > 0) {
- firstLine = (PdfLine) lines.get(0);
- float firstLineRealHeight = firstLineRealHeight();
- contentHeight -= firstLine.height();
- firstLine.height = firstLineRealHeight;
- contentHeight += firstLineRealHeight;
- }
- }
- return oldLine;
- }
-
- private void flushCurrentLine() {
- if (line != null && line.size() > 0) {
- addLine(line);
- }
- }
-
- /**
- * Calculates what the height of the first line should be so that the content will be
- * flush with the top. For text, this is the height of the ascender. For an image,
- * it is the actual height of the image.
- */
- private float firstLineRealHeight() {
- float firstLineRealHeight = 0f;
- if (firstLine != null) {
- PdfChunk chunk = firstLine.getChunk(0);
- if (chunk != null) {
- Image image = chunk.getImage();
- if (image != null) {
- firstLineRealHeight = firstLine.getChunk(0).getImage().scaledHeight();
- } else {
- firstLineRealHeight = useAscender ? firstLine.getAscender() : leading;
- }
- }
- }
- return firstLineRealHeight;
- }
-
- /**
- * Gets the amount of the border for the specified side that is inside the Rectangle.
- * For non-variable width borders this is only 1/2 the border width on that side. This
- * always returns 0 if {@link #useBorderPadding} is false;
- * @param side the side to check. One of the side constants in {@link com.lowagie.text.Rectangle}
- */
- private float getBorderWidthInside(int side) {
- float width = 0f;
- if (useBorderPadding) {
- switch (side) {
- case Rectangle.LEFT:
- width = getBorderWidthLeft();
- break;
-
- case Rectangle.RIGHT:
- width = getBorderWidthRight();
- break;
-
- case Rectangle.TOP:
- width = getBorderWidthTop();
- break;
-
- default: // default and BOTTOM
- width = getBorderWidthBottom();
- break;
- }
- // non-variable (original style) borders overlap the rectangle (only 1/2 counts)
- if (!isUseVariableBorders()) {
- width = width / 2f;
- }
- }
- return width;
- }
-
-
- /**
- * Adds an image to this Cell.
- *
- * @param i the image to add
- * @param left the left border
- * @param right the right border
- * @param extraHeight extra height to add above image
- * @param alignment horizontal alignment (constant from Element class)
- */
-
- private float addImage(Image i, float left, float right, float extraHeight, int alignment) {
- Image image = Image.getInstance(i);
- if (image.scaledWidth() > right - left) {
- image.scaleToFit(right - left, Float.MAX_VALUE);
- }
- flushCurrentLine();
- if (line == null) {
- line = new PdfLine(left, right, alignment, leading);
- }
- PdfLine imageLine = line;
-
- // left and right in chunk is relative to the start of the line
- right = right - left;
- left = 0f;
-
- if ((image.alignment() & Image.RIGHT) == Image.RIGHT) { // fix Uwe Zimmerman
- left = right - image.scaledWidth();
- } else if ((image.alignment() & Image.MIDDLE) == Image.MIDDLE) {
- left = left + ((right - left - image.scaledWidth()) / 2f);
- }
- Chunk imageChunk = new Chunk(image, left, 0);
- imageLine.add(new PdfChunk(imageChunk, null));
- addLine(imageLine);
- return imageLine.height();
- }
-
- /**
- * Gets the lines of a cell that can be drawn between certain limits.
- * <P>
- * Remark: all the lines that can be drawn are removed from the object!
- *
- * @param top the top of the part of the table that can be drawn
- * @param bottom the bottom of the part of the table that can be drawn
- * @return an <CODE>ArrayList</CODE> of <CODE>PdfLine</CODE>s
- */
-
- public ArrayList getLines(float top, float bottom) {
- float lineHeight;
- float currentPosition = Math.min(top(), top);
- setTop(currentPosition + cellspacing);
- ArrayList result = new ArrayList();
-
- // if the bottom of the page is higher than the top of the cell: do nothing
- if (top() < bottom) {
- return result;
- }
-
- // we loop over the lines
- int size = lines.size();
- boolean aboveBottom = true;
- for (int i = 0; i < size && aboveBottom; i++) {
- line = (PdfLine) lines.get(i);
- lineHeight = line.height();
- currentPosition -= lineHeight;
- // if the currentPosition is higher than the bottom, we add the line to the result
- if (currentPosition > (bottom + cellpadding + getBorderWidthInside(BOTTOM))) { // bugfix by Tom Ring and Veerendra Namineni
- result.add(line);
- } else {
- aboveBottom = false;
- }
- }
- // if the bottom of the cell is higher than the bottom of the page, the cell is written, so we can remove all lines
- float difference = 0f;
- if (!header) {
- if (aboveBottom) {
- lines = new ArrayList();
- contentHeight = 0f;
- } else {
- size = result.size();
- for (int i = 0; i < size; i++) {
- line = (PdfLine) removeLine(0);
- difference += line.height();
- }
- }
- }
- if (difference > 0) {
- Image image;
- for (Iterator i = images.iterator(); i.hasNext();) {
- image = (Image) i.next();
- image.setAbsolutePosition(image.absoluteX(), image.absoluteY() - difference - leading);
- }
- }
- return result;
- }
-
- /**
- * Gets the images of a cell that can be drawn between certain limits.
- * <P>
- * Remark: all the lines that can be drawn are removed from the object!
- *
- * @param top the top of the part of the table that can be drawn
- * @param bottom the bottom of the part of the table that can be drawn
- * @return an <CODE>ArrayList</CODE> of <CODE>Image</CODE>s
- */
-
- public ArrayList getImages(float top, float bottom) {
-
- // if the bottom of the page is higher than the top of the cell: do nothing
- if (top() < bottom) {
- return new ArrayList();
- }
- top = Math.min(top(), top);
- // initialisations
- Image image;
- float height;
- ArrayList result = new ArrayList();
- // we loop over the images
- for (Iterator i = images.iterator(); i.hasNext() && !header;) {
- image = (Image) i.next();
- height = image.absoluteY();
- // if the currentPosition is higher than the bottom, we add the line to the result
- if (top - height > (bottom + cellpadding)) {
- image.setAbsolutePosition(image.absoluteX(), top - height);
- result.add(image);
- i.remove();
- }
- }
- return result;
- }
-
- /**
- * Checks if this cell belongs to the header of a <CODE>PdfTable</CODE>.
- *
- * @return <CODE>void</CODE>
- */
-
- boolean isHeader() {
- return header;
- }
-
- /**
- * Indicates that this cell belongs to the header of a <CODE>PdfTable</CODE>.
- */
-
- void setHeader() {
- header = true;
- }
-
- /**
- * Checks if the cell may be removed.
- * <P>
- * Headers may allways be removed, even if they are drawn only partially:
- * they will be repeated on each following page anyway!
- *
- * @return <CODE>true</CODE> if all the lines are allready drawn; <CODE>false</CODE> otherwise.
- */
-
- boolean mayBeRemoved() {
- return (header || (lines.size() == 0 && images.size() == 0));
- }
-
- /**
- * Returns the number of lines in the cell.
- *
- * @return a value
- */
-
- public int size() {
- return lines.size();
- }
-
- /**
- * Returns the number of lines in the cell that are not empty.
- *
- * @return a value
- */
-
- public int remainingLines() {
- if (lines.size() == 0) return 0;
- int result = 0;
- int size = lines.size();
- PdfLine line;
- for (int i = 0; i < size; i++) {
- line = (PdfLine) lines.get(i);
- if (line.size() > 0) result++;
- }
- return result;
- }
-
- /**
- * Returns the height needed to draw the remaining text.
- *
- * @return a height
- */
-
- public float remainingHeight() {
- float result = 0f;
- for (Iterator i = images.iterator(); i.hasNext();) {
- Image image = (Image) i.next();
- result += image.scaledHeight();
- }
- return remainingLines() * leading + 2 * cellpadding + cellspacing + result + leading / 2.5f;
- }
-
- // methods to retrieve membervariables
-
- /**
- * Gets the leading of a cell.
- *
- * @return the leading of the lines is the cell.
- */
-
- public float leading() {
- return leading;
- }
-
- /**
- * Gets the number of the row this cell is in..
- *
- * @return a number
- */
-
- public int rownumber() {
- return rownumber;
- }
-
- /**
- * Gets the rowspan of a cell.
- *
- * @return the rowspan of the cell
- */
-
- public int rowspan() {
- return rowspan;
- }
-
- /**
- * Gets the cellspacing of a cell.
- *
- * @return a value
- */
-
- public float cellspacing() {
- return cellspacing;
- }
-
- /**
- * Gets the cellpadding of a cell..
- *
- * @return a value
- */
-
- public float cellpadding() {
- return cellpadding;
- }
-
- /**
- * Processes all actions contained in the cell.
- */
-
- protected void processActions(Element element, PdfAction action, ArrayList allActions) {
- if (element.type() == Element.ANCHOR) {
- String url = ((Anchor) element).reference();
- if (url != null) {
- action = new PdfAction(url);
- }
- }
- Iterator i;
- switch (element.type()) {
- case Element.PHRASE:
- case Element.SECTION:
- case Element.ANCHOR:
- case Element.CHAPTER:
- case Element.LISTITEM:
- case Element.PARAGRAPH:
- for (i = ((ArrayList) element).iterator(); i.hasNext();) {
- processActions((Element) i.next(), action, allActions);
- }
- break;
- case Element.CHUNK:
- allActions.add(action);
- break;
- case Element.LIST:
- for (i = ((List) element).getItems().iterator(); i.hasNext();) {
- processActions((Element) i.next(), action, allActions);
- }
- break;
- default:
- ArrayList tmp = element.getChunks();
- int n = element.getChunks().size();
- while (n-- > 0)
- allActions.add(action);
- break;
- }
- }
-
- /**
- * This is the number of the group the cell is in.
- */
- private int groupNumber;
-
- /**
- * Gets the number of the group this cell is in..
- *
- * @return a number
- */
-
- public int getGroupNumber() {
- return groupNumber;
- }
-
- /**
- * Sets the group number.
- */
-
- void setGroupNumber(int number) {
- groupNumber = number;
- }
-
- /**
- * Gets a Rectangle that is altered to fit on the page.
- *
- * @param top the top position
- * @param bottom the bottom position
- * @return a <CODE>Rectangle</CODE>
- */
-
- public Rectangle rectangle(float top, float bottom) {
- Rectangle tmp = new Rectangle(left(), bottom(), right(), top());
- tmp.cloneNonPositionParameters(this);
- if (top() > top) {
- tmp.setTop(top);
- tmp.setBorder(border - (border & TOP));
- }
- if (bottom() < bottom) {
- tmp.setBottom(bottom);
- tmp.setBorder(border - (border & BOTTOM));
- }
- return tmp;
- }
-
- /**
- * Sets the value of {@link #useAscender}.
- * @param use use ascender height if true
- */
- public void setUseAscender(boolean use) {
- useAscender = use;
- }
-
- /**
- * Gets the value of {@link #useAscender}
- * @return useAscender
- */
- public boolean isUseAscender() {
- return useAscender;
- }
-
- /**
- * Sets the value of {@link #useDescender}.
- * @param use use descender height if true
- */
- public void setUseDescender(boolean use) {
- useDescender = use;
- }
-
- /**
- * gets the value of {@link #useDescender }
- * @return useDescender
- */
- public boolean isUseDescender() {
- return useDescender;
- }
-
- /**
- * Sets the value of {@link #useBorderPadding}.
- * @param use adjust layour for borders if true
- */
- public void setUseBorderPadding(boolean use) {
- useBorderPadding = use;
- }
-
- /**
- * Gets the value of {@link #useBorderPadding}.
- * @return useBorderPadding
- */
- public boolean isUseBorderPadding() {
- return useBorderPadding;
- }
-
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfChunk.java b/LibrarySource/com/lowagie/text/pdf/PdfChunk.java
deleted file mode 100644
index d8316f7..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfChunk.java
+++ /dev/null
@@ -1,782 +0,0 @@
-/*
- * $Id: PdfChunk.java,v 1.70 2004/12/20 11:39:08 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import headless.awt.Color;
-
-import com.lowagie.text.Chunk;
-import com.lowagie.text.Font;
-import com.lowagie.text.Image;
-import com.lowagie.text.SplitCharacter;
-import java.util.HashMap;
-import java.util.Iterator;
-
-/**
- * A <CODE>PdfChunk</CODE> is the PDF translation of a <CODE>Chunk</CODE>.
- * <P>
- * A <CODE>PdfChunk</CODE> is a <CODE>PdfString</CODE> in a certain
- * <CODE>PdfFont</CODE> and <CODE>Color</CODE>.
- *
- * @see PdfString
- * @see PdfFont
- * @see com.lowagie.text.Chunk
- * @see com.lowagie.text.Font
- */
-
-public class PdfChunk implements SplitCharacter{
-
- private static final char singleSpace[] = {' '};
- private static final PdfChunk thisChunk[] = new PdfChunk[1];
- private static final float ITALIC_ANGLE = 0.21256f;
-/** The allowed attributes in variable <CODE>attributes</CODE>. */
- private static final HashMap keysAttributes = new HashMap();
-
-/** The allowed attributes in variable <CODE>noStroke</CODE>. */
- private static final HashMap keysNoStroke = new HashMap();
-
- static {
- keysAttributes.put(Chunk.ACTION, null);
- keysAttributes.put(Chunk.UNDERLINE, null);
- keysAttributes.put(Chunk.REMOTEGOTO, null);
- keysAttributes.put(Chunk.LOCALGOTO, null);
- keysAttributes.put(Chunk.LOCALDESTINATION, null);
- keysAttributes.put(Chunk.GENERICTAG, null);
- keysAttributes.put(Chunk.NEWPAGE, null);
- keysAttributes.put(Chunk.IMAGE, null);
- keysAttributes.put(Chunk.BACKGROUND, null);
- keysAttributes.put(Chunk.PDFANNOTATION, null);
- keysAttributes.put(Chunk.SKEW, null);
- keysAttributes.put(Chunk.HSCALE, null);
- keysNoStroke.put(Chunk.SUBSUPSCRIPT, null);
- keysNoStroke.put(Chunk.SPLITCHARACTER, null);
- keysNoStroke.put(Chunk.HYPHENATION, null);
- keysNoStroke.put(Chunk.TEXTRENDERMODE, null);
- }
-
- // membervariables
-
- /** The value of this object. */
- protected String value = PdfObject.NOTHING;
-
- /** The encoding. */
- protected String encoding = BaseFont.WINANSI;
-
-
-/** The font for this <CODE>PdfChunk</CODE>. */
- protected PdfFont font;
-
- protected BaseFont baseFont;
-
- protected SplitCharacter splitCharacter;
-/**
- * Metric attributes.
- * <P>
- * This attributes require the mesurement of characters widths when rendering
- * such as underline.
- */
- protected HashMap attributes = new HashMap();
-
-/**
- * Non metric attributes.
- * <P>
- * This attributes do not require the mesurement of characters widths when rendering
- * such as Color.
- */
- protected HashMap noStroke = new HashMap();
-
-/** <CODE>true</CODE> if the chunk split was cause by a newline. */
- protected boolean newlineSplit;
-
-/** The image in this <CODE>PdfChunk</CODE>, if it has one */
- protected Image image;
-
-/** The offset in the x direction for the image */
- protected float offsetX;
-
-/** The offset in the y direction for the image */
- protected float offsetY;
-
-/** Indicates if the height and offset of the Image has to be taken into account */
- protected boolean changeLeading = false;
-
- // constructors
-
-/**
- * Constructs a <CODE>PdfChunk</CODE>-object.
- *
- * @param string the content of the <CODE>PdfChunk</CODE>-object
- * @param other Chunk with the same style you want for the new Chunk
- */
-
- PdfChunk(String string, PdfChunk other) {
- thisChunk[0] = this;
- value = string;
- this.font = other.font;
- this.attributes = other.attributes;
- this.noStroke = other.noStroke;
- this.baseFont = other.baseFont;
- Object obj[] = (Object[])attributes.get(Chunk.IMAGE);
- if (obj == null)
- image = null;
- else {
- image = (Image)obj[0];
- offsetX = ((Float)obj[1]).floatValue();
- offsetY = ((Float)obj[2]).floatValue();
- changeLeading = ((Boolean)obj[3]).booleanValue();
- }
- encoding = font.getFont().getEncoding();
- splitCharacter = (SplitCharacter)noStroke.get(Chunk.SPLITCHARACTER);
- if (splitCharacter == null)
- splitCharacter = this;
- }
-
-/**
- * Constructs a <CODE>PdfChunk</CODE>-object.
- *
- * @param chunk the original <CODE>Chunk</CODE>-object
- * @param action the <CODE>PdfAction</CODE> if the <CODE>Chunk</CODE> comes from an <CODE>Anchor</CODE>
- */
-
- PdfChunk(Chunk chunk, PdfAction action) {
- thisChunk[0] = this;
- value = chunk.content();
-
- Font f = chunk.font();
- float size = f.size();
- if (size == Font.UNDEFINED)
- size = 12;
- baseFont = f.getBaseFont();
- int style = f.style();
- if (style == Font.UNDEFINED) {
- style = Font.NORMAL;
- }
- if (baseFont == null) {
- // translation of the font-family to a PDF font-family
- baseFont = f.getCalculatedBaseFont(false);
- }
- else {
- // bold simulation
- if ((style & Font.BOLD) != 0)
- attributes.put(Chunk.TEXTRENDERMODE, new Object[]{new Integer(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE), new Float(size / 30f), null});
- // italic simulation
- if ((style & Font.ITALIC) != 0)
- attributes.put(Chunk.SKEW, new float[]{0, ITALIC_ANGLE});
- }
- font = new PdfFont(baseFont, size);
- // other style possibilities
- HashMap attr = chunk.getAttributes();
- if (attr != null) {
- for (Iterator i = attr.keySet().iterator(); i.hasNext();) {
- Object name = i.next();
- if (keysAttributes.containsKey(name)) {
- attributes.put(name, attr.get(name));
- }
- else if (keysNoStroke.containsKey(name)) {
- noStroke.put(name, attr.get(name));
- }
- }
- if ("".equals(attr.get(Chunk.GENERICTAG))) {
- attributes.put(Chunk.GENERICTAG, chunk.content());
- }
- }
- if (f.isUnderlined()) {
- Object obj[] = {null, new float[]{0, 1f / 15, 0, -1f / 3, 0}};
- Object unders[][] = Chunk.addToArray((Object[][])attributes.get(Chunk.UNDERLINE), obj);
- attributes.put(Chunk.UNDERLINE, unders);
- }
- if (f.isStrikethru()) {
- Object obj[] = {null, new float[]{0, 1f / 15, 0, 1f / 3, 0}};
- Object unders[][] = Chunk.addToArray((Object[][])attributes.get(Chunk.UNDERLINE), obj);
- attributes.put(Chunk.UNDERLINE, unders);
- }
- if (action != null)
- attributes.put(Chunk.ACTION, action);
- // the color can't be stored in a PdfFont
- noStroke.put(Chunk.COLOR, f.color());
- noStroke.put(Chunk.ENCODING, font.getFont().getEncoding());
- Object obj[] = (Object[])attributes.get(Chunk.IMAGE);
- if (obj == null) {
- image = null;
- }
- else {
- attributes.remove(Chunk.HSCALE); // images are scaled in other ways
- image = (Image)obj[0];
- offsetX = ((Float)obj[1]).floatValue();
- offsetY = ((Float)obj[2]).floatValue();
- changeLeading = ((Boolean)obj[3]).booleanValue();
- }
- font.setImage(image);
- Float hs = (Float)attributes.get(Chunk.HSCALE);
- if (hs != null)
- font.setHorizontalScaling(hs.floatValue());
- encoding = font.getFont().getEncoding();
- splitCharacter = (SplitCharacter)noStroke.get(Chunk.SPLITCHARACTER);
- if (splitCharacter == null)
- splitCharacter = this;
- }
-
- // methods
-
- /** Gets the Unicode equivalent to a CID.
- * The (inexistent) CID <FF00> is translated as '\n'.
- * It has only meaning with CJK fonts with Identity encoding.
- * @param c the CID code
- * @return the Unicode equivalent
- */
- public char getUnicodeEquivalent(char c) {
- return baseFont.getUnicodeEquivalent(c);
- }
-
- protected int getWord(String text, int start) {
- int len = text.length();
- while (start < len) {
- if (!Character.isLetter(text.charAt(start)))
- break;
- ++start;
- }
- return start;
- }
-
-/**
- * Splits this <CODE>PdfChunk</CODE> if it's too long for the given width.
- * <P>
- * Returns <VAR>null</VAR> if the <CODE>PdfChunk</CODE> wasn't truncated.
- *
- * @param width a given width
- * @return the <CODE>PdfChunk</CODE> that doesn't fit into the width.
- */
-
- PdfChunk split(float width) {
- newlineSplit = false;
- if (image != null) {
- if (image.scaledWidth() > width) {
- PdfChunk pc = new PdfChunk(Chunk.OBJECT_REPLACEMENT_CHARACTER, this);
- value = "";
- attributes = new HashMap();
- image = null;
- font = PdfFont.getDefaultFont();
- return pc;
- }
- else
- return null;
- }
- HyphenationEvent hyphenationEvent = (HyphenationEvent)noStroke.get(Chunk.HYPHENATION);
- int currentPosition = 0;
- int splitPosition = -1;
- float currentWidth = 0;
-
- // loop over all the characters of a string
- // or until the totalWidth is reached
- int lastSpace = -1;
- float lastSpaceWidth = 0;
- int length = value.length();
- char valueArray[] = value.toCharArray();
- char character = 0;
- BaseFont ft = font.getFont();
- if (ft.getFontType() == BaseFont.FONT_TYPE_CJK && ft.getUnicodeEquivalent(' ') != ' ') {
- while (currentPosition < length) {
- // the width of every character is added to the currentWidth
- char cidChar = valueArray[currentPosition];
- character = ft.getUnicodeEquivalent(cidChar);
- // if a newLine or carriageReturn is encountered
- if (character == '\n') {
- newlineSplit = true;
- String returnValue = value.substring(currentPosition + 1);
- value = value.substring(0, currentPosition);
- if (value.length() < 1) {
- value = "\u0001";
- }
- PdfChunk pc = new PdfChunk(returnValue, this);
- return pc;
- }
- currentWidth += font.width(cidChar);
- if (character == ' ') {
- lastSpace = currentPosition + 1;
- lastSpaceWidth = currentWidth;
- }
- if (currentWidth > width)
- break;
- // if a split-character is encountered, the splitPosition is altered
- if (splitCharacter.isSplitCharacter(0, currentPosition, length, valueArray, thisChunk))
- splitPosition = currentPosition + 1;
- currentPosition++;
- }
- }
- else {
- while (currentPosition < length) {
- // the width of every character is added to the currentWidth
- character = valueArray[currentPosition];
- // if a newLine or carriageReturn is encountered
- if (character == '\r' || character == '\n') {
- newlineSplit = true;
- int inc = 1;
- if (character == '\r' && currentPosition + 1 < length && valueArray[currentPosition + 1] == '\n')
- inc = 2;
- String returnValue = value.substring(currentPosition + inc);
- value = value.substring(0, currentPosition);
- if (value.length() < 1) {
- value = " ";
- }
- PdfChunk pc = new PdfChunk(returnValue, this);
- return pc;
- }
- currentWidth += font.width(character);
- if (character == ' ') {
- lastSpace = currentPosition + 1;
- lastSpaceWidth = currentWidth;
- }
- if (currentWidth > width)
- break;
- // if a split-character is encountered, the splitPosition is altered
- if (splitCharacter.isSplitCharacter(0, currentPosition, length, valueArray, null))
- splitPosition = currentPosition + 1;
- currentPosition++;
- }
- }
-
- // if all the characters fit in the total width, null is returned (there is no overflow)
- if (currentPosition == length) {
- return null;
- }
- // otherwise, the string has to be truncated
- if (splitPosition < 0) {
- String returnValue = value;
- value = "";
- PdfChunk pc = new PdfChunk(returnValue, this);
- return pc;
- }
- if (lastSpace > splitPosition && splitCharacter.isSplitCharacter(0, 0, 1, singleSpace, null))
- splitPosition = lastSpace;
- if (hyphenationEvent != null && lastSpace < currentPosition) {
- int wordIdx = getWord(value, lastSpace);
- if (wordIdx > lastSpace) {
- String pre = hyphenationEvent.getHyphenatedWordPre(value.substring(lastSpace, wordIdx), font.getFont(), font.size(), width - lastSpaceWidth);
- String post = hyphenationEvent.getHyphenatedWordPost();
- if (pre.length() > 0) {
- String returnValue = post + value.substring(wordIdx);
- value = trim(value.substring(0, lastSpace) + pre);
- PdfChunk pc = new PdfChunk(returnValue, this);
- return pc;
- }
- }
- }
- String returnValue = value.substring(splitPosition);
- value = trim(value.substring(0, splitPosition));
- PdfChunk pc = new PdfChunk(returnValue, this);
- return pc;
- }
-
-/**
- * Truncates this <CODE>PdfChunk</CODE> if it's too long for the given width.
- * <P>
- * Returns <VAR>null</VAR> if the <CODE>PdfChunk</CODE> wasn't truncated.
- *
- * @param width a given width
- * @return the <CODE>PdfChunk</CODE> that doesn't fit into the width.
- */
-
- PdfChunk truncate(float width) {
- if (image != null) {
- if (image.scaledWidth() > width) {
- PdfChunk pc = new PdfChunk("", this);
- value = "";
- attributes.remove(Chunk.IMAGE);
- image = null;
- font = PdfFont.getDefaultFont();
- return pc;
- }
- else
- return null;
- }
-
- int currentPosition = 0;
- float currentWidth = 0;
-
- // it's no use trying to split if there isn't even enough place for a space
- if (width < font.width()) {
- String returnValue = value.substring(1);
- value = value.substring(0, 1);
- PdfChunk pc = new PdfChunk(returnValue, this);
- return pc;
- }
-
- // loop over all the characters of a string
- // or until the totalWidth is reached
- int length = value.length();
- char character;
- while (currentPosition < length) {
- // the width of every character is added to the currentWidth
- character = value.charAt(currentPosition);
- currentWidth += font.width(character);
- if (currentWidth > width)
- break;
- currentPosition++;
- }
-
- // if all the characters fit in the total width, null is returned (there is no overflow)
- if (currentPosition == length) {
- return null;
- }
-
- // otherwise, the string has to be truncated
- //currentPosition -= 2;
- // we have to chop off minimum 1 character from the chunk
- if (currentPosition == 0) {
- currentPosition = 1;
- }
- String returnValue = value.substring(currentPosition);
- value = value.substring(0, currentPosition);
- PdfChunk pc = new PdfChunk(returnValue, this);
- return pc;
- }
-
- // methods to retrieve the membervariables
-
-/**
- * Returns the font of this <CODE>Chunk</CODE>.
- *
- * @return a <CODE>PdfFont</CODE>
- */
-
- PdfFont font() {
- return font;
- }
-
-/**
- * Returns the color of this <CODE>Chunk</CODE>.
- *
- * @return a <CODE>Color</CODE>
- */
-
- Color color() {
- return (Color)noStroke.get(Chunk.COLOR);
- }
-
-/**
- * Returns the width of this <CODE>PdfChunk</CODE>.
- *
- * @return a width
- */
-
- float width() {
- return font.width(value);
- }
-
-/**
- * Checks if the <CODE>PdfChunk</CODE> split was caused by a newline.
- * @return <CODE>true</CODE> if the <CODE>PdfChunk</CODE> split was caused by a newline.
- */
-
- public boolean isNewlineSplit()
- {
- return newlineSplit;
- }
-
-/**
- * Gets the width of the <CODE>PdfChunk</CODE> taking into account the
- * extra character and word spacing.
- * @param charSpacing the extra character spacing
- * @param wordSpacing the extra word spacing
- * @return the calculated width
- */
-
- public float getWidthCorrected(float charSpacing, float wordSpacing)
- {
- if (image != null) {
- return image.scaledWidth() + charSpacing;
- }
- int numberOfSpaces = 0;
- int idx = -1;
- while ((idx = value.indexOf(' ', idx + 1)) >= 0)
- ++numberOfSpaces;
- return width() + (value.length() * charSpacing + numberOfSpaces * wordSpacing);
- }
-
- /**
- * Gets the text displacement relatiev to the baseline.
- * @return a displacement in points
- */
- public float getTextRise() {
- Float f = (Float) getAttribute(Chunk.SUBSUPSCRIPT);
- if (f != null) {
- return f.floatValue();
- }
- return 0.0f;
- }
-
-/**
- * Trims the last space.
- * @return the width of the space trimmed, otherwise 0
- */
-
- public float trimLastSpace()
- {
- BaseFont ft = font.getFont();
- if (ft.getFontType() == BaseFont.FONT_TYPE_CJK && ft.getUnicodeEquivalent(' ') != ' ') {
- if (value.length() > 1 && value.endsWith("\u0001")) {
- value = value.substring(0, value.length() - 1);
- return font.width('\u0001');
- }
- }
- else {
- if (value.length() > 1 && value.endsWith(" ")) {
- value = value.substring(0, value.length() - 1);
- return font.width(' ');
- }
- }
- return 0;
- }
-
-/**
- * Gets an attribute. The search is made in <CODE>attributes</CODE>
- * and <CODE>noStroke</CODE>.
- * @param name the attribute key
- * @return the attribute value or null if not found
- */
-
- Object getAttribute(String name)
- {
- if (attributes.containsKey(name))
- return attributes.get(name);
- return noStroke.get(name);
- }
-
-/**
- *Checks if the attribute exists.
- * @param name the attribute key
- * @return <CODE>true</CODE> if the attribute exists
- */
-
- boolean isAttribute(String name)
- {
- if (attributes.containsKey(name))
- return true;
- return noStroke.containsKey(name);
- }
-
-/**
- * Checks if this <CODE>PdfChunk</CODE> needs some special metrics handling.
- * @return <CODE>true</CODE> if this <CODE>PdfChunk</CODE> needs some special metrics handling.
- */
-
- boolean isStroked()
- {
- return (attributes.size() > 0);
- }
-
-/**
- * Checks if there is an image in the <CODE>PdfChunk</CODE>.
- * @return <CODE>true</CODE> if an image is present
- */
-
- boolean isImage()
- {
- return image != null;
- }
-
-/**
- * Gets the image in the <CODE>PdfChunk</CODE>.
- * @return the image or <CODE>null</CODE>
- */
-
- Image getImage()
- {
- return image;
- }
-
-/**
- * Sets the image offset in the x direction
- * @param offsetX the image offset in the x direction
- */
-
- void setImageOffsetX(float offsetX)
- {
- this.offsetX = offsetX;
- }
-
-/**
- * Gets the image offset in the x direction
- * @return the image offset in the x direction
- */
-
- float getImageOffsetX()
- {
- return offsetX;
- }
-
-/**
- * Sets the image offset in the y direction
- * @param offsetY the image offset in the y direction
- */
-
- void setImageOffsetY(float offsetY)
- {
- this.offsetY = offsetY;
- }
-
-/**
- * Gets the image offset in the y direction
- * @return Gets the image offset in the y direction
- */
-
- float getImageOffsetY()
- {
- return offsetY;
- }
-
-/**
- * sets the value.
- * @param value content of the Chunk
- */
-
- void setValue(String value)
- {
- this.value = value;
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return value;
- }
-
- /**
- * Tells you if this string is in Chinese, Japanese, Korean or Identity-H.
- * @return true if the Chunk has a special encoding
- */
-
- boolean isSpecialEncoding() {
- return encoding.equals(CJKFont.CJK_ENCODING) || encoding.equals(BaseFont.IDENTITY_H);
- }
-
- /**
- * Gets the encoding of this string.
- *
- * @return a <CODE>String</CODE>
- */
-
- String getEncoding() {
- return encoding;
- }
-
- int length() {
- return value.length();
- }
-/**
- * Checks if a character can be used to split a <CODE>PdfString</CODE>.
- * <P>
- * for the moment every character less than or equal to SPACE and the character '-' are 'splitCharacters'.
- *
- * @param start start position in the array
- * @param current current position in the array
- * @param end end position in the array
- * @param cc the character array that has to be checked
- * @param ck chunk array
- * @return <CODE>true</CODE> if the character can be used to split a string, <CODE>false</CODE> otherwise
- */
- public boolean isSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck) {
- char c;
- if (ck == null)
- c = cc[current];
- else
- c = ck[Math.min(current, ck.length - 1)].getUnicodeEquivalent(cc[current]);
- if (c <= ' ' || c == '-') {
- return true;
- }
- if (c < 0x2e80)
- return false;
- return ((c >= 0x2e80 && c < 0xd7a0)
- || (c >= 0xf900 && c < 0xfb00)
- || (c >= 0xfe30 && c < 0xfe50)
- || (c >= 0xff61 && c < 0xffa0));
- }
-
- boolean isExtSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck) {
- return splitCharacter.isSplitCharacter(start, current, end, cc, ck);
- }
-
-/**
- * Removes all the <VAR>' '</VAR> and <VAR>'-'</VAR>-characters on the right of a <CODE>String</CODE>.
- * <P>
- * @param string the <CODE>String<CODE> that has to be trimmed.
- * @return the trimmed <CODE>String</CODE>
- */
- String trim(String string) {
- BaseFont ft = font.getFont();
- if (ft.getFontType() == BaseFont.FONT_TYPE_CJK && ft.getUnicodeEquivalent(' ') != ' ') {
- while (string.endsWith("\u0001")) {
- string = string.substring(0, string.length() - 1);
- }
- }
- else {
- while (string.endsWith(" ") || string.endsWith("\t")) {
- string = string.substring(0, string.length() - 1);
- }
- }
- return string;
- }
-
- public boolean changeLeading() {
- return changeLeading;
- }
-
- float getCharWidth(char c) {
- if (noPrint(c))
- return 0;
- return font.width(c);
- }
-
- public static boolean noPrint(char c) {
- return ((c >= 0x200b && c <= 0x200f) || (c >= 0x202a && c <= 0x202e));
- }
-
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfColor.java b/LibrarySource/com/lowagie/text/pdf/PdfColor.java
deleted file mode 100644
index 5332630..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfColor.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * $Id: PdfColor.java,v 1.22 2002/06/20 13:28:22 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-import headless.awt.Color;
-/**
- * A <CODE>PdfColor</CODE> defines a Color (it's a <CODE>PdfArray</CODE> containing 3 values).
- *
- * @see PdfDictionary
- */
-
-class PdfColor extends PdfArray {
-
- // constructors
-
-/**
- * Constructs a new <CODE>PdfColor</CODE>.
- *
- * @param red a value between 0 and 255
- * @param green a value between 0 and 255
- * @param blue a value between 0 and 255
- */
-
- PdfColor(int red, int green, int blue) {
- super(new PdfNumber((double)(red & 0xFF) / 0xFF));
- add(new PdfNumber((double)(green & 0xFF) / 0xFF));
- add(new PdfNumber((double)(blue & 0xFF) / 0xFF));
- }
-
- PdfColor(Color color) {
- this(color.getRed(), color.getGreen(), color.getBlue());
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfContentByte.java b/LibrarySource/com/lowagie/text/pdf/PdfContentByte.java
deleted file mode 100644
index 61689f1..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfContentByte.java
+++ /dev/null
@@ -1,2728 +0,0 @@
-/*
- * $Id: PdfContentByte.java,v 1.84 2005/03/29 11:07:53 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-import headless.awt.Color;
-import java.util.ArrayList;
-import headless.awt.geom.AffineTransform;
-import headless.awt.print.PrinterJob;
-
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.Element;
-import com.lowagie.text.Image;
-import com.lowagie.text.Rectangle;
-
-/**
- * <CODE>PdfContentByte</CODE> is an object containing the user positioned
- * text and graphic contents of a page. It knows how to apply the proper
- * font encoding.
- */
-
-public class PdfContentByte {
-
- /**
- * This class keeps the graphic state of the current page
- */
-
- static class GraphicState {
-
- /** This is the font in use */
- FontDetails fontDetails;
-
- /** This is the color in use */
- ColorDetails colorDetails;
-
- /** This is the font size in use */
- float size;
-
- /** The x position of the text line matrix. */
- protected float xTLM = 0;
- /** The y position of the text line matrix. */
- protected float yTLM = 0;
-
- /** The current text leading. */
- protected float leading = 0;
- }
-
- /** The alignement is center */
- public static final int ALIGN_CENTER = Element.ALIGN_CENTER;
-
- /** The alignement is left */
- public static final int ALIGN_LEFT = Element.ALIGN_LEFT;
-
- /** The alignement is right */
- public static final int ALIGN_RIGHT = Element.ALIGN_RIGHT;
-
- /** A possible line cap value */
- public static final int LINE_CAP_BUTT = 0;
- /** A possible line cap value */
- public static final int LINE_CAP_ROUND = 1;
- /** A possible line cap value */
- public static final int LINE_CAP_PROJECTING_SQUARE = 2;
-
- /** A possible line join value */
- public static final int LINE_JOIN_MITER = 0;
- /** A possible line join value */
- public static final int LINE_JOIN_ROUND = 1;
- /** A possible line join value */
- public static final int LINE_JOIN_BEVEL = 2;
-
- /** A possible text rendering value */
- public static final int TEXT_RENDER_MODE_FILL = 0;
- /** A possible text rendering value */
- public static final int TEXT_RENDER_MODE_STROKE = 1;
- /** A possible text rendering value */
- public static final int TEXT_RENDER_MODE_FILL_STROKE = 2;
- /** A possible text rendering value */
- public static final int TEXT_RENDER_MODE_INVISIBLE = 3;
- /** A possible text rendering value */
- public static final int TEXT_RENDER_MODE_FILL_CLIP = 4;
- /** A possible text rendering value */
- public static final int TEXT_RENDER_MODE_STROKE_CLIP = 5;
- /** A possible text rendering value */
- public static final int TEXT_RENDER_MODE_FILL_STROKE_CLIP = 6;
- /** A possible text rendering value */
- public static final int TEXT_RENDER_MODE_CLIP = 7;
-
- // membervariables
-
- /** This is the actual content */
- protected ByteBuffer content = new ByteBuffer();
-
- /** This is the writer */
- protected PdfWriter writer;
-
- /** This is the PdfDocument */
- protected PdfDocument pdf;
-
- /** This is the GraphicState in use */
- protected GraphicState state = new GraphicState();
-
- /** The list were we save/restore the state */
- protected ArrayList stateList = new ArrayList();
-
- /** The list were we save/restore the layer depth */
- protected ArrayList layerDepth;
-
- /** The separator between commands.
- */
- protected int separator = '\n';
-
- // constructors
-
- /**
- * Constructs a new <CODE>PdfContentByte</CODE>-object.
- *
- * @param wr the writer associated to this content
- */
-
- public PdfContentByte(PdfWriter wr) {
- if (wr != null) {
- writer = wr;
- pdf = writer.getPdfDocument();
- }
- }
-
- // methods to get the content of this object
-
- /**
- * Returns the <CODE>String</CODE> representation of this <CODE>PdfContentByte</CODE>-object.
- *
- * @return a <CODE>String</CODE>
- */
-
- public String toString() {
- return content.toString();
- }
-
- /**
- * Gets the internal buffer.
- * @return the internal buffer
- */
- public ByteBuffer getInternalBuffer() {
- return content;
- }
-
- /** Returns the PDF representation of this <CODE>PdfContentByte</CODE>-object.
- *
- * @param writer the <CODE>PdfWriter</CODE>
- * @return a <CODE>byte</CODE> array with the representation
- */
-
- public byte[] toPdf(PdfWriter writer) {
- return content.toByteArray();
- }
-
- // methods to add graphical content
-
- /**
- * Adds the content of another <CODE>PdfContent</CODE>-object to this object.
- *
- * @param other another <CODE>PdfByteContent</CODE>-object
- */
-
- public void add(PdfContentByte other) {
- if (other.writer != null && writer != other.writer)
- throw new RuntimeException("Inconsistent writers. Are you mixing two documents?");
- content.append(other.content);
- }
-
- /**
- * Gets the x position of the text line matrix.
- *
- * @return the x position of the text line matrix
- */
- public float getXTLM() {
- return state.xTLM;
- }
-
- /**
- * Gets the y position of the text line matrix.
- *
- * @return the y position of the text line matrix
- */
- public float getYTLM() {
- return state.yTLM;
- }
-
- /**
- * Gets the current text leading.
- *
- * @return the current text leading
- */
- public float getLeading() {
- return state.leading;
- }
-
- /**
- * Changes the <VAR>Flatness</VAR>.
- * <P>
- * <VAR>Flatness</VAR> sets the maximum permitted distance in device pixels between the
- * mathematically correct path and an approximation constructed from straight line segments.<BR>
- *
- * @param flatness a value
- */
-
- public void setFlatness(float flatness) {
- if (flatness >= 0 && flatness <= 100) {
- content.append(flatness).append(" i").append_i(separator);
- }
- }
-
- /**
- * Changes the <VAR>Line cap style</VAR>.
- * <P>
- * The <VAR>line cap style</VAR> specifies the shape to be used at the end of open subpaths
- * when they are stroked.<BR>
- * Allowed values are LINE_CAP_BUTT, LINE_CAP_ROUND and LINE_CAP_PROJECTING_SQUARE.<BR>
- *
- * @param style a value
- */
-
- public void setLineCap(int style) {
- if (style >= 0 && style <= 2) {
- content.append(style).append(" J").append_i(separator);
- }
- }
-
- /**
- * Changes the value of the <VAR>line dash pattern</VAR>.
- * <P>
- * The line dash pattern controls the pattern of dashes and gaps used to stroke paths.
- * It is specified by an <I>array</I> and a <I>phase</I>. The array specifies the length
- * of the alternating dashes and gaps. The phase specifies the distance into the dash
- * pattern to start the dash.<BR>
- *
- * @param phase the value of the phase
- */
-
- public void setLineDash(float phase) {
- content.append("[] ").append(phase).append(" d").append_i(separator);
- }
-
- /**
- * Changes the value of the <VAR>line dash pattern</VAR>.
- * <P>
- * The line dash pattern controls the pattern of dashes and gaps used to stroke paths.
- * It is specified by an <I>array</I> and a <I>phase</I>. The array specifies the length
- * of the alternating dashes and gaps. The phase specifies the distance into the dash
- * pattern to start the dash.<BR>
- *
- * @param phase the value of the phase
- * @param unitsOn the number of units that must be 'on' (equals the number of units that must be 'off').
- */
-
- public void setLineDash(float unitsOn, float phase) {
- content.append("[").append(unitsOn).append("] ").append(phase).append(" d").append_i(separator);
- }
-
- /**
- * Changes the value of the <VAR>line dash pattern</VAR>.
- * <P>
- * The line dash pattern controls the pattern of dashes and gaps used to stroke paths.
- * It is specified by an <I>array</I> and a <I>phase</I>. The array specifies the length
- * of the alternating dashes and gaps. The phase specifies the distance into the dash
- * pattern to start the dash.<BR>
- *
- * @param phase the value of the phase
- * @param unitsOn the number of units that must be 'on'
- * @param unitsOff the number of units that must be 'off'
- */
-
- public void setLineDash(float unitsOn, float unitsOff, float phase) {
- content.append("[").append(unitsOn).append(' ').append(unitsOff).append("] ").append(phase).append(" d").append_i(separator);
- }
-
- /**
- * Changes the value of the <VAR>line dash pattern</VAR>.
- * <P>
- * The line dash pattern controls the pattern of dashes and gaps used to stroke paths.
- * It is specified by an <I>array</I> and a <I>phase</I>. The array specifies the length
- * of the alternating dashes and gaps. The phase specifies the distance into the dash
- * pattern to start the dash.<BR>
- *
- * @param array length of the alternating dashes and gaps
- * @param phase the value of the phase
- */
-
- public final void setLineDash(float[] array, float phase) {
- content.append("[");
- for (int i = 0; i < array.length; i++) {
- content.append(array[i]);
- if (i < array.length - 1) content.append(' ');
- }
- content.append("] ").append(phase).append(" d").append_i(separator);
- }
-
- /**
- * Changes the <VAR>Line join style</VAR>.
- * <P>
- * The <VAR>line join style</VAR> specifies the shape to be used at the corners of paths
- * that are stroked.<BR>
- * Allowed values are LINE_JOIN_MITER (Miter joins), LINE_JOIN_ROUND (Round joins) and LINE_JOIN_BEVEL (Bevel joins).<BR>
- *
- * @param style a value
- */
-
- public void setLineJoin(int style) {
- if (style >= 0 && style <= 2) {
- content.append(style).append(" j").append_i(separator);
- }
- }
-
- /**
- * Changes the <VAR>line width</VAR>.
- * <P>
- * The line width specifies the thickness of the line used to stroke a path and is measured
- * in used space units.<BR>
- *
- * @param w a width
- */
-
- public void setLineWidth(float w) {
- content.append(w).append(" w").append_i(separator);
- }
-
- /**
- * Changes the <VAR>Miter limit</VAR>.
- * <P>
- * When two line segments meet at a sharp angle and mitered joins have been specified as the
- * line join style, it is possible for the miter to extend far beyond the thickness of the line
- * stroking path. The miter limit imposes a maximum on the ratio of the miter length to the line
- * witdh. When the limit is exceeded, the join is converted from a miter to a bevel.<BR>
- *
- * @param miterLimit a miter limit
- */
-
- public void setMiterLimit(float miterLimit) {
- if (miterLimit > 1) {
- content.append(miterLimit).append(" M").append_i(separator);
- }
- }
-
- /**
- * Modify the current clipping path by intersecting it with the current path, using the
- * nonzero winding number rule to determine which regions lie inside the clipping
- * path.
- */
-
- public void clip() {
- content.append("W").append_i(separator);
- }
-
- /**
- * Modify the current clipping path by intersecting it with the current path, using the
- * even-odd rule to determine which regions lie inside the clipping path.
- */
-
- public void eoClip() {
- content.append("W*").append_i(separator);
- }
-
- /**
- * Changes the currentgray tint for filling paths (device dependent colors!).
- * <P>
- * Sets the color space to <B>DeviceGray</B> (or the <B>DefaultGray</B> color space),
- * and sets the gray tint to use for filling paths.</P>
- *
- * @param gray a value between 0 (black) and 1 (white)
- */
-
- public void setGrayFill(float gray) {
- content.append(gray).append(" g").append_i(separator);
- }
-
- /**
- * Changes the current gray tint for filling paths to black.
- */
-
- public void resetGrayFill() {
- content.append("0 g").append_i(separator);
- }
-
- /**
- * Changes the currentgray tint for stroking paths (device dependent colors!).
- * <P>
- * Sets the color space to <B>DeviceGray</B> (or the <B>DefaultGray</B> color space),
- * and sets the gray tint to use for stroking paths.</P>
- *
- * @param gray a value between 0 (black) and 1 (white)
- */
-
- public void setGrayStroke(float gray) {
- content.append(gray).append(" G").append_i(separator);
- }
-
- /**
- * Changes the current gray tint for stroking paths to black.
- */
-
- public void resetGrayStroke() {
- content.append("0 G").append_i(separator);
- }
-
- /**
- * Helper to validate and write the RGB color components
- * @param red the intensity of red. A value between 0 and 1
- * @param green the intensity of green. A value between 0 and 1
- * @param blue the intensity of blue. A value between 0 and 1
- */
- private void HelperRGB(float red, float green, float blue) {
- PdfWriter.checkPDFXConformance(writer, PdfWriter.PDFXKEY_RGB, null);
- if (red < 0)
- red = 0.0f;
- else if (red > 1.0f)
- red = 1.0f;
- if (green < 0)
- green = 0.0f;
- else if (green > 1.0f)
- green = 1.0f;
- if (blue < 0)
- blue = 0.0f;
- else if (blue > 1.0f)
- blue = 1.0f;
- content.append(red).append(' ').append(green).append(' ').append(blue);
- }
-
- /**
- * Changes the current color for filling paths (device dependent colors!).
- * <P>
- * Sets the color space to <B>DeviceRGB</B> (or the <B>DefaultRGB</B> color space),
- * and sets the color to use for filling paths.</P>
- * <P>
- * Following the PDF manual, each operand must be a number between 0 (minimum intensity) and
- * 1 (maximum intensity).</P>
- *
- * @param red the intensity of red. A value between 0 and 1
- * @param green the intensity of green. A value between 0 and 1
- * @param blue the intensity of blue. A value between 0 and 1
- */
-
- public void setRGBColorFillF(float red, float green, float blue) {
- HelperRGB(red, green, blue);
- content.append(" rg").append_i(separator);
- }
-
- /**
- * Changes the current color for filling paths to black.
- */
-
- public void resetRGBColorFill() {
- content.append("0 g").append_i(separator);
- }
-
- /**
- * Changes the current color for stroking paths (device dependent colors!).
- * <P>
- * Sets the color space to <B>DeviceRGB</B> (or the <B>DefaultRGB</B> color space),
- * and sets the color to use for stroking paths.</P>
- * <P>
- * Following the PDF manual, each operand must be a number between 0 (miniumum intensity) and
- * 1 (maximum intensity).
- *
- * @param red the intensity of red. A value between 0 and 1
- * @param green the intensity of green. A value between 0 and 1
- * @param blue the intensity of blue. A value between 0 and 1
- */
-
- public void setRGBColorStrokeF(float red, float green, float blue) {
- HelperRGB(red, green, blue);
- content.append(" RG").append_i(separator);
- }
-
- /**
- * Changes the current color for stroking paths to black.
- *
- */
-
- public void resetRGBColorStroke() {
- content.append("0 G").append_i(separator);
- }
-
- /**
- * Helper to validate and write the CMYK color components.
- *
- * @param cyan the intensity of cyan. A value between 0 and 1
- * @param magenta the intensity of magenta. A value between 0 and 1
- * @param yellow the intensity of yellow. A value between 0 and 1
- * @param black the intensity of black. A value between 0 and 1
- */
- private void HelperCMYK(float cyan, float magenta, float yellow, float black) {
- if (cyan < 0)
- cyan = 0.0f;
- else if (cyan > 1.0f)
- cyan = 1.0f;
- if (magenta < 0)
- magenta = 0.0f;
- else if (magenta > 1.0f)
- magenta = 1.0f;
- if (yellow < 0)
- yellow = 0.0f;
- else if (yellow > 1.0f)
- yellow = 1.0f;
- if (black < 0)
- black = 0.0f;
- else if (black > 1.0f)
- black = 1.0f;
- content.append(cyan).append(' ').append(magenta).append(' ').append(yellow).append(' ').append(black);
- }
-
- /**
- * Changes the current color for filling paths (device dependent colors!).
- * <P>
- * Sets the color space to <B>DeviceCMYK</B> (or the <B>DefaultCMYK</B> color space),
- * and sets the color to use for filling paths.</P>
- * <P>
- * Following the PDF manual, each operand must be a number between 0 (no ink) and
- * 1 (maximum ink).</P>
- *
- * @param cyan the intensity of cyan. A value between 0 and 1
- * @param magenta the intensity of magenta. A value between 0 and 1
- * @param yellow the intensity of yellow. A value between 0 and 1
- * @param black the intensity of black. A value between 0 and 1
- */
-
- public void setCMYKColorFillF(float cyan, float magenta, float yellow, float black) {
- HelperCMYK(cyan, magenta, yellow, black);
- content.append(" k").append_i(separator);
- }
-
- /**
- * Changes the current color for filling paths to black.
- *
- */
-
- public void resetCMYKColorFill() {
- content.append("0 0 0 1 k").append_i(separator);
- }
-
- /**
- * Changes the current color for stroking paths (device dependent colors!).
- * <P>
- * Sets the color space to <B>DeviceCMYK</B> (or the <B>DefaultCMYK</B> color space),
- * and sets the color to use for stroking paths.</P>
- * <P>
- * Following the PDF manual, each operand must be a number between 0 (miniumum intensity) and
- * 1 (maximum intensity).
- *
- * @param cyan the intensity of cyan. A value between 0 and 1
- * @param magenta the intensity of magenta. A value between 0 and 1
- * @param yellow the intensity of yellow. A value between 0 and 1
- * @param black the intensity of black. A value between 0 and 1
- */
-
- public void setCMYKColorStrokeF(float cyan, float magenta, float yellow, float black) {
- HelperCMYK(cyan, magenta, yellow, black);
- content.append(" K").append_i(separator);
- }
-
- /**
- * Changes the current color for stroking paths to black.
- *
- */
-
- public void resetCMYKColorStroke() {
- content.append("0 0 0 1 K").append_i(separator);
- }
-
- /**
- * Move the current point <I>(x, y)</I>, omitting any connecting line segment.
- *
- * @param x new x-coordinate
- * @param y new y-coordinate
- */
-
- public void moveTo(float x, float y) {
- content.append(x).append(' ').append(y).append(" m").append_i(separator);
- }
-
- /**
- * Appends a straight line segment from the current point <I>(x, y)</I>. The new current
- * point is <I>(x, y)</I>.
- *
- * @param x new x-coordinate
- * @param y new y-coordinate
- */
-
- public void lineTo(float x, float y) {
- content.append(x).append(' ').append(y).append(" l").append_i(separator);
- }
-
- /**
- * Appends a B�zier curve to the path, starting from the current point.
- *
- * @param x1 x-coordinate of the first control point
- * @param y1 y-coordinate of the first control point
- * @param x2 x-coordinate of the second control point
- * @param y2 y-coordinate of the second control point
- * @param x3 x-coordinaat of the ending point (= new current point)
- * @param y3 y-coordinaat of the ending point (= new current point)
- */
-
- public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) {
- content.append(x1).append(' ').append(y1).append(' ').append(x2).append(' ').append(y2).append(' ').append(x3).append(' ').append(y3).append(" c").append_i(separator);
- }
-
- /**
- * Appends a B�zier curve to the path, starting from the current point.
- *
- * @param x2 x-coordinate of the second control point
- * @param y2 y-coordinate of the second control point
- * @param x3 x-coordinaat of the ending point (= new current point)
- * @param y3 y-coordinaat of the ending point (= new current point)
- */
-
- public void curveTo(float x2, float y2, float x3, float y3) {
- content.append(x2).append(' ').append(y2).append(' ').append(x3).append(' ').append(y3).append(" v").append_i(separator);
- }
-
- /**
- * Appends a B�zier curve to the path, starting from the current point.
- *
- * @param x1 x-coordinate of the first control point
- * @param y1 y-coordinate of the first control point
- * @param x3 x-coordinaat of the ending point (= new current point)
- * @param y3 y-coordinaat of the ending point (= new current point)
- */
-
- public void curveFromTo(float x1, float y1, float x3, float y3) {
- content.append(x1).append(' ').append(y1).append(' ').append(x3).append(' ').append(y3).append(" y").append_i(separator);
- }
-
- /** Draws a circle. The endpoint will (x+r, y).
- *
- * @param x x center of circle
- * @param y y center of circle
- * @param r radius of circle
- */
- public void circle(float x, float y, float r) {
- float b = 0.5523f;
- moveTo(x + r, y);
- curveTo(x + r, y + r * b, x + r * b, y + r, x, y + r);
- curveTo(x - r * b, y + r, x - r, y + r * b, x - r, y);
- curveTo(x - r, y - r * b, x - r * b, y - r, x, y - r);
- curveTo(x + r * b, y - r, x + r, y - r * b, x + r, y);
- }
-
-
-
- /**
- * Adds a rectangle to the current path.
- *
- * @param x x-coordinate of the starting point
- * @param y y-coordinate of the starting point
- * @param w width
- * @param h height
- */
-
- public void rectangle(float x, float y, float w, float h) {
- content.append(x).append(' ').append(y).append(' ').append(w).append(' ').append(h).append(" re").append_i(separator);
- }
-
-
- // Contribution by Barry Richards and Prabhakar Chaganti
- /**
- * Adds a variable width border to the current path.
- * Only use if {@link com.lowagie.text.Rectangle#isUseVariableBorders() Rectangle.isUseVariableBorders}
- * = true.
- * @param rect a <CODE>Rectangle</CODE>
- */
- public void variableRectangle(Rectangle rect) {
- float limit = 0f;
- float startX = rect.left();
- float startY = rect.bottom();
-
- // start at the origin
- // draw bottom
- if (rect.getBorderWidthBottom() > limit) {
- moveTo(startX, startY);
- if (rect.getBorderColorBottom() == null)
- resetRGBColorFill();
- else
- setColorFill(rect.getBorderColorBottom());
- // DRAW BOTTOM EDGE.
- lineTo(startX + rect.width(), startY);
- // DRAW RIGHT EDGE.
- lineTo((startX + rect.width()) - rect.getBorderWidthRight(), startY + rect.getBorderWidthBottom());
- //DRAW TOP EDGE.
- lineTo((startX + rect.getBorderWidthLeft()), startY + rect.getBorderWidthBottom());
- lineTo(startX, startY);
- fill();
- }
-
- // Draw left
- if (rect.getBorderWidthLeft() > limit) {
- moveTo(startX, startY);
- if (rect.getBorderColorLeft() == null)
- resetRGBColorFill();
- else
- setColorFill(rect.getBorderColorLeft());
- // DRAW BOTTOM EDGE.
- lineTo(startX, startY + rect.height());
- // DRAW RIGHT EDGE.
- lineTo(startX + rect.getBorderWidthLeft(), (startY + rect.height()) - rect.getBorderWidthTop());
- //DRAW TOP EDGE.
- lineTo(startX + rect.getBorderWidthLeft(), startY + rect.getBorderWidthBottom());
-
- lineTo(startX, startY);
- fill();
- }
-
-
- startX = startX + rect.width();
- startY = startY + rect.height();
-
- // Draw top
- if (rect.getBorderWidthTop() > limit) {
- moveTo(startX, startY);
- if (rect.getBorderColorTop() == null)
- resetRGBColorFill();
- else
- setColorFill(rect.getBorderColorTop());
- // DRAW LONG EDGE.
- lineTo(startX - rect.width(), startY);
- // DRAW LEFT EDGE.
- lineTo(startX - rect.width() + rect.getBorderWidthLeft(), startY - rect.getBorderWidthTop());
- //DRAW SHORT EDGE.
- lineTo(startX - rect.getBorderWidthRight(), startY - rect.getBorderWidthTop());
-
- lineTo(startX, startY);
- fill();
- }
-
- // Draw Right
- if (rect.getBorderWidthRight() > limit) {
- moveTo(startX, startY);
- if (rect.getBorderColorRight() == null)
- resetRGBColorFill();
- else
- setColorFill(rect.getBorderColorRight());
- // DRAW LONG EDGE.
- lineTo(startX, startY - rect.height());
- // DRAW LEFT EDGE.
- lineTo(startX - rect.getBorderWidthRight(), startY - rect.height() + rect.getBorderWidthBottom());
- //DRAW SHORT EDGE.
- lineTo(startX - rect.getBorderWidthRight(), startY - rect.getBorderWidthTop());
-
- lineTo(startX, startY);
- fill();
- }
- resetRGBColorFill();
- }
-
- /**
- * Adds a border (complete or partially) to the current path..
- *
- * @param rectangle a <CODE>Rectangle</CODE>
- */
-
- public void rectangle(Rectangle rectangle) {
- // the coordinates of the border are retrieved
- float x1 = rectangle.left();
- float y1 = rectangle.bottom();
- float x2 = rectangle.right();
- float y2 = rectangle.top();
-
- // the backgroundcolor is set
- Color background = rectangle.backgroundColor();
- if (background != null) {
- setColorFill(background);
- rectangle(x1, y1, x2 - x1, y2 - y1);
- fill();
- resetRGBColorFill();
- }
- else if (rectangle.grayFill() > 0.0) {
- setGrayFill((float)rectangle.grayFill());
- rectangle(x1, y1, x2 - x1, y2 - y1);
- fill();
- resetGrayFill();
- }
-
-
- // if the element hasn't got any borders, nothing is added
- if (! rectangle.hasBorders()) {
- return;
- }
-
- // if any of the individual border colors are set
- // we draw the borders all around using the
- // different colors
- if (rectangle.isUseVariableBorders()) {
- variableRectangle(rectangle);
- }
- else {
- // the width is set to the width of the element
- if (rectangle.borderWidth() != Rectangle.UNDEFINED) {
- setLineWidth((float)rectangle.borderWidth());
- }
-
- // the color is set to the color of the element
- Color color = rectangle.borderColor();
- if (color != null) {
- setColorStroke(color);
- }
-
- // if the box is a rectangle, it is added as a rectangle
- if (rectangle.hasBorder(Rectangle.BOX)) {
- rectangle(x1, y1, x2 - x1, y2 - y1);
- }
- // if the border isn't a rectangle, the different sides are added apart
- else {
- if (rectangle.hasBorder(Rectangle.RIGHT)) {
- moveTo(x2, y1);
- lineTo(x2, y2);
- }
- if (rectangle.hasBorder(Rectangle.LEFT)) {
- moveTo(x1, y1);
- lineTo(x1, y2);
- }
- if (rectangle.hasBorder(Rectangle.BOTTOM)) {
- moveTo(x1, y1);
- lineTo(x2, y1);
- }
- if (rectangle.hasBorder(Rectangle.TOP)) {
- moveTo(x1, y2);
- lineTo(x2, y2);
- }
- }
-
- stroke();
-
- if (color != null) {
- resetRGBColorStroke();
- }
- }
- }
-
- /**
- * Closes the current subpath by appending a straight line segment from the current point
- * to the starting point of the subpath.
- */
-
- public void closePath() {
- content.append("h").append_i(separator);
- }
-
- /**
- * Ends the path without filling or stroking it.
- */
-
- public void newPath() {
- content.append("n").append_i(separator);
- }
-
- /**
- * Strokes the path.
- */
-
- public void stroke() {
- content.append("S").append_i(separator);
- }
-
- /**
- * Closes the path and strokes it.
- */
-
- public void closePathStroke() {
- content.append("s").append_i(separator);
- }
-
- /**
- * Fills the path, using the non-zero winding number rule to determine the region to fill.
- */
-
- public void fill() {
- content.append("f").append_i(separator);
- }
-
- /**
- * Fills the path, using the even-odd rule to determine the region to fill.
- */
-
- public void eoFill() {
- content.append("f*").append_i(separator);
- }
-
- /**
- * Fills the path using the non-zero winding number rule to determine the region to fill and strokes it.
- */
-
- public void fillStroke() {
- content.append("B").append_i(separator);
- }
-
- /**
- * Closes the path, fills it using the non-zero winding number rule to determine the region to fill and strokes it.
- */
-
- public void closePathFillStroke() {
- content.append("b").append_i(separator);
- }
-
- /**
- * Fills the path, using the even-odd rule to determine the region to fill and strokes it.
- */
-
- public void eoFillStroke() {
- content.append("B*").append_i(separator);
- }
-
- /**
- * Closes the path, fills it using the even-odd rule to determine the region to fill and strokes it.
- */
-
- public void closePathEoFillStroke() {
- content.append("b*").append_i(separator);
- }
-
- /**
- * Adds an <CODE>Image</CODE> to the page. The <CODE>Image</CODE> must have
- * absolute positioning.
- * @param image the <CODE>Image</CODE> object
- * @throws DocumentException if the <CODE>Image</CODE> does not have absolute positioning
- */
- public void addImage(Image image) throws DocumentException {
- if (!image.hasAbsolutePosition())
- throw new DocumentException("The image must have absolute positioning.");
- float matrix[] = image.matrix();
- matrix[Image.CX] = image.absoluteX() - matrix[Image.CX];
- matrix[Image.CY] = image.absoluteY() - matrix[Image.CY];
- addImage(image, matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
- }
-
- /**
- * Adds an <CODE>Image</CODE> to the page. The positioning of the <CODE>Image</CODE>
- * is done with the transformation matrix. To position an <CODE>image</CODE> at (x,y)
- * use addImage(image, image_width, 0, 0, image_height, x, y).
- * @param image the <CODE>Image</CODE> object
- * @param a an element of the transformation matrix
- * @param b an element of the transformation matrix
- * @param c an element of the transformation matrix
- * @param d an element of the transformation matrix
- * @param e an element of the transformation matrix
- * @param f an element of the transformation matrix
- * @throws DocumentException on error
- */
- public void addImage(Image image, float a, float b, float c, float d, float e, float f) throws DocumentException {
- try {
-
- if (image.isImgTemplate()) {
- writer.addDirectImageSimple(image);
- PdfTemplate template = image.templateData();
- float w = template.getWidth();
- float h = template.getHeight();
- if (image.getLayer() != null)
- beginLayer(image.getLayer());
- addTemplate(template, a / w, b / w, c / h, d / h, e, f);
- if (image.getLayer() != null)
- endLayer();
- }
- else {
- PdfName name;
- PageResources prs = getPageResources();
- Image maskImage = image.getImageMask();
- if (maskImage != null) {
- name = writer.addDirectImageSimple(maskImage);
- prs.addXObject(name, writer.getImageReference(name));
- }
- name = writer.addDirectImageSimple(image);
- name = prs.addXObject(name, writer.getImageReference(name));
- content.append("q ");
- content.append(a).append(' ');
- content.append(b).append(' ');
- content.append(c).append(' ');
- content.append(d).append(' ');
- content.append(e).append(' ');
- content.append(f).append(" cm ");
- content.append(name.getBytes()).append(" Do Q").append_i(separator);
- }
- }
- catch (Exception ee) {
- throw new DocumentException(ee);
- }
- }
-
- /**
- * Makes this <CODE>PdfContentByte</CODE> empty.
- */
- public void reset() {
- content.reset();
- stateList.clear();
- state = new GraphicState();
- }
-
- /**
- * Starts the writing of text.
- */
- public void beginText() {
- state.xTLM = 0;
- state.yTLM = 0;
- content.append("BT").append_i(separator);
- }
-
- /**
- * Ends the writing of text and makes the current font invalid.
- */
- public void endText() {
- content.append("ET").append_i(separator);
- }
-
- /**
- * Saves the graphic state. <CODE>saveState</CODE> and
- * <CODE>restoreState</CODE> must be balanced.
- */
- public void saveState() {
- content.append("q").append_i(separator);
- stateList.add(state);
- }
-
- /**
- * Restores the graphic state. <CODE>saveState</CODE> and
- * <CODE>restoreState</CODE> must be balanced.
- */
- public void restoreState() {
- content.append("Q").append_i(separator);
- int idx = stateList.size() - 1;
- if (idx < 0)
- throw new RuntimeException("Unbalanced save/restore state operators.");
- state = (GraphicState)stateList.get(idx);
- stateList.remove(idx);
- }
-
- /**
- * Sets the character spacing parameter.
- *
- * @param charSpace a parameter
- */
- public void setCharacterSpacing(float charSpace) {
- content.append(charSpace).append(" Tc").append_i(separator);
- }
-
- /**
- * Sets the word spacing parameter.
- *
- * @param wordSpace a parameter
- */
- public void setWordSpacing(float wordSpace) {
- content.append(wordSpace).append(" Tw").append_i(separator);
- }
-
- /**
- * Sets the horizontal scaling parameter.
- *
- * @param scale a parameter
- */
- public void setHorizontalScaling(float scale) {
- content.append(scale).append(" Tz").append_i(separator);
- }
-
- /**
- * Sets the text leading parameter.
- * <P>
- * The leading parameter is measured in text space units. It specifies the vertical distance
- * between the baselines of adjacent lines of text.</P>
- *
- * @param leading the new leading
- */
- public void setLeading(float leading) {
- state.leading = leading;
- content.append(leading).append(" TL").append_i(separator);
- }
-
- /**
- * Set the font and the size for the subsequent text writing.
- *
- * @param bf the font
- * @param size the font size in points
- */
- public void setFontAndSize(BaseFont bf, float size) {
- checkWriter();
- state.size = size;
- state.fontDetails = writer.addSimple(bf);
- PageResources prs = getPageResources();
- PdfName name = state.fontDetails.getFontName();
- name = prs.addFont(name, state.fontDetails.getIndirectReference());
- content.append(name.getBytes()).append(' ').append(size).append(" Tf").append_i(separator);
- }
-
- /**
- * Sets the text rendering parameter.
- *
- * @param rendering a parameter
- */
- public void setTextRenderingMode(int rendering) {
- content.append(rendering).append(" Tr").append_i(separator);
- }
-
- /**
- * Sets the text rise parameter.
- * <P>
- * This allows to write text in subscript or superscript mode.</P>
- *
- * @param rise a parameter
- */
- public void setTextRise(float rise) {
- content.append(rise).append(" Ts").append_i(separator);
- }
-
- /**
- * A helper to insert into the content stream the <CODE>text</CODE>
- * converted to bytes according to the font's encoding.
- *
- * @param text the text to write
- */
- private void showText2(String text) {
- if (state.fontDetails == null)
- throw new NullPointerException("Font and size must be set before writing any text");
- byte b[] = state.fontDetails.convertToBytes(text);
- escapeString(b, content);
- }
-
- /**
- * Shows the <CODE>text</CODE>.
- *
- * @param text the text to write
- */
- public void showText(String text) {
- showText2(text);
- content.append("Tj").append_i(separator);
- }
-
- /**
- * Constructs a kern array for a text in a certain font
- * @param text the text
- * @param font the font
- * @return a PdfTextArray
- */
- public static PdfTextArray getKernArray(String text, BaseFont font) {
- PdfTextArray pa = new PdfTextArray();
- StringBuffer acc = new StringBuffer();
- int len = text.length() - 1;
- char c[] = text.toCharArray();
- if (len >= 0)
- acc.append(c, 0, 1);
- for (int k = 0; k < len; ++k) {
- char c2 = c[k + 1];
- int kern = font.getKerning(c[k], c2);
- if (kern == 0) {
- acc.append(c2);
- }
- else {
- pa.add(acc.toString());
- acc.setLength(0);
- acc.append(c, k + 1, 1);
- pa.add(-kern);
- }
- }
- pa.add(acc.toString());
- return pa;
- }
-
- /**
- * Shows the <CODE>text</CODE> kerned.
- *
- * @param text the text to write
- */
- public void showTextKerned(String text) {
- if (state.fontDetails == null)
- throw new NullPointerException("Font and size must be set before writing any text");
- BaseFont bf = state.fontDetails.getBaseFont();
- if (bf.hasKernPairs())
- showText(getKernArray(text, bf));
- else
- showText(text);
- }
-
- /**
- * Moves to the next line and shows <CODE>text</CODE>.
- *
- * @param text the text to write
- */
- public void newlineShowText(String text) {
- state.yTLM -= state.leading;
- showText2(text);
- content.append("'").append_i(separator);
- }
-
- /**
- * Moves to the next line and shows text string, using the given values of the character and word spacing parameters.
- *
- * @param wordSpacing a parameter
- * @param charSpacing a parameter
- * @param text the text to write
- */
- public void newlineShowText(float wordSpacing, float charSpacing, String text) {
- state.yTLM -= state.leading;
- content.append(wordSpacing).append(' ').append(charSpacing);
- showText2(text);
- content.append("\"").append_i(separator);
- }
-
- /**
- * Changes the text matrix.
- * <P>
- * Remark: this operation also initializes the current point position.</P>
- *
- * @param a operand 1,1 in the matrix
- * @param b operand 1,2 in the matrix
- * @param c operand 2,1 in the matrix
- * @param d operand 2,2 in the matrix
- * @param x operand 3,1 in the matrix
- * @param y operand 3,2 in the matrix
- */
- public void setTextMatrix(float a, float b, float c, float d, float x, float y) {
- state.xTLM = x;
- state.yTLM = y;
- content.append(a).append(' ').append(b).append_i(' ')
- .append(c).append_i(' ').append(d).append_i(' ')
- .append(x).append_i(' ').append(y).append(" Tm").append_i(separator);
- }
-
- /**
- * Changes the text matrix. The first four parameters are {1,0,0,1}.
- * <P>
- * Remark: this operation also initializes the current point position.</P>
- *
- * @param x operand 3,1 in the matrix
- * @param y operand 3,2 in the matrix
- */
- public void setTextMatrix(float x, float y) {
- setTextMatrix(1, 0, 0, 1, x, y);
- }
-
- /**
- * Moves to the start of the next line, offset from the start of the current line.
- *
- * @param x x-coordinate of the new current point
- * @param y y-coordinate of the new current point
- */
- public void moveText(float x, float y) {
- state.xTLM += x;
- state.yTLM += y;
- content.append(x).append(' ').append(y).append(" Td").append_i(separator);
- }
-
- /**
- * Moves to the start of the next line, offset from the start of the current line.
- * <P>
- * As a side effect, this sets the leading parameter in the text state.</P>
- *
- * @param x offset of the new current point
- * @param y y-coordinate of the new current point
- */
- public void moveTextWithLeading(float x, float y) {
- state.xTLM += x;
- state.yTLM += y;
- state.leading = -y;
- content.append(x).append(' ').append(y).append(" TD").append_i(separator);
- }
-
- /**
- * Moves to the start of the next line.
- */
- public void newlineText() {
- state.yTLM -= state.leading;
- content.append("T*").append_i(separator);
- }
-
- /**
- * Gets the size of this content.
- *
- * @return the size of the content
- */
- int size() {
- return content.size();
- }
-
- /**
- * Escapes a <CODE>byte</CODE> array according to the PDF conventions.
- *
- * @param b the <CODE>byte</CODE> array to escape
- * @return an escaped <CODE>byte</CODE> array
- */
- static byte[] escapeString(byte b[]) {
- ByteBuffer content = new ByteBuffer();
- escapeString(b, content);
- return content.toByteArray();
- }
-
- /**
- * Escapes a <CODE>byte</CODE> array according to the PDF conventions.
- *
- * @param b the <CODE>byte</CODE> array to escape
- * @param content the content
- */
- static void escapeString(byte b[], ByteBuffer content) {
- content.append_i('(');
- for (int k = 0; k < b.length; ++k) {
- byte c = b[k];
- switch ((int)c) {
- case '\r':
- content.append("\\r");
- break;
- case '\n':
- content.append("\\n");
- break;
- case '\t':
- content.append("\\t");
- break;
- case '\b':
- content.append("\\b");
- break;
- case '\f':
- content.append("\\f");
- break;
- case '(':
- case ')':
- case '\\':
- content.append_i('\\').append_i(c);
- break;
- default:
- content.append_i(c);
- }
- }
- content.append(")");
- }
-
- /**
- * Adds an outline to the document.
- *
- * @param outline the outline
- * @deprecated not needed anymore. The outlines are extracted
- * from the root outline
- */
- public void addOutline(PdfOutline outline) {
- // for compatibility
- }
- /**
- * Adds a named outline to the document.
- *
- * @param outline the outline
- * @param name the name for the local destination
- */
- public void addOutline(PdfOutline outline, String name) {
- checkWriter();
- pdf.addOutline(outline, name);
- }
- /**
- * Gets the root outline.
- *
- * @return the root outline
- */
- public PdfOutline getRootOutline() {
- checkWriter();
- return pdf.getRootOutline();
- }
-
- /**
- * Shows text right, left or center aligned with rotation.
- * @param alignment the alignment can be ALIGN_CENTER, ALIGN_RIGHT or ALIGN_LEFT
- * @param text the text to show
- * @param x the x pivot position
- * @param y the y pivot position
- * @param rotation the rotation to be applied in degrees counterclockwise
- */
- public void showTextAligned(int alignment, String text, float x, float y, float rotation) {
- if (state.fontDetails == null)
- throw new NullPointerException("Font and size must be set before writing any text");
- BaseFont bf = state.fontDetails.getBaseFont();
- if (rotation == 0) {
- switch (alignment) {
- case ALIGN_CENTER:
- x -= bf.getWidthPoint(text, state.size) / 2;
- break;
- case ALIGN_RIGHT:
- x -= bf.getWidthPoint(text, state.size);
- break;
- }
- setTextMatrix(x, y);
- showText(text);
- }
- else {
- double alpha = rotation * Math.PI / 180.0;
- float cos = (float)Math.cos(alpha);
- float sin = (float)Math.sin(alpha);
- float len;
- switch (alignment) {
- case ALIGN_CENTER:
- len = bf.getWidthPoint(text, state.size) / 2;
- x -= len * cos;
- y -= len * sin;
- break;
- case ALIGN_RIGHT:
- len = bf.getWidthPoint(text, state.size);
- x -= len * cos;
- y -= len * sin;
- break;
- }
- setTextMatrix(cos, sin, -sin, cos, x, y);
- showText(text);
- setTextMatrix(0f, 0f);
- }
- }
-
- /**
- * Shows text kerned right, left or center aligned with rotation.
- * @param alignement the alignment can be ALIGN_CENTER, ALIGN_RIGHT or ALIGN_LEFT
- * @param text the text to show
- * @param x the x pivot position
- * @param y the y pivot position
- * @param rotation the rotation to be applied in degrees counterclockwise
- */
- public void showTextAlignedKerned(int alignement, String text, float x, float y, float rotation) {
- if (state.fontDetails == null)
- throw new NullPointerException("Font and size must be set before writing any text");
- BaseFont bf = state.fontDetails.getBaseFont();
- if (rotation == 0) {
- switch (alignement) {
- case ALIGN_CENTER:
- x -= bf.getWidthPointKerned(text, state.size) / 2;
- break;
- case ALIGN_RIGHT:
- x -= bf.getWidthPointKerned(text, state.size);
- break;
- }
- setTextMatrix(x, y);
- showTextKerned(text);
- }
- else {
- double alpha = rotation * Math.PI / 180.0;
- float cos = (float)Math.cos(alpha);
- float sin = (float)Math.sin(alpha);
- float len;
- switch (alignement) {
- case ALIGN_CENTER:
- len = bf.getWidthPointKerned(text, state.size) / 2;
- x -= len * cos;
- y -= len * sin;
- break;
- case ALIGN_RIGHT:
- len = bf.getWidthPointKerned(text, state.size);
- x -= len * cos;
- y -= len * sin;
- break;
- }
- setTextMatrix(cos, sin, -sin, cos, x, y);
- showTextKerned(text);
- setTextMatrix(0f, 0f);
- }
- }
-
- /**
- * Concatenate a matrix to the current transformation matrix.
- * @param a an element of the transformation matrix
- * @param b an element of the transformation matrix
- * @param c an element of the transformation matrix
- * @param d an element of the transformation matrix
- * @param e an element of the transformation matrix
- * @param f an element of the transformation matrix
- **/
- public void concatCTM(float a, float b, float c, float d, float e, float f) {
- content.append(a).append(' ').append(b).append(' ').append(c).append(' ');
- content.append(d).append(' ').append(e).append(' ').append(f).append(" cm").append_i(separator);
- }
-
- /**
- * Generates an array of bezier curves to draw an arc.
- * <P>
- * (x1, y1) and (x2, y2) are the corners of the enclosing rectangle.
- * Angles, measured in degrees, start with 0 to the right (the positive X
- * axis) and increase counter-clockwise. The arc extends from startAng
- * to startAng+extent. I.e. startAng=0 and extent=180 yields an openside-down
- * semi-circle.
- * <P>
- * The resulting coordinates are of the form float[]{x1,y1,x2,y2,x3,y3, x4,y4}
- * such that the curve goes from (x1, y1) to (x4, y4) with (x2, y2) and
- * (x3, y3) as their respective Bezier control points.
- * <P>
- * Note: this code was taken from ReportLab (www.reportlab.com), an excelent
- * PDF generator for Python.
- *
- * @param x1 a corner of the enclosing rectangle
- * @param y1 a corner of the enclosing rectangle
- * @param x2 a corner of the enclosing rectangle
- * @param y2 a corner of the enclosing rectangle
- * @param startAng starting angle in degrees
- * @param extent angle extent in degrees
- * @return a list of float[] with the bezier curves
- */
- public static ArrayList bezierArc(float x1, float y1, float x2, float y2, float startAng, float extent) {
- float tmp;
- if (x1 > x2) {
- tmp = x1;
- x1 = x2;
- x2 = tmp;
- }
- if (y2 > y1) {
- tmp = y1;
- y1 = y2;
- y2 = tmp;
- }
-
- float fragAngle;
- int Nfrag;
- if (Math.abs(extent) <= 90f) {
- fragAngle = extent;
- Nfrag = 1;
- }
- else {
- Nfrag = (int)(Math.ceil(Math.abs(extent)/90f));
- fragAngle = extent / Nfrag;
- }
- float x_cen = (x1+x2)/2f;
- float y_cen = (y1+y2)/2f;
- float rx = (x2-x1)/2f;
- float ry = (y2-y1)/2f;
- float halfAng = (float)(fragAngle * Math.PI / 360.);
- float kappa = (float)(Math.abs(4. / 3. * (1. - Math.cos(halfAng)) / Math.sin(halfAng)));
- ArrayList pointList = new ArrayList();
- for (int i = 0; i < Nfrag; ++i) {
- float theta0 = (float)((startAng + i*fragAngle) * Math.PI / 180.);
- float theta1 = (float)((startAng + (i+1)*fragAngle) * Math.PI / 180.);
- float cos0 = (float)Math.cos(theta0);
- float cos1 = (float)Math.cos(theta1);
- float sin0 = (float)Math.sin(theta0);
- float sin1 = (float)Math.sin(theta1);
- if (fragAngle > 0f) {
- pointList.add(new float[]{x_cen + rx * cos0,
- y_cen - ry * sin0,
- x_cen + rx * (cos0 - kappa * sin0),
- y_cen - ry * (sin0 + kappa * cos0),
- x_cen + rx * (cos1 + kappa * sin1),
- y_cen - ry * (sin1 - kappa * cos1),
- x_cen + rx * cos1,
- y_cen - ry * sin1});
- }
- else {
- pointList.add(new float[]{x_cen + rx * cos0,
- y_cen - ry * sin0,
- x_cen + rx * (cos0 + kappa * sin0),
- y_cen - ry * (sin0 - kappa * cos0),
- x_cen + rx * (cos1 - kappa * sin1),
- y_cen - ry * (sin1 + kappa * cos1),
- x_cen + rx * cos1,
- y_cen - ry * sin1});
- }
- }
- return pointList;
- }
-
- /**
- * Draws a partial ellipse inscribed within the rectangle x1,y1,x2,y2,
- * starting at startAng degrees and covering extent degrees. Angles
- * start with 0 to the right (+x) and increase counter-clockwise.
- *
- * @param x1 a corner of the enclosing rectangle
- * @param y1 a corner of the enclosing rectangle
- * @param x2 a corner of the enclosing rectangle
- * @param y2 a corner of the enclosing rectangle
- * @param startAng starting angle in degrees
- * @param extent angle extent in degrees
- */
- public void arc(float x1, float y1, float x2, float y2, float startAng, float extent) {
- ArrayList ar = bezierArc(x1, y1, x2, y2, startAng, extent);
- if (ar.size() == 0)
- return;
- float pt[] = (float [])ar.get(0);
- moveTo(pt[0], pt[1]);
- for (int k = 0; k < ar.size(); ++k) {
- pt = (float [])ar.get(k);
- curveTo(pt[2], pt[3], pt[4], pt[5], pt[6], pt[7]);
- }
- }
-
- /**
- * Draws an ellipse inscribed within the rectangle x1,y1,x2,y2.
- *
- * @param x1 a corner of the enclosing rectangle
- * @param y1 a corner of the enclosing rectangle
- * @param x2 a corner of the enclosing rectangle
- * @param y2 a corner of the enclosing rectangle
- */
- public void ellipse(float x1, float y1, float x2, float y2) {
- arc(x1, y1, x2, y2, 0f, 360f);
- }
-
- /**
- * Create a new colored tiling pattern.
- *
- * @param width the width of the pattern
- * @param height the height of the pattern
- * @param xstep the desired horizontal spacing between pattern cells.
- * May be either positive or negative, but not zero.
- * @param ystep the desired vertical spacing between pattern cells.
- * May be either positive or negative, but not zero.
- * @return the <CODE>PdfPatternPainter</CODE> where the pattern will be created
- */
- public PdfPatternPainter createPattern(float width, float height, float xstep, float ystep) {
- checkWriter();
- if ( xstep == 0.0f || ystep == 0.0f )
- throw new RuntimeException("XStep or YStep can not be ZERO.");
- PdfPatternPainter painter = new PdfPatternPainter(writer);
- painter.setWidth(width);
- painter.setHeight(height);
- painter.setXStep(xstep);
- painter.setYStep(ystep);
- writer.addSimplePattern(painter);
- return painter;
- }
-
- /**
- * Create a new colored tiling pattern. Variables xstep and ystep are set to the same values
- * of width and height.
- * @param width the width of the pattern
- * @param height the height of the pattern
- * @return the <CODE>PdfPatternPainter</CODE> where the pattern will be created
- */
- public PdfPatternPainter createPattern(float width, float height) {
- return createPattern(width, height, width, height);
- }
-
- /**
- * Create a new uncolored tiling pattern.
- *
- * @param width the width of the pattern
- * @param height the height of the pattern
- * @param xstep the desired horizontal spacing between pattern cells.
- * May be either positive or negative, but not zero.
- * @param ystep the desired vertical spacing between pattern cells.
- * May be either positive or negative, but not zero.
- * @param color the default color. Can be <CODE>null</CODE>
- * @return the <CODE>PdfPatternPainter</CODE> where the pattern will be created
- */
- public PdfPatternPainter createPattern(float width, float height, float xstep, float ystep, Color color) {
- checkWriter();
- if ( xstep == 0.0f || ystep == 0.0f )
- throw new RuntimeException("XStep or YStep can not be ZERO.");
- PdfPatternPainter painter = new PdfPatternPainter(writer, color);
- painter.setWidth(width);
- painter.setHeight(height);
- painter.setXStep(xstep);
- painter.setYStep(ystep);
- writer.addSimplePattern(painter);
- return painter;
- }
-
- /**
- * Create a new uncolored tiling pattern.
- * Variables xstep and ystep are set to the same values
- * of width and height.
- * @param width the width of the pattern
- * @param height the height of the pattern
- * @param color the default color. Can be <CODE>null</CODE>
- * @return the <CODE>PdfPatternPainter</CODE> where the pattern will be created
- */
- public PdfPatternPainter createPattern(float width, float height, Color color) {
- return createPattern(width, height, width, height, color);
- }
-
- /**
- * Creates a new template.
- * <P>
- * Creates a new template that is nothing more than a form XObject. This template can be included
- * in this <CODE>PdfContentByte</CODE> or in another template. Templates are only written
- * to the output when the document is closed permitting things like showing text in the first page
- * that is only defined in the last page.
- *
- * @param width the bounding box width
- * @param height the bounding box height
- * @return the templated created
- */
- public PdfTemplate createTemplate(float width, float height) {
- return createTemplate(width, height, null);
- }
-
- PdfTemplate createTemplate(float width, float height, PdfName forcedName) {
- checkWriter();
- PdfTemplate template = new PdfTemplate(writer);
- template.setWidth(width);
- template.setHeight(height);
- writer.addDirectTemplateSimple(template, forcedName);
- return template;
- }
-
- /**
- * Creates a new appearance to be used with form fields.
- *
- * @param width the bounding box width
- * @param height the bounding box height
- * @return the appearance created
- */
- public PdfAppearance createAppearance(float width, float height) {
- return createAppearance(width, height, null);
- }
-
- PdfAppearance createAppearance(float width, float height, PdfName forcedName) {
- checkWriter();
- PdfAppearance template = new PdfAppearance(writer);
- template.setWidth(width);
- template.setHeight(height);
- writer.addDirectTemplateSimple(template, forcedName);
- return template;
- }
-
- /**
- * Adds a PostScript XObject to this content.
- *
- * @param psobject the object
- */
- public void addPSXObject(PdfPSXObject psobject) {
- checkWriter();
- PdfName name = writer.addDirectTemplateSimple(psobject, null);
- PageResources prs = getPageResources();
- name = prs.addXObject(name, psobject.getIndirectReference());
- content.append(name.getBytes()).append(" Do").append_i(separator);
- }
-
- /**
- * Adds a template to this content.
- *
- * @param template the template
- * @param a an element of the transformation matrix
- * @param b an element of the transformation matrix
- * @param c an element of the transformation matrix
- * @param d an element of the transformation matrix
- * @param e an element of the transformation matrix
- * @param f an element of the transformation matrix
- */
- public void addTemplate(PdfTemplate template, float a, float b, float c, float d, float e, float f) {
- checkWriter();
- checkNoPattern(template);
- PdfName name = writer.addDirectTemplateSimple(template, null);
- PageResources prs = getPageResources();
- name = prs.addXObject(name, template.getIndirectReference());
- content.append("q ");
- content.append(a).append(' ');
- content.append(b).append(' ');
- content.append(c).append(' ');
- content.append(d).append(' ');
- content.append(e).append(' ');
- content.append(f).append(" cm ");
- content.append(name.getBytes()).append(" Do Q").append_i(separator);
- }
-
- /**
- * Adds a template to this content.
- *
- * @param template the template
- * @param x the x location of this template
- * @param y the y location of this template
- */
- public void addTemplate(PdfTemplate template, float x, float y) {
- addTemplate(template, 1, 0, 0, 1, x, y);
- }
-
- /**
- * Changes the current color for filling paths (device dependent colors!).
- * <P>
- * Sets the color space to <B>DeviceCMYK</B> (or the <B>DefaultCMYK</B> color space),
- * and sets the color to use for filling paths.</P>
- * <P>
- * This method is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 8.5.2.1 (page 331).</P>
- * <P>
- * Following the PDF manual, each operand must be a number between 0 (no ink) and
- * 1 (maximum ink). This method however accepts only integers between 0x00 and 0xFF.</P>
- *
- * @param cyan the intensity of cyan
- * @param magenta the intensity of magenta
- * @param yellow the intensity of yellow
- * @param black the intensity of black
- */
-
- public void setCMYKColorFill(int cyan, int magenta, int yellow, int black) {
- content.append((float)(cyan & 0xFF) / 0xFF);
- content.append(' ');
- content.append((float)(magenta & 0xFF) / 0xFF);
- content.append(' ');
- content.append((float)(yellow & 0xFF) / 0xFF);
- content.append(' ');
- content.append((float)(black & 0xFF) / 0xFF);
- content.append(" k").append_i(separator);
- }
- /**
- * Changes the current color for stroking paths (device dependent colors!).
- * <P>
- * Sets the color space to <B>DeviceCMYK</B> (or the <B>DefaultCMYK</B> color space),
- * and sets the color to use for stroking paths.</P>
- * <P>
- * This method is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 8.5.2.1 (page 331).</P>
- * Following the PDF manual, each operand must be a number between 0 (miniumum intensity) and
- * 1 (maximum intensity). This method however accepts only integers between 0x00 and 0xFF.
- *
- * @param cyan the intensity of red
- * @param magenta the intensity of green
- * @param yellow the intensity of blue
- * @param black the intensity of black
- */
-
- public void setCMYKColorStroke(int cyan, int magenta, int yellow, int black) {
- content.append((float)(cyan & 0xFF) / 0xFF);
- content.append(' ');
- content.append((float)(magenta & 0xFF) / 0xFF);
- content.append(' ');
- content.append((float)(yellow & 0xFF) / 0xFF);
- content.append(' ');
- content.append((float)(black & 0xFF) / 0xFF);
- content.append(" K").append_i(separator);
- }
-
- /**
- * Changes the current color for filling paths (device dependent colors!).
- * <P>
- * Sets the color space to <B>DeviceRGB</B> (or the <B>DefaultRGB</B> color space),
- * and sets the color to use for filling paths.</P>
- * <P>
- * This method is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 8.5.2.1 (page 331).</P>
- * <P>
- * Following the PDF manual, each operand must be a number between 0 (miniumum intensity) and
- * 1 (maximum intensity). This method however accepts only integers between 0x00 and 0xFF.</P>
- *
- * @param red the intensity of red
- * @param green the intensity of green
- * @param blue the intensity of blue
- */
-
- public void setRGBColorFill(int red, int green, int blue) {
- HelperRGB((float)(red & 0xFF) / 0xFF, (float)(green & 0xFF) / 0xFF, (float)(blue & 0xFF) / 0xFF);
- content.append(" rg").append_i(separator);
- }
-
- /**
- * Changes the current color for stroking paths (device dependent colors!).
- * <P>
- * Sets the color space to <B>DeviceRGB</B> (or the <B>DefaultRGB</B> color space),
- * and sets the color to use for stroking paths.</P>
- * <P>
- * This method is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 8.5.2.1 (page 331).</P>
- * Following the PDF manual, each operand must be a number between 0 (miniumum intensity) and
- * 1 (maximum intensity). This method however accepts only integers between 0x00 and 0xFF.
- *
- * @param red the intensity of red
- * @param green the intensity of green
- * @param blue the intensity of blue
- */
-
- public void setRGBColorStroke(int red, int green, int blue) {
- HelperRGB((float)(red & 0xFF) / 0xFF, (float)(green & 0xFF) / 0xFF, (float)(blue & 0xFF) / 0xFF);
- content.append(" RG").append_i(separator);
- }
-
- /** Sets the stroke color. <CODE>color</CODE> can be an
- * <CODE>ExtendedColor</CODE>.
- * @param color the color
- */
- public void setColorStroke(Color color) {
- PdfWriter.checkPDFXConformance(writer, PdfWriter.PDFXKEY_COLOR, color);
- int type = ExtendedColor.getType(color);
- switch (type) {
- case ExtendedColor.TYPE_GRAY: {
- setGrayStroke(((GrayColor)color).getGray());
- break;
- }
- case ExtendedColor.TYPE_CMYK: {
- CMYKColor cmyk = (CMYKColor)color;
- setCMYKColorStrokeF(cmyk.getCyan(), cmyk.getMagenta(), cmyk.getYellow(), cmyk.getBlack());
- break;
- }
- case ExtendedColor.TYPE_SEPARATION: {
- SpotColor spot = (SpotColor)color;
- setColorStroke(spot.getPdfSpotColor(), spot.getTint());
- break;
- }
- case ExtendedColor.TYPE_PATTERN: {
- PatternColor pat = (PatternColor) color;
- setPatternStroke(pat.getPainter());
- break;
- }
- case ExtendedColor.TYPE_SHADING: {
- ShadingColor shading = (ShadingColor) color;
- setShadingStroke(shading.getPdfShadingPattern());
- break;
- }
- default:
- setRGBColorStroke(color.getRed(), color.getGreen(), color.getBlue());
- }
- }
-
- /** Sets the fill color. <CODE>color</CODE> can be an
- * <CODE>ExtendedColor</CODE>.
- * @param color the color
- */
- public void setColorFill(Color color) {
- PdfWriter.checkPDFXConformance(writer, PdfWriter.PDFXKEY_COLOR, color);
- int type = ExtendedColor.getType(color);
- switch (type) {
- case ExtendedColor.TYPE_GRAY: {
- setGrayFill(((GrayColor)color).getGray());
- break;
- }
- case ExtendedColor.TYPE_CMYK: {
- CMYKColor cmyk = (CMYKColor)color;
- setCMYKColorFillF(cmyk.getCyan(), cmyk.getMagenta(), cmyk.getYellow(), cmyk.getBlack());
- break;
- }
- case ExtendedColor.TYPE_SEPARATION: {
- SpotColor spot = (SpotColor)color;
- setColorFill(spot.getPdfSpotColor(), spot.getTint());
- break;
- }
- case ExtendedColor.TYPE_PATTERN: {
- PatternColor pat = (PatternColor) color;
- setPatternFill(pat.getPainter());
- break;
- }
- case ExtendedColor.TYPE_SHADING: {
- ShadingColor shading = (ShadingColor) color;
- setShadingFill(shading.getPdfShadingPattern());
- break;
- }
- default:
- setRGBColorFill(color.getRed(), color.getGreen(), color.getBlue());
- }
- }
-
- /** Sets the fill color to a spot color.
- * @param sp the spot color
- * @param tint the tint for the spot color. 0 is no color and 1
- * is 100% color
- */
- public void setColorFill(PdfSpotColor sp, float tint) {
- checkWriter();
- state.colorDetails = writer.addSimple(sp);
- PageResources prs = getPageResources();
- PdfName name = state.colorDetails.getColorName();
- name = prs.addColor(name, state.colorDetails.getIndirectReference());
- content.append(name.getBytes()).append(" cs ").append(tint).append(" scn").append_i(separator);
- }
-
- /** Sets the stroke color to a spot color.
- * @param sp the spot color
- * @param tint the tint for the spot color. 0 is no color and 1
- * is 100% color
- */
- public void setColorStroke(PdfSpotColor sp, float tint) {
- checkWriter();
- state.colorDetails = writer.addSimple(sp);
- PageResources prs = getPageResources();
- PdfName name = state.colorDetails.getColorName();
- name = prs.addColor(name, state.colorDetails.getIndirectReference());
- content.append(name.getBytes()).append(" CS ").append(tint).append(" SCN").append_i(separator);
- }
-
- /** Sets the fill color to a pattern. The pattern can be
- * colored or uncolored.
- * @param p the pattern
- */
- public void setPatternFill(PdfPatternPainter p) {
- if (p.isStencil()) {
- setPatternFill(p, p.getDefaultColor());
- return;
- }
- checkWriter();
- PageResources prs = getPageResources();
- PdfName name = writer.addSimplePattern(p);
- name = prs.addPattern(name, p.getIndirectReference());
- content.append(PdfName.PATTERN.getBytes()).append(" cs ").append(name.getBytes()).append(" scn").append_i(separator);
- }
-
- /** Outputs the color values to the content.
- * @param color The color
- * @param tint the tint if it is a spot color, ignored otherwise
- */
- void outputColorNumbers(Color color, float tint) {
- PdfWriter.checkPDFXConformance(writer, PdfWriter.PDFXKEY_COLOR, color);
- int type = ExtendedColor.getType(color);
- switch (type) {
- case ExtendedColor.TYPE_RGB:
- content.append((float)(color.getRed()) / 0xFF);
- content.append(' ');
- content.append((float)(color.getGreen()) / 0xFF);
- content.append(' ');
- content.append((float)(color.getBlue()) / 0xFF);
- break;
- case ExtendedColor.TYPE_GRAY:
- content.append(((GrayColor)color).getGray());
- break;
- case ExtendedColor.TYPE_CMYK: {
- CMYKColor cmyk = (CMYKColor)color;
- content.append(cmyk.getCyan()).append(' ').append(cmyk.getMagenta());
- content.append(' ').append(cmyk.getYellow()).append(' ').append(cmyk.getBlack());
- break;
- }
- case ExtendedColor.TYPE_SEPARATION:
- content.append(tint);
- break;
- default:
- throw new RuntimeException("Invalid color type.");
- }
- }
-
- /** Sets the fill color to an uncolored pattern.
- * @param p the pattern
- * @param color the color of the pattern
- */
- public void setPatternFill(PdfPatternPainter p, Color color) {
- if (ExtendedColor.getType(color) == ExtendedColor.TYPE_SEPARATION)
- setPatternFill(p, color, ((SpotColor)color).getTint());
- else
- setPatternFill(p, color, 0);
- }
-
- /** Sets the fill color to an uncolored pattern.
- * @param p the pattern
- * @param color the color of the pattern
- * @param tint the tint if the color is a spot color, ignored otherwise
- */
- public void setPatternFill(PdfPatternPainter p, Color color, float tint) {
- checkWriter();
- if (!p.isStencil())
- throw new RuntimeException("An uncolored pattern was expected.");
- PageResources prs = getPageResources();
- PdfName name = writer.addSimplePattern(p);
- name = prs.addPattern(name, p.getIndirectReference());
- ColorDetails csDetail = writer.addSimplePatternColorspace(color);
- PdfName cName = prs.addColor(csDetail.getColorName(), csDetail.getIndirectReference());
- content.append(cName.getBytes()).append(" cs").append_i(separator);
- outputColorNumbers(color, tint);
- content.append(' ').append(name.getBytes()).append(" scn").append_i(separator);
- }
-
- /** Sets the stroke color to an uncolored pattern.
- * @param p the pattern
- * @param color the color of the pattern
- */
- public void setPatternStroke(PdfPatternPainter p, Color color) {
- if (ExtendedColor.getType(color) == ExtendedColor.TYPE_SEPARATION)
- setPatternStroke(p, color, ((SpotColor)color).getTint());
- else
- setPatternStroke(p, color, 0);
- }
-
- /** Sets the stroke color to an uncolored pattern.
- * @param p the pattern
- * @param color the color of the pattern
- * @param tint the tint if the color is a spot color, ignored otherwise
- */
- public void setPatternStroke(PdfPatternPainter p, Color color, float tint) {
- checkWriter();
- if (!p.isStencil())
- throw new RuntimeException("An uncolored pattern was expected.");
- PageResources prs = getPageResources();
- PdfName name = writer.addSimplePattern(p);
- name = prs.addPattern(name, p.getIndirectReference());
- ColorDetails csDetail = writer.addSimplePatternColorspace(color);
- PdfName cName = prs.addColor(csDetail.getColorName(), csDetail.getIndirectReference());
- content.append(cName.getBytes()).append(" CS").append_i(separator);
- outputColorNumbers(color, tint);
- content.append(' ').append(name.getBytes()).append(" SCN").append_i(separator);
- }
-
- /** Sets the stroke color to a pattern. The pattern can be
- * colored or uncolored.
- * @param p the pattern
- */
- public void setPatternStroke(PdfPatternPainter p) {
- if (p.isStencil()) {
- setPatternStroke(p, p.getDefaultColor());
- return;
- }
- checkWriter();
- PageResources prs = getPageResources();
- PdfName name = writer.addSimplePattern(p);
- name = prs.addPattern(name, p.getIndirectReference());
- content.append(PdfName.PATTERN.getBytes()).append(" CS ").append(name.getBytes()).append(" SCN").append_i(separator);
- }
-
- /**
- * Paints using a shading object.
- * @param shading the shading object
- */
- public void paintShading(PdfShading shading) {
- writer.addSimpleShading(shading);
- PageResources prs = getPageResources();
- PdfName name = prs.addShading(shading.getShadingName(), shading.getShadingReference());
- content.append(name.getBytes()).append(" sh").append_i(separator);
- ColorDetails details = shading.getColorDetails();
- if (details != null)
- prs.addColor(details.getColorName(), details.getIndirectReference());
- }
-
- /**
- * Paints using a shading pattern.
- * @param shading the shading pattern
- */
- public void paintShading(PdfShadingPattern shading) {
- paintShading(shading.getShading());
- }
-
- /**
- * Sets the shading fill pattern.
- * @param shading the shading pattern
- */
- public void setShadingFill(PdfShadingPattern shading) {
- writer.addSimpleShadingPattern(shading);
- PageResources prs = getPageResources();
- PdfName name = prs.addPattern(shading.getPatternName(), shading.getPatternReference());
- content.append(PdfName.PATTERN.getBytes()).append(" cs ").append(name.getBytes()).append(" scn").append_i(separator);
- ColorDetails details = shading.getColorDetails();
- if (details != null)
- prs.addColor(details.getColorName(), details.getIndirectReference());
- }
-
- /**
- * Sets the shading stroke pattern
- * @param shading the shading pattern
- */
- public void setShadingStroke(PdfShadingPattern shading) {
- writer.addSimpleShadingPattern(shading);
- PageResources prs = getPageResources();
- PdfName name = prs.addPattern(shading.getPatternName(), shading.getPatternReference());
- content.append(PdfName.PATTERN.getBytes()).append(" CS ").append(name.getBytes()).append(" SCN").append_i(separator);
- ColorDetails details = shading.getColorDetails();
- if (details != null)
- prs.addColor(details.getColorName(), details.getIndirectReference());
- }
-
- /** Check if we have a valid PdfWriter.
- *
- */
- protected void checkWriter() {
- if (writer == null)
- throw new NullPointerException("The writer in PdfContentByte is null.");
- }
-
- /**
- * Show an array of text.
- * @param text array of text
- */
- public void showText(PdfTextArray text) {
- if (state.fontDetails == null)
- throw new NullPointerException("Font and size must be set before writing any text");
- content.append("[");
- ArrayList arrayList = text.getArrayList();
- boolean lastWasNumber = false;
- for (int k = 0; k < arrayList.size(); ++k) {
- Object obj = arrayList.get(k);
- if (obj instanceof String) {
- showText2((String)obj);
- lastWasNumber = false;
- }
- else {
- if (lastWasNumber)
- content.append(' ');
- else
- lastWasNumber = true;
- content.append(((Float)obj).floatValue());
- }
- }
- content.append("]TJ").append_i(separator);
- }
-
- /**
- * Gets the <CODE>PdfWriter</CODE> in use by this object.
- * @return the <CODE>PdfWriter</CODE> in use by this object
- */
- public PdfWriter getPdfWriter() {
- return writer;
- }
-
- /**
- * Gets the <CODE>PdfDocument</CODE> in use by this object.
- * @return the <CODE>PdfDocument</CODE> in use by this object
- */
- public PdfDocument getPdfDocument() {
- return pdf;
- }
-
- /**
- * Implements a link to other part of the document. The jump will
- * be made to a local destination with the same name, that must exist.
- * @param name the name for this link
- * @param llx the lower left x corner of the activation area
- * @param lly the lower left y corner of the activation area
- * @param urx the upper right x corner of the activation area
- * @param ury the upper right y corner of the activation area
- */
- public void localGoto(String name, float llx, float lly, float urx, float ury) {
- pdf.localGoto(name, llx, lly, urx, ury);
- }
-
- /**
- * The local destination to where a local goto with the same
- * name will jump.
- * @param name the name of this local destination
- * @param destination the <CODE>PdfDestination</CODE> with the jump coordinates
- * @return <CODE>true</CODE> if the local destination was added,
- * <CODE>false</CODE> if a local destination with the same name
- * already exists
- */
- public boolean localDestination(String name, PdfDestination destination) {
- return pdf.localDestination(name, destination);
- }
-
- /**
- * Gets a duplicate of this <CODE>PdfContentByte</CODE>. All
- * the members are copied by reference but the buffer stays different.
- *
- * @return a copy of this <CODE>PdfContentByte</CODE>
- */
- public PdfContentByte getDuplicate() {
- return new PdfContentByte(writer);
- }
-
- /**
- * Implements a link to another document.
- * @param filename the filename for the remote document
- * @param name the name to jump to
- * @param llx the lower left x corner of the activation area
- * @param lly the lower left y corner of the activation area
- * @param urx the upper right x corner of the activation area
- * @param ury the upper right y corner of the activation area
- */
- public void remoteGoto(String filename, String name, float llx, float lly, float urx, float ury) {
- pdf.remoteGoto(filename, name, llx, lly, urx, ury);
- }
-
- /**
- * Implements a link to another document.
- * @param filename the filename for the remote document
- * @param page the page to jump to
- * @param llx the lower left x corner of the activation area
- * @param lly the lower left y corner of the activation area
- * @param urx the upper right x corner of the activation area
- * @param ury the upper right y corner of the activation area
- */
- public void remoteGoto(String filename, int page, float llx, float lly, float urx, float ury) {
- pdf.remoteGoto(filename, page, llx, lly, urx, ury);
- }
- /**
- * Adds a round rectangle to the current path.
- *
- * @param x x-coordinate of the starting point
- * @param y y-coordinate of the starting point
- * @param w width
- * @param h height
- * @param r radius of the arc corner
- */
- public void roundRectangle(float x, float y, float w, float h, float r) {
- if (w < 0) {
- x += w;
- w = -w;
- }
- if (h < 0) {
- y += h;
- h = -h;
- }
- if (r < 0)
- r = -r;
- float b = 0.4477f;
- moveTo(x + r, y);
- lineTo(x + w - r, y);
- curveTo(x + w - r * b, y, x + w, y + r * b, x + w, y + r);
- lineTo(x + w, y + h - r);
- curveTo(x + w, y + h - r * b, x + w - r * b, y + h, x + w - r, y + h);
- lineTo(x + r, y + h);
- curveTo(x + r * b, y + h, x, y + h - r * b, x, y + h - r);
- lineTo(x, y + r);
- curveTo(x, y + r * b, x + r * b, y, x + r, y);
- }
-
- /** Implements an action in an area.
- * @param action the <CODE>PdfAction</CODE>
- * @param llx the lower left x corner of the activation area
- * @param lly the lower left y corner of the activation area
- * @param urx the upper right x corner of the activation area
- * @param ury the upper right y corner of the activation area
- */
- public void setAction(PdfAction action, float llx, float lly, float urx, float ury) {
- pdf.setAction(action, llx, lly, urx, ury);
- }
-
- /** Outputs a <CODE>String</CODE> directly to the content.
- * @param s the <CODE>String</CODE>
- */
- public void setLiteral(String s) {
- content.append(s);
- }
-
- /** Outputs a <CODE>char</CODE> directly to the content.
- * @param c the <CODE>char</CODE>
- */
- public void setLiteral(char c) {
- content.append(c);
- }
-
- /** Outputs a <CODE>float</CODE> directly to the content.
- * @param n the <CODE>float</CODE>
- */
- public void setLiteral(float n) {
- content.append(n);
- }
-
- /** Throws an error if it is a pattern.
- * @param t the object to check
- */
- void checkNoPattern(PdfTemplate t) {
- if (t.getType() == PdfTemplate.TYPE_PATTERN)
- throw new RuntimeException("Invalid use of a pattern. A template was expected.");
- }
-
- /**
- * Draws a TextField.
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @param on
- */
- public void drawRadioField(float llx, float lly, float urx, float ury, boolean on) {
- if (llx > urx) { float x = llx; llx = urx; urx = x; }
- if (lly > ury) { float y = lly; lly = ury; ury = y; }
- // silver circle
- setLineWidth(1);
- setLineCap(1);
- setColorStroke(new Color(0xC0, 0xC0, 0xC0));
- arc(llx + 1f, lly + 1f, urx - 1f, ury - 1f, 0f, 360f);
- stroke();
- // gray circle-segment
- setLineWidth(1);
- setLineCap(1);
- setColorStroke(new Color(0xA0, 0xA0, 0xA0));
- arc(llx + 0.5f, lly + 0.5f, urx - 0.5f, ury - 0.5f, 45, 180);
- stroke();
- // black circle-segment
- setLineWidth(1);
- setLineCap(1);
- setColorStroke(new Color(0x00, 0x00, 0x00));
- arc(llx + 1.5f, lly + 1.5f, urx - 1.5f, ury - 1.5f, 45, 180);
- stroke();
- if (on) {
- // gray circle
- setLineWidth(1);
- setLineCap(1);
- setColorFill(new Color(0x00, 0x00, 0x00));
- arc(llx + 4f, lly + 4f, urx - 4f, ury - 4f, 0, 360);
- fill();
- }
- }
-
- /**
- * Draws a TextField.
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- */
- public void drawTextField(float llx, float lly, float urx, float ury) {
- if (llx > urx) { float x = llx; llx = urx; urx = x; }
- if (lly > ury) { float y = lly; lly = ury; ury = y; }
- // silver rectangle not filled
- setColorStroke(new Color(0xC0, 0xC0, 0xC0));
- setLineWidth(1);
- setLineCap(0);
- rectangle(llx, lly, urx - llx, ury - lly);
- stroke();
- // white rectangle filled
- setLineWidth(1);
- setLineCap(0);
- setColorFill(new Color(0xFF, 0xFF, 0xFF));
- rectangle(llx + 0.5f, lly + 0.5f, urx - llx - 1f, ury -lly - 1f);
- fill();
- // silver lines
- setColorStroke(new Color(0xC0, 0xC0, 0xC0));
- setLineWidth(1);
- setLineCap(0);
- moveTo(llx + 1f, lly + 1.5f);
- lineTo(urx - 1.5f, lly + 1.5f);
- lineTo(urx - 1.5f, ury - 1f);
- stroke();
- // gray lines
- setColorStroke(new Color(0xA0, 0xA0, 0xA0));
- setLineWidth(1);
- setLineCap(0);
- moveTo(llx + 1f, lly + 1);
- lineTo(llx + 1f, ury - 1f);
- lineTo(urx - 1f, ury - 1f);
- stroke();
- // black lines
- setColorStroke(new Color(0x00, 0x00, 0x00));
- setLineWidth(1);
- setLineCap(0);
- moveTo(llx + 2f, lly + 2f);
- lineTo(llx + 2f, ury - 2f);
- lineTo(urx - 2f, ury - 2f);
- stroke();
- }
-
- /**
- * Draws a button.
- * @param llx
- * @param lly
- * @param urx
- * @param ury
- * @param text
- * @param bf
- * @param size
- */
- public void drawButton(float llx, float lly, float urx, float ury, String text, BaseFont bf, float size) {
- if (llx > urx) { float x = llx; llx = urx; urx = x; }
- if (lly > ury) { float y = lly; lly = ury; ury = y; }
- // black rectangle not filled
- setColorStroke(new Color(0x00, 0x00, 0x00));
- setLineWidth(1);
- setLineCap(0);
- rectangle(llx, lly, urx - llx, ury - lly);
- stroke();
- // silver rectangle filled
- setLineWidth(1);
- setLineCap(0);
- setColorFill(new Color(0xC0, 0xC0, 0xC0));
- rectangle(llx + 0.5f, lly + 0.5f, urx - llx - 1f, ury -lly - 1f);
- fill();
- // white lines
- setColorStroke(new Color(0xFF, 0xFF, 0xFF));
- setLineWidth(1);
- setLineCap(0);
- moveTo(llx + 1f, lly + 1f);
- lineTo(llx + 1f, ury - 1f);
- lineTo(urx - 1f, ury - 1f);
- stroke();
- // dark grey lines
- setColorStroke(new Color(0xA0, 0xA0, 0xA0));
- setLineWidth(1);
- setLineCap(0);
- moveTo(llx + 1f, lly + 1f);
- lineTo(urx - 1f, lly + 1f);
- lineTo(urx - 1f, ury - 1f);
- stroke();
- // text
- resetRGBColorFill();
- beginText();
- setFontAndSize(bf, size);
- showTextAligned(PdfContentByte.ALIGN_CENTER, text, llx + (urx - llx) / 2, lly + (ury - lly - size) / 2, 0);
- endText();
- }
-
- /** Gets a <CODE>Graphics2D</CODE> to write on. The graphics
- * are translated to PDF commands as shapes. No PDF fonts will appear.
- * @param width the width of the panel
- * @param height the height of the panel
- * @return a <CODE>Graphics2D</CODE>
- */
- public java.awt.Graphics2D createGraphicsShapes(float width, float height) {
- return new PdfGraphics2D(this, width, height, null, true, false, 0);
- }
-
- /** Gets a <CODE>Graphics2D</CODE> to print on. The graphics
- * are translated to PDF commands as shapes. No PDF fonts will appear.
- * @param width the width of the panel
- * @param height the height of the panel
- * @param printerJob a printer job
- * @return a <CODE>Graphics2D</CODE>
- */
- public java.awt.Graphics2D createPrinterGraphicsShapes(float width, float height, PrinterJob printerJob) {
- return new PdfPrinterGraphics2D(this, width, height, null, true, false, 0, printerJob);
- }
-
- /** Gets a <CODE>Graphics2D</CODE> to write on. The graphics
- * are translated to PDF commands.
- * @param width the width of the panel
- * @param height the height of the panel
- * @return a <CODE>Graphics2D</CODE>
- */
- public java.awt.Graphics2D createGraphics(float width, float height) {
- return new PdfGraphics2D(this, width, height, null, false, false, 0);
- }
-
- /** Gets a <CODE>Graphics2D</CODE> to print on. The graphics
- * are translated to PDF commands.
- * @param width the width of the panel
- * @param height the height of the panel
- * @param printerJob
- * @return a <CODE>Graphics2D</CODE>
- */
- public java.awt.Graphics2D createPrinterGraphics(float width, float height, PrinterJob printerJob) {
- return new PdfPrinterGraphics2D(this, width, height, null, false, false, 0, printerJob);
- }
-
- /** Gets a <CODE>Graphics2D</CODE> to write on. The graphics
- * are translated to PDF commands.
- * @param width the width of the panel
- * @param height the height of the panel
- * @param convertImagesToJPEG
- * @param quality
- * @return a <CODE>Graphics2D</CODE>
- */
- public java.awt.Graphics2D createGraphics(float width, float height, boolean convertImagesToJPEG, float quality) {
- return new PdfGraphics2D(this, width, height, null, false, convertImagesToJPEG, quality);
- }
-
- /** Gets a <CODE>Graphics2D</CODE> to print on. The graphics
- * are translated to PDF commands.
- * @param width the width of the panel
- * @param height the height of the panel
- * @param convertImagesToJPEG
- * @param quality
- * @param printerJob
- * @return a <CODE>Graphics2D</CODE>
- */
- public java.awt.Graphics2D createPrinterGraphics(float width, float height, boolean convertImagesToJPEG, float quality, PrinterJob printerJob) {
- return new PdfPrinterGraphics2D(this, width, height, null, false, convertImagesToJPEG, quality, printerJob);
- }
-
- /** Gets a <CODE>Graphics2D</CODE> to print on. The graphics
- * are translated to PDF commands.
- * @param width
- * @param height
- * @param convertImagesToJPEG
- * @param quality
- * @return A Graphics2D object
- */
- public java.awt.Graphics2D createGraphicsShapes(float width, float height, boolean convertImagesToJPEG, float quality) {
- return new PdfGraphics2D(this, width, height, null, true, convertImagesToJPEG, quality);
- }
-
- /** Gets a <CODE>Graphics2D</CODE> to print on. The graphics
- * are translated to PDF commands.
- * @param width
- * @param height
- * @param convertImagesToJPEG
- * @param quality
- * @param printerJob
- * @return a Graphics2D object
- */
- public java.awt.Graphics2D createPrinterGraphicsShapes(float width, float height, boolean convertImagesToJPEG, float quality, PrinterJob printerJob) {
- return new PdfPrinterGraphics2D(this, width, height, null, true, convertImagesToJPEG, quality, printerJob);
- }
-
- /** Gets a <CODE>Graphics2D</CODE> to write on. The graphics
- * are translated to PDF commands.
- * @param width the width of the panel
- * @param height the height of the panel
- * @param fontMapper the mapping from awt fonts to <CODE>BaseFont</CODE>
- * @return a <CODE>Graphics2D</CODE>
- */
- public java.awt.Graphics2D createGraphics(float width, float height, FontMapper fontMapper) {
- return new PdfGraphics2D(this, width, height, fontMapper, false, false, 0);
- }
-
- /** Gets a <CODE>Graphics2D</CODE> to print on. The graphics
- * are translated to PDF commands.
- * @param width the width of the panel
- * @param height the height of the panel
- * @param fontMapper the mapping from awt fonts to <CODE>BaseFont</CODE>
- * @param printerJob a printer job
- * @return a <CODE>Graphics2D</CODE>
- */
- public java.awt.Graphics2D createPrinterGraphics(float width, float height, FontMapper fontMapper, PrinterJob printerJob) {
- return new PdfPrinterGraphics2D(this, width, height, fontMapper, false, false, 0, printerJob);
- }
-
- /** Gets a <CODE>Graphics2D</CODE> to write on. The graphics
- * are translated to PDF commands.
- * @param width the width of the panel
- * @param height the height of the panel
- * @param fontMapper the mapping from awt fonts to <CODE>BaseFont</CODE>
- * @param convertImagesToJPEG converts awt images to jpeg before inserting in pdf
- * @param quality the quality of the jpeg
- * @return a <CODE>Graphics2D</CODE>
- */
- public java.awt.Graphics2D createGraphics(float width, float height, FontMapper fontMapper, boolean convertImagesToJPEG, float quality) {
- return new PdfGraphics2D(this, width, height, fontMapper, false, convertImagesToJPEG, quality);
- }
-
- /** Gets a <CODE>Graphics2D</CODE> to print on. The graphics
- * are translated to PDF commands.
- * @param width the width of the panel
- * @param height the height of the panel
- * @param fontMapper the mapping from awt fonts to <CODE>BaseFont</CODE>
- * @param convertImagesToJPEG converts awt images to jpeg before inserting in pdf
- * @param quality the quality of the jpeg
- * @param printerJob a printer job
- * @return a <CODE>Graphics2D</CODE>
- */
- public java.awt.Graphics2D createPrinterGraphics(float width, float height, FontMapper fontMapper, boolean convertImagesToJPEG, float quality, PrinterJob printerJob) {
- return new PdfPrinterGraphics2D(this, width, height, fontMapper, false, convertImagesToJPEG, quality, printerJob);
- }
-
- PageResources getPageResources() {
- return pdf.getPageResources();
- }
-
- /** Sets the graphic state
- * @param gstate the graphic state
- */
- public void setGState(PdfGState gstate) {
- PdfObject obj[] = writer.addSimpleExtGState(gstate);
- PageResources prs = getPageResources();
- PdfName name = prs.addExtGState((PdfName)obj[0], (PdfIndirectReference)obj[1]);
- content.append(name.getBytes()).append(" gs").append_i(separator);
- }
-
- /**
- * Begins a graphic block whose visibility is controled by the <CODE>layer</CODE>.
- * Blocks can be nested. Each block must be terminated by an {@link #endLayer()}.<p>
- * Note that nested layers with {@link PdfLayer#addChild(PdfLayer)} only require a single
- * call to this method and a single call to {@link #endLayer()}; all the nesting control
- * is built in.
- * @param layer the layer
- */
- public void beginLayer(PdfOCG layer) {
- if ((layer instanceof PdfLayer) && ((PdfLayer)layer).getTitle() != null)
- throw new IllegalArgumentException("A title is not a layer");
- if (layerDepth == null)
- layerDepth = new ArrayList();
- if (layer instanceof PdfLayerMembership) {
- layerDepth.add(new Integer(1));
- beginLayer2(layer);
- return;
- }
- int n = 0;
- PdfLayer la = (PdfLayer)layer;
- while (la != null) {
- if (la.getTitle() == null) {
- beginLayer2(la);
- ++n;
- }
- la = la.getParent();
- }
- layerDepth.add(new Integer(n));
- }
-
- private void beginLayer2(PdfOCG layer) {
- PdfName name = writer.addSimpleLayer(layer);
- PageResources prs = getPageResources();
- name = prs.addLayer(name, layer.getRef());
- content.append("/OC ").append(name.getBytes()).append(" BDC").append_i(separator);
- }
-
- /**
- * Ends a layer controled graphic block. It will end the most recent open block.
- */
- public void endLayer() {
- int n = 1;
- if (layerDepth != null && layerDepth.size() > 0) {
- n = ((Integer)layerDepth.get(layerDepth.size() - 1)).intValue();
- layerDepth.remove(layerDepth.size() - 1);
- }
- while (n-- > 0)
- content.append("EMC").append_i(separator);
- }
-
- /** Concatenates a transformation to the current transformation
- * matrix.
- * @param af the transformation
- */
- public void transform(AffineTransform af) {
- double arr[] = new double[6];
- af.getMatrix(arr);
- content.append(arr[0]).append(' ').append(arr[1]).append(' ').append(arr[2]).append(' ');
- content.append(arr[3]).append(' ').append(arr[4]).append(' ').append(arr[5]).append(" cm").append_i(separator);
- }
-
- void addAnnotation(PdfAnnotation annot) {
- writer.addAnnotation(annot);
- }
-
- /**
- * Sets the default colorspace.
- * @param name the name of the colorspace. It can be <CODE>PdfName.DEFAULTGRAY</CODE>, <CODE>PdfName.DEFAULTRGB</CODE>
- * or <CODE>PdfName.DEFAULTCMYK</CODE>
- * @param obj the colorspace. A <CODE>null</CODE> or <CODE>PdfNull</CODE> removes any colorspace with the same name
- */
- public void setDefaultColorspace(PdfName name, PdfObject obj) {
- PageResources prs = getPageResources();
- prs.addDefaultColor(name, obj);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfContents.java b/LibrarySource/com/lowagie/text/pdf/PdfContents.java
deleted file mode 100644
index fb031cf..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfContents.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * $Id: PdfContents.java,v 1.26 2002/06/20 13:28:22 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.DocWriter;
-import com.lowagie.text.Document;
-import com.lowagie.text.Rectangle;
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-import java.util.zip.DeflaterOutputStream;
-
-/**
- * <CODE>PdfContents</CODE> is a <CODE>PdfStream</CODE> containing the contents (text + graphics) of a <CODE>PdfPage</CODE>.
- */
-
-class PdfContents extends PdfStream {
-
- static final byte SAVESTATE[] = DocWriter.getISOBytes("q\n");
- static final byte RESTORESTATE[] = DocWriter.getISOBytes("Q\n");
- static final byte ROTATE90[] = DocWriter.getISOBytes("0 1 -1 0 ");
- static final byte ROTATE180[] = DocWriter.getISOBytes("-1 0 0 -1 ");
- static final byte ROTATE270[] = DocWriter.getISOBytes("0 -1 1 0 ");
- static final byte ROTATEFINAL[] = DocWriter.getISOBytes(" cm\n");
- // constructor
-
-/**
- * Constructs a <CODE>PdfContents</CODE>-object, containing text and general graphics.
- *
- * @param under the direct content that is under all others
- * @param content the graphics in a page
- * @param text the text in a page
- * @param secondContent the direct content that is over all others
- * @throws BadPdfFormatException on error
- */
-
- PdfContents(PdfContentByte under, PdfContentByte content, PdfContentByte text, PdfContentByte secondContent, Rectangle page) throws BadPdfFormatException {
- super();
- try {
- OutputStream out = null;
- streamBytes = new ByteArrayOutputStream();
- if (Document.compress)
- {
- compressed = true;
- out = new DeflaterOutputStream(streamBytes);
- }
- else
- out = streamBytes;
- int rotation = page.getRotation();
- switch (rotation) {
- case 90:
- out.write(ROTATE90);
- out.write(DocWriter.getISOBytes(ByteBuffer.formatDouble(page.top())));
- out.write(' ');
- out.write('0');
- out.write(ROTATEFINAL);
- break;
- case 180:
- out.write(ROTATE180);
- out.write(DocWriter.getISOBytes(ByteBuffer.formatDouble(page.right())));
- out.write(' ');
- out.write(DocWriter.getISOBytes(ByteBuffer.formatDouble(page.top())));
- out.write(ROTATEFINAL);
- break;
- case 270:
- out.write(ROTATE270);
- out.write('0');
- out.write(' ');
- out.write(DocWriter.getISOBytes(ByteBuffer.formatDouble(page.right())));
- out.write(ROTATEFINAL);
- break;
- }
- if (under.size() > 0) {
- out.write(SAVESTATE);
- under.getInternalBuffer().writeTo(out);
- out.write(RESTORESTATE);
- }
- if (content.size() > 0) {
- out.write(SAVESTATE);
- content.getInternalBuffer().writeTo(out);
- out.write(RESTORESTATE);
- }
- if (text != null) {
- out.write(SAVESTATE);
- text.getInternalBuffer().writeTo(out);
- out.write(RESTORESTATE);
- }
- if (secondContent.size() > 0) {
- secondContent.getInternalBuffer().writeTo(out);
- }
- out.close();
- }
- catch (Exception e) {
- throw new BadPdfFormatException(e.getMessage());
- }
- put(PdfName.LENGTH, new PdfNumber(streamBytes.size()));
- if (compressed)
- put(PdfName.FILTER, PdfName.FLATEDECODE);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfDashPattern.java b/LibrarySource/com/lowagie/text/pdf/PdfDashPattern.java
deleted file mode 100644
index bd252f4..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfDashPattern.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * $Id: PdfDashPattern.java,v 1.33 2003/05/02 09:01:18 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * A <CODE>PdfDashPattern</CODE> defines a dash pattern as described in
- * the PDF Reference Manual version 1.3 p 325 (section 8.4.3).
- *
- * @see PdfArray
- */
-
-public class PdfDashPattern extends PdfArray {
-
- // membervariables
-
-/** This is the length of a dash. */
- private float dash = -1;
-
-/** This is the length of a gap. */
- private float gap = -1;
-
-/** This is the phase. */
- private float phase = -1;
-
- // constructors
-
-/**
- * Constructs a new <CODE>PdfDashPattern</CODE>.
- */
-
- public PdfDashPattern() {
- super();
- }
-
-/**
- * Constructs a new <CODE>PdfDashPattern</CODE>.
- */
-
- public PdfDashPattern(float dash) {
- super(new PdfNumber(dash));
- this.dash = dash;
- }
-
-/**
- * Constructs a new <CODE>PdfDashPattern</CODE>.
- */
-
- public PdfDashPattern(float dash, float gap) {
- super(new PdfNumber(dash));
- add(new PdfNumber(gap));
- this.dash = dash;
- this.gap = gap;
- }
-
-/**
- * Constructs a new <CODE>PdfDashPattern</CODE>.
- */
-
- public PdfDashPattern(float dash, float gap, float phase) {
- super(new PdfNumber(dash));
- add(new PdfNumber(gap));
- this.dash = dash;
- this.gap = gap;
- this.phase = phase;
- }
-
- public void add(float n) {
- add(new PdfNumber(n));
- }
-
-/**
- * Returns the PDF representation of this <CODE>PdfArray</CODE>.
- *
- * @return an array of <CODE>byte</CODE>s
- */
-
- public void toPdf(PdfWriter writer, OutputStream os) throws IOException {
- os.write('[');
-
- if (dash >= 0) {
- new PdfNumber(dash).toPdf(writer, os);
- if (gap >= 0) {
- os.write(' ');
- new PdfNumber(gap).toPdf(writer, os);
- }
- }
- os.write(']');
- if (phase >=0) {
- os.write(' ');
- new PdfNumber(phase).toPdf(writer, os);
- }
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfDate.java b/LibrarySource/com/lowagie/text/pdf/PdfDate.java
deleted file mode 100644
index df14a24..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfDate.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * $Id: PdfDate.java,v 1.23 2002/07/09 11:28:22 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.util.GregorianCalendar;
-import java.util.Calendar;
-import java.util.SimpleTimeZone;
-
-/**
- * <CODE>PdfDate</CODE> is the PDF date object.
- * <P>
- * PDF defines a standard date format. The PDF date format closely follows the format
- * defined by the international standard ASN.1 (Abstract Syntax Notation One, defined
- * in CCITT X.208 or ISO/IEC 8824). A date is a <CODE>PdfString</CODE> of the form:
- * <P><BLOCKQUOTE>
- * (D: YYYYMMDDHHmmSSOHH'mm')
- * </BLOCKQUOTE><P>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 7.2 (page 183-184)
- *
- * @see PdfString
- * @see java.util.GregorianCalendar
- */
-
-public class PdfDate extends PdfString {
-
- private static final int dateSpace[] = {Calendar.YEAR, 4, 0, Calendar.MONTH, 2, -1, Calendar.DAY_OF_MONTH, 2, 0,
- Calendar.HOUR_OF_DAY, 2, 0, Calendar.MINUTE, 2, 0, Calendar.SECOND, 2, 0};
-
- // constructors
-
-/**
- * Constructs a <CODE>PdfDate</CODE>-object.
- *
- * @param d the date that has to be turned into a <CODE>PdfDate</CODE>-object
- */
-
- public PdfDate(Calendar d) {
- super();
- StringBuffer date = new StringBuffer("D:");
- date.append(setLength(d.get(Calendar.YEAR), 4));
- date.append(setLength(d.get(Calendar.MONTH) + 1, 2));
- date.append(setLength(d.get(Calendar.DATE), 2));
- date.append(setLength(d.get(Calendar.HOUR_OF_DAY), 2));
- date.append(setLength(d.get(Calendar.MINUTE), 2));
- date.append(setLength(d.get(Calendar.SECOND), 2));
- int timezone = d.get(Calendar.ZONE_OFFSET) / (60 * 60 * 1000);
- if (timezone == 0) {
- date.append("Z");
- }
- else if (timezone < 0) {
- date.append("-");
- timezone = -timezone;
- }
- else {
- date.append("+");
- }
- if (timezone != 0) {
- date.append(setLength(timezone, 2)).append("'");
- int zone = Math.abs(d.get(Calendar.ZONE_OFFSET) / (60 * 1000)) - (timezone * 60);
- date.append(setLength(zone, 2)).append("'");
- }
- value = date.toString();
- }
-
-/**
- * Constructs a <CODE>PdfDate</CODE>-object, representing the current day and time.
- */
-
- public PdfDate() {
- this(new GregorianCalendar());
- }
-
-/**
- * Adds a number of leading zeros to a given <CODE>String</CODE> in order to get a <CODE>String</CODE>
- * of a certain length.
- *
- * @param i a given number
- * @param length the length of the resulting <CODE>String</CODE>
- * @return the resulting <CODE>String</CODE>
- */
-
- private String setLength(int i, int length) { // 1.3-1.4 problem fixed by Finn Bock
- StringBuffer tmp = new StringBuffer();
- tmp.append(i);
- while (tmp.length() < length) {
- tmp.insert(0, "0");
- }
- tmp.setLength(length);
- return tmp.toString();
- }
-
- /**
- * Converts a PDF string representing a date into a Calendar.
- * @param s the PDF string representing a date
- * @return a <CODE>Calendar</CODE> representing the date or <CODE>null</CODE> if the string
- * was not a date
- */
- public static Calendar decode(String s) {
- try {
- if (s.startsWith("D:"))
- s = s.substring(2);
- GregorianCalendar calendar;
- int slen = s.length();
- int idx = s.indexOf('Z');
- if (idx >= 0) {
- slen = idx;
- calendar = new GregorianCalendar(new SimpleTimeZone(0, "ZPDF"));
- }
- else {
- int sign = 1;
- idx = s.indexOf('+');
- if (idx < 0) {
- idx = s.indexOf('-');
- if (idx >= 0)
- sign = -1;
- }
- if (idx < 0)
- calendar = new GregorianCalendar();
- else {
- int offset = Integer.parseInt(s.substring(idx + 1, idx + 3)) * 60;
- if (idx + 5 < s.length())
- offset += Integer.parseInt(s.substring(idx + 4, idx + 6));
- calendar = new GregorianCalendar(new SimpleTimeZone(offset * sign * 60000, "ZPDF"));
- slen = idx;
- }
- }
- calendar.clear();
- idx = 0;
- for (int k = 0; k < dateSpace.length; k += 3) {
- if (idx >= slen)
- break;
- calendar.set(dateSpace[k], Integer.parseInt(s.substring(idx, idx + dateSpace[k + 1])) + dateSpace[k + 2]);
- idx += dateSpace[k + 1];
- }
- return calendar;
- }
- catch (Exception e) {
- return null;
- }
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfDestination.java b/LibrarySource/com/lowagie/text/pdf/PdfDestination.java
deleted file mode 100644
index 36c49ba..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfDestination.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * $Id: PdfDestination.java,v 1.22 2002/06/20 13:28:22 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/**
- * A <CODE>PdfColor</CODE> defines a Color (it's a <CODE>PdfArray</CODE> containing 3 values).
- *
- * @see PdfDictionary
- */
-
-public class PdfDestination extends PdfArray {
-
- // public static final member-variables
-
-/** This is a possible destination type */
- public static final int XYZ = 0;
-
-/** This is a possible destination type */
- public static final int FIT = 1;
-
-/** This is a possible destination type */
- public static final int FITH = 2;
-
-/** This is a possible destination type */
- public static final int FITV = 3;
-
-/** This is a possible destination type */
- public static final int FITR = 4;
-
-/** This is a possible destination type */
- public static final int FITB = 5;
-
-/** This is a possible destination type */
- public static final int FITBH = 6;
-
-/** This is a possible destination type */
- public static final int FITBV = 7;
-
- // member variables
-
-/** Is the indirect reference to a page already added? */
- private boolean status = false;
-
- // constructors
-
-/**
- * Constructs a new <CODE>PdfDestination</CODE>.
- * <P>
- * If <VAR>type</VAR> equals <VAR>FITB</VAR>, the bounding box of a page
- * will fit the window of the Reader. Otherwise the type will be set to
- * <VAR>FIT</VAR> so that the entire page will fit to the window.
- *
- * @param type The destination type
- */
-
- public PdfDestination(int type) {
- super();
- if (type == FITB) {
- add(PdfName.FITB);
- }
- else {
- add(PdfName.FIT);
- }
- }
-
-/**
- * Constructs a new <CODE>PdfDestination</CODE>.
- * <P>
- * If <VAR>type</VAR> equals <VAR>FITBH</VAR> / <VAR>FITBV</VAR>,
- * the width / height of the bounding box of a page will fit the window
- * of the Reader. The parameter will specify the y / x coordinate of the
- * top / left edge of the window. If the <VAR>type</VAR> equals <VAR>FITH</VAR>
- * or <VAR>FITV</VAR> the width / height of the entire page will fit
- * the window and the parameter will specify the y / x coordinate of the
- * top / left edge. In all other cases the type will be set to <VAR>FITH</VAR>.
- *
- * @param type the destination type
- * @param parameter a parameter to combined with the destination type
- */
-
- public PdfDestination(int type, float parameter) {
- super(new PdfNumber(parameter));
- switch(type) {
- default:
- addFirst(PdfName.FITH);
- break;
- case FITV:
- addFirst(PdfName.FITV);
- break;
- case FITBH:
- addFirst(PdfName.FITBH);
- break;
- case FITBV:
- addFirst(PdfName.FITBV);
- }
- }
-
-/** Constructs a new <CODE>PdfDestination</CODE>.
- * <P>
- * Display the page, with the coordinates (left, top) positioned
- * at the top-left corner of the window and the contents of the page magnified
- * by the factor zoom. A negative value for any of the parameters left or top, or a
- * zoom value of 0 specifies that the current value of that parameter is to be retained unchanged.
- * @param type must be a <VAR>PdfDestination.XYZ</VAR>
- * @param left the left value. Negative to place a null
- * @param top the top value. Negative to place a null
- * @param zoom The zoom factor. A value of 0 keeps the current value
- */
-
- public PdfDestination(int type, float left, float top, float zoom) {
- super(PdfName.XYZ);
- if (left < 0)
- add(PdfNull.PDFNULL);
- else
- add(new PdfNumber(left));
- if (top < 0)
- add(PdfNull.PDFNULL);
- else
- add(new PdfNumber(top));
- add(new PdfNumber(zoom));
- }
-
-/** Constructs a new <CODE>PdfDestination</CODE>.
- * <P>
- * Display the page, with its contents magnified just enough
- * to fit the rectangle specified by the coordinates left, bottom, right, and top
- * entirely within the window both horizontally and vertically. If the required
- * horizontal and vertical magnification factors are different, use the smaller of
- * the two, centering the rectangle within the window in the other dimension.
- *
- * @param type must be PdfDestination.FITR
- * @param left a parameter
- * @param bottom a parameter
- * @param right a parameter
- * @param top a parameter
- * @since iText0.38
- */
-
- public PdfDestination(int type, float left, float bottom, float right, float top) {
- super(PdfName.FITR);
- add(new PdfNumber(left));
- add(new PdfNumber(bottom));
- add(new PdfNumber(right));
- add(new PdfNumber(top));
- }
-
- // methods
-
-/**
- * Checks if an indirect reference to a page has been added.
- *
- * @return <CODE>true</CODE> or <CODE>false</CODE>
- */
-
- public boolean hasPage() {
- return status;
- }
-
-/** Adds the indirect reference of the destination page.
- *
- * @param page an indirect reference
- * @return true if the page reference was added
- */
-
- public boolean addPage(PdfIndirectReference page) {
- if (!status) {
- addFirst(page);
- status = true;
- return true;
- }
- return false;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfDictionary.java b/LibrarySource/com/lowagie/text/pdf/PdfDictionary.java
deleted file mode 100644
index 4af1471..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfDictionary.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * $Id: PdfDictionary.java,v 1.27 2002/07/09 11:28:22 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Iterator;
-import java.util.HashMap;
-import java.util.Set;
-
-/**
- * <CODE>PdfDictionary</CODE> is the Pdf dictionary object.
- * <P>
- * A dictionary is an associative table containing pairs of objects. The first element
- * of each pair is called the <I>key</I> and the second element is called the <I>value</I>.
- * Unlike dictionaries in the PostScript language, a key must be a <CODE>PdfName</CODE>.
- * A value can be any kind of <CODE>PdfObject</CODE>, including a dictionary. A dictionary is
- * generally used to collect and tie together the attributes of a complex object, with each
- * key-value pair specifying the name and value of an attribute.<BR>
- * A dictionary is represented by two left angle brackets (<<), followed by a sequence of
- * key-value pairs, followed by two right angle brackets (>>).<BR>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 4.7 (page 40-41).
- * <P>
- *
- * @see PdfObject
- * @see PdfName
- * @see BadPdfFormatException
- */
-
-public class PdfDictionary extends PdfObject {
-
- // static membervariables (types of dictionary's)
-
-/** This is a possible type of dictionary */
- public static final PdfName FONT = PdfName.FONT;
-
-/** This is a possible type of dictionary */
- public static final PdfName OUTLINES = PdfName.OUTLINES;
-
-/** This is a possible type of dictionary */
- public static final PdfName PAGE = PdfName.PAGE;
-
-/** This is a possible type of dictionary */
- public static final PdfName PAGES = PdfName.PAGES;
-
-/** This is a possible type of dictionary */
- public static final PdfName CATALOG = PdfName.CATALOG;
-
- // membervariables
-
-/** This is the type of this dictionary */
- private PdfName dictionaryType = null;
-
-/** This is the hashmap that contains all the values and keys of the dictionary */
- protected HashMap hashMap;
-
- // constructors
-
-/**
- * Constructs an empty <CODE>PdfDictionary</CODE>-object.
- */
-
- public PdfDictionary() {
- super(DICTIONARY);
- hashMap = new HashMap();
- }
-
-/**
- * Constructs a <CODE>PdfDictionary</CODE>-object of a certain type.
- *
- * @param type a <CODE>PdfName</CODE>
- */
-
- public PdfDictionary(PdfName type) {
- this();
- dictionaryType = type;
- put(PdfName.TYPE, dictionaryType);
- }
-
- // methods overriding some methods in PdfObject
-
-/**
- * Returns the PDF representation of this <CODE>PdfDictionary</CODE>.
- *
- * @return an array of <CODE>byte</CODE>
- */
-
- public void toPdf(PdfWriter writer, OutputStream os) throws IOException {
- os.write('<');
- os.write('<');
-
- // loop over all the object-pairs in the HashMap
- PdfName key;
- PdfObject value;
- int type = 0;
- for (Iterator i = hashMap.keySet().iterator(); i.hasNext(); ) {
- key = (PdfName) i.next();
- value = (PdfObject) hashMap.get(key);
- key.toPdf(writer, os);
- type = value.type();
- if (type != PdfObject.ARRAY && type != PdfObject.DICTIONARY && type != PdfObject.NAME && type != PdfObject.STRING)
- os.write(' ');
- value.toPdf(writer, os);
- }
- os.write('>');
- os.write('>');
- }
-
- // methods concerning the HashMap member value
-
-/**
- * Adds a <CODE>PdfObject</CODE> and its key to the <CODE>PdfDictionary</CODE>.
- *
- * @param key key of the entry (a <CODE>PdfName</CODE>)
- * @param value value of the entry (a <CODE>PdfObject</CODE>)
- * @return the previous </CODE>PdfObject</CODE> corresponding with the <VAR>key</VAR>
- */
-
- public PdfObject put(PdfName key, PdfObject value) {
- return (PdfObject) hashMap.put(key, value);
- }
-
-/**
- * Adds a <CODE>PdfObject</CODE> and its key to the <CODE>PdfDictionary</CODE>.
- * If the value is null it does nothing.
- *
- * @param key key of the entry (a <CODE>PdfName</CODE>)
- * @param value value of the entry (a <CODE>PdfObject</CODE>)
- * @return the previous </CODE>PdfObject</CODE> corresponding with the <VAR>key</VAR>
- */
- public PdfObject putEx(PdfName key, PdfObject value) {
- if (value == null)
- return null;
- return (PdfObject) hashMap.put(key, value);
- }
-
-/**
- * Adds a <CODE>PdfObject</CODE> and its key to the <CODE>PdfDictionary</CODE>.
- * If the value is null the key is deleted.
- *
- * @param key key of the entry (a <CODE>PdfName</CODE>)
- * @param value value of the entry (a <CODE>PdfObject</CODE>)
- * @return the previous </CODE>PdfObject</CODE> corresponding with the <VAR>key</VAR>
- */
- public PdfObject putDel(PdfName key, PdfObject value) {
- if (value == null)
- return (PdfObject) hashMap.remove(key);;
- return (PdfObject) hashMap.put(key, value);
- }
-
-/**
- * Removes a <CODE>PdfObject</CODE> and its key from the <CODE>PdfDictionary</CODE>.
- *
- * @param key key of the entry (a <CODE>PdfName</CODE>)
- * @return the previous </CODE>PdfObject</CODE> corresponding with the <VAR>key</VAR>
- */
-
- public PdfObject remove(PdfName key) {
- return (PdfObject) hashMap.remove(key);
- }
-
-/**
- * Gets a <CODE>PdfObject</CODE> with a certain key from the <CODE>PdfDictionary</CODE>.
- *
- * @param key key of the entry (a <CODE>PdfName</CODE>)
- * @return the previous </CODE>PdfObject</CODE> corresponding with the <VAR>key</VAR>
- */
-
- public PdfObject get(PdfName key) {
- return (PdfObject) hashMap.get(key);
- }
-
- // methods concerning the type of Dictionary
-
-/**
- * Checks if a <CODE>PdfDictionary</CODE> is of a certain type.
- *
- * @param type a type of dictionary
- * @return <CODE>true</CODE> of <CODE>false</CODE>
- *
- * @deprecated
- */
-
- public boolean isDictionaryType(PdfName type) {
- return dictionaryType.compareTo(type) == 0;
- }
-
-/**
- * Checks if a <CODE>Dictionary</CODE> is of the type FONT.
- *
- * @return <CODE>true</CODE> if it is, <CODE>false</CODE> if it isn't.
- */
-
- public boolean isFont() {
- return dictionaryType.compareTo(FONT) == 0;
- }
-
-/**
- * Checks if a <CODE>Dictionary</CODE> is of the type PAGE.
- *
- * @return <CODE>true</CODE> if it is, <CODE>false</CODE> if it isn't.
- */
-
- public boolean isPage() {
- return dictionaryType.compareTo(PAGE) == 0;
- }
-
-/**
- * Checks if a <CODE>Dictionary</CODE> is of the type PAGES.
- *
- * @return <CODE>true</CODE> if it is, <CODE>false</CODE> if it isn't.
- */
-
- public boolean isPages() {
- return dictionaryType.compareTo(PAGES) == 0;
- }
-
-/**
- * Checks if a <CODE>Dictionary</CODE> is of the type CATALOG.
- *
- * @return <CODE>true</CODE> if it is, <CODE>false</CODE> if it isn't.
- */
-
- public boolean isCatalog() {
- return dictionaryType.compareTo(CATALOG) == 0;
- }
-
-/**
- * Checks if a <CODE>Dictionary</CODE> is of the type OUTLINES.
- *
- * @return <CODE>true</CODE> if it is, <CODE>false</CODE> if it isn't.
- */
-
- public boolean isOutlineTree() {
- return dictionaryType.compareTo(OUTLINES) == 0;
- }
-
- public void merge(PdfDictionary other) {
- hashMap.putAll(other.hashMap);
- }
-
- public void mergeDifferent(PdfDictionary other) {
- for (Iterator i = other.hashMap.keySet().iterator(); i.hasNext();) {
- Object key = i.next();
- if (!hashMap.containsKey(key)) {
- hashMap.put(key, other.hashMap.get(key));
- }
- }
- }
-
- public Set getKeys() {
- return hashMap.keySet();
- }
-
- public void putAll(PdfDictionary dic) {
- hashMap.putAll(dic.hashMap);
- }
-
- public int size() {
- return hashMap.size();
- }
-
- public boolean contains(PdfName key) {
- return hashMap.containsKey(key);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfDocument.java b/LibrarySource/com/lowagie/text/pdf/PdfDocument.java
deleted file mode 100644
index e45e4ea..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfDocument.java
+++ /dev/null
@@ -1,2972 +0,0 @@
-/*
- * $Name: $
- * $Id: PdfDocument.java,v 1.199 2005/05/03 09:05:50 blowagie Exp $
- *
- * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import headless.awt.Color;
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.TreeMap;
-
-import com.lowagie.text.Anchor;
-import com.lowagie.text.Annotation;
-import com.lowagie.text.BadElementException;
-import com.lowagie.text.Cell;
-import com.lowagie.text.Chunk;
-import com.lowagie.text.DocListener;
-import com.lowagie.text.Document;
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.Element;
-import com.lowagie.text.ExceptionConverter;
-import com.lowagie.text.Graphic;
-import com.lowagie.text.HeaderFooter;
-import com.lowagie.text.Image;
-import com.lowagie.text.List;
-import com.lowagie.text.ListItem;
-import com.lowagie.text.Meta;
-import com.lowagie.text.Paragraph;
-import com.lowagie.text.Phrase;
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.Section;
-import com.lowagie.text.StringCompare;
-import com.lowagie.text.Table;
-import com.lowagie.text.Watermark;
-
-/**
- * <CODE>PdfDocument</CODE> is the class that is used by <CODE>PdfWriter</CODE>
- * to translate a <CODE>Document</CODE> into a PDF with different pages.
- * <P>
- * A <CODE>PdfDocument</CODE> always listens to a <CODE>Document</CODE>
- * and adds the Pdf representation of every <CODE>Element</CODE> that is
- * added to the <CODE>Document</CODE>.
- *
- * @see com.lowagie.text.Document
- * @see com.lowagie.text.DocListener
- * @see PdfWriter
- */
-
-class PdfDocument extends Document implements DocListener {
-
- /**
- * <CODE>PdfInfo</CODE> is the PDF InfoDictionary.
- * <P>
- * A document's trailer may contain a reference to an Info dictionary that provides information
- * about the document. This optional dictionary may contain one or more keys, whose values
- * should be strings.<BR>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 6.10 (page 120-121)
- */
-
- public static class PdfInfo extends PdfDictionary {
-
- // constructors
-
- /**
- * Construct a <CODE>PdfInfo</CODE>-object.
- */
-
- PdfInfo() {
- super();
- addProducer();
- addCreationDate();
- }
-
- /**
- * Constructs a <CODE>PdfInfo</CODE>-object.
- *
- * @param author name of the author of the document
- * @param title title of the document
- * @param subject subject of the document
- */
-
- PdfInfo(String author, String title, String subject) {
- this();
- addTitle(title);
- addSubject(subject);
- addAuthor(author);
- }
-
- /**
- * Adds the title of the document.
- *
- * @param title the title of the document
- */
-
- void addTitle(String title) {
- put(PdfName.TITLE, new PdfString(title, PdfObject.TEXT_UNICODE));
- }
-
- /**
- * Adds the subject to the document.
- *
- * @param subject the subject of the document
- */
-
- void addSubject(String subject) {
- put(PdfName.SUBJECT, new PdfString(subject, PdfObject.TEXT_UNICODE));
- }
-
- /**
- * Adds some keywords to the document.
- *
- * @param keywords the keywords of the document
- */
-
- void addKeywords(String keywords) {
- put(PdfName.KEYWORDS, new PdfString(keywords, PdfObject.TEXT_UNICODE));
- }
-
- /**
- * Adds the name of the author to the document.
- *
- * @param author the name of the author
- */
-
- void addAuthor(String author) {
- put(PdfName.AUTHOR, new PdfString(author, PdfObject.TEXT_UNICODE));
- }
-
- /**
- * Adds the name of the creator to the document.
- *
- * @param creator the name of the creator
- */
-
- void addCreator(String creator) {
- put(PdfName.CREATOR, new PdfString(creator, PdfObject.TEXT_UNICODE));
- }
-
- /**
- * Adds the name of the producer to the document.
- */
-
- void addProducer() {
- // This line may only be changed by Bruno Lowagie or Paulo Soares
- put(PdfName.PRODUCER, new PdfString(getVersion()));
- // Do not edit the line above!
- }
-
- /**
- * Adds the date of creation to the document.
- */
-
- void addCreationDate() {
- PdfString date = new PdfDate();
- put(PdfName.CREATIONDATE, date);
- put(PdfName.MODDATE, date);
- }
-
- void addkey(String key, String value) {
- if (key.equals("Producer") || key.equals("CreationDate"))
- return;
- put(new PdfName(key), new PdfString(value, PdfObject.TEXT_UNICODE));
- }
- }
-
- /**
- * <CODE>PdfCatalog</CODE> is the PDF Catalog-object.
- * <P>
- * The Catalog is a dictionary that is the root node of the document. It contains a reference
- * to the tree of pages contained in the document, a reference to the tree of objects representing
- * the document's outline, a reference to the document's article threads, and the list of named
- * destinations. In addition, the Catalog indicates whether the document's outline or thumbnail
- * page images should be displayed automatically when the document is viewed and wether some location
- * other than the first page should be shown when the document is opened.<BR>
- * In this class however, only the reference to the tree of pages is implemented.<BR>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 6.2 (page 67-71)
- */
-
- static class PdfCatalog extends PdfDictionary {
-
- PdfWriter writer;
- // constructors
-
- /**
- * Constructs a <CODE>PdfCatalog</CODE>.
- *
- * @param pages an indirect reference to the root of the document's Pages tree.
- * @param writer the writer the catalog applies to
- */
-
- PdfCatalog(PdfIndirectReference pages, PdfWriter writer) {
- super(CATALOG);
- this.writer = writer;
- put(PdfName.PAGES, pages);
- }
-
- /**
- * Constructs a <CODE>PdfCatalog</CODE>.
- *
- * @param pages an indirect reference to the root of the document's Pages tree.
- * @param outlines an indirect reference to the outline tree.
- * @param writer the writer the catalog applies to
- */
-
- PdfCatalog(PdfIndirectReference pages, PdfIndirectReference outlines, PdfWriter writer) {
- super(CATALOG);
- this.writer = writer;
- put(PdfName.PAGES, pages);
- put(PdfName.PAGEMODE, PdfName.USEOUTLINES);
- put(PdfName.OUTLINES, outlines);
- }
-
- /**
- * Adds the names of the named destinations to the catalog.
- * @param localDestinations the local destinations
- * @param documentJavaScript the javascript used in the document
- * @param writer the writer the catalog applies to
- */
- void addNames(TreeMap localDestinations, ArrayList documentJavaScript, PdfWriter writer) {
- if (localDestinations.size() == 0 && documentJavaScript.size() == 0)
- return;
- try {
- PdfDictionary names = new PdfDictionary();
- if (localDestinations.size() > 0) {
- PdfArray ar = new PdfArray();
- for (Iterator i = localDestinations.keySet().iterator(); i.hasNext();) {
- String name = (String)i.next();
- Object obj[] = (Object[])localDestinations.get(name);
- PdfIndirectReference ref = (PdfIndirectReference)obj[1];
- ar.add(new PdfString(name));
- ar.add(ref);
- }
- PdfDictionary dests = new PdfDictionary();
- dests.put(PdfName.NAMES, ar);
- names.put(PdfName.DESTS, writer.addToBody(dests).getIndirectReference());
- }
- if (documentJavaScript.size() > 0) {
- String s[] = new String[documentJavaScript.size()];
- for (int k = 0; k < s.length; ++k)
- s[k] = Integer.toHexString(k);
- Arrays.sort(s, new StringCompare());
- PdfArray ar = new PdfArray();
- for (int k = 0; k < s.length; ++k) {
- ar.add(new PdfString(s[k]));
- ar.add((PdfIndirectReference)documentJavaScript.get(k));
- }
- PdfDictionary js = new PdfDictionary();
- js.put(PdfName.NAMES, ar);
- names.put(PdfName.JAVASCRIPT, writer.addToBody(js).getIndirectReference());
- }
- put(PdfName.NAMES, writer.addToBody(names).getIndirectReference());
- }
- catch (IOException e) {
- throw new ExceptionConverter(e);
- }
- }
-
- /** Sets the viewer preferences as the sum of several constants.
- * @param preferences the viewer preferences
- * @see PdfWriter#setViewerPreferences
- */
-
- void setViewerPreferences(int preferences) {
- PdfReader.setViewerPreferences(preferences, this);
- }
-
- void setOpenAction(PdfAction action) {
- put(PdfName.OPENACTION, action);
- }
-
-
- /** Sets the document level additional actions.
- * @param actions dictionary of actions
- */
- void setAdditionalActions(PdfDictionary actions) {
- try {
- put(PdfName.AA, writer.addToBody(actions).getIndirectReference());
- } catch (Exception e) {
- new ExceptionConverter(e);
- }
- }
-
-
- void setPageLabels(PdfPageLabels pageLabels) {
- put(PdfName.PAGELABELS, pageLabels.getDictionary());
- }
-
- void setAcroForm(PdfObject fields) {
- put(PdfName.ACROFORM, fields);
- }
- }
-
- // membervariables
- private PdfIndirectReference thumb;
-
- /** The characters to be applied the hanging ponctuation. */
- static final String hangingPunctuation = ".,;:'";
-
- /** The <CODE>PdfWriter</CODE>. */
- private PdfWriter writer;
-
- /** some meta information about the Document. */
- private PdfInfo info = new PdfInfo();
-
- /** Signals that OnOpenDocument should be called. */
- private boolean firstPageEvent = true;
-
- /** Signals that onParagraph is valid. */
- private boolean isParagraph = true;
-
- // Horizontal line
-
- /** The line that is currently being written. */
- private PdfLine line = null;
-
- /** This represents the current indentation of the PDF Elements on the left side. */
- private float indentLeft = 0;
-
- /** This represents the current indentation of the PDF Elements on the right side. */
- private float indentRight = 0;
-
- /** This represents the current indentation of the PDF Elements on the left side. */
- private float listIndentLeft = 0;
-
- /** This represents the current alignment of the PDF Elements. */
- private int alignment = Element.ALIGN_LEFT;
-
- // Vertical lines
-
- /** This is the PdfContentByte object, containing the text. */
- private PdfContentByte text;
-
- /** This is the PdfContentByte object, containing the borders and other Graphics. */
- private PdfContentByte graphics;
-
- /** The lines that are written until now. */
- private ArrayList lines = new ArrayList();
-
- /** This represents the leading of the lines. */
- private float leading = 0;
-
- /** This is the current height of the document. */
- private float currentHeight = 0;
-
- /** This represents the current indentation of the PDF Elements on the top side. */
- private float indentTop = 0;
-
- /** This represents the current indentation of the PDF Elements on the bottom side. */
- private float indentBottom = 0;
-
- /** This checks if the page is empty. */
- private boolean pageEmpty = true;
-
- private int textEmptySize;
- // resources
-
- /** This is the size of the next page. */
- protected Rectangle nextPageSize = null;
-
- /** This is the size of the several boxes of the current Page. */
- protected HashMap thisBoxSize = new HashMap();
-
- /** This is the size of the several boxes that will be used in
- * the next page. */
- protected HashMap boxSize = new HashMap();
-
- /** This are the page resources of the current Page. */
- protected PageResources pageResources;
-
- // images
-
- /** This is the image that could not be shown on a previous page. */
- private Image imageWait = null;
-
- /** This is the position where the image ends. */
- private float imageEnd = -1;
-
- /** This is the indentation caused by an image on the left. */
- private float imageIndentLeft = 0;
-
- /** This is the indentation caused by an image on the right. */
- private float imageIndentRight = 0;
-
- // annotations and outlines
-
- /** This is the array containing the references to the annotations. */
- private ArrayList annotations;
-
- /** This is an array containg references to some delayed annotations. */
- private ArrayList delayedAnnotations = new ArrayList();
-
- /** This is the AcroForm object. */
- PdfAcroForm acroForm;
-
- /** This is the root outline of the document. */
- private PdfOutline rootOutline;
-
- /** This is the current <CODE>PdfOutline</CODE> in the hierarchy of outlines. */
- private PdfOutline currentOutline;
-
- /** The current active <CODE>PdfAction</CODE> when processing an <CODE>Anchor</CODE>. */
- private PdfAction currentAction = null;
-
- /**
- * Stores the destinations keyed by name. Value is
- * <CODE>Object[]{PdfAction,PdfIndirectReference,PdfDestintion}</CODE>.
- */
- private TreeMap localDestinations = new TreeMap(new StringCompare());
-
- private ArrayList documentJavaScript = new ArrayList();
-
- /** these are the viewerpreferences of the document */
- private int viewerPreferences = 0;
-
- private String openActionName;
- private PdfAction openActionAction;
- private PdfDictionary additionalActions;
- private PdfPageLabels pageLabels;
-
- //add by Jin-Hsia Yang
- private boolean isNewpage = false;
-
- private float paraIndent = 0;
- //end add by Jin-Hsia Yang
-
- /** margin in x direction starting from the left. Will be valid in the next page */
- protected float nextMarginLeft;
-
- /** margin in x direction starting from the right. Will be valid in the next page */
- protected float nextMarginRight;
-
- /** margin in y direction starting from the top. Will be valid in the next page */
- protected float nextMarginTop;
-
- /** margin in y direction starting from the bottom. Will be valid in the next page */
- protected float nextMarginBottom;
-
-/** The duration of the page */
- protected int duration=-1; // negative values will indicate no duration
-
-/** The page transition */
- protected PdfTransition transition=null;
-
- protected PdfDictionary pageAA = null;
-
- /** Holds value of property strictImageSequence. */
- private boolean strictImageSequence = false;
-
- /** Holds the type of the last element, that has been added to the document. */
- private int lastElementType = -1;
-
-
- // constructors
-
- /**
- * Constructs a new PDF document.
- * @throws DocumentException on error
- */
-
- public PdfDocument() throws DocumentException {
- super();
- addProducer();
- addCreationDate();
- }
-
- // listener methods
-
- /**
- * Adds a <CODE>PdfWriter</CODE> to the <CODE>PdfDocument</CODE>.
- *
- * @param writer the <CODE>PdfWriter</CODE> that writes everything
- * what is added to this document to an outputstream.
- * @throws DocumentException on error
- */
-
- public void addWriter(PdfWriter writer) throws DocumentException {
- if (this.writer == null) {
- this.writer = writer;
- acroForm = new PdfAcroForm(writer);
- return;
- }
- throw new DocumentException("You can only add a writer to a PdfDocument once.");
- }
-
- /**
- * Sets the pagesize.
- *
- * @param pageSize the new pagesize
- * @return <CODE>true</CODE> if the page size was set
- */
-
- public boolean setPageSize(Rectangle pageSize) {
- if (writer != null && writer.isPaused()) {
- return false;
- }
- nextPageSize = new Rectangle(pageSize);
- return true;
- }
-
- /**
- * Changes the header of this document.
- *
- * @param header the new header
- */
-
- public void setHeader(HeaderFooter header) {
- if (writer != null && writer.isPaused()) {
- return;
- }
- super.setHeader(header);
- }
-
- /**
- * Resets the header of this document.
- */
-
- public void resetHeader() {
- if (writer != null && writer.isPaused()) {
- return;
- }
- super.resetHeader();
- }
-
- /**
- * Changes the footer of this document.
- *
- * @param footer the new footer
- */
-
- public void setFooter(HeaderFooter footer) {
- if (writer != null && writer.isPaused()) {
- return;
- }
- super.setFooter(footer);
- }
-
- /**
- * Resets the footer of this document.
- */
-
- public void resetFooter() {
- if (writer != null && writer.isPaused()) {
- return;
- }
- super.resetFooter();
- }
-
- /**
- * Sets the page number to 0.
- */
-
- public void resetPageCount() {
- if (writer != null && writer.isPaused()) {
- return;
- }
- super.resetPageCount();
- }
-
- /**
- * Sets the page number.
- *
- * @param pageN the new page number
- */
-
- public void setPageCount(int pageN) {
- if (writer != null && writer.isPaused()) {
- return;
- }
- super.setPageCount(pageN);
- }
-
- /**
- * Sets the <CODE>Watermark</CODE>.
- *
- * @param watermark the watermark to add
- * @return <CODE>true</CODE> if the element was added, <CODE>false</CODE> if not.
- */
-
- public boolean add(Watermark watermark) {
- if (writer != null && writer.isPaused()) {
- return false;
- }
- this.watermark = watermark;
- return true;
- }
-
- /**
- * Removes the <CODE>Watermark</CODE>.
- */
-
- public void removeWatermark() {
- if (writer != null && writer.isPaused()) {
- return;
- }
- this.watermark = null;
- }
-
- /**
- * Sets the margins.
- *
- * @param marginLeft the margin on the left
- * @param marginRight the margin on the right
- * @param marginTop the margin on the top
- * @param marginBottom the margin on the bottom
- * @return a <CODE>boolean</CODE>
- */
-
- public boolean setMargins(float marginLeft, float marginRight, float marginTop, float marginBottom) {
- if (writer != null && writer.isPaused()) {
- return false;
- }
- nextMarginLeft = marginLeft;
- nextMarginRight = marginRight;
- nextMarginTop = marginTop;
- nextMarginBottom = marginBottom;
- return true;
- }
-
- protected PdfArray rotateAnnotations() {
- PdfArray array = new PdfArray();
- int rotation = pageSize.getRotation() % 360;
- int currentPage = writer.getCurrentPageNumber();
- for (int k = 0; k < annotations.size(); ++k) {
- PdfAnnotation dic = (PdfAnnotation)annotations.get(k);
- int page = dic.getPlaceInPage();
- if (page > currentPage) {
- delayedAnnotations.add(dic);
- continue;
- }
- if (dic.isForm()) {
- if (!dic.isUsed()) {
- HashMap templates = dic.getTemplates();
- if (templates != null)
- acroForm.addFieldTemplates(templates);
- }
- PdfFormField field = (PdfFormField)dic;
- if (field.getParent() == null)
- acroForm.addDocumentField(field.getIndirectReference());
- }
- if (dic.isAnnotation()) {
- array.add(dic.getIndirectReference());
- if (!dic.isUsed()) {
- PdfRectangle rect = (PdfRectangle)dic.get(PdfName.RECT);
- switch (rotation) {
- case 90:
- dic.put(PdfName.RECT, new PdfRectangle(
- pageSize.top() - rect.bottom(),
- rect.left(),
- pageSize.top() - rect.top(),
- rect.right()));
- break;
- case 180:
- dic.put(PdfName.RECT, new PdfRectangle(
- pageSize.right() - rect.left(),
- pageSize.top() - rect.bottom(),
- pageSize.right() - rect.right(),
- pageSize.top() - rect.top()));
- break;
- case 270:
- dic.put(PdfName.RECT, new PdfRectangle(
- rect.bottom(),
- pageSize.right() - rect.left(),
- rect.top(),
- pageSize.right() - rect.right()));
- break;
- }
- }
- }
- if (!dic.isUsed()) {
- dic.setUsed();
- try {
- writer.addToBody(dic, dic.getIndirectReference());
- }
- catch (IOException e) {
- throw new ExceptionConverter(e);
- }
- }
- }
- return array;
- }
-
- /**
- * Makes a new page and sends it to the <CODE>PdfWriter</CODE>.
- *
- * @return a <CODE>boolean</CODE>
- * @throws DocumentException on error
- */
-
- public boolean newPage() throws DocumentException {
- lastElementType = -1;
- //add by Jin-Hsia Yang
- isNewpage = true;
- //end add by Jin-Hsia Yang
- if (writer.getDirectContent().size() == 0 && writer.getDirectContentUnder().size() == 0 && (pageEmpty || (writer != null && writer.isPaused()))) {
- return false;
- }
- PdfPageEvent pageEvent = writer.getPageEvent();
- if (pageEvent != null)
- pageEvent.onEndPage(writer, this);
-
- //Added to inform any listeners that we are moving to a new page (added by David Freels)
- super.newPage();
-
- // the following 2 lines were added by Pelikan Stephan
- imageIndentLeft = 0;
- imageIndentRight = 0;
-
- // we flush the arraylist with recently written lines
- flushLines();
- // we assemble the resources of this pages
- pageResources.addDefaultColorDiff(writer.getDefaultColorspace());
- PdfDictionary resources = pageResources.getResources();
- // we make a new page and add it to the document
- if (writer.getPDFXConformance() != PdfWriter.PDFXNONE) {
- if (thisBoxSize.containsKey("art") && thisBoxSize.containsKey("trim"))
- throw new PdfXConformanceException("Only one of ArtBox or TrimBox can exist in the page.");
- if (!thisBoxSize.containsKey("art") && !thisBoxSize.containsKey("trim")) {
- if (thisBoxSize.containsKey("crop"))
- thisBoxSize.put("trim", thisBoxSize.get("crop"));
- else
- thisBoxSize.put("trim", new PdfRectangle(pageSize, pageSize.getRotation()));
- }
- }
- PdfPage page;
- int rotation = pageSize.getRotation();
- page = new PdfPage(new PdfRectangle(pageSize, rotation), thisBoxSize, resources, rotation);
- // we add the transitions
- if (this.transition!=null) {
- page.put(PdfName.TRANS, this.transition.getTransitionDictionary());
- transition = null;
- }
- if (this.duration>0) {
- page.put(PdfName.DUR,new PdfNumber(this.duration));
- duration = 0;
- }
- // we add the page object additional actions
- if (pageAA != null) {
- try {
- page.put(PdfName.AA, writer.addToBody(pageAA).getIndirectReference());
- }
- catch (IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- pageAA = null;
- }
- // we add the annotations
- if (annotations.size() > 0) {
- PdfArray array = rotateAnnotations();
- if (array.size() != 0)
- page.put(PdfName.ANNOTS, array);
- }
- // we add the thumbs
- if (thumb != null) {
- page.put(PdfName.THUMB, thumb);
- thumb = null;
- }
- if (!open || close) {
- throw new PdfException("The document isn't open.");
- }
- if (text.size() > textEmptySize)
- text.endText();
- else
- text = null;
- PdfIndirectReference pageReference = writer.add(page, new PdfContents(writer.getDirectContentUnder(), graphics, text, writer.getDirectContent(), pageSize));
- // we initialize the new page
- initPage();
-
- //add by Jin-Hsia Yang
- isNewpage = false;
- //end add by Jin-Hsia Yang
-
- return true;
- }
-
- // methods to open and close a document
-
- /**
- * Opens the document.
- * <P>
- * You have to open the document before you can begin to add content
- * to the body of the document.
- */
-
- public void open() {
- if (!open) {
- super.open();
- writer.open();
- rootOutline = new PdfOutline(writer);
- currentOutline = rootOutline;
- }
- try {
- initPage();
- }
- catch(DocumentException de) {
- throw new ExceptionConverter(de);
- }
- }
-
- void outlineTree(PdfOutline outline) throws IOException {
- outline.setIndirectReference(writer.getPdfIndirectReference());
- if (outline.parent() != null)
- outline.put(PdfName.PARENT, outline.parent().indirectReference());
- ArrayList kids = outline.getKids();
- int size = kids.size();
- for (int k = 0; k < size; ++k)
- outlineTree((PdfOutline)kids.get(k));
- for (int k = 0; k < size; ++k) {
- if (k > 0)
- ((PdfOutline)kids.get(k)).put(PdfName.PREV, ((PdfOutline)kids.get(k - 1)).indirectReference());
- if (k < size - 1)
- ((PdfOutline)kids.get(k)).put(PdfName.NEXT, ((PdfOutline)kids.get(k + 1)).indirectReference());
- }
- if (size > 0) {
- outline.put(PdfName.FIRST, ((PdfOutline)kids.get(0)).indirectReference());
- outline.put(PdfName.LAST, ((PdfOutline)kids.get(size - 1)).indirectReference());
- }
- for (int k = 0; k < size; ++k) {
- PdfOutline kid = (PdfOutline)kids.get(k);
- writer.addToBody(kid, kid.indirectReference());
- }
- }
-
- void writeOutlines() throws IOException {
- if (rootOutline.getKids().size() == 0)
- return;
- outlineTree(rootOutline);
- writer.addToBody(rootOutline, rootOutline.indirectReference());
- }
-
- void traverseOutlineCount(PdfOutline outline) {
- ArrayList kids = outline.getKids();
- PdfOutline parent = outline.parent();
- if (kids.size() == 0) {
- if (parent != null) {
- parent.setCount(parent.getCount() + 1);
- }
- }
- else {
- for (int k = 0; k < kids.size(); ++k) {
- traverseOutlineCount((PdfOutline)kids.get(k));
- }
- if (parent != null) {
- if (outline.isOpen()) {
- parent.setCount(outline.getCount() + parent.getCount() + 1);
- }
- else {
- parent.setCount(parent.getCount() + 1);
- outline.setCount(-outline.getCount());
- }
- }
- }
- }
-
- void calculateOutlineCount() {
- if (rootOutline.getKids().size() == 0)
- return;
- traverseOutlineCount(rootOutline);
- }
- /**
- * Closes the document.
- * <B>
- * Once all the content has been written in the body, you have to close
- * the body. After that nothing can be written to the body anymore.
- */
-
- public void close() {
- if (close) {
- return;
- }
- try {
- newPage();
- if (imageWait != null) newPage();
- if (annotations.size() > 0)
- throw new RuntimeException(annotations.size() + " annotations had invalid placement pages.");
- PdfPageEvent pageEvent = writer.getPageEvent();
- if (pageEvent != null)
- pageEvent.onCloseDocument(writer, this);
- super.close();
-
- writer.addLocalDestinations(localDestinations);
- calculateOutlineCount();
- writeOutlines();
- }
- catch(Exception e) {
- throw new ExceptionConverter(e);
- }
-
- writer.close();
- }
-
- PageResources getPageResources() {
- return pageResources;
- }
-
- /** Adds a <CODE>PdfPTable</CODE> to the document.
- * @param ptable the <CODE>PdfPTable</CODE> to be added to the document.
- * @throws DocumentException on error
- */
- void addPTable(PdfPTable ptable) throws DocumentException {
- ColumnText ct = new ColumnText(writer.getDirectContent());
- if (currentHeight > 0) {
- Paragraph p = new Paragraph();
- p.setLeading(0);
- ct.addElement(p);
- }
- ct.addElement(ptable);
- boolean he = ptable.isHeadersInEvent();
- ptable.setHeadersInEvent(true);
- int loop = 0;
- while (true) {
- ct.setSimpleColumn(indentLeft(), indentBottom(), indentRight(), indentTop() - currentHeight);
- int status = ct.go();
- if ((status & ColumnText.NO_MORE_TEXT) != 0) {
- text.moveText(0, ct.getYLine() - indentTop() + currentHeight);
- currentHeight = indentTop() - ct.getYLine();
- break;
- }
- if (indentTop() - currentHeight == ct.getYLine())
- ++loop;
- else
- loop = 0;
- if (loop == 3) {
- add(new Paragraph("ERROR: Infinite table loop"));
- break;
- }
- newPage();
- }
- ptable.setHeadersInEvent(he);
- }
-
- /**
- * Gets a PdfTable object
- * (contributed by dperezcar at fcc.es)
- * @param table a high level table object
- * @param supportRowAdditions
- * @return returns a PdfTable object
- * @see PdfWriter#getPdfTable(Table)
- */
-
- PdfTable getPdfTable(Table table, boolean supportRowAdditions) {
- return new PdfTable(table, indentLeft(), indentRight(), indentTop() - currentHeight, supportRowAdditions);
- }
-
- /**
- * @see PdfWriter#breakTableIfDoesntFit(PdfTable)
- * (contributed by dperezcar at fcc.es)
- * @param table Table to add
- * @return true if the table will be broken
- * @throws DocumentException
- */
-
- boolean breakTableIfDoesntFit(PdfTable table) throws DocumentException {
- table.updateRowAdditions();
- // Do we have any full page available?
- if (!table.hasToFitPageTable() && table.bottom() <= indentBottom) {
- // Then output that page
- add(table, true);
- return true;
- }
- return false;
- }
-
- /**
- * Adds a new table to
- * @param table Table to add. Rendered rows will be deleted after processing.
- * @param onlyFirstPage Render only the first full page
- * @throws DocumentException
- */
-
- private void add(PdfTable table, boolean onlyFirstPage) throws DocumentException {
- // before every table, we flush all lines
- flushLines();
-
- // initialisation of parameters
- float pagetop = indentTop();
- float oldHeight = currentHeight;
- float cellDisplacement;
- PdfCell cell;
- PdfContentByte cellGraphics = new PdfContentByte(writer);
-
- boolean tableHasToFit =
- table.hasToFitPageTable() ? table.bottom() < indentBottom() : false;
- if (pageEmpty)
- tableHasToFit = false;
- boolean cellsHaveToFit = table.hasToFitPageCells();
-
- // drawing the table
- ArrayList cells = table.getCells();
- ArrayList headercells = table.getHeaderCells();
- // Check if we have removed header cells in a previous call
- if (headercells.size() > 0 && (cells.size() == 0 || cells.get(0) != headercells.get(0))) {
- ArrayList allCells = new ArrayList(cells.size()+headercells.size());
- allCells.addAll(headercells);
- allCells.addAll(cells);
- cells = allCells;
- }
- while (!cells.isEmpty()) {
- // initialisation of some extra parameters;
- float lostTableBottom = 0;
-
- // loop over the cells
- boolean cellsShown = false;
- int currentGroupNumber = 0;
- boolean headerChecked = false;
- for (ListIterator iterator = cells.listIterator(); iterator.hasNext() && !tableHasToFit;) {
- cell = (PdfCell) iterator.next();
- if( cellsHaveToFit ) {
- if( !cell.isHeader() ) {
- if (cell.getGroupNumber() != currentGroupNumber) {
- boolean cellsFit = true;
- currentGroupNumber = cell.getGroupNumber();
- int cellCount = 0;
- while (cell.getGroupNumber() == currentGroupNumber && cellsFit && iterator.hasNext()) {
- if (cell.bottom() < indentBottom()) {
- cellsFit = false;
- }
- cell = (PdfCell) iterator.next();
- cellCount++;
- }
- if (!cellsFit) {
- break;
- }
- for (int i = cellCount; i >= 0; i--) {
- cell = (PdfCell) iterator.previous();
- }
- }
- }
- else {
- if( !headerChecked ) {
- headerChecked = true;
- boolean cellsFit = true;
- int cellCount = 0;
- float firstTop = cell.top();
- while (cell.isHeader() && cellsFit && iterator.hasNext()) {
- if (firstTop - cell.bottom(0) > indentTop() - currentHeight - indentBottom()) {
- cellsFit = false;
- }
- cell = (PdfCell) iterator.next();
- cellCount++;
- }
- currentGroupNumber = cell.getGroupNumber();
- while (cell.getGroupNumber() == currentGroupNumber && cellsFit && iterator.hasNext()) {
- if (firstTop - cell.bottom(0) > indentTop() - currentHeight - indentBottom() - 10.0) {
- cellsFit = false;
- }
- cell = (PdfCell) iterator.next();
- cellCount++;
- }
- for (int i = cellCount; i >= 0; i--) {
- cell = (PdfCell) iterator.previous();
- }
- if (!cellsFit) {
- while( cell.isHeader() ) {
- iterator.remove();
- cell = (PdfCell) iterator.next();
- }
- break;
- }
- }
- }
- }
- lines = cell.getLines(pagetop, indentBottom());
- // if there are lines to add, add them
- if (lines != null && lines.size() > 0) {
- // we paint the borders of the cells
- cellsShown = true;
- cellGraphics.rectangle(cell.rectangle(pagetop, indentBottom()));
- lostTableBottom = Math.max(cell.bottom(), indentBottom());
-
- // we write the text
- float cellTop = cell.top(pagetop - oldHeight);
- text.moveText(0, cellTop);
- cellDisplacement = flushLines() - cellTop;
- text.moveText(0, cellDisplacement);
- if (oldHeight + cellDisplacement > currentHeight) {
- currentHeight = oldHeight + cellDisplacement;
- }
- }
- ArrayList images = cell.getImages(pagetop, indentBottom());
- for (Iterator i = images.iterator(); i.hasNext();) {
- cellsShown = true;
- Image image = (Image) i.next();
- addImage(graphics, image, 0, 0, 0, 0, 0, 0);
- }
- // if a cell is allready added completely, remove it
- if (cell.mayBeRemoved()) {
- iterator.remove();
- }
- }
- tableHasToFit = false;
- // we paint the graphics of the table after looping through all the cells
- if (cellsShown) {
- Rectangle tablerec = new Rectangle(table);
- tablerec.setBorder(table.border());
- tablerec.setBorderWidth(table.borderWidth());
- tablerec.setBorderColor(table.borderColor());
- tablerec.setBackgroundColor(table.backgroundColor());
- tablerec.setGrayFill(table.grayFill());
- PdfContentByte under = writer.getDirectContentUnder();
- under.rectangle(tablerec.rectangle(top(), indentBottom()));
- under.add(cellGraphics);
- // bugfix by Gerald Fehringer: now again add the border for the table
- // since it might have been covered by cell backgrounds
- tablerec.setGrayFill(0);
- tablerec.setBackgroundColor(null);
- under.rectangle(tablerec.rectangle(top(), indentBottom()));
- // end bugfix
- }
- cellGraphics = new PdfContentByte(null);
- // if the table continues on the next page
- if (!cells.isEmpty()) {
- graphics.setLineWidth(table.borderWidth());
- if (cellsShown && (table.border() & Rectangle.BOTTOM) == Rectangle.BOTTOM) {
- // Draw the bottom line
-
- // the color is set to the color of the element
- Color tColor = table.borderColor();
- if (tColor != null) {
- graphics.setColorStroke(tColor);
- }
- graphics.moveTo(table.left(), Math.max(table.bottom(), indentBottom()));
- graphics.lineTo(table.right(), Math.max(table.bottom(), indentBottom()));
- graphics.stroke();
- if (tColor != null) {
- graphics.resetRGBColorStroke();
- }
- }
-
- // old page
- pageEmpty = false;
- float difference = lostTableBottom;
-
- // new page
- newPage();
- // G.F.: if something added in page event i.e. currentHeight > 0
- float heightCorrection = 0;
- boolean somethingAdded = false;
- if (currentHeight > 0) {
- heightCorrection = 6;
- currentHeight += heightCorrection;
- somethingAdded = true;
- newLine();
- flushLines();
- indentTop = currentHeight - leading;
- currentHeight = 0;
- }
- else {
- flushLines();
- }
-
- // this part repeats the table headers (if any)
- int size = headercells.size();
- if (size > 0) {
- // this is the top of the headersection
- cell = (PdfCell) headercells.get(0);
- float oldTop = cell.top(0);
- // loop over all the cells of the table header
- for (int i = 0; i < size; i++) {
- cell = (PdfCell) headercells.get(i);
- // calculation of the new cellpositions
- cell.setTop(indentTop() - oldTop + cell.top(0));
- cell.setBottom(indentTop() - oldTop + cell.bottom(0));
- pagetop = cell.bottom();
- // we paint the borders of the cell
- cellGraphics.rectangle(cell.rectangle(indentTop(), indentBottom()));
- // we write the text of the cell
- ArrayList images = cell.getImages(indentTop(), indentBottom());
- for (Iterator im = images.iterator(); im.hasNext();) {
- cellsShown = true;
- Image image = (Image) im.next();
- addImage(graphics, image, 0, 0, 0, 0, 0, 0);
- }
- lines = cell.getLines(indentTop(), indentBottom());
- float cellTop = cell.top(indentTop());
- text.moveText(0, cellTop-heightCorrection);
- cellDisplacement = flushLines() - cellTop+heightCorrection;
- text.moveText(0, cellDisplacement);
- }
- currentHeight = indentTop() - pagetop + table.cellspacing();
- text.moveText(0, pagetop - indentTop() - currentHeight);
- }
- else {
- if (somethingAdded) {
- pagetop = indentTop();
- text.moveText(0, -table.cellspacing());
- }
- }
- oldHeight = currentHeight - heightCorrection;
-
- // calculating the new positions of the table and the cells
- size = Math.min(cells.size(), table.columns());
- int i = 0;
- while (i < size) {
- cell = (PdfCell) cells.get(i);
- if (cell.top(-table.cellspacing()) > lostTableBottom) {
- float newBottom = pagetop - difference + cell.bottom();
- float neededHeight = cell.remainingHeight();
- if (newBottom > pagetop - neededHeight) {
- difference += newBottom - (pagetop - neededHeight);
- }
- }
- i++;
- }
- size = cells.size();
- table.setTop(indentTop());
- table.setBottom(pagetop - difference + table.bottom(table.cellspacing()));
- for (i = 0; i < size; i++) {
- cell = (PdfCell) cells.get(i);
- float newBottom = pagetop - difference + cell.bottom();
- float newTop = pagetop - difference + cell.top(-table.cellspacing());
- if (newTop > indentTop() - currentHeight) {
- newTop = indentTop() - currentHeight;
- }
- //float newBottom = newTop - cell.height();
- cell.setTop(newTop );
- cell.setBottom(newBottom );
- }
- if (onlyFirstPage) {
- break;
- }
- }
- }
-
- float tableHeight = table.top() - table.bottom();
- currentHeight = oldHeight + tableHeight;
- text.moveText(0, -tableHeight );
- pageEmpty = false;
- }
-
- /**
- * Signals that an <CODE>Element</CODE> was added to the <CODE>Document</CODE>.
- *
- * @param element the element to add
- * @return <CODE>true</CODE> if the element was added, <CODE>false</CODE> if not.
- * @throws DocumentException when a document isn't open yet, or has been closed
- */
-
- public boolean add(Element element) throws DocumentException {
- if (writer != null && writer.isPaused()) {
- return false;
- }
- try {
-
- switch(element.type()) {
-
- // Information (headers)
- case Element.HEADER:
- info.addkey(((Meta)element).name(), ((Meta)element).content());
- break;
- case Element.TITLE:
- info.addTitle(((Meta)element).content());
- break;
- case Element.SUBJECT:
- info.addSubject(((Meta)element).content());
- break;
- case Element.KEYWORDS:
- info.addKeywords(((Meta)element).content());
- break;
- case Element.AUTHOR:
- info.addAuthor(((Meta)element).content());
- break;
- case Element.CREATOR:
- info.addCreator(((Meta)element).content());
- break;
- case Element.PRODUCER:
- // you can not change the name of the producer
- info.addProducer();
- break;
- case Element.CREATIONDATE:
- // you can not set the creation date, only reset it
- info.addCreationDate();
- break;
-
- // content (text)
- case Element.CHUNK: {
- // if there isn't a current line available, we make one
- if (line == null) {
- carriageReturn();
- }
-
- // we cast the element to a chunk
- PdfChunk chunk = new PdfChunk((Chunk) element, currentAction);
- // we try to add the chunk to the line, until we succeed
- {
- PdfChunk overflow;
- while ((overflow = line.add(chunk)) != null) {
- carriageReturn();
- chunk = overflow;
- }
- }
- pageEmpty = false;
- if (chunk.isAttribute(Chunk.NEWPAGE)) {
- newPage();
- }
- break;
- }
- case Element.ANCHOR: {
- Anchor anchor = (Anchor) element;
- String url = anchor.reference();
- leading = anchor.leading();
- if (url != null) {
- currentAction = new PdfAction(url);
- }
-
- // we process the element
- element.process(this);
- currentAction = null;
- break;
- }
- case Element.ANNOTATION: {
- if (line == null) {
- carriageReturn();
- }
- Annotation annot = (Annotation) element;
- switch(annot.annotationType()) {
- case Annotation.URL_NET:
- annotations.add(new PdfAnnotation(writer, annot.llx(), annot.lly(), annot.urx(), annot.ury(), new PdfAction((URL) annot.attributes().get(Annotation.URL))));
- break;
- case Annotation.URL_AS_STRING:
- annotations.add(new PdfAnnotation(writer, annot.llx(), annot.lly(), annot.urx(), annot.ury(), new PdfAction((String) annot.attributes().get(Annotation.FILE))));
- break;
- case Annotation.FILE_DEST:
- annotations.add(new PdfAnnotation(writer, annot.llx(), annot.lly(), annot.urx(), annot.ury(), new PdfAction((String) annot.attributes().get(Annotation.FILE), (String) annot.attributes().get(Annotation.DESTINATION))));
- break;
- case Annotation.SCREEN:
- boolean sparams[] = (boolean[])annot.attributes().get(Annotation.PARAMETERS);
- String fname = (String) annot.attributes().get(Annotation.FILE);
- String mimetype = (String) annot.attributes().get(Annotation.MIMETYPE);
- PdfFileSpecification fs;
- if (sparams[0])
- fs = PdfFileSpecification.fileEmbedded(writer, fname, fname, null);
- else
- fs = PdfFileSpecification.fileExtern(writer, fname);
- PdfAnnotation ann = PdfAnnotation.createScreen(writer, new Rectangle(annot.llx(), annot.lly(), annot.urx(), annot.ury()),
- fname, fs, mimetype, sparams[1]);
- annotations.add(ann);
- break;
- case Annotation.FILE_PAGE:
- annotations.add(new PdfAnnotation(writer, annot.llx(), annot.lly(), annot.urx(), annot.ury(), new PdfAction((String) annot.attributes().get(Annotation.FILE), ((Integer) annot.attributes().get(Annotation.PAGE)).intValue())));
- break;
- case Annotation.NAMED_DEST:
- annotations.add(new PdfAnnotation(writer, annot.llx(), annot.lly(), annot.urx(), annot.ury(), new PdfAction(((Integer) annot.attributes().get(Annotation.NAMED)).intValue())));
- break;
- case Annotation.LAUNCH:
- annotations.add(new PdfAnnotation(writer, annot.llx(), annot.lly(), annot.urx(), annot.ury(), new PdfAction((String) annot.attributes().get(Annotation.APPLICATION),(String) annot.attributes().get(Annotation.PARAMETERS),(String) annot.attributes().get(Annotation.OPERATION),(String) annot.attributes().get(Annotation.DEFAULTDIR))));
- break;
- default:
- PdfAnnotation an = new PdfAnnotation(writer, annot.llx(indentRight() - line.widthLeft()), annot.lly(indentTop() - currentHeight), annot.urx(indentRight() - line.widthLeft() + 20), annot.ury(indentTop() - currentHeight - 20), new PdfString(annot.title()), new PdfString(annot.content()));
- //PdfAnnotation pop = PdfAnnotation.createPopup(writer, new Rectangle(annot.llx(indentRight() - line.widthLeft()), annot.lly(indentTop() - currentHeight), annot.urx(indentRight() - line.widthLeft() + 20), annot.ury(indentTop() - currentHeight - 20)), null, true);
- //an.setPopup(pop);
- annotations.add(an);
- //annotations.add(pop);
- }
- pageEmpty = false;
- break;
- }
- case Element.PHRASE: {
- // we cast the element to a phrase and set the leading of the document
- leading = ((Phrase) element).leading();
- // we process the element
- element.process(this);
- break;
- }
- case Element.PARAGRAPH: {
- // we cast the element to a paragraph
- Paragraph paragraph = (Paragraph) element;
-
- float spacingBefore = paragraph.spacingBefore();
- if (spacingBefore != 0) {
- leading = spacingBefore;
- carriageReturn();
- if (!pageEmpty) {
- /*
- * Don't add spacing before a paragraph if it's the first
- * on the page
- */
- Chunk space = new Chunk(" ");
- space.process(this);
- carriageReturn();
- }
- }
-
- // we adjust the parameters of the document
- alignment = paragraph.alignment();
- leading = paragraph.leading();
-
- carriageReturn();
- // we don't want to make orphans/widows
- if (currentHeight + line.height() + leading > indentTop() - indentBottom()) {
- newPage();
- }
-
- // Begin added: Bonf (Marc Schneider) 2003-07-29
- //carriageReturn();
- // End added: Bonf (Marc Schneider) 2003-07-29
-
- indentLeft += paragraph.indentationLeft();
- indentRight += paragraph.indentationRight();
-
- // Begin removed: Bonf (Marc Schneider) 2003-07-29
- carriageReturn();
- // End removed: Bonf (Marc Schneider) 2003-07-29
-
-
- //add by Jin-Hsia Yang
-
- paraIndent += paragraph.indentationLeft();
- //end add by Jin-Hsia Yang
-
- PdfPageEvent pageEvent = writer.getPageEvent();
- if (pageEvent != null && isParagraph)
- pageEvent.onParagraph(writer, this, indentTop() - currentHeight);
-
- // if a paragraph has to be kept together, we wrap it in a table object
- if (paragraph.getKeepTogether()) {
- Table table = new Table(1, 1);
- table.setOffset(0f);
- table.setBorder(Table.NO_BORDER);
- table.setWidth(100f);
- table.setTableFitsPage(true);
- Cell cell = new Cell(paragraph);
- cell.setBorder(Table.NO_BORDER);
- //patch by Matt Benson 11/01/2002 - 14:32:00
- cell.setHorizontalAlignment(paragraph.alignment());
- //end patch by Matt Benson
- table.addCell(cell);
- this.add(table);
- break;
- }
- else
- // we process the paragraph
- element.process(this);
-
- //add by Jin-Hsia Yang and blowagie
- paraIndent -= paragraph.indentationLeft();
- //end add by Jin-Hsia Yang and blowagie
-
- // Begin removed: Bonf (Marc Schneider) 2003-07-29
- // carriageReturn();
- // End removed: Bonf (Marc Schneider) 2003-07-29
-
- float spacingAfter = paragraph.spacingAfter();
- if (spacingAfter != 0) {
- leading = spacingAfter;
- carriageReturn();
- if (currentHeight + line.height() + leading < indentTop() - indentBottom()) {
- /*
- * Only add spacing after a paragraph if the extra
- * spacing fits on the page.
- */
- Chunk space = new Chunk(" ");
- space.process(this);
- carriageReturn();
- }
- leading = paragraph.leading(); // restore original leading
- }
-
- if (pageEvent != null && isParagraph)
- pageEvent.onParagraphEnd(writer, this, indentTop() - currentHeight);
-
- alignment = Element.ALIGN_LEFT;
- indentLeft -= paragraph.indentationLeft();
- indentRight -= paragraph.indentationRight();
-
- // Begin added: Bonf (Marc Schneider) 2003-07-29
- carriageReturn();
- // End added: Bonf (Marc Schneider) 2003-07-29
-
- //add by Jin-Hsia Yang
-
- //end add by Jin-Hsia Yang
-
- break;
- }
- case Element.SECTION:
- case Element.CHAPTER: {
- // Chapters and Sections only differ in their constructor
- // so we cast both to a Section
- Section section = (Section) element;
-
- boolean hasTitle = section.title() != null;
-
- // if the section is a chapter, we begin a new page
- if (section.isChapter()) {
- newPage();
- }
- // otherwise, we begin a new line
- else {
- newLine();
- }
-
- if (hasTitle) {
- float fith = indentTop() - currentHeight;
- int rotation = pageSize.getRotation();
- if (rotation == 90 || rotation == 180)
- fith = pageSize.height() - fith;
- PdfDestination destination = new PdfDestination(PdfDestination.FITH, fith);
- while (currentOutline.level() >= section.depth()) {
- currentOutline = currentOutline.parent();
- }
- PdfOutline outline = new PdfOutline(currentOutline, destination, section.getBookmarkTitle(), section.isBookmarkOpen());
- currentOutline = outline;
- }
-
- // some values are set
- carriageReturn();
- indentLeft += section.indentationLeft();
- indentRight += section.indentationRight();
-
- PdfPageEvent pageEvent = writer.getPageEvent();
- if (pageEvent != null)
- if (element.type() == Element.CHAPTER)
- pageEvent.onChapter(writer, this, indentTop() - currentHeight, section.title());
- else
- pageEvent.onSection(writer, this, indentTop() - currentHeight, section.depth(), section.title());
-
- // the title of the section (if any has to be printed)
- if (hasTitle) {
- isParagraph = false;
- add(section.title());
- isParagraph = true;
- }
- indentLeft += section.indentation();
- // we process the section
- element.process(this);
- // some parameters are set back to normal again
- indentLeft -= section.indentationLeft() + section.indentation();
- indentRight -= section.indentationRight();
-
- if (pageEvent != null)
- if (element.type() == Element.CHAPTER)
- pageEvent.onChapterEnd(writer, this, indentTop() - currentHeight);
- else
- pageEvent.onSectionEnd(writer, this, indentTop() - currentHeight);
-
- break;
- }
- case Element.LIST: {
- // we cast the element to a List
- List list = (List) element;
- // we adjust the document
- listIndentLeft += list.indentationLeft();
- indentRight += list.indentationRight();
- // we process the items in the list
- element.process(this);
- // some parameters are set back to normal again
- listIndentLeft -= list.indentationLeft();
- indentRight -= list.indentationRight();
- break;
- }
- case Element.LISTITEM: {
- // we cast the element to a ListItem
- ListItem listItem = (ListItem) element;
-
- float spacingBefore = listItem.spacingBefore();
- if (spacingBefore != 0) {
- leading = spacingBefore;
- carriageReturn();
- if (!pageEmpty) {
- /*
- * Don't add spacing before a paragraph if it's the first
- * on the page
- */
- Chunk space = new Chunk(" ");
- space.process(this);
- carriageReturn();
- }
- }
-
- // we adjust the document
- alignment = listItem.alignment();
- listIndentLeft += listItem.indentationLeft();
- indentRight += listItem.indentationRight();
- leading = listItem.leading();
- carriageReturn();
- // we prepare the current line to be able to show us the listsymbol
- line.setListItem(listItem);
- // we process the item
- element.process(this);
-
- float spacingAfter = listItem.spacingAfter();
- if (spacingAfter != 0) {
- leading = spacingAfter;
- carriageReturn();
- if (currentHeight + line.height() + leading < indentTop() - indentBottom()) {
- /*
- * Only add spacing after a paragraph if the extra
- * spacing fits on the page.
- */
- Chunk space = new Chunk(" ");
- space.process(this);
- carriageReturn();
- }
- leading = listItem.leading(); // restore original leading
- }
-
- // if the last line is justified, it should be aligned to the left
- // if (line.hasToBeJustified()) {
- // line.resetAlignment();
- // }
- // some parameters are set back to normal again
- carriageReturn();
- listIndentLeft -= listItem.indentationLeft();
- indentRight -= listItem.indentationRight();
- break;
- }
- case Element.RECTANGLE: {
- Rectangle rectangle = (Rectangle) element;
- graphics.rectangle(rectangle);
- pageEmpty = false;
- break;
- }
- case Element.PTABLE: {
- PdfPTable ptable = (PdfPTable)element;
- if (ptable.size() <= ptable.getHeaderRows())
- break; //nothing to do
-
- // before every table, we add a new line and flush all lines
- ensureNewLine();
- flushLines();
- addPTable(ptable);
- pageEmpty = false;
- break;
- }
- case Element.MULTI_COLUMN_TEXT: {
- ensureNewLine();
- flushLines();
- MultiColumnText multiText = (MultiColumnText) element;
- float height = multiText.write(writer.getDirectContent(), this, indentTop() - currentHeight);
- currentHeight += height;
- text.moveText(0, -1f* height);
- pageEmpty = false;
- break;
- }
- case Element.TABLE : {
-
- /**
- * This is a list of people who worked on the Table functionality.
- * To see who did what, please check the CVS repository:
- *
- * Leslie Baski
- * Matt Benson
- * Francesco De Milato
- * David Freels
- * Bruno Lowagie
- * Veerendra Namineni
- * Geert Poels
- * Tom Ring
- * Paulo Soares
- * Gerald Fehringer
- * Steve Appling
- */
-
- PdfTable table;
- if (element instanceof PdfTable) {
- // Already pre-rendered
- table = (PdfTable)element;
- table.updateRowAdditions();
- } else if (element instanceof Table) {
-
- try {
- PdfPTable ptable = ((Table)element).createPdfPTable();
- if (ptable.size() <= ptable.getHeaderRows())
- break; //nothing to do
-
- // before every table, we add a new line and flush all lines
- ensureNewLine();
- flushLines();
- addPTable(ptable);
- pageEmpty = false;
- break;
- }
- catch(BadElementException bee) {
- // constructing the PdfTable
- // Before the table, add a blank line using offset or default leading
- float offset = ((Table)element).getOffset();
- if (Float.isNaN(offset))
- offset = leading;
- carriageReturn();
- lines.add(new PdfLine(indentLeft(), indentRight(), alignment, offset));
- currentHeight += offset;
- table = getPdfTable((Table)element, false);
- }
- } else {
- return false;
- }
- add(table, false);
- break;
- }
- case Element.JPEG:
- case Element.IMGRAW:
- case Element.IMGTEMPLATE: {
- //carriageReturn(); suggestion by Marc Campforts
- add((Image) element);
- break;
- }
- case Element.GRAPHIC: {
- Graphic graphic = (Graphic) element;
- graphic.processAttributes(indentLeft(), indentBottom(), indentRight(), indentTop(), indentTop() - currentHeight);
- graphics.add(graphic);
- pageEmpty = false;
- break;
- }
- default:
- return false;
- }
- lastElementType = element.type();
- return true;
- }
- catch(Exception e) {
- throw new DocumentException(e);
- }
- }
-
- // methods to add Content
-
- /**
- * Adds an image to the Graphics object.
- *
- * @param graphics the PdfContentByte holding the graphics layer of this PdfDocument
- * @param image the image
- * @param a an element of the transformation matrix
- * @param b an element of the transformation matrix
- * @param c an element of the transformation matrix
- * @param d an element of the transformation matrix
- * @param e an element of the transformation matrix
- * @param f an element of the transformation matrix
- * @throws DocumentException
- */
-
- private void addImage(PdfContentByte graphics, Image image, float a, float b, float c, float d, float e, float f) throws DocumentException {
- Annotation annotation = image.annotation();
- if (image.hasAbsolutePosition()) {
- graphics.addImage(image);
- if (annotation != null) {
- annotation.setDimensions(image.absoluteX(), image.absoluteY(), image.absoluteX() + image.scaledWidth(), image.absoluteY() + image.scaledHeight());
- add(annotation);
- }
- }
- else {
- graphics.addImage(image, a, b, c, d, e, f);
- if (annotation != null) {
- annotation.setDimensions(e, f, e + image.scaledWidth(), f + image.scaledHeight());
- add(annotation);
- }
- }
- }
-
- /**
- * Adds an image to the document.
- * @param image the <CODE>Image</CODE> to add
- * @throws PdfException on error
- * @throws DocumentException on error
- */
-
- private void add(Image image) throws PdfException, DocumentException {
-
- if (image.hasAbsolutePosition()) {
- addImage(graphics, image, 0, 0, 0, 0, 0, 0);
- pageEmpty = false;
- return;
- }
-
- // if there isn't enough room for the image on this page, save it for the next page
- if (currentHeight != 0 && indentTop() - currentHeight - image.scaledHeight() < indentBottom()) {
- if (!strictImageSequence && imageWait == null) {
- imageWait = image;
- return;
- }
- newPage();
- if (currentHeight != 0 && indentTop() - currentHeight - image.scaledHeight() < indentBottom()) {
- imageWait = image;
- return;
- }
- }
- pageEmpty = false;
- // avoid endless loops
- if (image == imageWait)
- imageWait = null;
- boolean textwrap = (image.alignment() & Image.TEXTWRAP) == Image.TEXTWRAP
- && !((image.alignment() & Image.MIDDLE) == Image.MIDDLE);
- boolean underlying = (image.alignment() & Image.UNDERLYING) == Image.UNDERLYING;
- float diff = leading / 2;
- if (textwrap) {
- diff += leading;
- }
- float lowerleft = indentTop() - currentHeight - image.scaledHeight() -diff;
- float mt[] = image.matrix();
- float startPosition = indentLeft() - mt[4];
- if ((image.alignment() & Image.RIGHT) == Image.RIGHT) startPosition = indentRight() - image.scaledWidth() - mt[4];
- if ((image.alignment() & Image.MIDDLE) == Image.MIDDLE) startPosition = indentLeft() + ((indentRight() - indentLeft() - image.scaledWidth()) / 2) - mt[4];
- if (image.hasAbsoluteX()) startPosition = image.absoluteX();
- addImage(graphics, image, mt[0], mt[1], mt[2], mt[3], startPosition, lowerleft - mt[5]);
- if (textwrap) {
- if (imageEnd < 0 || imageEnd < currentHeight + image.scaledHeight() + diff) {
- imageEnd = currentHeight + image.scaledHeight() + diff;
- }
- if ((image.alignment() & Image.RIGHT) == Image.RIGHT) {
- // indentation suggested by Pelikan Stephan
- imageIndentRight += image.scaledWidth() + image.indentationLeft();
- }
- else {
- // indentation suggested by Pelikan Stephan
- imageIndentLeft += image.scaledWidth() + image.indentationRight();
- }
- }
- if (!(textwrap || underlying)) {
- currentHeight += image.scaledHeight() + diff;
- flushLines();
- text.moveText(0, - (image.scaledHeight() + diff));
- newLine();
- }
- }
-
- /**
- * Initializes a page.
- * <P>
- * If the footer/header is set, it is printed.
- * @throws DocumentException on error
- */
-
- private void initPage() throws DocumentException {
-
- // initialisation of some page objects
- annotations = delayedAnnotations;
- delayedAnnotations = new ArrayList();
- pageResources = new PageResources();
- writer.resetContent();
-
- // the pagenumber is incremented
- pageN++;
-
- // graphics and text are initialized
- float oldleading = leading;
- int oldAlignment = alignment;
-
- if (marginMirroring && (getPageNumber() & 1) == 0) {
- marginRight = nextMarginLeft;
- marginLeft = nextMarginRight;
- }
- else {
- marginLeft = nextMarginLeft;
- marginRight = nextMarginRight;
- }
- marginTop = nextMarginTop;
- marginBottom = nextMarginBottom;
- imageEnd = -1;
- imageIndentRight = 0;
- imageIndentLeft = 0;
- graphics = new PdfContentByte(writer);
- text = new PdfContentByte(writer);
- text.beginText();
- text.moveText(left(), top());
- textEmptySize = text.size();
- text.reset();
- text.beginText();
- leading = 16;
- indentBottom = 0;
- indentTop = 0;
- currentHeight = 0;
-
- // backgroundcolors, etc...
- pageSize = nextPageSize;
- thisBoxSize = new HashMap(boxSize);
- if (pageSize.backgroundColor() != null
- || pageSize.hasBorders()
- || pageSize.borderColor() != null
- || pageSize.grayFill() > 0) {
- add(pageSize);
- }
-
- // if there is a watermark, the watermark is added
- if (watermark != null) {
- float mt[] = watermark.matrix();
- addImage(graphics, watermark, mt[0], mt[1], mt[2], mt[3], watermark.offsetX() - mt[4], watermark.offsetY() - mt[5]);
- }
-
- // if there is a footer, the footer is added
- if (footer != null) {
- /*
- Added by Edgar Leonardo Prieto Perilla
- */
- // Avoid footer identation
- float tmpIndentLeft = indentLeft;
- float tmpIndentRight = indentRight;
- // Begin added: Bonf (Marc Schneider) 2003-07-29
- float tmpListIndentLeft = listIndentLeft;
- float tmpImageIndentLeft = imageIndentLeft;
- float tmpImageIndentRight = imageIndentRight;
- // End added: Bonf (Marc Schneider) 2003-07-29
-
- indentLeft = indentRight = 0;
- // Begin added: Bonf (Marc Schneider) 2003-07-29
- listIndentLeft = 0;
- imageIndentLeft = 0;
- imageIndentRight = 0;
- // End added: Bonf (Marc Schneider) 2003-07-29
- /*
- End Added by Edgar Leonardo Prieto Perilla
- */
-
- footer.setPageNumber(pageN);
- leading = footer.paragraph().leading();
- add(footer.paragraph());
- // adding the footer limits the height
- indentBottom = currentHeight;
- text.moveText(left(), indentBottom());
- flushLines();
- text.moveText(-left(), -bottom());
- footer.setTop(bottom(currentHeight));
- footer.setBottom(bottom() - (0.75f * leading));
- footer.setLeft(left());
- footer.setRight(right());
- graphics.rectangle(footer);
- indentBottom = currentHeight + leading * 2;
- currentHeight = 0;
-
- /*
- Added by Edgar Leonardo Prieto Perilla
- */
- indentLeft = tmpIndentLeft;
- indentRight = tmpIndentRight;
- // Begin added: Bonf (Marc Schneider) 2003-07-29
- listIndentLeft = tmpListIndentLeft;
- imageIndentLeft = tmpImageIndentLeft;
- imageIndentRight = tmpImageIndentRight;
- // End added: Bonf (Marc Schneider) 2003-07-29
- /*
- End Added by Edgar Leonardo Prieto Perilla
- */
- }
-
- // we move to the left/top position of the page
- text.moveText(left(), top());
-
- // if there is a header, the header = added
- if (header != null) {
- /*
- Added by Edgar Leonardo Prieto Perilla
- */
- // Avoid header identation
- float tmpIndentLeft = indentLeft;
- float tmpIndentRight = indentRight;
- // Begin added: Bonf (Marc Schneider) 2003-07-29
- float tmpListIndentLeft = listIndentLeft;
- float tmpImageIndentLeft = imageIndentLeft;
- float tmpImageIndentRight = imageIndentRight;
- // End added: Bonf (Marc Schneider) 2003-07-29
-
- indentLeft = indentRight = 0;
- // Added: Bonf
- listIndentLeft = 0;
- imageIndentLeft = 0;
- imageIndentRight = 0;
- // End added: Bonf
- /*
- End Added by Edgar Leonardo Prieto Perilla
- */
-
- header.setPageNumber(pageN);
- leading = header.paragraph().leading();
- text.moveText(0, leading);
- add(header.paragraph());
- newLine();
- indentTop = currentHeight - leading;
- header.setTop(top() + leading);
- header.setBottom(indentTop() + leading * 2 / 3);
- header.setLeft(left());
- header.setRight(right());
- graphics.rectangle(header);
- flushLines();
- currentHeight = 0;
-
- /*
- Added by Edgar Leonardo Prieto Perilla
- */
- // Restore identation
- indentLeft = tmpIndentLeft;
- indentRight = tmpIndentRight;
- // Begin added: Bonf (Marc Schneider) 2003-07-29
- listIndentLeft = tmpListIndentLeft;
- imageIndentLeft = tmpImageIndentLeft;
- imageIndentRight = tmpImageIndentRight;
- // End added: Bonf (Marc Schneider) 2003-07-29
- /*
- End Added by Edgar Leonardo Prieto Perilla
- */
- }
-
- pageEmpty = true;
-
- // if there is an image waiting to be drawn, draw it
- try {
- if (imageWait != null) {
- add(imageWait);
- imageWait = null;
- }
- }
- catch(Exception e) {
- throw new ExceptionConverter(e);
- }
-
- leading = oldleading;
- alignment = oldAlignment;
- carriageReturn();
- PdfPageEvent pageEvent = writer.getPageEvent();
- if (pageEvent != null) {
- if (firstPageEvent) {
- pageEvent.onOpenDocument(writer, this);
- }
- pageEvent.onStartPage(writer, this);
- }
- firstPageEvent = false;
- }
-
- /**
- * If the current line is not empty or null, it is added to the arraylist
- * of lines and a new empty line is added.
- * @throws DocumentException on error
- */
-
- private void carriageReturn() throws DocumentException {
- // the arraylist with lines may not be null
- if (lines == null) {
- lines = new ArrayList();
- }
- // If the current line is not null
- if (line != null) {
- // we check if the end of the page is reached (bugfix by Francois Gravel)
- if (currentHeight + line.height() + leading < indentTop() - indentBottom()) {
- // if so nonempty lines are added and the heigt is augmented
- if (line.size() > 0) {
- currentHeight += line.height();
- lines.add(line);
- pageEmpty = false;
- }
- }
- // if the end of the line is reached, we start a new page
- else {
- newPage();
- }
- }
- if (imageEnd > -1 && currentHeight > imageEnd) {
- imageEnd = -1;
- imageIndentRight = 0;
- imageIndentLeft = 0;
- }
- // a new current line is constructed
- line = new PdfLine(indentLeft(), indentRight(), alignment, leading);
- }
-
- /**
- * Adds the current line to the list of lines and also adds an empty line.
- * @throws DocumentException on error
- */
-
- private void newLine() throws DocumentException {
- lastElementType = -1;
- carriageReturn();
- if (lines != null && lines.size() > 0) {
- lines.add(line);
- currentHeight += line.height();
- }
- line = new PdfLine(indentLeft(), indentRight(), alignment, leading);
- }
-
- /**
- * Writes all the lines to the text-object.
- *
- * @return the displacement that was caused
- * @throws DocumentException on error
- */
-
- private float flushLines() throws DocumentException {
-
- // checks if the ArrayList with the lines is not null
- if (lines == null) {
- return 0;
- }
-
- //add by Jin-Hsia Yang
- boolean newline=false;
- //end add by Jin-Hsia Yang
-
- // checks if a new Line has to be made.
- if (line != null && line.size() > 0) {
- lines.add(line);
- line = new PdfLine(indentLeft(), indentRight(), alignment, leading);
-
- //add by Jin-Hsia Yang
- newline=true;
- //end add by Jin-Hsia Yang
-
- }
-
- // checks if the ArrayList with the lines is empty
- if (lines.size() == 0) {
- return 0;
- }
-
- // initialisation of some parameters
- Object currentValues[] = new Object[2];
- PdfFont currentFont = null;
- float displacement = 0;
- PdfLine l;
- PdfChunk chunk;
- Float lastBaseFactor = new Float(0);
- currentValues[1] = lastBaseFactor;
- // looping over all the lines
- for (Iterator i = lines.iterator(); i.hasNext(); ) {
-
- // this is a line in the loop
- l = (PdfLine) i.next();
-
- if(isNewpage && newline) { // fix Ken at PDI
- newline=false;
- text.moveText(l.indentLeft() - indentLeft() + listIndentLeft + paraIndent,-l.height());
- }
- else {
- text.moveText(l.indentLeft() - indentLeft() + listIndentLeft, -l.height());
- }
-
- // is the line preceeded by a symbol?
- if (l.listSymbol() != null) {
- chunk = l.listSymbol();
- text.moveText(- l.listIndent(), 0);
- if (chunk.font().compareTo(currentFont) != 0) {
- currentFont = chunk.font();
- text.setFontAndSize(currentFont.getFont(), currentFont.size());
- }
- if (chunk.color() != null) {
- Color color = chunk.color();
- text.setColorFill(color);
- text.showText(chunk.toString());
- text.resetRGBColorFill();
- }
- else if (chunk.isImage()) {
- Image image = chunk.getImage();
- float matrix[] = image.matrix();
- float xMarker = text.getXTLM();
- float yMarker = text.getYTLM();
- matrix[Image.CX] = xMarker + chunk.getImageOffsetX() - matrix[Image.CX];
- matrix[Image.CY] = yMarker + chunk.getImageOffsetY() - matrix[Image.CY];
- addImage(graphics, image, matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
- }
- else {
- text.showText(chunk.toString());
- }
- text.moveText(l.listIndent(), 0);
- }
-
- currentValues[0] = currentFont;
-
- writeLineToContent(l, text, graphics, currentValues, writer.getSpaceCharRatio());
-
- currentFont = (PdfFont)currentValues[0];
-
- displacement += l.height();
- if (indentLeft() - listIndentLeft != l.indentLeft()) {
- text.moveText(indentLeft() - l.indentLeft() - listIndentLeft, 0);
- }
-
- }
- lines = new ArrayList();
- return displacement;
- }
-
- // methods to retrieve information
-
- /**
- * Gets the <CODE>PdfInfo</CODE>-object.
- *
- * @return <CODE>PdfInfo</COPE>
- */
-
- PdfInfo getInfo() {
- return info;
- }
-
- /**
- * Gets the <CODE>PdfCatalog</CODE>-object.
- *
- * @param pages an indirect reference to this document pages
- * @return <CODE>PdfCatalog</CODE>
- */
-
- PdfCatalog getCatalog(PdfIndirectReference pages) {
- PdfCatalog catalog;
- if (rootOutline.getKids().size() > 0) {
- catalog = new PdfCatalog(pages, rootOutline.indirectReference(), writer);
- }
- else
- catalog = new PdfCatalog(pages, writer);
- if (openActionName != null) {
- PdfAction action = getLocalGotoAction(openActionName);
- catalog.setOpenAction(action);
- }
- else if (openActionAction != null)
- catalog.setOpenAction(openActionAction);
-
- if (additionalActions != null) {
- catalog.setAdditionalActions(additionalActions);
- }
-
- if (pageLabels != null)
- catalog.setPageLabels(pageLabels);
- catalog.addNames(localDestinations, documentJavaScript, writer);
- catalog.setViewerPreferences(viewerPreferences);
- if (acroForm.isValid()) {
- try {
- catalog.setAcroForm(writer.addToBody(acroForm).getIndirectReference());
- }
- catch (IOException e) {
- throw new ExceptionConverter(e);
- }
- }
- return catalog;
- }
-
- // methods concerning the layout
-
- /**
- * Returns the bottomvalue of a <CODE>Table</CODE> if it were added to this document.
- *
- * @param table the table that may or may not be added to this document
- * @return a bottom value
- */
-
- float bottom(Table table) {
- // where will the table begin?
- float h = (currentHeight > 0) ? indentTop() - currentHeight - 2f * leading : indentTop();
- // constructing a PdfTable
- PdfTable tmp = getPdfTable(table, false);
- return tmp.bottom();
- }
-
- /**
- * Checks if a <CODE>PdfPTable</CODE> fits the current page of the <CODE>PdfDocument</CODE>.
- *
- * @param table the table that has to be checked
- * @param margin a certain margin
- * @return <CODE>true</CODE> if the <CODE>PdfPTable</CODE> fits the page, <CODE>false</CODE> otherwise.
- */
-
- boolean fitsPage(PdfPTable table, float margin) {
- if (!table.isLockedWidth()) {
- float totalWidth = (indentRight() - indentLeft()) * table.getWidthPercentage() / 100;
- table.setTotalWidth(totalWidth);
- }
- // ensuring that a new line has been started.
- ensureNewLine();
- return table.getTotalHeight() <= indentTop() - currentHeight - indentBottom() - margin;
- }
-
-
- /**
- * Gets the current vertical page position.
- * @param ensureNewLine Tells whether a new line shall be enforced. This may cause side effects
- * for elements that do not terminate the lines they've started because those lines will get
- * terminated.
- * @return The current vertical page position.
- */
- public float getVerticalPosition(boolean ensureNewLine) {
- // ensuring that a new line has been started.
- if (ensureNewLine) {
- ensureNewLine();
- }
- return top() - currentHeight - indentTop;
- }
-
- /**
- * Ensures that a new line has been started.
- */
- private void ensureNewLine() {
- try {
- if ((lastElementType == Element.PHRASE) ||
- (lastElementType == Element.CHUNK)) {
- newLine();
- flushLines();
- }
- } catch (DocumentException ex) {
- throw new ExceptionConverter(ex);
- }
- }
-
- /**
- * Gets the indentation on the left side.
- *
- * @return a margin
- */
-
- private float indentLeft() {
- return left(indentLeft + listIndentLeft + imageIndentLeft);
- }
-
- /**
- * Gets the indentation on the right side.
- *
- * @return a margin
- */
-
- private float indentRight() {
- return right(indentRight + imageIndentRight);
- }
-
- /**
- * Gets the indentation on the top side.
- *
- * @return a margin
- */
-
- private float indentTop() {
- return top(indentTop);
- }
-
- /**
- * Gets the indentation on the bottom side.
- *
- * @return a margin
- */
-
- float indentBottom() {
- return bottom(indentBottom);
- }
-
- /**
- * Adds a named outline to the document .
- * @param outline the outline to be added
- * @param name the name of this local destination
- */
- void addOutline(PdfOutline outline, String name) {
- localDestination(name, outline.getPdfDestination());
- }
-
- /**
- * Gets the AcroForm object.
- * @return the PdfAcroform object of the PdfDocument
- */
-
- public PdfAcroForm getAcroForm() {
- return acroForm;
- }
-
- /**
- * Gets the root outline. All the outlines must be created with a parent.
- * The first level is created with this outline.
- * @return the root outline
- */
- public PdfOutline getRootOutline() {
- return rootOutline;
- }
-
- /**
- * Writes a text line to the document. It takes care of all the attributes.
- * <P>
- * Before entering the line position must have been established and the
- * <CODE>text</CODE> argument must be in text object scope (<CODE>beginText()</CODE>).
- * @param line the line to be written
- * @param text the <CODE>PdfContentByte</CODE> where the text will be written to
- * @param graphics the <CODE>PdfContentByte</CODE> where the graphics will be written to
- * @param currentValues the current font and extra spacing values
- * @param ratio
- * @throws DocumentException on error
- */
- void writeLineToContent(PdfLine line, PdfContentByte text, PdfContentByte graphics, Object currentValues[], float ratio) throws DocumentException {
- PdfFont currentFont = (PdfFont)(currentValues[0]);
- float lastBaseFactor = ((Float)(currentValues[1])).floatValue();
- PdfChunk chunk;
- int numberOfSpaces;
- int lineLen;
- boolean isJustified;
- float hangingCorrection = 0;
- float hScale = 1;
- float lastHScale = Float.NaN;
- float baseWordSpacing = 0;
- float baseCharacterSpacing = 0;
-
- numberOfSpaces = line.numberOfSpaces();
- lineLen = line.toString().length();
- // does the line need to be justified?
- isJustified = line.hasToBeJustified() && (numberOfSpaces != 0 || lineLen > 1);
- if (isJustified) {
- if (line.isNewlineSplit() && line.widthLeft() >= (lastBaseFactor * (ratio * numberOfSpaces + lineLen - 1))) {
- if (line.isRTL()) {
- text.moveText(line.widthLeft() - lastBaseFactor * (ratio * numberOfSpaces + lineLen - 1), 0);
- }
- baseWordSpacing = ratio * lastBaseFactor;
- baseCharacterSpacing = lastBaseFactor;
- }
- else {
- float width = line.widthLeft();
- PdfChunk last = line.getChunk(line.size() - 1);
- if (last != null) {
- String s = last.toString();
- char c;
- if (s.length() > 0 && hangingPunctuation.indexOf((c = s.charAt(s.length() - 1))) >= 0) {
- float oldWidth = width;
- width += last.font().width(c) * 0.4f;
- hangingCorrection = width - oldWidth;
- }
- }
- float baseFactor = width / (ratio * numberOfSpaces + lineLen - 1);
- baseWordSpacing = ratio * baseFactor;
- baseCharacterSpacing = baseFactor;
- lastBaseFactor = baseFactor;
- }
- }
-
- int lastChunkStroke = line.getLastStrokeChunk();
- int chunkStrokeIdx = 0;
- float xMarker = text.getXTLM();
- float baseXMarker = xMarker;
- float yMarker = text.getYTLM();
- boolean adjustMatrix = false;
-
- // looping over all the chunks in 1 line
- for (Iterator j = line.iterator(); j.hasNext(); ) {
- chunk = (PdfChunk) j.next();
- Color color = chunk.color();
- hScale = 1;
-
- if (chunkStrokeIdx <= lastChunkStroke) {
- float width;
- if (isJustified) {
- width = chunk.getWidthCorrected(baseCharacterSpacing, baseWordSpacing);
- }
- else
- width = chunk.width();
- if (chunk.isStroked()) {
- PdfChunk nextChunk = line.getChunk(chunkStrokeIdx + 1);
- if (chunk.isAttribute(Chunk.UNDERLINE)) {
- float subtract = lastBaseFactor;
- if (nextChunk != null && nextChunk.isAttribute(Chunk.UNDERLINE))
- subtract = 0;
- if (nextChunk == null)
- subtract += hangingCorrection;
- Object unders[][] = (Object[][])chunk.getAttribute(Chunk.UNDERLINE);
- Color scolor = null;
- int cap = 0;
- for (int k = 0; k < unders.length; ++k) {
- Object obj[] = unders[k];
- scolor = (Color)obj[0];
- float ps[] = (float[])obj[1];
- if (scolor == null)
- scolor = color;
- if (scolor != null)
- graphics.setColorStroke(scolor);
- float fsize = chunk.font().size();
- graphics.setLineWidth(ps[0] + fsize * ps[1]);
- float shift = ps[2] + fsize * ps[3];
- int cap2 = (int)ps[4];
- if (cap2 != 0)
- graphics.setLineCap(cap2);
- graphics.moveTo(xMarker, yMarker + shift);
- graphics.lineTo(xMarker + width - subtract, yMarker + shift);
- graphics.stroke();
- if (scolor != null)
- graphics.resetGrayStroke();
- if (cap2 != 0)
- graphics.setLineCap(0);
- }
- graphics.setLineWidth(1);
- }
- if (chunk.isAttribute(Chunk.ACTION)) {
- float subtract = lastBaseFactor;
- if (nextChunk != null && nextChunk.isAttribute(Chunk.ACTION))
- subtract = 0;
- if (nextChunk == null)
- subtract += hangingCorrection;
- text.addAnnotation(new PdfAnnotation(writer, xMarker, yMarker, xMarker + width - subtract, yMarker + chunk.font().size(), (PdfAction)chunk.getAttribute(Chunk.ACTION)));
- }
- if (chunk.isAttribute(Chunk.REMOTEGOTO)) {
- float subtract = lastBaseFactor;
- if (nextChunk != null && nextChunk.isAttribute(Chunk.REMOTEGOTO))
- subtract = 0;
- if (nextChunk == null)
- subtract += hangingCorrection;
- Object obj[] = (Object[])chunk.getAttribute(Chunk.REMOTEGOTO);
- String filename = (String)obj[0];
- if (obj[1] instanceof String)
- remoteGoto(filename, (String)obj[1], xMarker, yMarker, xMarker + width - subtract, yMarker + chunk.font().size());
- else
- remoteGoto(filename, ((Integer)obj[1]).intValue(), xMarker, yMarker, xMarker + width - subtract, yMarker + chunk.font().size());
- }
- if (chunk.isAttribute(Chunk.LOCALGOTO)) {
- float subtract = lastBaseFactor;
- if (nextChunk != null && nextChunk.isAttribute(Chunk.LOCALGOTO))
- subtract = 0;
- if (nextChunk == null)
- subtract += hangingCorrection;
- localGoto((String)chunk.getAttribute(Chunk.LOCALGOTO), xMarker, yMarker, xMarker + width - subtract, yMarker + chunk.font().size());
- }
- if (chunk.isAttribute(Chunk.LOCALDESTINATION)) {
- float subtract = lastBaseFactor;
- if (nextChunk != null && nextChunk.isAttribute(Chunk.LOCALDESTINATION))
- subtract = 0;
- if (nextChunk == null)
- subtract += hangingCorrection;
- localDestination((String)chunk.getAttribute(Chunk.LOCALDESTINATION), new PdfDestination(PdfDestination.XYZ, xMarker, yMarker + chunk.font().size(), 0));
- }
- if (chunk.isAttribute(Chunk.GENERICTAG)) {
- float subtract = lastBaseFactor;
- if (nextChunk != null && nextChunk.isAttribute(Chunk.GENERICTAG))
- subtract = 0;
- if (nextChunk == null)
- subtract += hangingCorrection;
- Rectangle rect = new Rectangle(xMarker, yMarker, xMarker + width - subtract, yMarker + chunk.font().size());
- PdfPageEvent pev = writer.getPageEvent();
- if (pev != null)
- pev.onGenericTag(writer, this, rect, (String)chunk.getAttribute(Chunk.GENERICTAG));
- }
- if (chunk.isAttribute(Chunk.BACKGROUND)) {
- float subtract = lastBaseFactor;
- if (nextChunk != null && nextChunk.isAttribute(Chunk.BACKGROUND))
- subtract = 0;
- if (nextChunk == null)
- subtract += hangingCorrection;
- float fontSize = chunk.font().size();
- float ascender = chunk.font().getFont().getFontDescriptor(BaseFont.ASCENT, fontSize);
- float descender = chunk.font().getFont().getFontDescriptor(BaseFont.DESCENT, fontSize);
- Object bgr[] = (Object[])chunk.getAttribute(Chunk.BACKGROUND);
- graphics.setColorFill((Color)bgr[0]);
- float extra[] = (float[])bgr[1];
- graphics.rectangle(xMarker - extra[0],
- yMarker + descender - extra[1] + chunk.getTextRise(),
- width - subtract + extra[0] + extra[2],
- ascender - descender + extra[1] + extra[3]);
- graphics.fill();
- graphics.setGrayFill(0);
- }
- if (chunk.isAttribute(Chunk.PDFANNOTATION)) {
- float subtract = lastBaseFactor;
- if (nextChunk != null && nextChunk.isAttribute(Chunk.PDFANNOTATION))
- subtract = 0;
- if (nextChunk == null)
- subtract += hangingCorrection;
- float fontSize = chunk.font().size();
- float ascender = chunk.font().getFont().getFontDescriptor(BaseFont.ASCENT, fontSize);
- float descender = chunk.font().getFont().getFontDescriptor(BaseFont.DESCENT, fontSize);
- PdfAnnotation annot = PdfFormField.shallowDuplicate((PdfAnnotation)chunk.getAttribute(Chunk.PDFANNOTATION));
- annot.put(PdfName.RECT, new PdfRectangle(xMarker, yMarker + descender, xMarker + width - subtract, yMarker + ascender));
- text.addAnnotation(annot);
- }
- float params[] = (float[])chunk.getAttribute(Chunk.SKEW);
- Float hs = (Float)chunk.getAttribute(Chunk.HSCALE);
- if (params != null || hs != null) {
- float a = 1, b = 0, c = 0;
- if (params != null) {
- b = params[0];
- c = params[1];
- }
- if (hs != null)
- hScale = hs.floatValue();
- text.setTextMatrix(hScale, b, c, 1, xMarker, yMarker);
- }
- if (chunk.isImage()) {
- Image image = chunk.getImage();
- float matrix[] = image.matrix();
- matrix[Image.CX] = xMarker + chunk.getImageOffsetX() - matrix[Image.CX];
- matrix[Image.CY] = yMarker + chunk.getImageOffsetY() - matrix[Image.CY];
- addImage(graphics, image, matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
- text.moveText(xMarker + lastBaseFactor + image.scaledWidth() - text.getXTLM(), 0);
- }
- }
- xMarker += width;
- ++chunkStrokeIdx;
- }
-
- if (chunk.font().compareTo(currentFont) != 0) {
- currentFont = chunk.font();
- text.setFontAndSize(currentFont.getFont(), currentFont.size());
- }
- float rise = 0;
- Object textRender[] = (Object[])chunk.getAttribute(Chunk.TEXTRENDERMODE);
- int tr = 0;
- float strokeWidth = 1;
- Color strokeColor = null;
- Float fr = (Float)chunk.getAttribute(Chunk.SUBSUPSCRIPT);
- if (textRender != null) {
- tr = ((Integer)textRender[0]).intValue() & 3;
- if (tr != PdfContentByte.TEXT_RENDER_MODE_FILL)
- text.setTextRenderingMode(tr);
- if (tr == PdfContentByte.TEXT_RENDER_MODE_STROKE || tr == PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE) {
- strokeWidth = ((Float)textRender[1]).floatValue();
- if (strokeWidth != 1)
- text.setLineWidth(strokeWidth);
- strokeColor = (Color)textRender[2];
- if (strokeColor == null)
- strokeColor = color;
- if (strokeColor != null)
- text.setColorStroke(strokeColor);
- }
- }
- if (fr != null)
- rise = fr.floatValue();
- if (color != null)
- text.setColorFill(color);
- if (rise != 0)
- text.setTextRise(rise);
- if (chunk.isImage()) {
- adjustMatrix = true;
- }
- // If it is a CJK chunk or Unicode TTF we will have to simulate the
- // space adjustment.
- else if (isJustified && numberOfSpaces > 0 && chunk.isSpecialEncoding()) {
- if (hScale != lastHScale) {
- lastHScale = hScale;
- text.setWordSpacing(baseWordSpacing / hScale);
- text.setCharacterSpacing(baseCharacterSpacing / hScale);
- }
- String s = chunk.toString();
- int idx = s.indexOf(' ');
- if (idx < 0)
- text.showText(chunk.toString());
- else {
- float spaceCorrection = - baseWordSpacing * 1000f / chunk.font.size() / hScale;
- PdfTextArray textArray = new PdfTextArray(s.substring(0, idx));
- int lastIdx = idx;
- while ((idx = s.indexOf(' ', lastIdx + 1)) >= 0) {
- textArray.add(spaceCorrection);
- textArray.add(s.substring(lastIdx, idx));
- lastIdx = idx;
- }
- textArray.add(spaceCorrection);
- textArray.add(s.substring(lastIdx));
- text.showText(textArray);
- }
- }
- else {
- if (isJustified && hScale != lastHScale) {
- lastHScale = hScale;
- text.setWordSpacing(baseWordSpacing / hScale);
- text.setCharacterSpacing(baseCharacterSpacing / hScale);
- }
- text.showText(chunk.toString());
- }
-
- if (rise != 0)
- text.setTextRise(0);
- if (color != null)
- text.resetRGBColorFill();
- if (tr != PdfContentByte.TEXT_RENDER_MODE_FILL)
- text.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL);
- if (strokeColor != null)
- text.resetRGBColorStroke();
- if (strokeWidth != 1)
- text.setLineWidth(1);
- if (chunk.isAttribute(Chunk.SKEW) || chunk.isAttribute(Chunk.HSCALE)) {
- adjustMatrix = true;
- text.setTextMatrix(xMarker, yMarker);
- }
- }
- if (isJustified) {
- text.setWordSpacing(0);
- text.setCharacterSpacing(0);
- if (line.isNewlineSplit())
- lastBaseFactor = 0;
- }
- if (adjustMatrix)
- text.moveText(baseXMarker - text.getXTLM(), 0);
- currentValues[0] = currentFont;
- currentValues[1] = new Float(lastBaseFactor);
- }
-
- /**
- * Implements a link to other part of the document. The jump will
- * be made to a local destination with the same name, that must exist.
- * @param name the name for this link
- * @param llx the lower left x corner of the activation area
- * @param lly the lower left y corner of the activation area
- * @param urx the upper right x corner of the activation area
- * @param ury the upper right y corner of the activation area
- */
- void localGoto(String name, float llx, float lly, float urx, float ury) {
- PdfAction action = getLocalGotoAction(name);
- annotations.add(new PdfAnnotation(writer, llx, lly, urx, ury, action));
- }
-
- PdfAction getLocalGotoAction(String name) {
- PdfAction action;
- Object obj[] = (Object[])localDestinations.get(name);
- if (obj == null)
- obj = new Object[3];
- if (obj[0] == null) {
- if (obj[1] == null) {
- obj[1] = writer.getPdfIndirectReference();
- }
- action = new PdfAction((PdfIndirectReference)obj[1]);
- obj[0] = action;
- localDestinations.put(name, obj);
- }
- else {
- action = (PdfAction)obj[0];
- }
- return action;
- }
-
- /**
- * The local destination to where a local goto with the same
- * name will jump to.
- * @param name the name of this local destination
- * @param destination the <CODE>PdfDestination</CODE> with the jump coordinates
- * @return <CODE>true</CODE> if the local destination was added,
- * <CODE>false</CODE> if a local destination with the same name
- * already existed
- */
- boolean localDestination(String name, PdfDestination destination) {
- Object obj[] = (Object[])localDestinations.get(name);
- if (obj == null)
- obj = new Object[3];
- if (obj[2] != null)
- return false;
- obj[2] = destination;
- localDestinations.put(name, obj);
- destination.addPage(writer.getCurrentPage());
- return true;
- }
-
- /**
- * Implements a link to another document.
- * @param filename the filename for the remote document
- * @param name the name to jump to
- * @param llx the lower left x corner of the activation area
- * @param lly the lower left y corner of the activation area
- * @param urx the upper right x corner of the activation area
- * @param ury the upper right y corner of the activation area
- */
- void remoteGoto(String filename, String name, float llx, float lly, float urx, float ury) {
- annotations.add(new PdfAnnotation(writer, llx, lly, urx, ury, new PdfAction(filename, name)));
- }
-
- /**
- * Implements a link to another document.
- * @param filename the filename for the remote document
- * @param page the page to jump to
- * @param llx the lower left x corner of the activation area
- * @param lly the lower left y corner of the activation area
- * @param urx the upper right x corner of the activation area
- * @param ury the upper right y corner of the activation area
- */
- void remoteGoto(String filename, int page, float llx, float lly, float urx, float ury) {
- writer.addAnnotation(new PdfAnnotation(writer, llx, lly, urx, ury, new PdfAction(filename, page)));
- }
-
- /** Sets the viewer preferences as the sum of several constants.
- * @param preferences the viewer preferences
- * @see PdfWriter#setViewerPreferences
- */
-
- public void setViewerPreferences(int preferences) {
- viewerPreferences |= preferences;
- }
-
- /** Implements an action in an area.
- * @param action the <CODE>PdfAction</CODE>
- * @param llx the lower left x corner of the activation area
- * @param lly the lower left y corner of the activation area
- * @param urx the upper right x corner of the activation area
- * @param ury the upper right y corner of the activation area
- */
- void setAction(PdfAction action, float llx, float lly, float urx, float ury) {
- writer.addAnnotation(new PdfAnnotation(writer, llx, lly, urx, ury, action));
- }
-
- void setOpenAction(String name) {
- openActionName = name;
- openActionAction = null;
- }
-
- void setOpenAction(PdfAction action) {
- openActionAction = action;
- openActionName = null;
- }
-
- void addAdditionalAction(PdfName actionType, PdfAction action) {
- if (additionalActions == null) {
- additionalActions = new PdfDictionary();
- }
- if (action == null)
- additionalActions.remove(actionType);
- else
- additionalActions.put(actionType, action);
- if (additionalActions.size() == 0)
- additionalActions = null;
- }
-
- void setPageLabels(PdfPageLabels pageLabels) {
- this.pageLabels = pageLabels;
- }
-
- void addJavaScript(PdfAction js) {
- if (js.get(PdfName.JS) == null)
- throw new RuntimeException("Only JavaScript actions are allowed.");
- try {
- documentJavaScript.add(writer.addToBody(js).getIndirectReference());
- }
- catch (IOException e) {
- throw new ExceptionConverter(e);
- }
- }
-
- void setCropBoxSize(Rectangle crop) {
- setBoxSize("crop", crop);
- }
-
- void setBoxSize(String boxName, Rectangle size) {
- if (size == null)
- boxSize.remove(boxName);
- else
- boxSize.put(boxName, new PdfRectangle(size));
- }
-
- void addCalculationOrder(PdfFormField formField) {
- acroForm.addCalculationOrder(formField);
- }
-
- void setSigFlags(int f) {
- acroForm.setSigFlags(f);
- }
-
- void addFormFieldRaw(PdfFormField field) {
- annotations.add(field);
- ArrayList kids = field.getKids();
- if (kids != null) {
- for (int k = 0; k < kids.size(); ++k)
- addFormFieldRaw((PdfFormField)kids.get(k));
- }
- }
-
- void addAnnotation(PdfAnnotation annot) {
- pageEmpty = false;
- if (annot.isForm()) {
- PdfFormField field = (PdfFormField)annot;
- if (field.getParent() == null)
- addFormFieldRaw(field);
- }
- else
- annotations.add(annot);
- }
-
- /**
- * Sets the display duration for the page (for presentations)
- * @param seconds the number of seconds to display the page
- */
- void setDuration(int seconds) {
- if (seconds > 0)
- this.duration=seconds;
- else
- this.duration=-1;
- }
-
- /**
- * Sets the transition for the page
- * @param transition the PdfTransition object
- */
- void setTransition(PdfTransition transition) {
- this.transition=transition;
- }
-
- void setPageAction(PdfName actionType, PdfAction action) {
- if (pageAA == null) {
- pageAA = new PdfDictionary();
- }
- pageAA.put(actionType, action);
- }
-
- /** Getter for property strictImageSequence.
- * @return Value of property strictImageSequence.
- *
- */
- boolean isStrictImageSequence() {
- return this.strictImageSequence;
- }
-
- /** Setter for property strictImageSequence.
- * @param strictImageSequence New value of property strictImageSequence.
- *
- */
- void setStrictImageSequence(boolean strictImageSequence) {
- this.strictImageSequence = strictImageSequence;
- }
-
- void setPageEmpty(boolean pageEmpty) {
- this.pageEmpty = pageEmpty;
- }
- /**
- * Method added by Pelikan Stephan
- * @see com.lowagie.text.DocListener#clearTextWrap()
- */
- public void clearTextWrap() throws DocumentException {
- super.clearTextWrap();
- float tmpHeight = imageEnd - currentHeight;
- if (line != null) {
- tmpHeight += line.height();
- }
- if ((imageEnd > -1) && (tmpHeight > 0)) {
- carriageReturn();
- currentHeight += tmpHeight;
- }
- }
-
- ArrayList getDocumentJavaScript() {
- return documentJavaScript;
- }
-
- /**
- * @see com.lowagie.text.DocListener#setMarginMirroring(boolean)
- */
- public boolean setMarginMirroring(boolean MarginMirroring) {
- if (writer != null && writer.isPaused()) {
- return false;
- }
- return super.setMarginMirroring(MarginMirroring);
- }
-
- void setThumbnail(Image image) throws PdfException, DocumentException {
- thumb = writer.getImageReference(writer.addDirectImageSimple(image));
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfEncodings.java b/LibrarySource/com/lowagie/text/pdf/PdfEncodings.java
deleted file mode 100644
index 3bd2b30..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfEncodings.java
+++ /dev/null
@@ -1,717 +0,0 @@
-/*
- * Copyright 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-import com.lowagie.text.ExceptionConverter;
-import java.io.UnsupportedEncodingException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.BufferedReader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.StringTokenizer;
-/** Supports fast encodings for winansi and PDFDocEncoding.
- * Supports conversions from CJK encodings to CID.
- * Supports custom encodings.
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class PdfEncodings {
- protected static final int CIDNONE = 0;
- protected static final int CIDRANGE = 1;
- protected static final int CIDCHAR = 2;
-
- static final char winansiByteToChar[] = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
- 8364, 65533, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 352, 8249, 338, 65533, 381, 65533,
- 65533, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732, 8482, 353, 8250, 339, 65533, 382, 376,
- 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
- 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
- 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
- 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
- 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255};
-
- static final char pdfEncodingByteToChar[] = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
- 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x0192, 0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018,
- 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x0141, 0x0152, 0x0160, 0x0178, 0x017d, 0x0131, 0x0142, 0x0153, 0x0161, 0x017e, 65533,
- 0x20ac, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
- 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
- 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
- 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
- 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255};
-
- static final IntHashtable winansi = new IntHashtable();
-
- static final IntHashtable pdfEncoding = new IntHashtable();
-
- static final HashMap extraEncodings = new HashMap();
-
- static {
- for (int k = 128; k < 160; ++k) {
- char c = winansiByteToChar[k];
- if (c != 65533)
- winansi.put(c, k);
- }
-
- for (int k = 128; k < 161; ++k) {
- char c = pdfEncodingByteToChar[k];
- if (c != 65533)
- pdfEncoding.put(c, k);
- }
-
- addExtraEncoding("Wingdings", new WingdingsConversion());
- addExtraEncoding("Symbol", new SymbolConversion(true));
- addExtraEncoding("ZapfDingbats", new SymbolConversion(false));
- addExtraEncoding("SymbolTT", new SymbolTTConversion());
- addExtraEncoding("Cp437", new Cp437Conversion());
- }
-
- /** Converts a <CODE>String</CODE> to a </CODE>byte</CODE> array according
- * to the font's encoding.
- * @return an array of <CODE>byte</CODE> representing the conversion according to the font's encoding
- * @param encoding the encoding
- * @param text the <CODE>String</CODE> to be converted
- */
- public static final byte[] convertToBytes(String text, String encoding) {
- if (text == null)
- return new byte[0];
- if (encoding == null || encoding.length() == 0) {
- int len = text.length();
- byte b[] = new byte[len];
- for (int k = 0; k < len; ++k)
- b[k] = (byte)text.charAt(k);
- return b;
- }
- ExtraEncoding extra = null;
- synchronized (extraEncodings) {
- extra = (ExtraEncoding)extraEncodings.get(encoding.toLowerCase());
- }
- if (extra != null) {
- byte b[] = extra.charToByte(text, encoding);
- if (b != null)
- return b;
- }
- IntHashtable hash = null;
- if (encoding.equals(BaseFont.WINANSI))
- hash = winansi;
- else if (encoding.equals(PdfObject.TEXT_PDFDOCENCODING))
- hash = pdfEncoding;
- if (hash != null) {
- char cc[] = text.toCharArray();
- int len = cc.length;
- int ptr = 0;
- byte b[] = new byte[len];
- int c = 0;
- for (int k = 0; k < len; ++k) {
- char char1 = cc[k];
- if (char1 < 128 || (char1 >= 160 && char1 <= 255))
- c = char1;
- else
- c = hash.get(char1);
- if (c != 0)
- b[ptr++] = (byte)c;
- }
- if (ptr == len)
- return b;
- byte b2[] = new byte[ptr];
- System.arraycopy(b, 0, b2, 0, ptr);
- return b2;
- }
- if (encoding.equals(PdfObject.TEXT_UNICODE)) {
- // workaround for jdk 1.2.2 bug
- char cc[] = text.toCharArray();
- int len = cc.length;
- byte b[] = new byte[cc.length * 2 + 2];
- b[0] = -2;
- b[1] = -1;
- int bptr = 2;
- for (int k = 0; k < len; ++k) {
- char c = cc[k];
- b[bptr++] = (byte)(c >> 8);
- b[bptr++] = (byte)(c & 0xff);
- }
- return b;
- }
- try {
- return text.getBytes(encoding);
- }
- catch (UnsupportedEncodingException e) {
- throw new ExceptionConverter(e);
- }
- }
-
- /** Converts a </CODE>byte</CODE> array to a <CODE>String</CODE> according
- * to the some encoding.
- * @param bytes the bytes to convert
- * @param encoding the encoding
- * @return the converted <CODE>String</CODE>
- */
- public static final String convertToString(byte bytes[], String encoding) {
- if (bytes == null)
- return PdfObject.NOTHING;
- if (encoding == null || encoding.length() == 0) {
- char c[] = new char[bytes.length];
- for (int k = 0; k < bytes.length; ++k)
- c[k] = (char)(bytes[k] & 0xff);
- return new String(c);
- }
- ExtraEncoding extra = null;
- synchronized (extraEncodings) {
- extra = (ExtraEncoding)extraEncodings.get(encoding.toLowerCase());
- }
- if (extra != null) {
- String text = extra.byteToChar(bytes, encoding);
- if (text != null)
- return text;
- }
- char ch[] = null;
- if (encoding.equals(BaseFont.WINANSI))
- ch = winansiByteToChar;
- else if (encoding.equals(PdfObject.TEXT_PDFDOCENCODING))
- ch = pdfEncodingByteToChar;
- if (ch != null) {
- int len = bytes.length;
- char c[] = new char[len];
- for (int k = 0; k < len; ++k) {
- c[k] = ch[bytes[k] & 0xff];
- }
- return new String(c);
- }
- try {
- return new String(bytes, encoding);
- }
- catch (UnsupportedEncodingException e) {
- throw new ExceptionConverter(e);
- }
- }
-
- /** Checks is <CODE>text</CODE> only has PdfDocEncoding characters.
- * @param text the <CODE>String</CODE> to test
- * @return <CODE>true</CODE> if only PdfDocEncoding characters are present
- */
- public static boolean isPdfDocEncoding(String text) {
- if (text == null)
- return true;
- int len = text.length();
- for (int k = 0; k < len; ++k) {
- char char1 = text.charAt(k);
- if (char1 < 128 || (char1 >= 160 && char1 <= 255))
- continue;
- if (!pdfEncoding.containsKey(char1))
- return false;
- }
- return true;
- }
-
- static final HashMap cmaps = new HashMap();
- /** Assumes that '\\n' and '\\r\\n' are the newline sequences. It may not work for
- * all CJK encodings. To be used with loadCmap().
- */
- public static final byte CRLF_CID_NEWLINE[][] = new byte[][]{{(byte)'\n'}, {(byte)'\r', (byte)'\n'}};
-
- /** Clears the CJK cmaps from the cache. If <CODE>name</CODE> is the
- * empty string then all the cache is cleared. Calling this method
- * has no consequences other than the need to reload the cmap
- * if needed.
- * @param name the name of the cmap to clear or all the cmaps if the empty string
- */
- public static void clearCmap(String name) {
- synchronized (cmaps) {
- if (name.length() == 0)
- cmaps.clear();
- else
- cmaps.remove(name);
- }
- }
-
- /** Loads a CJK cmap to the cache with the option of associating
- * sequences to the newline.
- * @param name the CJK cmap name
- * @param newline the sequences to be replaced bi a newline in the resulting CID. See <CODE>CRLF_CID_NEWLINE</CODE>
- */
- public static void loadCmap(String name, byte newline[][]) {
- try {
- char planes[][] = null;
- synchronized (cmaps) {
- planes = (char[][])cmaps.get(name);
- }
- if (planes == null) {
- planes = readCmap(name, (byte[][])newline);
- synchronized (cmaps) {
- cmaps.put(name, planes);
- }
- }
- }
- catch (IOException e) {
- throw new ExceptionConverter(e);
- }
- }
-
- /** Converts a <CODE>byte</CODE> array encoded as <CODE>name</CODE>
- * to a CID string. This is needed to reach some CJK characters
- * that don't exist in 16 bit Unicode.</p>
- * The font to use this result must use the encoding "Identity-H"
- * or "Identity-V".</p>
- * See ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/.
- * @param name the CJK encoding name
- * @param seq the <CODE>byte</CODE> array to be decoded
- * @return the CID string
- */
- public static String convertCmap(String name, byte seq[]) {
- return convertCmap(name, seq, 0, seq.length);
- }
-
- /** Converts a <CODE>byte</CODE> array encoded as <CODE>name</CODE>
- * to a CID string. This is needed to reach some CJK characters
- * that don't exist in 16 bit Unicode.</p>
- * The font to use this result must use the encoding "Identity-H"
- * or "Identity-V".</p>
- * See ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/.
- * @param name the CJK encoding name
- * @param start the start offset in the data
- * @param length the number of bytes to convert
- * @param seq the <CODE>byte</CODE> array to be decoded
- * @return the CID string
- */
- public static String convertCmap(String name, byte seq[], int start, int length) {
- try {
- char planes[][] = null;
- synchronized (cmaps) {
- planes = (char[][])cmaps.get(name);
- }
- if (planes == null) {
- planes = readCmap(name, (byte[][])null);
- synchronized (cmaps) {
- cmaps.put(name, planes);
- }
- }
- return decodeSequence(seq, start, length, planes);
- }
- catch (IOException e) {
- throw new ExceptionConverter(e);
- }
- }
-
- static String decodeSequence(byte seq[], int start, int length, char planes[][]) {
- StringBuffer buf = new StringBuffer();
- int end = start + length;
- int currentPlane = 0;
- for (int k = start; k < end; ++k) {
- int one = (int)seq[k] & 0xff;
- char plane[] = planes[currentPlane];
- int cid = plane[one];
- if ((cid & 0x8000) == 0) {
- buf.append((char)cid);
- currentPlane = 0;
- }
- else
- currentPlane = cid & 0x7fff;
- }
- return buf.toString();
- }
-
- static char[][] readCmap(String name, byte newline[][]) throws IOException {
- ArrayList planes = new ArrayList();
- planes.add(new char[256]);
- readCmap(name, planes);
- if (newline != null) {
- for (int k = 0; k < newline.length; ++k)
- encodeSequence(newline[k].length, newline[k], BaseFont.CID_NEWLINE, planes);
- }
- char ret[][] = new char[planes.size()][];
- return (char[][])planes.toArray(ret);
- }
-
- static void readCmap(String name, ArrayList planes) throws IOException {
- String fullName = BaseFont.RESOURCE_PATH + "cmaps/" + name;
- InputStream in = BaseFont.getResourceStream(fullName);
- if (in == null)
- throw new IOException("The Cmap " + name + " was not found.");
- encodeStream(in, planes);
- in.close();
- }
-
- static void encodeStream(InputStream in, ArrayList planes) throws IOException {
- BufferedReader rd = new BufferedReader(new InputStreamReader(in, "iso-8859-1"));
- String line = null;
- int state = CIDNONE;
- byte seqs[] = new byte[7];
- while ((line = rd.readLine()) != null) {
- if (line.length() < 6)
- continue;
- switch (state) {
- case CIDNONE: {
- if (line.indexOf("begincidrange") >= 0)
- state = CIDRANGE;
- else if (line.indexOf("begincidchar") >= 0)
- state = CIDCHAR;
- else if (line.indexOf("usecmap") >= 0) {
- StringTokenizer tk = new StringTokenizer(line);
- String t = tk.nextToken();
- readCmap(t.substring(1), planes);
- }
- break;
- }
- case CIDRANGE: {
- if (line.indexOf("endcidrange") >= 0) {
- state = CIDNONE;
- break;
- }
- StringTokenizer tk = new StringTokenizer(line);
- String t = tk.nextToken();
- int size = t.length() / 2 - 1;
- long start = Long.parseLong(t.substring(1, t.length() - 1), 16);
- t = tk.nextToken();
- long end = Long.parseLong(t.substring(1, t.length() - 1), 16);
- t = tk.nextToken();
- int cid = Integer.parseInt(t);
- for (long k = start; k <= end; ++k) {
- breakLong(k, size, seqs);
- encodeSequence(size, seqs, (char)cid, planes);
- ++cid;
- }
- break;
- }
- case CIDCHAR: {
- if (line.indexOf("endcidchar") >= 0) {
- state = CIDNONE;
- break;
- }
- StringTokenizer tk = new StringTokenizer(line);
- String t = tk.nextToken();
- int size = t.length() / 2 - 1;
- long start = Long.parseLong(t.substring(1, t.length() - 1), 16);
- t = tk.nextToken();
- int cid = Integer.parseInt(t);
- breakLong(start, size, seqs);
- encodeSequence(size, seqs, (char)cid, planes);
- break;
- }
- }
- }
- }
-
- static void breakLong(long n, int size, byte seqs[]) {
- for (int k = 0; k < size; ++k) {
- seqs[k] = (byte)(n >> ((size - 1 - k) * 8));
- }
- }
-
- static void encodeSequence(int size, byte seqs[], char cid, ArrayList planes) {
- --size;
- int nextPlane = 0;
- for (int idx = 0; idx < size; ++idx) {
- char plane[] = (char[])planes.get(nextPlane);
- int one = (int)seqs[idx] & 0xff;
- char c = plane[one];
- if (c != 0 && (c & 0x8000) == 0)
- throw new RuntimeException("Inconsistent mapping.");
- if (c == 0) {
- planes.add(new char[256]);
- c = (char)((planes.size() - 1) | 0x8000);
- plane[one] = c;
- }
- nextPlane = c & 0x7fff;
- }
- char plane[] = (char[])planes.get(nextPlane);
- int one = (int)seqs[size] & 0xff;
- char c = plane[one];
- if ((c & 0x8000) != 0)
- throw new RuntimeException("Inconsistent mapping.");
- plane[one] = cid;
- }
-
- /** Adds an extra encoding.
- * @param name the name of the encoding. The encoding recognition is case insensitive
- * @param enc the conversion class
- */
- public static void addExtraEncoding(String name, ExtraEncoding enc) {
- synchronized (extraEncodings) {
- extraEncodings.put(name.toLowerCase(), enc);
- }
- }
-
- private static class WingdingsConversion implements ExtraEncoding {
-
- public byte[] charToByte(String text, String encoding) {
- char cc[] = text.toCharArray();
- byte b[] = new byte[cc.length];
- int ptr = 0;
- int len = cc.length;
- for (int k = 0; k < len; ++k) {
- char c = cc[k];
- if (c == ' ')
- b[ptr++] = (byte)c;
- else if (c >= '\u2701' && c <= '\u27BE') {
- byte v = table[c - 0x2700];
- if (v != 0)
- b[ptr++] = v;
- }
- }
- if (ptr == len)
- return b;
- byte b2[] = new byte[ptr];
- System.arraycopy(b, 0, b2, 0, ptr);
- return b2;
- }
-
- public String byteToChar(byte[] b, String encoding) {
- return null;
- }
-
- private final static byte table[] = {
- 0, 35, 34, 0, 0, 0, 41, 62, 81, 42,
- 0, 0, 65, 63, 0, 0, 0, 0, 0, -4,
- 0, 0, 0, -5, 0, 0, 0, 0, 0, 0,
- 86, 0, 88, 89, 0, 0, 0, 0, 0, 0,
- 0, 0, -75, 0, 0, 0, 0, 0, -74, 0,
- 0, 0, -83, -81, -84, 0, 0, 0, 0, 0,
- 0, 0, 0, 124, 123, 0, 0, 0, 84, 0,
- 0, 0, 0, 0, 0, 0, 0, -90, 0, 0,
- 0, 113, 114, 0, 0, 0, 117, 0, 0, 0,
- 0, 0, 0, 125, 126, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, -116, -115,
- -114, -113, -112, -111, -110, -109, -108, -107, -127, -126,
- -125, -124, -123, -122, -121, -120, -119, -118, -116, -115,
- -114, -113, -112, -111, -110, -109, -108, -107, -24, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, -24, -40, 0, 0, -60, -58, 0, 0, -16,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, -36,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0
- };
- }
-
- private static class Cp437Conversion implements ExtraEncoding {
- private static IntHashtable c2b = new IntHashtable();
-
- public byte[] charToByte(String text, String encoding) {
- char cc[] = text.toCharArray();
- byte b[] = new byte[cc.length];
- int ptr = 0;
- int len = cc.length;
- for (int k = 0; k < len; ++k) {
- char c = cc[k];
- if (c < ' ')
- continue;
- if (c < 128)
- b[ptr++] = (byte)c;
- else {
- byte v = (byte)c2b.get(c);
- if (v != 0)
- b[ptr++] = v;
- }
- }
- if (ptr == len)
- return b;
- byte b2[] = new byte[ptr];
- System.arraycopy(b, 0, b2, 0, ptr);
- return b2;
- }
-
- public String byteToChar(byte[] b, String encoding) {
- int len = b.length;
- char cc[] = new char[len];
- int ptr = 0;
- for (int k = 0; k < len; ++k) {
- int c = b[k] & 0xff;
- if (c < ' ')
- continue;
- if (c < 128)
- cc[ptr++] = (char)c;
- else {
- char v = table[c - 128];
- cc[ptr++] = v;
- }
- }
- return new String(cc, 0, ptr);
- }
-
- private final static char table[] = {
- '\u00C7', '\u00FC', '\u00E9', '\u00E2', '\u00E4', '\u00E0', '\u00E5', '\u00E7', '\u00EA', '\u00EB', '\u00E8', '\u00EF', '\u00EE', '\u00EC', '\u00C4', '\u00C5',
- '\u00C9', '\u00E6', '\u00C6', '\u00F4', '\u00F6', '\u00F2', '\u00FB', '\u00F9', '\u00FF', '\u00D6', '\u00DC', '\u00A2', '\u00A3', '\u00A5', '\u20A7', '\u0192',
- '\u00E1', '\u00ED', '\u00F3', '\u00FA', '\u00F1', '\u00D1', '\u00AA', '\u00BA', '\u00BF', '\u2310', '\u00AC', '\u00BD', '\u00BC', '\u00A1', '\u00AB', '\u00BB',
- '\u2591', '\u2592', '\u2593', '\u2502', '\u2524', '\u2561', '\u2562', '\u2556', '\u2555', '\u2563', '\u2551', '\u2557', '\u255D', '\u255C', '\u255B', '\u2510',
- '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C', '\u255E', '\u255F', '\u255A', '\u2554', '\u2569', '\u2566', '\u2560', '\u2550', '\u256C', '\u2567',
- '\u2568', '\u2564', '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B', '\u256A', '\u2518', '\u250C', '\u2588', '\u2584', '\u258C', '\u2590', '\u2580',
- '\u03B1', '\u00DF', '\u0393', '\u03C0', '\u03A3', '\u03C3', '\u00B5', '\u03C4', '\u03A6', '\u0398', '\u03A9', '\u03B4', '\u221E', '\u03C6', '\u03B5', '\u2229',
- '\u2261', '\u00B1', '\u2265', '\u2264', '\u2320', '\u2321', '\u00F7', '\u2248', '\u00B0', '\u2219', '\u00B7', '\u221A', '\u207F', '\u00B2', '\u25A0', '\u00A0'
- };
-
- static {
- for (int k = 0; k < table.length; ++k)
- c2b.put(table[k], k + 128);
- }
- }
-
- private static class SymbolConversion implements ExtraEncoding {
-
- private static final IntHashtable t1 = new IntHashtable();
- private static final IntHashtable t2 = new IntHashtable();
- private IntHashtable translation;
-
- SymbolConversion(boolean symbol) {
- if (symbol)
- translation = t1;
- else
- translation = t2;
- }
-
- public byte[] charToByte(String text, String encoding) {
- char cc[] = text.toCharArray();
- byte b[] = new byte[cc.length];
- int ptr = 0;
- int len = cc.length;
- for (int k = 0; k < len; ++k) {
- char c = cc[k];
- byte v = (byte)translation.get((int)c);
- if (v != 0)
- b[ptr++] = v;
- }
- if (ptr == len)
- return b;
- byte b2[] = new byte[ptr];
- System.arraycopy(b, 0, b2, 0, ptr);
- return b2;
- }
-
- public String byteToChar(byte[] b, String encoding) {
- return null;
- }
-
- private final static char table1[] = {
- ' ','!','\u2200','#','\u2203','%','&','\u220b','(',')','*','+',',','-','.','/',
- '0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?',
- '\u2245','\u0391','\u0392','\u03a7','\u0394','\u0395','\u03a6','\u0393','\u0397','\u0399','\u03d1','\u039a','\u039b','\u039c','\u039d','\u039f',
- '\u03a0','\u0398','\u03a1','\u03a3','\u03a4','\u03a5','\u03c2','\u03a9','\u039e','\u03a8','\u0396','[','\u2234',']','\u22a5','_',
- '\u0305','\u03b1','\u03b2','\u03c7','\u03b4','\u03b5','\u03d5','\u03b3','\u03b7','\u03b9','\u03c6','\u03ba','\u03bb','\u03bc','\u03bd','\u03bf',
- '\u03c0','\u03b8','\u03c1','\u03c3','\u03c4','\u03c5','\u03d6','\u03c9','\u03be','\u03c8','\u03b6','{','|','}','~','\0',
- '\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0',
- '\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0',
- '\u20ac','\u03d2','\u2032','\u2264','\u2044','\u221e','\u0192','\u2663','\u2666','\u2665','\u2660','\u2194','\u2190','\u2191','\u2192','\u2193',
- '\u00b0','\u00b1','\u2033','\u2265','\u00d7','\u221d','\u2202','\u2022','\u00f7','\u2260','\u2261','\u2248','\u2026','\u2502','\u2500','\u21b5',
- '\u2135','\u2111','\u211c','\u2118','\u2297','\u2295','\u2205','\u2229','\u222a','\u2283','\u2287','\u2284','\u2282','\u2286','\u2208','\u2209',
- '\u2220','\u2207','\u00ae','\u00a9','\u2122','\u220f','\u221a','\u2022','\u00ac','\u2227','\u2228','\u21d4','\u21d0','\u21d1','\u21d2','\u21d3',
- '\u25ca','\u2329','\0','\0','\0','\u2211','\u239b','\u239c','\u239d','\u23a1','\u23a2','\u23a3','\u23a7','\u23a8','\u23a9','\u23aa',
- '\0','\u232a','\u222b','\u2320','\u23ae','\u2321','\u239e','\u239f','\u23a0','\u23a4','\u23a5','\u23a6','\u23ab','\u23ac','\u23ad','\0'
- };
-
- private final static char table2[] = {
- '\u0020','\u2701','\u2702','\u2703','\u2704','\u260e','\u2706','\u2707','\u2708','\u2709','\u261b','\u261e','\u270C','\u270D','\u270E','\u270F',
- '\u2710','\u2711','\u2712','\u2713','\u2714','\u2715','\u2716','\u2717','\u2718','\u2719','\u271A','\u271B','\u271C','\u271D','\u271E','\u271F',
- '\u2720','\u2721','\u2722','\u2723','\u2724','\u2725','\u2726','\u2727','\u2605','\u2729','\u272A','\u272B','\u272C','\u272D','\u272E','\u272F',
- '\u2730','\u2731','\u2732','\u2733','\u2734','\u2735','\u2736','\u2737','\u2738','\u2739','\u273A','\u273B','\u273C','\u273D','\u273E','\u273F',
- '\u2740','\u2741','\u2742','\u2743','\u2744','\u2745','\u2746','\u2747','\u2748','\u2749','\u274A','\u274B','\u25cf','\u274D','\u25a0','\u274F',
- '\u2750','\u2751','\u2752','\u25b2','\u25bc','\u25c6','\u2756','\u25d7','\u2758','\u2759','\u275A','\u275B','\u275C','\u275D','\u275E','\u0000',
- '\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0',
- '\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0',
- '\u0000','\u2761','\u2762','\u2763','\u2764','\u2765','\u2766','\u2767','\u2663','\u2666','\u2665','\u2660','\u2460','\u2461','\u2462','\u2463',
- '\u2464','\u2465','\u2466','\u2467','\u2468','\u2469','\u2776','\u2777','\u2778','\u2779','\u277A','\u277B','\u277C','\u277D','\u277E','\u277F',
- '\u2780','\u2781','\u2782','\u2783','\u2784','\u2785','\u2786','\u2787','\u2788','\u2789','\u278A','\u278B','\u278C','\u278D','\u278E','\u278F',
- '\u2790','\u2791','\u2792','\u2793','\u2794','\u2192','\u2194','\u2195','\u2798','\u2799','\u279A','\u279B','\u279C','\u279D','\u279E','\u279F',
- '\u27A0','\u27A1','\u27A2','\u27A3','\u27A4','\u27A5','\u27A6','\u27A7','\u27A8','\u27A9','\u27AA','\u27AB','\u27AC','\u27AD','\u27AE','\u27AF',
- '\u0000','\u27B1','\u27B2','\u27B3','\u27B4','\u27B5','\u27B6','\u27B7','\u27B8','\u27B9','\u27BA','\u27BB','\u27BC','\u27BD','\u27BE','\u0000'
- };
-
- static {
- for (int k = 0; k < table1.length; ++k) {
- int v = (int)table1[k];
- if (v != 0)
- t1.put(v, k + 32);
- }
- for (int k = 0; k < table2.length; ++k) {
- int v = (int)table2[k];
- if (v != 0)
- t2.put(v, k + 32);
- }
- }
- }
-
- private static class SymbolTTConversion implements ExtraEncoding {
-
- public byte[] charToByte(String text, String encoding) {
- char ch[] = text.toCharArray();
- byte b[] = new byte[ch.length];
- int ptr = 0;
- int len = ch.length;
- for (int k = 0; k < len; ++k) {
- char c = ch[k];
- if ((c & 0xff00) == 0 || (c & 0xff00) == 0xf000)
- b[ptr++] = (byte)c;
- }
- if (ptr == len)
- return b;
- byte b2[] = new byte[ptr];
- System.arraycopy(b, 0, b2, 0, ptr);
- return b2;
- }
-
- public String byteToChar(byte[] b, String encoding) {
- return null;
- }
-
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfEncryption.java b/LibrarySource/com/lowagie/text/pdf/PdfEncryption.java
deleted file mode 100644
index 86653f9..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfEncryption.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * $Id: PdfEncryption.java,v 1.20 2003/03/11 09:33:34 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.security.MessageDigest;
-import com.lowagie.text.ExceptionConverter;
-
-/**
- *
- * @author Paulo Soares (psoares at consiste.pt)
- * @author Kazuya Ujihara
- */
-public class PdfEncryption {
-
- static final byte pad[] = {
- (byte)0x28, (byte)0xBF, (byte)0x4E, (byte)0x5E, (byte)0x4E, (byte)0x75,
- (byte)0x8A, (byte)0x41, (byte)0x64, (byte)0x00, (byte)0x4E, (byte)0x56,
- (byte)0xFF, (byte)0xFA, (byte)0x01, (byte)0x08, (byte)0x2E, (byte)0x2E,
- (byte)0x00, (byte)0xB6, (byte)0xD0, (byte)0x68, (byte)0x3E, (byte)0x80,
- (byte)0x2F, (byte)0x0C, (byte)0xA9, (byte)0xFE, (byte)0x64, (byte)0x53,
- (byte)0x69, (byte)0x7A};
-
- byte state[] = new byte[256];
- int x;
- int y;
- /** The encryption key for a particular object/generation */
- byte key[];
- /** The encryption key length for a particular object/generation */
- int keySize;
- /** The global encryption key */
- byte mkey[];
- /** Work area to prepare the object/generation bytes */
- byte extra[] = new byte[5];
- /** The message digest algorithm MD5 */
- MessageDigest md5;
- /** The encryption key for the owner */
- byte ownerKey[] = new byte[32];
- /** The encryption key for the user */
- byte userKey[] = new byte[32];
- int permissions;
- byte documentID[];
- static long seq = System.currentTimeMillis();
-
- public PdfEncryption() {
- try {
- md5 = MessageDigest.getInstance("MD5");
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- public PdfEncryption(PdfEncryption enc) {
- super();
- mkey = (byte[])enc.mkey.clone();
- ownerKey = (byte[])enc.ownerKey.clone();
- userKey = (byte[])enc.userKey.clone();
- permissions = enc.permissions;
- if (enc.documentID != null)
- documentID = (byte[])enc.documentID.clone();
- }
-
- /**
- */
- private byte[] padPassword(byte userPassword[]) {
- byte userPad[] = new byte[32];
- if (userPassword == null) {
- System.arraycopy(pad, 0, userPad, 0, 32);
- }
- else {
- System.arraycopy(userPassword, 0, userPad, 0, Math.min(userPassword.length, 32));
- if (userPassword.length < 32)
- System.arraycopy(pad, 0, userPad, userPassword.length, 32 - userPassword.length);
- }
-
- return userPad;
- }
-
- /**
- */
- private byte[] computeOwnerKey(byte userPad[], byte ownerPad[], boolean strength128Bits) {
- byte ownerKey[] = new byte[32];
-
- byte digest[] = md5.digest(ownerPad);
- if (strength128Bits) {
- byte mkey[] = new byte[16];
- for (int k = 0; k < 50; ++k)
- digest = md5.digest(digest);
- System.arraycopy(userPad, 0, ownerKey, 0, 32);
- for (int i = 0; i < 20; ++i) {
- for (int j = 0; j < mkey.length ; ++j)
- mkey[j] = (byte)(digest[j] ^ i);
- prepareRC4Key(mkey);
- encryptRC4(ownerKey);
- }
- }
- else {
- prepareRC4Key(digest, 0, 5);
- encryptRC4(userPad, ownerKey);
- }
-
- return ownerKey;
- }
-
- /**
- *
- * ownerKey, documentID must be setuped
- */
- private void setupGlobalEncryptionKey(byte[] documentID, byte userPad[], byte ownerKey[], int permissions, boolean strength128Bits) {
- this.documentID = documentID;
- this.ownerKey = ownerKey;
- this.permissions = permissions;
- mkey = new byte[strength128Bits ? 16 : 5];
-
- //fixed by ujihara in order to follow PDF refrence
- md5.reset();
- md5.update(userPad);
- md5.update(ownerKey);
-
- byte ext[] = new byte[4];
- ext[0] = (byte)permissions;
- ext[1] = (byte)(permissions >> 8);
- ext[2] = (byte)(permissions >> 16);
- ext[3] = (byte)(permissions >> 24);
- md5.update(ext, 0, 4);
- if (documentID != null) md5.update(documentID);
-
- byte digest[] = md5.digest();
-
- if (mkey.length == 16) {
- for (int k = 0; k < 50; ++k)
- digest = md5.digest(digest);
- }
-
- System.arraycopy(digest, 0, mkey, 0, mkey.length);
- }
-
- /**
- *
- * mkey must be setuped
- */
- private void setupUserKey() {
- if (mkey.length == 16) {
- md5.update(pad);
- byte digest[] = md5.digest(documentID);
- System.arraycopy(digest, 0, userKey, 0, 16);
- for (int k = 16; k < 32; ++k)
- userKey[k] = 0;
- for (int i = 0; i < 20; ++i) {
- for (int j = 0; j < mkey.length; ++j)
- digest[j] = (byte)(mkey[j] ^ i);
- prepareRC4Key(digest, 0, mkey.length);
- encryptRC4(userKey, 0, 16);
- }
- }
- else {
- prepareRC4Key(mkey);
- encryptRC4(pad, userKey);
- }
- }
-
- public void setupAllKeys(byte userPassword[], byte ownerPassword[], int permissions, boolean strength128Bits) {
- if (ownerPassword == null || ownerPassword.length == 0)
- ownerPassword = md5.digest(createDocumentId());
- permissions |= strength128Bits ? 0xfffff0c0 : 0xffffffc0;
- permissions &= 0xfffffffc;
- //PDF refrence 3.5.2 Standard Security Handler, Algorithum 3.3-1
- //If there is no owner password, use the user password instead.
- byte userPad[] = padPassword(userPassword);
- byte ownerPad[] = padPassword(ownerPassword);
-
- this.ownerKey = computeOwnerKey(userPad, ownerPad, strength128Bits);
- documentID = createDocumentId();
- setupByUserPad(this.documentID, userPad, this.ownerKey, permissions, strength128Bits);
- }
-
- public static byte[] createDocumentId() {
- MessageDigest md5;
- try {
- md5 = MessageDigest.getInstance("MD5");
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- long time = System.currentTimeMillis();
- long mem = Runtime.getRuntime().freeMemory();
- String s = time + "+" + mem + "+" + (seq++);
- return md5.digest(s.getBytes());
- }
-
- /**
- */
- public void setupByUserPassword(byte[] documentID, byte userPassword[], byte ownerKey[], int permissions, boolean strength128Bits) {
- setupByUserPad(documentID, padPassword(userPassword), ownerKey, permissions, strength128Bits);
- }
-
- /**
- */
- private void setupByUserPad(byte[] documentID, byte userPad[], byte ownerKey[], int permissions, boolean strength128Bits) {
- setupGlobalEncryptionKey(documentID, userPad, ownerKey, permissions, strength128Bits);
- setupUserKey();
- }
-
- /**
- */
- public void setupByOwnerPassword(byte[] documentID, byte ownerPassword[], byte userKey[], byte ownerKey[], int permissions, boolean strength128Bits) {
- setupByOwnerPad(documentID, padPassword(ownerPassword), userKey, ownerKey, permissions, strength128Bits);
- }
-
- private void setupByOwnerPad(byte[] documentID, byte ownerPad[], byte userKey[], byte ownerKey[], int permissions, boolean strength128Bits) {
- byte userPad[] = computeOwnerKey(ownerKey, ownerPad, strength128Bits); //userPad will be set in this.ownerKey
- setupGlobalEncryptionKey(documentID, userPad, ownerKey, permissions, strength128Bits); //step 3
- setupUserKey();
- }
-
- public void prepareKey() {
- prepareRC4Key(key, 0, keySize);
- }
-
- public void setHashKey(int number, int generation) {
- md5.reset(); //added by ujihara
- extra[0] = (byte)number;
- extra[1] = (byte)(number >> 8);
- extra[2] = (byte)(number >> 16);
- extra[3] = (byte)generation;
- extra[4] = (byte)(generation >> 8);
- md5.update(mkey);
- key = md5.digest(extra);
- keySize = mkey.length + 5;
- if (keySize > 16)
- keySize = 16;
- }
-
- public static PdfObject createInfoId(byte id[]) {
- ByteBuffer buf = new ByteBuffer(90);
- buf.append('[').append('<');
- for (int k = 0; k < 16; ++k)
- buf.appendHex(id[k]);
- buf.append('>').append('<');
- for (int k = 0; k < 16; ++k)
- buf.appendHex(id[k]);
- buf.append('>').append(']');
- return new PdfLiteral(buf.toByteArray());
- }
-
- public PdfDictionary getEncryptionDictionary() {
- PdfDictionary dic = new PdfDictionary();
- dic.put(PdfName.FILTER, PdfName.STANDARD);
- dic.put(PdfName.O, new PdfLiteral(PdfContentByte.escapeString(ownerKey)));
- dic.put(PdfName.U, new PdfLiteral(PdfContentByte.escapeString(userKey)));
- dic.put(PdfName.P, new PdfNumber(permissions));
- if (mkey.length > 5) {
- dic.put(PdfName.V, new PdfNumber(2));
- dic.put(PdfName.R, new PdfNumber(3));
- dic.put(PdfName.LENGTH, new PdfNumber(128));
- }
- else {
- dic.put(PdfName.V, new PdfNumber(1));
- dic.put(PdfName.R, new PdfNumber(2));
- }
- return dic;
- }
-
- public void prepareRC4Key(byte key[]) {
- prepareRC4Key(key, 0, key.length);
- }
-
- public void prepareRC4Key(byte key[], int off, int len) {
- int index1 = 0;
- int index2 = 0;
- for (int k = 0; k < 256; ++k)
- state[k] = (byte)k;
- x = 0;
- y = 0;
- byte tmp;
- for (int k = 0; k < 256; ++k) {
- index2 = (key[index1 + off] + state[k] + index2) & 255;
- tmp = state[k];
- state[k] = state[index2];
- state[index2] = tmp;
- index1 = (index1 + 1) % len;
- }
- }
-
- public void encryptRC4(byte dataIn[], int off, int len, byte dataOut[]) {
- int length = len + off;
- byte tmp;
- for (int k = off; k < length; ++k) {
- x = (x + 1) & 255;
- y = (state[x] + y) & 255;
- tmp = state[x];
- state[x] = state[y];
- state[y] = tmp;
- dataOut[k] = (byte)(dataIn[k] ^ state[(state[x] + state[y]) & 255]);
- }
- }
-
- public void encryptRC4(byte data[], int off, int len) {
- encryptRC4(data, off, len, data);
- }
-
- public void encryptRC4(byte dataIn[], byte dataOut[]) {
- encryptRC4(dataIn, 0, dataIn.length, dataOut);
- }
-
- public void encryptRC4(byte data[]) {
- encryptRC4(data, 0, data.length, data);
- }
-
- public PdfObject getFileID() {
- return createInfoId(documentID);
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfEncryptionStream.java b/LibrarySource/com/lowagie/text/pdf/PdfEncryptionStream.java
deleted file mode 100644
index 30c2be4..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfEncryptionStream.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * $Id: PdfEncryptionStream.java,v 1.3 2005/02/17 09:20:54 blowagie Exp $
- * $Name: $
- *
- * Copyright 2004 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999-2005 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000-2005 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.FilterOutputStream;
-import java.io.OutputStream;
-import java.io.IOException;
-
-public class PdfEncryptionStream extends FilterOutputStream {
-
- protected PdfEncryption enc;
- private byte buf[] = new byte[1];
-
- public PdfEncryptionStream(OutputStream out, PdfEncryption enc) {
- super(out);
- this.enc = enc;
- }
-
- public void write(byte[] b, int off, int len) throws IOException {
- if ((off | len | (b.length - (len + off)) | (off + len)) < 0)
- throw new IndexOutOfBoundsException();
- enc.encryptRC4(b, off, len);
- out.write(b, off, len);
- }
-
- public void close() throws IOException {
- }
-
- public void write(int b) throws IOException {
- buf[0] = (byte)b;
- write(buf);
- }
-
- public void flush() throws IOException {
- }
-
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfException.java b/LibrarySource/com/lowagie/text/pdf/PdfException.java
deleted file mode 100644
index 6fa0581..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfException.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * $Id: PdfException.java,v 1.22 2002/06/20 13:30:25 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.DocumentException;
-
-/**
- * Signals that an unspecified problem while constructing a PDF document.
- *
- * @see BadPdfFormatException
- */
-
-public class PdfException extends DocumentException {
-
- // constructors
-
- public PdfException(Exception ex) {
- super(ex);
- }
-
- /**
- * Constructs a <CODE>PdfException</CODE> whithout a message.
- */
-
- PdfException() {
- super();
- }
-
-/**
- * Constructs a <code>PdfException</code> with a message.
- *
- * @param message a message describing the exception
- */
-
- PdfException(String message) {
- super(message);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfFileSpecification.java b/LibrarySource/com/lowagie/text/pdf/PdfFileSpecification.java
deleted file mode 100644
index c951df9..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfFileSpecification.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright 2003 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.*;
-import java.net.URL;
-/** Specifies a file or an URL. The file can be extern or embedded.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class PdfFileSpecification extends PdfDictionary {
- protected PdfWriter writer;
- protected PdfIndirectReference ref;
-
- /** Creates a new instance of PdfFileSpecification. The static methods are preferred. */
- public PdfFileSpecification() {
- super(PdfName.FILESPEC);
- }
-
- /**
- * Creates a file specification of type URL.
- * @param writer the <CODE>PdfWriter</CODE>
- * @param url the URL
- * @return the file specification
- */
- public static PdfFileSpecification url(PdfWriter writer, String url) {
- PdfFileSpecification fs = new PdfFileSpecification();
- fs.writer = writer;
- fs.put(PdfName.FS, PdfName.URL);
- fs.put(PdfName.F, new PdfString(url));
- return fs;
- }
-
- /**
- * Creates a file specification with the file embedded. The file may
- * come from the file system or from a byte array. The data is flate compressed.
- * @param writer the <CODE>PdfWriter</CODE>
- * @param filePath the file path
- * @param fileDisplay the file information that is presented to the user
- * @param fileStore the byte array with the file. If it is not <CODE>null</CODE>
- * it takes precedence over <CODE>filePath</CODE>
- * @throws IOException on error
- * @return the file specification
- */
- public static PdfFileSpecification fileEmbedded(PdfWriter writer, String filePath, String fileDisplay, byte fileStore[]) throws IOException {
- return fileEmbedded(writer, filePath, fileDisplay, fileStore, true);
- }
-
-
- /**
- * Creates a file specification with the file embedded. The file may
- * come from the file system or from a byte array.
- * @param writer the <CODE>PdfWriter</CODE>
- * @param filePath the file path
- * @param fileDisplay the file information that is presented to the user
- * @param fileStore the byte array with the file. If it is not <CODE>null</CODE>
- * it takes precedence over <CODE>filePath</CODE>
- * @param compress sets the compression on the data. Multimedia content will benefit little
- * from compression
- * @throws IOException on error
- * @return the file specification
- */
- public static PdfFileSpecification fileEmbedded(PdfWriter writer, String filePath, String fileDisplay, byte fileStore[], boolean compress) throws IOException {
- PdfFileSpecification fs = new PdfFileSpecification();
- fs.writer = writer;
- fs.put(PdfName.F, new PdfString(fileDisplay));
- PdfStream stream;
- InputStream in = null;
- PdfIndirectReference ref;
- try {
- if (fileStore == null) {
- File file = new File(filePath);
- if (file.canRead()) {
- in = new FileInputStream(filePath);
- }
- else {
- if (filePath.startsWith("file:/") || filePath.startsWith("http://") || filePath.startsWith("https://") || filePath.startsWith("jar:")) {
- in = new URL(filePath).openStream();
- }
- else {
- in = BaseFont.getResourceStream(filePath);
- if (in == null)
- throw new IOException(filePath + " not found as file or resource.");
- }
- }
- stream = new PdfStream(in, writer);
- }
- else
- stream = new PdfStream(fileStore);
- stream.put(PdfName.TYPE, PdfName.EMBEDDEDFILE);
- if (compress)
- stream.flateCompress();
- ref = writer.addToBody(stream).getIndirectReference();
- if (fileStore == null) {
- stream.writeLength();
- }
- }
- finally {
- if (in != null)
- try{in.close();}catch(Exception e){}
- }
- PdfDictionary f = new PdfDictionary();
- f.put(PdfName.F, ref);
- fs.put(PdfName.EF, f);
- return fs;
- }
-
- /**
- * Creates a file specification for an external file.
- * @param writer the <CODE>PdfWriter</CODE>
- * @param filePath the file path
- * @return the file specification
- */
- public static PdfFileSpecification fileExtern(PdfWriter writer, String filePath) {
- PdfFileSpecification fs = new PdfFileSpecification();
- fs.writer = writer;
- fs.put(PdfName.F, new PdfString(filePath));
- return fs;
- }
-
- /**
- * Gets the indirect reference to this file specification.
- * Multiple invocations will retrieve the same value.
- * @throws IOException on error
- * @return the indirect reference
- */
- public PdfIndirectReference getReference() throws IOException {
- if (ref != null)
- return ref;
- ref = writer.addToBody(this).getIndirectReference();
- return ref;
- }
-
- /**
- * Sets the file name (the key /F) string as an hex representation
- * to support multi byte file names. The name must heve th slash and
- * backslash escaped according to the file specification rules
- * @param fileName the file name as a byte array
- */
- public void setMultiByteFileName(byte fileName[]) {
- put(PdfName.F, new PdfString(fileName).setHexWriting(true));
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfFont.java b/LibrarySource/com/lowagie/text/pdf/PdfFont.java
deleted file mode 100644
index 298f8c7..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfFont.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * $Id: PdfFont.java,v 1.30 2002/07/09 11:28:23 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.Image;
-import com.lowagie.text.ExceptionConverter;
-
-/**
- * <CODE>PdfFont</CODE> is the Pdf Font object.
- * <P>
- * Limitation: in this class only base 14 Type 1 fonts (courier, courier bold, courier oblique,
- * courier boldoblique, helvetica, helvetica bold, helvetica oblique, helvetica boldoblique,
- * symbol, times roman, times bold, times italic, times bolditalic, zapfdingbats) and their
- * standard encoding (standard, MacRoman, (MacExpert,) WinAnsi) are supported.<BR>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 7.7 (page 198-203).
- *
- * @see PdfName
- * @see PdfDictionary
- * @see BadPdfFormatException
- */
-
-class PdfFont implements Comparable {
-
-
- /** the font metrics. */
- private BaseFont font;
-
- /** the size. */
- private float size;
-
- /** an image. */
- protected Image image;
-
- protected float hScale = 1;
-
- // constructors
-
- PdfFont(BaseFont bf, float size) {
- this.size = size;
- font = bf;
- }
-
- // methods
-
- /**
- * Compares this <CODE>PdfFont</CODE> with another
- *
- * @param object the other <CODE>PdfFont</CODE>
- * @return a value
- */
-
- public int compareTo(Object object) {
- if (image != null)
- return 0;
- if (object == null) {
- return -1;
- }
- PdfFont pdfFont;
- try {
- pdfFont = (PdfFont) object;
- if (font != pdfFont.font) {
- return 1;
- }
- if (this.size() != pdfFont.size()) {
- return 2;
- }
- return 0;
- }
- catch(ClassCastException cce) {
- return -2;
- }
- }
-
- /**
- * Returns the size of this font.
- *
- * @return a size
- */
-
- float size() {
- if (image == null)
- return size;
- else {
- return image.scaledHeight();
- }
- }
-
- /**
- * Returns the approximative width of 1 character of this font.
- *
- * @return a width in Text Space
- */
-
- float width() {
- return width(' ');
- }
-
- /**
- * Returns the width of a certain character of this font.
- *
- * @param character a certain character
- * @return a width in Text Space
- */
-
- float width(char character) {
- if (image == null)
- return font.getWidthPoint(character, size) * hScale;
- else
- return image.scaledWidth();
- }
-
- float width(String s) {
- if (image == null)
- return font.getWidthPoint(s, size) * hScale;
- else
- return image.scaledWidth();
- }
-
- BaseFont getFont() {
- return font;
- }
-
- void setImage(Image image) {
- this.image = image;
- }
-
- static PdfFont getDefaultFont() {
- try {
- BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, false);
- return new PdfFont(bf, 12);
- }
- catch (Exception ee) {
- throw new ExceptionConverter(ee);
- }
- }
- void setHorizontalScaling(float hScale) {
- this.hScale = hScale;
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfFormField.java b/LibrarySource/com/lowagie/text/pdf/PdfFormField.java
deleted file mode 100644
index b552ee8..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfFormField.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Copyright 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- *
- * Mesquite specific changes/deletions copyright 2005 Peter E. Midford
- * peteremidford at yahoo.com. Mesquite itself is copyright 1997-2005 by W. and D.
- * Maddison and licensed under the LGPL.
- *
- */
-
-package com.lowagie.text.pdf;
-import com.lowagie.text.Rectangle;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-/** Implements form fields.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class PdfFormField extends PdfAnnotation {
-
- public static final int FF_READ_ONLY = 1;
- public static final int FF_REQUIRED = 2;
- public static final int FF_NO_EXPORT = 4;
- public static final int FF_NO_TOGGLE_TO_OFF = 16384;
- public static final int FF_RADIO = 32768;
- public static final int FF_PUSHBUTTON = 65536;
- public static final int FF_MULTILINE = 4096;
- public static final int FF_PASSWORD = 8192;
- public static final int FF_COMBO = 131072;
- public static final int FF_EDIT = 262144;
- public static final int FF_FILESELECT = 1048576;
- public static final int FF_MULTISELECT = 2097152;
- public static final int FF_DONOTSPELLCHECK = 4194304;
- public static final int FF_DONOTSCROLL = 8388608;
- public static final int FF_COMB = 16777216;
- public static final int FF_RADIOSINUNISON = 1 << 25;
- public static final int Q_LEFT = 0;
- public static final int Q_CENTER = 1;
- public static final int Q_RIGHT = 2;
- public static final int MK_NO_ICON = 0;
- public static final int MK_NO_CAPTION = 1;
- public static final int MK_CAPTION_BELOW = 2;
- public static final int MK_CAPTION_ABOVE = 3;
- public static final int MK_CAPTION_RIGHT = 4;
- public static final int MK_CAPTION_LEFT = 5;
- public static final int MK_CAPTION_OVERLAID = 6;
- public static final PdfName IF_SCALE_ALWAYS = PdfName.A;
- public static final PdfName IF_SCALE_BIGGER = PdfName.B;
- public static final PdfName IF_SCALE_SMALLER = PdfName.S;
- public static final PdfName IF_SCALE_NEVER = PdfName.N;
- public static final PdfName IF_SCALE_ANAMORPHIC = PdfName.A;
- public static final PdfName IF_SCALE_PROPORTIONAL = PdfName.P;
- public static final boolean MULTILINE = true;
- public static final boolean SINGLELINE = false;
- public static final boolean PLAINTEXT = false;
- public static final boolean PASSWORD = true;
- static PdfName mergeTarget[] = {PdfName.FONT, PdfName.XOBJECT, PdfName.COLORSPACE, PdfName.PATTERN};
-
- /** Holds value of property parent. */
- protected PdfFormField parent;
-
- protected ArrayList kids;
-
-/**
- * Constructs a new <CODE>PdfAnnotation</CODE> of subtype link (Action).
- */
-
- public PdfFormField(PdfWriter writer, float llx, float lly, float urx, float ury, PdfAction action) {
- super(writer, llx, lly, urx, ury, action);
- put(PdfName.TYPE, PdfName.ANNOT);
- put(PdfName.SUBTYPE, PdfName.WIDGET);
- annotation = true;
- }
-
- /** Creates new PdfFormField */
- protected PdfFormField(PdfWriter writer) {
- super(writer, null);
- form = true;
- annotation = false;
- }
-
- public void setWidget(Rectangle rect, PdfName highlight) {
- put(PdfName.TYPE, PdfName.ANNOT);
- put(PdfName.SUBTYPE, PdfName.WIDGET);
- put(PdfName.RECT, new PdfRectangle(rect));
- annotation = true;
- if (highlight != null && !highlight.equals(HIGHLIGHT_INVERT))
- put(PdfName.H, highlight);
- }
-
- public static PdfFormField createEmpty(PdfWriter writer) {
- PdfFormField field = new PdfFormField(writer);
- return field;
- }
-
- public void setButton(int flags) {
- put(PdfName.FT, PdfName.BTN);
- if (flags != 0)
- put(PdfName.FF, new PdfNumber(flags));
- }
-
- protected static PdfFormField createButton(PdfWriter writer, int flags) {
- PdfFormField field = new PdfFormField(writer);
- field.setButton(flags);
- return field;
- }
-
- public static PdfFormField createPushButton(PdfWriter writer) {
- return createButton(writer, FF_PUSHBUTTON);
- }
-
- public static PdfFormField createCheckBox(PdfWriter writer) {
- return createButton(writer, 0);
- }
-
- public static PdfFormField createRadioButton(PdfWriter writer, boolean noToggleToOff) {
- return createButton(writer, FF_RADIO + (noToggleToOff ? FF_NO_TOGGLE_TO_OFF : 0));
- }
-
- public static PdfFormField createTextField(PdfWriter writer, boolean multiline, boolean password, int maxLen) {
- PdfFormField field = new PdfFormField(writer);
- field.put(PdfName.FT, PdfName.TX);
- int flags = (multiline ? FF_MULTILINE : 0);
- flags += (password ? FF_PASSWORD : 0);
- field.put(PdfName.FF, new PdfNumber(flags));
- if (maxLen > 0)
- field.put(PdfName.MAXLEN, new PdfNumber(maxLen));
- return field;
- }
-
- protected static PdfFormField createChoice(PdfWriter writer, int flags, PdfArray options, int topIndex) {
- PdfFormField field = new PdfFormField(writer);
- field.put(PdfName.FT, PdfName.CH);
- field.put(PdfName.FF, new PdfNumber(flags));
- field.put(PdfName.OPT, options);
- if (topIndex > 0)
- field.put(PdfName.TI, new PdfNumber(topIndex));
- return field;
- }
-
- public static PdfFormField createList(PdfWriter writer, String options[], int topIndex) {
- return createChoice(writer, 0, processOptions(options), topIndex);
- }
-
- public static PdfFormField createList(PdfWriter writer, String options[][], int topIndex) {
- return createChoice(writer, 0, processOptions(options), topIndex);
- }
-
- public static PdfFormField createCombo(PdfWriter writer, boolean edit, String options[], int topIndex) {
- return createChoice(writer, FF_COMBO + (edit ? FF_EDIT : 0), processOptions(options), topIndex);
- }
-
- public static PdfFormField createCombo(PdfWriter writer, boolean edit, String options[][], int topIndex) {
- return createChoice(writer, FF_COMBO + (edit ? FF_EDIT : 0), processOptions(options), topIndex);
- }
-
- protected static PdfArray processOptions(String options[]) {
- PdfArray array = new PdfArray();
- for (int k = 0; k < options.length; ++k) {
- array.add(new PdfString(options[k], PdfObject.TEXT_UNICODE));
- }
- return array;
- }
-
- protected static PdfArray processOptions(String options[][]) {
- PdfArray array = new PdfArray();
- for (int k = 0; k < options.length; ++k) {
- String subOption[] = options[k];
- PdfArray ar2 = new PdfArray(new PdfString(subOption[0], PdfObject.TEXT_UNICODE));
- ar2.add(new PdfString(subOption[1], PdfObject.TEXT_UNICODE));
- array.add(ar2);
- }
- return array;
- }
-
- public static PdfFormField createSignature(PdfWriter writer) {
- PdfFormField field = new PdfFormField(writer);
- field.put(PdfName.FT, PdfName.SIG);
- return field;
- }
-
- /** Getter for property parent.
- * @return Value of property parent.
- */
- public PdfFormField getParent() {
- return parent;
- }
-
- public void addKid(PdfFormField field) {
- field.parent = this;
- if (kids == null)
- kids = new ArrayList();
- kids.add(field);
- }
-
- ArrayList getKids() {
- return kids;
- }
-
- public int setFieldFlags(int flags) {
- PdfNumber obj = (PdfNumber)get(PdfName.FF);
- int old;
- if (obj == null)
- old = 0;
- else
- old = obj.intValue();
- int v = old | flags;
- put(PdfName.FF, new PdfNumber(v));
- return old;
- }
-
- public void setValueAsString(String s) {
- put(PdfName.V, new PdfString(s, PdfObject.TEXT_UNICODE));
- }
-
- public void setValueAsName(String s) {
- put(PdfName.V, new PdfName(s));
- }
-
- // Removed for mesquite support 25 September 2005 P. E. Midford
-// public void setValue(PdfSignature sig) {
-// put(PdfName.V, sig);
-// }
-
- public void setDefaultValueAsString(String s) {
- put(PdfName.DV, new PdfString(s, PdfObject.TEXT_UNICODE));
- }
-
- public void setDefaultValueAsName(String s) {
- put(PdfName.DV, new PdfName(s));
- }
-
- public void setFieldName(String s) {
- put(PdfName.T, new PdfString(s, PdfObject.TEXT_UNICODE));
- }
-
- public void setUserName(String s) {
- put(PdfName.TU, new PdfString(s, PdfObject.TEXT_UNICODE));
- }
-
- public void setMappingName(String s) {
- put(PdfName.TM, new PdfString(s, PdfObject.TEXT_UNICODE));
- }
-
- public void setQuadding(int v) {
- put(PdfName.Q, new PdfNumber(v));
- }
-
- static void mergeResources(PdfDictionary result, PdfDictionary source, Object writer) {
- PdfDictionary dic = null;
- PdfDictionary res = null;
- PdfName target = null;
- for (int k = 0; k < mergeTarget.length; ++k) {
- target = mergeTarget[k];
- PdfDictionary pdfDict = (PdfDictionary)PdfReader.getPdfObject(source.get(target));
- if ((dic = pdfDict) != null) {
- if ((res = (PdfDictionary)PdfReader.getPdfObject(result.get(target), result)) == null) {
- res = new PdfDictionary();
- }
- res.mergeDifferent(dic);
- result.put(target, res);
- // if (writer != null)
- // writer.markUsed(res);
- }
- }
- }
-
- static void mergeResources(PdfDictionary result, PdfDictionary source) {
- mergeResources(result, source, null);
- }
-
- void setUsed() {
- used = true;
- if (parent != null)
- put(PdfName.PARENT, parent.getIndirectReference());
- if (kids != null) {
- PdfArray array = new PdfArray();
- for (int k = 0; k < kids.size(); ++k)
- array.add(((PdfFormField)kids.get(k)).getIndirectReference());
- put(PdfName.KIDS, array);
- }
- if (templates == null)
- return;
- PdfDictionary dic = new PdfDictionary();
- for (Iterator it = templates.keySet().iterator(); it.hasNext();) {
- PdfTemplate template = (PdfTemplate)it.next();
- mergeResources(dic, (PdfDictionary)template.getResources());
- }
- put(PdfName.DR, dic);
- }
-
- public static PdfAnnotation shallowDuplicate(PdfAnnotation annot) {
- PdfAnnotation dup;
- if (annot.isForm()) {
- dup = new PdfFormField(annot.writer);
- PdfFormField dupField = (PdfFormField)dup;
- PdfFormField srcField = (PdfFormField)annot;
- dupField.parent = srcField.parent;
- dupField.kids = srcField.kids;
- }
- else
- dup = new PdfAnnotation(annot.writer, null);
- dup.merge(annot);
- dup.form = annot.form;
- dup.annotation = annot.annotation;
- dup.templates = annot.templates;
- return dup;
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfFormXObject.java b/LibrarySource/com/lowagie/text/pdf/PdfFormXObject.java
deleted file mode 100644
index a05a946..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfFormXObject.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * $Id: PdfFormXObject.java,v 1.25 2002/07/09 11:28:23 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.ExceptionConverter;
-/**
- * <CODE>PdfFormObject</CODE> is a type of XObject containing a template-object.
- */
-
-public class PdfFormXObject extends PdfStream {
-
- // public static final variables
-
-/** This is a PdfNumber representing 0. */
- public static final PdfNumber ZERO = new PdfNumber(0);
-
-/** This is a PdfNumber representing 1. */
- public static final PdfNumber ONE = new PdfNumber(1);
-
-/** This is the 1 - matrix. */
- public static final PdfLiteral MATRIX = new PdfLiteral("[1 0 0 1 0 0]");
-
- // membervariables
-
-
- // constructor
-
-/**
- * Constructs a <CODE>PdfFormXObject</CODE>-object.
- *
- * @param template the template
- */
-
- PdfFormXObject(PdfTemplate template) // throws BadPdfFormatException
- {
- super();
- put(PdfName.TYPE, PdfName.XOBJECT);
- put(PdfName.SUBTYPE, PdfName.FORM);
- put(PdfName.RESOURCES, template.getResources());
- put(PdfName.BBOX, new PdfRectangle(template.getBoundingBox()));
- put(PdfName.FORMTYPE, ONE);
- if (template.getLayer() != null)
- put(PdfName.OC, template.getLayer().getRef());
- if (template.getGroup() != null)
- put(PdfName.GROUP, template.getGroup());
- PdfArray matrix = template.getMatrix();
- if (matrix == null)
- put(PdfName.MATRIX, MATRIX);
- else
- put(PdfName.MATRIX, matrix);
- bytes = template.toPdf(null);
- put(PdfName.LENGTH, new PdfNumber(bytes.length));
- flateCompress();
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfFunction.java b/LibrarySource/com/lowagie/text/pdf/PdfFunction.java
deleted file mode 100644
index 5956801..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfFunction.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.ExceptionConverter;
-import java.io.IOException;
-/** Implements PDF functions.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class PdfFunction {
-
- protected PdfWriter writer;
-
- protected PdfIndirectReference reference;
-
- protected PdfDictionary dictionary;
-
- /** Creates new PdfFunction */
- protected PdfFunction(PdfWriter writer) {
- this.writer = writer;
- }
-
- PdfIndirectReference getReference() {
- try {
- if (reference == null) {
- reference = writer.addToBody(dictionary).getIndirectReference();
- }
- }
- catch (IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- return reference;
- }
-
- public static PdfFunction type0(PdfWriter writer, float domain[], float range[], int size[],
- int bitsPerSample, int order, float encode[], float decode[], byte stream[]) {
- PdfFunction func = new PdfFunction(writer);
- func.dictionary = new PdfStream(stream);
- ((PdfStream)func.dictionary).flateCompress();
- func.dictionary.put(PdfName.FUNCTIONTYPE, new PdfNumber(0));
- func.dictionary.put(PdfName.DOMAIN, new PdfArray(domain));
- func.dictionary.put(PdfName.RANGE, new PdfArray(range));
- func.dictionary.put(PdfName.SIZE, new PdfArray(size));
- func.dictionary.put(PdfName.BITSPERSAMPLE, new PdfNumber(bitsPerSample));
- if (order != 1)
- func.dictionary.put(PdfName.ORDER, new PdfNumber(order));
- if (encode != null)
- func.dictionary.put(PdfName.ENCODE, new PdfArray(encode));
- if (decode != null)
- func.dictionary.put(PdfName.DECODE, new PdfArray(decode));
- return func;
- }
-
- public static PdfFunction type2(PdfWriter writer, float domain[], float range[], float c0[], float c1[], float n) {
- PdfFunction func = new PdfFunction(writer);
- func.dictionary = new PdfDictionary();
- func.dictionary.put(PdfName.FUNCTIONTYPE, new PdfNumber(2));
- func.dictionary.put(PdfName.DOMAIN, new PdfArray(domain));
- if (range != null)
- func.dictionary.put(PdfName.RANGE, new PdfArray(range));
- if (c0 != null)
- func.dictionary.put(PdfName.C0, new PdfArray(c0));
- if (c1 != null)
- func.dictionary.put(PdfName.C1, new PdfArray(c1));
- func.dictionary.put(PdfName.N, new PdfNumber(n));
- return func;
- }
-
- public static PdfFunction type3(PdfWriter writer, float domain[], float range[], PdfFunction functions[], float bounds[], float encode[]) {
- PdfFunction func = new PdfFunction(writer);
- func.dictionary = new PdfDictionary();
- func.dictionary.put(PdfName.FUNCTIONTYPE, new PdfNumber(3));
- func.dictionary.put(PdfName.DOMAIN, new PdfArray(domain));
- if (range != null)
- func.dictionary.put(PdfName.RANGE, new PdfArray(range));
- PdfArray array = new PdfArray();
- for (int k = 0; k < functions.length; ++k)
- array.add(functions[k].getReference());
- func.dictionary.put(PdfName.FUNCTIONS, array);
- func.dictionary.put(PdfName.BOUNDS, new PdfArray(bounds));
- func.dictionary.put(PdfName.ENCODE, new PdfArray(encode));
- return func;
- }
-
- public static PdfFunction type4(PdfWriter writer, float domain[], float range[], String postscript) {
- byte b[] = new byte[postscript.length()];
- for (int k = 0; k < b.length; ++k)
- b[k] = (byte)postscript.charAt(k);
- PdfFunction func = new PdfFunction(writer);
- func.dictionary = new PdfStream(b);
- ((PdfStream)func.dictionary).flateCompress();
- func.dictionary.put(PdfName.FUNCTIONTYPE, new PdfNumber(4));
- func.dictionary.put(PdfName.DOMAIN, new PdfArray(domain));
- func.dictionary.put(PdfName.RANGE, new PdfArray(range));
- return func;
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfGState.java b/LibrarySource/com/lowagie/text/pdf/PdfGState.java
deleted file mode 100644
index fe629aa..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfGState.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright 2003 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-/** The graphic state dictionary.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class PdfGState extends PdfDictionary {
- /** A possible blend mode */
- public static final PdfName BM_NORMAL = new PdfName("Normal");
- /** A possible blend mode */
- public static final PdfName BM_COMPATIBLE = new PdfName("Compatible");
- /** A possible blend mode */
- public static final PdfName BM_MULTIPLY = new PdfName("Multiply");
- /** A possible blend mode */
- public static final PdfName BM_SCREEN = new PdfName("Screen");
- /** A possible blend mode */
- public static final PdfName BM_OVERLAY = new PdfName("Overlay");
- /** A possible blend mode */
- public static final PdfName BM_DARKEN = new PdfName("Darken");
- /** A possible blend mode */
- public static final PdfName BM_LIGHTEN = new PdfName("Lighten");
- /** A possible blend mode */
- public static final PdfName BM_COLORDODGE = new PdfName("ColorDodge");
- /** A possible blend mode */
- public static final PdfName BM_COLORBURN = new PdfName("ColorBurn");
- /** A possible blend mode */
- public static final PdfName BM_HARDLIGHT = new PdfName("HardLight");
- /** A possible blend mode */
- public static final PdfName BM_SOFTLIGHT = new PdfName("SoftLight");
- /** A possible blend mode */
- public static final PdfName BM_DIFFERENCE = new PdfName("Difference");
- /** A possible blend mode */
- public static final PdfName BM_EXCLUSION = new PdfName("Exclusion");
-
- /**
- * Sets the flag whether to apply overprint for stroking.
- * @param ov
- */
- public void setOverPrintStroking(boolean ov) {
- put(PdfName.OP, ov ? PdfBoolean.PDFTRUE : PdfBoolean.PDFFALSE);
- }
-
- /**
- * Sets the flag whether to apply overprint for non stroking painting operations.
- * @param ov
- */
- public void setOverPrintNonStroking(boolean ov) {
- put(PdfName.op, ov ? PdfBoolean.PDFTRUE : PdfBoolean.PDFFALSE);
- }
-
- /**
- * Sets the current stroking alpha constant, specifying the constant shape or
- * constant opacity value to be used for stroking operations in the transparent
- * imaging model.
- * @param n
- */
- public void setStrokeOpacity(float n) {
- put(PdfName.CA, new PdfNumber(n));
- }
-
- /**
- * Sets the current stroking alpha constant, specifying the constant shape or
- * constant opacity value to be used for nonstroking operations in the transparent
- * imaging model.
- * @param n
- */
- public void setFillOpacity(float n) {
- put(PdfName.ca, new PdfNumber(n));
- }
-
- /**
- * The alpha source flag specifying whether the current soft mask
- * and alpha constant are to be interpreted as shape values (true)
- * or opacity values (false).
- * @param v
- */
- public void setAlphaIsShape(boolean v) {
- put(PdfName.AIS, v ? PdfBoolean.PDFTRUE : PdfBoolean.PDFFALSE);
- }
-
- /**
- * Determines the behaviour of overlapping glyphs within a text object
- * in the transparent imaging model.
- * @param v
- */
- public void setTextKnockout(boolean v) {
- put(PdfName.TK, v ? PdfBoolean.PDFTRUE : PdfBoolean.PDFFALSE);
- }
-
- /**
- * The current blend mode to be used in the transparent imaging model.
- * @param bm
- */
- public void setBlendMode(PdfName bm) {
- put(PdfName.BM, bm);
- }
-
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfGraphics2D.java b/LibrarySource/com/lowagie/text/pdf/PdfGraphics2D.java
deleted file mode 100644
index ed25e2b..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfGraphics2D.java
+++ /dev/null
@@ -1,1423 +0,0 @@
-/*
- * Copyright 2002 by Jim Moore <jim at scolamoore.com>.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import headless.awt.BasicStroke;
-import headless.awt.Color;
-import headless.awt.Component;
-import headless.awt.Composite;
-import headless.awt.Font;
-import headless.awt.FontMetrics;
-import headless.awt.Graphics;
-import headless.awt.Graphics2D;
-import headless.awt.GraphicsConfiguration;
-import headless.awt.Image;
-import headless.awt.Paint;
-import headless.awt.GradientPaint;
-import headless.awt.TexturePaint;
-import headless.awt.MediaTracker;
-import headless.awt.Polygon;
-import headless.awt.Rectangle;
-import headless.awt.RenderingHints;
-import headless.awt.Shape;
-import headless.awt.Stroke;
-import headless.awt.Transparency;
-import headless.awt.font.FontRenderContext;
-import headless.awt.font.GlyphVector;
-import headless.awt.font.TextLayout;
-import headless.awt.geom.AffineTransform;
-import headless.awt.geom.Arc2D;
-import headless.awt.geom.Area;
-import headless.awt.geom.Ellipse2D;
-import headless.awt.geom.Line2D;
-import headless.awt.geom.PathIterator;
-import headless.awt.geom.Rectangle2D;
-import headless.awt.geom.RoundRectangle2D;
-import headless.awt.image.BufferedImage;
-import headless.awt.image.BufferedImageOp;
-import headless.awt.image.ColorModel;
-import headless.awt.image.ImageObserver;
-import headless.awt.image.RenderedImage;
-import headless.awt.image.WritableRaster;
-import headless.awt.image.renderable.RenderableImage;
-import headless.awt.RenderingHints.Key;
-import headless.awt.geom.NoninvertibleTransformException;
-import headless.awt.geom.Point2D;
-import java.text.CharacterIterator;
-import java.text.AttributedCharacterIterator;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.ArrayList;
-import java.io.ByteArrayOutputStream;
-//
-import java.util.Set;
-import java.util.Iterator;
-import headless.awt.font.TextAttribute;
-
-public class PdfGraphics2D extends Graphics2D {
-
- private static final int FILL = 1;
- private static final int STROKE = 2;
- private static final int CLIP = 3;
- private BasicStroke strokeOne = new BasicStroke(1);
-
- private static AffineTransform IDENTITY = new AffineTransform();
-
- private Font font;
- private BaseFont baseFont;
- private float fontSize;
- private AffineTransform transform;
- private Paint paint;
- private Color background;
- private float width;
- private float height;
-
- private Area clip;
-
- private RenderingHints rhints = new RenderingHints(null);
-
- private Stroke stroke;
- private Stroke originalStroke;
-
- private PdfContentByte cb;
-
- /** Storage for BaseFont objects created. */
- private HashMap baseFonts;
-
- private boolean disposeCalled = false;
-
- private FontMapper fontMapper;
-
- private ArrayList kids;
-
- private boolean kid = false;
-
- private Graphics dg2 = new BufferedImage(2, 2, BufferedImage.TYPE_INT_RGB).getGraphics();
-
- private boolean onlyShapes = false;
-
- private Stroke oldStroke;
- private Paint paintFill;
- private Paint paintStroke;
-
- private MediaTracker mediaTracker;
-
- // Added by Jurij Bilas
- protected boolean underline; // indicates if the font style is underlined
-
- protected PdfGState fillGState[] = new PdfGState[256];
- protected PdfGState strokeGState[] = new PdfGState[256];
- protected int currentFillGState = 255;
- protected int currentStrokeGState = 255;
-
- public static int AFM_DIVISOR = 1000; // used to calculate coordinates
-
- private boolean convertImagesToJPEG = false;
- private float jpegQuality = .95f;
-
- private PdfGraphics2D() {
- }
-
- /**
- * Constructor for PDFGraphics2D.
- *
- */
- PdfGraphics2D(PdfContentByte cb, float width, float height, FontMapper fontMapper, boolean onlyShapes, boolean convertImagesToJPEG, float quality) {
- super();
- try {
- Class.forName("com.sun.image.codec.jpeg.JPEGCodec");
- }
- catch (Throwable t) {
- convertImagesToJPEG = false;
- }
- this.convertImagesToJPEG = convertImagesToJPEG;
- this.jpegQuality = quality;
- this.onlyShapes = onlyShapes;
- this.transform = new AffineTransform();
- this.baseFonts = new HashMap();
- if (!onlyShapes) {
- this.fontMapper = fontMapper;
- if (this.fontMapper == null)
- this.fontMapper = new DefaultFontMapper();
- }
- this.kids = new ArrayList();
- paint = Color.black;
- background = Color.white;
- setFont(new Font("sanserif", Font.PLAIN, 12));
- this.cb = cb;
- cb.saveState();
- this.width = width;
- this.height = height;
- clip = new Area(new Rectangle2D.Float(0, 0, width, height));
- clip(clip);
- originalStroke = stroke = oldStroke = strokeOne;
- setStrokeDiff(stroke, null);
- cb.saveState();
- }
-
- /**
- * @see Graphics2D#draw(Shape)
- */
- public void draw(Shape s) {
- followPath(s, STROKE);
- }
-
- /**
- * @see Graphics2D#drawImage(Image, AffineTransform, ImageObserver)
- */
- public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) {
- return drawImage(img, null, xform, null, obs);
- }
-
- /**
- * @see Graphics2D#drawImage(BufferedImage, BufferedImageOp, int, int)
- */
- public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) {
- BufferedImage result = op.createCompatibleDestImage(img, img.getColorModel());
- result = op.filter(img, result);
- drawImage(result, x, y, null);
- }
-
- /**
- * @see Graphics2D#drawRenderedImage(RenderedImage, AffineTransform)
- */
- public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
- BufferedImage image = null;
- if (img instanceof BufferedImage) {
- image = (BufferedImage)img;
- } else {
- ColorModel cm = img.getColorModel();
- int width = img.getWidth();
- int height = img.getHeight();
- WritableRaster raster = cm.createCompatibleWritableRaster(width, height);
- boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
- Hashtable properties = new Hashtable();
- String[] keys = img.getPropertyNames();
- if (keys!=null) {
- for (int i = 0; i < keys.length; i++) {
- properties.put(keys[i], img.getProperty(keys[i]));
- }
- }
- BufferedImage result = new BufferedImage(cm, raster, isAlphaPremultiplied, properties);
- img.copyData(raster);
- image=result;
- }
- drawImage(image, xform, null);
- }
-
- /**
- * @see Graphics2D#drawRenderableImage(RenderableImage, AffineTransform)
- */
- public void drawRenderableImage(RenderableImage img, AffineTransform xform) {
- drawRenderedImage(img.createDefaultRendering(), xform);
- }
-
- /**
- * @see Graphics#drawString(String, int, int)
- */
- public void drawString(String s, int x, int y) {
- drawString(s, (float)x, (float)y);
- }
-
- /**
- * Calculates position and/or stroke thickness depending on the font size
- * @param d value to be converted
- * @param i font size
- * @return position and/or stroke thickness depending on the font size
- */
- public static double asPoints(double d, int i) {
- return (d * (double)i) / (double)AFM_DIVISOR;
- }
- /**
- * This routine goes through the attributes and sets the font
- * before calling the actual string drawing routine
- * @param iter
- */
- protected void doAttributes(AttributedCharacterIterator iter) {
- underline = false;
- Set set = iter.getAttributes().keySet();
- for(Iterator iterator = set.iterator(); iterator.hasNext();) {
- TextAttribute textattribute = (TextAttribute)iterator.next();
- if(textattribute.equals(TextAttribute.FONT)) {
- Font font = (Font)iter.getAttributes().get(textattribute);
- setFont(font);
- }
- else if(textattribute.equals(TextAttribute.UNDERLINE)) {
- if(iter.getAttributes().get(textattribute) == TextAttribute.UNDERLINE_ON)
- underline = true;
- }
- else if(textattribute.equals(TextAttribute.SUPERSCRIPT)) {
- /*
- iter.getAttributes().get(textattribute);
- Integer _tmp = TextAttribute.SUPERSCRIPT_SUPER;
- subscript = true;
- */
- }
- else if(textattribute.equals(TextAttribute.SIZE)) {
- Object obj = iter.getAttributes().get(textattribute);
- Font font1 = null;
- if(obj instanceof Integer) {
- int i = ((Integer)obj).intValue();
- font1 = getFont().deriveFont(getFont().getStyle(), i);
- }
- else if(obj instanceof Float) {
- float f = ((Float)obj).floatValue();
- font1 = getFont().deriveFont(getFont().getStyle(), f);
- }
- else {
- //System.out.println("Unknown type for attribute SIZE");
- return;
- }
- setFont(font1);
- }
- else {
- String s = "only FONT/SIZE/UNDERLINE/SUPERSCRIPT supported";
- throw new RuntimeException(s);
- }
- }
- }
-
- /**
- * @see Graphics2D#drawString(String, float, float)
- */
- public void drawString(String s, float x, float y) {
- if (s.length() == 0)
- return;
- setFillPaint();
- if (onlyShapes) {
- TextLayout tl = new TextLayout(s, this.font, new FontRenderContext(new AffineTransform(), false, true));
- tl.draw(this, x, y);
- }
- else {
- AffineTransform at = getTransform();
- AffineTransform at2 = getTransform();
- at2.translate(x, y);
- at2.concatenate(font.getTransform());
- setTransform(at2);
- AffineTransform inverse = this.normalizeMatrix();
- AffineTransform flipper = AffineTransform.getScaleInstance(1,-1);
- inverse.concatenate(flipper);
- double[] mx = new double[6];
- inverse.getMatrix(mx);
- cb.beginText();
- cb.setFontAndSize(baseFont, fontSize);
- cb.setTextMatrix((float)mx[0], (float)mx[1], (float)mx[2], (float)mx[3], (float)mx[4], (float)mx[5]);
- double width = font.deriveFont(IDENTITY).getStringBounds(s, getFontRenderContext()).getWidth();
- if (s.length() > 1) {
- float adv = ((float)width - baseFont.getWidthPoint(s, fontSize)) / (s.length() - 1);
- cb.setCharacterSpacing(adv);
- }
- cb.showText(s);
- if (s.length() > 1) {
- cb.setCharacterSpacing(0);
- }
- cb.endText();
- setTransform(at);
- if(underline)
- {
- // These two are supposed to be taken from the .AFM file
- int UnderlinePosition = -100;
- int UnderlineThickness = 50;
- //
- double d = asPoints((double)UnderlineThickness, (int)fontSize);
- setStroke(new BasicStroke((float)d));
- y = (float)((double)(y) + asPoints((double)(-UnderlineThickness), (int)fontSize));
- Line2D line = new Line2D.Double((double)x, (double)y, (double)(width+x), (double)y);
- draw(line);
- }
- }
- }
-
- /**
- * @see Graphics#drawString(AttributedCharacterIterator, int, int)
- */
- public void drawString(AttributedCharacterIterator iterator, int x, int y) {
- drawString(iterator, (float)x, (float)y);
- }
-
- /**
- * @see Graphics2D#drawString(AttributedCharacterIterator, float, float)
- */
- public void drawString(AttributedCharacterIterator iter, float x, float y) {
-/*
- StringBuffer sb = new StringBuffer();
- for(char c = iter.first(); c != AttributedCharacterIterator.DONE; c = iter.next()) {
- sb.append(c);
- }
- drawString(sb.toString(),x,y);
-*/
- StringBuffer stringbuffer = new StringBuffer(iter.getEndIndex());
- for(char c = iter.first(); c != '\uFFFF'; c = iter.next())
- {
- if(iter.getIndex() == iter.getRunStart())
- {
- if(stringbuffer.length() > 0)
- {
- drawString(stringbuffer.toString(), x, y);
- FontMetrics fontmetrics = getFontMetrics();
- x = (float)((double)x + fontmetrics.getStringBounds(stringbuffer.toString(), this).getWidth());
- stringbuffer.delete(0, stringbuffer.length());
- }
- doAttributes(iter);
- }
- stringbuffer.append(c);
- }
-
- drawString(stringbuffer.toString(), x, y);
- underline = false;
- }
-
- /**
- * @see Graphics2D#drawGlyphVector(GlyphVector, float, float)
- */
- public void drawGlyphVector(GlyphVector g, float x, float y) {
- Shape s = g.getOutline(x, y);
- fill(s);
- }
-
- /**
- * @see Graphics2D#fill(Shape)
- */
- public void fill(Shape s) {
- followPath(s, FILL);
- }
-
- /**
- * @see Graphics2D#hit(Rectangle, Shape, boolean)
- */
- public boolean hit(Rectangle rect, Shape s, boolean onStroke) {
- if (onStroke) {
- s = stroke.createStrokedShape(s);
- }
- s = transform.createTransformedShape(s);
- Area area = new Area(s);
- if (clip != null)
- area.intersect(clip);
- return area.intersects(rect.x, rect.y, rect.width, rect.height);
- }
-
- /**
- * @see Graphics2D#getDeviceConfiguration()
- */
- public GraphicsConfiguration getDeviceConfiguration() {
- return ((Graphics2D)dg2).getDeviceConfiguration();
- }
-
- /**
- * @see Graphics2D#setComposite(Composite)
- */
- public void setComposite(Composite comp) {
-
- }
-
- /**
- * @see Graphics2D#setPaint(Paint)
- */
- public void setPaint(Paint paint) {
- if (paint == null)
- return;
- this.paint = paint;
-// setPaint(paint, false, 0, 0);
- }
-
- private Stroke transformStroke(Stroke stroke) {
- if (!(stroke instanceof BasicStroke))
- return stroke;
- BasicStroke st = (BasicStroke)stroke;
- float scale = (float)Math.sqrt(Math.abs(transform.getDeterminant()));
- float dash[] = st.getDashArray();
- if (dash != null) {
- for (int k = 0; k < dash.length; ++k)
- dash[k] *= scale;
- }
- return new BasicStroke(st.getLineWidth() * scale, st.getEndCap(), st.getLineJoin(), st.getMiterLimit(), dash, st.getDashPhase() * scale);
- }
-
- private void setStrokeDiff(Stroke newStroke, Stroke oldStroke) {
- if (newStroke == oldStroke)
- return;
- if (!(newStroke instanceof BasicStroke))
- return;
- BasicStroke nStroke = (BasicStroke)newStroke;
- boolean oldOk = (oldStroke instanceof BasicStroke);
- BasicStroke oStroke = null;
- if (oldOk)
- oStroke = (BasicStroke)oldStroke;
- if (!oldOk || nStroke.getLineWidth() != oStroke.getLineWidth())
- cb.setLineWidth(nStroke.getLineWidth());
- if (!oldOk || nStroke.getEndCap() != oStroke.getEndCap()) {
- switch (nStroke.getEndCap()) {
- case BasicStroke.CAP_BUTT:
- cb.setLineCap(0);
- break;
- case BasicStroke.CAP_SQUARE:
- cb.setLineCap(2);
- break;
- default:
- cb.setLineCap(1);
- }
- }
- if (!oldOk || nStroke.getLineJoin() != oStroke.getLineJoin()) {
- switch (nStroke.getLineJoin()) {
- case BasicStroke.JOIN_MITER:
- cb.setLineJoin(0);
- break;
- case BasicStroke.JOIN_BEVEL:
- cb.setLineJoin(2);
- break;
- default:
- cb.setLineJoin(1);
- }
- }
- if (!oldOk || nStroke.getMiterLimit() != oStroke.getMiterLimit())
- cb.setMiterLimit(nStroke.getMiterLimit());
- boolean makeDash;
- if (oldOk) {
- if (nStroke.getDashArray() != null) {
- if (nStroke.getDashPhase() != oStroke.getDashPhase()) {
- makeDash = true;
- }
- else if (!java.util.Arrays.equals(nStroke.getDashArray(), oStroke.getDashArray())) {
- makeDash = true;
- }
- else
- makeDash = false;
- }
- else if (oStroke.getDashArray() != null) {
- makeDash = true;
- }
- else
- makeDash = false;
- }
- else {
- makeDash = true;
- }
- if (makeDash) {
- float dash[] = nStroke.getDashArray();
- if (dash == null)
- cb.setLiteral("[]0 d\n");
- else {
- cb.setLiteral('[');
- int lim = dash.length;
- for (int k = 0; k < lim; ++k) {
- cb.setLiteral(dash[k]);
- cb.setLiteral(' ');
- }
- cb.setLiteral(']');
- cb.setLiteral(nStroke.getDashPhase());
- cb.setLiteral(" d\n");
- }
- }
- }
-
- /**
- * @see Graphics2D#setStroke(Stroke)
- */
- public void setStroke(Stroke s) {
- originalStroke = s;
- this.stroke = transformStroke(s);
- }
-
-
- /**
- * Sets a rendering hint
- * @param arg0
- * @param arg1
- */
- public void setRenderingHint(Key arg0, Object arg1) {
- rhints.put(arg0, arg1);
- }
-
- /**
- * @param arg0 a key
- * @return the rendering hint
- */
- public Object getRenderingHint(Key arg0) {
- return rhints.get(arg0);
- }
-
- /**
- * @see Graphics2D#setRenderingHints(Map)
- */
- public void setRenderingHints(Map hints) {
- rhints.clear();
- rhints.putAll(hints);
- }
-
- /**
- * @see Graphics2D#addRenderingHints(Map)
- */
- public void addRenderingHints(Map hints) {
- rhints.putAll(hints);
- }
-
- /**
- * @see Graphics2D#getRenderingHints()
- */
- public RenderingHints getRenderingHints() {
- return rhints;
- }
-
- /**
- * @see Graphics#translate(int, int)
- */
- public void translate(int x, int y) {
- translate((double)x, (double)y);
- }
-
- /**
- * @see Graphics2D#translate(double, double)
- */
- public void translate(double tx, double ty) {
- transform.translate(tx,ty);
- }
-
- /**
- * @see Graphics2D#rotate(double)
- */
- public void rotate(double theta) {
- transform.rotate(theta);
- }
-
- /**
- * @see Graphics2D#rotate(double, double, double)
- */
- public void rotate(double theta, double x, double y) {
- transform.rotate(theta, x, y);
- }
-
- /**
- * @see Graphics2D#scale(double, double)
- */
- public void scale(double sx, double sy) {
- transform.scale(sx, sy);
- this.stroke = transformStroke(originalStroke);
- }
-
- /**
- * @see Graphics2D#shear(double, double)
- */
- public void shear(double shx, double shy) {
- transform.shear(shx, shy);
- }
-
- /**
- * @see Graphics2D#transform(AffineTransform)
- */
- public void transform(AffineTransform tx) {
- transform.concatenate(tx);
- this.stroke = transformStroke(originalStroke);
- }
-
- /**
- * @see Graphics2D#setTransform(AffineTransform)
- */
- public void setTransform(AffineTransform t) {
- transform = new AffineTransform(t);
- this.stroke = transformStroke(originalStroke);
- }
-
- /**
- * @see Graphics2D#getTransform()
- */
- public AffineTransform getTransform() {
- return new AffineTransform(transform);
- }
-
- /**
- * @see Graphics2D#getPaint()
- */
- public Paint getPaint() {
- return paint;
- }
-
- /**
- * @see Graphics2D#getComposite()
- */
- public Composite getComposite() {
- return null;
- }
-
- /**
- * @see Graphics2D#setBackground(Color)
- */
- public void setBackground(Color color) {
- background = color;
- }
-
- /**
- * @see Graphics2D#getBackground()
- */
- public Color getBackground() {
- return background;
- }
-
- /**
- * @see Graphics2D#getStroke()
- */
- public Stroke getStroke() {
- return originalStroke;
- }
-
-
- /**
- * @see Graphics2D#getFontRenderContext()
- */
- public FontRenderContext getFontRenderContext() {
- return new FontRenderContext(null, true, true);
- }
-
- /**
- * @see Graphics#create()
- */
- public Graphics create() {
- PdfGraphics2D g2 = new PdfGraphics2D();
- g2.onlyShapes = this.onlyShapes;
- g2.transform = new AffineTransform(this.transform);
- g2.baseFonts = this.baseFonts;
- g2.fontMapper = this.fontMapper;
- g2.kids = this.kids;
- g2.paint = this.paint;
- g2.fillGState = this.fillGState;
- g2.strokeGState = this.strokeGState;
- g2.background = this.background;
- g2.mediaTracker = this.mediaTracker;
- g2.convertImagesToJPEG = this.convertImagesToJPEG;
- g2.jpegQuality = this.jpegQuality;
- g2.setFont(this.font);
- g2.cb = this.cb.getDuplicate();
- g2.cb.saveState();
- g2.width = this.width;
- g2.height = this.height;
- g2.followPath(new Area(new Rectangle2D.Float(0, 0, width, height)), CLIP);
- if (this.clip != null)
- g2.clip = new Area(this.clip);
- g2.stroke = stroke;
- g2.originalStroke = originalStroke;
- g2.strokeOne = (BasicStroke)g2.transformStroke(g2.strokeOne);
- g2.oldStroke = g2.strokeOne;
- g2.setStrokeDiff(g2.oldStroke, null);
- g2.cb.saveState();
- if (g2.clip != null)
- g2.followPath(g2.clip, CLIP);
- g2.kid = true;
- synchronized (kids) {
- kids.add(g2);
- }
- return g2;
- }
-
- public PdfContentByte getContent() {
- return this.cb;
- }
- /**
- * @see Graphics#getColor()
- */
- public Color getColor() {
- if (paint instanceof Color) {
- return (Color)paint;
- } else {
- return Color.black;
- }
- }
-
- /**
- * @see Graphics#setColor(Color)
- */
- public void setColor(Color color) {
- setPaint(color);
- }
-
- /**
- * @see Graphics#setPaintMode()
- */
- public void setPaintMode() {}
-
- /**
- * @see Graphics#setXORMode(Color)
- */
- public void setXORMode(Color c1) {
-
- }
-
- /**
- * @see Graphics#getFont()
- */
- public Font getFont() {
- return font;
- }
-
- /**
- * @see Graphics#setFont(Font)
- */
- /**
- * Sets the current font.
- */
- public void setFont(Font f) {
- if (f == null)
- return;
- if (onlyShapes) {
- font = f;
- return;
- }
- if (f == font)
- return;
- font = f;
- fontSize = f.getSize2D();
- baseFont = getCachedBaseFont(f);
- }
-
- private BaseFont getCachedBaseFont(Font f) {
- synchronized (baseFonts) {
- BaseFont bf = (BaseFont)baseFonts.get(f.getFontName());
- if (bf == null) {
- bf = fontMapper.awtToPdf(f);
- baseFonts.put(f.getFontName(), bf);
- }
- return bf;
- }
- }
-
- /**
- * @see Graphics#getFontMetrics(Font)
- */
- public FontMetrics getFontMetrics(Font f) {
- return dg2.getFontMetrics(f);
- }
-
- /**
- * @see Graphics#getClipBounds()
- */
- public Rectangle getClipBounds() {
- if (clip == null)
- return null;
- return getClip().getBounds();
- }
-
- /**
- * @see Graphics#clipRect(int, int, int, int)
- */
- public void clipRect(int x, int y, int width, int height) {
- Rectangle2D rect = new Rectangle2D.Double(x,y,width,height);
- clip(rect);
- }
-
- /**
- * @see Graphics#setClip(int, int, int, int)
- */
- public void setClip(int x, int y, int width, int height) {
- Rectangle2D rect = new Rectangle2D.Double(x,y,width,height);
- setClip(rect);
- }
-
- /**
- * @see Graphics2D#clip(Shape)
- */
- public void clip(Shape s) {
- if (s != null)
- s = transform.createTransformedShape(s);
- if (clip == null)
- clip = new Area(s);
- else
- clip.intersect(new Area(s));
- followPath(s, CLIP);
- }
-
- /**
- * @see Graphics#getClip()
- */
- public Shape getClip() {
- try {
- return transform.createInverse().createTransformedShape(clip);
- }
- catch (NoninvertibleTransformException e) {
- return null;
- }
- }
-
- /**
- * @see Graphics#setClip(Shape)
- */
- public void setClip(Shape s) {
- cb.restoreState();
- cb.saveState();
- if (s != null)
- s = transform.createTransformedShape(s);
- if (s == null) {
- clip = null;
- }
- else {
- clip = new Area(s);
- followPath(s, CLIP);
- }
- paintFill = paintStroke = null;
- currentFillGState = currentStrokeGState = 255;
- oldStroke = strokeOne;
- }
-
- /**
- * @see Graphics#copyArea(int, int, int, int, int, int)
- */
- public void copyArea(int x, int y, int width, int height, int dx, int dy) {
-
- }
-
- /**
- * @see Graphics#drawLine(int, int, int, int)
- */
- public void drawLine(int x1, int y1, int x2, int y2) {
- Line2D line = new Line2D.Double((double)x1, (double)y1, (double)x2, (double)y2);
- draw(line);
- }
-
- /**
- * @see Graphics#fillRect(int, int, int, int)
- */
- public void drawRect(int x, int y, int width, int height) {
- draw(new Rectangle(x, y, width, height));
- }
-
- /**
- * @see Graphics#fillRect(int, int, int, int)
- */
- public void fillRect(int x, int y, int width, int height) {
- fill(new Rectangle(x,y,width,height));
- }
-
- /**
- * @see Graphics#clearRect(int, int, int, int)
- */
- public void clearRect(int x, int y, int width, int height) {
- Paint temp = paint;
- setPaint(background);
- fillRect(x,y,width,height);
- setPaint(temp);
- }
-
- /**
- * @see Graphics#drawRoundRect(int, int, int, int, int, int)
- */
- public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
- RoundRectangle2D rect = new RoundRectangle2D.Double(x,y,width,height,arcWidth, arcHeight);
- draw(rect);
- }
-
- /**
- * @see Graphics#fillRoundRect(int, int, int, int, int, int)
- */
- public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
- RoundRectangle2D rect = new RoundRectangle2D.Double(x,y,width,height,arcWidth, arcHeight);
- fill(rect);
- }
-
- /**
- * @see Graphics#drawOval(int, int, int, int)
- */
- public void drawOval(int x, int y, int width, int height) {
- Ellipse2D oval = new Ellipse2D.Float((float)x, (float)y, (float)width, (float)height);
- draw(oval);
- }
-
- /**
- * @see Graphics#fillOval(int, int, int, int)
- */
- public void fillOval(int x, int y, int width, int height) {
- Ellipse2D oval = new Ellipse2D.Float((float)x, (float)y, (float)width, (float)height);
- fill(oval);
- }
-
- /**
- * @see Graphics#drawArc(int, int, int, int, int, int)
- */
- public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
- Arc2D arc = new Arc2D.Double(x,y,width,height,startAngle, arcAngle, Arc2D.OPEN);
- draw(arc);
-
- }
-
- /**
- * @see Graphics#fillArc(int, int, int, int, int, int)
- */
- public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
- Arc2D arc = new Arc2D.Double(x,y,width,height,startAngle, arcAngle, Arc2D.PIE);
- fill(arc);
- }
-
- /**
- * @see Graphics#drawPolyline(int[], int[], int)
- */
- public void drawPolyline(int[] x, int[] y, int nPoints) {
- Line2D line = new Line2D.Double(x[0],y[0],x[0],y[0]);
- for (int i = 1; i < nPoints; i++) {
- line.setLine(line.getX2(), line.getY2(), x[i], y[i]);
- draw(line);
- }
- }
-
- /**
- * @see Graphics#drawPolygon(int[], int[], int)
- */
- public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) {
- Polygon poly = new Polygon();
- for (int i = 0; i < nPoints; i++) {
- poly.addPoint(xPoints[i], yPoints[i]);
- }
- draw(poly);
- }
-
- /**
- * @see Graphics#fillPolygon(int[], int[], int)
- */
- public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) {
- Polygon poly = new Polygon();
- for (int i = 0; i < nPoints; i++) {
- poly.addPoint(xPoints[i], yPoints[i]);
- }
- fill(poly);
- }
-
- /**
- * @see Graphics#drawImage(Image, int, int, ImageObserver)
- */
- public boolean drawImage(Image img, int x, int y, ImageObserver observer) {
- return drawImage(img, x, y, null, observer);
- }
-
- /**
- * @see Graphics#drawImage(Image, int, int, int, int, ImageObserver)
- */
- public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) {
- return drawImage(img, x, y, width, height, null, observer);
- }
-
- /**
- * @see Graphics#drawImage(Image, int, int, Color, ImageObserver)
- */
- public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) {
- waitForImage(img);
- return drawImage(img, x, y, img.getWidth(observer), img.getHeight(observer), bgcolor, observer);
- }
-
- /**
- * @see Graphics#drawImage(Image, int, int, int, int, Color, ImageObserver)
- */
- public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) {
- waitForImage(img);
- double scalex = width/(double)img.getWidth(observer);
- double scaley = height/(double)img.getHeight(observer);
- AffineTransform tx = AffineTransform.getTranslateInstance(x,y);
- tx.scale(scalex,scaley);
- return drawImage(img, null, tx, bgcolor, observer);
- }
-
- /**
- * @see Graphics#drawImage(Image, int, int, int, int, int, int, int, int, ImageObserver)
- */
- public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) {
- return drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null, observer);
- }
-
- /**
- * @see Graphics#drawImage(Image, int, int, int, int, int, int, int, int, Color, ImageObserver)
- */
- public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer) {
- waitForImage(img);
- double dwidth = (double)dx2-dx1;
- double dheight = (double)dy2-dy1;
- double swidth = (double)sx2-sx1;
- double sheight = (double)sy2-sy1;
-
- //if either width or height is 0, then there is nothing to draw
- if (dwidth == 0 || dheight == 0 || swidth == 0 || sheight == 0) return true;
-
- double scalex = dwidth/swidth;
- double scaley = dheight/sheight;
-
- double transx = sx1*scalex;
- double transy = sy1*scaley;
- AffineTransform tx = AffineTransform.getTranslateInstance(dx1-transx,dy1-transy);
- tx.scale(scalex,scaley);
-
- BufferedImage mask = new BufferedImage(img.getWidth(observer), img.getHeight(observer), BufferedImage.TYPE_BYTE_BINARY);
- Graphics g = mask.getGraphics();
- g.fillRect(sx1,sy1, (int)swidth, (int)sheight);
- drawImage(img, mask, tx, null, observer);
- return true;
- }
-
- /**
- * @see Graphics#dispose()
- */
- public void dispose() {
- if (kid)
- return;
- if (!disposeCalled) {
- disposeCalled = true;
- cb.restoreState();
- cb.restoreState();
- for (int k = 0; k < kids.size(); ++k) {
- PdfGraphics2D g2 = (PdfGraphics2D)kids.get(k);
- g2.cb.restoreState();
- g2.cb.restoreState();
- cb.add(g2.cb);
- }
- }
- }
-
- ///////////////////////////////////////////////
- //
- //
- // implementation specific methods
- //
- //
-
-
- private void followPath(Shape s, int drawType) {
- if (s==null) return;
- if (drawType==STROKE) {
- if (!(stroke instanceof BasicStroke)) {
- s = stroke.createStrokedShape(s);
- followPath(s, FILL);
- return;
- }
- }
- if (drawType==STROKE) {
- setStrokeDiff(stroke, oldStroke);
- oldStroke = stroke;
- setStrokePaint();
- }
- else if (drawType==FILL)
- setFillPaint();
- PathIterator points;
- if (drawType == CLIP)
- points = s.getPathIterator(IDENTITY);
- else
- points = s.getPathIterator(transform);
- float[] coords = new float[6];
- int traces = 0;
- while(!points.isDone()) {
- ++traces;
- int segtype = points.currentSegment(coords);
- normalizeY(coords);
- switch(segtype) {
- case PathIterator.SEG_CLOSE:
- cb.closePath();
- break;
-
- case PathIterator.SEG_CUBICTO:
- cb.curveTo(coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]);
- break;
-
- case PathIterator.SEG_LINETO:
- cb.lineTo(coords[0], coords[1]);
- break;
-
- case PathIterator.SEG_MOVETO:
- cb.moveTo(coords[0], coords[1]);
- break;
-
- case PathIterator.SEG_QUADTO:
- cb.curveTo(coords[0], coords[1], coords[2], coords[3]);
- break;
- }
- points.next();
- }
-
- switch (drawType) {
- case FILL:
- if (traces > 0) {
- if (points.getWindingRule() == PathIterator.WIND_EVEN_ODD)
- cb.eoFill();
- else
- cb.fill();
- }
- break;
- case STROKE:
- if (traces > 0)
- cb.stroke();
- break;
- default: //drawType==CLIP
- if (traces == 0)
- cb.rectangle(0, 0, 0, 0);
- if (points.getWindingRule() == PathIterator.WIND_EVEN_ODD)
- cb.eoClip();
- else
- cb.clip();
- cb.newPath();
- }
- }
-
- private float normalizeY(float y) {
- return this.height - y;
- }
-
- private void normalizeY(float[] coords) {
- coords[1] = normalizeY(coords[1]);
- coords[3] = normalizeY(coords[3]);
- coords[5] = normalizeY(coords[5]);
- }
-
- private AffineTransform normalizeMatrix() {
- double[] mx = new double[6];
- AffineTransform result = AffineTransform.getTranslateInstance(0,0);
- result.getMatrix(mx);
- mx[3]=-1;
- mx[5]=height;
- result = new AffineTransform(mx);
- result.concatenate(transform);
- return result;
- }
-
- private boolean drawImage(Image img, Image mask, AffineTransform xform, Color bgColor, ImageObserver obs) {
- if (xform==null) return true;
-
- xform.translate(0, img.getHeight(obs));
- xform.scale(img.getWidth(obs), img.getHeight(obs));
-
- AffineTransform inverse = this.normalizeMatrix();
- AffineTransform flipper = AffineTransform.getScaleInstance(1,-1);
- inverse.concatenate(xform);
- inverse.concatenate(flipper);
-
- double[] mx = new double[6];
- inverse.getMatrix(mx);
- if (currentFillGState != 255) {
- PdfGState gs = fillGState[255];
- if (gs == null) {
- gs = new PdfGState();
- gs.setFillOpacity(1);
- fillGState[255] = gs;
- }
- cb.setGState(gs);
- }
-
- try {
- com.lowagie.text.Image image = null;
- if(!convertImagesToJPEG){
- image = com.lowagie.text.Image.getInstance(img, bgColor);
- }
- else{
- BufferedImage scaled = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);
- Graphics2D g3 = scaled.createGraphics();
- g3.drawImage(img, 0, 0, img.getWidth(null), img.getHeight(null), null);
- g3.dispose();
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- com.sun.image.codec.jpeg.JPEGImageEncoder encoder = com.sun.image.codec.jpeg.JPEGCodec.createJPEGEncoder(baos);
- com.sun.image.codec.jpeg.JPEGEncodeParam param = com.sun.image.codec.jpeg.JPEGCodec.getDefaultJPEGEncodeParam(scaled);
- param.setQuality(jpegQuality, true);
- encoder.encode(scaled, param);
- scaled.flush();
- scaled = null;
- image = com.lowagie.text.Image.getInstance(baos.toByteArray());
-
- }
- if (mask!=null) {
- com.lowagie.text.Image msk = com.lowagie.text.Image.getInstance(mask, null, true);
- msk.makeMask();
- msk.setInvertMask(true);
- image.setImageMask(msk);
- }
- cb.addImage(image, (float)mx[0], (float)mx[1], (float)mx[2], (float)mx[3], (float)mx[4], (float)mx[5]);
- } catch (Exception ex) {
- throw new IllegalArgumentException();
- }
- if (currentFillGState != 255) {
- PdfGState gs = fillGState[currentFillGState];
- cb.setGState(gs);
- }
- return true;
- }
-
- private boolean checkNewPaint(Paint oldPaint) {
- if (paint == oldPaint)
- return false;
- return !((paint instanceof Color) && paint.equals(oldPaint));
- }
-
- private void setFillPaint() {
- if (checkNewPaint(paintFill)) {
- paintFill = paint;
- setPaint(false, 0, 0, true);
- }
- }
-
- private void setStrokePaint() {
- if (checkNewPaint(paintStroke)) {
- paintStroke = paint;
- setPaint(false, 0, 0, false);
- }
- }
-
- private void setPaint(boolean invert, double xoffset, double yoffset, boolean fill) {
- if (paint instanceof Color) {
- Color color = (Color)paint;
- int alpha = color.getAlpha();
- if (fill) {
- if (alpha != currentFillGState) {
- currentFillGState = alpha;
- PdfGState gs = fillGState[alpha];
- if (gs == null) {
- gs = new PdfGState();
- gs.setFillOpacity((float)alpha / 255f);
- fillGState[alpha] = gs;
- }
- cb.setGState(gs);
- }
- cb.setColorFill(color);
- }
- else {
- if (alpha != currentStrokeGState) {
- currentStrokeGState = alpha;
- PdfGState gs = strokeGState[alpha];
- if (gs == null) {
- gs = new PdfGState();
- gs.setStrokeOpacity((float)alpha / 255f);
- strokeGState[alpha] = gs;
- }
- cb.setGState(gs);
- }
- cb.setColorStroke(color);
- }
- }
- else if (paint instanceof GradientPaint) {
- GradientPaint gp = (GradientPaint)paint;
- Point2D p1 = gp.getPoint1();
- transform.transform(p1, p1);
- Point2D p2 = gp.getPoint2();
- transform.transform(p2, p2);
- Color c1 = gp.getColor1();
- Color c2 = gp.getColor2();
- PdfShading shading = PdfShading.simpleAxial(cb.getPdfWriter(), (float)p1.getX(), normalizeY((float)p1.getY()), (float)p2.getX(), normalizeY((float)p2.getY()), c1, c2);
- PdfShadingPattern pat = new PdfShadingPattern(shading);
- if (fill)
- cb.setShadingFill(pat);
- else
- cb.setShadingStroke(pat);
- }
- else if (paint instanceof TexturePaint) {
- try {
- TexturePaint tp = (TexturePaint)paint;
- BufferedImage img = tp.getImage();
- Rectangle2D rect = tp.getAnchorRect();
- com.lowagie.text.Image image = com.lowagie.text.Image.getInstance(img, null);
- PdfPatternPainter pattern = cb.createPattern(image.width(), image.height());
- AffineTransform inverse = this.normalizeMatrix();
- inverse.translate(rect.getX(), rect.getY());
- inverse.scale(rect.getWidth() / image.width(), -rect.getHeight() / image.height());
- double[] mx = new double[6];
- inverse.getMatrix(mx);
- pattern.setPatternMatrix((float)mx[0], (float)mx[1], (float)mx[2], (float)mx[3], (float)mx[4], (float)mx[5]) ;
- image.setAbsolutePosition(0,0);
- pattern.addImage(image);
- if (fill)
- cb.setPatternFill(pattern);
- else
- cb.setPatternStroke(pattern);
- } catch (Exception ex) {
- if (fill)
- cb.setColorFill(Color.gray);
- else
- cb.setColorStroke(Color.gray);
- }
- }
- else {
- try {
- BufferedImage img = null;
- int type = BufferedImage.TYPE_4BYTE_ABGR;
- if (paint.getTransparency() == Transparency.OPAQUE) {
- type = BufferedImage.TYPE_3BYTE_BGR;
- }
- img = new BufferedImage((int)width, (int)height, type);
- Graphics2D g = (Graphics2D)img.getGraphics();
- g.transform(transform);
- AffineTransform inv = transform.createInverse();
- Shape fillRect = new Rectangle2D.Double(0,0,img.getWidth(),img.getHeight());
- fillRect = inv.createTransformedShape(fillRect);
- g.setPaint(paint);
- g.fill(fillRect);
- if (invert) {
- AffineTransform tx = new AffineTransform();
- tx.scale(1,-1);
- tx.translate(-xoffset,-yoffset);
- g.drawImage(img,tx,null);
- }
- com.lowagie.text.Image image = com.lowagie.text.Image.getInstance(img, null);
- PdfPatternPainter pattern = cb.createPattern(width, height);
- image.setAbsolutePosition(0,0);
- pattern.addImage(image);
- if (fill)
- cb.setPatternFill(pattern);
- else
- cb.setPatternStroke(pattern);
- } catch (Exception ex) {
- if (fill)
- cb.setColorFill(Color.gray);
- else
- cb.setColorStroke(Color.gray);
- }
- }
- }
-
- private synchronized void waitForImage(java.awt.Image image) {
- if (mediaTracker == null)
- mediaTracker = new MediaTracker(new PdfGraphics2D.fakeComponent());
- mediaTracker.addImage(image, 0);
- try {
- mediaTracker.waitForID(0);
- }
- catch (InterruptedException e) {
- // empty on purpose
- }
- mediaTracker.removeImage(image);
- }
-
- static private class fakeComponent extends Component {
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfICCBased.java b/LibrarySource/com/lowagie/text/pdf/PdfICCBased.java
deleted file mode 100644
index c59e106..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfICCBased.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import headless.awt.color.ICC_Profile;
-
-import com.lowagie.text.ExceptionConverter;
-
-/**
- * A <CODE>PdfICCBased</CODE> defines a ColorSpace
- *
- * @see PdfStream
- */
-
-class PdfICCBased extends PdfStream {
-
- protected int NumberOfComponents;
-
- PdfICCBased(ICC_Profile profile) {
- super();
- try {
- NumberOfComponents = profile.getNumComponents();
- PdfNumber pNumber = new PdfNumber(NumberOfComponents);
- switch (NumberOfComponents) {
- case 1:
- put(PdfName.ALTERNATE, PdfName.DEVICEGRAY);
- break;
- case 3:
- put(PdfName.ALTERNATE, PdfName.DEVICERGB);
- break;
- case 4:
- put(PdfName.ALTERNATE, PdfName.DEVICECMYK);
- break;
- default:
- throw new PdfException(NumberOfComponents + " component(s) is not supported in PDF1.4");
- }
- put(PdfName.N, new PdfNumber(NumberOfComponents));
- bytes = profile.getData();
- flateCompress();
- } catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfImage.java b/LibrarySource/com/lowagie/text/pdf/PdfImage.java
deleted file mode 100644
index 0a2e0cb..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfImage.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * $Id: PdfImage.java,v 1.58 2004/11/29 14:07:00 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- *
- * REMARK:
- * LZW/GIF is covered by a software patent which is owned by Unisys Corporation.
- * Unisys refuses to license this patent for PDF-related use in software
- * even when this software is released for free and may be freely distributed.
- * HOWEVER:
- * This library doesn't compress or decompress data using the LZW
- * algorithm, nor does it create or visualize GIF-images in any way;
- * it only copies parts of an existing GIF file into a PDF file.
- *
- * More information about the GIF format can be found in the following documents:
- * * GRAPHICS INTERCHANGE FORMAT(sm) Version 89a
- * (c)1987,1988,1989,1990 Copyright CompuServe Incorporated. Columbus, Ohio
- * * LZW and GIF explained
- * Steve Blackstock
- * * http://mistress.informatik.unibw-muenchen.de/
- * very special thanks to klee at informatik.unibw-muenchen.de for the algorithm
- * to extract the LZW data from a GIF.
- */
-
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.Image;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.IOException;
-
-/**
- * <CODE>PdfImage</CODE> is a <CODE>PdfStream</CODE> containing an image-<CODE>Dictionary</CODE> and -stream.
- */
-
-class PdfImage extends PdfStream {
-
- static final int TRANSFERSIZE = 4096;
- // membervariables
-
- /** This is the <CODE>PdfName</CODE> of the image. */
- protected PdfName name = null;
-
- // constructor
-
- /**
- * Constructs a <CODE>PdfImage</CODE>-object.
- *
- * @param image the <CODE>Image</CODE>-object
- * @param name the <CODE>PdfName</CODE> for this image
- * @throws BadPdfFormatException on error
- */
-
- public PdfImage(Image image, String name, PdfIndirectReference maskRef) throws BadPdfFormatException {
- super();
- this.name = new PdfName(name);
- put(PdfName.TYPE, PdfName.XOBJECT);
- put(PdfName.SUBTYPE, PdfName.IMAGE);
- put(PdfName.WIDTH, new PdfNumber(image.width()));
- put(PdfName.HEIGHT, new PdfNumber(image.height()));
- if (image.getLayer() != null)
- put(PdfName.OC, image.getLayer().getRef());
- if (image.isMask() && (image.bpc() == 1 || image.bpc() > 0xff))
- put(PdfName.IMAGEMASK, PdfBoolean.PDFTRUE);
- if (maskRef != null) {
- if (image.isSmask())
- put(PdfName.SMASK, maskRef);
- else
- put(PdfName.MASK, maskRef);
- }
- if (image.isMask() && image.isInvertMask())
- put(PdfName.DECODE, new PdfLiteral("[1 0]"));
- if (image.isInterpolation())
- put(PdfName.INTERPOLATE, PdfBoolean.PDFTRUE);
- InputStream is = null;
- try {
-
- // Raw Image data
- if (image.isImgRaw()) {
- // will also have the CCITT parameters
- int colorspace = image.colorspace();
- int transparency[] = image.getTransparency();
- if (transparency != null && !image.isMask() && maskRef == null) {
- String s = "[";
- for (int k = 0; k < transparency.length; ++k)
- s += transparency[k] + " ";
- s += "]";
- put(PdfName.MASK, new PdfLiteral(s));
- }
- bytes = image.rawData();
- put(PdfName.LENGTH, new PdfNumber(bytes.length));
- int bpc = image.bpc();
- if (bpc > 0xff) {
- if (!image.isMask())
- put(PdfName.COLORSPACE, PdfName.DEVICEGRAY);
- put(PdfName.BITSPERCOMPONENT, new PdfNumber(1));
- put(PdfName.FILTER, PdfName.CCITTFAXDECODE);
- int k = bpc - Image.CCITTG3_1D;
- PdfDictionary decodeparms = new PdfDictionary();
- if (k != 0)
- decodeparms.put(PdfName.K, new PdfNumber(k));
- if ((colorspace & Image.CCITT_BLACKIS1) != 0)
- decodeparms.put(PdfName.BLACKIS1, PdfBoolean.PDFTRUE);
- if ((colorspace & Image.CCITT_ENCODEDBYTEALIGN) != 0)
- decodeparms.put(PdfName.ENCODEDBYTEALIGN, PdfBoolean.PDFTRUE);
- if ((colorspace & Image.CCITT_ENDOFLINE) != 0)
- decodeparms.put(PdfName.ENDOFLINE, PdfBoolean.PDFTRUE);
- if ((colorspace & Image.CCITT_ENDOFBLOCK) != 0)
- decodeparms.put(PdfName.ENDOFBLOCK, PdfBoolean.PDFFALSE);
- decodeparms.put(PdfName.COLUMNS, new PdfNumber(image.width()));
- decodeparms.put(PdfName.ROWS, new PdfNumber(image.height()));
- put(PdfName.DECODEPARMS, decodeparms);
- }
- else {
- switch(colorspace) {
- case 1:
- put(PdfName.COLORSPACE, PdfName.DEVICEGRAY);
- if (image.isInverted())
- put(PdfName.DECODE, new PdfLiteral("[1 0]"));
- break;
- case 3:
- put(PdfName.COLORSPACE, PdfName.DEVICERGB);
- if (image.isInverted())
- put(PdfName.DECODE, new PdfLiteral("[1 0 1 0 1 0]"));
- break;
- case 4:
- default:
- put(PdfName.COLORSPACE, PdfName.DEVICECMYK);
- if (image.isInverted())
- put(PdfName.DECODE, new PdfLiteral("[1 0 1 0 1 0 1 0]"));
- }
- PdfDictionary additional = image.getAdditional();
- if (additional != null)
- putAll(additional);
- if (image.isMask() && (image.bpc() == 1 || image.bpc() > 8))
- remove(PdfName.COLORSPACE);
- put(PdfName.BITSPERCOMPONENT, new PdfNumber(image.bpc()));
- if (image.isDeflated())
- put(PdfName.FILTER, PdfName.FLATEDECODE);
- else {
- flateCompress();
- }
- }
- return;
- }
-
- // GIF, JPEG or PNG
- String errorID;
- if (image.rawData() == null){
- is = image.url().openStream();
- errorID = image.url().toString();
- }
- else{
- is = new java.io.ByteArrayInputStream(image.rawData());
- errorID = "Byte array";
- }
- int i = 0;
- switch(image.type()) {
- case Image.JPEG:
- put(PdfName.FILTER, PdfName.DCTDECODE);
- switch(image.colorspace()) {
- case 1:
- put(PdfName.COLORSPACE, PdfName.DEVICEGRAY);
- break;
- case 3:
- put(PdfName.COLORSPACE, PdfName.DEVICERGB);
- break;
- default:
- put(PdfName.COLORSPACE, PdfName.DEVICECMYK);
- if (image.isInverted()) {
- put(PdfName.DECODE, new PdfLiteral("[1 0 1 0 1 0 1 0]"));
- }
- }
- put(PdfName.BITSPERCOMPONENT, new PdfNumber(8));
- if (image.rawData() != null){
- bytes = image.rawData();
- put(PdfName.LENGTH, new PdfNumber(bytes.length));
- return;
- }
- streamBytes = new ByteArrayOutputStream();
- transferBytes(is, streamBytes, -1);
- break;
- default:
- throw new BadPdfFormatException(errorID + " is an unknown Image format.");
- }
- put(PdfName.LENGTH, new PdfNumber(streamBytes.size()));
- }
- catch(IOException ioe) {
- throw new BadPdfFormatException(ioe.getMessage());
- }
- finally {
- if (is != null) {
- try{
- is.close();
- }
- catch (Exception ee) {
- // empty on purpose
- }
- }
- }
- }
-
- /**
- * Returns the <CODE>PdfName</CODE> of the image.
- *
- * @return the name
- */
-
- public PdfName name() {
- return name;
- }
-
- static void transferBytes(InputStream in, OutputStream out, int len) throws IOException {
- byte buffer[] = new byte[TRANSFERSIZE];
- if (len < 0)
- len = 0x7ffffff;
- int size;
- while (len != 0) {
- size = in.read(buffer, 0, Math.min(len, TRANSFERSIZE));
- if (size < 0)
- return;
- out.write(buffer, 0, size);
- len -= size;
- }
- }
-
- protected void importAll(PdfImage dup) {
- name = dup.name;
- compressed = dup.compressed;
- streamBytes = dup.streamBytes;
- bytes = dup.bytes;
- hashMap = dup.hashMap;
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfImportedPage.java b/LibrarySource/com/lowagie/text/pdf/PdfImportedPage.java
deleted file mode 100644
index feb51fd..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfImportedPage.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * $Id: PdfImportedPage.java,v 1.14 2002/06/20 13:30:25 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.Image;
-import java.io.IOException;
-
-/** Represents an imported page.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class PdfImportedPage extends com.lowagie.text.pdf.PdfTemplate {
-
- PdfReaderInstance readerInstance;
- int pageNumber;
-
- PdfImportedPage(PdfReaderInstance readerInstance, PdfWriter writer, int pageNumber) {
- this.readerInstance = readerInstance;
- this.pageNumber = pageNumber;
- thisReference = writer.getPdfIndirectReference();
- bBox = readerInstance.getReader().getPageSize(pageNumber);
- type = TYPE_IMPORTED;
- }
-
- /** Reads the content from this <CODE>PdfImportedPage</CODE>-object from a reader.
- *
- * @return self
- *
- */
- public PdfImportedPage getFromReader() {
- return this;
- }
-
- public int getPageNumber() {
- return pageNumber;
- }
-
-
- /** Always throws an error. This operation is not allowed.
- * @param image dummy
- * @param a dummy
- * @param b dummy
- * @param c dummy
- * @param d dummy
- * @param e dummy
- * @param f dummy
- * @throws DocumentException dummy */
- public void addImage(Image image, float a, float b, float c, float d, float e, float f) throws DocumentException {
- throwError();
- }
-
- /** Always throws an error. This operation is not allowed.
- * @param template dummy
- * @param a dummy
- * @param b dummy
- * @param c dummy
- * @param d dummy
- * @param e dummy
- * @param f dummy */
- public void addTemplate(PdfTemplate template, float a, float b, float c, float d, float e, float f) {
- throwError();
- }
-
- /** Always throws an error. This operation is not allowed.
- * @return dummy */
- public PdfContentByte getDuplicate() {
- throwError();
- return null;
- }
-
- PdfStream getFormXObject() throws IOException {
- return readerInstance.getFormXObject(pageNumber);
- }
-
- public void setColorFill(PdfSpotColor sp, float tint) {
- throwError();
- }
-
- public void setColorStroke(PdfSpotColor sp, float tint) {
- throwError();
- }
-
- PdfObject getResources() {
- return readerInstance.getResources(pageNumber);
- }
-
- /** Always throws an error. This operation is not allowed.
- * @param bf dummy
- * @param size dummy */
- public void setFontAndSize(BaseFont bf, float size) {
- throwError();
- }
-
- void throwError() {
- throw new RuntimeException("Content can not be added to a PdfImportedPage.");
- }
-
- PdfReaderInstance getPdfReaderInstance() {
- return readerInstance;
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfIndirectObject.java b/LibrarySource/com/lowagie/text/pdf/PdfIndirectObject.java
deleted file mode 100644
index 3880a7c..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfIndirectObject.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * $Id: PdfIndirectObject.java,v 1.35 2003/05/02 09:01:25 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import com.lowagie.text.DocWriter;
-
-/**
- * <CODE>PdfIndirectObject</CODE> is the Pdf indirect object.
- * <P>
- * An <I>indirect object</I> is an object that has been labeled so that it can be referenced by
- * other objects. Any type of <CODE>PdfObject</CODE> may be labeled as an indirect object.<BR>
- * An indirect object consists of an object identifier, a direct object, and the <B>endobj</B>
- * keyword. The <I>object identifier</I> consists of an integer <I>object number</I>, an integer
- * <I>generation number</I>, and the <B>obj</B> keyword.<BR>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 4.10 (page 53).
- *
- * @see PdfObject
- * @see PdfIndirectReference
- */
-
-public class PdfIndirectObject {
-
- // membervariables
-
-/** The object number */
- protected int number;
-
-/** the generation number */
- protected int generation = 0;
-
- static final byte STARTOBJ[] = DocWriter.getISOBytes(" obj");
- static final byte ENDOBJ[] = DocWriter.getISOBytes("\nendobj\n");
- static final int SIZEOBJ = STARTOBJ.length + ENDOBJ.length;
- PdfObject object;
- PdfWriter writer;
-
- // constructors
-
-/**
- * Constructs a <CODE>PdfIndirectObject</CODE>.
- *
- * @param number the object number
- * @param object the direct object
- */
-
- PdfIndirectObject(int number, PdfObject object, PdfWriter writer) {
- this(number, 0, object, writer);
- }
-
- PdfIndirectObject(PdfIndirectReference ref, PdfObject object, PdfWriter writer) {
- this(ref.getNumber(),ref.getGeneration(),object,writer);
- }
-/**
- * Constructs a <CODE>PdfIndirectObject</CODE>.
- *
- * @param number the object number
- * @param generation the generation number
- * @param object the direct object
- */
-
- PdfIndirectObject(int number, int generation, PdfObject object, PdfWriter writer) {
- this.writer = writer;
- this.number = number;
- this.generation = generation;
- this.object = object;
- PdfEncryption crypto = null;
- if (writer != null)
- crypto = writer.getEncryption();
- if (crypto != null) {
- crypto.setHashKey(number, generation);
- }
- }
-
- // methods
-
-/**
- * Return the length of this <CODE>PdfIndirectObject</CODE>.
- *
- * @return the length of the PDF-representation of this indirect object.
- */
-
-// public int length() {
-// if (isStream)
-// return bytes.size() + SIZEOBJ + stream.getStreamLength(writer);
-// else
-// return bytes.size();
-// }
-
-
-/**
- * Returns a <CODE>PdfIndirectReference</CODE> to this <CODE>PdfIndirectObject</CODE>.
- *
- * @return a <CODE>PdfIndirectReference</CODE>
- */
-
- public PdfIndirectReference getIndirectReference() {
- return new PdfIndirectReference(object.type(), number, generation);
- }
-
-/**
- * Writes eficiently to a stream
- *
- * @param os the stream to write to
- * @throws IOException on write error
- */
- void writeTo(OutputStream os) throws IOException
- {
- os.write(DocWriter.getISOBytes(String.valueOf(number)));
- os.write(' ');
- os.write(DocWriter.getISOBytes(String.valueOf(generation)));
- os.write(STARTOBJ);
- int type = object.type();
- if (type != PdfObject.ARRAY && type != PdfObject.DICTIONARY && type != PdfObject.NAME && type != PdfObject.STRING)
- os.write(' ');
- object.toPdf(writer, os);
- os.write(ENDOBJ);
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfIndirectReference.java b/LibrarySource/com/lowagie/text/pdf/PdfIndirectReference.java
deleted file mode 100644
index b3436ad..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfIndirectReference.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * $Id: PdfIndirectReference.java,v 1.22 2002/06/20 13:30:25 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/**
- * <CODE>PdfIndirectReference</CODE> contains a reference to a <CODE>PdfIndirectObject</CODE>.
- * <P>
- * Any object used as an element of an array or as a value in a dictionary may be specified
- * by either a direct object of an indirect reference. An <I>indirect reference</I> is a reference
- * to an indirect object, and consists of the indirect object's object number, generation number
- * and the <B>R</B> keyword.<BR>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 4.11 (page 54).
- *
- * @see PdfObject
- * @see PdfIndirectObject
- */
-
-public class PdfIndirectReference extends PdfObject {
-
- // membervariables
-
-/** the object number */
- protected int number;
-
-/** the generation number */
- protected int generation = 0;
-
- // constructors
-
- protected PdfIndirectReference() {
- super(0);
- }
-
-/**
- * Constructs a <CODE>PdfIndirectReference</CODE>.
- *
- * @param type the type of the <CODE>PdfObject</CODE> that is referenced to
- * @param number the object number.
- * @param generation the generation number.
- */
-
- PdfIndirectReference(int type, int number, int generation) {
- super(0, new StringBuffer().append(number).append(" ").append(generation).append(" R").toString());
- this.number = number;
- this.generation = generation;
- }
-
-/**
- * Constructs a <CODE>PdfIndirectReference</CODE>.
- *
- * @param type the type of the <CODE>PdfObject</CODE> that is referenced to
- * @param number the object number.
- */
-
- PdfIndirectReference(int type, int number) {
- this(type, number, 0);
- }
-
- // methods
-
-/**
- * Returns the number of the object.
- *
- * @return a number.
- */
-
- public int getNumber() {
- return number;
- }
-
-/**
- * Returns the generation of the object.
- *
- * @return a number.
- */
-
- public int getGeneration() {
- return generation;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfLayer.java b/LibrarySource/com/lowagie/text/pdf/PdfLayer.java
deleted file mode 100644
index 6a835cf..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfLayer.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Copyright 2004 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.util.ArrayList;
-/**
- * An optional content group is a dictionary representing a collection of graphics
- * that can be made visible or invisible dynamically by users of viewer applications.
- * In iText they are referenced as layers.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class PdfLayer extends PdfDictionary implements PdfOCG {
- protected PdfIndirectReference ref;
- protected ArrayList children;
- protected PdfLayer parent;
- protected String title;
-
- /**
- * Holds value of property on.
- */
- private boolean on = true;
-
- /**
- * Holds value of property onPanel.
- */
- private boolean onPanel = true;
-
- PdfLayer(String title) {
- this.title = title;
- }
-
- /**
- * Creates a title layer. A title layer is not really a layer but a collection of layers
- * under the same title heading.
- * @param title the title text
- * @param writer the <CODE>PdfWriter</CODE>
- * @return the title layer
- */
- public static PdfLayer createTitle(String title, PdfWriter writer) {
- if (title == null)
- throw new NullPointerException("Title cannot be null.");
- PdfLayer layer = new PdfLayer(title);
- writer.registerLayer(layer);
- return layer;
- }
- /**
- * Creates a new layer.
- * @param name the name of the layer
- * @param writer the writer
- */
- public PdfLayer(String name, PdfWriter writer) {
- super(PdfName.OCG);
- setName(name);
- ref = writer.getPdfIndirectReference();
- writer.registerLayer(this);
- }
-
- String getTitle() {
- return title;
- }
-
- /**
- * Adds a child layer. Nested layers can only have one parent.
- * @param child the child layer
- */
- public void addChild(PdfLayer child) {
- if (child.parent != null)
- throw new IllegalArgumentException("The layer '" + ((PdfString)child.get(PdfName.NAME)).toUnicodeString() + "' already has a parent.");
- child.parent = this;
- if (children == null)
- children = new ArrayList();
- children.add(child);
- }
-
-
- /**
- * Gets the parent layer.
- * @return the parent layer or <CODE>null</CODE> if the layer has no parent
- */
- public PdfLayer getParent() {
- return parent;
- }
-
- /**
- * Gets the children layers.
- * @return the children layers or <CODE>null</CODE> if the layer has no children
- */
- public ArrayList getChildren() {
- return children;
- }
-
- /**
- * Gets the <CODE>PdfIndirectReference</CODE> that represents this layer.
- * @return the <CODE>PdfIndirectReference</CODE> that represents this layer
- */
- public PdfIndirectReference getRef() {
- return ref;
- }
-
- /**
- * Sets the name of this layer.
- * @param name the name of this layer
- */
- public void setName(String name) {
- put(PdfName.NAME, new PdfString(name, PdfObject.TEXT_UNICODE));
- }
-
- /**
- * Gets the dictionary representing the layer. It just returns <CODE>this</CODE>.
- * @return the dictionary representing the layer
- */
- public PdfObject getPdfObject() {
- return this;
- }
-
- /**
- * Gets the initial visibility of the layer.
- * @return the initial visibility of the layer
- */
- public boolean isOn() {
- return this.on;
- }
-
- /**
- * Sets the initial visibility of the layer.
- * @param on the initial visibility of the layer
- */
- public void setOn(boolean on) {
- this.on = on;
- }
-
- private PdfDictionary getUsage() {
- PdfDictionary usage = (PdfDictionary)get(PdfName.USAGE);
- if (usage == null) {
- usage = new PdfDictionary();
- put(PdfName.USAGE, usage);
- }
- return usage;
- }
-
- /**
- * Used by the creating application to store application-specific
- * data associated with this optional content group.
- * @param creator a text string specifying the application that created the group
- * @param subtype a string defining the type of content controlled by the group. Suggested
- * values include but are not limited to <B>Artwork</B>, for graphic-design or publishing
- * applications, and <B>Technical</B>, for technical designs such as building plans or
- * schematics
- */
- public void setCreatorInfo(String creator, String subtype) {
- PdfDictionary usage = getUsage();
- PdfDictionary dic = new PdfDictionary();
- dic.put(PdfName.CREATOR, new PdfString(creator, PdfObject.TEXT_UNICODE));
- dic.put(PdfName.SUBTYPE, new PdfName(subtype));
- usage.put(PdfName.CREATORINFO, dic);
- }
-
- /**
- * Specifies the language of the content controlled by this
- * optional content group
- * @param lang a language string which specifies a language and possibly a locale
- * (for example, <B>es-MX</B> represents Mexican Spanish)
- * @param preferred used by viewer applications when there is a partial match but no exact
- * match between the system language and the language strings in all usage dictionaries
- */
- public void setLanguage(String lang, boolean preferred) {
- PdfDictionary usage = getUsage();
- PdfDictionary dic = new PdfDictionary();
- dic.put(PdfName.LANG, new PdfString(lang, PdfObject.TEXT_UNICODE));
- if (preferred)
- dic.put(PdfName.PREFERRED, PdfName.ON);
- usage.put(PdfName.LANGUAGE, dic);
- }
-
- /**
- * Specifies the recommended state for content in this
- * group when the document (or part of it) is saved by a viewer application to a format
- * that does not support optional content (for example, an earlier version of
- * PDF or a raster image format).
- * @param export the export state
- */
- public void setExport(boolean export) {
- PdfDictionary usage = getUsage();
- PdfDictionary dic = new PdfDictionary();
- dic.put(PdfName.EXPORTSTATE, export ? PdfName.ON : PdfName.OFF);
- usage.put(PdfName.EXPORT, dic);
- }
-
- /**
- * Specifies a range of magnifications at which the content
- * in this optional content group is best viewed.
- * @param min the minimum recommended magnification factors at which the group
- * should be ON. A negative value will set the default to 0
- * @param max the maximum recommended magnification factor at which the group
- * should be ON. A negative value will set the largest possible magnification supported by the
- * viewer application
- */
- public void setZoom(float min, float max) {
- if (min <= 0 && max < 0)
- return;
- PdfDictionary usage = getUsage();
- PdfDictionary dic = new PdfDictionary();
- if (min > 0)
- dic.put(PdfName.MIN, new PdfNumber(min));
- if (max >= 0)
- dic.put(PdfName.MAX, new PdfNumber(max));
- usage.put(PdfName.ZOOM, dic);
- }
-
- /**
- * Specifies that the content in this group is intended for
- * use in printing
- * @param subtype a name specifying the kind of content controlled by the group;
- * for example, <B>Trapping</B>, <B>PrintersMarks</B> and <B>Watermark</B>
- * @param printstate indicates that the group should be
- * set to that state when the document is printed from a viewer application
- */
- public void setPrint(String subtype, boolean printstate) {
- PdfDictionary usage = getUsage();
- PdfDictionary dic = new PdfDictionary();
- dic.put(PdfName.SUBTYPE, new PdfName(subtype));
- dic.put(PdfName.PRINTSTATE, printstate ? PdfName.ON : PdfName.OFF);
- usage.put(PdfName.PRINT, dic);
- }
-
- /**
- * Indicates that the group should be set to that state when the
- * document is opened in a viewer application.
- * @param view the view state
- */
- public void setView(boolean view) {
- PdfDictionary usage = getUsage();
- PdfDictionary dic = new PdfDictionary();
- dic.put(PdfName.VIEWSTATE, view ? PdfName.ON : PdfName.OFF);
- usage.put(PdfName.VIEW, dic);
- }
-
- /**
- * Gets the layer visibility in Acrobat's layer panel
- * @return the layer visibility in Acrobat's layer panel
- */
- public boolean isOnPanel() {
- return this.onPanel;
- }
-
- /**
- * Sets the visibility of the layer in Acrobat's layer panel. If <CODE>false</CODE>
- * the layer cannot be directly manipulated by the user. Note that any children layers will
- * also be absent from the panel.
- * @param onPanel the visibility of the layer in Acrobat's layer panel
- */
- public void setOnPanel(boolean onPanel) {
- this.onPanel = onPanel;
- }
-
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfLayerMembership.java b/LibrarySource/com/lowagie/text/pdf/PdfLayerMembership.java
deleted file mode 100644
index c899134..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfLayerMembership.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright 2004 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Collection;
-
-/**
- * Content typically belongs to a single optional content group,
- * and is visible when the group is <B>ON</B> and invisible when it is <B>OFF</B>. To express more
- * complex visibility policies, content should not declare itself to belong to an optional
- * content group directly, but rather to an optional content membership dictionary
- * represented by this class.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class PdfLayerMembership extends PdfDictionary implements PdfOCG {
-
- /**
- * Visible only if all of the entries are <B>ON</B>.
- */
- public static PdfName ALLON = new PdfName("AllOn");
- /**
- * Visible if any of the entries are <B>ON</B>.
- */
- public static PdfName ANYON = new PdfName("AnyOn");
- /**
- * Visible if any of the entries are <B>OFF</B>.
- */
- public static PdfName ANYOFF = new PdfName("AnyOff");
- /**
- * Visible only if all of the entries are <B>OFF</B>.
- */
- public static PdfName ALLOFF = new PdfName("AllOff");
-
- PdfIndirectReference ref;
- PdfArray members = new PdfArray();
- HashSet layers = new HashSet();
-
- /**
- * Creates a new, empty, membership layer.
- * @param writer the writer
- */
- public PdfLayerMembership(PdfWriter writer) {
- super(PdfName.OCMD);
- put(PdfName.OCGS, members);
- ref = writer.getPdfIndirectReference();
- }
-
- /**
- * Gets the <CODE>PdfIndirectReference</CODE> that represents this membership layer.
- * @return the <CODE>PdfIndirectReference</CODE> that represents this layer
- */
- public PdfIndirectReference getRef() {
- return ref;
- }
-
- /**
- * Adds a new member to the layer.
- * @param layer the new member to the layer
- */
- public void addMember(PdfLayer layer) {
- if (!layers.contains(layer)) {
- members.add(layer.getRef());
- layers.add(layer);
- }
- }
-
- /**
- * Gets the member layers.
- * @return the member layers
- */
- public Collection getLayers() {
- return layers;
- }
-
- /**
- * Sets the visibility policy for content belonging to this
- * membership dictionary. Possible values are ALLON, ANYON, ANYOFF and ALLOFF.
- * The default value is ANYON.
- * @param type the visibility policy
- */
- public void setVisibilityPolicy(PdfName type) {
- put(PdfName.P, type);
- }
-
- /**
- * Gets the dictionary representing the membership layer. It just returns <CODE>this</CODE>.
- * @return the dictionary representing the layer
- */
- public PdfObject getPdfObject() {
- return this;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfLine.java b/LibrarySource/com/lowagie/text/pdf/PdfLine.java
deleted file mode 100644
index 60f8b62..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfLine.java
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- * $Id: PdfLine.java,v 1.65 2005/04/08 07:33:22 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import com.lowagie.text.Element;
-import com.lowagie.text.ListItem;
-
-/**
- * <CODE>PdfLine</CODE> defines an array with <CODE>PdfChunk</CODE>-objects
- * that fit into 1 line.
- */
-
-public class PdfLine {
-
- // membervariables
-
- /** The arraylist containing the chunks. */
- protected ArrayList line;
-
- /** The left indentation of the line. */
- protected float left;
-
- /** The width of the line. */
- protected float width;
-
- /** The alignment of the line. */
- protected int alignment;
-
- /** The heigth of the line. */
- protected float height;
-
- /** The listsymbol (if necessary). */
- protected PdfChunk listSymbol = null;
-
- /** The listsymbol (if necessary). */
- protected float symbolIndent;
-
- /** <CODE>true</CODE> if the chunk splitting was caused by a newline. */
- protected boolean newlineSplit = false;
-
- /** The original width. */
- protected float originalWidth;
-
- protected boolean isRTL = false;
-
- // constructors
-
- /**
- * Constructs a new <CODE>PdfLine</CODE>-object.
- *
- * @param left the limit of the line at the left
- * @param right the limit of the line at the right
- * @param alignment the alignment of the line
- * @param height the height of the line
- */
-
- PdfLine(float left, float right, int alignment, float height) {
- this.left = left;
- this.width = right - left;
- this.originalWidth = this.width;
- this.alignment = alignment;
- this.height = height;
- this.line = new ArrayList();
- }
-
- PdfLine(float left, float remainingWidth, int alignment, boolean newlineSplit, ArrayList line, boolean isRTL) {
- this.left = left;
- this.width = remainingWidth;
- this.alignment = alignment;
- this.line = line;
- this.newlineSplit = newlineSplit;
- this.isRTL = isRTL;
- }
-
- // methods
-
- /**
- * Adds a <CODE>PdfChunk</CODE> to the <CODE>PdfLine</CODE>.
- *
- * @param chunk the <CODE>PdfChunk</CODE> to add
- * @return <CODE>null</CODE> if the chunk could be added completely; if not
- * a <CODE>PdfChunk</CODE> containing the part of the chunk that could
- * not be added is returned
- */
-
- PdfChunk add(PdfChunk chunk) {
- // nothing happens if the chunk is null.
- if (chunk == null || chunk.toString().equals("")) {
- return null;
- }
-
- // we split the chunk to be added
- PdfChunk overflow = chunk.split(width);
- newlineSplit = (chunk.isNewlineSplit() || overflow == null);
- // if (chunk.isNewlineSplit() && alignment == Element.ALIGN_JUSTIFIED)
- // alignment = Element.ALIGN_LEFT;
-
-
- // if the length of the chunk > 0 we add it to the line
- if (chunk.length() > 0) {
- if (overflow != null)
- chunk.trimLastSpace();
- width -= chunk.width();
- line.add(chunk);
- }
-
- // if the length == 0 and there were no other chunks added to the line yet,
- // we risk to end up in an endless loop trying endlessly to add the same chunk
- else if (line.size() < 1) {
- chunk = overflow;
- overflow = chunk.truncate(width);
- width -= chunk.width();
- if (chunk.length() > 0) {
- line.add(chunk);
- return overflow;
- }
- // if the chunck couldn't even be truncated, we add everything, so be it
- else {
- if (overflow != null)
- line.add(overflow);
- return null;
- }
- }
- else {
- width += ((PdfChunk)(line.get(line.size() - 1))).trimLastSpace();
- }
- return overflow;
- }
-
- // methods to retrieve information
-
- /**
- * Returns the number of chunks in the line.
- *
- * @return a value
- */
-
- public int size() {
- return line.size();
- }
-
- /**
- * Returns an iterator of <CODE>PdfChunk</CODE>s.
- *
- * @return an <CODE>Iterator</CODE>
- */
-
- public Iterator iterator() {
- return line.iterator();
- }
-
- /**
- * Returns the height of the line.
- *
- * @return a value
- */
-
- float height() {
- return height;
- }
-
- /**
- * Returns the left indentation of the line taking the alignment of the line into account.
- *
- * @return a value
- */
-
- float indentLeft() {
- if (isRTL) {
- switch (alignment) {
- case Element.ALIGN_LEFT:
- return left + width;
- case Element.ALIGN_CENTER:
- return left + (width / 2f);
- default:
- return left;
- }
- }
- else {
- switch (alignment) {
- case Element.ALIGN_RIGHT:
- return left + width;
- case Element.ALIGN_CENTER:
- return left + (width / 2f);
- default:
- return left;
- }
- }
- }
-
- /**
- * Checks if this line has to be justified.
- *
- * @return <CODE>true</CODE> if the alignment equals <VAR>ALIGN_JUSTIFIED</VAR> and there is some width left.
- */
-
- public boolean hasToBeJustified() {
- return ((alignment == Element.ALIGN_JUSTIFIED || alignment == Element.ALIGN_JUSTIFIED_ALL) && width != 0);
- }
-
- /**
- * Resets the alignment of this line.
- * <P>
- * The alignment of the last line of for instance a <CODE>Paragraph</CODE>
- * that has to be justified, has to be reset to <VAR>ALIGN_LEFT</VAR>.
- */
-
- public void resetAlignment() {
- if (alignment == Element.ALIGN_JUSTIFIED) {
- alignment = Element.ALIGN_LEFT;
- }
- }
-
- /**
- * Returns the width that is left, after a maximum of characters is added to the line.
- *
- * @return a value
- */
-
- float widthLeft() {
- return width;
- }
-
- /**
- * Returns the number of space-characters in this line.
- *
- * @return a value
- */
-
- int numberOfSpaces() {
- String string = toString();
- int length = string.length();
- int numberOfSpaces = 0;
- for (int i = 0; i < length; i++) {
- if (string.charAt(i) == ' ') {
- numberOfSpaces++;
- }
- }
- return numberOfSpaces;
- }
-
- /**
- * Sets the listsymbol of this line.
- * <P>
- * This is only necessary for the first line of a <CODE>ListItem</CODE>.
- *
- * @param listItem the list symbol
- */
-
- public void setListItem(ListItem listItem) {
- this.listSymbol = new PdfChunk(listItem.listSymbol(), null);
- this.symbolIndent = listItem.indentationLeft();
- }
-
- /**
- * Returns the listsymbol of this line.
- *
- * @return a <CODE>PdfChunk</CODE> if the line has a listsymbol; <CODE>null</CODE> otherwise
- */
-
- public PdfChunk listSymbol() {
- return listSymbol;
- }
-
- /**
- * Return the indentation needed to show the listsymbol.
- *
- * @return a value
- */
-
- public float listIndent() {
- return symbolIndent;
- }
-
- /**
- * Get the string representation of what is in this line.
- *
- * @return a <CODE>String</CODE>
- */
-
- public String toString() {
- StringBuffer tmp = new StringBuffer();
- for (Iterator i = line.iterator(); i.hasNext(); ) {
- tmp.append(((PdfChunk) i.next()).toString());
- }
- return tmp.toString();
- }
-
- /**
- * Checks if a newline caused the line split.
- * @return <CODE>true</CODE> if a newline caused the line split
- */
- public boolean isNewlineSplit() {
- return newlineSplit && (alignment != Element.ALIGN_JUSTIFIED_ALL);
- }
-
- /**
- * Gets the index of the last <CODE>PdfChunk</CODE> with metric attributes
- * @return the last <CODE>PdfChunk</CODE> with metric attributes
- */
- public int getLastStrokeChunk() {
- int lastIdx = line.size() - 1;
- for (; lastIdx >= 0; --lastIdx) {
- PdfChunk chunk = (PdfChunk)line.get(lastIdx);
- if (chunk.isStroked())
- break;
- }
- return lastIdx;
- }
-
- /**
- * Gets a <CODE>PdfChunk</CODE> by index.
- * @param idx the index
- * @return the <CODE>PdfChunk</CODE> or null if beyond the array
- */
- public PdfChunk getChunk(int idx) {
- if (idx < 0 || idx >= line.size())
- return null;
- return (PdfChunk)line.get(idx);
- }
-
- /**
- * Gets the original width of the line.
- * @return the original width of the line
- */
- public float getOriginalWidth() {
- return originalWidth;
- }
-
- /**
- * Gets the maximum size of all the fonts used in this line
- * including images (if there are images in the line and if
- * the leading has to be changed).
- * @return maximum size of all the fonts used in this line
- */
- float getMaxSize() {
- float maxSize = 0;
- for (int k = 0; k < line.size(); ++k) {
- PdfChunk chunk = (PdfChunk)line.get(k);
- if (!chunk.isImage() || !chunk.changeLeading()) {
- maxSize = Math.max(chunk.font().size(), maxSize);
- }
- else {
- maxSize = Math.max(chunk.getImage().scaledHeight() + chunk.getImageOffsetY() , maxSize);
- }
- }
- return maxSize;
- }
-
- /**
- * Gets the maximum size of all the fonts used in this line
- * including images.
- * @return maximum size of all the fonts used in this line
- */
- float getMaxSizeSimple() {
- float maxSize = 0;
- for (int k = 0; k < line.size(); ++k) {
- PdfChunk chunk = (PdfChunk)line.get(k);
- if (!chunk.isImage()) {
- maxSize = Math.max(chunk.font().size(), maxSize);
- }
- else {
- maxSize = Math.max(chunk.getImage().scaledHeight() + chunk.getImageOffsetY() , maxSize);
- }
- }
- return maxSize;
- }
-
- boolean isRTL() {
- return isRTL;
- }
-
- /**
- * Gets a width corrected with a charSpacing and wordSpacing.
- * @param charSpacing
- * @param wordSpacing
- * @return a corrected width
- */
- public float getWidthCorrected(float charSpacing, float wordSpacing) {
- float total = 0;
- for (int k = 0; k < line.size(); ++k) {
- PdfChunk ck = (PdfChunk)line.get(k);
- total += ck.getWidthCorrected(charSpacing, wordSpacing);
- }
- return total;
- }
-
-/**
- * Gets the maximum size of the ascender for all the fonts used
- * in this line.
- * @return maximum size of all the ascenders used in this line
- */
- public float getAscender() {
- float ascender = 0;
- for (int k = 0; k < line.size(); ++k) {
- PdfChunk ck = (PdfChunk)line.get(k);
- if (ck.isImage())
- ascender = Math.max(ascender, ck.getImage().scaledHeight() + ck.getImageOffsetY());
- else {
- PdfFont font = ck.font();
- ascender = Math.max(ascender, font.getFont().getFontDescriptor(BaseFont.ASCENT, font.size()));
- }
- }
- return ascender;
- }
-
-/**
- * Gets the biggest descender for all the fonts used
- * in this line. Note that this is a negative number.
- * @return maximum size of all the ascenders used in this line
- */
- public float getDescender() {
- float descender = 0;
- for (int k = 0; k < line.size(); ++k) {
- PdfChunk ck = (PdfChunk)line.get(k);
- if (ck.isImage())
- descender = Math.min(descender, ck.getImageOffsetY());
- else {
- PdfFont font = ck.font();
- descender = Math.min(descender, font.getFont().getFontDescriptor(BaseFont.DESCENT, font.size()));
- }
- }
- return descender;
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfLister.java b/LibrarySource/com/lowagie/text/pdf/PdfLister.java
deleted file mode 100644
index fc6932f..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfLister.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * $Id: PdfLister.java,v 1.33 2005/02/01 14:30:50 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * This class by Mark Thompson. Copyright (C) 2002 Mark Thompson
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
- package com.lowagie.text.pdf;
-
-import java.io.*;
-import java.util.Iterator;
-/**
- * List a PDF file in human-readable form (for debugging reasons mostly)
- * @author Mark Thompson
- */
-
-public class PdfLister {
-
- /** the printStream you want to write the output to. */
- PrintStream out;
-
- /**
- * Create a new lister object.
- * @param out
- */
- public PdfLister(PrintStream out) {
- this.out = out;
- }
-
- /**
- * Visualizes a PDF object.
- * @param object a com.lowagie.text.pdf object
- */
- public void listAnyObject(PdfObject object)
- {
- switch (object.type()) {
- case PdfObject.ARRAY:
- listArray((PdfArray)object);
- break;
- case PdfObject.DICTIONARY:
- listDict((PdfDictionary) object);
- break;
- case PdfObject.STRING:
- out.println("(" + object.toString() + ")");
- break;
- default:
- out.println(object.toString());
- break;
- }
- }
- /**
- * Visualizes a PdfDictionary object.
- * @param dictionary a com.lowagie.text.pdf.PdfDictionary object
- */
- public void listDict(PdfDictionary dictionary)
- {
- out.println("<<");
- PdfName key;
- PdfObject value;
- for (Iterator i = dictionary.getKeys().iterator(); i.hasNext(); ) {
- key = (PdfName) i.next();
- value = (PdfObject) dictionary.get(key);
- out.print(key.toString());
- out.print(' ');
- listAnyObject(value);
- }
- out.println(">>");
- }
-
- /**
- * Visualizes a PdfArray object.
- * @param array a com.lowagie.text.pdf.PdfArray object
- */
- public void listArray(PdfArray array)
- {
- out.println('[');
- for (Iterator i = array.getArrayList().iterator(); i.hasNext(); ) {
- PdfObject item = (PdfObject)i.next();
- listAnyObject(item);
- }
- out.println(']');
- }
- /**
- * Visualizes a Stream.
- * @param stream
- * @param reader
- */
- public void listStream(PRStream stream, PdfReaderInstance reader)
- {
- try {
- listDict(stream);
- out.println("startstream");
- byte[] b = PdfReader.getStreamBytes(stream);
-// byte buf[] = new byte[Math.min(stream.getLength(), 4096)];
-// int r = 0;
-// stream.openStream(reader);
-// for (;;) {
-// r = stream.readStream(buf, 0, buf.length);
-// if (r == 0) break;
-// out.write(buf, 0, r);
-// }
-// stream.closeStream();
- int len = b.length - 1;
- for (int k = 0; k < len; ++k) {
- if (b[k] == '\r' && b[k + 1] != '\n')
- b[k] = (byte)'\n';
- }
- out.println(new String(b));
- out.println("endstream");
- } catch (IOException e) {
- System.err.println("I/O exception: " + e);
-// } catch (java.util.zip.DataFormatException e) {
-// System.err.println("Data Format Exception: " + e);
- }
- }
- /**
- * Visualizes an imported page
- * @param iPage
- */
- public void listPage(PdfImportedPage iPage)
- {
- int pageNum = iPage.getPageNumber();
- PdfReaderInstance readerInst = iPage.getPdfReaderInstance();
- PdfReader reader = readerInst.getReader();
-
- PdfDictionary page = reader.getPageN(pageNum);
- listDict(page);
- PdfObject obj = PdfReader.getPdfObject(page.get(PdfName.CONTENTS));
- switch (obj.type) {
- case PdfObject.STREAM:
- listStream((PRStream)obj, readerInst);
- break;
- case PdfObject.ARRAY:
- for (Iterator i = ((PdfArray)obj).getArrayList().iterator(); i.hasNext();) {
- PdfObject o = PdfReader.getPdfObject((PdfObject)i.next());
- listStream((PRStream)o, readerInst);
- out.println("-----------");
- }
- break;
- }
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfLiteral.java b/LibrarySource/com/lowagie/text/pdf/PdfLiteral.java
deleted file mode 100644
index b64a823..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfLiteral.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * $Id: PdfLiteral.java,v 1.21 2002/06/20 13:30:25 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/**
- * a Literal
- */
-
-public class PdfLiteral extends PdfObject {
-
- /**
- * Holds value of property position.
- */
- private int position;
-
- public PdfLiteral(String text) {
- super(0, text);
- }
-
- public PdfLiteral(byte b[]) {
- super(0, b);
- }
-
- public PdfLiteral(int size) {
- super(0, (byte[])null);
- bytes = new byte[size];
- java.util.Arrays.fill(bytes, (byte)32);
- }
-
- public PdfLiteral(int type, String text) {
- super(type, text);
- }
-
- public PdfLiteral(int type, byte b[]) {
- super(type, b);
- }
-
- public void toPdf(PdfWriter writer, java.io.OutputStream os) throws java.io.IOException {
- if (os instanceof OutputStreamCounter)
- position = ((OutputStreamCounter)os).getCounter();
- super.toPdf(writer, os);
- }
-
- /**
- * Getter for property position.
- * @return Value of property position.
- */
- public int getPosition() {
- return this.position;
- }
-
- /**
- * Getter for property posLength.
- * @return Value of property posLength.
- */
- public int getPosLength() {
- if (bytes != null)
- return bytes.length;
- else
- return 0;
- }
-
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfMediaClipData.java b/LibrarySource/com/lowagie/text/pdf/PdfMediaClipData.java
deleted file mode 100644
index 8fbd689..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfMediaClipData.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2003 Galo Gimenez
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import java.io.IOException;
-
-public class PdfMediaClipData extends PdfDictionary {
-
- PdfMediaClipData(String file, PdfFileSpecification fs, String mimeType) throws IOException {
- put(PdfName.TYPE,new PdfName("MediaClip"));
- put(PdfName.S, new PdfName("MCD"));
- put(PdfName.N, new PdfString("Media clip for "+file));
- put(new PdfName("CT"), new PdfString(mimeType));
- PdfDictionary dic = new PdfDictionary();
- dic.put(new PdfName("TF"), new PdfString("TEMPACCESS"));
- put(new PdfName("P"), dic);
- put(PdfName.D, fs.getReference());
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfName.java b/LibrarySource/com/lowagie/text/pdf/PdfName.java
deleted file mode 100644
index c4cbb40..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfName.java
+++ /dev/null
@@ -1,1093 +0,0 @@
-/*
- * $Id: PdfName.java,v 1.34 2002/07/09 11:28:23 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/**
- * <CODE>PdfName</CODE> is an object that can be used as a name in a PDF-file.
- * <P>
- * A name, like a string, is a sequence of characters. It must begin with a slash
- * followed by a sequence of ASCII characters in the range 32 through 136 except
- * %, (, ), [, ], <, >, {, }, / and #. Any character except 0x00 may be included
- * in a name by writing its twocharacter hex code, preceded by #. The maximum number
- * of characters in a name is 127.<BR>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 4.5 (page 39-40).
- * <P>
- *
- * @see PdfObject
- * @see PdfDictionary
- * @see BadPdfFormatException
- */
-
-public class PdfName extends PdfObject implements Comparable{
-
- // static membervariables (a variety of standard names used in PDF)
-
- /** A name */
- public static final PdfName A = new PdfName("A");
- /** A name */
- public static final PdfName AA = new PdfName("AA");
- /** A name */
- public static final PdfName ABSOLUTECALORIMETRIC = new PdfName("AbsoluteColorimetric");
- /** A name */
- public static final PdfName AC = new PdfName("AC");
- /** A name */
- public static final PdfName ACROFORM = new PdfName("AcroForm");
- /** A name */
- public static final PdfName ACTION = new PdfName("Action");
- /** A name */
- public static final PdfName ADBE_PKCS7_DETACHED = new PdfName("adbe.pkcs7.detached");
- /** A name */
- public static final PdfName ADBE_PKCS7_SHA1 = new PdfName("adbe.pkcs7.sha1");
- /** A name */
- public static final PdfName ADBE_X509_RSA_SHA1 = new PdfName("adbe.x509.rsa_sha1");
- /** A name */
- public static final PdfName ADOBE_PPKLITE = new PdfName("Adobe.PPKLite");
- /** A name */
- public static final PdfName ADOBE_PPKMS = new PdfName("Adobe.PPKMS");
- /** A name */
- public static final PdfName AIS = new PdfName("AIS");
- /** A name */
- public static final PdfName ALLPAGES = new PdfName("AllPages");
- /** A name */
- public static final PdfName ALTERNATE = new PdfName("Alternate");
- /** A name */
- public static final PdfName ANNOT = new PdfName("Annot");
- /** A name */
- public static final PdfName ANTIALIAS = new PdfName("AntiAlias");
- /** A name */
- public static final PdfName ANNOTS = new PdfName("Annots");
- /** A name */
- public static final PdfName AP = new PdfName("AP");
- /** A name */
- public static final PdfName ARTBOX = new PdfName("ArtBox");
- /** A name */
- public static final PdfName ASCENT = new PdfName("Ascent");
- /** A name */
- public static final PdfName AS = new PdfName("AS");
- /** A name */
- public static final PdfName ASCII85DECODE = new PdfName("ASCII85Decode");
- /** A name */
- public static final PdfName ASCIIHEXDECODE = new PdfName("ASCIIHexDecode");
- /** A name */
- public static final PdfName AUTHOR = new PdfName("Author");
- /** A name */
- public static final PdfName B = new PdfName("B");
- /** A name */
- public static final PdfName BASEENCODING = new PdfName("BaseEncoding");
- /** A name */
- public static final PdfName BASEFONT = new PdfName("BaseFont");
- /** A name */
- public static final PdfName BBOX = new PdfName("BBox");
- /** A name */
- public static final PdfName BC = new PdfName("BC");
- /** A name */
- public static final PdfName BG = new PdfName("BG");
- /** A name */
- public static final PdfName BIGFIVE = new PdfName("BigFive");
- /** A name */
- public static final PdfName BITSPERCOMPONENT = new PdfName("BitsPerComponent");
- /** A name */
- public static final PdfName BITSPERSAMPLE = new PdfName("BitsPerSample");
- /** A name */
- public static final PdfName BL = new PdfName("Bl");
- /** A name */
- public static final PdfName BLACKIS1 = new PdfName("BlackIs1");
- /** A name */
- public static final PdfName BLACKPOINT = new PdfName("BlackPoint");
- /** A name */
- public static final PdfName BLEEDBOX = new PdfName("BleedBox");
- /** A name */
- public static final PdfName BLINDS = new PdfName("Blinds");
- /** A name */
- public static final PdfName BM = new PdfName("BM");
- /** A name */
- public static final PdfName BORDER = new PdfName("Border");
- /** A name */
- public static final PdfName BOUNDS = new PdfName("Bounds");
- /** A name */
- public static final PdfName BOX = new PdfName("Box");
- /** A name */
- public static final PdfName BS = new PdfName("BS");
- /** A name */
- public static final PdfName BTN = new PdfName("Btn");
- /** A name */
- public static final PdfName BYTERANGE = new PdfName("ByteRange");
- /** A name */
- public static final PdfName C = new PdfName("C");
- /** A name */
- public static final PdfName C0 = new PdfName("C0");
- /** A name */
- public static final PdfName C1 = new PdfName("C1");
- /** A name */
- public static final PdfName CA = new PdfName("CA");
- /** A name */
- public static final PdfName ca = new PdfName("ca");
- /** A name */
- public static final PdfName CALGRAY = new PdfName("CalGray");
- /** A name */
- public static final PdfName CALRGB = new PdfName("CalRGB");
- /** A name */
- public static final PdfName CAPHEIGHT = new PdfName("CapHeight");
- /** A name */
- public static final PdfName CATALOG = new PdfName("Catalog");
- /** A name */
- public static final PdfName CATEGORY = new PdfName("Category");
- /** A name */
- public static final PdfName CCITTFAXDECODE = new PdfName("CCITTFaxDecode");
- /** A name */
- public static final PdfName CENTERWINDOW = new PdfName("CenterWindow");
- /** A name */
- public static final PdfName CERT = new PdfName("Cert");
- /** A name */
- public static final PdfName CH = new PdfName("Ch");
- /** A name */
- public static final PdfName CIDFONTTYPE0 = new PdfName("CIDFontType0");
- /** A name */
- public static final PdfName CIDFONTTYPE2 = new PdfName("CIDFontType2");
- /** A name */
- public static final PdfName CIDSYSTEMINFO = new PdfName("CIDSystemInfo");
- /** A name */
- public static final PdfName CIDTOGIDMAP = new PdfName("CIDToGIDMap");
- /** A name */
- public static final PdfName CIRCLE = new PdfName("Circle");
- /** A name */
- public static final PdfName CO = new PdfName("CO");
- /** A name */
- public static final PdfName COLORS = new PdfName("Colors");
- /** A name */
- public static final PdfName COLORSPACE = new PdfName("ColorSpace");
- /** A name */
- public static final PdfName COLUMNS = new PdfName("Columns");
- /** A name */
- public static final PdfName CONTACTINFO = new PdfName("ContactInfo");
- /** A name */
- public static final PdfName CONTENT = new PdfName("Content");
- /** A name */
- public static final PdfName CONTENTS = new PdfName("Contents");
- /** A name */
- public static final PdfName COORDS = new PdfName("Coords");
- /** A name */
- public static final PdfName COUNT = new PdfName("Count");
- /** A name of a base 14 type 1 font */
- public static final PdfName COURIER = new PdfName("Courier");
- /** A name of a base 14 type 1 font */
- public static final PdfName COURIER_BOLD = new PdfName("Courier-Bold");
- /** A name of a base 14 type 1 font */
- public static final PdfName COURIER_OBLIQUE = new PdfName("Courier-Oblique");
- /** A name of a base 14 type 1 font */
- public static final PdfName COURIER_BOLDOBLIQUE = new PdfName("Courier-BoldOblique");
- /** A name */
- public static final PdfName CREATIONDATE = new PdfName("CreationDate");
- /** A name */
- public static final PdfName CREATOR = new PdfName("Creator");
- /** A name */
- public static final PdfName CREATORINFO = new PdfName("CreatorInfo");
- /** A name */
- public static final PdfName CROPBOX = new PdfName("CropBox");
- /** A name */
- public static final PdfName CS = new PdfName("CS");
- /** A name */
- public static final PdfName D = new PdfName("D");
- /** A name */
- public static final PdfName DA = new PdfName("DA");
- /** A name */
- public static final PdfName DC = new PdfName("DC");
- /** A name */
- public static final PdfName DCTDECODE = new PdfName("DCTDecode");
- /** A name */
- public static final PdfName DECODE = new PdfName("Decode");
- /** A name */
- public static final PdfName DECODEPARMS = new PdfName("DecodeParms");
- /** A name */
- public static final PdfName DEFAULTCMYK = new PdfName("DefaultCMYK");
- /** A name */
- public static final PdfName DEFAULTGRAY = new PdfName("DefaultGray");
- /** A name */
- public static final PdfName DEFAULTRGB = new PdfName("DefaultRGB");
- /** A name */
- public static final PdfName DESCENDANTFONTS = new PdfName("DescendantFonts");
- /** A name */
- public static final PdfName DESCENT = new PdfName("Descent");
- /** A name */
- public static final PdfName DEST = new PdfName("Dest");
- /** A name */
- public static final PdfName DESTOUTPUTPROFILE = new PdfName("DestOutputProfile");
- /** A name */
- public static final PdfName DESTS = new PdfName("Dests");
- /** A name */
- public static final PdfName DEVICEGRAY = new PdfName("DeviceGray");
- /** A name */
- public static final PdfName DEVICERGB = new PdfName("DeviceRGB");
- /** A name */
- public static final PdfName DEVICECMYK = new PdfName("DeviceCMYK");
- /** A name */
- public static final PdfName DI = new PdfName("Di");
- /** A name */
- public static final PdfName DIFFERENCES = new PdfName("Differences");
- /** A name */
- public static final PdfName DISSOLVE = new PdfName("Dissolve");
- /** A name */
- public static final PdfName DIRECTION = new PdfName("Direction");
- /** A name */
- public static final PdfName DISPLAYDOCTITLE = new PdfName("DisplayDocTitle");
- /** A name */
- public static final PdfName DM = new PdfName("Dm");
- /** A name */
- public static final PdfName DOMAIN = new PdfName("Domain");
- /** A name */
- public static final PdfName DP = new PdfName("DP");
- /** A name */
- public static final PdfName DR = new PdfName("DR");
- /** A name */
- public static final PdfName DS = new PdfName("DS");
- /** A name */
- public static final PdfName DUR = new PdfName("Dur");
- /** A name */
- public static final PdfName DV = new PdfName("DV");
- /** A name */
- public static final PdfName DW = new PdfName("DW");
- /** A name */
- public static final PdfName E = new PdfName("E");
- /** A name */
- public static final PdfName EARLYCHANGE = new PdfName("EarlyChange");
- /** A name */
- public static final PdfName EF = new PdfName("EF");
- /** A name */
- public static final PdfName EMBEDDEDFILE = new PdfName("EmbeddedFile");
- /** A name */
- public static final PdfName ENCODE = new PdfName("Encode");
- /** A name */
- public static final PdfName ENCODEDBYTEALIGN = new PdfName("EncodedByteAlign");
- /** A name */
- public static final PdfName ENCODING = new PdfName("Encoding");
- /** A name */
- public static final PdfName ENCRYPT = new PdfName("Encrypt");
- /** A name */
- public static final PdfName ENDOFBLOCK = new PdfName("EndOfBlock");
- /** A name */
- public static final PdfName ENDOFLINE = new PdfName("EndOfLine");
- /** A name */
- public static final PdfName EXTEND = new PdfName("Extend");
- /** A name */
- public static final PdfName EXTGSTATE = new PdfName("ExtGState");
- /** A name */
- public static final PdfName EXPORT = new PdfName("Export");
- /** A name */
- public static final PdfName EXPORTSTATE = new PdfName("ExportState");
- /** A name */
- public static final PdfName EVENT = new PdfName("Event");
- /** A name */
- public static final PdfName F = new PdfName("F");
- /** A name */
- public static final PdfName FB = new PdfName("FB");
- /** A name */
- public static final PdfName FDECODEPARMS = new PdfName("FDecodeParms");
- /** A name */
- public static final PdfName FDF = new PdfName("FDF");
- /** A name */
- public static final PdfName FF = new PdfName("Ff");
- /** A name */
- public static final PdfName FFILTER = new PdfName("FFilter");
- /** A name */
- public static final PdfName FIELDS = new PdfName("Fields");
- /** A name */
- public static final PdfName FILEATTACHMENT = new PdfName("FileAttachment");
- /** A name */
- public static final PdfName FILESPEC = new PdfName("Filespec");
- /** A name */
- public static final PdfName FILTER = new PdfName("Filter");
- /** A name */
- public static final PdfName FIRST = new PdfName("First");
- /** A name */
- public static final PdfName FIRSTCHAR = new PdfName("FirstChar");
- /** A name */
- public static final PdfName FIRSTPAGE = new PdfName("FirstPage");
- /** A name */
- public static final PdfName FIT = new PdfName("Fit");
- /** A name */
- public static final PdfName FITH = new PdfName("FitH");
- /** A name */
- public static final PdfName FITV = new PdfName("FitV");
- /** A name */
- public static final PdfName FITR = new PdfName("FitR");
- /** A name */
- public static final PdfName FITB = new PdfName("FitB");
- /** A name */
- public static final PdfName FITBH = new PdfName("FitBH");
- /** A name */
- public static final PdfName FITBV = new PdfName("FitBV");
- /** A name */
- public static final PdfName FITWINDOW = new PdfName("FitWindow");
- /** A name */
- public static final PdfName FLAGS = new PdfName("Flags");
- /** A name */
- public static final PdfName FLATEDECODE = new PdfName("FlateDecode");
- /** A name */
- public static final PdfName FO = new PdfName("Fo");
- /** A name */
- public static final PdfName FONT = new PdfName("Font");
- /** A name */
- public static final PdfName FONTBBOX = new PdfName("FontBBox");
- /** A name */
- public static final PdfName FONTDESCRIPTOR = new PdfName("FontDescriptor");
- /** A name */
- public static final PdfName FONTFILE = new PdfName("FontFile");
- /** A name */
- public static final PdfName FONTFILE2 = new PdfName("FontFile2");
- /** A name */
- public static final PdfName FONTFILE3 = new PdfName("FontFile3");
- /** A name */
- public static final PdfName FONTNAME = new PdfName("FontName");
- /** A name */
- public static final PdfName FORM = new PdfName("Form");
- /** A name */
- public static final PdfName FORMTYPE = new PdfName("FormType");
- /** A name */
- public static final PdfName FREETEXT = new PdfName("FreeText");
- /** A name */
- public static final PdfName FRM = new PdfName("FRM");
- /** A name */
- public static final PdfName FS = new PdfName("FS");
- /** A name */
- public static final PdfName FT = new PdfName("FT");
- /** A name */
- public static final PdfName FULLSCREEN = new PdfName("FullScreen");
- /** A name */
- public static final PdfName FUNCTION = new PdfName("Function");
- /** A name */
- public static final PdfName FUNCTIONS = new PdfName("Functions");
- /** A name */
- public static final PdfName FUNCTIONTYPE = new PdfName("FunctionType");
- /** A name of an attribute. */
- public static final PdfName GAMMA = new PdfName("Gamma");
- /** A name of an attribute. */
- public static final PdfName GBK = new PdfName("GBK");
- /** A name of an attribute. */
- public static final PdfName GLITTER = new PdfName("Glitter");
- /** A name of an attribute. */
- public static final PdfName GOTO = new PdfName("GoTo");
- /** A name of an attribute. */
- public static final PdfName GOTOR = new PdfName("GoToR");
- /** A name of an attribute. */
- public static final PdfName GROUP = new PdfName("Group");
- /** A name of an attribute. */
- public static final PdfName GTS_PDFX = new PdfName("GTS_PDFX");
- /** A name of an attribute. */
- public static final PdfName GTS_PDFXVERSION = new PdfName("GTS_PDFXVersion");
- /** A name of an attribute. */
- public static final PdfName H = new PdfName("H");
- /** A name of an attribute. */
- public static final PdfName HEIGHT = new PdfName("Height");
- /** A name of a base 14 type 1 font */
- public static final PdfName HELVETICA = new PdfName("Helvetica");
- /** A name of a base 14 type 1 font */
- public static final PdfName HELVETICA_BOLD = new PdfName("Helvetica-Bold");
- /** This is a static PdfName PdfName of a base 14 type 1 font */
- public static final PdfName HELVETICA_OBLIQUE = new PdfName("Helvetica-Oblique");
- /** This is a static PdfName PdfName of a base 14 type 1 font */
- public static final PdfName HELVETICA_BOLDOBLIQUE = new PdfName("Helvetica-BoldOblique");
- /** A name */
- public static final PdfName HID = new PdfName("Hid");
- /** A name */
- public static final PdfName HIDE = new PdfName("Hide");
- /** A name */
- public static final PdfName HIDEMENUBAR = new PdfName("HideMenubar");
- /** A name */
- public static final PdfName HIDETOOLBAR = new PdfName("HideToolbar");
- /** A name */
- public static final PdfName HIDEWINDOWUI = new PdfName("HideWindowUI");
- /** A name */
- public static final PdfName HIGHLIGHT = new PdfName("Highlight");
- /** A name */
- public static final PdfName I = new PdfName("I");
- /** A name */
- public static final PdfName ICCBASED = new PdfName("ICCBased");
- /** A name */
- public static final PdfName ID = new PdfName("ID");
- /** A name */
- public static final PdfName IDENTITY = new PdfName("Identity");
- /** A name */
- public static final PdfName IF = new PdfName("IF");
- /** A name */
- public static final PdfName IMAGE = new PdfName("Image");
- /** A name */
- public static final PdfName IMAGEB = new PdfName("ImageB");
- /** A name */
- public static final PdfName IMAGEC = new PdfName("ImageC");
- /** A name */
- public static final PdfName IMAGEI = new PdfName("ImageI");
- /** A name */
- public static final PdfName IMAGEMASK = new PdfName("ImageMask");
- /** A name */
- public static final PdfName INDEX = new PdfName("Index");
- /** A name */
- public static final PdfName INDEXED = new PdfName("Indexed");
- /** A name */
- public static final PdfName INFO = new PdfName("Info");
- /** A name */
- public static final PdfName INK = new PdfName("Ink");
- /** A name */
- public static final PdfName INKLIST = new PdfName("InkList");
- /** A name */
- public static final PdfName IMPORTDATA = new PdfName("ImportData");
- /** A name */
- public static final PdfName INTENT = new PdfName("Intent");
- /** A name */
- public static final PdfName INTERPOLATE = new PdfName("Interpolate");
- /** A name */
- public static final PdfName ISMAP = new PdfName("IsMap");
- /** A name */
- public static final PdfName IRT = new PdfName("IRT");
- /** A name */
- public static final PdfName ITALICANGLE = new PdfName("ItalicAngle");
- /** A name */
- public static final PdfName IX = new PdfName("IX");
- /** A name */
- public static final PdfName JAVASCRIPT = new PdfName("JavaScript");
- /** A name */
- public static final PdfName JS = new PdfName("JS");
- /** A name */
- public static final PdfName K = new PdfName("K");
- /** A name */
- public static final PdfName KEYWORDS = new PdfName("Keywords");
- /** A name */
- public static final PdfName KIDS = new PdfName("Kids");
- /** A name */
- public static final PdfName L = new PdfName("L");
- /** A name */
- public static final PdfName L2R = new PdfName("L2R");
- /** A name */
- public static final PdfName LANG = new PdfName("Lang");
- /** A name */
- public static final PdfName LANGUAGE = new PdfName("Language");
- /** A name */
- public static final PdfName LAST = new PdfName("Last");
- /** A name */
- public static final PdfName LASTCHAR = new PdfName("LastChar");
- /** A name */
- public static final PdfName LASTPAGE = new PdfName("LastPage");
- /** A name */
- public static final PdfName LAUNCH = new PdfName("Launch");
- /** A name */
- public static final PdfName LENGTH = new PdfName("Length");
- /** A name */
- public static final PdfName LENGTH1 = new PdfName("Length1");
- /** A name */
- public static final PdfName LIMITS = new PdfName("Limits");
- /** A name */
- public static final PdfName LINE = new PdfName("Line");
- /** A name */
- public static final PdfName LINK = new PdfName("Link");
- /** A name */
- public static final PdfName LISTMODE = new PdfName("ListMode");
- /** A name */
- public static final PdfName LOCATION = new PdfName("Location");
- /** A name */
- public static final PdfName LOCK = new PdfName("Lock");
- /** A name */
- public static final PdfName LZWDECODE = new PdfName("LZWDecode");
- /** A name */
- public static final PdfName M = new PdfName("M");
- /** A name */
- public static final PdfName MATRIX = new PdfName("Matrix");
- /** A name of an encoding */
- public static final PdfName MAC_EXPERT_ENCODING = new PdfName("MacExpertEncoding");
- /** A name of an encoding */
- public static final PdfName MAC_ROMAN_ENCODING = new PdfName("MacRomanEncoding");
- /** A name */
- public static final PdfName MASK = new PdfName("Mask");
- /** A name */
- public static final PdfName MAX = new PdfName("max");
- /** A name */
- public static final PdfName MAXLEN = new PdfName("MaxLen");
- /** A name */
- public static final PdfName MEDIABOX = new PdfName("MediaBox");
- /** A name */
- public static final PdfName METADATA = new PdfName("Metadata");
- /** A name */
- public static final PdfName MIN = new PdfName("min");
- /** A name */
- public static final PdfName MK = new PdfName("MK");
- /** A name */
- public static final PdfName MMTYPE1 = new PdfName("MMType1");
- /** A name */
- public static final PdfName MODDATE = new PdfName("ModDate");
- /** A name */
- public static final PdfName N = new PdfName("N");
- /** A name */
- public static final PdfName N0 = new PdfName("n0");
- /** A name */
- public static final PdfName N1 = new PdfName("n1");
- /** A name */
- public static final PdfName N2 = new PdfName("n2");
- /** A name */
- public static final PdfName N3 = new PdfName("n3");
- /** A name */
- public static final PdfName N4 = new PdfName("n4");
- /** A name */
- public static final PdfName NAME = new PdfName("Name");
- /** A name */
- public static final PdfName NAMED = new PdfName("Named");
- /** A name */
- public static final PdfName NAMES = new PdfName("Names");
- /** A name */
- public static final PdfName NEEDAPPEARANCES = new PdfName("NeedAppearances");
- /** A name */
- public static final PdfName NEWWINDOW = new PdfName("NewWindow");
- /** A name */
- public static final PdfName NEXT = new PdfName("Next");
- /** A name */
- public static final PdfName NEXTPAGE = new PdfName("NextPage");
- /** A name */
- public static final PdfName NM = new PdfName("NM");
- /** A name */
- public static final PdfName NONE = new PdfName("None");
- /** A name */
- public static final PdfName NONFULLSCREENPAGEMODE = new PdfName("NonFullScreenPageMode");
- /** A name */
- public static final PdfName NUMS = new PdfName("Nums");
- /** A name */
- public static final PdfName O = new PdfName("O");
- /** A name */
- public static final PdfName OBJSTM = new PdfName("ObjStm");
- /** A name */
- public static final PdfName OC = new PdfName("OC");
- /** A name */
- public static final PdfName OCG = new PdfName("OCG");
- /** A name */
- public static final PdfName OCGS = new PdfName("OCGs");
- /** A name */
- public static final PdfName OCMD = new PdfName("OCMD");
- /** A name */
- public static final PdfName OCPROPERTIES = new PdfName("OCProperties");
- /** A name */
- public static final PdfName Off = new PdfName("Off");
- /** A name */
- public static final PdfName OFF = new PdfName("OFF");
- /** A name */
- public static final PdfName ON = new PdfName("ON");
- /** A name */
- public static final PdfName ONECOLUMN = new PdfName("OneColumn");
- /** A name */
- public static final PdfName OPEN = new PdfName("Open");
- /** A name */
- public static final PdfName OPENACTION = new PdfName("OpenAction");
- /** A name */
- public static final PdfName OP = new PdfName("OP");
- /** A name */
- public static final PdfName op = new PdfName("op");
- /** A name */
- public static final PdfName OPM = new PdfName("OPM");
- /** A name */
- public static final PdfName OPT = new PdfName("Opt");
- /** A name */
- public static final PdfName ORDER = new PdfName("Order");
- /** A name */
- public static final PdfName ORDERING = new PdfName("Ordering");
- /** A name */
- public static final PdfName OUTLINES = new PdfName("Outlines");
- /** A name */
- public static final PdfName OUTPUTCONDITION = new PdfName("OutputCondition");
- /** A name */
- public static final PdfName OUTPUTCONDITIONIDENTIFIER = new PdfName("OutputConditionIdentifier");
- /** A name */
- public static final PdfName OUTPUTINTENT = new PdfName("OutputIntent");
- /** A name */
- public static final PdfName OUTPUTINTENTS = new PdfName("OutputIntents");
- /** A name */
- public static final PdfName P = new PdfName("P");
- /** A name */
- public static final PdfName PAGE = new PdfName("Page");
- /** A name */
- public static final PdfName PAGELABELS = new PdfName("PageLabels");
- /** A name */
- public static final PdfName PAGELAYOUT = new PdfName("PageLayout");
- /** A name */
- public static final PdfName PAGEMODE = new PdfName("PageMode");
- /** A name */
- public static final PdfName PAGES = new PdfName("Pages");
- /** A name */
- public static final PdfName PAINTTYPE = new PdfName("PaintType");
- /** A name */
- public static final PdfName PANOSE = new PdfName("Panose");
- /** A name */
- public static final PdfName PARENT = new PdfName("Parent");
- /** A name */
- public static final PdfName PATTERN = new PdfName("Pattern");
- /** A name */
- public static final PdfName PATTERNTYPE = new PdfName("PatternType");
- /** A name */
- public static final PdfName PDF = new PdfName("PDF");
- /** A name */
- public static final PdfName PERCEPTUAL = new PdfName("Perceptual");
- /** A name */
- public static final PdfName POPUP = new PdfName("Popup");
- /** A name */
- public static final PdfName PREDICTOR = new PdfName("Predictor");
- /** A name */
- public static final PdfName PREFERRED = new PdfName("Preferred");
- /** A name */
- public static final PdfName PRESERVERB = new PdfName("PreserveRB");
- /** A name */
- public static final PdfName PREV = new PdfName("Prev");
- /** A name */
- public static final PdfName PREVPAGE = new PdfName("PrevPage");
- /** A name */
- public static final PdfName PRINT = new PdfName("Print");
- /** A name */
- public static final PdfName PRINTSCALING = new PdfName("PrintScaling");
- /** A name */
- public static final PdfName PRINTSTATE = new PdfName("PrintState");
- /** A name */
- public static final PdfName PROCSET = new PdfName("ProcSet");
- /** A name */
- public static final PdfName PRODUCER = new PdfName("Producer");
- /** A name */
- public static final PdfName PROPERTIES = new PdfName("Properties");
- /** A name */
- public static final PdfName PS = new PdfName("PS");
- /** A name */
- public static final PdfName Q = new PdfName("Q");
- /** A name */
- public static final PdfName QUADPOINTS = new PdfName("QuadPoints");
- /** A name */
- public static final PdfName R = new PdfName("R");
- /** A name */
- public static final PdfName R2L = new PdfName("R2L");
- /** A name */
- public static final PdfName RANGE = new PdfName("Range");
- /** A name */
- public static final PdfName RC = new PdfName("RC");
- /** A name */
- public static final PdfName RBGROUPS = new PdfName("RBGroups");
- /** A name */
- public static final PdfName REASON = new PdfName("Reason");
- /** A name */
- public static final PdfName RECT = new PdfName("Rect");
- /** A name */
- public static final PdfName REGISTRY = new PdfName("Registry");
- /** A name */
- public static final PdfName REGISTRYNAME = new PdfName("RegistryName");
- /** A name */
- public static final PdfName RELATIVECALORIMETRIC = new PdfName("RelativeColorimetric");
- /** A name */
- public static final PdfName RENDITION = new PdfName("Rendition");
- /** A name */
- public static final PdfName RESETFORM = new PdfName("ResetForm");
- /** A name */
- public static final PdfName RESOURCES = new PdfName("Resources");
- /** A name */
- public static final PdfName RI = new PdfName("RI");
- /** A name */
- public static final PdfName ROOT = new PdfName("Root");
- /** A name */
- public static final PdfName ROTATE = new PdfName("Rotate");
- /** A name */
- public static final PdfName ROWS = new PdfName("Rows");
- /** A name */
- public static final PdfName RUNLENGTHDECODE = new PdfName("RunLengthDecode");
- /** A name */
- public static final PdfName RV = new PdfName("RV");
- /** A name */
- public static final PdfName S = new PdfName("S");
- /** A name */
- public static final PdfName SATURATION = new PdfName("Saturation");
- /** A name */
- public static final PdfName SCREEN = new PdfName("Screen");
- /** A name */
- public static final PdfName SEPARATION = new PdfName("Separation");
- /** A name */
- public static final PdfName SETOCGSTATE = new PdfName("SetOCGState");
- /** A name */
- public static final PdfName SHADING = new PdfName("Shading");
- /** A name */
- public static final PdfName SHADINGTYPE = new PdfName("ShadingType");
- /** A name */
- public static final PdfName SHIFT_JIS = new PdfName("Shift?JIS");
- /** A name */
- public static final PdfName SIG = new PdfName("Sig");
- /** A name */
- public static final PdfName SIGFLAGS = new PdfName("SigFlags");
- /** A name */
- public static final PdfName SINGLEPAGE = new PdfName("SinglePage");
- /** A name */
- public static final PdfName SIZE = new PdfName("Size");
- /** A name */
- public static final PdfName SMASK = new PdfName("SMask");
- /** A name */
- public static final PdfName SPLIT = new PdfName("Split");
- /** A name */
- public static final PdfName SQUARE = new PdfName("Square");
- /** A name */
- public static final PdfName ST = new PdfName("St");
- /** A name */
- public static final PdfName STAMP = new PdfName("Stamp");
- /** A name */
- public static final PdfName STANDARD = new PdfName("Standard");
- /** A name */
- public static final PdfName STATE = new PdfName("State");
- /** A name */
- public static final PdfName STRIKEOUT = new PdfName("StrikeOut");
- /** A name */
- public static final PdfName STRUCTPARENT = new PdfName("StructParent");
- /** A name */
- public static final PdfName STYLE = new PdfName("Style");
- /** A name */
- public static final PdfName STEMV = new PdfName("StemV");
- /** A name */
- public static final PdfName SUBFILTER = new PdfName("SubFilter");
- /** A name */
- public static final PdfName SUBJECT = new PdfName("Subject");
- /** A name */
- public static final PdfName SUBMITFORM = new PdfName("SubmitForm");
- /** A name */
- public static final PdfName SUBTYPE = new PdfName("Subtype");
- /** A name */
- public static final PdfName SUPPLEMENT = new PdfName("Supplement");
- /** A name */
- public static final PdfName SV = new PdfName("SV");
- /** A name */
- public static final PdfName SW = new PdfName("SW");
- /** A name of a base 14 type 1 font */
- public static final PdfName SYMBOL = new PdfName("Symbol");
- /** A name */
- public static final PdfName T = new PdfName("T");
- /** A name */
- public static final PdfName TEXT = new PdfName("Text");
- /** A name */
- public static final PdfName THUMB = new PdfName("Thumb");
- /** A name */
- public static final PdfName THREADS = new PdfName("Threads");
- /** A name */
- public static final PdfName TI = new PdfName("TI");
- /** A name */
- public static final PdfName TILINGTYPE = new PdfName("TilingType");
- /** A name of a base 14 type 1 font */
- public static final PdfName TIMES_ROMAN = new PdfName("Times-Roman");
- /** A name of a base 14 type 1 font */
- public static final PdfName TIMES_BOLD = new PdfName("Times-Bold");
- /** A name of a base 14 type 1 font */
- public static final PdfName TIMES_ITALIC = new PdfName("Times-Italic");
- /** A name of a base 14 type 1 font */
- public static final PdfName TIMES_BOLDITALIC = new PdfName("Times-BoldItalic");
- /** A name */
- public static final PdfName TITLE = new PdfName("Title");
- /** A name */
- public static final PdfName TK = new PdfName("TK");
- /** A name */
- public static final PdfName TM = new PdfName("TM");
- /** A name */
- public static final PdfName TOGGLE = new PdfName("Toggle");
- /** A name */
- public static final PdfName TOUNICODE = new PdfName("ToUnicode");
- /** A name */
- public static final PdfName TP = new PdfName("TP");
- /** A name */
- public static final PdfName TRANS = new PdfName("Trans");
- /** A name */
- public static final PdfName TRANSPARENCY = new PdfName("Transparency");
- /** A name */
- public static final PdfName TRAPPED = new PdfName("Trapped");
- /** A name */
- public static final PdfName TRIMBOX = new PdfName("TrimBox");
- /** A name */
- public static final PdfName TRUETYPE = new PdfName("TrueType");
- /** A name */
- public static final PdfName TU = new PdfName("TU");
- /** A name */
- public static final PdfName TWOCOLUMNLEFT = new PdfName("TwoColumnLeft");
- /** A name */
- public static final PdfName TWOCOLUMNRIGHT = new PdfName("TwoColumnRight");
- /** A name */
- public static final PdfName TX = new PdfName("Tx");
- /** A name */
- public static final PdfName TYPE = new PdfName("Type");
- /** A name */
- public static final PdfName TYPE0 = new PdfName("Type0");
- /** A name */
- public static final PdfName TYPE1 = new PdfName("Type1");
- /** A name of an attribute. */
- public static final PdfName U = new PdfName("U");
- /** A name of an attribute. */
- public static final PdfName UHC = new PdfName("UHC");
- /** A name of an attribute. */
- public static final PdfName UNDERLINE = new PdfName("Underline");
- /** A name */
- public static final PdfName URI = new PdfName("URI");
- /** A name */
- public static final PdfName URL = new PdfName("URL");
- /** A name */
- public static final PdfName USAGE = new PdfName("Usage");
- /** A name */
- public static final PdfName USENONE = new PdfName("UseNone");
- /** A name */
- public static final PdfName USEOC = new PdfName("UseOC");
- /** A name */
- public static final PdfName USEOUTLINES = new PdfName("UseOutlines");
- /** A name */
- public static final PdfName USER = new PdfName("User");
- /** A name */
- public static final PdfName USETHUMBS = new PdfName("UseThumbs");
- /** A name */
- public static final PdfName V = new PdfName("V");
- /** A name */
- public static final PdfName VERISIGN_PPKVS = new PdfName("VeriSign.PPKVS");
- /** A name */
- public static final PdfName VIEW = new PdfName("View");
- /** A name */
- public static final PdfName VIEWERPREFERENCES = new PdfName("ViewerPreferences");
- /** A name */
- public static final PdfName VIEWSTATE = new PdfName("ViewState");
- /** A name */
- public static final PdfName VISIBLEPAGES = new PdfName("VisiblePages");
- /** A name of an attribute. */
- public static final PdfName W = new PdfName("W");
- /** A name of an attribute. */
- public static final PdfName W2 = new PdfName("W2");
- /** A name of an attribute. */
- public static final PdfName WC = new PdfName("WC");
- /** A name of an attribute. */
- public static final PdfName WIDGET = new PdfName("Widget");
- /** A name of an attribute. */
- public static final PdfName WIDTH = new PdfName("Width");
- /** A name */
- public static final PdfName WIDTHS = new PdfName("Widths");
- /** A name of an encoding */
- public static final PdfName WIN = new PdfName("Win");
- /** A name of an encoding */
- public static final PdfName WIN_ANSI_ENCODING = new PdfName("WinAnsiEncoding");
- /** A name of an encoding */
- public static final PdfName WIPE = new PdfName("Wipe");
- /** A name */
- public static final PdfName WHITEPOINT = new PdfName("WhitePoint");
- /** A name */
- public static final PdfName WP = new PdfName("WP");
- /** A name of an encoding */
- public static final PdfName WS = new PdfName("WS");
- /** A name */
- public static final PdfName X = new PdfName("X");
- /** A name */
- public static final PdfName XOBJECT = new PdfName("XObject");
- /** A name */
- public static final PdfName XSTEP = new PdfName("XStep");
- /** A name */
- public static final PdfName XREF = new PdfName("XRef");
- /** A name */
- public static final PdfName XREFSTM = new PdfName("XRefStm");
- /** A name */
- public static final PdfName XYZ = new PdfName("XYZ");
- /** A name */
- public static final PdfName YSTEP = new PdfName("YStep");
- /** A name of a base 14 type 1 font */
- public static final PdfName ZAPFDINGBATS = new PdfName("ZapfDingbats");
- /** A name */
- public static final PdfName ZOOM = new PdfName("Zoom");
-
- private int hash = 0;
-
- // constructors
-
- /**
- * Constructs a <CODE>PdfName</CODE>-object.
- *
- * @param name the new Name.
- */
-
- public PdfName(String name) {
- super(PdfObject.NAME);
- // The minimum number of characters in a name is 0, the maximum is 127 (the '/' not included)
- int length = name.length();
- if (length > 127) {
- throw new IllegalArgumentException("The name '" + name + "' is too long (" + length + " characters).");
- }
- // The name has to be checked for illegal characters
- // every special character has to be substituted
- ByteBuffer pdfName = new ByteBuffer(length + 20);
- pdfName.append('/');
- char character;
- char chars[] = name.toCharArray();
- // loop over all the characters
- for (int index = 0; index < length; index++) {
- character = (char)(chars[index] & 0xff);
- // special characters are escaped (reference manual p.39)
- switch (character) {
- case ' ':
- case '%':
- case '(':
- case ')':
- case '<':
- case '>':
- case '[':
- case ']':
- case '{':
- case '}':
- case '/':
- case '#':
- pdfName.append('#');
- pdfName.append(Integer.toString((int) character, 16));
- break;
- default:
- if (character > 126 || character < 32) {
- pdfName.append('#');
- if (character < 16)
- pdfName.append('0');
- pdfName.append(Integer.toString((int) character, 16));
- }
- else
- pdfName.append(character);
- break;
- }
- }
- bytes = pdfName.toByteArray();
- }
-
- /**
- * Constructs a PdfName.
- * @param bytes
- */
- public PdfName(byte bytes[]) {
- super(PdfObject.NAME, bytes);
- }
- // methods
-
- /**
- * Compares this object with the specified object for order. Returns a
- * negative integer, zero, or a positive integer as this object is less
- * than, equal to, or greater than the specified object.<p>
- *
- *
- * @param object the Object to be compared.
- * @return a negative integer, zero, or a positive integer as this object
- * is less than, equal to, or greater than the specified object.
- *
- * @throws ClassCastException if the specified object's type prevents it
- * from being compared to this Object.
- */
- public int compareTo(Object object) {
- PdfName name = (PdfName) object;
-
- byte myBytes[] = bytes;
- byte objBytes[] = name.bytes;
- int len = Math.min(myBytes.length, objBytes.length);
- for(int i=0; i<len; i++) {
- if(myBytes[i] > objBytes[i])
- return 1;
-
- if(myBytes[i] < objBytes[i])
- return -1;
- }
- if (myBytes.length < objBytes.length)
- return -1;
- if (myBytes.length > objBytes.length)
- return 1;
- return 0;
- }
-
- /**
- * Indicates whether some other object is "equal to" this one.
- *
- * @param obj the reference object with which to compare.
- * @return <code>true</code> if this object is the same as the obj
- * argument; <code>false</code> otherwise.
- */
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj instanceof PdfName)
- return compareTo(obj) == 0;
- return false;
- }
-
- /**
- * Returns a hash code value for the object. This method is
- * supported for the benefit of hashtables such as those provided by
- * <code>java.util.Hashtable</code>.
- *
- * @return a hash code value for this object.
- */
- public int hashCode() {
- int h = hash;
- if (h == 0) {
- int ptr = 0;
- int len = bytes.length;
-
- for (int i = 0; i < len; i++)
- h = 31*h + (bytes[ptr++] & 0xff);
- hash = h;
- }
- return h;
- }
-
- /** Decodes an escaped name in the form "/AB#20CD" into "AB CD".
- * @param name the name to decode
- * @return the decoded name
- */
- public static String decodeName(String name) {
- StringBuffer buf = new StringBuffer();
- try {
- int len = name.length();
- for (int k = 1; k < len; ++k) {
- char c = name.charAt(k);
- if (c == '#') {
- c = (char)((PRTokeniser.getHex(name.charAt(k + 1)) << 4) + PRTokeniser.getHex(name.charAt(k + 2)));
- k += 2;
- }
- buf.append(c);
- }
- }
- catch (IndexOutOfBoundsException e) {
- // empty on purpose
- }
- return buf.toString();
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfNameTree.java b/LibrarySource/com/lowagie/text/pdf/PdfNameTree.java
deleted file mode 100644
index 9227c57..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfNameTree.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright 2004 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import java.util.HashMap;
-import java.util.Arrays;
-import java.util.ArrayList;
-import java.io.IOException;
-import com.lowagie.text.StringCompare;
-
-/**
- * Creates a name tree.
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class PdfNameTree {
-
- private static final int leafSize = 64;
- private static final StringCompare stringCompare = new StringCompare();
-
- /**
- * Creates a name tree.
- * @param items the item of the name tree. The key is a <CODE>String</CODE>
- * and the value is a <CODE>PdfIndirectReference</CODE>. Note that although the
- * keys are strings only the lower byte is used and no check is made for chars
- * with the same lower byte and different upper byte. This will generate a wrong
- * tree name.
- * @param writer the writer
- * @throws IOException on error
- * @return the dictionary with the name tree. This dictionary is the one
- * generally pointed to by the key /Dests
- */
- public static PdfDictionary writeTree(HashMap items, PdfWriter writer) throws IOException {
- if (items.size() == 0)
- return null;
- String names[] = new String[items.size()];
- names = (String[])items.keySet().toArray(names);
- Arrays.sort(names, stringCompare);
- if (names.length <= leafSize) {
- PdfDictionary dic = new PdfDictionary();
- PdfArray ar = new PdfArray();
- for (int k = 0; k < names.length; ++k) {
- ar.add(new PdfString(names[k], null));
- ar.add((PdfIndirectReference)items.get(names[k]));
- }
- dic.put(PdfName.NAMES, ar);
- return dic;
- }
- int skip = leafSize;
- PdfIndirectReference kids[] = new PdfIndirectReference[(names.length + leafSize - 1) / leafSize];
- for (int k = 0; k < kids.length; ++k) {
- int offset = k * leafSize;
- int end = Math.min(offset + leafSize, names.length);
- PdfDictionary dic = new PdfDictionary();
- PdfArray arr = new PdfArray();
- arr.add(new PdfString(names[offset], null));
- arr.add(new PdfString(names[end - 1], null));
- dic.put(PdfName.LIMITS, arr);
- arr = new PdfArray();
- for (; offset < end; ++offset) {
- arr.add(new PdfString(names[offset], null));
- arr.add((PdfIndirectReference)items.get(names[offset]));
- }
- dic.put(PdfName.NAMES, arr);
- kids[k] = writer.addToBody(dic).getIndirectReference();
- }
- int top = kids.length;
- while (true) {
- if (top <= leafSize) {
- PdfArray arr = new PdfArray();
- for (int k = 0; k < top; ++k)
- arr.add(kids[k]);
- PdfDictionary dic = new PdfDictionary();
- dic.put(PdfName.KIDS, arr);
- return dic;
- }
- skip *= leafSize;
- int tt = (names.length + skip - 1 )/ skip;
- for (int k = 0; k < tt; ++k) {
- int offset = k * leafSize;
- int end = Math.min(offset + leafSize, top);
- PdfDictionary dic = new PdfDictionary();
- PdfArray arr = new PdfArray();
- arr.add(new PdfString(names[k * skip], null));
- arr.add(new PdfString(names[Math.min((k + 1) * skip, names.length) - 1], null));
- dic.put(PdfName.LIMITS, arr);
- arr = new PdfArray();
- for (; offset < end; ++offset) {
- arr.add(kids[offset]);
- }
- dic.put(PdfName.KIDS, arr);
- kids[k] = writer.addToBody(dic).getIndirectReference();
- }
- top = tt;
- }
- }
-
- private static void iterateItems(PdfDictionary dic, HashMap items) {
- PdfArray nn = (PdfArray)PdfReader.getPdfObjectRelease(dic.get(PdfName.NAMES));
- if (nn != null) {
- ArrayList arr = nn.getArrayList();
- for (int k = 0; k < arr.size(); ++k) {
- PdfString s = (PdfString)PdfReader.getPdfObjectRelease((PdfObject)arr.get(k++));
- items.put(s.toString(), arr.get(k));
- }
- }
- else if ((nn = (PdfArray)PdfReader.getPdfObjectRelease(dic.get(PdfName.KIDS))) != null) {
- ArrayList arr = nn.getArrayList();
- for (int k = 0; k < arr.size(); ++k) {
- PdfDictionary kid = (PdfDictionary)PdfReader.getPdfObjectRelease((PdfObject)arr.get(k));
- iterateItems(kid, items);
- }
- }
- }
-
- public static HashMap readTree(PdfDictionary dic) {
- HashMap items = new HashMap();
- if (dic != null)
- iterateItems(dic, items);
- return items;
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfNull.java b/LibrarySource/com/lowagie/text/pdf/PdfNull.java
deleted file mode 100644
index 24a536d..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfNull.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * $Id: PdfNull.java,v 1.22 2002/06/20 13:30:25 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/**
- * <CODE>PdfNull</CODE> is the Null object represented by the keyword <VAR>null</VAR>.
- * <P>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 4.9 (page 53).
- *
- * @see PdfObject
- */
-
-public class PdfNull extends PdfObject {
-
- // static membervariables
-
-/** This is an instance of the <CODE>PdfNull</CODE>-object. */
- public static final PdfNull PDFNULL = new PdfNull();
-
-/** This is the content of a <CODE>PdfNull</CODE>-object. */
- private static final String CONTENT = "null";
-
- // constructors
-
-/**
- * Constructs a <CODE>PdfNull</CODE>-object.
- * <P>
- * You never need to do this yourself, you can always use the static final object <VAR>PDFNULL</VAR>.
- */
-
- public PdfNull() {
- super(NULL, CONTENT);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfNumber.java b/LibrarySource/com/lowagie/text/pdf/PdfNumber.java
deleted file mode 100644
index 5276f9d..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfNumber.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * $Id: PdfNumber.java,v 1.24 2002/07/09 11:28:23 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/**
- * <CODE>PdfNumber</CODE> provides two types of numbers, integer and real.
- * <P>
- * Integers may be specified by signed or unsigned constants. Reals may only be
- * in decimal format.<BR>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 4.3 (page 37).
- *
- * @see PdfObject
- * @see BadPdfFormatException
- */
-
-public class PdfNumber extends PdfObject {
-
-/** actual value of this <CODE>PdfNumber</CODE>, represented as a <CODE>double</CODE> */
- private double value;
-
- // constructors
-
-/**
- * Constructs a <CODE>PdfNumber</CODE>-object.
- *
- * @param content value of the new <CODE>PdfNumber</CODE>-object
- */
-
- public PdfNumber(String content) {
- super(NUMBER);
- try {
- value = Double.valueOf(content.trim()).doubleValue();
- setContent(content);
- }
- catch (NumberFormatException nfe){
- throw new RuntimeException(content + " is not a valid number - " + nfe.toString());
- }
- }
-
-/**
- * Constructs a new INTEGER <CODE>PdfNumber</CODE>-object.
- *
- * @param value value of the new <CODE>PdfNumber</CODE>-object
- */
-
- public PdfNumber(int value) {
- super(NUMBER);
- this.value = value;
- setContent(String.valueOf(value));
- }
-
-/**
- * Constructs a new REAL <CODE>PdfNumber</CODE>-object.
- *
- * @param value value of the new <CODE>PdfNumber</CODE>-object
- */
-
- public PdfNumber(double value) {
- super(NUMBER);
- this.value = value;
- setContent(ByteBuffer.formatDouble(value));
- }
-
-/**
- * Constructs a new REAL <CODE>PdfNumber</CODE>-object.
- *
- * @param value value of the new <CODE>PdfNumber</CODE>-object
- */
-
- public PdfNumber(float value) {
- this((double)value);
- }
-
- // methods returning the value of this object
-
-/**
- * Returns the primitive <CODE>int</CODE> value of this object.
- *
- * @return a value
- */
-
- public int intValue() {
- return (int) value;
- }
-
-/**
- * Returns the primitive <CODE>double</CODE> value of this object.
- *
- * @return a value
- */
-
- public double doubleValue() {
- return value;
- }
-
- public float floatValue() {
- return (float)value;
- }
-
- // other methods
-
-/**
- * Increments the value of the <CODE>PdfNumber</CODE>-object with 1.
- */
-
- public void increment() {
- value += 1.0;
- setContent(ByteBuffer.formatDouble(value));
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfOCG.java b/LibrarySource/com/lowagie/text/pdf/PdfOCG.java
deleted file mode 100644
index bf0b078..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfOCG.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2004 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-/**
- * The interface common to all layer types.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public interface PdfOCG {
-
- /**
- * Gets the <CODE>PdfIndirectReference</CODE> that represents this layer.
- * @return the <CODE>PdfIndirectReference</CODE> that represents this layer
- */
- public PdfIndirectReference getRef();
-
- /**
- * Gets the object representing the layer.
- * @return the object representing the layer
- */
- public PdfObject getPdfObject();
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfOCProperties.java b/LibrarySource/com/lowagie/text/pdf/PdfOCProperties.java
deleted file mode 100644
index 41bbd36..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfOCProperties.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2004 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-/**
- * This class represents the /OCProperties entry in the document catalog
- * and holds the optional content properties dictionary, which contains
- * a list of all the optional content groups in the document, as well as information
- * about the default and alternate configurations for optional content.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class PdfOCProperties extends PdfDictionary {
-
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfObject.java b/LibrarySource/com/lowagie/text/pdf/PdfObject.java
deleted file mode 100644
index d55894c..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfObject.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * $Id: PdfObject.java,v 1.26 2002/07/09 11:28:23 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-import java.io.OutputStream;
-import java.io.IOException;
-
-/**
- * <CODE>PdfObject</CODE> is the abstract superclass of all PDF objects.
- * <P>
- * PDF supports seven basic types of objects: Booleans, numbers, strings, names,
- * arrays, dictionaries and streams. In addition, PDF provides a null object.
- * Objects may be labeled so that they can be referred to by other objects.<BR>
- * All these basic PDF objects are described in the 'Portable Document Format
- * Reference Manual version 1.3' Chapter 4 (pages 37-54).
- *
- * @see PdfNull
- * @see PdfBoolean
- * @see PdfNumber
- * @see PdfString
- * @see PdfName
- * @see PdfArray
- * @see PdfDictionary
- * @see PdfStream
- * @see PdfIndirectReference
- */
-
-public abstract class PdfObject {
-
- // static membervariables (all the possible types of a PdfObject)
-
-/** a possible type of <CODE>PdfObject</CODE> */
- public static final int BOOLEAN = 1;
-
-/** a possible type of <CODE>PdfObject</CODE> */
- public static final int NUMBER = 2;
-
-/** a possible type of <CODE>PdfObject</CODE> */
- public static final int STRING = 3;
-
-/** a possible type of <CODE>PdfObject</CODE> */
- public static final int NAME = 4;
-
-/** a possible type of <CODE>PdfObject</CODE> */
- public static final int ARRAY = 5;
-
-/** a possible type of <CODE>PdfObject</CODE> */
- public static final int DICTIONARY = 6;
-
-/** a possible type of <CODE>PdfObject</CODE> */
- public static final int STREAM = 7;
-
-/** a possible type of <CODE>PdfObject</CODE> */
- public static final int NULL = 8;
-
- /** a possible type of <CODE>PdfObject</CODE> */
- public static final int INDIRECT = 10;
-
-/** This is an empty string used for the <CODE>PdfNull</CODE>-object and for an empty <CODE>PdfString</CODE>-object. */
- public static final String NOTHING = "";
-
-/** This is the default encoding to be used for converting Strings into bytes and vice versa.
- * The default encoding is PdfDocEncoding.
- */
- public static final String TEXT_PDFDOCENCODING = "PDF";
-
-/** This is the encoding to be used to output text in Unicode. */
- public static final String TEXT_UNICODE = "UnicodeBig";
-
- // membervariables
-
-/** the content of this <CODE>PdfObject</CODE> */
- protected byte[] bytes;
-
-/** the type of this <CODE>PdfObject</CODE> */
- protected int type;
-
- /**
- * Holds value of property indRef.
- */
- protected PRIndirectReference indRef;
-
- // constructors
-
-/**
- * Constructs a <CODE>PdfObject</CODE> of a certain <VAR>type</VAR> without any <VAR>content</VAR>.
- *
- * @param type type of the new <CODE>PdfObject</CODE>
- */
-
- protected PdfObject(int type) {
- this.type = type;
- }
-
-/**
- * Constructs a <CODE>PdfObject</CODE> of a certain <VAR>type</VAR> with a certain <VAR>content</VAR>.
- *
- * @param type type of the new <CODE>PdfObject</CODE>
- * @param content content of the new <CODE>PdfObject</CODE> as a <CODE>String</CODE>.
- */
-
- protected PdfObject(int type, String content) {
- this.type = type;
- bytes = PdfEncodings.convertToBytes(content, null);
- }
-
-/**
- * Constructs a <CODE>PdfObject</CODE> of a certain <VAR>type</VAR> with a certain <VAR>content</VAR>.
- *
- * @param type type of the new <CODE>PdfObject</CODE>
- * @param bytes content of the new <CODE>PdfObject</CODE> as an array of <CODE>byte</CODE>.
- */
-
- protected PdfObject(int type, byte[] bytes) {
- this.bytes = bytes;
- this.type = type;
- }
-
- // methods dealing with the content of this object
-
-/**
- * Writes the PDF representation of this <CODE>PdfObject</CODE> as an array of <CODE>byte</CODE>s to the writer.
- * @param writer for backwards compatibility
- * @param os the outputstream to write the bytes to.
- * @throws IOException
- */
-
- public void toPdf(PdfWriter writer, OutputStream os) throws IOException {
- if (bytes != null)
- os.write(bytes);
- }
-
- /**
- * Gets the presentation of this object in a byte array
- * @return a byte array
- */
- public byte[] getBytes() {
- return bytes;
- }
-
- /**
- * Can this object be in an object stream?
- * @return true if this object can be in an object stream.
- */
- public boolean canBeInObjStm() {
- return (type >= 1 && type <= 6) || type == 8;
- }
-
-/**
- * Returns the length of the PDF representation of the <CODE>PdfObject</CODE>.
- * <P>
- * In some cases, namely for <CODE>PdfString</CODE> and <CODE>PdfStream</CODE>,
- * this method differs from the method <CODE>length</CODE> because <CODE>length</CODE>
- * returns the length of the actual content of the <CODE>PdfObject</CODE>.</P>
- * <P>
- * Remark: the actual content of an object is in most cases identical to its representation.
- * The following statement is always true: length() >= pdfLength().</P>
- *
- * @return a length
- */
-
-// public int pdfLength() {
-// return toPdf(null).length;
-// }
-
-/**
- * Returns the <CODE>String</CODE>-representation of this <CODE>PdfObject</CODE>.
- *
- * @return a <CODE>String</CODE>
- */
-
- public String toString() {
- if (bytes == null)
- return super.toString();
- else
- return PdfEncodings.convertToString(bytes, null);
- }
-
-/**
- * Returns the length of the actual content of the <CODE>PdfObject</CODE>.
- * <P>
- * In some cases, namely for <CODE>PdfString</CODE> and <CODE>PdfStream</CODE>,
- * this method differs from the method <CODE>pdfLength</CODE> because <CODE>pdfLength</CODE>
- * returns the length of the PDF representation of the object, not of the actual content
- * as does the method <CODE>length</CODE>.</P>
- * <P>
- * Remark: the actual content of an object is in some cases identical to its representation.
- * The following statement is always true: length() >= pdfLength().</P>
- *
- * @return a length
- */
-
- public int length() {
- return toString().length();
- }
-
-/**
- * Changes the content of this <CODE>PdfObject</CODE>.
- *
- * @param content the new content of this <CODE>PdfObject</CODE>
- */
-
- protected void setContent(String content) {
- bytes = PdfEncodings.convertToBytes(content, null);
- }
-
- // methods dealing with the type of this object
-
-/**
- * Returns the type of this <CODE>PdfObject</CODE>.
- *
- * @return a type
- */
-
- public int type() {
- return type;
- }
-
-/**
- * Checks if this <CODE>PdfObject</CODE> is of the type <CODE>PdfNull</CODE>.
- *
- * @return <CODE>true</CODE> or <CODE>false</CODE>
- */
-
- public boolean isNull() {
- return (this.type == NULL);
- }
-
-/**
- * Checks if this <CODE>PdfObject</CODE> is of the type <CODE>PdfBoolean</CODE>.
- *
- * @return <CODE>true</CODE> or <CODE>false</CODE>
- */
-
- public boolean isBoolean() {
- return (this.type == BOOLEAN);
- }
-
-/**
- * Checks if this <CODE>PdfObject</CODE> is of the type <CODE>PdfNumber</CODE>.
- *
- * @return <CODE>true</CODE> or <CODE>false</CODE>
- */
-
- public boolean isNumber() {
- return (this.type == NUMBER);
- }
-
-/**
- * Checks if this <CODE>PdfObject</CODE> is of the type <CODE>PdfString</CODE>.
- *
- * @return <CODE>true</CODE> or <CODE>false</CODE>
- */
-
- public boolean isString() {
- return (this.type == STRING);
- }
-
-/**
- * Checks if this <CODE>PdfObject</CODE> is of the type <CODE>PdfName</CODE>.
- *
- * @return <CODE>true</CODE> or <CODE>false</CODE>
- */
-
- public boolean isName() {
- return (this.type == NAME);
- }
-
-/**
- * Checks if this <CODE>PdfObject</CODE> is of the type <CODE>PdfArray</CODE>.
- *
- * @return <CODE>true</CODE> or <CODE>false</CODE>
- */
-
- public boolean isArray() {
- return (this.type == ARRAY);
- }
-
-/**
- * Checks if this <CODE>PdfObject</CODE> is of the type <CODE>PdfDictionary</CODE>.
- *
- * @return <CODE>true</CODE> or <CODE>false</CODE>
- */
-
- public boolean isDictionary() {
- return (this.type == DICTIONARY);
- }
-
-/**
- * Checks if this <CODE>PdfObject</CODE> is of the type <CODE>PdfStream</CODE>.
- *
- * @return <CODE>true</CODE> or <CODE>false</CODE>
- */
-
- public boolean isStream() {
- return (this.type == STREAM);
- }
-
- /**
- * Checks if this is an indirect object.
- * @return true if this is an indirect object
- */
- public boolean isIndirect() {
- return (this.type == INDIRECT);
- }
-
- /**
- * Getter for property indRef.
- * @return Value of property indRef.
- */
- public PRIndirectReference getIndRef() {
- return this.indRef;
- }
-
- /**
- * Setter for property indRef.
- * @param indRef New value of property indRef.
- */
- public void setIndRef(PRIndirectReference indRef) {
- this.indRef = indRef;
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfOutline.java b/LibrarySource/com/lowagie/text/pdf/PdfOutline.java
deleted file mode 100644
index 18f76b3..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfOutline.java
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- * $Id: PdfOutline.java,v 1.51 2005/01/05 10:05:20 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.util.Iterator;
-
-import com.lowagie.text.Chunk;
-import com.lowagie.text.Paragraph;
-import java.util.ArrayList;
-import headless.awt.Color;
-import com.lowagie.text.Font;
-import java.io.OutputStream;
-import java.io.IOException;
-
-/**
- * <CODE>PdfOutline</CODE> is an object that represents a PDF outline entry.
- * <P>
- * An outline allows a user to access views of a document by name.<BR>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 6.7 (page 104-106)
- *
- * @see PdfDictionary
- */
-
-public class PdfOutline extends PdfDictionary {
-
- // membervariables
-
- /** the <CODE>PdfIndirectReference</CODE> of this object */
- private PdfIndirectReference reference;
-
- /** value of the <B>Count</B>-key */
- private int count = 0;
-
- /** value of the <B>Parent</B>-key */
- private PdfOutline parent;
-
- /** value of the <B>Destination</B>-key */
- private PdfDestination destination;
-
- /** The <CODE>PdfAction</CODE> for this outline.
- */
- private PdfAction action;
-
- protected ArrayList kids = new ArrayList();
-
- protected PdfWriter writer;
-
- /** Holds value of property tag. */
- private String tag;
-
- /** Holds value of property open. */
- private boolean open;
-
- /** Holds value of property color. */
- private Color color;
-
- /** Holds value of property style. */
- private int style = 0;
-
- // constructors
-
- /**
- * Constructs a <CODE>PdfOutline</CODE>.
- * <P>
- * This is the constructor for the <CODE>outlines object</CODE>.
- *
- * @param writer The PdfWriter you are adding the outline to
- */
-
- PdfOutline(PdfWriter writer) {
- super(OUTLINES);
- open = true;
- parent = null;
- this.writer = writer;
- }
-
- /**
- * Constructs a <CODE>PdfOutline</CODE>.
- * <P>
- * This is the constructor for an <CODE>outline entry</CODE>. The open mode is
- * <CODE>true</CODE>.
- *
- * @param parent the parent of this outline item
- * @param action the <CODE>PdfAction</CODE> for this outline item
- * @param title the title of this outline item
- */
-
- public PdfOutline(PdfOutline parent, PdfAction action, String title) {
- this(parent, action, title, true);
- }
-
- /**
- * Constructs a <CODE>PdfOutline</CODE>.
- * <P>
- * This is the constructor for an <CODE>outline entry</CODE>.
- *
- * @param parent the parent of this outline item
- * @param action the <CODE>PdfAction</CODE> for this outline item
- * @param title the title of this outline item
- * @param open <CODE>true</CODE> if the children are visible
- */
- public PdfOutline(PdfOutline parent, PdfAction action, String title, boolean open) {
- super();
- this.action = action;
- initOutline(parent, title, open);
- }
-
- /**
- * Constructs a <CODE>PdfOutline</CODE>.
- * <P>
- * This is the constructor for an <CODE>outline entry</CODE>. The open mode is
- * <CODE>true</CODE>.
- *
- * @param parent the parent of this outline item
- * @param destination the destination for this outline item
- * @param title the title of this outline item
- */
-
- public PdfOutline(PdfOutline parent, PdfDestination destination, String title) {
- this(parent, destination, title, true);
- }
-
- /**
- * Constructs a <CODE>PdfOutline</CODE>.
- * <P>
- * This is the constructor for an <CODE>outline entry</CODE>.
- *
- * @param parent the parent of this outline item
- * @param destination the destination for this outline item
- * @param title the title of this outline item
- * @param open <CODE>true</CODE> if the children are visible
- */
- public PdfOutline(PdfOutline parent, PdfDestination destination, String title, boolean open) {
- super();
- this.destination = destination;
- initOutline(parent, title, open);
- }
-
- /**
- * Constructs a <CODE>PdfOutline</CODE>.
- * <P>
- * This is the constructor for an <CODE>outline entry</CODE>. The open mode is
- * <CODE>true</CODE>.
- *
- * @param parent the parent of this outline item
- * @param action the <CODE>PdfAction</CODE> for this outline item
- * @param title the title of this outline item
- */
- public PdfOutline(PdfOutline parent, PdfAction action, PdfString title) {
- this(parent, action, title, true);
- }
-
- /**
- * Constructs a <CODE>PdfOutline</CODE>.
- * <P>
- * This is the constructor for an <CODE>outline entry</CODE>.
- *
- * @param parent the parent of this outline item
- * @param action the <CODE>PdfAction</CODE> for this outline item
- * @param title the title of this outline item
- * @param open <CODE>true</CODE> if the children are visible
- */
- public PdfOutline(PdfOutline parent, PdfAction action, PdfString title, boolean open) {
- this(parent, action, title.toString(), true);
- }
-
- /**
- * Constructs a <CODE>PdfOutline</CODE>.
- * <P>
- * This is the constructor for an <CODE>outline entry</CODE>. The open mode is
- * <CODE>true</CODE>.
- *
- * @param parent the parent of this outline item
- * @param destination the destination for this outline item
- * @param title the title of this outline item
- */
-
- public PdfOutline(PdfOutline parent, PdfDestination destination, PdfString title) {
- this(parent, destination, title, true);
- }
-
- /**
- * Constructs a <CODE>PdfOutline</CODE>.
- * <P>
- * This is the constructor for an <CODE>outline entry</CODE>.
- *
- * @param parent the parent of this outline item
- * @param destination the destination for this outline item
- * @param title the title of this outline item
- * @param open <CODE>true</CODE> if the children are visible
- */
- public PdfOutline(PdfOutline parent, PdfDestination destination, PdfString title, boolean open) {
- this(parent, destination, title.toString(), true);
- }
-
- /**
- * Constructs a <CODE>PdfOutline</CODE>.
- * <P>
- * This is the constructor for an <CODE>outline entry</CODE>. The open mode is
- * <CODE>true</CODE>.
- *
- * @param parent the parent of this outline item
- * @param action the <CODE>PdfAction</CODE> for this outline item
- * @param title the title of this outline item
- */
-
- public PdfOutline(PdfOutline parent, PdfAction action, Paragraph title) {
- this(parent, action, title, true);
- }
-
- /**
- * Constructs a <CODE>PdfOutline</CODE>.
- * <P>
- * This is the constructor for an <CODE>outline entry</CODE>.
- *
- * @param parent the parent of this outline item
- * @param action the <CODE>PdfAction</CODE> for this outline item
- * @param title the title of this outline item
- * @param open <CODE>true</CODE> if the children are visible
- */
- public PdfOutline(PdfOutline parent, PdfAction action, Paragraph title, boolean open) {
- super();
- StringBuffer buf = new StringBuffer();
- for (Iterator i = title.getChunks().iterator(); i.hasNext(); ) {
- Chunk chunk = (Chunk) i.next();
- buf.append(chunk.content());
- }
- this.action = action;
- initOutline(parent, buf.toString(), open);
- }
-
- /**
- * Constructs a <CODE>PdfOutline</CODE>.
- * <P>
- * This is the constructor for an <CODE>outline entry</CODE>. The open mode is
- * <CODE>true</CODE>.
- *
- * @param parent the parent of this outline item
- * @param destination the destination for this outline item
- * @param title the title of this outline item
- */
-
- public PdfOutline(PdfOutline parent, PdfDestination destination, Paragraph title) {
- this(parent, destination, title, true);
- }
-
- /**
- * Constructs a <CODE>PdfOutline</CODE>.
- * <P>
- * This is the constructor for an <CODE>outline entry</CODE>.
- *
- * @param parent the parent of this outline item
- * @param destination the destination for this outline item
- * @param title the title of this outline item
- * @param open <CODE>true</CODE> if the children are visible
- */
- public PdfOutline(PdfOutline parent, PdfDestination destination, Paragraph title, boolean open) {
- super();
- StringBuffer buf = new StringBuffer();
- for (Iterator i = title.getChunks().iterator(); i.hasNext(); ) {
- Chunk chunk = (Chunk) i.next();
- buf.append(chunk.content());
- }
- this.destination = destination;
- initOutline(parent, buf.toString(), open);
- }
-
-
- // methods
-
- /** Helper for the constructors.
- * @param parent the parent outline
- * @param title the title for this outline
- * @param open <CODE>true</CODE> if the children are visible
- */
- void initOutline(PdfOutline parent, String title, boolean open) {
- this.open = open;
- this.parent = parent;
- writer = parent.writer;
- put(PdfName.TITLE, new PdfString(title, PdfObject.TEXT_UNICODE));
- parent.addKid(this);
- if (destination != null && !destination.hasPage()) // bugfix Finn Bock
- setDestinationPage(writer.getCurrentPage());
- }
-
- /**
- * Sets the indirect reference of this <CODE>PdfOutline</CODE>.
- *
- * @param reference the <CODE>PdfIndirectReference</CODE> to this outline.
- */
-
- public void setIndirectReference(PdfIndirectReference reference) {
- this.reference = reference;
- }
-
- /**
- * Gets the indirect reference of this <CODE>PdfOutline</CODE>.
- *
- * @return the <CODE>PdfIndirectReference</CODE> to this outline.
- */
-
- public PdfIndirectReference indirectReference() {
- return reference;
- }
-
- /**
- * Gets the parent of this <CODE>PdfOutline</CODE>.
- *
- * @return the <CODE>PdfOutline</CODE> that is the parent of this outline.
- */
-
- public PdfOutline parent() {
- return parent;
- }
-
- /**
- * Set the page of the <CODE>PdfDestination</CODE>-object.
- *
- * @param pageReference indirect reference to the page
- * @return <CODE>true</CODE> if this page was set as the <CODE>PdfDestination</CODE>-page.
- */
-
- public boolean setDestinationPage(PdfIndirectReference pageReference) {
- if (destination == null) {
- return false;
- }
- return destination.addPage(pageReference);
- }
-
- /**
- * Gets the destination for this outline.
- * @return the destination
- */
- public PdfDestination getPdfDestination() {
- return destination;
- }
-
- int getCount() {
- return count;
- }
-
- void setCount(int count) {
- this.count = count;
- }
-
- /**
- * returns the level of this outline.
- *
- * @return a level
- */
-
- public int level() {
- if (parent == null) {
- return 0;
- }
- return (parent.level() + 1);
- }
-
- /**
- * Returns the PDF representation of this <CODE>PdfOutline</CODE>.
- *
- * @param writer the encryption information
- * @param os
- * @throws IOException
- */
-
- public void toPdf(PdfWriter writer, OutputStream os) throws IOException {
- if (color != null && !color.equals(Color.black)) {
- put(PdfName.C, new PdfArray(new float[]{color.getRed()/255f,color.getGreen()/255f,color.getBlue()/255f}));
- }
- int flag = 0;
- if ((style & Font.BOLD) != 0)
- flag |= 2;
- if ((style & Font.ITALIC) != 0)
- flag |= 1;
- if (flag != 0)
- put(PdfName.F, new PdfNumber(flag));
- if (parent != null) {
- put(PdfName.PARENT, parent.indirectReference());
- }
- if (destination != null && destination.hasPage()) {
- put(PdfName.DEST, destination);
- }
- if (action != null)
- put(PdfName.A, action);
- if (count != 0) {
- put(PdfName.COUNT, new PdfNumber(count));
- }
- super.toPdf(writer, os);
- }
-
- /**
- * Adds a kid to the outline
- * @param outline
- */
- public void addKid(PdfOutline outline) {
- kids.add(outline);
- }
-
- /**
- * Returns the kids of this outline
- * @return an ArrayList with PdfOutlines
- */
- public ArrayList getKids() {
- return kids;
- }
-
- /**
- * Sets the kids of this outline
- * @param kids
- */
- public void setKids(ArrayList kids) {
- this.kids = kids;
- }
-
- /** Getter for property tag.
- * @return Value of property tag.
- */
- public String getTag() {
- return tag;
- }
-
- /** Setter for property tag.
- * @param tag New value of property tag.
- */
- public void setTag(String tag) {
- this.tag = tag;
- }
-
- /**
- * Gets the title of this outline
- * @return the title as a String
- */
- public String getTitle() {
- PdfString title = (PdfString)get(PdfName.TITLE);
- return title.toString();
- }
-
- /**
- * Sets the title of this outline
- * @param title
- */
- public void setTitle(String title) {
- put(PdfName.TITLE, new PdfString(title, PdfObject.TEXT_UNICODE));
- }
-
- /** Getter for property open.
- * @return Value of property open.
- */
- public boolean isOpen() {
- return open;
- }
-
- /** Setter for property open.
- * @param open New value of property open.
- */
- public void setOpen(boolean open) {
- this.open = open;
- }
-
- /** Getter for property color.
- * @return Value of property color.
- *
- */
- public Color getColor() {
- return this.color;
- }
-
- /** Setter for property color.
- * @param color New value of property color.
- *
- */
- public void setColor(Color color) {
- this.color = color;
- }
-
- /** Getter for property style.
- * @return Value of property style.
- *
- */
- public int getStyle() {
- return this.style;
- }
-
- /** Setter for property style.
- * @param style New value of property style.
- *
- */
- public void setStyle(int style) {
- this.style = style;
- }
-
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfPCell.java b/LibrarySource/com/lowagie/text/pdf/PdfPCell.java
deleted file mode 100644
index 05811be..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfPCell.java
+++ /dev/null
@@ -1,697 +0,0 @@
-/*
- * $Id: PdfPCell.java,v 1.56 2005/01/12 13:59:25 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.Element;
-import com.lowagie.text.Phrase;
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.Image;
-import com.lowagie.text.Chunk;
-
-/** A cell in a PdfPTable.
- */
-
-public class PdfPCell extends Rectangle{
-
- private ColumnText column = new ColumnText(null);
-
- /** Holds value of property verticalAlignment. */
- private int verticalAlignment = Element.ALIGN_TOP;
-
- /** Holds value of property paddingLeft. */
- private float paddingLeft = 2;
-
- /** Holds value of property paddingLeft. */
- private float paddingRight = 2;
-
- /** Holds value of property paddingTop. */
- private float paddingTop = 2;
-
- /** Holds value of property paddingBottom. */
- private float paddingBottom = 2;
-
- /** Holds value of property fixedHeight. */
- private float fixedHeight = 0;
-
- /** Holds value of property noWrap. */
- private boolean noWrap = false;
-
- /** Holds value of property table. */
- private PdfPTable table;
-
- /** Holds value of property minimumHeight. */
- private float minimumHeight;
-
- /** Holds value of property colspan. */
- private int colspan = 1;
-
- /** Holds value of property image. */
- private Image image;
-
- /** Holds value of property cellEvent. */
- private PdfPCellEvent cellEvent;
-
- /** Holds value of property useDescender. */
- private boolean useDescender;
-
- /** Increases padding to include border if true */
- private boolean useBorderPadding = false;
-
-
- /** The text in the cell. */
- protected Phrase phrase;
-
- /** Constructs an empty <CODE>PdfPCell</CODE>.
- * The default padding is 2.
- */
- public PdfPCell() {
- super(0, 0, 0, 0);
- borderWidth = 0.5f;
- border = BOX;
- column.setLeading(0, 1);
- }
-
- /** Constructs a <CODE>PdfPCell</CODE> with a <CODE>Phrase</CODE>.
- * The default padding is 2.
- * @param phrase the text
- */
- public PdfPCell(Phrase phrase) {
- super(0, 0, 0, 0);
- borderWidth = 0.5f;
- border = BOX;
- column.addText(this.phrase = phrase);
- column.setLeading(0, 1);
- }
-
- /** Constructs a <CODE>PdfPCell</CODE> with an <CODE>Image</CODE>.
- * The default padding is 0.
- * @param image the <CODE>Image</CODE>
- */
- public PdfPCell(Image image) {
- super(0, 0, 0, 0);
- borderWidth = 0.5f;
- border = BOX;
- column.addText(this.phrase = new Phrase(new Chunk(image, 0, 0)));
- column.setLeading(0, 1);
- setPadding(0);
- }
-
- /** Constructs a <CODE>PdfPCell</CODE> with an <CODE>Image</CODE>.
- * The default padding is 0.25 for a border width of 0.5.
- * @param image the <CODE>Image</CODE>
- * @param fit <CODE>true</CODE> to fit the image to the cell
- */
- public PdfPCell(Image image, boolean fit) {
- super(0, 0, 0, 0);
- if (fit) {
- borderWidth = 0.5f;
- border = BOX;
- this.image = image;
- column.setLeading(0, 1);
- setPadding(borderWidth / 2);
- }
- else {
- borderWidth = 0.5f;
- border = BOX;
- column.addText(this.phrase = new Phrase(new Chunk(image, 0, 0)));
- column.setLeading(0, 1);
- setPadding(0);
- }
- }
-
- /** Constructs a <CODE>PdfPCell</CODE> with a <CODE>PdfPtable</CODE>.
- * This constructor allows nested tables.
- * The default padding is 0.
- * @param table The <CODE>PdfPTable</CODE>
- */
- public PdfPCell(PdfPTable table) {
- super(0, 0, 0, 0);
- borderWidth = 0.5f;
- border = BOX;
- column.setLeading(0, 1);
- setPadding(0);
- this.table = table;
- table.setWidthPercentage(100);
- table.setExtendLastRow(true);
- column.addElement(table);
- }
-
- /** Constructs a deep copy of a <CODE>PdfPCell</CODE>.
- * @param cell the <CODE>PdfPCell</CODE> to duplicate
- */
- public PdfPCell(PdfPCell cell) {
- super(cell.llx, cell.lly, cell.urx, cell.ury);
- cloneNonPositionParameters(cell);
- verticalAlignment = cell.verticalAlignment;
- paddingLeft = cell.paddingLeft;
- paddingRight = cell.paddingRight;
- paddingTop = cell.paddingTop;
- paddingBottom = cell.paddingBottom;
- phrase = cell.phrase;
- fixedHeight = cell.fixedHeight;
- minimumHeight = cell.minimumHeight;
- noWrap = cell.noWrap;
- colspan = cell.colspan;
- if (cell.table != null)
- table = new PdfPTable(cell.table);
- image = Image.getInstance(cell.image);
- cellEvent = cell.cellEvent;
- useDescender = cell.useDescender;
- column = ColumnText.duplicate(cell.column);
- useBorderPadding = cell.useBorderPadding;
- }
-
- /**
- * Adds an iText element to the cell.
- * @param element
- */
- public void addElement(Element element) {
- if (table != null) {
- table = null;
- column.setText(null);
- }
- column.addElement(element);
- }
-
- /** Gets the <CODE>Phrase</CODE> from this cell.
- * @return the <CODE>Phrase</CODE>
- */
- public Phrase getPhrase() {
- return phrase;
- }
-
- /** Sets the <CODE>Phrase</CODE> for this cell.
- * @param phrase the <CODE>Phrase</CODE>
- */
- public void setPhrase(Phrase phrase) {
- table = null;
- image = null;
- column.setText(this.phrase = phrase);
- }
-
- /** Gets the horizontal alignment for the cell.
- * @return the horizontal alignment for the cell
- */
- public int getHorizontalAlignment() {
- return column.getAlignment();
- }
-
- /** Sets the horizontal alignment for the cell. It could be
- * <CODE>Element.ALIGN_CENTER</CODE> for example.
- * @param horizontalAlignment The horizontal alignment
- */
- public void setHorizontalAlignment(int horizontalAlignment) {
- column.setAlignment(horizontalAlignment);
- }
-
- /** Gets the vertical alignment for the cell.
- * @return the vertical alignment for the cell
- */
- public int getVerticalAlignment() {
- return verticalAlignment;
- }
-
- /** Sets the vertical alignment for the cell. It could be
- * <CODE>Element.ALIGN_MIDDLE</CODE> for example.
- * @param verticalAlignment The vertical alignment
- */
- public void setVerticalAlignment(int verticalAlignment) {
- if (table != null)
- table.setExtendLastRow(verticalAlignment == Element.ALIGN_TOP);
- this.verticalAlignment = verticalAlignment;
- }
-
- /** Gets the effective left padding. This will include
- * the left border width if {@link #isUseBorderPadding()} is true.
- * @return effective value of property paddingLeft.
- */
- public float getEffectivePaddingLeft() {
- return paddingLeft + (isUseBorderPadding() ? (getBorderWidthLeft()/(isUseVariableBorders()?1f:2f)) : 0);
- }
-
- /**
- * @return Value of property paddingLeft.
- */
- public float getPaddingLeft() {
- return paddingLeft;
- }
-
- /**
- * Setter for property paddingLeft.
- * @param paddingLeft New value of property paddingLeft.
- */
- public void setPaddingLeft(float paddingLeft) {
- this.paddingLeft = paddingLeft;
- }
-
- /** Gets the effective right padding. This will include
- * the right border width if {@link #isUseBorderPadding()} is true.
- * @return effective value of property paddingRight.
- */
- public float getEffectivePaddingRight() {
- return paddingRight + (isUseBorderPadding() ? (getBorderWidthRight()/(isUseVariableBorders()?1f:2f)) : 0);
- }
-
- /**
- * Getter for property paddingRight.
- * @return Value of property paddingRight.
- */
- public float getPaddingRight() {
- return paddingRight;
- }
-
- /**
- * Setter for property paddingRight.
- * @param paddingRight New value of property paddingRight.
- */
- public void setPaddingRight(float paddingRight) {
- this.paddingRight = paddingRight;
- }
-
- /** Gets the effective top padding. This will include
- * the top border width if {@link #isUseBorderPadding()} is true.
- * @return effective value of property paddingTop.
- */
- public float getEffectivePaddingTop() {
- return paddingTop + (isUseBorderPadding() ? (getBorderWidthTop()/(isUseVariableBorders()?1f:2f)) : 0);
- }
-
- /**
- * Getter for property paddingTop.
- * @return Value of property paddingTop.
- */
- public float getPaddingTop() {
- return paddingTop;
- }
-
- /**
- * Setter for property paddingTop.
- * @param paddingTop New value of property paddingTop.
- */
- public void setPaddingTop(float paddingTop) {
- this.paddingTop = paddingTop;
- }
-
- /** Gets the effective bottom padding. This will include
- * the bottom border width if {@link #isUseBorderPadding()} is true.
- * @return effective value of property paddingBottom.
- */
- public float getEffectivePaddingBottom() {
- return paddingBottom + (isUseBorderPadding() ? (getBorderWidthBottom()/(isUseVariableBorders()?1f:2f)) : 0);
- }
-
- /**
- * Getter for property paddingBottom.
- * @return Value of property paddingBottom.
- */
- public float getPaddingBottom() {
- return paddingBottom;
- }
-
- /**
- * Setter for property paddingBottom.
- * @param paddingBottom New value of property paddingBottom.
- */
- public void setPaddingBottom(float paddingBottom) {
- this.paddingBottom = paddingBottom;
- }
-
- /**
- * Sets the padding of the contents in the cell (space between content and border).
- * @param padding
- */
- public void setPadding(float padding) {
- paddingBottom = padding;
- paddingTop = padding;
- paddingLeft = padding;
- paddingRight = padding;
- }
-
- /**
- * If true, then effective padding will include border widths
- * @return true if effective padding includes border widths
- */
- public boolean isUseBorderPadding() {
- return useBorderPadding;
- }
-
- /**
- * Adjusts effective padding to include border widths.
- * @param use adjust effective padding if true
- */
- public void setUseBorderPadding(boolean use) {
- useBorderPadding = use;
- }
-
- /**
- * Sets the leading fixed and variable. The resultant leading will be
- * fixedLeading+multipliedLeading*maxFontSize where maxFontSize is the
- * size of the bigest font in the line.
- * @param fixedLeading the fixed leading
- * @param multipliedLeading the variable leading
- */
- public void setLeading(float fixedLeading, float multipliedLeading) {
- column.setLeading(fixedLeading, multipliedLeading);
- }
-
- /**
- * Gets the fixed leading
- * @return the leading
- */
- public float getLeading() {
- return column.getLeading();
- }
-
- /**
- * Gets the variable leading
- * @return the leading
- */
- public float getMultipliedLeading() {
- return column.getMultipliedLeading();
- }
-
- /**
- * Sets the first paragraph line indent.
- * @param indent the indent
- */
- public void setIndent(float indent) {
- column.setIndent(indent);
- }
-
- /**
- * Gets the first paragraph line indent.
- * @return the indent
- */
- public float getIndent() {
- return column.getIndent();
- }
-
- /**
- * Gets the extra space between paragraphs.
- * @return the extra space between paragraphs
- */
- public float getExtraParagraphSpace() {
- return column.getExtraParagraphSpace();
- }
-
- /**
- * Sets the extra space between paragraphs.
- * @param extraParagraphSpace the extra space between paragraphs
- */
- public void setExtraParagraphSpace(float extraParagraphSpace) {
- column.setExtraParagraphSpace(extraParagraphSpace);
- }
-
- /**
- * Getter for property fixedHeight.
- * @return Value of property fixedHeight.
- */
- public float getFixedHeight() {
- return fixedHeight;
- }
-
- /**
- * Setter for property fixedHeight.
- * @param fixedHeight New value of property fixedHeight.
- */
- public void setFixedHeight(float fixedHeight) {
- this.fixedHeight = fixedHeight;
- minimumHeight = 0;
- }
-
- /**
- * Getter for property noWrap.
- * @return Value of property noWrap.
- */
- public boolean isNoWrap() {
- return noWrap;
- }
-
- /**
- * Setter for property noWrap.
- * @param noWrap New value of property noWrap.
- */
- public void setNoWrap(boolean noWrap) {
- this.noWrap = noWrap;
- }
-
- /**
- * Getter for property table.
- * @return Value of property table.
- */
- PdfPTable getTable() {
- return table;
- }
-
- void setTable(PdfPTable table) {
- this.table = table;
- column.setText(null);
- image = null;
- if (table != null) {
- table.setExtendLastRow(verticalAlignment == Element.ALIGN_TOP);
- column.addElement(table);
- table.setWidthPercentage(100);
- }
- }
-
- /** Getter for property minimumHeight.
- * @return Value of property minimumHeight.
- */
- public float getMinimumHeight() {
- return minimumHeight;
- }
-
- /** Setter for property minimumHeight.
- * @param minimumHeight New value of property minimumHeight.
- */
- public void setMinimumHeight(float minimumHeight) {
- this.minimumHeight = minimumHeight;
- fixedHeight = 0;
- }
-
- /** Getter for property colspan.
- * @return Value of property colspan.
- */
- public int getColspan() {
- return colspan;
- }
-
- /** Setter for property colspan.
- * @param colspan New value of property colspan.
- */
- public void setColspan(int colspan) {
- this.colspan = colspan;
- }
-
- /**
- * Sets the following paragraph lines indent.
- * @param indent the indent
- */
- public void setFollowingIndent(float indent) {
- column.setFollowingIndent(indent);
- }
-
- /**
- * Gets the following paragraph lines indent.
- * @return the indent
- */
- public float getFollowingIndent() {
- return column.getFollowingIndent();
- }
-
- /**
- * Sets the right paragraph lines indent.
- * @param indent the indent
- */
- public void setRightIndent(float indent) {
- column.setRightIndent(indent);
- }
-
- /**
- * Gets the right paragraph lines indent.
- * @return the indent
- */
- public float getRightIndent() {
- return column.getRightIndent();
- }
-
- /** Gets the space/character extra spacing ratio for
- * fully justified text.
- * @return the space/character extra spacing ratio
- */
- public float getSpaceCharRatio() {
- return column.getSpaceCharRatio();
- }
-
- /** Sets the ratio between the extra word spacing and the extra character spacing
- * when the text is fully justified.
- * Extra word spacing will grow <CODE>spaceCharRatio</CODE> times more than extra character spacing.
- * If the ratio is <CODE>PdfWriter.NO_SPACE_CHAR_RATIO</CODE> then the extra character spacing
- * will be zero.
- * @param spaceCharRatio the ratio between the extra word spacing and the extra character spacing
- */
- public void setSpaceCharRatio(float spaceCharRatio) {
- column.setSpaceCharRatio(spaceCharRatio);
- }
-
- /**
- * Sets the run direction of the text content in the cell (PdfWriter.RUN_DIRECTION_DEFAULT, PdfWriter.RUN_DIRECTION_NO_BIDI, PdfWriter.RUN_DIRECTION_LTR or PdfWriter.RUN_DIRECTION_RTL).
- * @param runDirection
- */
- public void setRunDirection(int runDirection) {
- column.setRunDirection(runDirection);
- }
-
- /**
- * Gets the run direction of the text content in the cell
- * @return One of the following values: PdfWriter.RUN_DIRECTION_DEFAULT, PdfWriter.RUN_DIRECTION_NO_BIDI, PdfWriter.RUN_DIRECTION_LTR or PdfWriter.RUN_DIRECTION_RTL.
- */
- public int getRunDirection() {
- return column.getRunDirection();
- }
-
- /** Getter for property image.
- * @return Value of property image.
- *
- */
- public Image getImage() {
- return this.image;
- }
-
- /** Setter for property image.
- * @param image New value of property image.
- *
- */
- public void setImage(Image image) {
- column.setText(null);
- table = null;
- this.image = image;
- }
-
- /** Gets the cell event for this cell.
- * @return the cell event
- *
- */
- public PdfPCellEvent getCellEvent() {
- return this.cellEvent;
- }
-
- /** Sets the cell event for this cell.
- * @param cellEvent the cell event
- *
- */
- public void setCellEvent(PdfPCellEvent cellEvent) {
- this.cellEvent = cellEvent;
- }
-
- /** Gets the arabic shaping options.
- * @return the arabic shaping options
- */
- public int getArabicOptions() {
- return column.getArabicOptions();
- }
-
- /** Sets the arabic shaping options. The option can be AR_NOVOWEL,
- * AR_COMPOSEDTASHKEEL and AR_LIG.
- * @param arabicOptions the arabic shaping options
- */
- public void setArabicOptions(int arabicOptions) {
- column.setArabicOptions(arabicOptions);
- }
-
- /** Gets state of first line height based on max ascender
- * @return true if an ascender is to be used.
- */
- public boolean isUseAscender() {
- return column.isUseAscender();
- }
-
- /** Enables/ Disables adjustment of first line height based on max ascender.
- *
- * @param use adjust height if true
- */
- public void setUseAscender(boolean use) {
- column.setUseAscender(use);
- }
-
-
- /** Getter for property useDescender.
- * @return Value of property useDescender.
- *
- */
- public boolean isUseDescender() {
- return this.useDescender;
- }
-
- /** Setter for property useDescender.
- * @param useDescender New value of property useDescender.
- *
- */
- public void setUseDescender(boolean useDescender) {
- this.useDescender = useDescender;
- }
-
- /**
- * Gets the ColumnText with the content of the cell.
- * @return a columntext object
- */
- public ColumnText getColumn() {
- return column;
- }
-
- /**
- * Sets the columntext in the cell.
- * @param column
- */
- public void setColumn(ColumnText column) {
- this.column = column;
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfPCellEvent.java b/LibrarySource/com/lowagie/text/pdf/PdfPCellEvent.java
deleted file mode 100644
index f1d2f8c..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfPCellEvent.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2003 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.Rectangle;
-
-/** An event called for a single cell.
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public interface PdfPCellEvent {
- /** This method is called at the end of the cell rendering. The text or graphics are added to
- * one of the 4 <CODE>PdfContentByte</CODE> contained in
- * <CODE>canvases</CODE>.<br>
- * The indexes to <CODE>canvases</CODE> are:<p>
- * <ul>
- * <li><CODE>PdfPTable.BASECANVAS</CODE> - the original <CODE>PdfContentByte</CODE>. Anything placed here
- * will be under the cell.
- * <li><CODE>PdfPTable.BACKGROUNDCANVAS</CODE> - the layer where the background goes to.
- * <li><CODE>PdfPTable.LINECANVAS</CODE> - the layer where the lines go to.
- * <li><CODE>PdfPTable.TEXTCANVAS</CODE> - the layer where the text go to. Anything placed here
- * will be over the cell.
- * </ul>
- * The layers are placed in sequence on top of each other.
- * <p>
- * @param cell the cell
- * @param position the coordinates of the cell
- * @param canvases an array of <CODE>PdfContentByte</CODE>
- */
- public void cellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases);
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfPRow.java b/LibrarySource/com/lowagie/text/pdf/PdfPRow.java
deleted file mode 100644
index e1f9bc6..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfPRow.java
+++ /dev/null
@@ -1,530 +0,0 @@
-/*
- * $Id: PdfPRow.java,v 1.63 2005/01/11 13:59:21 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.ExceptionConverter;
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.Element;
-import com.lowagie.text.Image;
-import com.lowagie.text.Rectangle;
-import headless.awt.Color;
-
-/**
- * A row in a PdfPTable.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-
-public class PdfPRow {
-
- /** the bottom limit (bottom right y) */
- public static final float BOTTOM_LIMIT = -(1 << 30);
-
- protected PdfPCell cells[];
-
- protected float widths[];
-
- protected float maxHeight = 0;
-
- protected boolean calculated = false;
-
- /**
- * Constructs a new PdfPRow with the cells in the array that was passed as a parameter.
- * @param cells
- */
- public PdfPRow(PdfPCell cells[]) {
- this.cells = cells;
- widths = new float[cells.length];
- }
-
- /**
- * Makes a copy of an existing row.
- * @param row
- */
- public PdfPRow(PdfPRow row) {
- maxHeight = row.maxHeight;
- calculated = row.calculated;
- cells = new PdfPCell[row.cells.length];
- for (int k = 0; k < cells.length; ++k) {
- if (row.cells[k] != null)
- cells[k] = new PdfPCell(row.cells[k]);
- }
- widths = new float[cells.length];
- System.arraycopy(row.widths, 0, widths, 0, cells.length);
- }
-
- /**
- * Sets the widths of the columns in the row.
- * @param widths
- * @return true if everything went right
- */
- public boolean setWidths(float widths[]) {
- if (widths.length != cells.length)
- return false;
- System.arraycopy(widths, 0, this.widths, 0, cells.length);
- float total = 0;
- calculated = false;
- for (int k = 0; k < widths.length; ++k) {
- PdfPCell cell = cells[k];
- cell.setLeft(total);
- int last = k + cell.getColspan();
- for (; k < last; ++k)
- total += widths[k];
- --k;
- cell.setRight(total);
- cell.setTop(0);
- }
- return true;
- }
-
- /**
- * Calculates the heights of each cell in the row.
- * @return the maximum height of the row.
- */
- public float calculateHeights() {
- maxHeight = 0;
- for (int k = 0; k < cells.length; ++k) {
- PdfPCell cell = cells[k];
- if (cell == null)
- continue;
- Image img = cell.getImage();
- if (img != null) {
- img.scalePercent(100);
- float scale = (cell.right() - cell.getEffectivePaddingRight()
- - cell.getEffectivePaddingLeft() - cell.left())
- / img.scaledWidth();
- img.scalePercent(scale * 100);
- cell
- .setBottom(cell.top() - cell.getEffectivePaddingTop()
- - cell.getEffectivePaddingBottom()
- - img.scaledHeight());
- } else {
- float rightLimit = cell.isNoWrap() ? 20000 : cell.right()
- - cell.getEffectivePaddingRight();
- float bry = (cell.getFixedHeight() > 0) ? cell.top()
- - cell.getEffectivePaddingTop()
- + cell.getEffectivePaddingBottom()
- - cell.getFixedHeight() : BOTTOM_LIMIT;
- ColumnText ct = ColumnText.duplicate(cell.getColumn());
- ct.setSimpleColumn(
- cell.left() + cell.getEffectivePaddingLeft(), bry,
- rightLimit, cell.top() - cell.getEffectivePaddingTop());
- try {
- ct.go(true);
- } catch (DocumentException e) {
- throw new ExceptionConverter(e);
- }
- float yLine = ct.getYLine();
- if (cell.isUseDescender())
- yLine += ct.getDescender();
- cell.setBottom(yLine - cell.getEffectivePaddingBottom());
- }
- float height = cell.getFixedHeight();
- if (height <= 0)
- height = cell.height();
- if (height < cell.getFixedHeight())
- height = cell.getFixedHeight();
- else if (height < cell.getMinimumHeight())
- height = cell.getMinimumHeight();
- if (height > maxHeight)
- maxHeight = height;
- }
- calculated = true;
- return maxHeight;
- }
-
- /**
- * Writes the border and background of one cell in the row.
- * @param xPos
- * @param yPos
- * @param cell
- * @param canvases
- */
- public void writeBorderAndBackground(float xPos, float yPos, PdfPCell cell,
- PdfContentByte[] canvases) {
- PdfContentByte lines = canvases[PdfPTable.LINECANVAS];
- PdfContentByte backgr = canvases[PdfPTable.BACKGROUNDCANVAS];
- // the coordinates of the border are retrieved
- float x1 = cell.left() + xPos;
- float y2 = cell.top() + yPos;
- float x2 = cell.right() + xPos;
- float y1 = y2 - maxHeight;
-
- // the backgroundcolor is set
- Color background = cell.backgroundColor();
- if (background != null) {
- backgr.setColorFill(background);
- backgr.rectangle(x1, y1, x2 - x1, y2 - y1);
- backgr.fill();
- } else if (cell.grayFill() > 0) {
- backgr.setGrayFill(cell.grayFill());
- backgr.rectangle(x1, y1, x2 - x1, y2 - y1);
- backgr.fill();
- }
- // if the element hasn't got any borders, nothing is added
- if (cell.hasBorders()) {
- if (cell.isUseVariableBorders()) {
- Rectangle borderRect = new Rectangle(cell.left() + xPos, cell
- .top()
- - maxHeight + yPos, cell.right() + xPos, cell.top()
- + yPos);
- borderRect.cloneNonPositionParameters(cell);
- lines.rectangle(borderRect);
- } else {
- // the width is set to the width of the element
- if (cell.borderWidth() != Rectangle.UNDEFINED) {
- lines.setLineWidth(cell.borderWidth());
- }
- // the color is set to the color of the element
- Color color = cell.borderColor();
- if (color != null) {
- lines.setColorStroke(color);
- }
-
- // if the box is a rectangle, it is added as a rectangle
- if (cell.hasBorder(Rectangle.BOX)) {
- lines.rectangle(x1, y1, x2 - x1, y2 - y1);
- }
- // if the border isn't a rectangle, the different sides are
- // added apart
- else {
- if (cell.hasBorder(Rectangle.RIGHT)) {
- lines.moveTo(x2, y1);
- lines.lineTo(x2, y2);
- }
- if (cell.hasBorder(Rectangle.LEFT)) {
- lines.moveTo(x1, y1);
- lines.lineTo(x1, y2);
- }
- if (cell.hasBorder(Rectangle.BOTTOM)) {
- lines.moveTo(x1, y1);
- lines.lineTo(x2, y1);
- }
- if (cell.hasBorder(Rectangle.TOP)) {
- lines.moveTo(x1, y2);
- lines.lineTo(x2, y2);
- }
- }
- lines.stroke();
- if (color != null) {
- lines.resetRGBColorStroke();
- }
- }
- }
- }
-
- /**
- * Writes a number of cells (not necessarily all cells).
- * @param colStart
- * @param colEnd
- * @param xPos
- * @param yPos
- * @param canvases
- */
- public void writeCells(int colStart, int colEnd, float xPos, float yPos,
- PdfContentByte[] canvases) {
- if (!calculated)
- calculateHeights();
- if (colEnd < 0)
- colEnd = cells.length;
- colEnd = Math.min(colEnd, cells.length);
- if (colStart < 0)
- colStart = 0;
- if (colStart >= colEnd)
- return;
- int newStart;
- for (newStart = colStart; newStart >= 0; --newStart) {
- if (cells[newStart] != null)
- break;
- xPos -= widths[newStart - 1];
- }
- xPos -= cells[newStart].left();
- for (int k = newStart; k < colEnd; ++k) {
- PdfPCell cell = cells[k];
- if (cell == null)
- continue;
- writeBorderAndBackground(xPos, yPos, cell, canvases);
- PdfPTable table = cell.getTable();
- Image img = cell.getImage();
- float tly = 0;
- boolean alignTop = false;
- switch (cell.getVerticalAlignment()) {
- case Element.ALIGN_BOTTOM:
- tly = cell.top() + yPos - maxHeight + cell.height()
- - cell.getEffectivePaddingTop();
- break;
- case Element.ALIGN_MIDDLE:
- tly = cell.top() + yPos + (cell.height() - maxHeight) / 2
- - cell.getEffectivePaddingTop();
- break;
- default:
- alignTop = true;
- tly = cell.top() + yPos - cell.getEffectivePaddingTop();
- break;
- }
- if (img != null) {
- boolean vf = false;
- if (cell.height() > maxHeight) {
- img.scalePercent(100);
- float scale = (maxHeight - cell.getEffectivePaddingTop() - cell
- .getEffectivePaddingBottom())
- / img.scaledHeight();
- img.scalePercent(scale * 100);
- vf = true;
- }
- float left = cell.left() + xPos
- + cell.getEffectivePaddingLeft();
- if (vf) {
- switch (cell.getHorizontalAlignment()) {
- case Element.ALIGN_CENTER:
- left = xPos
- + (cell.left() + cell.getEffectivePaddingLeft()
- + cell.right()
- - cell.getEffectivePaddingRight() - img
- .scaledWidth()) / 2;
- break;
- case Element.ALIGN_RIGHT:
- left = xPos + cell.right()
- - cell.getEffectivePaddingRight()
- - img.scaledWidth();
- break;
- default:
- break;
- }
- tly = cell.top() + yPos - cell.getEffectivePaddingTop();
- }
- img.setAbsolutePosition(left, tly - img.scaledHeight());
- try {
- canvases[PdfPTable.TEXTCANVAS].addImage(img);
- } catch (DocumentException e) {
- throw new ExceptionConverter(e);
- }
- } else {
- float fixedHeight = cell.getFixedHeight();
- float rightLimit = cell.right() + xPos
- - cell.getEffectivePaddingRight();
- float leftLimit = cell.left() + xPos
- + cell.getEffectivePaddingLeft();
- if (cell.isNoWrap()) {
- switch (cell.getHorizontalAlignment()) {
- case Element.ALIGN_CENTER:
- rightLimit += 10000;
- leftLimit -= 10000;
- break;
- case Element.ALIGN_RIGHT:
- leftLimit -= 20000;
- break;
- default:
- rightLimit += 20000;
- break;
- }
- }
- ColumnText ct = ColumnText.duplicate(cell.getColumn());
- ct.setCanvas(canvases[PdfPTable.TEXTCANVAS]);
- float bry = tly
- - (maxHeight /* cell.height() */
- - cell.getEffectivePaddingTop() - cell
- .getEffectivePaddingBottom());
- if (fixedHeight > 0) {
- if (cell.height() > maxHeight) {
- tly = cell.top() + yPos - cell.getEffectivePaddingTop();
- bry = cell.top() + yPos - maxHeight
- + cell.getEffectivePaddingBottom();
- }
- }
- if (tly > bry || ct.zeroHeightElement()) {
- ct
- .setSimpleColumn(leftLimit, bry - 0.001f,
- rightLimit, tly);
- try {
- ct.go();
- } catch (DocumentException e) {
- throw new ExceptionConverter(e);
- }
- }
- }
- PdfPCellEvent evt = cell.getCellEvent();
- if (evt != null) {
- Rectangle rect = new Rectangle(cell.left() + xPos, cell.top()
- + yPos - maxHeight, cell.right() + xPos, cell.top()
- + yPos);
- evt.cellLayout(cell, rect, canvases);
- }
- }
- }
-
- /**
- * Checks if the dimensions of the columns were calculated.
- * @return true if the dimensions of the columns were calculated
- */
- public boolean isCalculated() {
- return calculated;
- }
-
- /**
- * Gets the maximum height of the row (i.e. of the 'highest' cell).
- * @return the maximum height of the row
- */
- public float getMaxHeights() {
- if (calculated)
- return maxHeight;
- else
- return calculateHeights();
- }
-
- /**
- * Changes the maximum height of the row (to make it higher).
- * (added by Jin-Hsia Yang)
- * @param maxHeight the new maximum height
- */
- public void setMaxHeights(float maxHeight) {
- this.maxHeight = maxHeight;
- }
-
- //end add
-
- float[] getEventWidth(float xPos) {
- int n = 0;
- for (int k = 0; k < cells.length; ++k) {
- if (cells[k] != null)
- ++n;
- }
- float width[] = new float[n + 1];
- n = 0;
- width[n++] = xPos;
- for (int k = 0; k < cells.length; ++k) {
- if (cells[k] != null) {
- width[n] = width[n - 1] + cells[k].width();
- ++n;
- }
- }
- return width;
- }
-
- /**
- * Splits a row to newHeight. The returned row is the remainder. It will
- * return null if the newHeight was so small that only an empty row would
- * result.
- *
- * @param newHeight
- * the new height
- * @return the remainder row or null if the newHeight was so small that only
- * an empty row would result
- */
- public PdfPRow splitRow(float newHeight) {
- PdfPCell newCells[] = new PdfPCell[cells.length];
- float fh[] = new float[cells.length * 2];
- boolean allEmpty = true;
- for (int k = 0; k < cells.length; ++k) {
- PdfPCell cell = cells[k];
- if (cell == null)
- continue;
- fh[k * 2] = cell.getFixedHeight();
- fh[k * 2 + 1] = cell.getMinimumHeight();
- Image img = cell.getImage();
- PdfPCell c2 = new PdfPCell(cell);
- if (img != null) {
- if (newHeight > cell.getEffectivePaddingBottom()
- + cell.getEffectivePaddingTop() + 2) {
- c2.setPhrase(null);
- allEmpty = false;
- }
- } else {
- float rightLimit = cell.isNoWrap() ? 20000 : cell.right()
- - cell.getEffectivePaddingRight();
- ColumnText ct = ColumnText.duplicate(cell.getColumn());
- float y1 = cell.top() - newHeight
- + cell.getEffectivePaddingBottom();
- float y2 = cell.top() - cell.getEffectivePaddingTop();
- float y = Math.max(y1, y2);
- int status;
- ct.setSimpleColumn(
- cell.left() + cell.getEffectivePaddingLeft(), y1,
- rightLimit, y2);
- try {
- status = ct.go(true);
- } catch (DocumentException e) {
- throw new ExceptionConverter(e);
- }
- boolean thisEmpty = (ct.getYLine() == y);
- if (thisEmpty)
- ct = ColumnText.duplicate(cell.getColumn());
- allEmpty = (allEmpty && thisEmpty);
- if ((status & ColumnText.NO_MORE_TEXT) == 0 || thisEmpty) {
- c2.setColumn(ct);
- } else {
- c2.setPhrase(null);
- }
- }
- newCells[k] = c2;
- cell.setFixedHeight(newHeight);
- }
- if (allEmpty) {
- for (int k = 0; k < cells.length; ++k) {
- PdfPCell cell = cells[k];
- if (cell == null)
- continue;
- float f = fh[k * 2];
- float m = fh[k * 2 + 1];
- if (f <= 0)
- cell.setMinimumHeight(m);
- else
- cell.setFixedHeight(f);
- }
- return null;
- }
- calculateHeights();
- PdfPRow split = new PdfPRow(newCells);
- split.widths = (float[]) widths.clone();
- split.calculateHeights();
- return split;
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfPSXObject.java b/LibrarySource/com/lowagie/text/pdf/PdfPSXObject.java
deleted file mode 100644
index 42f1ee9..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfPSXObject.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2005 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import java.io.IOException;
-
-/**
- * Implements the PostScript XObject.
- */
-public class PdfPSXObject extends PdfTemplate {
-
- /** Creates a new instance of PdfPSXObject */
- protected PdfPSXObject() {
- super();
- }
-
- /**
- * Constructs a PSXObject
- * @param wr
- */
- public PdfPSXObject(PdfWriter wr) {
- super(wr);
- }
-
- /**
- * Gets the stream representing this object.
- *
- * @return the stream representing this object
- * @throws IOException
- */
-
- PdfStream getFormXObject() throws IOException {
- PdfStream s = new PdfStream(content.toByteArray());
- s.put(PdfName.TYPE, PdfName.XOBJECT);
- s.put(PdfName.SUBTYPE, PdfName.PS);
- s.flateCompress();
- return s;
- }
-
- /**
- * Gets a duplicate of this <CODE>PdfPSXObject</CODE>. All
- * the members are copied by reference but the buffer stays different.
- * @return a copy of this <CODE>PdfPSXObject</CODE>
- */
-
- public PdfContentByte getDuplicate() {
- PdfPSXObject tpl = new PdfPSXObject();
- tpl.writer = writer;
- tpl.pdf = pdf;
- tpl.thisReference = thisReference;
- tpl.pageResources = pageResources;
- tpl.separator = separator;
- return tpl;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfPTable.java b/LibrarySource/com/lowagie/text/pdf/PdfPTable.java
deleted file mode 100644
index 3d4cd28..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfPTable.java
+++ /dev/null
@@ -1,1014 +0,0 @@
-/*
- * $Id: PdfPTable.java,v 1.58 2005/01/10 15:35:57 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.util.ArrayList;
-import com.lowagie.text.Phrase;
-import com.lowagie.text.Element;
-import com.lowagie.text.Image;
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.ElementListener;
-import com.lowagie.text.DocumentException;
-
-/** This is a table that can be put at an absolute position but can also
- * be added to the document as the class <CODE>Table</CODE>.
- * In the last case when crossing pages the table always break at full rows; if a
- * row is bigger than the page it is dropped silently to avoid infinite loops.
- * <P>
- * A PdfPTableEvent can be associated to the table to do custom drawing
- * when the table is rendered.
- * @author Paulo Soares (psoares at consiste.pt)
- */
-
-public class PdfPTable implements Element{
-
- /** The index of the original <CODE>PdfcontentByte</CODE>.
- */
- public static final int BASECANVAS = 0;
- /** The index of the duplicate <CODE>PdfContentByte</CODE> where the background will be drawn.
- */
- public static final int BACKGROUNDCANVAS = 1;
- /** The index of the duplicate <CODE>PdfContentByte</CODE> where the border lines will be drawn.
- */
- public static final int LINECANVAS = 2;
- /** The index of the duplicate <CODE>PdfContentByte</CODE> where the text will be drawn.
- */
- public static final int TEXTCANVAS = 3;
-
- protected ArrayList rows = new ArrayList();
- protected float totalHeight = 0;
- protected PdfPCell currentRow[];
- protected int currentRowIdx = 0;
- protected PdfPCell defaultCell = new PdfPCell((Phrase)null);
- protected float totalWidth = 0;
- protected float relativeWidths[];
- protected float absoluteWidths[];
- protected PdfPTableEvent tableEvent;
-
-/** Holds value of property headerRows. */
- protected int headerRows;
-
-/** Holds value of property widthPercentage. */
- protected float widthPercentage = 80;
-
-/** Holds value of property horizontalAlignment. */
- private int horizontalAlignment = Element.ALIGN_CENTER;
-
-/** Holds value of property skipFirstHeader. */
- private boolean skipFirstHeader = false;
-
- protected boolean isColspan = false;
-
- protected int runDirection = PdfWriter.RUN_DIRECTION_DEFAULT;
-
- /**
- * Holds value of property lockedWidth.
- */
- private boolean lockedWidth = false;
-
- /**
- * Holds value of property splitRows.
- */
- private boolean splitRows = true;
-
-/** The spacing before the table. */
- protected float spacingBefore;
-
-/** The spacing after the table. */
- protected float spacingAfter;
-
- /**
- * Holds value of property extendLastRow.
- */
- private boolean extendLastRow;
-
- /**
- * Holds value of property headersInEvent.
- */
- private boolean headersInEvent;
-
- /**
- * Holds value of property splitLate.
- */
- private boolean splitLate = true;
-
- protected PdfPTable() {
- }
-
- /** Constructs a <CODE>PdfPTable</CODE> with the relative column widths.
- * @param relativeWidths the relative column widths
- */
- public PdfPTable(float relativeWidths[]) {
- if (relativeWidths == null)
- throw new NullPointerException("The widths array in PdfPTable constructor can not be null.");
- if (relativeWidths.length == 0)
- throw new IllegalArgumentException("The widths array in PdfPTable constructor can not have zero length.");
- this.relativeWidths = new float[relativeWidths.length];
- System.arraycopy(relativeWidths, 0, this.relativeWidths, 0, relativeWidths.length);
- absoluteWidths = new float[relativeWidths.length];
- calculateWidths();
- currentRow = new PdfPCell[absoluteWidths.length];
- }
-
- /** Constructs a <CODE>PdfPTable</CODE> with <CODE>numColumns</CODE> columns.
- * @param numColumns the number of columns
- */
- public PdfPTable(int numColumns) {
- if (numColumns <= 0)
- throw new IllegalArgumentException("The number of columns in PdfPTable constructor must be greater than zero.");
- relativeWidths = new float[numColumns];
- for (int k = 0; k < numColumns; ++k)
- relativeWidths[k] = 1;
- absoluteWidths = new float[relativeWidths.length];
- calculateWidths();
- currentRow = new PdfPCell[absoluteWidths.length];
- }
-
- /** Constructs a copy of a <CODE>PdfPTable</CODE>.
- * @param table the <CODE>PdfPTable</CODE> to be copied
- */
- public PdfPTable(PdfPTable table) {
- copyFormat(table);
- for (int k = 0; k < currentRow.length; ++k) {
- if (table.currentRow[k] == null)
- break;
- currentRow[k] = new PdfPCell(table.currentRow[k]);
- }
- for (int k = 0; k < table.rows.size(); ++k) {
- PdfPRow row = (PdfPRow)(table.rows.get(k));
- if (row != null)
- row = new PdfPRow(row);
- rows.add(row);
- }
- }
-
- /**
- * Makes a shallow copy of a table (format without content).
- * @param table
- * @return a shallow copy of the table
- */
- public static PdfPTable shallowCopy(PdfPTable table) {
- PdfPTable nt = new PdfPTable();
- nt.copyFormat(table);
- return nt;
- }
-
- /**
- * Copies the format of the sourceTable without copying the content.
- * @param sourceTable
- */
- private void copyFormat(PdfPTable sourceTable) {
- relativeWidths = new float[sourceTable.relativeWidths.length];
- absoluteWidths = new float[sourceTable.relativeWidths.length];
- System.arraycopy(sourceTable.relativeWidths, 0, relativeWidths, 0, relativeWidths.length);
- System.arraycopy(sourceTable.absoluteWidths, 0, absoluteWidths, 0, relativeWidths.length);
- totalWidth = sourceTable.totalWidth;
- totalHeight = sourceTable.totalHeight;
- currentRowIdx = 0;
- tableEvent = sourceTable.tableEvent;
- runDirection = sourceTable.runDirection;
- defaultCell = new PdfPCell(sourceTable.defaultCell);
- currentRow = new PdfPCell[sourceTable.currentRow.length];
- isColspan = sourceTable.isColspan;
- splitRows = sourceTable.splitRows;
- spacingAfter = sourceTable.spacingAfter;
- spacingBefore = sourceTable.spacingBefore;
- headerRows = sourceTable.headerRows;
- lockedWidth = sourceTable.lockedWidth;
- extendLastRow = sourceTable.extendLastRow;
- headersInEvent = sourceTable.headersInEvent;
- widthPercentage = sourceTable.widthPercentage;
- splitLate = sourceTable.splitLate;
- skipFirstHeader = sourceTable.skipFirstHeader;
- horizontalAlignment = sourceTable.horizontalAlignment;
- }
-
- /** Sets the relative widths of the table.
- * @param relativeWidths the relative widths of the table.
- * @throws DocumentException if the number of widths is different than the number
- * of columns
- */
- public void setWidths(float relativeWidths[]) throws DocumentException {
- if (relativeWidths.length != this.relativeWidths.length)
- throw new DocumentException("Wrong number of columns.");
- this.relativeWidths = new float[relativeWidths.length];
- System.arraycopy(relativeWidths, 0, this.relativeWidths, 0, relativeWidths.length);
- absoluteWidths = new float[relativeWidths.length];
- totalHeight = 0;
- calculateWidths();
- calculateHeights();
- }
-
- /** Sets the relative widths of the table.
- * @param relativeWidths the relative widths of the table.
- * @throws DocumentException if the number of widths is different than the number
- * of columns
- */
- public void setWidths(int relativeWidths[]) throws DocumentException {
- float tb[] = new float[relativeWidths.length];
- for (int k = 0; k < relativeWidths.length; ++k)
- tb[k] = relativeWidths[k];
- setWidths(tb);
- }
-
- private void calculateWidths() {
- if (totalWidth <= 0)
- return;
- float total = 0;
- for (int k = 0; k < absoluteWidths.length; ++k) {
- total += relativeWidths[k];
- }
- for (int k = 0; k < absoluteWidths.length; ++k) {
- absoluteWidths[k] = totalWidth * relativeWidths[k] / total;
- }
- }
-
- /** Sets the full width of the table.
- * @param totalWidth the full width of the table.
- */
- public void setTotalWidth(float totalWidth) {
- if (this.totalWidth == totalWidth)
- return;
- this.totalWidth = totalWidth;
- totalHeight = 0;
- calculateWidths();
- calculateHeights();
- }
-
- /** Sets the full width of the table from the absolute column width.
- * @param columnWidth the absolute width of each column
- * @throws DocumentException if the number of widths is different than the number
- * of columns
- */
- public void setTotalWidth(float columnWidth[]) throws DocumentException {
- if (columnWidth.length != this.relativeWidths.length)
- throw new DocumentException("Wrong number of columns.");
- totalWidth = 0;
- for (int k = 0; k < columnWidth.length; ++k)
- totalWidth += columnWidth[k];
- setWidths(columnWidth);
- }
-
- /** Sets the percentage width of the table from the absolute column width.
- * @param columnWidth the absolute width of each column
- * @param pageSize the page size
- * @throws DocumentException
- */
- public void setWidthPercentage(float columnWidth[], Rectangle pageSize) throws DocumentException {
- if (columnWidth.length != this.relativeWidths.length)
- throw new IllegalArgumentException("Wrong number of columns.");
- float totalWidth = 0;
- for (int k = 0; k < columnWidth.length; ++k)
- totalWidth += columnWidth[k];
- widthPercentage = totalWidth / (pageSize.right() - pageSize.left()) * 100f;
- setWidths(columnWidth);
- }
-
- /** Gets the full width of the table.
- * @return the full width of the table
- */
- public float getTotalWidth() {
- return totalWidth;
- }
-
- void calculateHeights() {
- if (totalWidth <= 0)
- return;
- totalHeight = 0;
- for (int k = 0; k < rows.size(); ++k) {
- PdfPRow row = (PdfPRow)rows.get(k);
- if (row != null) {
- row.setWidths(absoluteWidths);
- totalHeight += row.getMaxHeights();
- }
- }
- }
-
- /**
- * Calculates the heights of the table.
- */
- public void calculateHeightsFast() {
- if (totalWidth <= 0)
- return;
- totalHeight = 0;
- for (int k = 0; k < rows.size(); ++k) {
- PdfPRow row = (PdfPRow)rows.get(k);
- if (row != null)
- totalHeight += row.getMaxHeights();
- }
- }
-
- /** Gets the default <CODE>PdfPCell</CODE> that will be used as
- * reference for all the <CODE>addCell</CODE> methods except
- * <CODE>addCell(PdfPCell)</CODE>.
- * @return default <CODE>PdfPCell</CODE>
- */
- public PdfPCell getDefaultCell() {
- return defaultCell;
- }
-
- /** Adds a cell element.
- * @param cell the cell element
- */
- public void addCell(PdfPCell cell) {
- PdfPCell ncell = new PdfPCell(cell);
- int colspan = ncell.getColspan();
- colspan = Math.max(colspan, 1);
- colspan = Math.min(colspan, currentRow.length - currentRowIdx);
- ncell.setColspan(colspan);
- if (colspan != 1)
- isColspan = true;
- int rdir = ncell.getRunDirection();
- if (rdir == PdfWriter.RUN_DIRECTION_DEFAULT)
- ncell.setRunDirection(runDirection);
- currentRow[currentRowIdx] = ncell;
- currentRowIdx += colspan;
- if (currentRowIdx >= currentRow.length) {
- if (runDirection == PdfWriter.RUN_DIRECTION_RTL) {
- PdfPCell rtlRow[] = new PdfPCell[absoluteWidths.length];
- int rev = currentRow.length;
- for (int k = 0; k < currentRow.length; ++k) {
- PdfPCell rcell = currentRow[k];
- int cspan = rcell.getColspan();
- rev -= cspan;
- rtlRow[rev] = rcell;
- k += cspan - 1;
- }
- currentRow = rtlRow;
- }
- PdfPRow row = new PdfPRow(currentRow);
- if (totalWidth > 0) {
- row.setWidths(absoluteWidths);
- totalHeight += row.getMaxHeights();
- }
- rows.add(row);
- currentRow = new PdfPCell[absoluteWidths.length];
- currentRowIdx = 0;
- }
- }
-
- /** Adds a cell element.
- * @param text the text for the cell
- */
- public void addCell(String text) {
- addCell(new Phrase(text));
- }
-
- /**
- * Adds a nested table.
- * @param table the table to be added to the cell
- */
- public void addCell(PdfPTable table) {
- defaultCell.setTable(table);
- addCell(defaultCell);
- defaultCell.setTable(null);
- }
-
- /**
- * Adds an Image as Cell.
- * @param image the <CODE>Image</CODE> to add to the table. This image will fit in the cell
- */
- public void addCell(Image image) {
- defaultCell.setImage(image);
- addCell(defaultCell);
- defaultCell.setImage(null);
- }
-
- /**
- * Adds a cell element.
- * @param phrase the <CODE>Phrase</CODE> to be added to the cell
- */
- public void addCell(Phrase phrase) {
- defaultCell.setPhrase(phrase);
- addCell(defaultCell);
- defaultCell.setPhrase(null);
- }
-
- /**
- * Writes the selected rows to the document.
- * <P>
- * <CODE>canvases</CODE> is obtained from <CODE>beginWritingRows()</CODE>.
- * @param rowStart the first row to be written, zero index
- * @param rowEnd the last row to be written + 1. If it is -1 all the
- * rows to the end are written
- * @param xPos the x write coodinate
- * @param yPos the y write coodinate
- * @param canvases an array of 4 <CODE>PdfContentByte</CODE> obtained from
- * <CODE>beginWrittingRows()</CODE>
- * @return the y coordinate position of the bottom of the last row
- * @see #beginWritingRows(com.lowagie.text.pdf.PdfContentByte)
- */
- public float writeSelectedRows(int rowStart, int rowEnd, float xPos, float yPos, PdfContentByte[] canvases) {
- return writeSelectedRows(0, -1, rowStart, rowEnd, xPos, yPos, canvases);
- }
-
- /** Writes the selected rows and columns to the document.
- * This method does not clip the columns; this is only important
- * if there are columns with colspan at boundaries.
- * <P>
- * <CODE>canvases</CODE> is obtained from <CODE>beginWritingRows()</CODE>.
- * <P>
- * The table event is only fired for complete rows.
- * @param colStart the first column to be written, zero index
- * @param colEnd the last column to be written + 1. If it is -1 all the
- * columns to the end are written
- * @param rowStart the first row to be written, zero index
- * @param rowEnd the last row to be written + 1. If it is -1 all the
- * rows to the end are written
- * @param xPos the x write coodinate
- * @param yPos the y write coodinate
- * @param canvases an array of 4 <CODE>PdfContentByte</CODE> obtained from
- * <CODE>beginWrittingRows()</CODE>
- * @return the y coordinate position of the bottom of the last row
- * @see #beginWritingRows(com.lowagie.text.pdf.PdfContentByte)
- */
- public float writeSelectedRows(int colStart, int colEnd, int rowStart, int rowEnd, float xPos, float yPos, PdfContentByte[] canvases) {
- if (totalWidth <= 0)
- throw new RuntimeException("The table width must be greater than zero.");
- int size = rows.size();
- if (rowEnd < 0)
- rowEnd = size;
- rowEnd = Math.min(rowEnd, size);
- if (rowStart < 0)
- rowStart = 0;
- if (rowStart >= rowEnd)
- return yPos;
- if (colEnd < 0)
- colEnd = absoluteWidths.length;
- colEnd = Math.min(colEnd, absoluteWidths.length);
- if (colStart < 0)
- colStart = 0;
- colStart = Math.min(colStart, absoluteWidths.length);
- float yPosStart = yPos;
- for (int k = rowStart; k < rowEnd; ++k) {
- PdfPRow row = (PdfPRow)rows.get(k);
- if (row != null) {
- row.writeCells(colStart, colEnd, xPos, yPos, canvases);
- yPos -= row.getMaxHeights();
- }
- }
- if (tableEvent != null && colStart == 0 && colEnd == absoluteWidths.length) {
- float heights[] = new float[rowEnd - rowStart + 1];
- heights[0] = yPosStart;
- for (int k = rowStart; k < rowEnd; ++k) {
- PdfPRow row = (PdfPRow)rows.get(k);
- float hr = 0;
- if (row != null)
- hr = row.getMaxHeights();
- heights[k - rowStart + 1] = heights[k - rowStart] - hr;
- }
- tableEvent.tableLayout(this, getEventWidths(xPos, rowStart, rowEnd, headersInEvent), heights, headersInEvent ? headerRows : 0, rowStart, canvases);
- }
- return yPos;
- }
-
- /**
- * Writes the selected rows to the document.
- *
- * @param rowStart the first row to be written, zero index
- * @param rowEnd the last row to be written + 1. If it is -1 all the
- * rows to the end are written
- * @param xPos the x write coodinate
- * @param yPos the y write coodinate
- * @param canvas the <CODE>PdfContentByte</CODE> where the rows will
- * be written to
- * @return the y coordinate position of the bottom of the last row
- */
- public float writeSelectedRows(int rowStart, int rowEnd, float xPos, float yPos, PdfContentByte canvas) {
- return writeSelectedRows(0, -1, rowStart, rowEnd, xPos, yPos, canvas);
- }
-
- /**
- * Writes the selected rows to the document.
- * This method clips the columns; this is only important
- * if there are columns with colspan at boundaries.
- * <P>
- * The table event is only fired for complete rows.
- *
- * @param colStart the first column to be written, zero index
- * @param colEnd the last column to be written + 1. If it is -1 all the
- * @param rowStart the first row to be written, zero index
- * @param rowEnd the last row to be written + 1. If it is -1 all the
- * rows to the end are written
- * @param xPos the x write coodinate
- * @param yPos the y write coodinate
- * @param canvas the <CODE>PdfContentByte</CODE> where the rows will
- * be written to
- * @return the y coordinate position of the bottom of the last row
- */
- public float writeSelectedRows(int colStart, int colEnd, int rowStart, int rowEnd, float xPos, float yPos, PdfContentByte canvas) {
- if (colEnd < 0)
- colEnd = absoluteWidths.length;
- colEnd = Math.min(colEnd, absoluteWidths.length);
- if (colStart < 0)
- colStart = 0;
- colStart = Math.min(colStart, absoluteWidths.length);
- if (colStart != 0 || colEnd != absoluteWidths.length) {
- float w = 0;
- for (int k = colStart; k < colEnd; ++k)
- w += absoluteWidths[k];
- canvas.saveState();
- float lx = 0;
- float rx = 0;
- if (colStart == 0)
- lx = 10000;
- if (colEnd == absoluteWidths.length)
- rx = 10000;
- canvas.rectangle(xPos - lx, -10000, w + lx + rx, 20000);
- canvas.clip();
- canvas.newPath();
- }
- PdfContentByte[] canvases = beginWritingRows(canvas);
- float y = writeSelectedRows(colStart, colEnd, rowStart, rowEnd, xPos, yPos, canvases);
- endWritingRows(canvases);
- if (colStart != 0 || colEnd != absoluteWidths.length)
- canvas.restoreState();
- return y;
- }
-
- /** Gets and initializes the 4 layers where the table is written to. The text or graphics are added to
- * one of the 4 <CODE>PdfContentByte</CODE> returned with the following order:<p>
- * <ul>
- * <li><CODE>PdfPtable.BASECANVAS</CODE> - the original <CODE>PdfContentByte</CODE>. Anything placed here
- * will be under the table.
- * <li><CODE>PdfPtable.BACKGROUNDCANVAS</CODE> - the layer where the background goes to.
- * <li><CODE>PdfPtable.LINECANVAS</CODE> - the layer where the lines go to.
- * <li><CODE>PdfPtable.TEXTCANVAS</CODE> - the layer where the text go to. Anything placed here
- * will be over the table.
- * </ul><p>
- * The layers are placed in sequence on top of each other.
- * @param canvas the <CODE>PdfContentByte</CODE> where the rows will
- * be written to
- * @return an array of 4 <CODE>PdfContentByte</CODE>
- * @see #writeSelectedRows(int, int, float, float, PdfContentByte[])
- */
- public static PdfContentByte[] beginWritingRows(PdfContentByte canvas) {
- return new PdfContentByte[]{
- canvas,
- canvas.getDuplicate(),
- canvas.getDuplicate(),
- canvas.getDuplicate(),
- };
- }
-
- /** Finishes writing the table.
- * @param canvases the array returned by <CODE>beginWritingRows()</CODE>
- */
- public static void endWritingRows(PdfContentByte[] canvases) {
- PdfContentByte canvas = canvases[BASECANVAS];
- canvas.saveState();
- canvas.add(canvases[BACKGROUNDCANVAS]);
- canvas.restoreState();
- canvas.saveState();
- canvas.setLineCap(2);
- canvas.resetRGBColorStroke();
- canvas.add(canvases[LINECANVAS]);
- canvas.restoreState();
- canvas.add(canvases[TEXTCANVAS]);
- }
-
- /** Gets the number of rows in this table.
- * @return the number of rows in this table
- */
- public int size() {
- return rows.size();
- }
-
- /** Gets the total height of the table.
- * @return the total height of the table
- */
- public float getTotalHeight() {
- return totalHeight;
- }
-
- /** Gets the height of a particular row.
- * @param idx the row index (starts at 0)
- * @return the height of a particular row
- */
- public float getRowHeight(int idx) {
- if (totalWidth <= 0 || idx < 0 || idx >= rows.size())
- return 0;
- PdfPRow row = (PdfPRow)rows.get(idx);
- if (row == null)
- return 0;
- return row.getMaxHeights();
- }
-
- /** Gets the height of the rows that constitute the header as defined by
- * <CODE>setHeaderRows()</CODE>.
- * @return the height of the rows that constitute the header
- */
- public float getHeaderHeight() {
- float total = 0;
- int size = Math.min(rows.size(), headerRows);
- for (int k = 0; k < size; ++k) {
- PdfPRow row = (PdfPRow)rows.get(k);
- if (row != null)
- total += row.getMaxHeights();
- }
- return total;
- }
-
- /** Deletes a row from the table.
- * @param rowNumber the row to be deleted
- * @return <CODE>true</CODE> if the row was deleted
- */
- public boolean deleteRow(int rowNumber) {
- if (rowNumber < 0 || rowNumber >= rows.size()) {
- return false;
- }
- if (totalWidth > 0) {
- PdfPRow row = (PdfPRow)rows.get(rowNumber);
- if (row != null)
- totalHeight -= row.getMaxHeights();
- }
- rows.remove(rowNumber);
- return true;
- }
-
- /** Deletes the last row in the table.
- * @return <CODE>true</CODE> if the last row was deleted
- */
- public boolean deleteLastRow() {
- return deleteRow(rows.size() - 1);
- }
-
- /**
- * Removes all of the rows except headers
- */
- public void deleteBodyRows() {
- ArrayList rows2 = new ArrayList();
- for (int k = 0; k < headerRows; ++k)
- rows2.add(rows.get(k));
- rows = rows2;
- totalHeight = 0;
- if (totalWidth > 0)
- totalHeight = getHeaderHeight();
- }
-
- /** Gets the number of the rows that constitute the header.
- * @return the number of the rows that constitute the header
- */
- public int getHeaderRows() {
- return headerRows;
- }
-
- /** Sets the number of the top rows that constitute the header.
- * This header has only meaning if the table is added to <CODE>Document</CODE>
- * and the table crosses pages.
- * @param headerRows the number of the top rows that constitute the header
- */
- public void setHeaderRows(int headerRows) {
- if (headerRows < 0)
- headerRows = 0;
- this.headerRows = headerRows;
- }
-
- /**
- * Gets all the chunks in this element.
- *
- * @return an <CODE>ArrayList</CODE>
- */
- public ArrayList getChunks() {
- return new ArrayList();
- }
-
- /**
- * Gets the type of the text element.
- *
- * @return a type
- */
- public int type() {
- return Element.PTABLE;
- }
-
- /**
- * Processes the element by adding it (or the different parts) to an
- * <CODE>ElementListener</CODE>.
- *
- * @param listener an <CODE>ElementListener</CODE>
- * @return <CODE>true</CODE> if the element was processed successfully
- */
- public boolean process(ElementListener listener) {
- try {
- return listener.add(this);
- }
- catch(DocumentException de) {
- return false;
- }
- }
-
- /** Gets the width percentage that the table will occupy in the page.
- * @return the width percentage that the table will occupy in the page
- */
- public float getWidthPercentage() {
- return widthPercentage;
- }
-
- /** Sets the width percentage that the table will occupy in the page.
- * @param widthPercentage the width percentage that the table will occupy in the page
- */
- public void setWidthPercentage(float widthPercentage) {
- this.widthPercentage = widthPercentage;
- }
-
- /** Gets the horizontal alignment of the table relative to the page.
- * @return the horizontal alignment of the table relative to the page
- */
- public int getHorizontalAlignment() {
- return horizontalAlignment;
- }
-
- /** Sets the horizontal alignment of the table relative to the page.
- * It only has meaning if the width percentage is less than
- * 100%.
- * @param horizontalAlignment the horizontal alignment of the table relative to the page
- */
- public void setHorizontalAlignment(int horizontalAlignment) {
- this.horizontalAlignment = horizontalAlignment;
- }
-
- /**
- * Gets a row with a given index
- * (added by Jin-Hsia Yang).
- * @param idx
- * @return the row at position idx
- */
- public PdfPRow getRow(int idx) {
- return (PdfPRow)rows.get(idx);
- }
-
- /**
- * Gets an arraylist with all the rows in the table.
- * @return an arraylist
- */
- public ArrayList getRows() {
- return rows;
- }
-
- /** Sets the table event for this table.
- * @param event the table event for this table
- */
- public void setTableEvent(PdfPTableEvent event) {
- tableEvent = event;
- }
-
- /** Gets the table event for this page.
- * @return the table event for this page
- */
- public PdfPTableEvent getTableEvent() {
- return tableEvent;
- }
-
- /** Gets the absolute sizes of each column width.
- * @return he absolute sizes of each column width
- */
- public float[] getAbsoluteWidths() {
- return absoluteWidths;
- }
-
- float [][] getEventWidths(float xPos, int firstRow, int lastRow, boolean includeHeaders) {
- if (includeHeaders) {
- firstRow = Math.max(firstRow, headerRows);
- lastRow = Math.max(lastRow, headerRows);
- }
- float widths[][] = new float[(includeHeaders ? headerRows : 0) + lastRow - firstRow][];
- if (isColspan) {
- int n = 0;
- if (includeHeaders) {
- for (int k = 0; k < headerRows; ++k) {
- PdfPRow row = (PdfPRow)rows.get(k);
- if (row == null)
- ++n;
- else
- widths[n++] = row.getEventWidth(xPos);
- }
- }
- for (; firstRow < lastRow; ++firstRow) {
- PdfPRow row = (PdfPRow)rows.get(firstRow);
- if (row == null)
- ++n;
- else
- widths[n++] = row.getEventWidth(xPos);
- }
- }
- else {
- float width[] = new float[absoluteWidths.length + 1];
- width[0] = xPos;
- for (int k = 0; k < absoluteWidths.length; ++k)
- width[k + 1] = width[k] + absoluteWidths[k];
- for (int k = 0; k < widths.length; ++k)
- widths[k] = width;
- }
- return widths;
- }
-
-
- /** Getter for property skipFirstHeader.
- * @return Value of property skipFirstHeader.
- */
- public boolean isSkipFirstHeader() {
- return skipFirstHeader;
- }
-
- /** Skips the printing of the first header. Used when printing
- * tables in succession belonging to the same printed table aspect.
- * @param skipFirstHeader New value of property skipFirstHeader.
- */
- public void setSkipFirstHeader(boolean skipFirstHeader) {
- this.skipFirstHeader = skipFirstHeader;
- }
-
- /**
- * Sets the run direction of the contents of the table.
- * @param runDirection
- */
- public void setRunDirection(int runDirection) {
- if (runDirection < PdfWriter.RUN_DIRECTION_DEFAULT || runDirection > PdfWriter.RUN_DIRECTION_RTL)
- throw new RuntimeException("Invalid run direction: " + runDirection);
- this.runDirection = runDirection;
- }
-
- /**
- * Returns the run direction of the contents in the table.
- * @return One of the following values: PdfWriter.RUN_DIRECTION_DEFAULT, PdfWriter.RUN_DIRECTION_NO_BIDI, PdfWriter.RUN_DIRECTION_LTR or PdfWriter.RUN_DIRECTION_RTL.
- */
- public int getRunDirection() {
- return runDirection;
- }
-
- /**
- * Getter for property lockedWidth.
- * @return Value of property lockedWidth.
- */
- public boolean isLockedWidth() {
- return this.lockedWidth;
- }
-
- /**
- * Uses the value in <CODE>setTotalWidth()</CODE> in <CODE>Document.add()</CODE>.
- * @param lockedWidth <CODE>true</CODE> to use the value in <CODE>setTotalWidth()</CODE> in <CODE>Document.add()</CODE>
- */
- public void setLockedWidth(boolean lockedWidth) {
- this.lockedWidth = lockedWidth;
- }
-
- /**
- * Gets the split value.
- * @return true to split; false otherwise
- */
- public boolean isSplitRows() {
- return this.splitRows;
- }
-
- /**
- * When set the rows that won't fit in the page will be split.
- * Note that it takes at least twice the memory to handle a split table row
- * than a normal table. <CODE>true</CODE> by default.
- * @param splitRows true to split; false otherwise
- */
- public void setSplitRows(boolean splitRows) {
- this.splitRows = splitRows;
- }
-
-/**
- * Sets the spacing before this table.
- *
- * @param spacing the new spacing
- */
-
- public void setSpacingBefore(float spacing) {
- this.spacingBefore = spacing;
- }
-
-/**
- * Sets the spacing after this table.
- *
- * @param spacing the new spacing
- */
-
- public void setSpacingAfter(float spacing) {
- this.spacingAfter = spacing;
- }
-
-/**
- * Gets the spacing before this table.
- *
- * @return the spacing
- */
-
- public float spacingBefore() {
- return spacingBefore;
- }
-
-/**
- * Gets the spacing before this table.
- *
- * @return the spacing
- */
-
- public float spacingAfter() {
- return spacingAfter;
- }
-
- /**
- * Gets the value of the last row extension.
- * @return true if the last row will extend; false otherwise
- */
- public boolean isExtendLastRow() {
- return this.extendLastRow;
- }
-
- /**
- * When set the last row will be extended to fill all the remaining space to the
- * bottom boundary.
- * @param extendLastRow true to extend the last row; false otherwise
- */
- public void setExtendLastRow(boolean extendLastRow) {
- this.extendLastRow = extendLastRow;
- }
-
- /**
- * Gets the header status inclusion in PdfPTableEvent.
- * @return true if the headers are included; false otherwise
- */
- public boolean isHeadersInEvent() {
- return this.headersInEvent;
- }
-
- /**
- * When set the PdfPTableEvent will include the headers.
- * @param headersInEvent true to include the headers; false otherwise
- */
- public void setHeadersInEvent(boolean headersInEvent) {
- this.headersInEvent = headersInEvent;
- }
-
- /**
- * Gets the property splitLate.
- * @return the property splitLate
- */
- public boolean isSplitLate() {
- return this.splitLate;
- }
-
- /**
- * If true the row will only split if it's the first one in an empty page.
- * It's true by default.
- *<p>
- * It's only meaningful if setSplitRows(true).
- * @param splitLate the property value
- */
- public void setSplitLate(boolean splitLate) {
- this.splitLate = splitLate;
- }
-
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfPTableEvent.java b/LibrarySource/com/lowagie/text/pdf/PdfPTableEvent.java
deleted file mode 100644
index 90f4f64..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfPTableEvent.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * $Id: PdfPTableEvent.java,v 1.13 2002/06/20 13:30:25 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/** An interface that can be used to retrieve the position of cells in <CODE>PdfPTable</CODE>.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public interface PdfPTableEvent {
-
- /** This method is called at the end of the table rendering. The text or graphics are added to
- * one of the 4 <CODE>PdfContentByte</CODE> contained in
- * <CODE>canvases</CODE>.<br>
- * The indexes to <CODE>canvases</CODE> are:<p>
- * <ul>
- * <li><CODE>PdfPTable.BASECANVAS</CODE> - the original <CODE>PdfContentByte</CODE>. Anything placed here
- * will be under the table.
- * <li><CODE>PdfPTable.BACKGROUNDCANVAS</CODE> - the layer where the background goes to.
- * <li><CODE>PdfPTable.LINECANVAS</CODE> - the layer where the lines go to.
- * <li><CODE>PdfPTable.TEXTCANVAS</CODE> - the layer where the text go to. Anything placed here
- * will be over the table.
- * </ul>
- * The layers are placed in sequence on top of each other.
- * <p>
- * The <CODE>widths</CODE> and <CODE>heights</CODE> have the coordinates of the cells.<br>
- * The size of the <CODE>widths</CODE> array is the number of rows.
- * Each sub-array in <CODE>widths</CODE> corresponds to the x column border positions where
- * the first element is the x coordinate of the left table border and the last
- * element is the x coordinate of the right table border.
- * If colspan is not used all the sub-arrays in <CODE>widths</CODE>
- * are the same.<br>
- * For the <CODE>heights</CODE> the first element is the y coordinate of the top table border and the last
- * element is the y coordinate of the bottom table border.
- * @param table the <CODE>PdfPTable</CODE> in use
- * @param widths an array of arrays with the cells' x positions. It has the length of the number
- * of rows
- * @param heights an array with the cells' y positions. It has a length of the number
- * of rows + 1
- * @param headerRows the number of rows defined for the header.
- * @param rowStart the first row number after the header
- * @param canvases an array of <CODE>PdfContentByte</CODE>
- */
- public void tableLayout(PdfPTable table, float widths[][], float heights[], int headerRows, int rowStart, PdfContentByte[] canvases);
-
-}
-
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfPage.java b/LibrarySource/com/lowagie/text/pdf/PdfPage.java
deleted file mode 100644
index 1b84750..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfPage.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * $Id: PdfPage.java,v 1.47 2004/11/29 14:07:03 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-import java.util.HashMap;
-/**
- * <CODE>PdfPage</CODE> is the PDF Page-object.
- * <P>
- * A Page object is a dictionary whose keys describe a single page containing text,
- * graphics, and images. A Page onjects is a leaf of the Pages tree.<BR>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 6.4 (page 73-81)
- *
- * @see PdfPageElement
- * @see PdfPages
- */
-
-public class PdfPage extends PdfDictionary {
-
- private static final String boxStrings[] = {"crop", "trim", "art", "bleed"};
- private static final PdfName boxNames[] = {PdfName.CROPBOX, PdfName.TRIMBOX, PdfName.ARTBOX, PdfName.BLEEDBOX};
- // membervariables
-
-/** value of the <B>Rotate</B> key for a page in PORTRAIT */
- public static final PdfNumber PORTRAIT = new PdfNumber(0);
-
-/** value of the <B>Rotate</B> key for a page in LANDSCAPE */
- public static final PdfNumber LANDSCAPE = new PdfNumber(90);
-
-/** value of the <B>Rotate</B> key for a page in INVERTEDPORTRAIT */
- public static final PdfNumber INVERTEDPORTRAIT = new PdfNumber(180);
-
-/** value of the <B>Rotate</B> key for a page in SEASCAPE */
- public static final PdfNumber SEASCAPE = new PdfNumber(270);
-
-/** value of the <B>MediaBox</B> key */
- PdfRectangle mediaBox;
-
- // constructors
-
-/**
- * Constructs a <CODE>PdfPage</CODE>.
- *
- * @param mediaBox a value for the <B>MediaBox</B> key
- * @param resources an indirect reference to a <CODE>PdfResources</CODE>-object
- * @param rotate a value for the <B>Rotate</B> key
- */
-
-// PdfPage(PdfRectangle mediaBox, Rectangle cropBox, PdfIndirectReference resources, PdfNumber rotate) {
-// super(PAGE);
-// this.mediaBox = mediaBox;
-// put(PdfName.MEDIABOX, mediaBox);
-// put(PdfName.RESOURCES, resources);
-// if (rotate != null) {
-// put(PdfName.ROTATE, rotate);
-// }
-// if (cropBox != null)
-// put(PdfName.CROPBOX, new PdfRectangle(cropBox));
-// }
-
-/**
- * Constructs a <CODE>PdfPage</CODE>.
- *
- * @param mediaBox a value for the <B>MediaBox</B> key
- * @param resources an indirect reference to a <CODE>PdfResources</CODE>-object
- * @param rotate a value for the <B>Rotate</B> key
- */
-
- PdfPage(PdfRectangle mediaBox, HashMap boxSize, PdfDictionary resources, int rotate) {
- super(PAGE);
- this.mediaBox = mediaBox;
- put(PdfName.MEDIABOX, mediaBox);
- put(PdfName.RESOURCES, resources);
- if (rotate != 0) {
- put(PdfName.ROTATE, new PdfNumber(rotate));
- }
- for (int k = 0; k < boxStrings.length; ++k) {
- PdfObject rect = (PdfObject)boxSize.get(boxStrings[k]);
- if (rect != null)
- put(boxNames[k], rect);
- }
- }
-
-/**
- * Constructs a <CODE>PdfPage</CODE>.
- *
- * @param mediaBox a value for the <B>MediaBox</B> key
- * @param resources an indirect reference to a <CODE>PdfResources</CODE>-object
- */
-
-// PdfPage(PdfRectangle mediaBox, Rectangle cropBox, PdfIndirectReference resources) {
-// this(mediaBox, cropBox, resources, null);
-// }
-
-/**
- * Constructs a <CODE>PdfPage</CODE>.
- *
- * @param mediaBox a value for the <B>MediaBox</B> key
- * @param resources an indirect reference to a <CODE>PdfResources</CODE>-object
- */
-
- PdfPage(PdfRectangle mediaBox, HashMap boxSize, PdfDictionary resources) {
- this(mediaBox, boxSize, resources, 0);
- }
-
-/**
- * Checks if this page element is a tree of pages.
- * <P>
- * This method allways returns <CODE>false</CODE>.
- *
- * @return <CODE>false</CODE> because this is a single page
- */
-
- public boolean isParent() {
- return false;
- }
-
- // methods
-
-/**
- * Adds an indirect reference pointing to a <CODE>PdfContents</CODE>-object.
- *
- * @param contents an indirect reference to a <CODE>PdfContents</CODE>-object
- */
-
- void add(PdfIndirectReference contents) {
- put(PdfName.CONTENTS, contents);
- }
-
-/**
- * Rotates the mediabox, but not the text in it.
- *
- * @return a <CODE>PdfRectangle</CODE>
- */
-
- PdfRectangle rotateMediaBox() {
- this.mediaBox = mediaBox.rotate();
- put(PdfName.MEDIABOX, this.mediaBox);
- return this.mediaBox;
- }
-
-/**
- * Returns the MediaBox of this Page.
- *
- * @return a <CODE>PdfRectangle</CODE>
- */
-
- PdfRectangle getMediaBox() {
- return mediaBox;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfPageElement.java b/LibrarySource/com/lowagie/text/pdf/PdfPageElement.java
deleted file mode 100644
index 6799854..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfPageElement.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * $Id: PdfPageElement.java,v 1.24 2002/07/09 11:28:23 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/**
- * The <CODE>PdfPageElement</CODE> interface has to be implemented by <CODE>PdfPage</CODE> and <CODE>PdfPages</CODE>.
- *
- * @see PdfPage
- * @see PdfPages
- */
-
-interface PdfPageElement {
-
-/**
- * Set the value for the <B>Parent</B> key in the Page or Pages Dictionary.
- *
- * @param reference an indirect reference to a <CODE>PdfPages</CODE>-object
- */
-
- public void setParent(PdfIndirectReference reference);
-
-/**
- * Checks if this page element is a tree of pages.
- *
- * @return <CODE>true</CODE> if it's a tree of pages;
- * <CODE>false</CODE> if it's a single page
- */
-
- public boolean isParent();
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfPageEvent.java b/LibrarySource/com/lowagie/text/pdf/PdfPageEvent.java
deleted file mode 100644
index e76bf5b..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfPageEvent.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * $Id: PdfPageEvent.java,v 1.23 2002/07/09 11:28:24 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-import com.lowagie.text.Document;
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.Paragraph;
-
-/**
- * Allows a class to catch several document events.
- *<p>
- * Note: do not use Document.add() inside a page event.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-
-public interface PdfPageEvent {
-
-/**
- * Called when the document is opened.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- */
- public void onOpenDocument(PdfWriter writer, Document document);
-
-/**
- * Called when a page is initialized.
- * <P>
- * Note that if even if a page is not written this method is still
- * called. It is preferable to use <CODE>onEndPage</CODE> to avoid
- * infinite loops.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- */
- public void onStartPage(PdfWriter writer, Document document);
-
-/**
- * Called when a page is finished, just before being written to the document.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- */
- public void onEndPage(PdfWriter writer, Document document);
-
-/**
- * Called when the document is closed.
- * <P>
- * Note that this method is called with the page number equal
- * to the last page plus one.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- */
- public void onCloseDocument(PdfWriter writer, Document document);
-
-/**
- * Called when a Paragraph is written.
- * <P>
- * <CODE>paragraphPosition</CODE> will hold the height at which the
- * paragraph will be written to. This is useful to insert bookmarks with
- * more control.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- * @param paragraphPosition the position the paragraph will be written to
- */
- public void onParagraph(PdfWriter writer, Document document, float paragraphPosition);
-
-/**
- * Called when a Paragraph is written.
- * <P>
- * <CODE>paragraphPosition</CODE> will hold the height of the end of the paragraph.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- * @param paragraphPosition the position of the end of the paragraph
- */
- public void onParagraphEnd(PdfWriter writer,Document document,float paragraphPosition);
-
-/**
- * Called when a Chapter is written.
- * <P>
- * <CODE>position</CODE> will hold the height at which the
- * chapter will be written to.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- * @param paragraphPosition the position the chapter will be written to
- * @param title the title of the Chapter
- */
- public void onChapter(PdfWriter writer,Document document,float paragraphPosition, Paragraph title);
-
-/**
- * Called when the end of a Chapter is reached.
- * <P>
- * <CODE>position</CODE> will hold the height of the end of the chapter.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- * @param paragraphPosition the position the chapter will be written to
- */
- public void onChapterEnd(PdfWriter writer,Document document,float paragraphPosition);
-
-/**
- * Called when a Section is written.
- * <P>
- * <CODE>position</CODE> will hold the height at which the
- * section will be written to.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- * @param paragraphPosition the position the section will be written to
- * @param depth the number depth of the section
- * @param title the title of the section
- */
- public void onSection(PdfWriter writer,Document document,float paragraphPosition, int depth, Paragraph title);
-
-/**
- * Called when the end of a Section is reached.
- * <P>
- * <CODE>position</CODE> will hold the height of the section end.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- * @param paragraphPosition the position the section will be written to
- */
- public void onSectionEnd(PdfWriter writer,Document document,float paragraphPosition);
-
-/**
- * Called when a <CODE>Chunk</CODE> with a generic tag is written.
- * <P>
- * It is usefull to pinpoint the <CODE>Chunk</CODE> location to generate
- * bookmarks, for example.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- * @param rect the <CODE>Rectangle</CODE> containing the <CODE>Chunk</CODE>
- * @param text the text of the tag
- */
- public void onGenericTag(PdfWriter writer, Document document, Rectangle rect, String text);
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfPageEventHelper.java b/LibrarySource/com/lowagie/text/pdf/PdfPageEventHelper.java
deleted file mode 100644
index ab99717..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfPageEventHelper.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * $Id: PdfPageEventHelper.java,v 1.23 2002/07/09 11:28:24 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-import com.lowagie.text.Document;
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.Paragraph;
-
-/**
- * Helps the use of <CODE>PdfPageEvent</CODE> by implementing all the interface methods.
- * A class can extend <CODE>PdfPageEventHelper</CODE> and only implement the
- * needed methods.
- *<p>
- * Note: do not use Document.add() inside a page event.
- * @author Paulo Soares (psoares at consiste.pt)
- */
-
-public class PdfPageEventHelper implements PdfPageEvent {
-
-/**
- * Called when the document is opened.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- */
- public void onOpenDocument(PdfWriter writer,Document document) {
- }
-
-/**
- * Called when a page is initialized.
- * <P>
- * Note that if even if a page is not written this method is still
- * called. It is preferable to use <CODE>onEndPage</CODE> to avoid
- * infinite loops.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- */
- public void onStartPage(PdfWriter writer,Document document) {
- }
-
-/**
- * Called when a page is finished, just before being written to the document.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- */
- public void onEndPage(PdfWriter writer,Document document) {
- }
-
-/**
- * Called when the document is closed.
- * <P>
- * Note that this method is called with the page number equal
- * to the last page plus one.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- */
- public void onCloseDocument(PdfWriter writer,Document document) {
- }
-
-/**
- * Called when a Paragraph is written.
- * <P>
- * <CODE>paragraphPosition</CODE> will hold the height at which the
- * paragraph will be written to. This is useful to insert bookmarks with
- * more control.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- * @param paragraphPosition the position the paragraph will be written to
- */
- public void onParagraph(PdfWriter writer,Document document,float paragraphPosition) {
- }
-
-/**
- * Called when a Paragraph is written.
- * <P>
- * <CODE>paragraphPosition</CODE> will hold the height of the end of the paragraph.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- * @param paragraphPosition the position of the end of the paragraph
- */
- public void onParagraphEnd(PdfWriter writer,Document document,float paragraphPosition) {
- }
-
-/**
- * Called when a Chapter is written.
- * <P>
- * <CODE>position</CODE> will hold the height at which the
- * chapter will be written to.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- * @param paragraphPosition the position the chapter will be written to
- * @param title the title of the Chapter
- */
- public void onChapter(PdfWriter writer,Document document,float paragraphPosition,Paragraph title) {
- }
-
-/**
- * Called when the end of a Chapter is reached.
- * <P>
- * <CODE>position</CODE> will hold the height of the end of the chapter.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- * @param position the position of the end of the chapter.
- */
- public void onChapterEnd(PdfWriter writer,Document document,float position) {
- }
-
-/**
- * Called when a Section is written.
- * <P>
- * <CODE>position</CODE> will hold the height at which the
- * section will be written to.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- * @param paragraphPosition the position the section will be written to
- * @param depth the number depth of the Section
- * @param title the title of the section
- */
- public void onSection(PdfWriter writer,Document document,float paragraphPosition,int depth,Paragraph title) {
- }
-
-/**
- * Called when the end of a Section is reached.
- * <P>
- * <CODE>position</CODE> will hold the height of the section end.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- * @param position the position of the end of the section
- */
- public void onSectionEnd(PdfWriter writer,Document document,float position) {
- }
-
-/**
- * Called when a <CODE>Chunk</CODE> with a generic tag is written.
- * <P>
- * It is usefull to pinpoint the <CODE>Chunk</CODE> location to generate
- * bookmarks, for example.
- *
- * @param writer the <CODE>PdfWriter</CODE> for this document
- * @param document the document
- * @param rect the <CODE>Rectangle</CODE> containing the <CODE>Chunk</CODE>
- * @param text the text of the tag
- */
- public void onGenericTag(PdfWriter writer,Document document,Rectangle rect,String text) {
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfPageLabels.java b/LibrarySource/com/lowagie/text/pdf/PdfPageLabels.java
deleted file mode 100644
index 4c60f8a..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfPageLabels.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * $Id: PdfPageLabels.java,v 1.14 2002/07/09 11:28:24 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.util.Comparator;
-import java.util.TreeMap;
-import java.util.Iterator;
-
-/** Page labels are used to identify each
- * page visually on the screen or in print.
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class PdfPageLabels implements Comparator {
-
- /** Logical pages will have the form 1,2,3,...
- */
- public static int DECIMAL_ARABIC_NUMERALS = 0;
- /** Logical pages will have the form I,II,III,IV,...
- */
- public static int UPPERCASE_ROMAN_NUMERALS = 1;
- /** Logical pages will have the form i,ii,iii,iv,...
- */
- public static int LOWERCASE_ROMAN_NUMERALS = 2;
- /** Logical pages will have the form of uppercase letters
- * (A to Z for the first 26 pages, AA to ZZ for the next 26, and so on)
- */
- public static int UPPERCASE_LETTERS = 3;
- /** Logical pages will have the form of uppercase letters
- * (a to z for the first 26 pages, aa to zz for the next 26, and so on)
- */
- public static int LOWERCASE_LETTERS = 4;
- /** No logical page numbers are generated but fixed text may
- * still exist
- */
- public static int EMPTY = 5;
- /** Dictionary values to set the logical page styles
- */
- static PdfName numberingStyle[] = new PdfName[]{PdfName.D, PdfName.R,
- new PdfName("r"), PdfName.A, new PdfName("a")};
- /** The sequence of logical pages. Will contain at least a value for page 1
- */
- TreeMap map;
-
- /** Creates a new PdfPageLabel with a default logical page 1
- */
- public PdfPageLabels() {
- map = new TreeMap(this);
- addPageLabel(1, DECIMAL_ARABIC_NUMERALS, null, 1);
- }
-
- /** Compares two <CODE>Integer</CODE>.
- * @param obj the first <CODE>Integer</CODE>
- * @param obj1 the second <CODE>Integer</CODE>
- * @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
- */
- public int compare(Object obj, Object obj1) {
- int v1 = ((Integer)obj).intValue();
- int v2 = ((Integer)obj1).intValue();
- if (v1 < v2)
- return -1;
- if (v1 == v2)
- return 0;
- return 1;
- }
-
- /** Not used
- * @param obj not used
- * @return always <CODE>true</CODE>
- */
- public boolean equals(Object obj) {
- return true;
- }
-
- /** Adds or replaces a page label.
- * @param page the real page to start the numbering. First page is 1
- * @param numberStyle the numbering style such as LOWERCASE_ROMAN_NUMERALS
- * @param text the text to prefix the number. Can be <CODE>null</CODE> or empty
- * @param firstPage the first logical page number
- */
- public void addPageLabel(int page, int numberStyle, String text, int firstPage) {
- if (page < 1 || firstPage < 1)
- throw new IllegalArgumentException("In a page label the page numbers must be greater or equal to 1.");
- PdfName pdfName = null;
- if (numberStyle >= 0 && numberStyle < numberingStyle.length)
- pdfName = numberingStyle[numberStyle];
- Integer iPage = new Integer(page);
- Object obj = new Object[]{iPage, pdfName, text, new Integer(firstPage)};
- map.put(iPage, obj);
- }
-
- /** Adds or replaces a page label. The first logical page has the default
- * of 1.
- * @param page the real page to start the numbering. First page is 1
- * @param numberStyle the numbering style such as LOWERCASE_ROMAN_NUMERALS
- * @param text the text to prefix the number. Can be <CODE>null</CODE> or empty
- */
- public void addPageLabel(int page, int numberStyle, String text) {
- addPageLabel(page, numberStyle, text, 1);
- }
-
- /** Adds or replaces a page label. There is no text prefix and the first
- * logical page has the default of 1.
- * @param page the real page to start the numbering. First page is 1
- * @param numberStyle the numbering style such as LOWERCASE_ROMAN_NUMERALS
- */
- public void addPageLabel(int page, int numberStyle) {
- addPageLabel(page, numberStyle, null, 1);
- }
-
- /** Removes a page label. The first page label can not be removed, only changed.
- * @param page the real page to remove
- */
- public void removePageLabel(int page) {
- if (page <= 1)
- return;
- map.remove(new Integer(page));
- }
-
- /** Gets the page label dictionary to insert into the document.
- * @return the page label dictionary
- */
- PdfDictionary getDictionary() {
- PdfDictionary dic = new PdfDictionary();
- PdfArray array = new PdfArray();
- for (Iterator it = map.values().iterator(); it.hasNext();) {
- Object obj[] = (Object[])it.next();
- PdfDictionary subDic = new PdfDictionary();
- PdfName pName = (PdfName)obj[1];
- if (pName != null)
- subDic.put(PdfName.S, pName);
- String text = (String)obj[2];
- if (text != null)
- subDic.put(PdfName.P, new PdfString(text, PdfObject.TEXT_UNICODE));
- int st = ((Integer)obj[3]).intValue();
- if (st != 1)
- subDic.put(PdfName.ST, new PdfNumber(st));
- array.add(new PdfNumber(((Integer)obj[0]).intValue() - 1));
- array.add(subDic);
- }
- dic.put(PdfName.NUMS, array);
- return dic;
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfPages.java b/LibrarySource/com/lowagie/text/pdf/PdfPages.java
deleted file mode 100644
index ccb57e9..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfPages.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * $Id: PdfPages.java,v 1.33 2003/05/02 09:01:26 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.IOException;
-import java.util.ArrayList;
-
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.ExceptionConverter;
-
-/**
- * <CODE>PdfPages</CODE> is the PDF Pages-object.
- * <P>
- * The Pages of a document are accessible through a tree of nodes known as the Pages tree.
- * This tree defines the ordering of the pages in the document.<BR>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 6.3 (page 71-73)
- *
- * @see PdfPageElement
- * @see PdfPage
- */
-
-public class PdfPages {
-
- private ArrayList pages = new ArrayList();
- private ArrayList parents = new ArrayList();
- private int leafSize = 10;
- private PdfWriter writer;
- private PdfIndirectReference topParent;
-
- // constructors
-
-/**
- * Constructs a <CODE>PdfPages</CODE>-object.
- */
-
- PdfPages(PdfWriter writer) {
- this.writer = writer;
- }
-
- void addPage(PdfDictionary page) {
- try {
- if ((pages.size() % leafSize) == 0)
- parents.add(writer.getPdfIndirectReference());
- PdfIndirectReference parent = (PdfIndirectReference)parents.get(parents.size() - 1);
- page.put(PdfName.PARENT, parent);
- PdfIndirectReference current = writer.getCurrentPage();
- writer.addToBody(page, current);
- pages.add(current);
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- PdfIndirectReference addPageRef(PdfIndirectReference pageRef) {
- try {
- if ((pages.size() % leafSize) == 0)
- parents.add(writer.getPdfIndirectReference());
- pages.add(pageRef);
- return (PdfIndirectReference)parents.get(parents.size() - 1);
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- // returns the top parent to include in the catalog
- PdfIndirectReference writePageTree() throws IOException {
- if (pages.size() == 0)
- throw new IOException("The document has no pages.");
- int leaf = 1;
- ArrayList tParents = parents;
- ArrayList tPages = pages;
- ArrayList nextParents = new ArrayList();
- while (true) {
- leaf *= leafSize;
- int stdCount = leafSize;
- int rightCount = tPages.size() % leafSize;
- if (rightCount == 0)
- rightCount = leafSize;
- for (int p = 0; p < tParents.size(); ++p) {
- int count;
- int thisLeaf = leaf;
- if (p == tParents.size() - 1) {
- count = rightCount;
- thisLeaf = pages.size() % leaf;
- if (thisLeaf == 0)
- thisLeaf = leaf;
- }
- else
- count = stdCount;
- PdfDictionary top = new PdfDictionary(PdfName.PAGES);
- top.put(PdfName.COUNT, new PdfNumber(thisLeaf));
- PdfArray kids = new PdfArray();
- ArrayList internal = kids.getArrayList();
- internal.addAll(tPages.subList(p * stdCount, p * stdCount + count));
- top.put(PdfName.KIDS, kids);
- if (tParents.size() > 1) {
- if ((p % leafSize) == 0)
- nextParents.add(writer.getPdfIndirectReference());
- top.put(PdfName.PARENT, (PdfIndirectReference)nextParents.get(p / leafSize));
- }
- writer.addToBody(top, (PdfIndirectReference)tParents.get(p));
- }
- if (tParents.size() == 1) {
- topParent = (PdfIndirectReference)tParents.get(0);
- return topParent;
- }
- tPages = tParents;
- tParents = nextParents;
- nextParents = new ArrayList();
- }
- }
-
- PdfIndirectReference getTopParent() {
- return topParent;
- }
-
- void setLinearMode(PdfIndirectReference topParent) {
- if (parents.size() > 1)
- throw new RuntimeException("Linear page mode can only be called with a single parent.");
- if (topParent != null) {
- this.topParent = topParent;
- parents.clear();
- parents.add(topParent);
- }
- leafSize = 10000000;
- }
-
- void addPage(PdfIndirectReference page) {
- pages.add(page);
- }
-
- int reorderPages(int order[]) throws DocumentException {
- if (order == null)
- return pages.size();
- if (parents.size() > 1)
- throw new DocumentException("Page reordering requires a single parent in the page tree. Call PdfWriter.setLinearMode() after open.");
- if (order.length != pages.size())
- throw new DocumentException("Page reordering requires an array with the same size as the number of pages.");
- int max = pages.size();
- boolean temp[] = new boolean[max];
- for (int k = 0; k < max; ++k) {
- int p = order[k];
- if (p < 1 || p > max)
- throw new DocumentException("Page reordering requires pages between 1 and " + max + ". Found " + p + ".");
- if (temp[p - 1])
- throw new DocumentException("Page reordering requires no page repetition. Page " + p + " is repeated.");
- temp[p - 1] = true;
- }
- Object copy[] = pages.toArray();
- for (int k = 0; k < max; ++k) {
- pages.set(k, copy[order[k] - 1]);
- }
- return max;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfPattern.java b/LibrarySource/com/lowagie/text/pdf/PdfPattern.java
deleted file mode 100644
index 488bfde..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfPattern.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.ExceptionConverter;
-
-/**
- * A <CODE>PdfPattern</CODE> defines a ColorSpace
- *
- * @see PdfStream
- */
-
-public class PdfPattern extends PdfStream {
-
- PdfPattern(PdfPatternPainter painter) {
- super();
- PdfNumber one = new PdfNumber(1);
- PdfArray matrix = painter.getMatrix();
- if ( matrix != null ) {
- put(PdfName.MATRIX, matrix);
- }
- put(PdfName.TYPE, PdfName.PATTERN);
- put(PdfName.BBOX, new PdfRectangle(painter.getBoundingBox()));
- put(PdfName.RESOURCES, painter.getResources());
- put(PdfName.TILINGTYPE, one);
- put(PdfName.PATTERNTYPE, one);
- if (painter.isStencil())
- put(PdfName.PAINTTYPE, new PdfNumber(2));
- else
- put(PdfName.PAINTTYPE, one);
- put(PdfName.XSTEP, new PdfNumber(painter.getXStep()));
- put(PdfName.YSTEP, new PdfNumber(painter.getYStep()));
- bytes = painter.toPdf(null);
- put(PdfName.LENGTH, new PdfNumber(bytes.length));
- try {
- flateCompress();
- } catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfPatternPainter.java b/LibrarySource/com/lowagie/text/pdf/PdfPatternPainter.java
deleted file mode 100644
index 7221eac..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfPatternPainter.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.Image;
-import com.lowagie.text.Rectangle;
-import headless.awt.Color;
-
-/**
- * Implements the pattern.
- */
-
-public class PdfPatternPainter extends PdfTemplate {
-
- protected float xstep, ystep;
- protected boolean stencil = false;
- protected Color defaultColor;
-
- /**
- *Creates a <CODE>PdfPattern</CODE>.
- */
-
- private PdfPatternPainter() {
- super(null);
- type = TYPE_PATTERN;
- }
-
- /**
- * Creates new PdfPattern
- *
- * @param wr the <CODE>PdfWriter</CODE>
- */
-
- PdfPatternPainter(PdfWriter wr) {
- super(wr);
- type = TYPE_PATTERN;
- }
-
- PdfPatternPainter(PdfWriter wr, Color defaultColor) {
- this(wr);
- stencil = true;
- if (defaultColor == null)
- this.defaultColor = Color.gray;
- else
- this.defaultColor = defaultColor;
- }
-
- /**
- * Sets the horizontal interval of this pattern.
- *
- * @param xstep the xstep in horizontal painting
- */
-
- public void setXStep(float xstep) {
- this.xstep = xstep;
- }
-
- /**
- * Sets the vertical interval of this pattern.
- *
- * @param ystep in vertical painting
- */
-
- public void setYStep(float ystep) {
- this.ystep = ystep;
- }
-
- /**
- * Returns the horizontal interval when repeating the pattern.
- * @return a value
- */
- public float getXStep() {
- return this.xstep;
- }
-
- /**
- * Returns the vertical interval when repeating the pattern.
- * @return a value
- */
- public float getYStep() {
- return this.ystep;
- }
-
- /**
- * Tells you if this pattern is colored/uncolored (stencil = uncolored, you need to set a default color).
- * @return true if the pattern is an uncolored tiling pattern (stencil).
- */
- public boolean isStencil() {
- return stencil;
- }
-
- /**
- * Sets the transformation matrix for the pattern.
- * @param a
- * @param b
- * @param c
- * @param d
- * @param e
- * @param f
- */
- public void setPatternMatrix(float a, float b, float c, float d, float e, float f) {
- setMatrix(a, b, c, d, e, f);
- }
- /**
- * Gets the stream representing this pattern
- *
- * @return the stream representing this pattern
- */
-
- PdfPattern getPattern() {
- return new PdfPattern(this);
- }
-
- /**
- * Gets a duplicate of this <CODE>PdfPatternPainter</CODE>. All
- * the members are copied by reference but the buffer stays different.
- * @return a copy of this <CODE>PdfPatternPainter</CODE>
- */
-
- public PdfContentByte getDuplicate() {
- PdfPatternPainter tpl = new PdfPatternPainter();
- tpl.writer = writer;
- tpl.pdf = pdf;
- tpl.thisReference = thisReference;
- tpl.pageResources = pageResources;
- tpl.bBox = new Rectangle(bBox);
- tpl.xstep = xstep;
- tpl.ystep = ystep;
- tpl.matrix = matrix;
- tpl.stencil = stencil;
- tpl.defaultColor = defaultColor;
- return tpl;
- }
-
- /**
- * Returns the default color of the pattern.
- * @return a Color
- */
- public Color getDefaultColor() {
- return defaultColor;
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setGrayFill(float)
- */
- public void setGrayFill(float gray) {
- checkNoColor();
- super.setGrayFill(gray);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#resetGrayFill()
- */
- public void resetGrayFill() {
- checkNoColor();
- super.resetGrayFill();
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setGrayStroke(float)
- */
- public void setGrayStroke(float gray) {
- checkNoColor();
- super.setGrayStroke(gray);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#resetGrayStroke()
- */
- public void resetGrayStroke() {
- checkNoColor();
- super.resetGrayStroke();
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setRGBColorFillF(float, float, float)
- */
- public void setRGBColorFillF(float red, float green, float blue) {
- checkNoColor();
- super.setRGBColorFillF(red, green, blue);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#resetRGBColorFill()
- */
- public void resetRGBColorFill() {
- checkNoColor();
- super.resetRGBColorFill();
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setRGBColorStrokeF(float, float, float)
- */
- public void setRGBColorStrokeF(float red, float green, float blue) {
- checkNoColor();
- super.setRGBColorStrokeF(red, green, blue);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#resetRGBColorStroke()
- */
- public void resetRGBColorStroke() {
- checkNoColor();
- super.resetRGBColorStroke();
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setCMYKColorFillF(float, float, float, float)
- */
- public void setCMYKColorFillF(float cyan, float magenta, float yellow, float black) {
- checkNoColor();
- super.setCMYKColorFillF(cyan, magenta, yellow, black);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#resetCMYKColorFill()
- */
- public void resetCMYKColorFill() {
- checkNoColor();
- super.resetCMYKColorFill();
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setCMYKColorStrokeF(float, float, float, float)
- */
- public void setCMYKColorStrokeF(float cyan, float magenta, float yellow, float black) {
- checkNoColor();
- super.setCMYKColorStrokeF(cyan, magenta, yellow, black);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#resetCMYKColorStroke()
- */
- public void resetCMYKColorStroke() {
- checkNoColor();
- super.resetCMYKColorStroke();
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#addImage(com.lowagie.text.Image, float, float, float, float, float, float)
- */
- public void addImage(Image image, float a, float b, float c, float d, float e, float f) throws DocumentException {
- if (stencil && !image.isMask())
- checkNoColor();
- super.addImage(image, a, b, c, d, e, f);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setCMYKColorFill(int, int, int, int)
- */
- public void setCMYKColorFill(int cyan, int magenta, int yellow, int black) {
- checkNoColor();
- super.setCMYKColorFill(cyan, magenta, yellow, black);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setCMYKColorStroke(int, int, int, int)
- */
- public void setCMYKColorStroke(int cyan, int magenta, int yellow, int black) {
- checkNoColor();
- super.setCMYKColorStroke(cyan, magenta, yellow, black);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setRGBColorFill(int, int, int)
- */
- public void setRGBColorFill(int red, int green, int blue) {
- checkNoColor();
- super.setRGBColorFill(red, green, blue);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setRGBColorStroke(int, int, int)
- */
- public void setRGBColorStroke(int red, int green, int blue) {
- checkNoColor();
- super.setRGBColorStroke(red, green, blue);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setColorStroke(java.awt.Color)
- */
- public void setColorStroke(Color color) {
- checkNoColor();
- super.setColorStroke(color);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setColorFill(java.awt.Color)
- */
- public void setColorFill(Color color) {
- checkNoColor();
- super.setColorFill(color);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setColorFill(com.lowagie.text.pdf.PdfSpotColor, float)
- */
- public void setColorFill(PdfSpotColor sp, float tint) {
- checkNoColor();
- super.setColorFill(sp, tint);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setColorStroke(com.lowagie.text.pdf.PdfSpotColor, float)
- */
- public void setColorStroke(PdfSpotColor sp, float tint) {
- checkNoColor();
- super.setColorStroke(sp, tint);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setPatternFill(com.lowagie.text.pdf.PdfPatternPainter)
- */
- public void setPatternFill(PdfPatternPainter p) {
- checkNoColor();
- super.setPatternFill(p);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setPatternFill(com.lowagie.text.pdf.PdfPatternPainter, java.awt.Color, float)
- */
- public void setPatternFill(PdfPatternPainter p, Color color, float tint) {
- checkNoColor();
- super.setPatternFill(p, color, tint);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setPatternStroke(com.lowagie.text.pdf.PdfPatternPainter, java.awt.Color, float)
- */
- public void setPatternStroke(PdfPatternPainter p, Color color, float tint) {
- checkNoColor();
- super.setPatternStroke(p, color, tint);
- }
-
- /**
- * @see com.lowagie.text.pdf.PdfContentByte#setPatternStroke(com.lowagie.text.pdf.PdfPatternPainter)
- */
- public void setPatternStroke(PdfPatternPainter p) {
- checkNoColor();
- super.setPatternStroke(p);
- }
-
- void checkNoColor() {
- if (stencil)
- throw new RuntimeException("Colors are not allowed in uncolored tile patterns.");
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfPrinterGraphics2D.java b/LibrarySource/com/lowagie/text/pdf/PdfPrinterGraphics2D.java
deleted file mode 100644
index 4bc4624..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfPrinterGraphics2D.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * $Id: PdfPrinterGraphics2D.java,v 1.3 2005/02/17 09:20:53 blowagie Exp $
- * $Name: $
- *
- * Copyright 2004 Paulo Soares and Alexandru Carstoiu
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999-2005 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000-2005 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import headless.awt.print.PrinterGraphics;
-import headless.awt.print.PrinterJob;
-
-/**
- * This is an extension class for the sole purpose of implementing the
- * {@link java.awt.print.PrinterGraphics PrinterGraphics} interface.
- */
-public class PdfPrinterGraphics2D extends PdfGraphics2D implements PrinterGraphics
-{
- private PrinterJob printerJob;
-
- public PdfPrinterGraphics2D(PdfContentByte cb, float width, float height, FontMapper fontMapper,
- boolean onlyShapes, boolean convertImagesToJPEG, float quality, PrinterJob printerJob) {
- super(cb, width, height, fontMapper, onlyShapes, convertImagesToJPEG, quality);
- this.printerJob = printerJob;
- }
-
- public PrinterJob getPrinterJob() {
- return printerJob;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfReader.java b/LibrarySource/com/lowagie/text/pdf/PdfReader.java
deleted file mode 100644
index 442880c..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfReader.java
+++ /dev/null
@@ -1,3052 +0,0 @@
-/*
- * $Id: PdfReader.java,v 1.31 2003/05/02 09:01:26 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- *
- * Mesquite specific changes/deletions copyright 2005 Peter E. Midford
- * peteremidford at yahoo.com. Mesquite itself is copyright 1997-2005 by W. and D.
- * Maddison and licensed under the LGPL.
- *
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.Iterator;
-import java.util.zip.InflaterInputStream;
-import java.util.Arrays;
-import java.util.Collections;
-
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.PageSize;
-import com.lowagie.text.StringCompare;
-import com.lowagie.text.ExceptionConverter;
-
-/** Reads a PDF document.
- * @author Paulo Soares (psoares at consiste.pt)
- * @author Kazuya Ujihara
- */
-public class PdfReader {
-
- static final PdfName pageInhCandidates[] = {
- PdfName.MEDIABOX, PdfName.ROTATE, PdfName.RESOURCES, PdfName.CROPBOX
- };
-
- static final PdfName vpnames[] = {PdfName.HIDETOOLBAR, PdfName.HIDEMENUBAR,
- PdfName.HIDEWINDOWUI, PdfName.FITWINDOW, PdfName.CENTERWINDOW, PdfName.DISPLAYDOCTITLE};
- static final int vpints[] = {PdfWriter.HideToolbar, PdfWriter.HideMenubar,
- PdfWriter.HideWindowUI, PdfWriter.FitWindow, PdfWriter.CenterWindow, PdfWriter.DisplayDocTitle};
-
- static final byte endstream[] = PdfEncodings.convertToBytes("endstream", null);
- static final byte endobj[] = PdfEncodings.convertToBytes("endobj", null);
- protected PRTokeniser tokens;
- // Each xref pair is a position
- // type 0 -> -1, 0
- // type 1 -> offset, 0
- // type 2 -> index, obj num
- protected int xref[];
- protected HashMap objStmMark;
- protected IntHashtable objStmToOffset;
- protected boolean newXrefType;
- private ArrayList xrefObj;
- PdfDictionary rootPages;
- protected PdfDictionary trailer;
- //protected ArrayList pages;
- protected PdfDictionary catalog;
- protected PageRefs pageRefs;
- // protected PRAcroForm acroForm = null; //removed for Mesquite support 25 September 2005
- protected boolean acroFormParsed = false;
- protected ArrayList pageInh;
- protected boolean encrypted = false;
- protected boolean rebuilt = false;
- protected int freeXref;
- protected boolean tampered = false;
- protected int lastXref;
- protected int eofPos;
- protected char pdfVersion;
- protected PdfEncryption decrypt;
- protected byte password[] = null; //added by ujihara for decryption
- protected ArrayList strings = new ArrayList();
- protected boolean sharedStreams = true;
- protected boolean consolidateNamedDestinations = false;
- protected int rValue;
- protected int pValue;
- private int objNum;
- private int objGen;
- private boolean visited[];
- private IntHashtable newHits;
- private int fileLength;
- private boolean hybridXref;
- private int lastXrefPartial = -1;
- private boolean partial;
-
- /**
- * Holds value of property appendable.
- */
- private boolean appendable;
-
- protected PdfReader() {
- }
-
- /** Reads and parses a PDF document.
- * @param filename the file name of the document
- * @throws IOException on error
- */
- public PdfReader(String filename) throws IOException {
- this(filename, null);
- }
-
- /** Reads and parses a PDF document.
- * @param filename the file name of the document
- * @param ownerPassword the password to read the document
- * @throws IOException on error
- */
- public PdfReader(String filename, byte ownerPassword[]) throws IOException {
- password = ownerPassword;
- tokens = new PRTokeniser(filename);
- readPdf();
- }
-
- /** Reads and parses a PDF document.
- * @param pdfIn the byte array with the document
- * @throws IOException on error
- */
- public PdfReader(byte pdfIn[]) throws IOException {
- this(pdfIn, null);
- }
-
- /** Reads and parses a PDF document.
- * @param pdfIn the byte array with the document
- * @param ownerPassword the password to read the document
- * @throws IOException on error
- */
- public PdfReader(byte pdfIn[], byte ownerPassword[]) throws IOException {
- password = ownerPassword;
- tokens = new PRTokeniser(pdfIn);
- readPdf();
- }
-
- /** Reads and parses a PDF document.
- * @param url the URL of the document
- * @throws IOException on error
- */
- public PdfReader(URL url) throws IOException {
- this(url, null);
- }
-
- /** Reads and parses a PDF document.
- * @param url the URL of the document
- * @param ownerPassword the password to read the document
- * @throws IOException on error
- */
- public PdfReader(URL url, byte ownerPassword[]) throws IOException {
- password = ownerPassword;
- tokens = new PRTokeniser(new RandomAccessFileOrArray(url));
- readPdf();
- }
-
- /**
- * Reads and parses a PDF document.
- * @param is the <CODE>InputStream</CODE> containing the document. The stream is read to the
- * end but is not closed
- * @param ownerPassword the password to read the document
- * @throws IOException on error
- */
- public PdfReader(InputStream is, byte ownerPassword[]) throws IOException {
- password = ownerPassword;
- tokens = new PRTokeniser(new RandomAccessFileOrArray(is));
- readPdf();
- }
-
- /**
- * Reads and parses a PDF document.
- * @param is the <CODE>InputStream</CODE> containing the document. The stream is read to the
- * end but is not closed
- * @throws IOException on error
- */
- public PdfReader(InputStream is) throws IOException {
- this(is, null);
- }
-
- /**
- * Reads and parses a pdf document. Contrary to the other constructors only the xref is read
- * into memory. The reader is said to be working in "partial" mode as only parts of the pdf
- * are read as needed. The pdf is left open but may be closed at any time with
- * <CODE>PdfReader.close()</CODE>, reopen is automatic.
- * @param raf the document location
- * @param ownerPassword the password or <CODE>null</CODE> for no password
- * @throws IOException on error
- */
- public PdfReader(RandomAccessFileOrArray raf, byte ownerPassword[]) throws IOException {
- password = ownerPassword;
- partial = true;
- tokens = new PRTokeniser(raf);
- readPdfPartial();
- }
-
- /** Creates an independent duplicate.
- * @param reader the <CODE>PdfReader</CODE> to duplicate
- */
- public PdfReader(PdfReader reader) {
- this.appendable = reader.appendable;
- this.consolidateNamedDestinations = reader.consolidateNamedDestinations;
- this.encrypted = reader.encrypted;
- this.rebuilt = reader.rebuilt;
- this.sharedStreams = reader.sharedStreams;
- this.tampered = reader.tampered;
- this.password = reader.password;
- this.pdfVersion = reader.pdfVersion;
- this.eofPos = reader.eofPos;
- this.freeXref = reader.freeXref;
- this.lastXref = reader.lastXref;
- this.tokens = new PRTokeniser(reader.tokens.getSafeFile());
- if (reader.decrypt != null)
- this.decrypt = new PdfEncryption(reader.decrypt);
- this.pValue = reader.pValue;
- this.rValue = reader.rValue;
- this.xrefObj = new ArrayList(reader.xrefObj);
- for (int k = 0; k < reader.xrefObj.size(); ++k) {
- this.xrefObj.set(k, duplicatePdfObject((PdfObject)reader.xrefObj.get(k), this));
- }
- this.pageRefs = new PageRefs(reader.pageRefs, this);
- this.trailer = (PdfDictionary)duplicatePdfObject(reader.trailer, this);
- this.catalog = (PdfDictionary)getPdfObject(trailer.get(PdfName.ROOT));
- this.rootPages = (PdfDictionary)getPdfObject(catalog.get(PdfName.PAGES));
- this.fileLength = reader.fileLength;
- this.partial = reader.partial;
- this.hybridXref = reader.hybridXref;
- this.objStmToOffset = reader.objStmToOffset;
- this.xref = reader.xref;
- }
-
- /** Gets a new file instance of the original PDF
- * document.
- * @return a new file instance of the original PDF document
- */
- public RandomAccessFileOrArray getSafeFile() {
- return tokens.getSafeFile();
- }
-
- protected PdfReaderInstance getPdfReaderInstance(PdfWriter writer) {
- return new PdfReaderInstance(this, writer);
- }
-
- /** Gets the number of pages in the document.
- * @return the number of pages in the document
- */
- public int getNumberOfPages() {
- return pageRefs.size();
- }
-
- /** Returns the document's catalog. This dictionary is not a copy,
- * any changes will be reflected in the catalog.
- * @return the document's catalog
- */
- public PdfDictionary getCatalog() {
- return catalog;
- }
-
- /** Returns the document's acroform, if it has one.
- * @return the document's acroform
- * removed for Mesquite support 25 September 2005 P. E. Midford
- */
-// public PRAcroForm getAcroForm() {
-// if (!acroFormParsed) {
-// acroFormParsed = true;
-// PdfObject form = catalog.get(PdfName.ACROFORM);
-// if (form != null) {
-// try {
-// acroForm = new PRAcroForm(this);
-// acroForm.readAcroForm((PdfDictionary)getPdfObject(form));
-// }
-// catch (Exception e) {
-// acroForm = null;
-// }
-// }
-// }
-// return acroForm;
-// }
- /**
- * Gets the page rotation. This value can be 0, 90, 180 or 270.
- * @param index the page number. The first page is 1
- * @return the page rotation
- */
- public int getPageRotation(int index) {
- return getPageRotation(pageRefs.getPageNRelease(index));
- }
-
- int getPageRotation(PdfDictionary page) {
- PdfNumber rotate = (PdfNumber)getPdfObject(page.get(PdfName.ROTATE));
- if (rotate == null)
- return 0;
- else {
- int n = rotate.intValue();
- n %= 360;
- return n < 0 ? n + 360 : n;
- }
- }
- /** Gets the page size, taking rotation into account. This
- * is a <CODE>Rectangle</CODE> with the value of the /MediaBox and the /Rotate key.
- * @param index the page number. The first page is 1
- * @return a <CODE>Rectangle</CODE>
- */
- public Rectangle getPageSizeWithRotation(int index) {
- return getPageSizeWithRotation(pageRefs.getPageNRelease(index));
- }
-
- /**
- * Gets the rotated page from a page dictionary.
- * @param page the page dictionary
- * @return the rotated page
- */
- public Rectangle getPageSizeWithRotation(PdfDictionary page) {
- Rectangle rect = getPageSize(page);
- int rotation = getPageRotation(page);
- while (rotation > 0) {
- rect = rect.rotate();
- rotation -= 90;
- }
- return rect;
- }
-
- /** Gets the page size without taking rotation into account. This
- * is the value of the /MediaBox key.
- * @param index the page number. The first page is 1
- * @return the page size
- */
- public Rectangle getPageSize(int index) {
- return getPageSize(pageRefs.getPageNRelease(index));
- }
-
- /**
- * Gets the page from a page dictionary
- * @param page the page dictionary
- * @return the page
- */
- public Rectangle getPageSize(PdfDictionary page) {
- PdfArray mediaBox = (PdfArray)getPdfObject(page.get(PdfName.MEDIABOX));
- return getNormalizedRectangle(mediaBox);
- }
-
- /** Gets the crop box without taking rotation into account. This
- * is the value of the /CropBox key. The crop box is the part
- * of the document to be displayed or printed. It usually is the same
- * as the media box but may be smaller. If the page doesn't have a crop
- * box the page size will be returned.
- * @param index the page number. The first page is 1
- * @return the crop box
- */
- public Rectangle getCropBox(int index) {
- PdfDictionary page = pageRefs.getPageNRelease(index);
- PdfArray cropBox = (PdfArray)getPdfObjectRelease(page.get(PdfName.CROPBOX));
- if (cropBox == null)
- return getPageSize(page);
- return getNormalizedRectangle(cropBox);
- }
-
- /** Gets the box size. Allowed names are: "crop", "trim", "art", "bleed" and "media".
- * @param index the page number. The first page is 1
- * @param boxName the box name
- * @return the box rectangle or null
- */
- public Rectangle getBoxSize(int index, String boxName) {
- PdfDictionary page = pageRefs.getPageNRelease(index);
- PdfArray box = null;
- if (boxName.equals("trim"))
- box = (PdfArray)getPdfObjectRelease(page.get(PdfName.TRIMBOX));
- else if (boxName.equals("art"))
- box = (PdfArray)getPdfObjectRelease(page.get(PdfName.ARTBOX));
- else if (boxName.equals("bleed"))
- box = (PdfArray)getPdfObjectRelease(page.get(PdfName.BLEEDBOX));
- else if (boxName.equals("crop"))
- box = (PdfArray)getPdfObjectRelease(page.get(PdfName.CROPBOX));
- else if (boxName.equals("media"))
- box = (PdfArray)getPdfObjectRelease(page.get(PdfName.MEDIABOX));
- if (box == null)
- return null;
- return getNormalizedRectangle(box);
- }
-
- /** Returns the content of the document information dictionary as a <CODE>HashMap</CODE>
- * of <CODE>String</CODE>.
- * @return content of the document information dictionary
- */
- public HashMap getInfo() {
- HashMap map = new HashMap();
- PdfDictionary info = (PdfDictionary)getPdfObject(trailer.get(PdfName.INFO));
- if (info == null)
- return map;
- for (Iterator it = info.getKeys().iterator(); it.hasNext();) {
- PdfName key = (PdfName)it.next();
- PdfObject obj = (PdfObject)getPdfObject(info.get(key));
- if (obj == null)
- continue;
- String value = obj.toString();
- switch (obj.type()) {
- case PdfObject.STRING: {
- value = ((PdfString)obj).toUnicodeString();
- break;
- }
- case PdfObject.NAME: {
- value = PdfName.decodeName(value);
- break;
- }
- }
- map.put(PdfName.decodeName(key.toString()), value);
- }
- return map;
- }
-
- /** Normalizes a <CODE>Rectangle</CODE> so that llx and lly are smaller than urx and ury.
- * @param box the original rectangle
- * @return a normalized <CODE>Rectangle</CODE>
- */
- public static Rectangle getNormalizedRectangle(PdfArray box) {
- ArrayList rect = box.getArrayList();
- float llx = ((PdfNumber)rect.get(0)).floatValue();
- float lly = ((PdfNumber)rect.get(1)).floatValue();
- float urx = ((PdfNumber)rect.get(2)).floatValue();
- float ury = ((PdfNumber)rect.get(3)).floatValue();
- return new Rectangle(Math.min(llx, urx), Math.min(lly, ury),
- Math.max(llx, urx), Math.max(lly, ury));
- }
-
- protected void readPdf() throws IOException {
- try {
- fileLength = tokens.getFile().length();
- pdfVersion = tokens.checkPdfHeader();
- try {
- readXref();
- }
- catch (Exception e) {
- try {
- rebuilt = true;
- rebuildXref();
- lastXref = -1;
- }
- catch (Exception ne) {
- throw new IOException("Rebuild failed: " + ne.getMessage() + "; Original message: " + e.getMessage());
- }
- }
- try {
- readDocObj();
- }
- catch (IOException ne) {
- if (rebuilt)
- throw ne;
- rebuilt = true;
- encrypted = false;
- rebuildXref();
- lastXref = -1;
- readDocObj();
- }
-
- strings.clear();
- readPages();
- eliminateSharedStreams();
- removeUnusedObjects();
- }
- finally {
- try {
- tokens.close();
- }
- catch (Exception e) {
- // empty on purpose
- }
- }
- }
-
- protected void readPdfPartial() throws IOException {
- try {
- fileLength = tokens.getFile().length();
- pdfVersion = tokens.checkPdfHeader();
- try {
- readXref();
- }
- catch (Exception e) {
- try {
- rebuilt = true;
- rebuildXref();
- lastXref = -1;
- }
- catch (Exception ne) {
- throw new IOException("Rebuild failed: " + ne.getMessage() + "; Original message: " + e.getMessage());
- }
- }
- readDocObjPartial();
- readPages();
- }
- catch (IOException e) {
- try{tokens.close();}catch(Exception ee){}
- throw e;
- }
- }
-
- private boolean equalsArray(byte ar1[], byte ar2[], int size) {
- for (int k = 0; k < size; ++k) {
- if (ar1[k] != ar2[k])
- return false;
- }
- return true;
- }
-
- /**
- */
- private void readDecryptedDocObj() throws IOException {
- if (encrypted)
- return;
- PdfObject encDic = trailer.get(PdfName.ENCRYPT);
- if (encDic == null || encDic.toString().equals("null"))
- return;
- encrypted = true;
- PdfDictionary enc = (PdfDictionary)getPdfObject(encDic);
-
- String s;
- PdfObject o;
-
- PdfArray documentIDs = (PdfArray)getPdfObject(trailer.get(PdfName.ID));
- byte documentID[] = null;
- if (documentIDs != null) {
- o = (PdfObject)documentIDs.getArrayList().get(0);
- s = o.toString();
- documentID = com.lowagie.text.DocWriter.getISOBytes(s);
- }
-
- s = enc.get(PdfName.U).toString();
- byte uValue[] = com.lowagie.text.DocWriter.getISOBytes(s);
- s = enc.get(PdfName.O).toString();
- byte oValue[] = com.lowagie.text.DocWriter.getISOBytes(s);
-
- o = enc.get(PdfName.R);
- if (!o.isNumber()) throw new IOException("Illegal R value.");
- rValue = ((PdfNumber)o).intValue();
- if (rValue != 2 && rValue != 3) throw new IOException("Unknown encryption type (" + rValue + ")");
-
- o = enc.get(PdfName.P);
- if (!o.isNumber()) throw new IOException("Illegal P value.");
- pValue = ((PdfNumber)o).intValue();
-
- decrypt = new PdfEncryption();
-
- //check by user password
- decrypt.setupByUserPassword(documentID, password, oValue, pValue, rValue == 3);
- if (!equalsArray(uValue, decrypt.userKey, rValue == 3 ? 16 : 32)) {
- //check by owner password
- decrypt.setupByOwnerPassword(documentID, password, uValue, oValue, pValue, rValue == 3);
- if (!equalsArray(uValue, decrypt.userKey, rValue == 3 ? 16 : 32)) {
- throw new IOException("Bad user password");
- }
- }
- for (int k = 0; k < strings.size(); ++k) {
- PdfString str = (PdfString)strings.get(k);
- str.decrypt(this);
- }
- if (encDic.isIndirect())
- xrefObj.set(((PRIndirectReference)encDic).getNumber(), null);
- }
-
- public static PdfObject getPdfObjectRelease(PdfObject obj) {
- PdfObject obj2 = getPdfObject(obj);
- releaseLastXrefPartial(obj);
- return obj2;
- }
-
-
- /**
- * Reads a <CODE>PdfObject</CODE> resolving an indirect reference
- * if needed.
- * @param obj the <CODE>PdfObject</CODE> to read
- * @return the resolved <CODE>PdfObject</CODE>
- */
- public static PdfObject getPdfObject(PdfObject obj) {
- if (obj == null)
- return null;
- if (!obj.isIndirect())
- return obj;
- try {
- PRIndirectReference ref = (PRIndirectReference)obj;
- int idx = ref.getNumber();
- boolean appendable = ref.getReader().appendable;
- obj = ref.getReader().getPdfObject(idx);
- if (obj == null) {
- if (appendable) {
- obj = new PdfNull();
- obj.setIndRef(ref);
- return obj;
- }
- else
- return PdfNull.PDFNULL;
- }
- else {
- if (appendable) {
- switch (obj.type()) {
- case PdfObject.NULL:
- obj = new PdfNull();
- break;
- case PdfObject.BOOLEAN:
- obj = new PdfBoolean(((PdfBoolean)obj).booleanValue());
- break;
- case PdfObject.NAME:
- obj = new PdfName(obj.getBytes());
- break;
- }
- obj.setIndRef(ref);
- }
- return obj;
- }
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- /**
- * Reads a <CODE>PdfObject</CODE> resolving an indirect reference
- * if needed. If the reader was opened in partial mode the object will be released
- * to save memory.
- * @param obj the <CODE>PdfObject</CODE> to read
- * @param parent
- * @return
- */
- public static PdfObject getPdfObjectRelease(PdfObject obj, PdfObject parent) {
- PdfObject obj2 = getPdfObject(obj, parent);
- releaseLastXrefPartial(obj);
- return obj2;
- }
-
- public static PdfObject getPdfObject(PdfObject obj, PdfObject parent) {
- if (obj == null)
- return null;
- if (!obj.isIndirect()) {
- PRIndirectReference ref = null;
- if (parent != null && (ref = parent.getIndRef()) != null && ref.getReader().isAppendable()) {
- switch (obj.type()) {
- case PdfObject.NULL:
- obj = new PdfNull();
- break;
- case PdfObject.BOOLEAN:
- obj = new PdfBoolean(((PdfBoolean)obj).booleanValue());
- break;
- case PdfObject.NAME:
- obj = new PdfName(obj.getBytes());
- break;
- }
- obj.setIndRef(ref);
- }
- return obj;
- }
- return getPdfObject(obj);
- }
-
- public PdfObject getPdfObjectRelease(int idx) {
- PdfObject obj = getPdfObject(idx);
- releaseLastXrefPartial();
- return obj;
- }
-
- public PdfObject getPdfObject(int idx) {
- try {
- lastXrefPartial = -1;
- if (idx < 0 || idx >= xrefObj.size())
- return null;
- PdfObject obj = (PdfObject)xrefObj.get(idx);
- if (!partial || obj != null)
- return obj;
- if (idx * 2 >= xref.length)
- return null;
- obj = readSingleObject(idx);
- lastXrefPartial = -1;
- if (obj != null)
- lastXrefPartial = idx;
- return obj;
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- public void resetLastXrefPartial() {
- lastXrefPartial = -1;
- }
-
- public void releaseLastXrefPartial() {
- if (partial && lastXrefPartial != -1) {
- xrefObj.set(lastXrefPartial, null);
- lastXrefPartial = -1;
- }
- }
-
- public static void releaseLastXrefPartial(PdfObject obj) {
- if (obj == null)
- return;
- if (!obj.isIndirect())
- return;
- PRIndirectReference ref = (PRIndirectReference)obj;
- PdfReader reader = ref.getReader();
- if (reader.partial && reader.lastXrefPartial != -1 && reader.lastXrefPartial == ref.getNumber()) {
- reader.xrefObj.set(reader.lastXrefPartial, null);
- }
- reader.lastXrefPartial = -1;
- }
-
- private void setXrefPartialObject(int idx, PdfObject obj) {
- if (!partial || idx < 0)
- return;
- xrefObj.set(idx, obj);
- }
-
- public PRIndirectReference addPdfObject(PdfObject obj) {
- xrefObj.add(obj);
- return new PRIndirectReference(this, xrefObj.size() - 1);
- }
-
- protected void readPages() throws IOException {
- pageInh = new ArrayList();
- catalog = (PdfDictionary)getPdfObject(trailer.get(PdfName.ROOT));
- rootPages = (PdfDictionary)getPdfObject(catalog.get(PdfName.PAGES));
- pageRefs = new PageRefs(this);
- }
-
- protected PRIndirectReference getSinglePage(int n) throws IOException {
- PdfDictionary acc = new PdfDictionary();
- PdfDictionary top = rootPages;
- int base = 0;
- while (true) {
- break;
- }
- return null;
- }
-
- protected void PRSimpleRecursive(PdfObject obj) throws IOException {
- switch (obj.type()) {
- case PdfObject.DICTIONARY:
- case PdfObject.STREAM:
- PdfDictionary dic = (PdfDictionary)obj;
- for (Iterator it = dic.getKeys().iterator(); it.hasNext();) {
- PdfName key = (PdfName)it.next();
- PRSimpleRecursive(dic.get(key));
- }
- break;
- case PdfObject.ARRAY:
- ArrayList list = ((PdfArray)obj).getArrayList();
- for (int k = 0; k < list.size(); ++k) {
- PRSimpleRecursive((PdfObject)list.get(k));
- }
- break;
- case PdfObject.INDIRECT:
- PRIndirectReference ref = (PRIndirectReference)obj;
- int num = ref.getNumber();
- if (!visited[num]) {
- visited[num] = true;
- newHits.put(num, 1);
- }
- break;
- }
- }
-
- protected void readDocObjPartial() throws IOException {
- xrefObj = new ArrayList(xref.length / 2);
- xrefObj.addAll(Collections.nCopies(xref.length / 2, null));
- readDecryptedDocObj();
- if (objStmToOffset != null) {
- int keys[] = objStmToOffset.getKeys();
- for (int k = 0; k < keys.length; ++k) {
- int n = keys[k];
- objStmToOffset.put(n, xref[n * 2]);
- xref[n * 2] = -1;
- }
- }
- }
-
- protected PdfObject readSingleObject(int k) throws IOException {
- strings.clear();
- int k2 = k * 2;
- int pos = xref[k2];
- if (pos < 0)
- return null;
- if (xref[k2 + 1] > 0)
- pos = objStmToOffset.get(xref[k2 + 1]);
- tokens.seek(pos);
- tokens.nextValidToken();
- if (tokens.getTokenType() != PRTokeniser.TK_NUMBER)
- tokens.throwError("Invalid object number.");
- objNum = tokens.intValue();
- tokens.nextValidToken();
- if (tokens.getTokenType() != PRTokeniser.TK_NUMBER)
- tokens.throwError("Invalid generation number.");
- objGen = tokens.intValue();
- tokens.nextValidToken();
- if (!tokens.getStringValue().equals("obj"))
- tokens.throwError("Token 'obj' expected.");
- PdfObject obj;
- try {
- obj = readPRObject();
- for (int j = 0; j < strings.size(); ++j) {
- PdfString str = (PdfString)strings.get(j);
- str.decrypt(this);
- }
- if (obj.isStream()) {
- checkPRStreamLength((PRStream)obj);
- }
- }
- catch (Exception e) {
- obj = null;
- }
- if (xref[k2 + 1] > 0) {
- obj = readOneObjStm((PRStream)obj, xref[k2]);
- }
- xrefObj.set(k, obj);
- return obj;
- }
-
- protected PdfObject readOneObjStm(PRStream stream, int idx) throws IOException {
- int first = ((PdfNumber)getPdfObject(stream.get(PdfName.FIRST))).intValue();
- int n = ((PdfNumber)getPdfObject(stream.get(PdfName.N))).intValue();
- byte b[] = getStreamBytes(stream, tokens.getFile());
- PRTokeniser saveTokens = tokens;
- tokens = new PRTokeniser(b);
- try {
- int address = 0;
- int objNumber = 0;
- boolean ok = true;
- ++idx;
- for (int k = 0; k < idx; ++k) {
- ok = tokens.nextToken();
- if (!ok)
- break;
- if (tokens.getTokenType() != PRTokeniser.TK_NUMBER) {
- ok = false;
- break;
- }
- objNumber = tokens.intValue();
- ok = tokens.nextToken();
- if (!ok)
- break;
- if (tokens.getTokenType() != PRTokeniser.TK_NUMBER) {
- ok = false;
- break;
- }
- address = tokens.intValue() + first;
- }
- if (!ok)
- throw new IOException("Error reading ObjStm");
- tokens.seek(address);
- return readPRObject();
- }
- finally {
- tokens = saveTokens;
- }
- }
-
- public double dumpPerc() {
- int total = 0;
- for (int k = 0; k < xrefObj.size(); ++k) {
- if (xrefObj.get(k) != null)
- ++total;
- }
- return (total * 100.0 / xrefObj.size());
- }
-
- protected void readDocObj() throws IOException {
- ArrayList streams = new ArrayList();
- xrefObj = new ArrayList(xref.length / 2);
- xrefObj.addAll(Collections.nCopies(xref.length / 2, null));
- for (int k = 2; k < xref.length; k += 2) {
- int pos = xref[k];
- if (pos <= 0 || xref[k + 1] > 0)
- continue;
- tokens.seek(pos);
- tokens.nextValidToken();
- if (tokens.getTokenType() != PRTokeniser.TK_NUMBER)
- tokens.throwError("Invalid object number.");
- objNum = tokens.intValue();
- tokens.nextValidToken();
- if (tokens.getTokenType() != PRTokeniser.TK_NUMBER)
- tokens.throwError("Invalid generation number.");
- objGen = tokens.intValue();
- tokens.nextValidToken();
- if (!tokens.getStringValue().equals("obj"))
- tokens.throwError("Token 'obj' expected.");
- PdfObject obj;
- try {
- obj = readPRObject();
- if (obj.isStream()) {
- streams.add(obj);
- }
- }
- catch (Exception e) {
- obj = null;
- }
- xrefObj.set(k / 2, obj);
- }
- int fileLength = tokens.length();
- byte tline[] = new byte[16];
- for (int k = 0; k < streams.size(); ++k) {
- checkPRStreamLength((PRStream)streams.get(k));
- }
- readDecryptedDocObj();
- if (objStmMark != null) {
- for (Iterator i = objStmMark.entrySet().iterator(); i.hasNext();) {
- Map.Entry entry = (Map.Entry)i.next();
- int n = ((Integer)entry.getKey()).intValue();
- IntHashtable h = (IntHashtable)entry.getValue();
- readObjStm((PRStream)xrefObj.get(n), h);
- xrefObj.set(n, null);
- }
- objStmMark = null;
- }
- xref = null;
- }
-
- private void checkPRStreamLength(PRStream stream) throws IOException {
- int fileLength = tokens.length();
- int start = stream.getOffset();
- boolean calc = false;
- int streamLength = 0;
- PdfObject obj = getPdfObjectRelease(stream.get(PdfName.LENGTH));
- if (obj != null && obj.type() == PdfObject.NUMBER) {
- streamLength = ((PdfNumber)obj).intValue();
- if (streamLength + start > fileLength - 20)
- calc = true;
- else {
- tokens.seek(start + streamLength);
- String line = tokens.readString(20);
- if (!line.startsWith("\nendstream") &&
- !line.startsWith("\r\nendstream") &&
- !line.startsWith("\rendstream") &&
- !line.startsWith("endstream"))
- calc = true;
- }
- }
- else
- calc = true;
- if (calc) {
- byte tline[] = new byte[16];
- tokens.seek(start);
- while (true) {
- int pos = tokens.getFilePointer();
- if (!tokens.readLineSegment(tline))
- break;
- if (equalsn(tline, endstream)) {
- streamLength = pos - start;
- break;
- }
- if (equalsn(tline, endobj)) {
- tokens.seek(pos - 16);
- String s = tokens.readString(16);
- int index = s.indexOf("endstream");
- if (index >= 0)
- pos = pos - 16 + index;
- streamLength = pos - start;
- break;
- }
- }
- }
- stream.setLength(streamLength);
- }
-
- protected void readObjStm(PRStream stream, IntHashtable map) throws IOException {
- int first = ((PdfNumber)getPdfObject(stream.get(PdfName.FIRST))).intValue();
- int n = ((PdfNumber)getPdfObject(stream.get(PdfName.N))).intValue();
- byte b[] = getStreamBytes(stream, tokens.getFile());
- PRTokeniser saveTokens = tokens;
- tokens = new PRTokeniser(b);
- try {
- int address[] = new int[n];
- int objNumber[] = new int[n];
- boolean ok = true;
- for (int k = 0; k < n; ++k) {
- ok = tokens.nextToken();
- if (!ok)
- break;
- if (tokens.getTokenType() != PRTokeniser.TK_NUMBER) {
- ok = false;
- break;
- }
- objNumber[k] = tokens.intValue();
- ok = tokens.nextToken();
- if (!ok)
- break;
- if (tokens.getTokenType() != PRTokeniser.TK_NUMBER) {
- ok = false;
- break;
- }
- address[k] = tokens.intValue() + first;
- }
- if (!ok)
- throw new IOException("Error reading ObjStm");
- for (int k = 0; k < n; ++k) {
- if (map.containsKey(k)) {
- tokens.seek(address[k]);
- PdfObject obj = readPRObject();
- xrefObj.set(objNumber[k], obj);
- }
- }
- }
- finally {
- tokens = saveTokens;
- }
- }
-
- static PdfObject killIndirect(PdfObject obj) {
- if (obj == null || obj.isNull())
- return null;
- PdfObject ret = getPdfObjectRelease(obj);
- if (obj.isIndirect()) {
- PRIndirectReference ref = (PRIndirectReference)obj;
- PdfReader reader = ref.getReader();
- int n = ref.getNumber();
- reader.xrefObj.set(n, null);
- if (reader.partial)
- reader.xref[n * 2] = -1;
- }
- return ret;
- }
-
- private void ensureXrefSize(int size) {
- if (size == 0)
- return;
- if (xref == null)
- xref = new int[size];
- else {
- if (xref.length < size) {
- int xref2[] = new int[size];
- System.arraycopy(xref, 0, xref2, 0, xref.length);
- xref = xref2;
- }
- }
- }
-
- protected void readXref() throws IOException {
- hybridXref = false;
- newXrefType = false;
- tokens.seek(tokens.getStartxref());
- tokens.nextToken();
- if (!tokens.getStringValue().equals("startxref"))
- throw new IOException("startxref not found.");
- tokens.nextToken();
- if (tokens.getTokenType() != PRTokeniser.TK_NUMBER)
- throw new IOException("startxref is not followed by a number.");
- int startxref = tokens.intValue();
- lastXref = startxref;
- eofPos = tokens.getFilePointer();
- try {
- if (readXRefStream(startxref)) {
- newXrefType = true;
- return;
- }
- }
- catch (Exception e) {}
- xref = null;
- tokens.seek(startxref);
- trailer = readXrefSection();
- PdfDictionary trailer2 = trailer;
- while (true) {
- PdfNumber prev = (PdfNumber)trailer2.get(PdfName.PREV);
- if (prev == null)
- break;
- tokens.seek(prev.intValue());
- trailer2 = readXrefSection();
- }
- }
-
- protected PdfDictionary readXrefSection() throws IOException {
- tokens.nextValidToken();
- if (!tokens.getStringValue().equals("xref"))
- tokens.throwError("xref subsection not found");
- int start = 0;
- int end = 0;
- int pos = 0;
- int gen = 0;
- while (true) {
- tokens.nextValidToken();
- if (tokens.getStringValue().equals("trailer"))
- break;
- if (tokens.getTokenType() != PRTokeniser.TK_NUMBER)
- tokens.throwError("Object number of the first object in this xref subsection not found");
- start = tokens.intValue();
- tokens.nextValidToken();
- if (tokens.getTokenType() != PRTokeniser.TK_NUMBER)
- tokens.throwError("Number of entries in this xref subsection not found");
- end = tokens.intValue() + start;
- if (start == 1) { // fix incorrect start number
- int back = tokens.getFilePointer();
- tokens.nextValidToken();
- pos = tokens.intValue();
- tokens.nextValidToken();
- gen = tokens.intValue();
- if (pos == 0 && gen == 65535) {
- --start;
- --end;
- }
- tokens.seek(back);
- }
- ensureXrefSize(end * 2);
- for (int k = start; k < end; ++k) {
- tokens.nextValidToken();
- pos = tokens.intValue();
- tokens.nextValidToken();
- gen = tokens.intValue();
- tokens.nextValidToken();
- int p = k * 2;
- if (tokens.getStringValue().equals("n")) {
- if (xref[p] == 0 && xref[p + 1] == 0) {
-// if (pos == 0)
-// tokens.throwError("File position 0 cross-reference entry in this xref subsection");
- xref[p] = pos;
- }
- }
- else if (tokens.getStringValue().equals("f")) {
- if (xref[p] == 0 && xref[p + 1] == 0)
- xref[p] = -1;
- }
- else
- tokens.throwError("Invalid cross-reference entry in this xref subsection");
- }
- }
- PdfDictionary trailer = (PdfDictionary)readPRObject();
- PdfNumber xrefSize = (PdfNumber)trailer.get(PdfName.SIZE);
- ensureXrefSize(xrefSize.intValue() * 2);
- PdfObject xrs = trailer.get(PdfName.XREFSTM);
- if (xrs != null && xrs.isNumber()) {
- int loc = ((PdfNumber)xrs).intValue();
- try {
- readXRefStream(loc);
- newXrefType = true;
- hybridXref = true;
- }
- catch (IOException e) {
- xref = null;
- throw e;
- }
- }
- return trailer;
- }
-
- protected boolean readXRefStream(int ptr) throws IOException {
- tokens.seek(ptr);
- int thisStream = 0;
- if (!tokens.nextToken())
- return false;
- if (tokens.getTokenType() != PRTokeniser.TK_NUMBER)
- return false;
- thisStream = tokens.intValue();
- if (!tokens.nextToken() || tokens.getTokenType() != PRTokeniser.TK_NUMBER)
- return false;
- if (!tokens.nextToken() || !tokens.getStringValue().equals("obj"))
- return false;
- PdfObject object = readPRObject();
- PRStream stm = null;
- if (object.isStream()) {
- stm = (PRStream)object;
- if (!PdfName.XREF.equals(stm.get(PdfName.TYPE)))
- return false;
- }
- if (trailer == null) {
- trailer = new PdfDictionary();
- trailer.putAll(stm);
- }
- stm.setLength(((PdfNumber)stm.get(PdfName.LENGTH)).intValue());
- int size = ((PdfNumber)stm.get(PdfName.SIZE)).intValue();
- PdfArray index;
- PdfObject obj = stm.get(PdfName.INDEX);
- if (obj == null) {
- index = new PdfArray();
- index.add(new int[]{0, size});
- }
- else
- index = (PdfArray)obj;
- PdfArray w = (PdfArray)stm.get(PdfName.W);
- int prev = -1;
- obj = stm.get(PdfName.PREV);
- if (obj != null)
- prev = ((PdfNumber)obj).intValue();
- // Each xref pair is a position
- // type 0 -> -1, 0
- // type 1 -> offset, 0
- // type 2 -> index, obj num
- ensureXrefSize(size * 2);
- if (objStmMark == null && !partial)
- objStmMark = new HashMap();
- if (objStmToOffset == null && partial)
- objStmToOffset = new IntHashtable();
- byte b[] = getStreamBytes(stm, tokens.getFile());
- int bptr = 0;
- ArrayList wa = w.getArrayList();
- int wc[] = new int[3];
- for (int k = 0; k < 3; ++k)
- wc[k] = ((PdfNumber)wa.get(k)).intValue();
- ArrayList sections = index.getArrayList();
- for (int idx = 0; idx < sections.size(); idx += 2) {
- int start = ((PdfNumber)sections.get(idx)).intValue();
- int length = ((PdfNumber)sections.get(idx + 1)).intValue();
- ensureXrefSize((start + length) * 2);
- while (length-- > 0) {
- int total = 0;
- int type = 1;
- if (wc[0] > 0) {
- type = 0;
- for (int k = 0; k < wc[0]; ++k)
- type = (type << 8) + (b[bptr++] & 0xff);
- }
- int field2 = 0;
- for (int k = 0; k < wc[1]; ++k)
- field2 = (field2 << 8) + (b[bptr++] & 0xff);
- int field3 = 0;
- for (int k = 0; k < wc[2]; ++k)
- field3 = (field3 << 8) + (b[bptr++] & 0xff);
- int base = start * 2;
- if (xref[base] == 0 && xref[base + 1] == 0) {
- switch (type) {
- case 0:
- xref[base] = -1;
- break;
- case 1:
- xref[base] = field2;
- break;
- case 2:
- xref[base] = field3;
- xref[base + 1] = field2;
- if (partial) {
- objStmToOffset.put(field2, 0);
- }
- else {
- Integer on = new Integer(field2);
- IntHashtable seq = (IntHashtable)objStmMark.get(on);
- if (seq == null) {
- seq = new IntHashtable();
- seq.put(field3, 1);
- objStmMark.put(on, seq);
- }
- else
- seq.put(field3, 1);
- }
- break;
- }
- }
- ++start;
- }
- }
- thisStream *= 2;
- if (thisStream < xref.length)
- xref[thisStream] = -1;
-
- if (prev == -1)
- return true;
- return readXRefStream(prev);
- }
-
- protected void rebuildXref() throws IOException {
- hybridXref = false;
- newXrefType = false;
- tokens.seek(0);
- int xr[][] = new int[1024][];
- int top = 0;
- trailer = null;
- byte line[] = new byte[64];
- for (;;) {
- int pos = tokens.getFilePointer();
- if (!tokens.readLineSegment(line))
- break;
- if (line[0] == 't') {
- if (!PdfEncodings.convertToString(line, null).startsWith("trailer"))
- continue;
- pos = tokens.getFilePointer();
- try {
- PdfDictionary dic = (PdfDictionary)readPRObject();
- if (dic.get(PdfName.ROOT) != null)
- trailer = dic;
- else
- tokens.seek(pos);
- }
- catch (Exception e) {
- tokens.seek(pos);
- }
- }
- else if (line[0] >= '0' && line[0] <= '9') {
- int obj[] = PRTokeniser.checkObjectStart(line);
- if (obj == null)
- continue;
- int num = obj[0];
- int gen = obj[1];
- if (num >= xr.length) {
- int newLength = num * 2;
- int xr2[][] = new int[newLength][];
- System.arraycopy(xr, 0, xr2, 0, top);
- xr = xr2;
- }
- if (num >= top)
- top = num + 1;
- if (xr[num] == null || gen >= xr[num][1]) {
- obj[0] = pos;
- xr[num] = obj;
- }
- }
- }
- if (trailer == null)
- throw new IOException("trailer not found.");
- xref = new int[top * 2];
- for (int k = 0; k < top; ++k) {
- int obj[] = xr[k];
- if (obj != null)
- xref[k * 2] = obj[0];
- }
- }
-
- protected PdfDictionary readDictionary() throws IOException {
- PdfDictionary dic = new PdfDictionary();
- while (true) {
- tokens.nextValidToken();
- if (tokens.getTokenType() == PRTokeniser.TK_END_DIC)
- break;
- if (tokens.getTokenType() != PRTokeniser.TK_NAME)
- tokens.throwError("Dictionary key is not a name.");
- PdfName name = new PdfName(tokens.getStringValue());
- PdfObject obj = readPRObject();
- int type = obj.type();
- if (-type == PRTokeniser.TK_END_DIC)
- tokens.throwError("Unexpected '>>'");
- if (-type == PRTokeniser.TK_END_ARRAY)
- tokens.throwError("Unexpected ']'");
- dic.put(name, obj);
- }
- return dic;
- }
-
- protected PdfArray readArray() throws IOException {
- PdfArray array = new PdfArray();
- while (true) {
- PdfObject obj = readPRObject();
- int type = obj.type();
- if (-type == PRTokeniser.TK_END_ARRAY)
- break;
- if (-type == PRTokeniser.TK_END_DIC)
- tokens.throwError("Unexpected '>>'");
- array.add(obj);
- }
- return array;
- }
-
- protected PdfObject readPRObject() throws IOException {
- tokens.nextValidToken();
- int type = tokens.getTokenType();
- switch (type) {
- case PRTokeniser.TK_START_DIC: {
- PdfDictionary dic = readDictionary();
- int pos = tokens.getFilePointer();
- // be careful in the trailer. May not be a "next" token.
- if (tokens.nextToken() && tokens.getStringValue().equals("stream")) {
- int ch = tokens.read();
- if (ch != '\n')
- ch = tokens.read();
- if (ch != '\n')
- tokens.backOnePosition(ch);
- PRStream stream = new PRStream(this, tokens.getFilePointer());
- stream.putAll(dic);
- stream.setObjNum(objNum, objGen);
- return stream;
- }
- else {
- tokens.seek(pos);
- return dic;
- }
- }
- case PRTokeniser.TK_START_ARRAY:
- return readArray();
- case PRTokeniser.TK_NUMBER:
- return new PdfNumber(tokens.getStringValue());
- case PRTokeniser.TK_STRING:
- PdfString str = new PdfString(tokens.getStringValue(), null).setHexWriting(tokens.isHexString());
- str.setObjNum(objNum, objGen);
- if (strings != null)
- strings.add(str);
- return str;
- case PRTokeniser.TK_NAME:
- return new PdfName(tokens.getStringValue());
- case PRTokeniser.TK_REF:
- int num = tokens.getReference();
- PRIndirectReference ref = new PRIndirectReference(this, num, tokens.getGeneration());
- if (visited != null && !visited[num]) {
- visited[num] = true;
- newHits.put(num, 1);
- }
- return ref;
- default:
- return new PdfLiteral(-type, tokens.getStringValue());
- }
- }
-
- /** Decodes a stream that has the FlateDecode filter.
- * @param in the input data
- * @return the decoded data
- */
- public static byte[] FlateDecode(byte in[]) {
- byte b[] = FlateDecode(in, true);
- if (b == null)
- return FlateDecode(in, false);
- return b;
- }
-
- public static byte[] decodePredictor(byte in[], PdfObject dicPar) {
- if (dicPar == null || !dicPar.isDictionary())
- return in;
- PdfDictionary dic = (PdfDictionary)dicPar;
- PdfObject obj = getPdfObject(dic.get(PdfName.PREDICTOR));
- if (obj == null || !obj.isNumber())
- return in;
- int predictor = ((PdfNumber)obj).intValue();
- if (predictor < 10)
- return in;
- int width = 1;
- obj = getPdfObject(dic.get(PdfName.COLUMNS));
- if (obj != null && obj.isNumber())
- width = ((PdfNumber)obj).intValue();
- int colors = 1;
- obj = getPdfObject(dic.get(PdfName.COLORS));
- if (obj != null && obj.isNumber())
- colors = ((PdfNumber)obj).intValue();
- int bpc = 8;
- obj = getPdfObject(dic.get(PdfName.BITSPERCOMPONENT));
- if (obj != null && obj.isNumber())
- bpc = ((PdfNumber)obj).intValue();
- DataInputStream dataStream = new DataInputStream(new ByteArrayInputStream(in));
- ByteArrayOutputStream fout = new ByteArrayOutputStream(in.length);
- int bytesPerPixel = colors * bpc / 8;
- int bytesPerRow = (colors*width*bpc + 7)/8;
- byte[] curr = new byte[bytesPerRow];
- byte[] prior = new byte[bytesPerRow];
-
- // Decode the (sub)image row-by-row
- while (true) {
- // Read the filter type byte and a row of data
- int filter = 0;
- try {
- filter = dataStream.read();
- if (filter < 0) {
- return fout.toByteArray();
- }
- dataStream.readFully(curr, 0, bytesPerRow);
- } catch (Exception e) {
- return fout.toByteArray();
- }
-
- switch (filter) {
- case 0: //PNG_FILTER_NONE
- break;
- case 1: //PNG_FILTER_SUB
- for (int i = bytesPerPixel; i < bytesPerRow; i++) {
- curr[i] += curr[i - bytesPerPixel];
- }
- break;
- case 2: //PNG_FILTER_UP
- for (int i = 0; i < bytesPerRow; i++) {
- curr[i] += prior[i];
- }
- break;
- case 3: //PNG_FILTER_AVERAGE
- for (int i = 0; i < bytesPerPixel; i++) {
- curr[i] += prior[i] / 2;
- }
- for (int i = bytesPerPixel; i < bytesPerRow; i++) {
- curr[i] += ((curr[i - bytesPerPixel] & 0xff) + (prior[i] & 0xff))/2;
- }
- break;
- case 4: //PNG_FILTER_PAETH
- for (int i = 0; i < bytesPerPixel; i++) {
- curr[i] += prior[i];
- }
-
- for (int i = bytesPerPixel; i < bytesPerRow; i++) {
- int a = curr[i - bytesPerPixel] & 0xff;
- int b = prior[i] & 0xff;
- int c = prior[i - bytesPerPixel] & 0xff;
-
- int p = a + b - c;
- int pa = Math.abs(p - a);
- int pb = Math.abs(p - b);
- int pc = Math.abs(p - c);
-
- int ret;
-
- if ((pa <= pb) && (pa <= pc)) {
- ret = a;
- } else if (pb <= pc) {
- ret = b;
- } else {
- ret = c;
- }
- curr[i] += (byte)(ret);
- }
- break;
- default:
- // Error -- uknown filter type
- throw new RuntimeException("PNG filter unknown.");
- }
- try {
- fout.write(curr);
- }
- catch (IOException ioe) {
- // Never happens
- }
-
- // Swap curr and prior
- byte[] tmp = prior;
- prior = curr;
- curr = tmp;
- }
- }
-
- /** A helper to FlateDecode.
- * @param in the input data
- * @param strict <CODE>true</CODE> to read a correct stream. <CODE>false</CODE>
- * to try to read a corrupted stream
- * @return the decoded data
- */
- public static byte[] FlateDecode(byte in[], boolean strict) {
- ByteArrayInputStream stream = new ByteArrayInputStream(in);
- InflaterInputStream zip = new InflaterInputStream(stream);
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- byte b[] = new byte[strict ? 4092 : 1];
- try {
- int n;
- while ((n = zip.read(b)) >= 0) {
- out.write(b, 0, n);
- }
- zip.close();
- out.close();
- return out.toByteArray();
- }
- catch (Exception e) {
- if (strict)
- return null;
- return out.toByteArray();
- }
- }
-
- /** Decodes a stream that has the ASCIIHexDecode filter.
- * @param in the input data
- * @return the decoded data
- */
- public static byte[] ASCIIHexDecode(byte in[]) {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- boolean first = true;
- int n1 = 0;
- for (int k = 0; k < in.length; ++k) {
- int ch = in[k] & 0xff;
- if (ch == '>')
- break;
- if (PRTokeniser.isWhitespace(ch))
- continue;
- int n = PRTokeniser.getHex(ch);
- if (n == -1)
- throw new RuntimeException("Illegal character in ASCIIHexDecode.");
- if (first)
- n1 = n;
- else
- out.write((byte)((n1 << 4) + n));
- first = !first;
- }
- if (!first)
- out.write((byte)(n1 << 4));
- return out.toByteArray();
- }
-
- /** Decodes a stream that has the ASCII85Decode filter.
- * @param in the input data
- * @return the decoded data
- */
- public static byte[] ASCII85Decode(byte in[]) {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- int state = 0;
- int chn[] = new int[5];
- for (int k = 0; k < in.length; ++k) {
- int ch = in[k] & 0xff;
- if (ch == '~')
- break;
- if (PRTokeniser.isWhitespace(ch))
- continue;
- if (ch == 'z' && state == 0) {
- out.write(0);
- out.write(0);
- out.write(0);
- out.write(0);
- continue;
- }
- if (ch < '!' || ch > 'u')
- throw new RuntimeException("Illegal character in ASCII85Decode.");
- chn[state] = ch - '!';
- ++state;
- if (state == 5) {
- state = 0;
- int r = 0;
- for (int j = 0; j < 5; ++j)
- r = r * 85 + chn[j];
- out.write((byte)(r >> 24));
- out.write((byte)(r >> 16));
- out.write((byte)(r >> 8));
- out.write((byte)r);
- }
- }
- int r = 0;
- if (state == 1)
- throw new RuntimeException("Illegal length in ASCII85Decode.");
- if (state == 2) {
- r = chn[0] * 85 * 85 * 85 * 85 + chn[1] * 85 * 85 * 85;
- out.write((byte)(r >> 24));
- }
- else if (state == 3) {
- r = chn[0] * 85 * 85 * 85 * 85 + chn[1] * 85 * 85 * 85 + chn[2] * 85 * 85;
- out.write((byte)(r >> 24));
- out.write((byte)(r >> 16));
- }
- else if (state == 4) {
- r = chn[0] * 85 * 85 * 85 * 85 + chn[1] * 85 * 85 * 85 + chn[2] * 85 * 85 + chn[3] * 85 ;
- out.write((byte)(r >> 24));
- out.write((byte)(r >> 16));
- out.write((byte)(r >> 8));
- }
- return out.toByteArray();
- }
-
- /** Decodes a stream that has the LZWDecode filter.
- * @param in the input data
- * @return the decoded data
- */
- public static byte[] LZWDecode(byte in[]) {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- LZWDecoder lzw = new LZWDecoder();
- lzw.decode(in, out);
- return out.toByteArray();
- }
-
- /** Checks if the document had errors and was rebuilt.
- * @return true if rebuilt.
- *
- */
- public boolean isRebuilt() {
- return this.rebuilt;
- }
-
- /** Gets the dictionary that represents a page.
- * @param pageNum the page number. 1 is the first
- * @return the page dictionary
- */
- public PdfDictionary getPageN(int pageNum) {
- PdfDictionary dic = pageRefs.getPageN(pageNum);
- if (dic == null)
- return null;
- if (appendable)
- dic.setIndRef(pageRefs.getPageOrigRef(pageNum));
- return dic;
- }
-
- public PdfDictionary getPageNRelease(int pageNum) {
- PdfDictionary dic = getPageN(pageNum);
- pageRefs.releasePage(pageNum);
- return dic;
- }
-
- public void releasePage(int pageNum) {
- pageRefs.releasePage(pageNum);
- }
-
- public void resetReleasePage() {
- pageRefs.resetReleasePage();
- }
-
- /** Gets the page reference to this page.
- * @param pageNum the page number. 1 is the first
- * @return the page reference
- */
- public PRIndirectReference getPageOrigRef(int pageNum) {
- return pageRefs.getPageOrigRef(pageNum);
- }
-
- /** Gets the contents of the page.
- * @param pageNum the page number. 1 is the first
- * @param file the location of the PDF document
- * @throws IOException on error
- * @return the content
- */
- public byte[] getPageContent(int pageNum, RandomAccessFileOrArray file) throws IOException{
- PdfDictionary page = getPageNRelease(pageNum);
- if (page == null)
- return null;
- PdfObject contents = getPdfObjectRelease(page.get(PdfName.CONTENTS));
- if (contents == null)
- return new byte[0];
- ByteArrayOutputStream bout = null;
- if (contents.isStream()) {
- return getStreamBytes((PRStream)contents, file);
- }
- else if (contents.isArray()) {
- PdfArray array = (PdfArray)contents;
- ArrayList list = array.getArrayList();
- bout = new ByteArrayOutputStream();
- for (int k = 0; k < list.size(); ++k) {
- PdfObject item = getPdfObjectRelease((PdfObject)list.get(k));
- if (item == null || !item.isStream())
- continue;
- byte[] b = getStreamBytes((PRStream)item, file);
- bout.write(b);
- if (k != list.size() - 1)
- bout.write('\n');
- }
- return bout.toByteArray();
- }
- else
- return new byte[0];
- }
-
- /** Gets the contents of the page.
- * @param pageNum the page number. 1 is the first
- * @throws IOException on error
- * @return the content
- */
- public byte[] getPageContent(int pageNum) throws IOException{
- RandomAccessFileOrArray rf = getSafeFile();
- try {
- rf.reOpen();
- return getPageContent(pageNum, rf);
- }
- finally {
- try{rf.close();}catch(Exception e){}
- }
- }
-
- protected void killXref(PdfObject obj) {
- if (obj == null)
- return;
- if ((obj instanceof PdfIndirectReference) && !obj.isIndirect())
- return;
- switch (obj.type()) {
- case PdfObject.INDIRECT: {
- int xr = ((PRIndirectReference)obj).getNumber();
- obj = (PdfObject)xrefObj.get(xr);
- xrefObj.set(xr, null);
- freeXref = xr;
- killXref(obj);
- break;
- }
- case PdfObject.ARRAY: {
- ArrayList t = ((PdfArray)obj).getArrayList();
- for (int i = 0; i < t.size(); ++i)
- killXref((PdfObject)t.get(i));
- break;
- }
- case PdfObject.STREAM:
- case PdfObject.DICTIONARY: {
- PdfDictionary dic = (PdfDictionary)obj;
- for (Iterator i = dic.getKeys().iterator(); i.hasNext();){
- killXref(dic.get((PdfName)i.next()));
- }
- break;
- }
- }
- }
-
- /** Sets the contents of the page.
- * @param content the new page content
- * @param pageNum the page number. 1 is the first
- * @throws IOException on error
- */
- public void setPageContent(int pageNum, byte content[]) throws IOException{
- PdfDictionary page = getPageN(pageNum);
- if (page == null)
- return;
- PdfObject contents = page.get(PdfName.CONTENTS);
- freeXref = -1;
- killXref(contents);
- if (freeXref == -1) {
- xrefObj.add(null);
- freeXref = xrefObj.size() - 1;
- }
- page.put(PdfName.CONTENTS, new PRIndirectReference(this, freeXref));
- xrefObj.set(freeXref, new PRStream(this, content));
- }
-
- /** Get the content from a stream.
- * @param stream the stream
- * @param file the location where the stream is
- * @throws IOException on error
- * @return the stream content
- */
- public static byte[] getStreamBytes(PRStream stream, RandomAccessFileOrArray file) throws IOException {
- PdfReader reader = stream.getReader();
- PdfObject filter = getPdfObjectRelease(stream.get(PdfName.FILTER));
- byte b[];
- if (stream.getOffset() < 0)
- b = stream.getBytes();
- else {
- b = new byte[stream.getLength()];
- file.seek(stream.getOffset());
- file.readFully(b);
- PdfEncryption decrypt = reader.getDecrypt();
- if (decrypt != null) {
- decrypt.setHashKey(stream.getObjNum(), stream.getObjGen());
- decrypt.prepareKey();
- decrypt.encryptRC4(b);
- }
- }
- ArrayList filters = new ArrayList();
- if (filter != null) {
- if (filter.isName())
- filters.add(filter);
- else if (filter.isArray())
- filters = ((PdfArray)filter).getArrayList();
- }
- ArrayList dp = new ArrayList();
- PdfObject dpo = getPdfObjectRelease(stream.get(PdfName.DECODEPARMS));
- if (dpo == null || (!dpo.isDictionary() && !dpo.isArray()))
- dpo = getPdfObjectRelease(stream.get(PdfName.DP));
- if (dpo != null) {
- if (dpo.isDictionary())
- dp.add(dpo);
- else if (dpo.isArray())
- dp = ((PdfArray)dpo).getArrayList();
- }
- String name;
- for (int j = 0; j < filters.size(); ++j) {
- name = ((PdfName)PdfReader.getPdfObjectRelease((PdfObject)filters.get(j))).toString();
- if (name.equals("/FlateDecode") || name.equals("/Fl")) {
- b = PdfReader.FlateDecode(b);
- PdfObject dicParam = null;
- if (j < dp.size()) {
- dicParam = (PdfObject)dp.get(j);
- b = decodePredictor(b, dicParam);
- }
- }
- else if (name.equals("/ASCIIHexDecode") || name.equals("/AHx"))
- b = PdfReader.ASCIIHexDecode(b);
- else if (name.equals("/ASCII85Decode") || name.equals("/A85"))
- b = PdfReader.ASCII85Decode(b);
- else if (name.equals("/LZWDecode")) {
- b = PdfReader.LZWDecode(b);
- PdfObject dicParam = null;
- if (j < dp.size()) {
- dicParam = (PdfObject)dp.get(j);
- b = decodePredictor(b, dicParam);
- }
- }
- else
- throw new IOException("The filter " + name + " is not supported.");
- }
- return b;
- }
-
- /** Get the content from a stream.
- * @param stream the stream
- * @throws IOException on error
- * @return the stream content
- */
- public static byte[] getStreamBytes(PRStream stream) throws IOException {
- RandomAccessFileOrArray rf = stream.getReader().getSafeFile();
- try {
- rf.reOpen();
- return PdfReader.getStreamBytes(stream, rf);
- }
- finally {
- try{rf.close();}catch(Exception e){}
- }
- }
-
- /** Eliminates shared streams if they exist. */
- public void eliminateSharedStreams() {
- if (!sharedStreams)
- return;
- sharedStreams = false;
- if (pageRefs.size() == 1)
- return;
- ArrayList newRefs = new ArrayList();
- ArrayList newStreams = new ArrayList();
- IntHashtable visited = new IntHashtable();
- for (int k = 1; k <= pageRefs.size(); ++k) {
- PdfDictionary page = pageRefs.getPageN(k);
- if (page == null)
- continue;
- PdfObject contents = getPdfObject(page.get(PdfName.CONTENTS));
- if (contents == null)
- continue;
- if (contents.isStream()) {
- PRIndirectReference ref = (PRIndirectReference)page.get(PdfName.CONTENTS);
- if (visited.containsKey(ref.getNumber())) {
- // need to duplicate
- newRefs.add(ref);
- newStreams.add(new PRStream((PRStream)contents, null));
- }
- else
- visited.put(ref.getNumber(), 1);
- }
- else {
- PdfArray array = (PdfArray)contents;
- ArrayList list = array.getArrayList();
- for (int j = 0; j < list.size(); ++j) {
- PRIndirectReference ref = (PRIndirectReference)list.get(j);
- if (visited.containsKey(ref.getNumber())) {
- // need to duplicate
- newRefs.add(ref);
- newStreams.add(new PRStream((PRStream)getPdfObject(ref), null));
- }
- else
- visited.put(ref.getNumber(), 1);
- }
- }
- }
- if (newStreams.size() == 0)
- return;
- for (int k = 0; k < newStreams.size(); ++k) {
- xrefObj.add(newStreams.get(k));
- PRIndirectReference ref = (PRIndirectReference)newRefs.get(k);
- ref.setNumber(xrefObj.size() - 1, 0);
- }
- }
-
- /** Checks if the document was changed.
- * @return <CODE>true</CODE> if the document was changed,
- * <CODE>false</CODE> otherwise
- */
- public boolean isTampered() {
- return tampered;
- }
-
- /**
- * Sets the tampered state. A tampered PdfReader cannot be reused in PdfStamper.
- * @param tampered the tampered state
- */
- public void setTampered(boolean tampered) {
- this.tampered = tampered;
- }
-
- /** Gets the XML metadata.
- * @throws IOException on error
- * @return the XML metadata
- */
- public byte[] getMetadata() throws IOException {
- PdfObject obj = getPdfObject(catalog.get(PdfName.METADATA));
- if (!(obj instanceof PRStream))
- return null;
- RandomAccessFileOrArray rf = getSafeFile();
- byte b[] = null;
- try {
- rf.reOpen();
- b = getStreamBytes((PRStream)obj, rf);
- }
- finally {
- try {
- rf.close();
- }
- catch (Exception e) {
- // empty on purpose
- }
- }
- return b;
- }
-
- /**
- * Gets the byte address of the last xref table.
- * @return the byte address of the last xref table
- */
- public int getLastXref() {
- return lastXref;
- }
-
- /**
- * Gets the number of xref objects.
- * @return the number of xref objects
- */
- public int getXrefSize() {
- return xrefObj.size();
- }
-
- /**
- * Gets the byte address of the %%EOF marker.
- * @return the byte address of the %%EOF marker
- */
- public int getEofPos() {
- return eofPos;
- }
-
- /**
- * Gets the PDF version. Only the last version char is returned. For example
- * version 1.4 is returned as '4'.
- * @return the PDF version
- */
- public char getPdfVersion() {
- return pdfVersion;
- }
-
- /**
- * Returns <CODE>true</CODE> if the PDF is encrypted.
- * @return <CODE>true</CODE> if the PDF is encrypted
- */
- public boolean isEncrypted() {
- return encrypted;
- }
-
- /**
- * Gets the encryption permissions. It can be used directly in
- * <CODE>PdfWriter.setEncryption()</CODE>.
- * @return the encryption permissions
- */
- public int getPermissions() {
- return pValue;
- }
-
- /**
- * Returns <CODE>true</CODE> if the PDF has a 128 bit key encryption.
- * @return <CODE>true</CODE> if the PDF has a 128 bit key encryption
- */
- public boolean is128Key() {
- return rValue == 3;
- }
-
- /**
- * Gets the trailer dictionary
- * @return the trailer dictionary
- */
- public PdfDictionary getTrailer() {
- return trailer;
- }
-
- PdfEncryption getDecrypt() {
- return decrypt;
- }
-
- static boolean equalsn(byte a1[], byte a2[]) {
- int length = a2.length;
- for (int k = 0; k < length; ++k) {
- if (a1[k] != a2[k])
- return false;
- }
- return true;
- }
-
- static boolean existsName(PdfDictionary dic, PdfName key, PdfName value) {
- PdfObject type = getPdfObjectRelease(dic.get(key));
- if (type == null || !type.isName())
- return false;
- PdfName name = (PdfName)type;
- return name.equals(value);
- }
-
- static String getFontName(PdfDictionary dic) {
- PdfObject type = getPdfObjectRelease(dic.get(PdfName.BASEFONT));
- if (type == null || !type.isName())
- return null;
- return PdfName.decodeName(type.toString());
- }
-
- static String getSubsetPrefix(PdfDictionary dic) {
- String s = getFontName(dic);
- if (s == null)
- return null;
- if (s.length() < 8 || s.charAt(6) != '+')
- return null;
- for (int k = 0; k < 6; ++k) {
- char c = s.charAt(k);
- if (c < 'A' || c > 'Z')
- return null;
- }
- return s;
- }
-
- /** Finds all the font subsets and changes the prefixes to some
- * random values.
- * @return the number of font subsets altered
- */
- public int shuffleSubsetNames() {
- int total = 0;
- for (int k = 1; k < xrefObj.size(); ++k) {
- PdfObject obj = getPdfObjectRelease(k);
- if (obj == null || !obj.isDictionary())
- continue;
- PdfDictionary dic = (PdfDictionary)obj;
- if (!existsName(dic, PdfName.TYPE, PdfName.FONT))
- continue;
- if (existsName(dic, PdfName.SUBTYPE, PdfName.TYPE1)
- || existsName(dic, PdfName.SUBTYPE, PdfName.MMTYPE1)
- || existsName(dic, PdfName.SUBTYPE, PdfName.TRUETYPE)) {
- String s = getSubsetPrefix(dic);
- if (s == null)
- continue;
- String ns = BaseFont.createSubsetPrefix() + s.substring(7);
- PdfName newName = new PdfName(ns);
- dic.put(PdfName.BASEFONT, newName);
- setXrefPartialObject(k, dic);
- ++total;
- PdfDictionary fd = (PdfDictionary)getPdfObject(dic.get(PdfName.FONTDESCRIPTOR));
- if (fd == null)
- continue;
- fd.put(PdfName.FONTNAME, newName);
- }
- else if (existsName(dic, PdfName.SUBTYPE, PdfName.TYPE0)) {
- String s = getSubsetPrefix(dic);
- PdfArray arr = (PdfArray)getPdfObject(dic.get(PdfName.DESCENDANTFONTS));
- if (arr == null)
- continue;
- ArrayList list = arr.getArrayList();
- if (list.size() == 0)
- continue;
- PdfDictionary desc = (PdfDictionary)getPdfObject((PdfObject)list.get(0));
- String sde = getSubsetPrefix(desc);
- if (sde == null)
- continue;
- String ns = BaseFont.createSubsetPrefix();
- if (s != null)
- dic.put(PdfName.BASEFONT, new PdfName(ns + s.substring(7)));
- setXrefPartialObject(k, dic);
- PdfName newName = new PdfName(ns + sde.substring(7));
- desc.put(PdfName.BASEFONT, newName);
- ++total;
- PdfDictionary fd = (PdfDictionary)getPdfObject(desc.get(PdfName.FONTDESCRIPTOR));
- if (fd == null)
- continue;
- fd.put(PdfName.FONTNAME, newName);
- }
- }
- return total;
- }
-
- /** Finds all the fonts not subset but embedded and marks them as subset.
- * @return the number of fonts altered
- */
- public int createFakeFontSubsets() {
- int total = 0;
- for (int k = 1; k < xrefObj.size(); ++k) {
- PdfObject obj = getPdfObjectRelease(k);
- if (obj == null || !obj.isDictionary())
- continue;
- PdfDictionary dic = (PdfDictionary)obj;
- if (!existsName(dic, PdfName.TYPE, PdfName.FONT))
- continue;
- if (existsName(dic, PdfName.SUBTYPE, PdfName.TYPE1)
- || existsName(dic, PdfName.SUBTYPE, PdfName.MMTYPE1)
- || existsName(dic, PdfName.SUBTYPE, PdfName.TRUETYPE)) {
- String s = getSubsetPrefix(dic);
- if (s != null)
- continue;
- s = getFontName(dic);
- if (s == null)
- continue;
- String ns = BaseFont.createSubsetPrefix() + s;
- PdfDictionary fd = (PdfDictionary)getPdfObjectRelease(dic.get(PdfName.FONTDESCRIPTOR));
- if (fd == null)
- continue;
- if (fd.get(PdfName.FONTFILE) == null && fd.get(PdfName.FONTFILE2) == null
- && fd.get(PdfName.FONTFILE3) == null)
- continue;
- fd = (PdfDictionary)getPdfObject(dic.get(PdfName.FONTDESCRIPTOR));
- PdfName newName = new PdfName(ns);
- dic.put(PdfName.BASEFONT, newName);
- fd.put(PdfName.FONTNAME, newName);
- setXrefPartialObject(k, dic);
- ++total;
- }
- }
- return total;
- }
-
- private static PdfArray getNameArray(PdfObject obj) {
- if (obj == null)
- return null;
- obj = getPdfObjectRelease(obj);
- if (obj.isArray())
- return (PdfArray)obj;
- else if (obj.isDictionary()) {
- PdfObject arr2 = getPdfObjectRelease(((PdfDictionary)obj).get(PdfName.D));
- if (arr2 != null && arr2.isArray())
- return (PdfArray)arr2;
- }
- return null;
- }
-
- /**
- * Gets all the named destinations as an <CODE>HashMap</CODE>. The key is the name
- * and the value is the destinations array.
- * @return gets all the named destinations
- */
- public HashMap getNamedDestination() {
- HashMap names = getNamedDestinationFromNames();
- names.putAll(getNamedDestinationFromStrings());
- return names;
- }
-
- /**
- * Gets the named destinations from the /Dests key in the catalog as an <CODE>HashMap</CODE>. The key is the name
- * and the value is the destinations array.
- * @return gets the named destinations
- */
- public HashMap getNamedDestinationFromNames() {
- HashMap names = new HashMap();
- if (catalog.get(PdfName.DESTS) != null) {
- PdfDictionary dic = (PdfDictionary)getPdfObjectRelease(catalog.get(PdfName.DESTS));
- Set keys = dic.getKeys();
- for (Iterator it = keys.iterator(); it.hasNext();) {
- PdfName key = (PdfName)it.next();
- String name = PdfName.decodeName(key.toString());
- PdfArray arr = getNameArray(dic.get(key));
- if (arr != null)
- names.put(name, arr);
- }
- }
- return names;
- }
-
- /**
- * Gets the named destinations from the /Names key in the catalog as an <CODE>HashMap</CODE>. The key is the name
- * and the value is the destinations array.
- * @return gets the named destinations
- */
- public HashMap getNamedDestinationFromStrings() {
- if (catalog.get(PdfName.NAMES) != null) {
- PdfDictionary dic = (PdfDictionary)getPdfObjectRelease(catalog.get(PdfName.NAMES));
- dic = (PdfDictionary)getPdfObjectRelease(dic.get(PdfName.DESTS));
- if (dic != null) {
- HashMap names = PdfNameTree.readTree(dic);
- for (Iterator it = names.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry)it.next();
- PdfArray arr = getNameArray((PdfObject)entry.getValue());
- if (arr != null)
- entry.setValue(arr);
- else
- it.remove();
- }
- return names;
- }
- }
- return new HashMap();
- }
-
- private boolean replaceNamedDestination(PdfObject obj, HashMap names) {
- obj = getPdfObject(obj);
- int objIdx = lastXrefPartial;
- releaseLastXrefPartial();
- if (obj != null && obj.isDictionary()) {
- PdfObject ob2 = getPdfObjectRelease(((PdfDictionary)obj).get(PdfName.DEST));
- String name = null;
- if (ob2 != null) {
- if (ob2.isName())
- name = PdfName.decodeName(ob2.toString());
- else if (ob2.isString())
- name = ob2.toString();
- PdfArray dest = (PdfArray)names.get(name);
- if (dest != null) {
- ((PdfDictionary)obj).put(PdfName.DEST, dest);
- setXrefPartialObject(objIdx, obj);
- return true;
- }
- }
- else if ((ob2 = getPdfObject(((PdfDictionary)obj).get(PdfName.A))) != null) {
- int obj2Idx = lastXrefPartial;
- releaseLastXrefPartial();
- PdfDictionary dic = (PdfDictionary)ob2;
- PdfName type = (PdfName)getPdfObjectRelease(dic.get(PdfName.S));
- if (PdfName.GOTO.equals(type)) {
- PdfObject ob3 = getPdfObjectRelease(dic.get(PdfName.D));
- if (ob3.isName())
- name = PdfName.decodeName(ob3.toString());
- else if (ob3.isString())
- name = ob3.toString();
- PdfArray dest = (PdfArray)names.get(name);
- if (dest != null) {
- dic.put(PdfName.D, dest);
- setXrefPartialObject(obj2Idx, ob2);
- setXrefPartialObject(objIdx, obj);
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /**
- * Removes all the fields from the document.
- */
- public void removeFields() {
- pageRefs.resetReleasePage();
- for (int k = 1; k <= pageRefs.size(); ++k) {
- PdfDictionary page = pageRefs.getPageN(k);
- PdfArray annots = (PdfArray)getPdfObject(page.get(PdfName.ANNOTS));
- if (annots == null) {
- pageRefs.releasePage(k);
- continue;
- }
- ArrayList arr = annots.getArrayList();
- int startSize = arr.size();
- for (int j = 0; j < arr.size(); ++j) {
- PdfDictionary annot = (PdfDictionary)getPdfObjectRelease((PdfObject)arr.get(j));
- if (PdfName.WIDGET.equals(annot.get(PdfName.SUBTYPE)))
- arr.remove(j--);
- }
- if (arr.isEmpty())
- page.remove(PdfName.ANNOTS);
- else
- pageRefs.releasePage(k);
- }
- catalog.remove(PdfName.ACROFORM);
- pageRefs.resetReleasePage();
- }
-
- /**
- * Removes all the annotations and fields from the document.
- */
- public void removeAnnotations() {
- pageRefs.resetReleasePage();
- for (int k = 1; k <= pageRefs.size(); ++k) {
- PdfDictionary page = pageRefs.getPageN(k);
- if (page.get(PdfName.ANNOTS) == null)
- pageRefs.releasePage(k);
- else
- page.remove(PdfName.ANNOTS);
- }
- catalog.remove(PdfName.ACROFORM);
- pageRefs.resetReleasePage();
- }
-
- private void iterateBookmarks(PdfObject outlineRef, HashMap names) {
- while (outlineRef != null) {
- replaceNamedDestination(outlineRef, names);
- PdfDictionary outline = (PdfDictionary)getPdfObjectRelease(outlineRef);
- PdfObject first = outline.get(PdfName.FIRST);
- if (first != null) {
- iterateBookmarks(first, names);
- }
- outlineRef = outline.get(PdfName.NEXT);
- }
- }
-
- /** Replaces all the local named links with the actual destinations. */
- public void consolidateNamedDestinations() {
- if (consolidateNamedDestinations)
- return;
- consolidateNamedDestinations = true;
- HashMap names = getNamedDestination();
- if (names.size() == 0)
- return;
- for (int k = 1; k <= pageRefs.size(); ++k) {
- PdfDictionary page = pageRefs.getPageN(k);
- PdfObject annotsRef;
- PdfArray annots = (PdfArray)getPdfObject(annotsRef = page.get(PdfName.ANNOTS));
- int annotIdx = lastXrefPartial;
- releaseLastXrefPartial();
- if (annots == null) {
- pageRefs.releasePage(k);
- continue;
- }
- ArrayList list = annots.getArrayList();
- boolean commitAnnots = false;
- for (int an = 0; an < list.size(); ++an) {
- PdfObject objRef = (PdfObject)list.get(an);
- if (replaceNamedDestination(objRef, names) && !objRef.isIndirect())
- commitAnnots = true;
- }
- if (commitAnnots)
- setXrefPartialObject(annotIdx, annots);
- if (!commitAnnots || annotsRef.isIndirect())
- pageRefs.releasePage(k);
- }
- PdfDictionary outlines = (PdfDictionary)getPdfObjectRelease(catalog.get(PdfName.OUTLINES));
- if (outlines == null)
- return;
- iterateBookmarks(outlines.get(PdfName.FIRST), names);
- }
-
- protected static PdfDictionary duplicatePdfDictionary(PdfDictionary original, PdfDictionary copy, PdfReader newReader) {
- if (copy == null)
- copy = new PdfDictionary();
- for (Iterator it = original.getKeys().iterator(); it.hasNext();) {
- PdfName key = (PdfName)it.next();
- copy.put(key, duplicatePdfObject(original.get(key), newReader));
- }
- return copy;
- }
-
- protected static PdfObject duplicatePdfObject(PdfObject original, PdfReader newReader) {
- if (original == null)
- return null;
- switch (original.type()) {
- case PdfObject.DICTIONARY: {
- return duplicatePdfDictionary((PdfDictionary)original, null, newReader);
- }
- case PdfObject.STREAM: {
- PRStream org = (PRStream)original;
- PRStream stream = new PRStream(org, null, newReader);
- duplicatePdfDictionary(org, stream, newReader);
- return stream;
- }
- case PdfObject.ARRAY: {
- ArrayList list = ((PdfArray)original).getArrayList();
- PdfArray arr = new PdfArray();
- for (Iterator it = list.iterator(); it.hasNext();) {
- arr.add(duplicatePdfObject((PdfObject)it.next(), newReader));
- }
- return arr;
- }
- case PdfObject.INDIRECT: {
- PRIndirectReference org = (PRIndirectReference)original;
- return new PRIndirectReference(newReader, org.getNumber(), org.getGeneration());
- }
- default:
- return original;
- }
- }
-
- public void close() {
- if (!partial)
- return;
- try {
- tokens.close();
- }
- catch (IOException e) {
- throw new ExceptionConverter(e);
- }
- }
-
- protected void removeUnusedNode(PdfObject obj, boolean hits[]) {
- if (obj == null)
- return;
- switch (obj.type()) {
- case PdfObject.DICTIONARY:
- case PdfObject.STREAM: {
- PdfDictionary dic = (PdfDictionary)obj;
- for (Iterator it = dic.getKeys().iterator(); it.hasNext();) {
- PdfName key = (PdfName)it.next();
- PdfObject v = dic.get(key);
- if (v.isIndirect()) {
- int num = ((PRIndirectReference)v).getNumber();
- if (num >= xrefObj.size() || xrefObj.get(num) == null) {
- dic.put(key, PdfNull.PDFNULL);
- continue;
- }
- }
- removeUnusedNode(v, hits);
- }
- break;
- }
- case PdfObject.ARRAY: {
- ArrayList list = ((PdfArray)obj).getArrayList();
- for (int k = 0; k < list.size(); ++k) {
- PdfObject v = (PdfObject)list.get(k);
- if (v.isIndirect()) {
- int num = ((PRIndirectReference)v).getNumber();
- if (xrefObj.get(num) == null) {
- list.set(k, PdfNull.PDFNULL);
- continue;
- }
- }
- removeUnusedNode(v, hits);
- }
- break;
- }
- case PdfObject.INDIRECT: {
- PRIndirectReference ref = (PRIndirectReference)obj;
- int num = ref.getNumber();
- if (!hits[num]) {
- hits[num] = true;
- removeUnusedNode(getPdfObjectRelease(ref), hits);
- }
- }
- }
- }
-
- /** Removes all the unreachable objects.
- * @return the number of indirect objects removed
- */
- public int removeUnusedObjects() {
- boolean hits[] = new boolean[xrefObj.size()];
- removeUnusedNode(trailer, hits);
- int total = 0;
- if (partial) {
- for (int k = 1; k < hits.length; ++k) {
- if (!hits[k]) {
- xref[k * 2] = -1;
- xref[k * 2 + 1] = 0;
- xrefObj.set(k, null);
- ++total;
- }
- }
- }
- else {
- for (int k = 1; k < hits.length; ++k) {
- if (!hits[k]) {
- xrefObj.set(k, null);
- ++total;
- }
- }
- }
- return total;
- }
-
- /** Gets a read-only version of <CODE>AcroFields</CODE>.
- * @return a read-only version of <CODE>AcroFields</CODE>
- * Removed for Mesquite Support 25 September 2005 P. E. Midford
- */
-// public AcroFields getAcroFields() {
-// return new AcroFields(this, null);
-// }
-
- /**
- * Gets the global document JavaScript.
- * @param file the document file
- * @throws IOException on error
- * @return the global document JavaScript
- */
- public String getJavaScript(RandomAccessFileOrArray file) throws IOException {
- PdfDictionary names = (PdfDictionary)getPdfObjectRelease(catalog.get(PdfName.NAMES));
- if (names == null)
- return null;
- PdfDictionary js = (PdfDictionary)getPdfObjectRelease(names.get(PdfName.JAVASCRIPT));
- if (js == null)
- return null;
- HashMap jscript = PdfNameTree.readTree(js);
- String sortedNames[] = new String[jscript.size()];
- sortedNames = (String[])jscript.keySet().toArray(sortedNames);
- Arrays.sort(sortedNames, new StringCompare());
- StringBuffer buf = new StringBuffer();
- for (int k = 0; k < sortedNames.length; ++k) {
- PdfDictionary j = (PdfDictionary)getPdfObjectRelease((PdfIndirectReference)jscript.get(sortedNames[k]));
- if (j == null)
- continue;
- PdfObject obj = getPdfObjectRelease(j.get(PdfName.JS));
- if (obj.isString())
- buf.append(((PdfString)obj).toUnicodeString()).append('\n');
- else if (obj.isStream()) {
- byte bytes[] = getStreamBytes((PRStream)obj, file);
- if (bytes.length >= 2 && bytes[0] == (byte)254 && bytes[1] == (byte)255)
- buf.append(PdfEncodings.convertToString(bytes, PdfObject.TEXT_UNICODE));
- else
- buf.append(PdfEncodings.convertToString(bytes, PdfObject.TEXT_PDFDOCENCODING));
- buf.append('\n');
- }
- }
- return buf.toString();
- }
-
- /**
- * Gets the global document JavaScript.
- * @throws IOException on error
- * @return the global document JavaScript
- */
- public String getJavaScript() throws IOException {
- RandomAccessFileOrArray rf = getSafeFile();
- try {
- rf.reOpen();
- return getJavaScript(rf);
- }
- finally {
- try{rf.close();}catch(Exception e){}
- }
- }
-
- /**
- * Selects the pages to keep in the document. The pages are described as
- * ranges. The page ordering can be changed but
- * no page repetitions are allowed.
- * @param ranges the comma separated ranges as described in {@link SequenceList}
- */
- public void selectPages(String ranges) {
- selectPages(SequenceList.expand(ranges, getNumberOfPages()));
- }
-
- /**
- * Selects the pages to keep in the document. The pages are described as a
- * <CODE>List</CODE> of <CODE>Integer</CODE>. The page ordering can be changed but
- * no page repetitions are allowed.
- * @param pagesToKeep the pages to keep in the document
- */
- public void selectPages(List pagesToKeep) {
- throw new UnsupportedOperationException("Later.");
-/*
- IntHashtable pg = new IntHashtable();
- ArrayList finalPages = new ArrayList();
- for (Iterator it = pagesToKeep.iterator(); it.hasNext();) {
- Integer pi = (Integer)it.next();
- int p = pi.intValue();
- if (p >= 1 && p <= pages.size() && pg.put(p, 1) == 0)
- finalPages.add(pi);
- }
- PRIndirectReference parent = (PRIndirectReference)catalog.get(PdfName.PAGES);
- PdfDictionary topPages = (PdfDictionary)getPdfObject(parent);
- PRIndirectReference newPageRefs[] = new PRIndirectReference[finalPages.size()];
- PdfDictionary newPages[] = new PdfDictionary[finalPages.size()];
- topPages.put(PdfName.COUNT, new PdfNumber(finalPages.size()));
- PdfArray kids = new PdfArray();
- for (int k = 0; k < finalPages.size(); ++k) {
- int p = ((Integer)finalPages.get(k)).intValue() - 1;
- kids.add(newPageRefs[k] = (PRIndirectReference)pageRefs.get(p));
- newPages[k] = (PdfDictionary)pages.get(p);
- newPages[k].put(PdfName.PARENT, parent);
- pageRefs.set(p, null);
- }
- topPages.put(PdfName.KIDS, kids);
- AcroFields af = getAcroFields();
- for (int k = 0; k < pageRefs.size(); ++k) {
- PRIndirectReference ref = (PRIndirectReference)pageRefs.get(k);
- if (ref != null) {
- af.removeFieldsFromPage(k + 1);
- xrefObj.set(ref.getNumber(), null);
- }
- }
- pages = new ArrayList(Arrays.asList(newPages));
- pageRefs = new ArrayList(Arrays.asList(newPageRefs));
- removeUnusedObjects();*/
- }
-
- public static void setViewerPreferences(int preferences, PdfDictionary catalog) {
- catalog.remove(PdfName.PAGELAYOUT);
- catalog.remove(PdfName.PAGEMODE);
- catalog.remove(PdfName.VIEWERPREFERENCES);
- if ((preferences & PdfWriter.PageLayoutSinglePage) != 0)
- catalog.put(PdfName.PAGELAYOUT, PdfName.SINGLEPAGE);
- else if ((preferences & PdfWriter.PageLayoutOneColumn) != 0)
- catalog.put(PdfName.PAGELAYOUT, PdfName.ONECOLUMN);
- else if ((preferences & PdfWriter.PageLayoutTwoColumnLeft) != 0)
- catalog.put(PdfName.PAGELAYOUT, PdfName.TWOCOLUMNLEFT);
- else if ((preferences & PdfWriter.PageLayoutTwoColumnRight) != 0)
- catalog.put(PdfName.PAGELAYOUT, PdfName.TWOCOLUMNRIGHT);
- if ((preferences & PdfWriter.PageModeUseNone) != 0)
- catalog.put(PdfName.PAGEMODE, PdfName.USENONE);
- else if ((preferences & PdfWriter.PageModeUseOutlines) != 0)
- catalog.put(PdfName.PAGEMODE, PdfName.USEOUTLINES);
- else if ((preferences & PdfWriter.PageModeUseThumbs) != 0)
- catalog.put(PdfName.PAGEMODE, PdfName.USETHUMBS);
- else if ((preferences & PdfWriter.PageModeFullScreen) != 0)
- catalog.put(PdfName.PAGEMODE, PdfName.FULLSCREEN);
- else if ((preferences & PdfWriter.PageModeUseOC) != 0)
- catalog.put(PdfName.PAGEMODE, PdfName.USEOC);
- if ((preferences & PdfWriter.ViewerPreferencesMask) == 0)
- return;
- PdfDictionary vp = new PdfDictionary();
- if ((preferences & PdfWriter.HideToolbar) != 0)
- vp.put(PdfName.HIDETOOLBAR, PdfBoolean.PDFTRUE);
- if ((preferences & PdfWriter.HideMenubar) != 0)
- vp.put(PdfName.HIDEMENUBAR, PdfBoolean.PDFTRUE);
- if ((preferences & PdfWriter.HideWindowUI) != 0)
- vp.put(PdfName.HIDEWINDOWUI, PdfBoolean.PDFTRUE);
- if ((preferences & PdfWriter.FitWindow) != 0)
- vp.put(PdfName.FITWINDOW, PdfBoolean.PDFTRUE);
- if ((preferences & PdfWriter.CenterWindow) != 0)
- vp.put(PdfName.CENTERWINDOW, PdfBoolean.PDFTRUE);
- if ((preferences & PdfWriter.DisplayDocTitle) != 0)
- vp.put(PdfName.DISPLAYDOCTITLE, PdfBoolean.PDFTRUE);
- if ((preferences & PdfWriter.NonFullScreenPageModeUseNone) != 0)
- vp.put(PdfName.NONFULLSCREENPAGEMODE, PdfName.USENONE);
- else if ((preferences & PdfWriter.NonFullScreenPageModeUseOutlines) != 0)
- vp.put(PdfName.NONFULLSCREENPAGEMODE, PdfName.USEOUTLINES);
- else if ((preferences & PdfWriter.NonFullScreenPageModeUseThumbs) != 0)
- vp.put(PdfName.NONFULLSCREENPAGEMODE, PdfName.USETHUMBS);
- else if ((preferences & PdfWriter.NonFullScreenPageModeUseOC) != 0)
- vp.put(PdfName.NONFULLSCREENPAGEMODE, PdfName.USEOC);
- if ((preferences & PdfWriter.DirectionL2R) != 0)
- vp.put(PdfName.DIRECTION, PdfName.L2R);
- else if ((preferences & PdfWriter.DirectionR2L) != 0)
- vp.put(PdfName.DIRECTION, PdfName.R2L);
- if ((preferences & PdfWriter.PrintScalingNone) != 0)
- vp.put(PdfName.PRINTSCALING, PdfName.NONE);
- catalog.put(PdfName.VIEWERPREFERENCES, vp);
- }
-
- public void setViewerPreferences(int preferences) {
- setViewerPreferences(preferences, catalog);
- }
-
- public int getViewerPreferences() {
- int prefs = 0;
- PdfName name = null;
- PdfObject obj = getPdfObjectRelease(catalog.get(PdfName.PAGELAYOUT));
- if (obj != null && obj.isName()) {
- name = (PdfName)obj;
- if (name.equals(PdfName.SINGLEPAGE))
- prefs |= PdfWriter.PageLayoutSinglePage;
- else if (name.equals(PdfName.ONECOLUMN))
- prefs |= PdfWriter.PageLayoutOneColumn;
- else if (name.equals(PdfName.TWOCOLUMNLEFT))
- prefs |= PdfWriter.PageLayoutTwoColumnLeft;
- else if (name.equals(PdfName.TWOCOLUMNRIGHT))
- prefs |= PdfWriter.PageLayoutTwoColumnRight;
- }
- obj = getPdfObjectRelease(catalog.get(PdfName.PAGEMODE));
- if (obj != null && obj.isName()) {
- name = (PdfName)obj;
- if (name.equals(PdfName.USENONE))
- prefs |= PdfWriter.PageModeUseNone;
- else if (name.equals(PdfName.USEOUTLINES))
- prefs |= PdfWriter.PageModeUseOutlines;
- else if (name.equals(PdfName.USETHUMBS))
- prefs |= PdfWriter.PageModeUseThumbs;
- else if (name.equals(PdfName.USEOC))
- prefs |= PdfWriter.PageModeUseOC;
- }
- obj = getPdfObjectRelease(catalog.get(PdfName.VIEWERPREFERENCES));
- if (obj == null || !obj.isDictionary())
- return prefs;
- PdfDictionary vp = (PdfDictionary)obj;
- for (int k = 0; k < vpnames.length; ++k) {
- obj = getPdfObject(vp.get(vpnames[k]));
- if (obj != null && "true".equals(obj.toString()))
- prefs |= vpints[k];
- }
- obj = getPdfObjectRelease(vp.get(PdfName.PRINTSCALING));
- if (PdfName.NONE.equals(obj))
- prefs |= PdfWriter.PrintScalingNone;
- obj = getPdfObjectRelease(vp.get(PdfName.NONFULLSCREENPAGEMODE));
- if (obj != null && obj.isName()) {
- name = (PdfName)obj;
- if (name.equals(PdfName.USENONE))
- prefs |= PdfWriter.NonFullScreenPageModeUseNone;
- else if (name.equals(PdfName.USEOUTLINES))
- prefs |= PdfWriter.NonFullScreenPageModeUseOutlines;
- else if (name.equals(PdfName.USETHUMBS))
- prefs |= PdfWriter.NonFullScreenPageModeUseThumbs;
- else if (name.equals(PdfName.USEOC))
- prefs |= PdfWriter.NonFullScreenPageModeUseOC;
- }
- obj = getPdfObjectRelease(vp.get(PdfName.DIRECTION));
- if (obj != null && obj.isName()) {
- name = (PdfName)obj;
- if (name.equals(PdfName.L2R))
- prefs |= PdfWriter.DirectionL2R;
- else if (name.equals(PdfName.R2L))
- prefs |= PdfWriter.DirectionR2L;
- }
- return prefs;
- }
-
- /**
- * Getter for property appendable.
- * @return Value of property appendable.
- */
- public boolean isAppendable() {
- return this.appendable;
- }
-
- /**
- * Setter for property appendable.
- * @param appendable New value of property appendable.
- */
- public void setAppendable(boolean appendable) {
- this.appendable = appendable;
- if (appendable)
- getPdfObject(trailer.get(PdfName.ROOT));
- }
-
- /**
- * Getter for property newXrefType.
- * @return Value of property newXrefType.
- */
- public boolean isNewXrefType() {
- return newXrefType;
- }
-
- /**
- * Getter for property fileLength.
- * @return Value of property fileLength.
- */
- public int getFileLength() {
- return fileLength;
- }
-
- /**
- * Getter for property hybridXref.
- * @return Value of property hybridXref.
- */
- public boolean isHybridXref() {
- return hybridXref;
- }
-
- static class PageRefs {
- private PdfReader reader;
- private IntHashtable refsp;
- private ArrayList refsn;
- private ArrayList pageInh;
- private int lastPageRead = -1;
- private int sizep;
-
- private PageRefs(PdfReader reader) throws IOException {
- this.reader = reader;
- if (reader.partial) {
- refsp = new IntHashtable();
- PdfNumber npages = (PdfNumber)PdfReader.getPdfObjectRelease(reader.rootPages.get(PdfName.COUNT));
- sizep = npages.intValue();
- }
- else {
- readPages();
- }
- }
-
- PageRefs(PageRefs other, PdfReader reader) {
- this.reader = reader;
- this.sizep = other.sizep;
- if (refsn != null) {
- refsn = new ArrayList(other.refsn);
- for (int k = 0; k < refsn.size(); ++k) {
- refsn.set(k, duplicatePdfObject((PdfObject)refsn.get(k), reader));
- }
- }
- else
- this.refsp = (IntHashtable)other.refsp.clone();
- }
-
- int size() {
- if (refsn != null)
- return refsn.size();
- else
- return sizep;
- }
-
- void readPages() throws IOException {
- if (refsn != null)
- return;
- refsp = null;
- refsn = new ArrayList();
- pageInh = new ArrayList();
- iteratePages((PRIndirectReference)reader.catalog.get(PdfName.PAGES));
- pageInh = null;
- reader.rootPages.put(PdfName.COUNT, new PdfNumber(refsn.size()));
- }
-
- void reReadPages() throws IOException {
- refsn = null;
- readPages();
- }
-
- /** Gets the dictionary that represents a page.
- * @param pageNum the page number. 1 is the first
- * @return the page dictionary
- */
- public PdfDictionary getPageN(int pageNum) {
- PRIndirectReference ref = getPageOrigRef(pageNum);
- return (PdfDictionary)PdfReader.getPdfObject(ref);
- }
-
- public PdfDictionary getPageNRelease(int pageNum) {
- PdfDictionary page = getPageN(pageNum);
- releasePage(pageNum);
- return page;
- }
-
- public PRIndirectReference getPageOrigRefRelease(int pageNum) {
- PRIndirectReference ref = getPageOrigRef(pageNum);
- releasePage(pageNum);
- return ref;
- }
-
- /** Gets the page reference to this page.
- * @param pageNum the page number. 1 is the first
- * @return the page reference
- */
- public PRIndirectReference getPageOrigRef(int pageNum) {
- try {
- --pageNum;
- if (pageNum < 0 || pageNum >= size())
- return null;
- if (refsn != null)
- return (PRIndirectReference)refsn.get(pageNum);
- else {
- int n = refsp.get(pageNum);
- if (n == 0) {
- PRIndirectReference ref = getSinglePage(pageNum);
- if (reader.lastXrefPartial == -1)
- lastPageRead = -1;
- else
- lastPageRead = pageNum;
- reader.lastXrefPartial = -1;
- refsp.put(pageNum, ref.getNumber());
- return ref;
- }
- else {
- if (lastPageRead != pageNum)
- lastPageRead = -1;
- return new PRIndirectReference(reader, n);
- }
- }
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- public void releasePage(int pageNum) {
- if (refsp == null)
- return;
- --pageNum;
- if (pageNum < 0 || pageNum >= size())
- return;
- if (pageNum != lastPageRead)
- return;
- lastPageRead = -1;
- reader.lastXrefPartial = refsp.get(pageNum);
- reader.releaseLastXrefPartial();
- refsp.remove(pageNum);
- }
-
- public void resetReleasePage() {
- if (refsp == null)
- return;
- lastPageRead = -1;
- }
-
- void insertPage(int pageNum, PRIndirectReference ref) {
- --pageNum;
- if (refsn != null) {
- if (pageNum >= refsn.size())
- refsn.add(ref);
- else
- refsn.add(pageNum, ref);
- }
- else {
- ++sizep;
- lastPageRead = -1;
- if (pageNum >= size()) {
- refsp.put(size(), ref.getNumber());
- }
- else {
- IntHashtable refs2 = new IntHashtable((refsp.size() + 1) * 2);
- for (Iterator it = refsp.getEntryIterator(); it.hasNext();) {
- IntHashtable.IntHashtableEntry entry = (IntHashtable.IntHashtableEntry)it.next();
- int p = entry.getKey();
- refs2.put(p >= pageNum ? p + 1 : p, entry.getValue());
- }
- refs2.put(pageNum, ref.getNumber());
- refsp = refs2;
- }
- }
- }
-
- private void pushPageAttributes(PdfDictionary nodePages) {
- PdfDictionary dic = new PdfDictionary();
- if (pageInh.size() != 0) {
- dic.putAll((PdfDictionary)pageInh.get(pageInh.size() - 1));
- }
- for (int k = 0; k < pageInhCandidates.length; ++k) {
- PdfObject obj = nodePages.get(pageInhCandidates[k]);
- if (obj != null)
- dic.put(pageInhCandidates[k], obj);
- }
- pageInh.add(dic);
- }
-
- private void popPageAttributes() {
- pageInh.remove(pageInh.size() - 1);
- }
-
- private void iteratePages(PRIndirectReference rpage) throws IOException {
- PdfDictionary page = (PdfDictionary)getPdfObject(rpage);
- PdfArray kidsPR = (PdfArray)getPdfObject(page.get(PdfName.KIDS));
- if (kidsPR == null) {
- page.put(PdfName.TYPE, PdfName.PAGE);
- PdfDictionary dic = (PdfDictionary)pageInh.get(pageInh.size() - 1);
- PdfName key;
- for (Iterator i = dic.getKeys().iterator(); i.hasNext();) {
- key = (PdfName)i.next();
- if (page.get(key) == null)
- page.put(key, dic.get(key));
- }
- if (page.get(PdfName.MEDIABOX) == null) {
- PdfArray arr = new PdfArray(new float[]{0,0,PageSize.LETTER.right(),PageSize.LETTER.top()});
- page.put(PdfName.MEDIABOX, arr);
- }
- refsn.add(rpage);
- }
- else {
- page.put(PdfName.TYPE, PdfName.PAGES);
- pushPageAttributes(page);
- ArrayList kids = kidsPR.getArrayList();
- for (int k = 0; k < kids.size(); ++k){
- iteratePages((PRIndirectReference)kids.get(k));
- }
- popPageAttributes();
- }
- }
-
- protected PRIndirectReference getSinglePage(int n) throws IOException {
- PdfDictionary acc = new PdfDictionary();
- PdfDictionary top = reader.rootPages;
- int base = 0;
- while (true) {
- for (int k = 0; k < pageInhCandidates.length; ++k) {
- PdfObject obj = top.get(pageInhCandidates[k]);
- if (obj != null)
- acc.put(pageInhCandidates[k], obj);
- }
- PdfArray kids = (PdfArray)PdfReader.getPdfObjectRelease(top.get(PdfName.KIDS));
- for (Iterator it = kids.listIterator(); it.hasNext();) {
- PRIndirectReference ref = (PRIndirectReference)it.next();
- PdfDictionary dic = (PdfDictionary)getPdfObject(ref);
- int last = reader.lastXrefPartial;
- PdfObject count = getPdfObjectRelease(dic.get(PdfName.COUNT));
- reader.lastXrefPartial = last;
- int acn = 1;
- if (count != null && count.type() == PdfObject.NUMBER)
- acn = ((PdfNumber)count).intValue();
- if (n < base + acn) {
- if (count == null) {
- dic.mergeDifferent(acc);
- return ref;
- }
- reader.releaseLastXrefPartial();
- top = dic;
- break;
- }
- reader.releaseLastXrefPartial();
- base += acn;
- }
- }
- }
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfReaderInstance.java b/LibrarySource/com/lowagie/text/pdf/PdfReaderInstance.java
deleted file mode 100644
index ec0326d..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfReaderInstance.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * $Id: PdfReaderInstance.java,v 1.27 2003/05/02 09:01:27 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.io.*;
-/**
- * Instance of PdfReader in each output document.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-class PdfReaderInstance {
- static final PdfLiteral IDENTITYMATRIX = new PdfLiteral("[1 0 0 1 0 0]");
- static final PdfNumber ONE = new PdfNumber(1);
- int myXref[];
- PdfReader reader;
- RandomAccessFileOrArray file;
- HashMap importedPages = new HashMap();
- PdfWriter writer;
- HashMap visited = new HashMap();
- ArrayList nextRound = new ArrayList();
-
- PdfReaderInstance(PdfReader reader, PdfWriter writer) {
- this.reader = reader;
- this.writer = writer;
- file = reader.getSafeFile();
- myXref = new int[reader.getXrefSize()];
- }
-
- PdfReader getReader() {
- return reader;
- }
-
- PdfImportedPage getImportedPage(int pageNumber) {
- if (pageNumber < 1 || pageNumber > reader.getNumberOfPages())
- throw new IllegalArgumentException("Invalid page number");
- Integer i = new Integer(pageNumber);
- PdfImportedPage pageT = (PdfImportedPage)importedPages.get(i);
- if (pageT == null) {
- pageT = new PdfImportedPage(this, writer, pageNumber);
- importedPages.put(i, pageT);
- }
- return pageT;
- }
-
- int getNewObjectNumber(int number, int generation) {
- if (myXref[number] == 0) {
- myXref[number] = writer.getIndirectReferenceNumber();
- nextRound.add(new Integer(number));
- }
- return myXref[number];
- }
-
- RandomAccessFileOrArray getReaderFile() {
- return file;
- }
-
- PdfObject getResources(int pageNumber) {
- PdfObject obj = PdfReader.getPdfObjectRelease(reader.getPageNRelease(pageNumber).get(PdfName.RESOURCES));
- return obj;
- }
-
-
- PdfStream getFormXObject(int pageNumber) throws IOException {
- PdfDictionary page = reader.getPageNRelease(pageNumber);
- PdfObject contents = PdfReader.getPdfObjectRelease(page.get(PdfName.CONTENTS));
- PdfDictionary dic = new PdfDictionary();
- byte bout[] = null;
- ArrayList filters = null;
- if (contents != null) {
- if (contents.isStream())
- dic.putAll((PRStream)contents);
- else
- bout = reader.getPageContent(pageNumber, file);
- }
- else
- bout = new byte[0];
- dic.put(PdfName.RESOURCES, PdfReader.getPdfObjectRelease(page.get(PdfName.RESOURCES)));
- dic.put(PdfName.TYPE, PdfName.XOBJECT);
- dic.put(PdfName.SUBTYPE, PdfName.FORM);
- PdfImportedPage impPage = (PdfImportedPage)importedPages.get(new Integer(pageNumber));
- dic.put(PdfName.BBOX, new PdfRectangle(impPage.getBoundingBox()));
- PdfArray matrix = impPage.getMatrix();
- if (matrix == null)
- dic.put(PdfName.MATRIX, IDENTITYMATRIX);
- else
- dic.put(PdfName.MATRIX, matrix);
- dic.put(PdfName.FORMTYPE, ONE);
- PRStream stream;
- if (bout == null) {
- stream = new PRStream((PRStream)contents, dic);
- }
- else {
- stream = new PRStream(reader, bout);
- stream.putAll(dic);
- }
- return stream;
- }
-
- void writeAllVisited() throws IOException {
- while (nextRound.size() > 0) {
- ArrayList vec = nextRound;
- nextRound = new ArrayList();
- for (int k = 0; k < vec.size(); ++k) {
- Integer i = (Integer)vec.get(k);
- if (!visited.containsKey(i)) {
- visited.put(i, null);
- int n = i.intValue();
- writer.addToBody(reader.getPdfObjectRelease(n), myXref[n]);
- }
- }
- }
- }
-
- void writeAllPages() throws IOException {
- try {
- file.reOpen();
- for (Iterator it = importedPages.values().iterator(); it.hasNext();) {
- PdfImportedPage ip = (PdfImportedPage)it.next();
- writer.addToBody(ip.getFormXObject(), ip.getIndirectReference());
- }
- writeAllVisited();
- }
- finally {
- try {
- reader.close();
- file.close();
- }
- catch (Exception e) {
- //Empty on purpose
- }
- }
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfRectangle.java b/LibrarySource/com/lowagie/text/pdf/PdfRectangle.java
deleted file mode 100644
index 3b0bade..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfRectangle.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * $Id: PdfRectangle.java,v 1.26 2002/07/09 11:28:24 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.Rectangle;
-
-/**
- * <CODE>PdfRectangle</CODE> is the PDF Rectangle object.
- * <P>
- * Rectangles are used to describe locations on the page and bounding boxes for several
- * objects in PDF, such as fonts. A rectangle is represented as an <CODE>array</CODE> of
- * four numbers, specifying the lower lef <I>x</I>, lower left <I>y</I>, upper right <I>x</I>,
- * and upper right <I>y</I> coordinates of the rectangle, in that order.<BR>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 7.1 (page 183).
- *
- * @see com.lowagie.text.Rectangle
- * @see PdfArray
- */
-
-public class PdfRectangle extends PdfArray {
-
- // membervariables
-
-/** lower left x */
- private float llx = 0;
-
-/** lower left y */
- private float lly = 0;
-
-/** upper right x */
- private float urx = 0;
-
-/** upper right y */
- private float ury = 0;
-
- // constructors
-
-/**
- * Constructs a <CODE>PdfRectangle</CODE>-object.
- *
- * @param llx lower left x
- * @param lly lower left y
- * @param urx upper right x
- * @param ury upper right y
- *
- * @since rugPdf0.10
- */
-
- public PdfRectangle(float llx, float lly, float urx, float ury, int rotation) {
- super();
- if (rotation == 90 || rotation == 270) {
- this.llx = lly;
- this.lly = llx;
- this.urx = ury;
- this.ury = urx;
- }
- else {
- this.llx = llx;
- this.lly = lly;
- this.urx = urx;
- this.ury = ury;
- }
- super.add(new PdfNumber(this.llx));
- super.add(new PdfNumber(this.lly));
- super.add(new PdfNumber(this.urx));
- super.add(new PdfNumber(this.ury));
- }
-
- public PdfRectangle(float llx, float lly, float urx, float ury) {
- this(llx, lly, urx, ury, 0);
- }
-
-/**
- * Constructs a <CODE>PdfRectangle</CODE>-object starting from the origin (0, 0).
- *
- * @param urx upper right x
- * @param ury upper right y
- */
-
- public PdfRectangle(float urx, float ury, int rotation) {
- this(0, 0, urx, ury, rotation);
- }
-
- public PdfRectangle(float urx, float ury) {
- this(0, 0, urx, ury, 0);
- }
-
-/**
- * Constructs a <CODE>PdfRectangle</CODE>-object with a <CODE>Rectangle</CODE>-object.
- *
- * @param rectangle a <CODE>Rectangle</CODE>
- */
-
- public PdfRectangle(Rectangle rectangle, int rotation) {
- this(rectangle.left(), rectangle.bottom(), rectangle.right(), rectangle.top(), rotation);
- }
-
- public PdfRectangle(Rectangle rectangle) {
- this(rectangle.left(), rectangle.bottom(), rectangle.right(), rectangle.top(), 0);
- }
-
- // methods
-
-/**
- * Overrides the <CODE>add</CODE>-method in <CODE>PdfArray</CODE> in order to prevent the adding of extra object to the array.
- *
- * @param object <CODE>PdfObject</CODE> to add (will not be added here)
- * @return <CODE>false</CODE>
- */
-
- public boolean add(PdfObject object) {
- return false;
- }
-
-/**
- * Returns the lower left x-coordinate.
- *
- * @return the lower left x-coordinaat
- */
-
- public float left() {
- return llx;
- }
-
-/**
- * Returns the upper right x-coordinate.
- *
- * @return the upper right x-coordinate
- */
-
- public float right() {
- return urx;
- }
-
-/**
- * Returns the upper right y-coordinate.
- *
- * @return the upper right y-coordinate
- */
-
- public float top() {
- return ury;
- }
-
-/**
- * Returns the lower left y-coordinate.
- *
- * @return the lower left y-coordinate
- */
-
- public float bottom() {
- return lly;
- }
-
-/**
- * Returns the lower left x-coordinate, considering a given margin.
- *
- * @param margin a margin
- * @return the lower left x-coordinate
- */
-
- public float left(int margin) {
- return llx + margin;
- }
-
-/**
- * Returns the upper right x-coordinate, considering a given margin.
- *
- * @param margin a margin
- * @return the upper right x-coordinate
- */
-
- public float right(int margin) {
- return urx - margin;
- }
-
-/**
- * Returns the upper right y-coordinate, considering a given margin.
- *
- * @param margin a margin
- * @return the upper right y-coordinate
- */
-
- public float top(int margin) {
- return ury - margin;
- }
-
-/**
- * Returns the lower left y-coordinate, considering a given margin.
- *
- * @param margin a margin
- * @return the lower left y-coordinate
- */
-
- public float bottom(int margin) {
- return lly + margin;
- }
-
-/**
- * Returns the width of the rectangle.
- *
- * @return a width
- */
-
- public float width() {
- return urx - llx;
- }
-
-/**
- * Returns the height of the rectangle.
- *
- * @return a height
- */
-
- public float height() {
- return ury - lly;
- }
-
-/**
- * Swaps the values of urx and ury and of lly and llx in order to rotate the rectangle.
- *
- * @return a <CODE>PdfRectangle</CODE>
- */
-
- public PdfRectangle rotate() {
- return new PdfRectangle(lly, llx, ury, urx, 0);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfRendition.java b/LibrarySource/com/lowagie/text/pdf/PdfRendition.java
deleted file mode 100644
index f3acd02..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfRendition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2003 Galo Gimenez
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import java.io.IOException;
-
-/**
- * A Rendition dictionary (pdf spec 1.5)
- */
-public class PdfRendition extends PdfDictionary {
- PdfRendition(String file, PdfFileSpecification fs, String mimeType) throws IOException{
- put(PdfName.S, new PdfName("MR"));
- put(PdfName.N, new PdfString("Rendition for "+file));
- put(PdfName.C, new PdfMediaClipData(file, fs, mimeType));
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfResources.java b/LibrarySource/com/lowagie/text/pdf/PdfResources.java
deleted file mode 100644
index 65001de..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfResources.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * $Id: PdfResources.java,v 1.22 2002/06/20 13:30:25 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/**
- * <CODE>PdfResources</CODE> is the PDF Resources-object.
- * <P>
- * The marking operations for drawing a page are stored in a stream that is the value of the
- * <B>Contents</B> key in the Page object's dictionary. Each marking context includes a list
- * of the named resources it uses. This resource list is stored as a dictionary that is the
- * value of the context's <B>Resources</B> key, and it serves two functions: it enumerates
- * the named resources in the contents stream, and it established the mapping from the names
- * to the objects used by the marking operations.<BR>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 7.5 (page 195-197).
- *
- * @see PdfPage
- */
-
-class PdfResources extends PdfDictionary {
-
- // constructor
-
-/**
- * Constructs a PDF ResourcesDictionary.
- */
-
- PdfResources() {
- super();
- }
-
- // methods
-
- void add(PdfName key, PdfDictionary resource) {
- if (resource.size() == 0)
- return;
- PdfDictionary dic = (PdfDictionary)PdfReader.getPdfObject(get(key));
- if (dic == null)
- put(key, resource);
- else
- dic.putAll(resource);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfShading.java b/LibrarySource/com/lowagie/text/pdf/PdfShading.java
deleted file mode 100644
index 5ce9f80..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfShading.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import headless.awt.Color;
-import java.io.IOException;
-/** Implements the shading dictionary (or stream).
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class PdfShading {
-
- protected PdfDictionary shading;
-
- protected PdfWriter writer;
-
- protected int shadingType;
-
- protected ColorDetails colorDetails;
-
- protected PdfName shadingName;
-
- protected PdfIndirectReference shadingReference;
-
- private Color cspace;
-
- /** Holds value of property bBox. */
- protected float[] bBox;
-
- /** Holds value of property antiAlias. */
- protected boolean antiAlias = false;
-
- /** Creates new PdfShading */
- protected PdfShading(PdfWriter writer) {
- this.writer = writer;
- }
-
- protected void setColorSpace(Color color) {
- cspace = color;
- int type = ExtendedColor.getType(color);
- PdfObject colorSpace = null;
- switch (type) {
- case ExtendedColor.TYPE_GRAY: {
- colorSpace = PdfName.DEVICEGRAY;
- break;
- }
- case ExtendedColor.TYPE_CMYK: {
- colorSpace = PdfName.DEVICECMYK;
- break;
- }
- case ExtendedColor.TYPE_SEPARATION: {
- SpotColor spot = (SpotColor)color;
- colorDetails = writer.addSimple(spot.getPdfSpotColor());
- colorSpace = colorDetails.getIndirectReference();
- break;
- }
- case ExtendedColor.TYPE_PATTERN:
- case ExtendedColor.TYPE_SHADING: {
- throwColorSpaceError();
- }
- default:
- colorSpace = PdfName.DEVICERGB;
- break;
- }
- shading.put(PdfName.COLORSPACE, colorSpace);
- }
-
- Color getColorSpace() {
- return cspace;
- }
-
- public static void throwColorSpaceError() {
- throw new IllegalArgumentException("A tiling or shading pattern cannot be used as a color space in a shading pattern");
- }
-
- public static void checkCompatibleColors(Color c1, Color c2) {
- int type1 = ExtendedColor.getType(c1);
- int type2 = ExtendedColor.getType(c2);
- if (type1 != type2)
- throw new IllegalArgumentException("Both colors must be of the same type.");
- if (type1 == ExtendedColor.TYPE_SEPARATION && ((SpotColor)c1).getPdfSpotColor() != ((SpotColor)c2).getPdfSpotColor())
- throw new IllegalArgumentException("The spot color must be the same, only the tint can vary.");
- if (type1 == ExtendedColor.TYPE_PATTERN || type1 == ExtendedColor.TYPE_SHADING)
- throwColorSpaceError();
- }
-
- public static float[] getColorArray(Color color) {
- int type = ExtendedColor.getType(color);
- switch (type) {
- case ExtendedColor.TYPE_GRAY: {
- return new float[]{((GrayColor)color).getGray()};
- }
- case ExtendedColor.TYPE_CMYK: {
- CMYKColor cmyk = (CMYKColor)color;
- return new float[]{cmyk.getCyan(), cmyk.getMagenta(), cmyk.getYellow(), cmyk.getBlack()};
- }
- case ExtendedColor.TYPE_SEPARATION: {
- return new float[]{((SpotColor)color).getTint()};
- }
- case ExtendedColor.TYPE_RGB: {
- return new float[]{color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f};
- }
- }
- throwColorSpaceError();
- return null;
- }
-
- public static PdfShading type1(PdfWriter writer, Color colorSpace, float domain[], float tMatrix[], PdfFunction function) {
- PdfShading sp = new PdfShading(writer);
- sp.shading = new PdfDictionary();
- sp.shadingType = 1;
- sp.shading.put(PdfName.SHADINGTYPE, new PdfNumber(sp.shadingType));
- sp.setColorSpace(colorSpace);
- if (domain != null)
- sp.shading.put(PdfName.DOMAIN, new PdfArray(domain));
- if (tMatrix != null)
- sp.shading.put(PdfName.MATRIX, new PdfArray(tMatrix));
- sp.shading.put(PdfName.FUNCTION, function.getReference());
- return sp;
- }
-
- public static PdfShading type2(PdfWriter writer, Color colorSpace, float coords[], float domain[], PdfFunction function, boolean extend[]) {
- PdfShading sp = new PdfShading(writer);
- sp.shading = new PdfDictionary();
- sp.shadingType = 2;
- sp.shading.put(PdfName.SHADINGTYPE, new PdfNumber(sp.shadingType));
- sp.setColorSpace(colorSpace);
- sp.shading.put(PdfName.COORDS, new PdfArray(coords));
- if (domain != null)
- sp.shading.put(PdfName.DOMAIN, new PdfArray(domain));
- sp.shading.put(PdfName.FUNCTION, function.getReference());
- if (extend != null && (extend[0] || extend[1])) {
- PdfArray array = new PdfArray(extend[0] ? PdfBoolean.PDFTRUE : PdfBoolean.PDFFALSE);
- array.add(extend[1] ? PdfBoolean.PDFTRUE : PdfBoolean.PDFFALSE);
- sp.shading.put(PdfName.EXTEND, array);
- }
- return sp;
- }
-
- public static PdfShading type3(PdfWriter writer, Color colorSpace, float coords[], float domain[], PdfFunction function, boolean extend[]) {
- PdfShading sp = type2(writer, colorSpace, coords, domain, function, extend);
- sp.shadingType = 3;
- sp.shading.put(PdfName.SHADINGTYPE, new PdfNumber(sp.shadingType));
- return sp;
- }
-
- public static PdfShading simpleAxial(PdfWriter writer, float x0, float y0, float x1, float y1, Color startColor, Color endColor, boolean extendStart, boolean extendEnd) {
- checkCompatibleColors(startColor, endColor);
- PdfFunction function = PdfFunction.type2(writer, new float[]{0, 1}, null, getColorArray(startColor),
- getColorArray(endColor), 1);
- return type2(writer, startColor, new float[]{x0, y0, x1, y1}, null, function, new boolean[]{extendStart, extendEnd});
- }
-
- public static PdfShading simpleAxial(PdfWriter writer, float x0, float y0, float x1, float y1, Color startColor, Color endColor) {
- return simpleAxial(writer, x0, y0, x1, y1, startColor, endColor, true, true);
- }
-
- public static PdfShading simpleRadial(PdfWriter writer, float x0, float y0, float r0, float x1, float y1, float r1, Color startColor, Color endColor, boolean extendStart, boolean extendEnd) {
- checkCompatibleColors(startColor, endColor);
- PdfFunction function = PdfFunction.type2(writer, new float[]{0, 1}, null, getColorArray(startColor),
- getColorArray(endColor), 1);
- return type3(writer, startColor, new float[]{x0, y0, r0, x1, y1, r1}, null, function, new boolean[]{extendStart, extendEnd});
- }
-
- public static PdfShading simpleRadial(PdfWriter writer, float x0, float y0, float r0, float x1, float y1, float r1, Color startColor, Color endColor) {
- return simpleRadial(writer, x0, y0, r0, x1, y1, r1, startColor, endColor, true, true);
- }
-
- PdfName getShadingName() {
- return shadingName;
- }
-
- PdfIndirectReference getShadingReference() {
- if (shadingReference == null)
- shadingReference = writer.getPdfIndirectReference();
- return shadingReference;
- }
-
- void setName(int number) {
- shadingName = new PdfName("Sh" + number);
- }
-
- void addToBody() throws IOException {
- if (bBox != null)
- shading.put(PdfName.BBOX, new PdfArray(bBox));
- if (antiAlias)
- shading.put(PdfName.ANTIALIAS, PdfBoolean.PDFTRUE);
- writer.addToBody(shading, getShadingReference());
- }
-
- PdfWriter getWriter() {
- return writer;
- }
-
- ColorDetails getColorDetails() {
- return colorDetails;
- }
-
- public float[] getBBox() {
- return bBox;
- }
-
- public void setBBox(float[] bBox) {
- if (bBox.length != 4)
- throw new IllegalArgumentException("BBox must be a 4 element array.");
- this.bBox = bBox;
- }
-
- public boolean isAntiAlias() {
- return antiAlias;
- }
-
- public void setAntiAlias(boolean antiAlias) {
- this.antiAlias = antiAlias;
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfShadingPattern.java b/LibrarySource/com/lowagie/text/pdf/PdfShadingPattern.java
deleted file mode 100644
index 8713101..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfShadingPattern.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import java.io.IOException;
-/** Implements the shading pattern dictionary.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class PdfShadingPattern extends PdfDictionary {
-
- protected PdfShading shading;
-
- protected PdfWriter writer;
-
- protected float matrix[] = {1, 0, 0, 1, 0, 0};
-
- protected PdfName patternName;
-
- protected PdfIndirectReference patternReference;
-
- /** Creates new PdfShadingPattern */
- public PdfShadingPattern(PdfShading shading) {
- writer = shading.getWriter();
- put(PdfName.PATTERNTYPE, new PdfNumber(2));
- this.shading = shading;
- }
-
- PdfName getPatternName() {
- return patternName;
- }
-
- PdfName getShadingName() {
- return shading.getShadingName();
- }
-
- PdfIndirectReference getPatternReference() {
- if (patternReference == null)
- patternReference = writer.getPdfIndirectReference();
- return patternReference;
- }
-
- PdfIndirectReference getShadingReference() {
- return shading.getShadingReference();
- }
-
- void setName(int number) {
- patternName = new PdfName("P" + number);
- }
-
- void addToBody() throws IOException {
- put(PdfName.SHADING, getShadingReference());
- put(PdfName.MATRIX, new PdfArray(matrix));
- writer.addToBody(this, getPatternReference());
- }
-
- public void setMatrix(float matrix[]) {
- if (matrix.length != 6)
- throw new RuntimeException("The matrix size must be 6.");
- this.matrix = matrix;
- }
-
- public float[] getMatrix() {
- return matrix;
- }
-
- PdfShading getShading() {
- return shading;
- }
-
- ColorDetails getColorDetails() {
- return shading.getColorDetails();
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfSpotColor.java b/LibrarySource/com/lowagie/text/pdf/PdfSpotColor.java
deleted file mode 100644
index 2befdcb..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfSpotColor.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * $Id: PdfSpotColor.java,v 1.45 2005/03/24 12:38:19 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import headless.awt.Color;
-import java.io.IOException;
-/**
- * A <CODE>PdfSpotColor</CODE> defines a ColorSpace
- *
- * @see PdfDictionary
- */
-
-public class PdfSpotColor{
-
-/* The tint value */
- protected float tint;
-
-/** The color name */
- public PdfName name;
-
-/** The alternative color space */
- public Color altcs;
- // constructors
-
- /**
- * Constructs a new <CODE>PdfSpotColor</CODE>.
- *
- * @param name a String value
- * @param tint a tint value between 0 and 1
- * @param altcs a altnative colorspace value
- */
-
- public PdfSpotColor(String name, float tint, Color altcs) {
- this.name = new PdfName(name);
- this.tint = tint;
- this.altcs = altcs;
- }
-
- /**
- * Gets the tint of the SpotColor.
- * @return a float
- */
- public float getTint() {
- return tint;
- }
-
- /**
- * Gets the alternative ColorSpace.
- * @return a Colot
- */
- public Color getAlternativeCS() {
- return altcs;
- }
-
- protected PdfObject getSpotObject(PdfWriter writer) throws IOException {
- PdfArray array = new PdfArray(PdfName.SEPARATION);
- array.add(name);
- PdfFunction func = null;
- if (altcs instanceof ExtendedColor) {
- int type = ((ExtendedColor)altcs).type;
- switch (type) {
- case ExtendedColor.TYPE_GRAY:
- array.add(PdfName.DEVICEGRAY);
- func = PdfFunction.type2(writer, new float[]{0, 1}, null, new float[]{0}, new float[]{((GrayColor)altcs).getGray()}, 1);
- break;
- case ExtendedColor.TYPE_CMYK:
- array.add(PdfName.DEVICECMYK);
- CMYKColor cmyk = (CMYKColor)altcs;
- func = PdfFunction.type2(writer, new float[]{0, 1}, null, new float[]{0, 0, 0, 0},
- new float[]{cmyk.getCyan(), cmyk.getMagenta(), cmyk.getYellow(), cmyk.getBlack()}, 1);
- break;
- default:
- throw new RuntimeException("Only RGB, Gray and CMYK are supported as alternative color spaces.");
- }
- }
- else {
- array.add(PdfName.DEVICERGB);
- func = PdfFunction.type2(writer, new float[]{0, 1}, null, new float[]{0, 0, 0},
- new float[]{(float)altcs.getRed() / 255, (float)altcs.getGreen() / 255, (float)altcs.getBlue() / 255}, 1);
- }
- array.add(func.getReference());
- return array;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfStream.java b/LibrarySource/com/lowagie/text/pdf/PdfStream.java
deleted file mode 100644
index f8a915c..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfStream.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * $Id: PdfStream.java,v 1.53 2004/12/14 15:15:59 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.util.zip.DeflaterOutputStream;
-import java.util.zip.Deflater;
-import com.lowagie.text.Document;
-import com.lowagie.text.DocWriter;
-import com.lowagie.text.ExceptionConverter;
-
-/**
- * <CODE>PdfStream</CODE> is the Pdf stream object.
- * <P>
- * A stream, like a string, is a sequence of characters. However, an application can
- * read a small portion of a stream at a time, while a string must be read in its entirety.
- * For this reason, objects with potentially large amounts of data, such as images and
- * page descriptions, are represented as streams.<BR>
- * A stream consists of a dictionary that describes a sequence of characters, followed by
- * the keyword <B>stream</B>, followed by zero or more lines of characters, followed by
- * the keyword <B>endstream</B>.<BR>
- * All streams must be <CODE>PdfIndirectObject</CODE>s. The stream dictionary must be a direct
- * object. The keyword <B>stream</B> that follows the stream dictionary should be followed by
- * a carriage return and linefeed or just a linefeed.<BR>
- * Remark: In this version only the FLATEDECODE-filter is supported.<BR>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 4.8 (page 41-53).<BR>
- *
- * @see PdfObject
- * @see PdfDictionary
- */
-
-public class PdfStream extends PdfDictionary {
-
- // membervariables
-
-/** is the stream compressed? */
- protected boolean compressed = false;
-
- protected ByteArrayOutputStream streamBytes = null;
- protected InputStream inputStream;
- protected PdfIndirectReference ref;
- protected int inputStreamLength = -1;
- protected PdfWriter writer;
-
- static final byte STARTSTREAM[] = DocWriter.getISOBytes("stream\n");
- static final byte ENDSTREAM[] = DocWriter.getISOBytes("\nendstream");
- static final int SIZESTREAM = STARTSTREAM.length + ENDSTREAM.length;
-
- // constructors
-
-/**
- * Constructs a <CODE>PdfStream</CODE>-object.
- *
- * @param bytes content of the new <CODE>PdfObject</CODE> as an array of <CODE>byte</CODE>.
- */
-
- public PdfStream(byte[] bytes) {
- super();
- type = STREAM;
- this.bytes = bytes;
- put(PdfName.LENGTH, new PdfNumber(bytes.length));
- }
-
- /**
- * Creates an efficient stream. No temporary array is ever created. The <CODE>InputStream</CODE>
- * is totally consumed but is not closed. The general usage is:
- * <p>
- * <pre>
- * InputStream in = ...;
- * PdfStream stream = new PdfStream(in, writer);
- * stream.flateCompress();
- * writer.addToBody(stream);
- * stream.writeLength();
- * in.close();
- * </pre>
- * @param inputStream the data to write to this stream
- * @param writer the <CODE>PdfWriter</CODE> for this stream
- */
- public PdfStream(InputStream inputStream, PdfWriter writer) {
- super();
- type = STREAM;
- this.inputStream = inputStream;
- this.writer = writer;
- ref = writer.getPdfIndirectReference();
- put(PdfName.LENGTH, ref);
- }
-
-/**
- * Constructs a <CODE>PdfStream</CODE>-object.
- */
-
- protected PdfStream() {
- super();
- type = STREAM;
- }
-
- /**
- * Writes the stream length to the <CODE>PdfWriter</CODE>.
- * <p>
- * This method must be called and can only be called if the contructor {@link #PdfStream(InputStream,PdfWriter)}
- * is used to create the stream.
- * @throws IOException on error
- * @see #PdfStream(InputStream,PdfWriter)
- */
- public void writeLength() throws IOException {
- if (inputStream == null)
- throw new UnsupportedOperationException("writeLength() can only be called in a contructed PdfStream(InputStream,PdfWriter).");
- if (inputStreamLength == -1)
- throw new IOException("writeLength() can only be called after output of the stream body.");
- writer.addToBody(new PdfNumber(inputStreamLength), ref, false);
- }
-
- /**
- * Compresses the stream.
- */
-
- public void flateCompress() {
- if (!Document.compress)
- return;
- // check if the flateCompress-method has already been
- if (compressed) {
- return;
- }
- if (inputStream != null) {
- compressed = true;
- return;
- }
- // check if a filter already exists
- PdfObject filter = get(PdfName.FILTER);
- if (filter != null) {
- if (filter.isName() && ((PdfName) filter).compareTo(PdfName.FLATEDECODE) == 0) {
- return;
- }
- else if (filter.isArray() && ((PdfArray) filter).contains(PdfName.FLATEDECODE)) {
- return;
- }
- else {
- throw new RuntimeException("Stream could not be compressed: filter is not a name or array.");
- }
- }
- try {
- // compress
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- DeflaterOutputStream zip = new DeflaterOutputStream(stream);
- if (streamBytes != null)
- streamBytes.writeTo(zip);
- else
- zip.write(bytes);
- zip.close();
- // update the object
- streamBytes = stream;
- bytes = null;
- put(PdfName.LENGTH, new PdfNumber(streamBytes.size()));
- if (filter == null) {
- put(PdfName.FILTER, PdfName.FLATEDECODE);
- }
- else {
- PdfArray filters = new PdfArray(filter);
- filters.add(PdfName.FLATEDECODE);
- put(PdfName.FILTER, filters);
- }
- compressed = true;
- }
- catch(IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- }
-
-// public int getStreamLength(PdfWriter writer) {
-// if (dicBytes == null)
-// toPdf(writer);
-// if (streamBytes != null)
-// return streamBytes.size() + dicBytes.length + SIZESTREAM;
-// else
-// return bytes.length + dicBytes.length + SIZESTREAM;
-// }
-
- protected void superToPdf(PdfWriter writer, OutputStream os) throws IOException {
- super.toPdf(writer, os);
- }
-
- public void toPdf(PdfWriter writer, OutputStream os) throws IOException {
- if (inputStream != null && compressed)
- put(PdfName.FILTER, PdfName.FLATEDECODE);
- superToPdf(writer, os);
- os.write(STARTSTREAM);
- PdfEncryption crypto = null;
- if (writer != null)
- crypto = writer.getEncryption();
- if (crypto != null)
- crypto.prepareKey();
- if (inputStream != null) {
- DeflaterOutputStream def = null;
- PdfEncryptionStream encs = null;
- OutputStreamCounter osc = new OutputStreamCounter(os);
- OutputStream fout = osc;
- if (crypto != null)
- fout = encs = new PdfEncryptionStream(fout, crypto);
- if (compressed)
- fout = def = new DeflaterOutputStream(fout, new Deflater(Deflater.BEST_COMPRESSION), 0x8000);
-
- byte buf[] = new byte[0x10000];
- while (true) {
- int n = inputStream.read(buf);
- if (n <= 0)
- break;
- fout.write(buf, 0, n);
- }
- if (def != null)
- def.finish();
- inputStreamLength = osc.getCounter();
- }
- else {
- if (crypto == null) {
- if (streamBytes != null)
- streamBytes.writeTo(os);
- else
- os.write(bytes);
- }
- else {
- byte b[];
- if (streamBytes != null) {
- b = streamBytes.toByteArray();
- crypto.encryptRC4(b);
- }
- else {
- b = new byte[bytes.length];
- crypto.encryptRC4(bytes, b);
- }
- os.write(b);
- }
- }
- os.write(ENDSTREAM);
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfString.java b/LibrarySource/com/lowagie/text/pdf/PdfString.java
deleted file mode 100644
index ec521f4..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfString.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * $Id: PdfString.java,v 1.26 2002/07/09 11:28:24 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-import java.io.OutputStream;
-import java.io.IOException;
-
-/**
- * A <CODE>PdfString</CODE>-class is the PDF-equivalent of a JAVA-<CODE>String</CODE>-object.
- * <P>
- * A string is a sequence of characters delimited by parenthesis. If a string is too long
- * to be conveniently placed on a single line, it may be split across multiple lines by using
- * the backslash character (\) at the end of a line to indicate that the string continues
- * on the following line. Within a string, the backslash character is used as an escape to
- * specify unbalanced parenthesis, non-printing ASCII characters, and the backslash character
- * itself. Use of the \<I>ddd</I> escape sequence is the preferred way to represent characters
- * outside the printable ASCII character set.<BR>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 4.4 (page 37-39).
- *
- * @see PdfObject
- * @see BadPdfFormatException
- */
-
-public class PdfString extends PdfObject {
-
- // membervariables
-
- /** The value of this object. */
- protected String value = NOTHING;
- protected String originalValue = null;
-
- /** The encoding. */
- protected String encoding = TEXT_PDFDOCENCODING;
- protected int objNum = 0;
- protected int objGen = 0;
- protected boolean hexWriting = false;
-
- // constructors
-
- /**
- * Constructs an empty <CODE>PdfString</CODE>-object.
- */
-
- public PdfString() {
- super(STRING);
- }
-
- /**
- * Constructs a <CODE>PdfString</CODE>-object.
- *
- * @param value the content of the string
- */
-
- public PdfString(String value) {
- super(STRING);
- this.value = value;
- }
-
- /**
- * Constructs a <CODE>PdfString</CODE>-object.
- *
- * @param value the content of the string
- * @param encoding an encoding
- */
-
- public PdfString(String value, String encoding) {
- super(STRING);
- this.value = value;
- this.encoding = encoding;
- }
-
- /**
- * Constructs a <CODE>PdfString</CODE>-object.
- *
- * @param bytes an array of <CODE>byte</CODE>
- */
-
- public PdfString(byte[] bytes) {
- super(STRING);
- value = PdfEncodings.convertToString(bytes, null);
- encoding = NOTHING;
- }
-
- // methods overriding some methods in PdfObject
-
- /**
- * Returns the PDF representation of this <CODE>PdfString</CODE>.
- *
- * @return an array of <CODE>byte</CODE>s
- */
-
- public void toPdf(PdfWriter writer, OutputStream os) throws IOException {
- byte b[] = getBytes();
- PdfEncryption crypto = null;
- if (writer != null)
- crypto = writer.getEncryption();
- if (crypto != null) {
- b = (byte[])bytes.clone();
- crypto.prepareKey();
- crypto.encryptRC4(b);
- }
- if (hexWriting) {
- ByteBuffer buf = new ByteBuffer();
- buf.append('<');
- int len = b.length;
- for (int k = 0; k < len; ++k)
- buf.appendHex(b[k]);
- buf.append('>');
- os.write(buf.toByteArray());
- }
- else
- os.write(PdfContentByte.escapeString(b));
- }
-
- /**
- * Returns the <CODE>String</CODE> value of the <CODE>PdfString</CODE>-object.
- *
- * @return a <CODE>String</CODE>
- */
-
- public String toString() {
- return value;
- }
-
- // other methods
-
- /**
- * Gets the encoding of this string.
- *
- * @return a <CODE>String</CODE>
- */
-
- public String getEncoding() {
- return encoding;
- }
-
- public String toUnicodeString() {
- if (encoding != null && encoding.length() != 0)
- return value;
- getBytes();
- if (bytes.length >= 2 && bytes[0] == (byte)254 && bytes[1] == (byte)255)
- return PdfEncodings.convertToString(bytes, PdfObject.TEXT_UNICODE);
- else
- return PdfEncodings.convertToString(bytes, PdfObject.TEXT_PDFDOCENCODING);
- }
-
- void setObjNum(int objNum, int objGen) {
- this.objNum = objNum;
- this.objGen = objGen;
- }
-
- void decrypt(PdfReader reader) {
- PdfEncryption decrypt = reader.getDecrypt();
- if (decrypt != null) {
- originalValue = value;
- decrypt.setHashKey(objNum, objGen);
- decrypt.prepareKey();
- bytes = PdfEncodings.convertToBytes(value, null);
- decrypt.encryptRC4(bytes);
- value = PdfEncodings.convertToString(bytes, null);
- }
- }
-
- public byte[] getBytes() {
- if (bytes == null) {
- if (encoding != null && encoding.equals(TEXT_UNICODE) && PdfEncodings.isPdfDocEncoding(value))
- bytes = PdfEncodings.convertToBytes(value, TEXT_PDFDOCENCODING);
- else
- bytes = PdfEncodings.convertToBytes(value, encoding);
- }
- return bytes;
- }
-
- public byte[] getOriginalBytes() {
- if (originalValue == null)
- return getBytes();
- return PdfEncodings.convertToBytes(originalValue, null);
- }
-
- public PdfString setHexWriting(boolean hexWriting) {
- this.hexWriting = hexWriting;
- return this;
- }
-
- public boolean isHexWriting() {
- return hexWriting;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfTable.java b/LibrarySource/com/lowagie/text/pdf/PdfTable.java
deleted file mode 100644
index b8333a3..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfTable.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * $Id: PdfTable.java,v 1.51 2004/02/07 10:28:45 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import com.lowagie.text.Element;
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.Cell;
-import com.lowagie.text.Row;
-import com.lowagie.text.Table;
-
-/**
- * <CODE>PdfTable</CODE> is an object that contains the graphics and text of a table.
- *
- * @see com.lowagie.text.Table
- * @see com.lowagie.text.Row
- * @see com.lowagie.text.Cell
- * @see PdfCell
- */
-
-public class PdfTable extends Rectangle {
-
- // membervariables
-
- /** this is the number of columns in the table. */
- private int columns;
-
- /** this is the ArrayList with all the cell of the table header. */
- private ArrayList headercells;
-
- /** this is the ArrayList with all the cells in the table. */
- private ArrayList cells;
-
- /** Original table used to build this object*/
- protected Table table;
-
- /** Cached column widths. */
- protected float[] positions;
-
- // constructors
-
- /**
- * Constructs a <CODE>PdfTable</CODE>-object.
- *
- * @param table a <CODE>Table</CODE>
- * @param left the left border on the page
- * @param right the right border on the page
- * @param top the start position of the top of the table
- * @param supportUpdateRowAdditions
- * if true, table rows will be deleted after building the PdfTable table,
- * in order to preserve memory and detect future row additions
- */
-
- PdfTable(Table table, float left, float right, float top, boolean supportUpdateRowAdditions) {
- // constructs a Rectangle (the bottomvalue will be changed afterwards)
- super(left, top, right, top);
- this.table = table;
- table.complete();
-
- // copying the attributes from class Table
- cloneNonPositionParameters(table);
-
- this.columns = table.columns();
- positions = table.getWidths(left, right - left);
-
- // initialisation of some parameters
- setLeft(positions[0]);
- setRight(positions[positions.length - 1]);
-
- headercells = new ArrayList();
- cells = new ArrayList();
-
- updateRowAdditionsInternal();
- if (supportUpdateRowAdditions) {
- table.deleteAllRows();
- }
- }
-
- // methods
-
- /**
- * Updates the table row additions in the underlying table object and deletes all table rows,
- * in order to preserve memory and detect future row additions.
- * <p><b>Pre-requisite</b>: the object must have been built with the parameter <code>supportUpdateRowAdditions</code> equals to true.
- */
-
- void updateRowAdditions() {
- table.complete();
- updateRowAdditionsInternal();
- table.deleteAllRows();
- }
-
- /**
- * Updates the table row additions in the underlying table object
- */
-
- private void updateRowAdditionsInternal() {
- // correct table : fill empty cells/ parse table in table
- Row row;
- int prevRows = rows();
- int rowNumber = 0;
- int groupNumber = 0;
- boolean groupChange;
- int firstDataRow = table.firstDataRow();
- Cell cell;
- PdfCell currentCell;
- ArrayList newCells = new ArrayList();
- int rows = table.size() + 1;
- float[] offsets = new float[rows];
- for (int i = 0; i < rows; i++) {
- offsets[i] = bottom();
- }
-
- // loop over all the rows
- for (Iterator rowIterator = table.iterator(); rowIterator.hasNext(); ) {
- groupChange = false;
- row = (Row) rowIterator.next();
- if (row.isEmpty()) {
- if (rowNumber < rows - 1 && offsets[rowNumber + 1] > offsets[rowNumber]) offsets[rowNumber + 1] = offsets[rowNumber];
- }
- else {
- for(int i = 0; i < row.columns(); i++) {
- cell = (Cell) row.getCell(i);
- if (cell != null) {
- currentCell = new PdfCell(cell, rowNumber+prevRows, positions[i], positions[i + cell.colspan()], offsets[rowNumber], cellspacing(), cellpadding());
- try {
- if (offsets[rowNumber] - currentCell.height() - cellpadding() < offsets[rowNumber + currentCell.rowspan()]) {
- offsets[rowNumber + currentCell.rowspan()] = offsets[rowNumber] - currentCell.height() - cellpadding();
- }
- }
- catch(ArrayIndexOutOfBoundsException aioobe) {
- if (offsets[rowNumber] - currentCell.height() < offsets[rows - 1]) {
- offsets[rows - 1] = offsets[rowNumber] - currentCell.height();
- }
- }
- if (rowNumber < firstDataRow) {
- currentCell.setHeader();
- headercells.add(currentCell);
- }
- currentCell.setGroupNumber(groupNumber);
- groupChange |= cell.getGroupChange();
- newCells.add(currentCell);
- }
- }
- }
- rowNumber++;
- if( groupChange ) groupNumber++;
- }
-
- // loop over all the cells
- int n = newCells.size();
- for (int i = 0; i < n; i++) {
- currentCell = (PdfCell) newCells.get(i);
- try {
- currentCell.setBottom(offsets[currentCell.rownumber()-prevRows + currentCell.rowspan()]);
- }
- catch(ArrayIndexOutOfBoundsException aioobe) {
- currentCell.setBottom(offsets[rows - 1]);
- }
- }
- cells.addAll(newCells);
- setBottom(offsets[rows - 1]);
- }
-
- /**
- * Get the number of rows
- */
-
- int rows() {
- return cells.size() == 0 ? 0 : ((PdfCell)cells.get(cells.size()-1)).rownumber()+1;
- }
-
- /** @see com.lowagie.text.Element#type() */
- public int type() {
- return Element.TABLE;
- }
-
- /**
- * Returns the arraylist with the cells of the table header.
- *
- * @return an <CODE>ArrayList</CODE>
- */
-
- ArrayList getHeaderCells() {
- return headercells;
- }
-
- /**
- * Checks if there is a table header.
- *
- * @return an <CODE>ArrayList</CODE>
- */
-
- boolean hasHeader() {
- return headercells.size() > 0;
- }
-
- /**
- * Returns the arraylist with the cells of the table.
- *
- * @return an <CODE>ArrayList</CODE>
- */
-
- ArrayList getCells() {
- return cells;
- }
-
- /**
- * Returns the number of columns of the table.
- *
- * @return the number of columns
- */
-
- int columns() {
- return columns;
- }
-
- /**
- * Returns the cellpadding of the table.
- *
- * @return the cellpadding
- */
-
- final float cellpadding() {
- return table.cellpadding();
- }
-
- /**
- * Returns the cellspacing of the table.
- *
- * @return the cellspacing
- */
-
- final float cellspacing() {
- return table.cellspacing();
- }
-
- /**
- * Checks if this <CODE>Table</CODE> has to fit a page.
- *
- * @return true if the table may not be split
- */
-
- public final boolean hasToFitPageTable() {
- return table.hasToFitPageTable();
- }
-
- /**
- * Checks if the cells of this <CODE>Table</CODE> have to fit a page.
- *
- * @return true if the cells may not be split
- */
-
- public final boolean hasToFitPageCells() {
- return table.hasToFitPageCells();
- }
-
- /**
- * Gets the offset of this table.
- *
- * @return the space between this table and the previous element.
- */
- public float getOffset() {
- return table.getOffset();
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfTemplate.java b/LibrarySource/com/lowagie/text/pdf/PdfTemplate.java
deleted file mode 100644
index d22aa60..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfTemplate.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * $Id: PdfTemplate.java,v 1.36 2003/05/02 09:01:28 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-import java.io.IOException;
-
-import com.lowagie.text.Rectangle;
-
-/**
- * Implements the form XObject.
- */
-
-public class PdfTemplate extends PdfContentByte {
- public static final int TYPE_TEMPLATE = 1;
- public static final int TYPE_IMPORTED = 2;
- public static final int TYPE_PATTERN = 3;
- protected int type;
- /** The indirect reference to this template */
- protected PdfIndirectReference thisReference;
-
- /** The resources used by this template */
- protected PageResources pageResources;
-
-
- /** The bounding box of this template */
- protected Rectangle bBox = new Rectangle(0, 0);
-
- protected PdfArray matrix;
-
- protected PdfTransparencyGroup group;
-
- protected PdfOCG layer;
-
- /**
- *Creates a <CODE>PdfTemplate</CODE>.
- */
-
- protected PdfTemplate() {
- super(null);
- type = TYPE_TEMPLATE;
- }
-
- /**
- * Creates new PdfTemplate
- *
- * @param wr the <CODE>PdfWriter</CODE>
- */
-
- PdfTemplate(PdfWriter wr) {
- super(wr);
- type = TYPE_TEMPLATE;
- pageResources = new PageResources();
- pageResources.addDefaultColor(wr.getDefaultColorspace());
- thisReference = writer.getPdfIndirectReference();
- }
-
- /**
- * Sets the bounding width of this template.
- *
- * @param width the bounding width
- */
-
- public void setWidth(float width) {
- bBox.setLeft(0);
- bBox.setRight(width);
- }
-
- /**
- * Sets the bounding heigth of this template.
- *
- * @param height the bounding height
- */
-
- public void setHeight(float height) {
- bBox.setBottom(0);
- bBox.setTop(height);
- }
-
- /**
- * Gets the bounding width of this template.
- *
- * @return width the bounding width
- */
- public float getWidth() {
- return bBox.width();
- }
-
- /**
- * Gets the bounding heigth of this template.
- *
- * @return heigth the bounding height
- */
-
- public float getHeight() {
- return bBox.height();
- }
-
- public Rectangle getBoundingBox() {
- return bBox;
- }
-
- public void setBoundingBox(Rectangle bBox) {
- this.bBox = bBox;
- }
-
- /**
- * Sets the layer this template belongs to.
- * @param layer the layer this template belongs to
- */
- public void setLayer(PdfOCG layer) {
- this.layer = layer;
- }
-
- /**
- * Gets the layer this template belongs to.
- * @return the layer this template belongs to or <code>null</code> for no layer defined
- */
- public PdfOCG getLayer() {
- return layer;
- }
-
- public void setMatrix(float a, float b, float c, float d, float e, float f) {
- matrix = new PdfArray();
- matrix.add(new PdfNumber(a));
- matrix.add(new PdfNumber(b));
- matrix.add(new PdfNumber(c));
- matrix.add(new PdfNumber(d));
- matrix.add(new PdfNumber(e));
- matrix.add(new PdfNumber(f));
- }
-
- PdfArray getMatrix() {
- return matrix;
- }
-
- /**
- * Gets the indirect reference to this template.
- *
- * @return the indirect reference to this template
- */
-
- PdfIndirectReference getIndirectReference() {
- return thisReference;
- }
-
- public void beginVariableText() {
- content.append("/Tx BMC ");
- }
-
- public void endVariableText() {
- content.append("EMC ");
- }
-
- /**
- * Constructs the resources used by this template.
- *
- * @return the resources used by this template
- */
-
- PdfObject getResources() {
- return getPageResources().getResources();
- }
-
- /**
- * Gets the stream representing this template.
- *
- * @return the stream representing this template
- */
-
- PdfStream getFormXObject() throws IOException {
- return new PdfFormXObject(this);
- }
-
- /**
- * Gets a duplicate of this <CODE>PdfTemplate</CODE>. All
- * the members are copied by reference but the buffer stays different.
- * @return a copy of this <CODE>PdfTemplate</CODE>
- */
-
- public PdfContentByte getDuplicate() {
- PdfTemplate tpl = new PdfTemplate();
- tpl.writer = writer;
- tpl.pdf = pdf;
- tpl.thisReference = thisReference;
- tpl.pageResources = pageResources;
- tpl.bBox = new Rectangle(bBox);
- tpl.group = group;
- tpl.layer = layer;
- if (matrix != null) {
- tpl.matrix = new PdfArray(matrix);
- }
- tpl.separator = separator;
- return tpl;
- }
-
- public int getType() {
- return type;
- }
-
- PageResources getPageResources() {
- return pageResources;
- }
-
- /** Getter for property group.
- * @return Value of property group.
- *
- */
- public PdfTransparencyGroup getGroup() {
- return this.group;
- }
-
- /** Setter for property group.
- * @param group New value of property group.
- *
- */
- public void setGroup(PdfTransparencyGroup group) {
- this.group = group;
- }
-
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfTextArray.java b/LibrarySource/com/lowagie/text/pdf/PdfTextArray.java
deleted file mode 100644
index 9abd927..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfTextArray.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * $Id: PdfTextArray.java,v 1.24 2002/07/09 11:28:24 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.util.ArrayList;
-
-/**
- * <CODE>PdfTextArray</CODE> defines an array with displacements and <CODE>PdfString</CODE>-objects.
- * <P>
- * A <CODE>TextArray</CODE> is used with the operator <VAR>TJ</VAR> in <CODE>PdfText</CODE>.
- * The first object in this array has to be a <CODE>PdfString</CODE>;
- * see reference manual version 1.3 section 8.7.5, pages 346-347.
- */
-
-public class PdfTextArray{
- ArrayList arrayList = new ArrayList();
- // constructors
-
-
- public PdfTextArray(String str) {
- arrayList.add(str);
- }
-
- public PdfTextArray() {
- }
-
-/**
- * Adds a <CODE>PdfNumber</CODE> to the <CODE>PdfArray</CODE>.
- *
- * @param number displacement of the string
- */
-
- public void add(PdfNumber number)
- {
- arrayList.add(new Float(number.doubleValue()));
- }
-
- public void add(float number)
- {
- arrayList.add(new Float(number));
- }
-
- public void add(String str)
- {
- arrayList.add(str);
- }
-
- ArrayList getArrayList() {
- return arrayList;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfTransition.java b/LibrarySource/com/lowagie/text/pdf/PdfTransition.java
deleted file mode 100644
index 057ccac..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfTransition.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright 2002 by Josselin PUJO.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-public class PdfTransition {
- /**
- * Out Vertical Split
- */
- public static final int SPLITVOUT = 1;
- /**
- * Out Horizontal Split
- */
- public static final int SPLITHOUT = 2;
- /**
- * In Vertical Split
- */
- public static final int SPLITVIN = 3;
- /**
- * IN Horizontal Split
- */
- public static final int SPLITHIN = 4;
- /**
- * Vertical Blinds
- */
- public static final int BLINDV = 5;
- /**
- * Vertical Blinds
- */
- public static final int BLINDH = 6;
- /**
- * Inward Box
- */
- public static final int INBOX = 7;
- /**
- * Outward Box
- */
- public static final int OUTBOX = 8;
- /**
- * Left-Right Wipe
- */
- public static final int LRWIPE = 9;
- /**
- * Right-Left Wipe
- */
- public static final int RLWIPE = 10;
- /**
- * Bottom-Top Wipe
- */
- public static final int BTWIPE = 11;
- /**
- * Top-Bottom Wipe
- */
- public static final int TBWIPE = 12;
- /**
- * Dissolve
- */
- public static final int DISSOLVE = 13;
- /**
- * Left-Right Glitter
- */
- public static final int LRGLITTER = 14;
- /**
- * Top-Bottom Glitter
- */
- public static final int TBGLITTER = 15;
- /**
- * Diagonal Glitter
- */
- public static final int DGLITTER = 16;
-
- /**
- * duration of the transition effect
- */
- protected int duration;
- /**
- * type of the transition effect
- */
- protected int type;
-
- /**
- * Constructs a <CODE>Transition</CODE>.
- *
- */
- public PdfTransition() {
- this(BLINDH);
- }
-
- /**
- * Constructs a <CODE>Transition</CODE>.
- *
- *@param type type of the transition effect
- */
- public PdfTransition(int type) {
- this(type,1);
- }
-
- /**
- * Constructs a <CODE>Transition</CODE>.
- *
- *@param type type of the transition effect
- *@param duration duration of the transition effect
- */
- public PdfTransition(int type, int duration) {
- this.duration = duration;
- this.type = type;
- }
-
-
- public int getDuration() {
- return duration;
- }
-
-
- public int getType() {
- return type;
- }
-
- public PdfDictionary getTransitionDictionary() {
- PdfDictionary trans = new PdfDictionary(PdfName.TRANS);
- switch (type) {
- case SPLITVOUT:
- trans.put(PdfName.S,PdfName.SPLIT);
- trans.put(PdfName.D,new PdfNumber(duration));
- trans.put(PdfName.DM,PdfName.V);
- trans.put(PdfName.M,PdfName.O);
- break;
- case SPLITHOUT:
- trans.put(PdfName.S,PdfName.SPLIT);
- trans.put(PdfName.D,new PdfNumber(duration));
- trans.put(PdfName.DM,PdfName.H);
- trans.put(PdfName.M,PdfName.O);
- break;
- case SPLITVIN:
- trans.put(PdfName.S,PdfName.SPLIT);
- trans.put(PdfName.D,new PdfNumber(duration));
- trans.put(PdfName.DM,PdfName.V);
- trans.put(PdfName.M,PdfName.I);
- break;
- case SPLITHIN:
- trans.put(PdfName.S,PdfName.SPLIT);
- trans.put(PdfName.D,new PdfNumber(duration));
- trans.put(PdfName.DM,PdfName.H);
- trans.put(PdfName.M,PdfName.I);
- break;
- case BLINDV:
- trans.put(PdfName.S,PdfName.BLINDS);
- trans.put(PdfName.D,new PdfNumber(duration));
- trans.put(PdfName.DM,PdfName.V);
- break;
- case BLINDH:
- trans.put(PdfName.S,PdfName.BLINDS);
- trans.put(PdfName.D,new PdfNumber(duration));
- trans.put(PdfName.DM,PdfName.H);
- break;
- case INBOX:
- trans.put(PdfName.S,PdfName.BOX);
- trans.put(PdfName.D,new PdfNumber(duration));
- trans.put(PdfName.M,PdfName.I);
- break;
- case OUTBOX:
- trans.put(PdfName.S,PdfName.BOX);
- trans.put(PdfName.D,new PdfNumber(duration));
- trans.put(PdfName.M,PdfName.O);
- break;
- case LRWIPE:
- trans.put(PdfName.S,PdfName.WIPE);
- trans.put(PdfName.D,new PdfNumber(duration));
- trans.put(PdfName.DI,new PdfNumber(0));
- break;
- case RLWIPE:
- trans.put(PdfName.S,PdfName.WIPE);
- trans.put(PdfName.D,new PdfNumber(duration));
- trans.put(PdfName.DI,new PdfNumber(180));
- break;
- case BTWIPE:
- trans.put(PdfName.S,PdfName.WIPE);
- trans.put(PdfName.D,new PdfNumber(duration));
- trans.put(PdfName.DI,new PdfNumber(90));
- break;
- case TBWIPE:
- trans.put(PdfName.S,PdfName.WIPE);
- trans.put(PdfName.D,new PdfNumber(duration));
- trans.put(PdfName.DI,new PdfNumber(270));
- break;
- case DISSOLVE:
- trans.put(PdfName.S,PdfName.DISSOLVE);
- trans.put(PdfName.D,new PdfNumber(duration));
- break;
- case LRGLITTER:
- trans.put(PdfName.S,PdfName.GLITTER);
- trans.put(PdfName.D,new PdfNumber(duration));
- trans.put(PdfName.DI,new PdfNumber(0));
- break;
- case TBGLITTER:
- trans.put(PdfName.S,PdfName.GLITTER);
- trans.put(PdfName.D,new PdfNumber(duration));
- trans.put(PdfName.DI,new PdfNumber(270));
- break;
- case DGLITTER:
- trans.put(PdfName.S,PdfName.GLITTER);
- trans.put(PdfName.D,new PdfNumber(duration));
- trans.put(PdfName.DI,new PdfNumber(315));
- break;
- }
- return trans;
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfTransparencyGroup.java b/LibrarySource/com/lowagie/text/pdf/PdfTransparencyGroup.java
deleted file mode 100644
index 7890cc3..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfTransparencyGroup.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2003 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-/** The transparency group dictionary.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class PdfTransparencyGroup extends PdfDictionary {
-
- /**
- * Constructs a transparencyGroup.
- */
- public PdfTransparencyGroup() {
- super();
- put(PdfName.S, PdfName.TRANSPARENCY);
- }
-
- /**
- * Determining the initial backdrop against which its stack is composited.
- * @param isolated
- */
- public void setIsolated(boolean isolated) {
- if (isolated)
- put(PdfName.I, PdfBoolean.PDFTRUE);
- else
- remove(PdfName.I);
- }
-
- /**
- * Determining whether the objects within the stack are composited with one another or only with the group's backdrop.
- * @param knockout
- */
- public void setKnockout(boolean knockout) {
- if (knockout)
- put(PdfName.K, PdfBoolean.PDFTRUE);
- else
- remove(PdfName.K);
- }
-
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfWriter.java b/LibrarySource/com/lowagie/text/pdf/PdfWriter.java
deleted file mode 100644
index dca2b22..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfWriter.java
+++ /dev/null
@@ -1,2542 +0,0 @@
-/*
- * $Id: PdfWriter.java,v 1.87 2004/12/14 15:16:01 blowagie Exp $
- * $Name: $
- *
- * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import headless.awt.Color;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.TreeMap;
-import java.util.TreeSet;
-import java.util.HashSet;
-
-import com.lowagie.text.DocListener;
-import com.lowagie.text.DocWriter;
-import com.lowagie.text.Document;
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.ExceptionConverter;
-import com.lowagie.text.Image;
-import com.lowagie.text.ImgWMF;
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.Table;
-import com.lowagie.text.ImgPostscript;
-
-/**
- * A <CODE>DocWriter</CODE> class for PDF.
- * <P>
- * When this <CODE>PdfWriter</CODE> is added
- * to a certain <CODE>PdfDocument</CODE>, the PDF representation of every Element
- * added to this Document will be written to the outputstream.</P>
- */
-
-public class PdfWriter extends DocWriter {
-
- // inner classes
-
- /**
- * This class generates the structure of a PDF document.
- * <P>
- * This class covers the third section of Chapter 5 in the 'Portable Document Format
- * Reference Manual version 1.3' (page 55-60). It contains the body of a PDF document
- * (section 5.14) and it can also generate a Cross-reference Table (section 5.15).
- *
- * @see PdfWriter
- * @see PdfObject
- * @see PdfIndirectObject
- */
-
- public static class PdfBody {
-
- // inner classes
-
- /**
- * <CODE>PdfCrossReference</CODE> is an entry in the PDF Cross-Reference table.
- */
-
- static class PdfCrossReference implements Comparable {
-
- // membervariables
- private int type;
-
- /** Byte offset in the PDF file. */
- private int offset;
-
- private int refnum;
- /** generation of the object. */
- private int generation;
-
- // constructors
- /**
- * Constructs a cross-reference element for a PdfIndirectObject.
- * @param refnum
- * @param offset byte offset of the object
- * @param generation generationnumber of the object
- */
-
- PdfCrossReference(int refnum, int offset, int generation) {
- type = 0;
- this.offset = offset;
- this.refnum = refnum;
- this.generation = generation;
- }
-
- /**
- * Constructs a cross-reference element for a PdfIndirectObject.
- * @param refnum
- * @param offset byte offset of the object
- */
-
- PdfCrossReference(int refnum, int offset) {
- type = 1;
- this.offset = offset;
- this.refnum = refnum;
- this.generation = 0;
- }
-
- PdfCrossReference(int type, int refnum, int offset, int generation) {
- this.type = type;
- this.offset = offset;
- this.refnum = refnum;
- this.generation = generation;
- }
-
- int getRefnum() {
- return refnum;
- }
-
- /**
- * Returns the PDF representation of this <CODE>PdfObject</CODE>.
- * @param os
- * @throws IOException
- */
-
- public void toPdf(OutputStream os) throws IOException {
- // This code makes it more difficult to port the lib to JDK1.1.x:
- // StringBuffer off = new StringBuffer("0000000000").append(offset);
- // off.delete(0, off.length() - 10);
- // StringBuffer gen = new StringBuffer("00000").append(generation);
- // gen.delete(0, gen.length() - 5);
- // so it was changed into this:
- String s = "0000000000" + offset;
- StringBuffer off = new StringBuffer(s.substring(s.length() - 10));
- s = "00000" + generation;
- String gen = s.substring(s.length() - 5);
- if (generation == 65535) {
- os.write(getISOBytes(off.append(' ').append(gen).append(" f \n").toString()));
- }
- else
- os.write(getISOBytes(off.append(' ').append(gen).append(" n \n").toString()));
- }
-
- /**
- * Writes PDF syntax to the OutputStream
- * @param midSize
- * @param os
- * @throws IOException
- */
- public void toPdf(int midSize, OutputStream os) throws IOException {
- os.write((byte)type);
- while (--midSize >= 0)
- os.write((byte)((offset >>> (8 * midSize)) & 0xff));
- os.write((byte)((generation >>> 8) & 0xff));
- os.write((byte)(generation & 0xff));
- }
-
- /**
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo(Object o) {
- PdfCrossReference other = (PdfCrossReference)o;
- return (refnum < other.refnum ? -1 : (refnum==other.refnum ? 0 : 1));
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj instanceof PdfCrossReference) {
- PdfCrossReference other = (PdfCrossReference)obj;
- return (refnum == other.refnum);
- }
- else
- return false;
- }
-
- }
-
- // membervariables
-
- /** array containing the cross-reference table of the normal objects. */
- private TreeSet xrefs;
- private int refnum;
- /** the current byteposition in the body. */
- private int position;
- private PdfWriter writer;
- // constructors
-
- /**
- * Constructs a new <CODE>PdfBody</CODE>.
- * @param writer
- */
- PdfBody(PdfWriter writer) {
- xrefs = new TreeSet();
- xrefs.add(new PdfCrossReference(0, 0, 65535));
- position = writer.getOs().getCounter();
- refnum = 1;
- this.writer = writer;
- }
-
- void setRefnum(int refnum) {
- this.refnum = refnum;
- }
-
- // methods
-
- private static final int OBJSINSTREAM = 200;
-
- private ByteBuffer index;
- private ByteBuffer streamObjects;
- private int currentObjNum;
- private int numObj = 0;
-
- private PdfWriter.PdfBody.PdfCrossReference addToObjStm(PdfObject obj, int nObj) throws IOException {
- if (numObj >= OBJSINSTREAM)
- flushObjStm();
- if (index == null) {
- index = new ByteBuffer();
- streamObjects = new ByteBuffer();
- currentObjNum = getIndirectReferenceNumber();
- numObj = 0;
- }
- int p = streamObjects.size();
- int idx = numObj++;
- PdfEncryption enc = writer.crypto;
- writer.crypto = null;
- obj.toPdf(writer, streamObjects);
- writer.crypto = enc;
- streamObjects.append(' ');
- index.append(nObj).append(' ').append(p).append(' ');
- return new PdfWriter.PdfBody.PdfCrossReference(2, nObj, currentObjNum, idx);
- }
-
- private void flushObjStm() throws IOException {
- if (numObj == 0)
- return;
- int first = index.size();
- index.append(streamObjects);
- PdfStream stream = new PdfStream(index.toByteArray());
- stream.flateCompress();
- stream.put(PdfName.TYPE, PdfName.OBJSTM);
- stream.put(PdfName.N, new PdfNumber(numObj));
- stream.put(PdfName.FIRST, new PdfNumber(first));
- add(stream, currentObjNum);
- index = null;
- streamObjects = null;
- numObj = 0;
- }
-
- /**
- * Adds a <CODE>PdfObject</CODE> to the body.
- * <P>
- * This methods creates a <CODE>PdfIndirectObject</CODE> with a
- * certain number, containing the given <CODE>PdfObject</CODE>.
- * It also adds a <CODE>PdfCrossReference</CODE> for this object
- * to an <CODE>ArrayList</CODE> that will be used to build the
- * Cross-reference Table.
- *
- * @param object a <CODE>PdfObject</CODE>
- * @return a <CODE>PdfIndirectObject</CODE>
- * @throws IOException
- */
-
- PdfIndirectObject add(PdfObject object) throws IOException {
- return add(object, getIndirectReferenceNumber());
- }
-
- PdfIndirectObject add(PdfObject object, boolean inObjStm) throws IOException {
- return add(object, getIndirectReferenceNumber(), inObjStm);
- }
-
- /**
- * Gets a PdfIndirectReference for an object that will be created in the future.
- * @return a PdfIndirectReference
- */
-
- PdfIndirectReference getPdfIndirectReference() {
- return new PdfIndirectReference(0, getIndirectReferenceNumber());
- }
-
- int getIndirectReferenceNumber() {
- int n = refnum++;
- xrefs.add(new PdfCrossReference(n, 0, 65536));
- return n;
- }
-
- /**
- * Adds a <CODE>PdfObject</CODE> to the body given an already existing
- * PdfIndirectReference.
- * <P>
- * This methods creates a <CODE>PdfIndirectObject</CODE> with the number given by
- * <CODE>ref</CODE>, containing the given <CODE>PdfObject</CODE>.
- * It also adds a <CODE>PdfCrossReference</CODE> for this object
- * to an <CODE>ArrayList</CODE> that will be used to build the
- * Cross-reference Table.
- *
- * @param object a <CODE>PdfObject</CODE>
- * @param ref a <CODE>PdfIndirectReference</CODE>
- * @return a <CODE>PdfIndirectObject</CODE>
- * @throws IOException
- */
-
- PdfIndirectObject add(PdfObject object, PdfIndirectReference ref) throws IOException {
- return add(object, ref.getNumber());
- }
-
- PdfIndirectObject add(PdfObject object, PdfIndirectReference ref, boolean inObjStm) throws IOException {
- return add(object, ref.getNumber(), inObjStm);
- }
-
- PdfIndirectObject add(PdfObject object, int refNumber) throws IOException {
- return add(object, refNumber, true); // to false
- }
-
- PdfIndirectObject add(PdfObject object, int refNumber, boolean inObjStm) throws IOException {
- if (inObjStm && object.canBeInObjStm() && writer.isFullCompression()) {
- PdfCrossReference pxref = addToObjStm(object, refNumber);
- PdfIndirectObject indirect = new PdfIndirectObject(refNumber, object, writer);
- if (!xrefs.add(pxref)) {
- xrefs.remove(pxref);
- xrefs.add(pxref);
- }
- return indirect;
- }
- else {
- PdfIndirectObject indirect = new PdfIndirectObject(refNumber, object, writer);
- PdfCrossReference pxref = new PdfCrossReference(refNumber, position);
- if (!xrefs.add(pxref)) {
- xrefs.remove(pxref);
- xrefs.add(pxref);
- }
- indirect.writeTo(writer.getOs());
- position = writer.getOs().getCounter();
- return indirect;
- }
- }
-
- /**
- * Adds a <CODE>PdfResources</CODE> object to the body.
- *
- * @param object the <CODE>PdfResources</CODE>
- * @return a <CODE>PdfIndirectObject</CODE>
- */
-
-// PdfIndirectObject add(PdfResources object) {
-// return add(object);
-// }
-
- /**
- * Adds a <CODE>PdfPages</CODE> object to the body.
- *
- * @param object the root of the document
- * @return a <CODE>PdfIndirectObject</CODE>
- */
-
-// PdfIndirectObject add(PdfPages object) throws IOException {
-// PdfIndirectObject indirect = new PdfIndirectObject(PdfWriter.ROOT, object, writer);
-// rootOffset = position;
-// indirect.writeTo(writer.getOs());
-// position = writer.getOs().getCounter();
-// return indirect;
-// }
-
- /**
- * Returns the offset of the Cross-Reference table.
- *
- * @return an offset
- */
-
- int offset() {
- return position;
- }
-
- /**
- * Returns the total number of objects contained in the CrossReferenceTable of this <CODE>Body</CODE>.
- *
- * @return a number of objects
- */
-
- int size() {
- return Math.max(((PdfCrossReference)xrefs.last()).getRefnum() + 1, refnum);
- }
-
- /**
- * Returns the CrossReferenceTable of the <CODE>Body</CODE>.
- * @param os
- * @param root
- * @param info
- * @param encryption
- * @param fileID
- * @param prevxref
- * @throws IOException
- */
-
- void writeCrossReferenceTable(OutputStream os, PdfIndirectReference root, PdfIndirectReference info, PdfIndirectReference encryption, PdfObject fileID, int prevxref) throws IOException {
- int refNumber = 0;
- if (writer.isFullCompression()) {
- flushObjStm();
- refNumber = getIndirectReferenceNumber();
- xrefs.add(new PdfCrossReference(refNumber, position));
- }
- PdfCrossReference entry = (PdfCrossReference)xrefs.first();
- int first = entry.getRefnum();
- int len = 0;
- ArrayList sections = new ArrayList();
- for (Iterator i = xrefs.iterator(); i.hasNext(); ) {
- entry = (PdfCrossReference)i.next();
- if (first + len == entry.getRefnum())
- ++len;
- else {
- sections.add(new Integer(first));
- sections.add(new Integer(len));
- first = entry.getRefnum();
- len = 1;
- }
- }
- sections.add(new Integer(first));
- sections.add(new Integer(len));
- if (writer.isFullCompression()) {
- int mid = 4;
- int mask = 0xff000000;
- for (; mid > 1; --mid) {
- if ((mask & position) != 0)
- break;
- mask >>>= 8;
- }
- ByteBuffer buf = new ByteBuffer();
-
- for (Iterator i = xrefs.iterator(); i.hasNext(); ) {
- entry = (PdfCrossReference) i.next();
- entry.toPdf(mid, buf);
- }
- PdfStream xr = new PdfStream(buf.toByteArray());
- buf = null;
- xr.flateCompress();
- xr.put(PdfName.SIZE, new PdfNumber(size()));
- xr.put(PdfName.ROOT, root);
- if (info != null) {
- xr.put(PdfName.INFO, info);
- }
- if (encryption != null)
- xr.put(PdfName.ENCRYPT, encryption);
- if (fileID != null)
- xr.put(PdfName.ID, fileID);
- xr.put(PdfName.W, new PdfArray(new int[]{1, mid, 2}));
- xr.put(PdfName.TYPE, PdfName.XREF);
- PdfArray idx = new PdfArray();
- for (int k = 0; k < sections.size(); ++k)
- idx.add(new PdfNumber(((Integer)sections.get(k)).intValue()));
- xr.put(PdfName.INDEX, idx);
- if (prevxref > 0)
- xr.put(PdfName.PREV, new PdfNumber(prevxref));
- PdfEncryption enc = writer.crypto;
- writer.crypto = null;
- PdfIndirectObject indirect = new PdfIndirectObject(refNumber, xr, writer);
- indirect.writeTo(writer.getOs());
- writer.crypto = enc;
- }
- else {
- os.write(getISOBytes("xref\n"));
- Iterator i = xrefs.iterator();
- for (int k = 0; k < sections.size(); k += 2) {
- first = ((Integer)sections.get(k)).intValue();
- len = ((Integer)sections.get(k + 1)).intValue();
- os.write(getISOBytes(String.valueOf(first)));
- os.write(getISOBytes(" "));
- os.write(getISOBytes(String.valueOf(len)));
- os.write('\n');
- while (len-- > 0) {
- entry = (PdfCrossReference) i.next();
- entry.toPdf(os);
- }
- }
- }
- }
- }
-
- /**
- * <CODE>PdfTrailer</CODE> is the PDF Trailer object.
- * <P>
- * This object is described in the 'Portable Document Format Reference Manual version 1.3'
- * section 5.16 (page 59-60).
- */
-
- static class PdfTrailer extends PdfDictionary {
-
- // membervariables
-
- int offset;
-
- // constructors
-
- /**
- * Constructs a PDF-Trailer.
- *
- * @param size the number of entries in the <CODE>PdfCrossReferenceTable</CODE>
- * @param offset offset of the <CODE>PdfCrossReferenceTable</CODE>
- * @param root an indirect reference to the root of the PDF document
- * @param info an indirect reference to the info object of the PDF document
- * @param encryption
- * @param fileID
- * @param prevxref
- */
-
- PdfTrailer(int size, int offset, PdfIndirectReference root, PdfIndirectReference info, PdfIndirectReference encryption, PdfObject fileID, int prevxref) {
- this.offset = offset;
- put(PdfName.SIZE, new PdfNumber(size));
- put(PdfName.ROOT, root);
- if (info != null) {
- put(PdfName.INFO, info);
- }
- if (encryption != null)
- put(PdfName.ENCRYPT, encryption);
- if (fileID != null)
- put(PdfName.ID, fileID);
- if (prevxref > 0)
- put(PdfName.PREV, new PdfNumber(prevxref));
- }
-
- /**
- * Returns the PDF representation of this <CODE>PdfObject</CODE>.
- * @param writer
- * @param os
- * @throws IOException
- */
- public void toPdf(PdfWriter writer, OutputStream os) throws IOException {
- os.write(getISOBytes("trailer\n"));
- super.toPdf(null, os);
- os.write(getISOBytes("\nstartxref\n"));
- os.write(getISOBytes(String.valueOf(offset)));
- os.write(getISOBytes("\n%%EOF\n"));
- }
- }
- // static membervariables
-
- /** A viewer preference */
- public static final int PageLayoutSinglePage = 1;
- /** A viewer preference */
- public static final int PageLayoutOneColumn = 2;
- /** A viewer preference */
- public static final int PageLayoutTwoColumnLeft = 4;
- /** A viewer preference */
- public static final int PageLayoutTwoColumnRight = 8;
-
- /** A viewer preference */
- public static final int PageModeUseNone = 16;
- /** A viewer preference */
- public static final int PageModeUseOutlines = 32;
- /** A viewer preference */
- public static final int PageModeUseThumbs = 64;
- /** A viewer preference */
- public static final int PageModeFullScreen = 128;
- /** A viewer preference */
- public static final int PageModeUseOC = 1 << 20;
-
- /** A viewer preference */
- public static final int HideToolbar = 256;
- /** A viewer preference */
- public static final int HideMenubar = 512;
- /** A viewer preference */
- public static final int HideWindowUI = 1024;
- /** A viewer preference */
- public static final int FitWindow = 2048;
- /** A viewer preference */
- public static final int CenterWindow = 4096;
-
- /** A viewer preference */
- public static final int NonFullScreenPageModeUseNone = 8192;
- /** A viewer preference */
- public static final int NonFullScreenPageModeUseOutlines = 16384;
- /** A viewer preference */
- public static final int NonFullScreenPageModeUseThumbs = 32768;
- /** A viewer preference */
- public static final int NonFullScreenPageModeUseOC = 1 << 19;
-
- /** A viewer preference */
- public static final int DirectionL2R = 1 << 16;
- /** A viewer preference */
- public static final int DirectionR2L = 1 << 17;
- /** A viewer preference */
- public static final int DisplayDocTitle = 1 << 18;
- /** A viewer preference */
- public static final int PrintScalingNone = 1 << 20;
- /** The mask to decide if a ViewerPreferences dictionary is needed */
- static final int ViewerPreferencesMask = 0xffff00;
- /** The operation permitted when the document is opened with the user password */
- public static final int AllowPrinting = 4 + 2048;
- /** The operation permitted when the document is opened with the user password */
- public static final int AllowModifyContents = 8;
- /** The operation permitted when the document is opened with the user password */
- public static final int AllowCopy = 16;
- /** The operation permitted when the document is opened with the user password */
- public static final int AllowModifyAnnotations = 32;
- /** The operation permitted when the document is opened with the user password */
- public static final int AllowFillIn = 256;
- /** The operation permitted when the document is opened with the user password */
- public static final int AllowScreenReaders = 512;
- /** The operation permitted when the document is opened with the user password */
- public static final int AllowAssembly = 1024;
- /** The operation permitted when the document is opened with the user password */
- public static final int AllowDegradedPrinting = 4;
- /** Type of encryption */
- public static final boolean STRENGTH40BITS = false;
- /** Type of encryption */
- public static final boolean STRENGTH128BITS = true;
- /** action value */
- public static final PdfName DOCUMENT_CLOSE = PdfName.WC;
- /** action value */
- public static final PdfName WILL_SAVE = PdfName.WS;
- /** action value */
- public static final PdfName DID_SAVE = PdfName.DS;
- /** action value */
- public static final PdfName WILL_PRINT = PdfName.WP;
- /** action value */
- public static final PdfName DID_PRINT = PdfName.DP;
- /** action value */
- public static final PdfName PAGE_OPEN = PdfName.O;
- /** action value */
- public static final PdfName PAGE_CLOSE = PdfName.C;
-
- /** signature value */
- public static final int SIGNATURE_EXISTS = 1;
- /** signature value */
- public static final int SIGNATURE_APPEND_ONLY = 2;
-
- /** possible PDF version */
- public static final char VERSION_1_2 = '2';
- /** possible PDF version */
- public static final char VERSION_1_3 = '3';
- /** possible PDF version */
- public static final char VERSION_1_4 = '4';
- /** possible PDF version */
- public static final char VERSION_1_5 = '5';
- /** possible PDF version */
- public static final char VERSION_1_6 = '6';
-
- private static final int VPOINT = 7;
- /** this is the header of a PDF document */
- protected byte[] HEADER = getISOBytes("%PDF-1.4\n%\u00e2\u00e3\u00cf\u00d3\n");
-
- protected int prevxref = 0;
-
- protected PdfPages root = new PdfPages(this);
-
- /** Dictionary, containing all the images of the PDF document */
- protected PdfDictionary imageDictionary = new PdfDictionary();
-
- /** This is the list with all the images in the document. */
- private HashMap images = new HashMap();
-
- /** The form XObjects in this document. The key is the xref and the value
- is Object[]{PdfName, template}.*/
- protected HashMap formXObjects = new HashMap();
-
- /** The name counter for the form XObjects name. */
- protected int formXObjectsCounter = 1;
-
- /** The font number counter for the fonts in the document. */
- protected int fontNumber = 1;
-
- /** The color number counter for the colors in the document. */
- protected int colorNumber = 1;
-
- /** The patten number counter for the colors in the document. */
- protected int patternNumber = 1;
-
- /** The direct content in this document. */
- protected PdfContentByte directContent;
-
- /** The direct content under in this document. */
- protected PdfContentByte directContentUnder;
-
- /** The fonts of this document */
- protected HashMap documentFonts = new HashMap();
-
- /** The colors of this document */
- protected HashMap documentColors = new HashMap();
-
- /** The patterns of this document */
- protected HashMap documentPatterns = new HashMap();
-
- protected HashMap documentShadings = new HashMap();
-
- protected HashMap documentShadingPatterns = new HashMap();
-
- protected ColorDetails patternColorspaceRGB;
- protected ColorDetails patternColorspaceGRAY;
- protected ColorDetails patternColorspaceCMYK;
- protected HashMap documentSpotPatterns = new HashMap();
-
- protected HashMap documentExtGState = new HashMap();
-
- protected HashMap documentLayers = new HashMap();
- protected HashSet documentOCG = new HashSet();
- protected ArrayList documentOCGorder = new ArrayList();
- protected PdfOCProperties OCProperties;
- protected PdfArray OCGRadioGroup = new PdfArray();
-
- protected PdfDictionary defaultColorspace = new PdfDictionary();
-
- /** PDF/X value */
- public static final int PDFXNONE = 0;
- /** PDF/X value */
- public static final int PDFX1A2001 = 1;
- /** PDF/X value */
- public static final int PDFX32002 = 2;
-
- private int pdfxConformance = PDFXNONE;
-
- static final int PDFXKEY_COLOR = 1;
- static final int PDFXKEY_CMYK = 2;
- static final int PDFXKEY_RGB = 3;
- static final int PDFXKEY_FONT = 4;
- static final int PDFXKEY_IMAGE = 5;
- static final int PDFXKEY_GSTATE = 6;
- static final int PDFXKEY_LAYER = 7;
-
- // membervariables
-
- /** body of the PDF document */
- protected PdfBody body;
-
- /** the pdfdocument object. */
- protected PdfDocument pdf;
-
- /** The <CODE>PdfPageEvent</CODE> for this document. */
- private PdfPageEvent pageEvent;
-
- protected PdfEncryption crypto;
-
- protected HashMap importedPages = new HashMap();
-
- protected PdfReaderInstance currentPdfReaderInstance;
-
- /** The PdfIndirectReference to the pages. */
- protected ArrayList pageReferences = new ArrayList();
-
- protected int currentPageNumber = 1;
-
- protected PdfDictionary group;
-
- /** The default space-char ratio. */
- public static final float SPACE_CHAR_RATIO_DEFAULT = 2.5f;
- /** Disable the inter-character spacing. */
- public static final float NO_SPACE_CHAR_RATIO = 10000000f;
-
- /** Use the default run direction. */
- public static final int RUN_DIRECTION_DEFAULT = 0;
- /** Do not use bidirectional reordering. */
- public static final int RUN_DIRECTION_NO_BIDI = 1;
- /** Use bidirectional reordering with left-to-right
- * preferential run direction.
- */
- public static final int RUN_DIRECTION_LTR = 2;
- /** Use bidirectional reordering with right-to-left
- * preferential run direction.
- */
- public static final int RUN_DIRECTION_RTL = 3;
- protected int runDirection = RUN_DIRECTION_NO_BIDI;
- /**
- * The ratio between the extra word spacing and the extra character spacing.
- * Extra word spacing will grow <CODE>ratio</CODE> times more than extra character spacing.
- */
- private float spaceCharRatio = SPACE_CHAR_RATIO_DEFAULT;
-
- /** Holds value of property extraCatalog. */
- private PdfDictionary extraCatalog;
-
- /**
- * Holds value of property fullCompression.
- */
- protected boolean fullCompression = false;
-
- // constructor
-
- protected PdfWriter() {
- }
-
- /**
- * Constructs a <CODE>PdfWriter</CODE>.
- * <P>
- * Remark: a PdfWriter can only be constructed by calling the method
- * <CODE>getInstance(Document document, OutputStream os)</CODE>.
- *
- * @param document The <CODE>PdfDocument</CODE> that has to be written
- * @param os The <CODE>OutputStream</CODE> the writer has to write to.
- */
-
- protected PdfWriter(PdfDocument document, OutputStream os) {
- super(document, os);
- pdf = document;
- directContent = new PdfContentByte(this);
- directContentUnder = new PdfContentByte(this);
- }
-
- // get an instance of the PdfWriter
-
- /**
- * Gets an instance of the <CODE>PdfWriter</CODE>.
- *
- * @param document The <CODE>Document</CODE> that has to be written
- * @param os The <CODE>OutputStream</CODE> the writer has to write to.
- * @return a new <CODE>PdfWriter</CODE>
- *
- * @throws DocumentException on error
- */
-
- public static PdfWriter getInstance(Document document, OutputStream os)
- throws DocumentException {
- PdfDocument pdf = new PdfDocument();
- document.addDocListener(pdf);
- PdfWriter writer = new PdfWriter(pdf, os);
- pdf.addWriter(writer);
- return writer;
- }
-
- /** Gets an instance of the <CODE>PdfWriter</CODE>.
- *
- * @return a new <CODE>PdfWriter</CODE>
- * @param document The <CODE>Document</CODE> that has to be written
- * @param os The <CODE>OutputStream</CODE> the writer has to write to.
- * @param listener A <CODE>DocListener</CODE> to pass to the PdfDocument.
- * @throws DocumentException on error
- */
-
- public static PdfWriter getInstance(Document document, OutputStream os, DocListener listener)
- throws DocumentException {
- PdfDocument pdf = new PdfDocument();
- pdf.addDocListener(listener);
- document.addDocListener(pdf);
- PdfWriter writer = new PdfWriter(pdf, os);
- pdf.addWriter(writer);
- return writer;
- }
-
- // methods to write objects to the outputstream
-
- /**
- * Adds some <CODE>PdfContents</CODE> to this Writer.
- * <P>
- * The document has to be open before you can begin to add content
- * to the body of the document.
- *
- * @return a <CODE>PdfIndirectReference</CODE>
- * @param page the <CODE>PdfPage</CODE> to add
- * @param contents the <CODE>PdfContents</CODE> of the page
- * @throws PdfException on error
- */
-
- PdfIndirectReference add(PdfPage page, PdfContents contents) throws PdfException {
- if (!open) {
- throw new PdfException("The document isn't open.");
- }
- PdfIndirectObject object;
- try {
- object = addToBody(contents);
- }
- catch(IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- page.add(object.getIndirectReference());
- if (group != null) {
- page.put(PdfName.GROUP, group);
- group = null;
- }
- root.addPage(page);
- currentPageNumber++;
- return null;
- }
-
- /** Adds an image to the document but not to the page resources. It is used with
- * templates and <CODE>Document.add(Image)</CODE>.
- * @param image the <CODE>Image</CODE> to add
- * @return the name of the image added
- * @throws PdfException on error
- * @throws DocumentException on error
- */
- PdfName addDirectImageSimple(Image image) throws PdfException, DocumentException {
- PdfName name;
- // if the images is already added, just retrieve the name
- if (images.containsKey(image.getMySerialId())) {
- name = (PdfName) images.get(image.getMySerialId());
- }
- // if it's a new image, add it to the document
- else {
- if (image.isImgTemplate()) {
- name = new PdfName("img" + images.size());
- if (image.templateData() == null) {
- if(image instanceof ImgWMF){
- try {
- ImgWMF wmf = (ImgWMF)image;
- wmf.readWMF(getDirectContent().createTemplate(0, 0));
- }
- catch (Exception e) {
- throw new DocumentException(e);
- }
- }else{
- try {
- ((ImgPostscript)image).readPostscript(getDirectContent().createTemplate(0, 0));
- }
- catch (Exception e) {
- throw new DocumentException(e);
- }
-
- }
- }
- }
- else {
- Image maskImage = image.getImageMask();
- PdfIndirectReference maskRef = null;
- if (maskImage != null) {
- PdfName mname = (PdfName)images.get(maskImage.getMySerialId());
- maskRef = getImageReference(mname);
- }
- PdfImage i = new PdfImage(image, "img" + images.size(), maskRef);
- if (image.hasICCProfile()) {
- PdfICCBased icc = new PdfICCBased(image.getICCProfile());
- PdfIndirectReference iccRef = add(icc);
- PdfArray iccArray = new PdfArray();
- iccArray.add(PdfName.ICCBASED);
- iccArray.add(iccRef);
- PdfObject colorspace = i.get(PdfName.COLORSPACE);
- if (colorspace != null && colorspace.isArray()) {
- ArrayList ar = ((PdfArray)colorspace).getArrayList();
- if (ar.size() > 1 && PdfName.INDEXED.equals(ar.get(0)))
- ar.set(1, iccArray);
- else
- i.put(PdfName.COLORSPACE, iccArray);
- }
- else
- i.put(PdfName.COLORSPACE, iccArray);
- }
- add(i);
- name = i.name();
- }
- images.put(image.getMySerialId(), name);
- }
- return name;
- }
-
- /**
- * Writes a <CODE>PdfImage</CODE> to the outputstream.
- *
- * @param pdfImage the image to be added
- * @return a <CODE>PdfIndirectReference</CODE> to the encapsulated image
- * @throws PdfException when a document isn't open yet, or has been closed
- */
-
- PdfIndirectReference add(PdfImage pdfImage) throws PdfException {
- if (! imageDictionary.contains(pdfImage.name())) {
- checkPDFXConformance(this, PDFXKEY_IMAGE, pdfImage);
- PdfIndirectObject object;
- try {
- object = addToBody(pdfImage);
- }
- catch(IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- imageDictionary.put(pdfImage.name(), object.getIndirectReference());
- return object.getIndirectReference();
- }
- return (PdfIndirectReference) imageDictionary.get(pdfImage.name());
- }
-
- protected PdfIndirectReference add(PdfICCBased icc) throws PdfException {
- PdfIndirectObject object;
- try {
- object = addToBody(icc);
- }
- catch(IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- return object.getIndirectReference();
- }
-
- /**
- * return the <CODE>PdfIndirectReference</CODE> to the image with a given name.
- *
- * @param name the name of the image
- * @return a <CODE>PdfIndirectReference</CODE>
- */
-
- PdfIndirectReference getImageReference(PdfName name) {
- return (PdfIndirectReference) imageDictionary.get(name);
- }
-
- // methods to open and close the writer
-
- /**
- * Signals that the <CODE>Document</CODE> has been opened and that
- * <CODE>Elements</CODE> can be added.
- * <P>
- * When this method is called, the PDF-document header is
- * written to the outputstream.
- */
-
- public void open() {
- super.open();
- try {
- os.write(HEADER);
- body = new PdfBody(this);
- if (pdfxConformance == PDFX32002) {
- PdfDictionary sec = new PdfDictionary();
- sec.put(PdfName.GAMMA, new PdfArray(new float[]{2.2f,2.2f,2.2f}));
- sec.put(PdfName.MATRIX, new PdfArray(new float[]{0.4124f,0.2126f,0.0193f,0.3576f,0.7152f,0.1192f,0.1805f,0.0722f,0.9505f}));
- sec.put(PdfName.WHITEPOINT, new PdfArray(new float[]{0.9505f,1f,1.089f}));
- PdfArray arr = new PdfArray(PdfName.CALRGB);
- arr.add(sec);
- setDefaultColorspace(PdfName.DEFAULTRGB, addToBody(arr).getIndirectReference());
- }
- }
- catch(IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- }
-
- private static void getOCGOrder(PdfArray order, PdfLayer layer) {
- if (!layer.isOnPanel())
- return;
- if (layer.getTitle() == null)
- order.add(layer.getRef());
- ArrayList children = layer.getChildren();
- if (children == null)
- return;
- PdfArray kids = new PdfArray();
- if (layer.getTitle() != null)
- kids.add(new PdfString(layer.getTitle(), PdfObject.TEXT_UNICODE));
- for (int k = 0; k < children.size(); ++k) {
- getOCGOrder(kids, (PdfLayer)children.get(k));
- }
- if (kids.size() > 0)
- order.add(kids);
- }
-
- private void addASEvent(PdfName event, PdfName category) {
- PdfArray arr = new PdfArray();
- for (Iterator it = documentOCG.iterator(); it.hasNext();) {
- PdfLayer layer = (PdfLayer)it.next();
- PdfDictionary usage = (PdfDictionary)layer.get(PdfName.USAGE);
- if (usage != null && usage.get(category) != null)
- arr.add(layer.getRef());
- }
- if (arr.size() == 0)
- return;
- PdfDictionary d = (PdfDictionary)OCProperties.get(PdfName.D);
- PdfArray arras = (PdfArray)d.get(PdfName.AS);
- if (arras == null) {
- arras = new PdfArray();
- d.put(PdfName.AS, arras);
- }
- PdfDictionary as = new PdfDictionary();
- as.put(PdfName.EVENT, event);
- as.put(PdfName.CATEGORY, new PdfArray(category));
- as.put(PdfName.OCGS, arr);
- arras.add(as);
- }
-
- private void fillOCProperties(boolean erase) {
- if (OCProperties == null)
- OCProperties = new PdfOCProperties();
- if (erase) {
- OCProperties.remove(PdfName.OCGS);
- OCProperties.remove(PdfName.D);
- }
- if (OCProperties.get(PdfName.OCGS) == null) {
- PdfArray gr = new PdfArray();
- for (Iterator it = documentOCG.iterator(); it.hasNext();) {
- PdfLayer layer = (PdfLayer)it.next();
- gr.add(layer.getRef());
- }
- OCProperties.put(PdfName.OCGS, gr);
- }
- if (OCProperties.get(PdfName.D) != null)
- return;
- ArrayList docOrder = new ArrayList(documentOCGorder);
- for (Iterator it = docOrder.iterator(); it.hasNext();) {
- PdfLayer layer = (PdfLayer)it.next();
- if (layer.getParent() != null)
- it.remove();
- }
- PdfArray order = new PdfArray();
- for (Iterator it = docOrder.iterator(); it.hasNext();) {
- PdfLayer layer = (PdfLayer)it.next();
- getOCGOrder(order, layer);
- }
- PdfDictionary d = new PdfDictionary();
- OCProperties.put(PdfName.D, d);
- d.put(PdfName.ORDER, order);
- PdfArray gr = new PdfArray();
- for (Iterator it = documentOCG.iterator(); it.hasNext();) {
- PdfLayer layer = (PdfLayer)it.next();
- if (!layer.isOn())
- gr.add(layer.getRef());
- }
- if (gr.size() > 0)
- d.put(PdfName.OFF, gr);
- if (OCGRadioGroup.size() > 0)
- d.put(PdfName.RBGROUPS, OCGRadioGroup);
- addASEvent(PdfName.VIEW, PdfName.ZOOM);
- addASEvent(PdfName.VIEW, PdfName.VIEW);
- addASEvent(PdfName.PRINT, PdfName.PRINT);
- addASEvent(PdfName.EXPORT, PdfName.EXPORT);
- d.put(PdfName.LISTMODE, PdfName.VISIBLEPAGES);
- }
-
- protected PdfDictionary getCatalog(PdfIndirectReference rootObj)
- {
- PdfDictionary catalog = ((PdfDocument)document).getCatalog(rootObj);
- if (documentOCG.size() == 0)
- return catalog;
- fillOCProperties(false);
- catalog.put(PdfName.OCPROPERTIES, OCProperties);
- return catalog;
- }
-
- protected void addSharedObjectsToBody() throws IOException {
- // add the fonts
- for (Iterator it = documentFonts.values().iterator(); it.hasNext();) {
- FontDetails details = (FontDetails)it.next();
- details.writeFont(this);
- }
- // add the form XObjects
- for (Iterator it = formXObjects.values().iterator(); it.hasNext();) {
- Object objs[] = (Object[])it.next();
- PdfTemplate template = (PdfTemplate)objs[1];
- if (template != null && template.getIndirectReference() instanceof PRIndirectReference)
- continue;
- if (template != null && template.getType() == PdfTemplate.TYPE_TEMPLATE) {
- PdfIndirectObject obj = addToBody(template.getFormXObject(), template.getIndirectReference());
- }
- }
- // add all the dependencies in the imported pages
- for (Iterator it = importedPages.values().iterator(); it.hasNext();) {
- currentPdfReaderInstance = (PdfReaderInstance)it.next();
- currentPdfReaderInstance.writeAllPages();
- }
- currentPdfReaderInstance = null;
- // add the color
- for (Iterator it = documentColors.values().iterator(); it.hasNext();) {
- ColorDetails color = (ColorDetails)it.next();
- PdfIndirectObject cobj = addToBody(color.getSpotColor(this), color.getIndirectReference());
- }
- // add the pattern
- for (Iterator it = documentPatterns.keySet().iterator(); it.hasNext();) {
- PdfPatternPainter pat = (PdfPatternPainter)it.next();
- PdfIndirectObject pobj = addToBody(pat.getPattern(), pat.getIndirectReference());
- }
- // add the shading patterns
- for (Iterator it = documentShadingPatterns.keySet().iterator(); it.hasNext();) {
- PdfShadingPattern shadingPattern = (PdfShadingPattern)it.next();
- shadingPattern.addToBody();
- }
- // add the shadings
- for (Iterator it = documentShadings.keySet().iterator(); it.hasNext();) {
- PdfShading shading = (PdfShading)it.next();
- shading.addToBody();
- }
- // add the extgstate
- for (Iterator it = documentExtGState.keySet().iterator(); it.hasNext();) {
- PdfDictionary gstate = (PdfDictionary)it.next();
- PdfObject obj[] = (PdfObject[])documentExtGState.get(gstate);
- addToBody(gstate, (PdfIndirectReference)obj[1]);
- }
- // add the layers
- for (Iterator it = documentLayers.keySet().iterator(); it.hasNext();) {
- PdfOCG layer = (PdfOCG)it.next();
- if (layer instanceof PdfLayerMembership)
- addToBody(layer.getPdfObject(), layer.getRef());
- }
- for (Iterator it = documentOCG.iterator(); it.hasNext();) {
- PdfOCG layer = (PdfOCG)it.next();
- addToBody(layer.getPdfObject(), layer.getRef());
- }
- }
-
- /**
- * Signals that the <CODE>Document</CODE> was closed and that no other
- * <CODE>Elements</CODE> will be added.
- * <P>
- * The pages-tree is built and written to the outputstream.
- * A Catalog is constructed, as well as an Info-object,
- * the referencetable is composed and everything is written
- * to the outputstream embedded in a Trailer.
- */
-
- public synchronized void close() {
- if (open) {
- if ((currentPageNumber - 1) != pageReferences.size())
- throw new RuntimeException("The page " + pageReferences.size() +
- " was requested but the document has only " + (currentPageNumber - 1) + " pages.");
- pdf.close();
- try {
- addSharedObjectsToBody();
- // add the root to the body
- PdfIndirectReference rootRef = root.writePageTree();
- // make the catalog-object and add it to the body
- PdfDictionary catalog = getCatalog(rootRef);
- // make pdfx conformant
- PdfDictionary info = getInfo();
- if (pdfxConformance != PDFXNONE) {
- if (info.get(PdfName.GTS_PDFXVERSION) == null) {
- if (pdfxConformance == PDFX1A2001) {
- info.put(PdfName.GTS_PDFXVERSION, new PdfString("PDF/X-1:2001"));
- info.put(new PdfName("GTS_PDFXConformance"), new PdfString("PDF/X-1a:2001"));
- }
- else if (pdfxConformance == PDFX32002)
- info.put(PdfName.GTS_PDFXVERSION, new PdfString("PDF/X-3:2002"));
- }
- if (info.get(PdfName.TITLE) == null) {
- info.put(PdfName.TITLE, new PdfString("Pdf document"));
- }
- if (info.get(PdfName.CREATOR) == null) {
- info.put(PdfName.CREATOR, new PdfString("Unknown"));
- }
- if (info.get(PdfName.TRAPPED) == null) {
- info.put(PdfName.TRAPPED, new PdfName("False"));
- }
- getExtraCatalog();
- if (extraCatalog.get(PdfName.OUTPUTINTENTS) == null) {
- PdfDictionary out = new PdfDictionary(PdfName.OUTPUTINTENT);
- out.put(PdfName.OUTPUTCONDITION, new PdfString("SWOP CGATS TR 001-1995"));
- out.put(PdfName.OUTPUTCONDITIONIDENTIFIER, new PdfString("CGATS TR 001"));
- out.put(PdfName.REGISTRYNAME, new PdfString("http://www.color.org"));
- out.put(PdfName.INFO, new PdfString(""));
- out.put(PdfName.S, PdfName.GTS_PDFX);
- extraCatalog.put(PdfName.OUTPUTINTENTS, new PdfArray(out));
- }
- }
- if (extraCatalog != null) {
- catalog.mergeDifferent(extraCatalog);
- }
- PdfIndirectObject indirectCatalog = addToBody(catalog, false);
- // add the info-object to the body
- PdfIndirectObject infoObj = addToBody(info, false);
- PdfIndirectReference encryption = null;
- PdfObject fileID = null;
- body.flushObjStm();
- if (crypto != null) {
- PdfIndirectObject encryptionObject = addToBody(crypto.getEncryptionDictionary(), false);
- encryption = encryptionObject.getIndirectReference();
- fileID = crypto.getFileID();
- }
- else
- fileID = PdfEncryption.createInfoId(PdfEncryption.createDocumentId());
-
- // write the cross-reference table of the body
- body.writeCrossReferenceTable(os, indirectCatalog.getIndirectReference(),
- infoObj.getIndirectReference(), encryption, fileID, prevxref);
-
- // make the trailer
- if (fullCompression) {
- os.write(getISOBytes("startxref\n"));
- os.write(getISOBytes(String.valueOf(body.offset())));
- os.write(getISOBytes("\n%%EOF\n"));
- }
- else {
- PdfTrailer trailer = new PdfTrailer(body.size(),
- body.offset(),
- indirectCatalog.getIndirectReference(),
- infoObj.getIndirectReference(),
- encryption,
- fileID, prevxref);
- trailer.toPdf(this, os);
- }
- super.close();
- }
- catch(IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
- }
- }
-
- // methods
-
- /**
- * Sometimes it is necessary to know where the just added <CODE>Table</CODE> ends.
- *
- * For instance to avoid to add another table in a page that is ending up, because
- * the new table will be probably splitted just after the header (it is an
- * unpleasant effect, isn't it?).
- *
- * Added on September 8th, 2001
- * by Francesco De Milato
- * francesco.demilato at tiscalinet.it
- * @param table the <CODE>Table</CODE>
- * @return the bottom height of the just added table
- */
-
- public float getTableBottom(Table table) {
- return pdf.bottom(table) - pdf.indentBottom();
- }
-
- /**
- * Gets a pre-rendered table.
- * (Contributed by dperezcar at fcc.es)
- * @param table Contains the table definition. Its contents are deleted, after being pre-rendered.
- * @return a PdfTable
- */
-
- public PdfTable getPdfTable(Table table) {
- return pdf.getPdfTable(table, true);
- }
-
- /**
- * Row additions to the original {@link Table} used to build the {@link PdfTable} are processed and pre-rendered,
- * and then the contents are deleted.
- * If the pre-rendered table doesn't fit, then it is fully rendered and its data discarded.
- * There shouldn't be any column change in the underlying {@link Table} object.
- * (Contributed by dperezcar at fcc.es)
- *
- * @param table The pre-rendered table obtained from {@link #getPdfTable(Table)}
- * @return true if the table is rendered and emptied.
- * @throws DocumentException
- * @see #getPdfTable(Table)
- */
-
- public boolean breakTableIfDoesntFit(PdfTable table) throws DocumentException {
- return pdf.breakTableIfDoesntFit(table);
- }
-
- /**
- * Checks if a <CODE>Table</CODE> fits the current page of the <CODE>PdfDocument</CODE>.
- *
- * @param table the table that has to be checked
- * @param margin a certain margin
- * @return <CODE>true</CODE> if the <CODE>Table</CODE> fits the page, <CODE>false</CODE> otherwise.
- */
-
- public boolean fitsPage(Table table, float margin) {
- return pdf.bottom(table) > pdf.indentBottom() + margin;
- }
-
- /**
- * Checks if a <CODE>Table</CODE> fits the current page of the <CODE>PdfDocument</CODE>.
- *
- * @param table the table that has to be checked
- * @return <CODE>true</CODE> if the <CODE>Table</CODE> fits the page, <CODE>false</CODE> otherwise.
- */
-
- public boolean fitsPage(Table table) {
- return fitsPage(table, 0);
- }
-
- /**
- * Checks if a <CODE>PdfPTable</CODE> fits the current page of the <CODE>PdfDocument</CODE>.
- *
- * @param table the table that has to be checked
- * @param margin a certain margin
- * @return <CODE>true</CODE> if the <CODE>PdfPTable</CODE> fits the page, <CODE>false</CODE> otherwise.
- */
- public boolean fitsPage(PdfPTable table, float margin) {
- return pdf.fitsPage(table, margin);
- }
-
- /**
- * Checks if a <CODE>PdfPTable</CODE> fits the current page of the <CODE>PdfDocument</CODE>.
- *
- * @param table the table that has to be checked
- * @return <CODE>true</CODE> if the <CODE>PdfPTable</CODE> fits the page, <CODE>false</CODE> otherwise.
- */
- public boolean fitsPage(PdfPTable table) {
- return pdf.fitsPage(table, 0);
- }
-
- /**
- * Gets the current vertical page position.
- * @param ensureNewLine Tells whether a new line shall be enforced. This may cause side effects
- * for elements that do not terminate the lines they've started because those lines will get
- * terminated.
- * @return The current vertical page position.
- */
- public float getVerticalPosition(boolean ensureNewLine) {
- return pdf.getVerticalPosition(ensureNewLine);
- }
-
- /**
- * Checks if writing is paused.
- *
- * @return <CODE>true</CODE> if writing temporarely has to be paused, <CODE>false</CODE> otherwise.
- */
-
- boolean isPaused() {
- return pause;
- }
-
- /**
- * Gets the direct content for this document. There is only one direct content,
- * multiple calls to this method will allways retrieve the same.
- * @return the direct content
- */
-
- public PdfContentByte getDirectContent() {
- if (!open)
- throw new RuntimeException("The document is not open.");
- return directContent;
- }
-
- /**
- * Gets the direct content under for this document. There is only one direct content,
- * multiple calls to this method will allways retrieve the same.
- * @return the direct content
- */
-
- public PdfContentByte getDirectContentUnder() {
- if (!open)
- throw new RuntimeException("The document is not open.");
- return directContentUnder;
- }
-
- /**
- * Resets all the direct contents to empty. This happens when a new page is started.
- */
-
- void resetContent() {
- directContent.reset();
- directContentUnder.reset();
- }
-
- /** Gets the AcroForm object.
- * @return the <CODE>PdfAcroForm</CODE>
- */
-
- public PdfAcroForm getAcroForm() {
- return pdf.getAcroForm();
- }
-
- /** Gets the root outline.
- * @return the root outline
- */
-
- public PdfOutline getRootOutline() {
- return directContent.getRootOutline();
- }
-
- /**
- * Returns the outputStreamCounter.
- * @return the outputStreamCounter
- */
- public OutputStreamCounter getOs() {
- return os;
- }
-
- /**
- * Adds a <CODE>BaseFont</CODE> to the document but not to the page resources.
- * It is used for templates.
- * @param bf the <CODE>BaseFont</CODE> to add
- * @return an <CODE>Object[]</CODE> where position 0 is a <CODE>PdfName</CODE>
- * and position 1 is an <CODE>PdfIndirectReference</CODE>
- */
-
- FontDetails addSimple(BaseFont bf) {
- if (bf.getFontType() == BaseFont.FONT_TYPE_DOCUMENT) {
- return new FontDetails(new PdfName("F" + (fontNumber++)), ((DocumentFont)bf).getIndirectReference(), bf);
- }
- FontDetails ret = (FontDetails)documentFonts.get(bf);
- if (ret == null) {
- checkPDFXConformance(this, PDFXKEY_FONT, bf);
- ret = new FontDetails(new PdfName("F" + (fontNumber++)), body.getPdfIndirectReference(), bf);
- documentFonts.put(bf, ret);
- }
- return ret;
- }
-
- void eliminateFontSubset(PdfDictionary fonts) {
- for (Iterator it = documentFonts.values().iterator(); it.hasNext();) {
- FontDetails ft = (FontDetails)it.next();
- if (fonts.get(ft.getFontName()) != null)
- ft.setSubset(false);
- }
- }
-
- /**
- * Adds a <CODE>SpotColor</CODE> to the document but not to the page resources.
- * @param spc the <CODE>SpotColor</CODE> to add
- * @return an <CODE>Object[]</CODE> where position 0 is a <CODE>PdfName</CODE>
- * and position 1 is an <CODE>PdfIndirectReference</CODE>
- */
-
- ColorDetails addSimple(PdfSpotColor spc) {
- ColorDetails ret = (ColorDetails)documentColors.get(spc);
- if (ret == null) {
- ret = new ColorDetails(new PdfName("CS" + (colorNumber++)), body.getPdfIndirectReference(), spc);
- documentColors.put(spc, ret);
- }
- return ret;
- }
-
- ColorDetails addSimplePatternColorspace(Color color) {
- int type = ExtendedColor.getType(color);
- if (type == ExtendedColor.TYPE_PATTERN || type == ExtendedColor.TYPE_SHADING)
- throw new RuntimeException("An uncolored tile pattern can not have another pattern or shading as color.");
- try {
- switch (type) {
- case ExtendedColor.TYPE_RGB:
- if (patternColorspaceRGB == null) {
- patternColorspaceRGB = new ColorDetails(new PdfName("CS" + (colorNumber++)), body.getPdfIndirectReference(), null);
- PdfArray array = new PdfArray(PdfName.PATTERN);
- array.add(PdfName.DEVICERGB);
- PdfIndirectObject cobj = addToBody(array, patternColorspaceRGB.getIndirectReference());
- }
- return patternColorspaceRGB;
- case ExtendedColor.TYPE_CMYK:
- if (patternColorspaceCMYK == null) {
- patternColorspaceCMYK = new ColorDetails(new PdfName("CS" + (colorNumber++)), body.getPdfIndirectReference(), null);
- PdfArray array = new PdfArray(PdfName.PATTERN);
- array.add(PdfName.DEVICECMYK);
- PdfIndirectObject cobj = addToBody(array, patternColorspaceCMYK.getIndirectReference());
- }
- return patternColorspaceCMYK;
- case ExtendedColor.TYPE_GRAY:
- if (patternColorspaceGRAY == null) {
- patternColorspaceGRAY = new ColorDetails(new PdfName("CS" + (colorNumber++)), body.getPdfIndirectReference(), null);
- PdfArray array = new PdfArray(PdfName.PATTERN);
- array.add(PdfName.DEVICEGRAY);
- PdfIndirectObject cobj = addToBody(array, patternColorspaceGRAY.getIndirectReference());
- }
- return patternColorspaceGRAY;
- case ExtendedColor.TYPE_SEPARATION: {
- ColorDetails details = addSimple(((SpotColor)color).getPdfSpotColor());
- ColorDetails patternDetails = (ColorDetails)documentSpotPatterns.get(details);
- if (patternDetails == null) {
- patternDetails = new ColorDetails(new PdfName("CS" + (colorNumber++)), body.getPdfIndirectReference(), null);
- PdfArray array = new PdfArray(PdfName.PATTERN);
- array.add(details.getIndirectReference());
- PdfIndirectObject cobj = addToBody(array, patternDetails.getIndirectReference());
- documentSpotPatterns.put(details, patternDetails);
- }
- return patternDetails;
- }
- default:
- throw new RuntimeException("Invalid color type in PdfWriter.addSimplePatternColorspace().");
- }
- }
- catch (Exception e) {
- throw new RuntimeException(e.getMessage());
- }
- }
-
- void addSimpleShadingPattern(PdfShadingPattern shading) {
- if (!documentShadingPatterns.containsKey(shading)) {
- shading.setName(patternNumber);
- ++patternNumber;
- documentShadingPatterns.put(shading, null);
- addSimpleShading(shading.getShading());
- }
- }
-
- void addSimpleShading(PdfShading shading) {
- if (!documentShadings.containsKey(shading)) {
- documentShadings.put(shading, null);
- shading.setName(documentShadings.size());
- }
- }
-
- PdfObject[] addSimpleExtGState(PdfDictionary gstate) {
- if (!documentExtGState.containsKey(gstate)) {
- checkPDFXConformance(this, PDFXKEY_GSTATE, gstate);
- documentExtGState.put(gstate, new PdfObject[]{new PdfName("GS" + (documentExtGState.size() + 1)), getPdfIndirectReference()});
- }
- return (PdfObject[])documentExtGState.get(gstate);
- }
-
- void registerLayer(PdfOCG layer) {
- checkPDFXConformance(this, PDFXKEY_LAYER, null);
- if (layer instanceof PdfLayer) {
- PdfLayer la = (PdfLayer)layer;
- if (la.getTitle() == null) {
- if (!documentOCG.contains(layer)) {
- documentOCG.add(layer);
- documentOCGorder.add(layer);
- }
- }
- else {
- documentOCGorder.add(layer);
- }
- }
- else
- throw new IllegalArgumentException("Only PdfLayer is accepted.");
- }
-
- PdfName addSimpleLayer(PdfOCG layer) {
- if (!documentLayers.containsKey(layer)) {
- checkPDFXConformance(this, PDFXKEY_LAYER, null);
- documentLayers.put(layer, new PdfName("OC" + (documentLayers.size() + 1)));
- }
- return (PdfName)documentLayers.get(layer);
- }
-
- /**
- * Gets the <CODE>PdfDocument</CODE> associated with this writer.
- * @return the <CODE>PdfDocument</CODE>
- */
-
- PdfDocument getPdfDocument() {
- return pdf;
- }
-
- /**
- * Gets a <CODE>PdfIndirectReference</CODE> for an object that
- * will be created in the future.
- * @return the <CODE>PdfIndirectReference</CODE>
- */
-
- public PdfIndirectReference getPdfIndirectReference() {
- return body.getPdfIndirectReference();
- }
-
- int getIndirectReferenceNumber() {
- return body.getIndirectReferenceNumber();
- }
-
- PdfName addSimplePattern(PdfPatternPainter painter) {
- PdfName name = (PdfName)documentPatterns.get(painter);
- try {
- if ( name == null ) {
- name = new PdfName("P" + patternNumber);
- ++patternNumber;
- documentPatterns.put(painter, name);
- }
- } catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- return name;
- }
-
- /**
- * Adds a template to the document but not to the page resources.
- * @param template the template to add
- * @param forcedName the template name, rather than a generated one. Can be null
- * @return the <CODE>PdfName</CODE> for this template
- */
-
- PdfName addDirectTemplateSimple(PdfTemplate template, PdfName forcedName) {
- PdfIndirectReference ref = template.getIndirectReference();
- Object obj[] = (Object[])formXObjects.get(ref);
- PdfName name = null;
- try {
- if (obj == null) {
- if (forcedName == null) {
- name = new PdfName("Xf" + formXObjectsCounter);
- ++formXObjectsCounter;
- }
- else
- name = forcedName;
- if (template.getType() == PdfTemplate.TYPE_IMPORTED)
- template = null;
- formXObjects.put(ref, new Object[]{name, template});
- }
- else
- name = (PdfName)obj[0];
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- return name;
- }
-
- /**
- * Sets the <CODE>PdfPageEvent</CODE> for this document.
- * @param pageEvent the <CODE>PdfPageEvent</CODE> for this document
- */
-
- public void setPageEvent(PdfPageEvent pageEvent) {
- this.pageEvent = pageEvent;
- }
-
- /**
- * Gets the <CODE>PdfPageEvent</CODE> for this document or <CODE>null</CODE>
- * if none is set.
- * @return the <CODE>PdfPageEvent</CODE> for this document or <CODE>null</CODE>
- * if none is set
- */
-
- public PdfPageEvent getPageEvent() {
- return pageEvent;
- }
-
- /**
- * Adds the local destinations to the body of the document.
- * @param dest the <CODE>HashMap</CODE> containing the destinations
- * @throws IOException on error
- */
-
- void addLocalDestinations(TreeMap dest) throws IOException {
- for (Iterator i = dest.keySet().iterator(); i.hasNext();) {
- String name = (String)i.next();
- Object obj[] = (Object[])dest.get(name);
- PdfDestination destination = (PdfDestination)obj[2];
- if (destination == null)
- throw new RuntimeException("The name '" + name + "' has no local destination.");
- if (obj[1] == null)
- obj[1] = getPdfIndirectReference();
- PdfIndirectObject iob = addToBody(destination, (PdfIndirectReference)obj[1]);
- }
- }
-
- /**
- * Gets the current pagenumber of this document.
- *
- * @return a page number
- */
-
- public int getPageNumber() {
- return pdf.getPageNumber();
- }
-
- /**
- * Sets the viewer preferences by ORing some constants.
- * <p>
- * <ul>
- * <li>The page layout to be used when the document is opened (choose one).
- * <ul>
- * <li><b>PageLayoutSinglePage</b> - Display one page at a time. (default)
- * <li><b>PageLayoutOneColumn</b> - Display the pages in one column.
- * <li><b>PageLayoutTwoColumnLeft</b> - Display the pages in two columns, with
- * oddnumbered pages on the left.
- * <li><b>PageLayoutTwoColumnRight</b> - Display the pages in two columns, with
- * oddnumbered pages on the right.
- * </ul>
- * <li>The page mode how the document should be displayed
- * when opened (choose one).
- * <ul>
- * <li><b>PageModeUseNone</b> - Neither document outline nor thumbnail images visible. (default)
- * <li><b>PageModeUseOutlines</b> - Document outline visible.
- * <li><b>PageModeUseThumbs</b> - Thumbnail images visible.
- * <li><b>PageModeFullScreen</b> - Full-screen mode, with no menu bar, window
- * controls, or any other window visible.
- * <li><b>PageModeUseOC</b> - Optional content group panel visible
- * </ul>
- * <li><b>HideToolbar</b> - A flag specifying whether to hide the viewer application's tool
- * bars when the document is active.
- * <li><b>HideMenubar</b> - A flag specifying whether to hide the viewer application's
- * menu bar when the document is active.
- * <li><b>HideWindowUI</b> - A flag specifying whether to hide user interface elements in
- * the document's window (such as scroll bars and navigation controls),
- * leaving only the document's contents displayed.
- * <li><b>FitWindow</b> - A flag specifying whether to resize the document's window to
- * fit the size of the first displayed page.
- * <li><b>CenterWindow</b> - A flag specifying whether to position the document's window
- * in the center of the screen.
- * <li><b>DisplayDocTitle</b> - A flag specifying whether to display the document's title
- * in the top bar.
- * <li>The predominant reading order for text. This entry has no direct effect on the
- * document's contents or page numbering, but can be used to determine the relative
- * positioning of pages when displayed side by side or printed <i>n-up</i> (choose one).
- * <ul>
- * <li><b>DirectionL2R</b> - Left to right
- * <li><b>DirectionR2L</b> - Right to left (including vertical writing systems such as
- * Chinese, Japanese, and Korean)
- * </ul>
- * <li>The document's page mode, specifying how to display the
- * document on exiting full-screen mode. It is meaningful only
- * if the page mode is <b>PageModeFullScreen</b> (choose one).
- * <ul>
- * <li><b>NonFullScreenPageModeUseNone</b> - Neither document outline nor thumbnail images
- * visible
- * <li><b>NonFullScreenPageModeUseOutlines</b> - Document outline visible
- * <li><b>NonFullScreenPageModeUseThumbs</b> - Thumbnail images visible
- * <li><b>NonFullScreenPageModeUseOC</b> - Optional content group panel visible
- * </ul>
- * <li><b>PrintScalingNone</b> - Indicates that the print dialog should reflect no page scaling.
- * </ul>
- * @param preferences the viewer preferences
- */
-
- public void setViewerPreferences(int preferences) {
- pdf.setViewerPreferences(preferences);
- }
-
- /** Sets the encryption options for this document. The userPassword and the
- * ownerPassword can be null or have zero length. In this case the ownerPassword
- * is replaced by a random string. The open permissions for the document can be
- * AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
- * AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
- * The permissions can be combined by ORing them.
- * @param userPassword the user password. Can be null or empty
- * @param ownerPassword the owner password. Can be null or empty
- * @param permissions the user permissions
- * @param strength128Bits <code>true</code> for 128 bit key length, <code>false</code> for 40 bit key length
- * @throws DocumentException if the document is already open
- */
- public void setEncryption(byte userPassword[], byte ownerPassword[], int permissions, boolean strength128Bits) throws DocumentException {
- if (pdf.isOpen())
- throw new DocumentException("Encryption can only be added before opening the document.");
- crypto = new PdfEncryption();
- crypto.setupAllKeys(userPassword, ownerPassword, permissions, strength128Bits);
- }
-
- /**
- * Sets the encryption options for this document. The userPassword and the
- * ownerPassword can be null or have zero length. In this case the ownerPassword
- * is replaced by a random string. The open permissions for the document can be
- * AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations,
- * AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting.
- * The permissions can be combined by ORing them.
- * @param strength <code>true</code> for 128 bit key length, <code>false</code> for 40 bit key length
- * @param userPassword the user password. Can be null or empty
- * @param ownerPassword the owner password. Can be null or empty
- * @param permissions the user permissions
- * @throws DocumentException if the document is already open
- */
- public void setEncryption(boolean strength, String userPassword, String ownerPassword, int permissions) throws DocumentException {
- setEncryption(getISOBytes(userPassword), getISOBytes(ownerPassword), permissions, strength);
- }
-
- /**
- * Adds an object to the PDF body.
- * @param object
- * @return a PdfIndirectObject
- * @throws IOException
- */
- public PdfIndirectObject addToBody(PdfObject object) throws IOException {
- PdfIndirectObject iobj = body.add(object);
- return iobj;
- }
-
- /**
- * Adds an object to the PDF body.
- * @param object
- * @param inObjStm
- * @return a PdfIndirectObject
- * @throws IOException
- */
- public PdfIndirectObject addToBody(PdfObject object, boolean inObjStm) throws IOException {
- PdfIndirectObject iobj = body.add(object, inObjStm);
- return iobj;
- }
-
- /**
- * Adds an object to the PDF body.
- * @param object
- * @param ref
- * @return a PdfIndirectObject
- * @throws IOException
- */
- public PdfIndirectObject addToBody(PdfObject object, PdfIndirectReference ref) throws IOException {
- PdfIndirectObject iobj = body.add(object, ref);
- return iobj;
- }
-
- /**
- * Adds an object to the PDF body.
- * @param object
- * @param ref
- * @param inObjStm
- * @return a PdfIndirectObject
- * @throws IOException
- */
- public PdfIndirectObject addToBody(PdfObject object, PdfIndirectReference ref, boolean inObjStm) throws IOException {
- PdfIndirectObject iobj = body.add(object, ref, inObjStm);
- return iobj;
- }
-
- /**
- * Adds an object to the PDF body.
- * @param object
- * @param refNumber
- * @return a PdfIndirectObject
- * @throws IOException
- */
- public PdfIndirectObject addToBody(PdfObject object, int refNumber) throws IOException {
- PdfIndirectObject iobj = body.add(object, refNumber);
- return iobj;
- }
-
- /**
- * Adds an object to the PDF body.
- * @param object
- * @param refNumber
- * @param inObjStm
- * @return a PdfIndirectObject
- * @throws IOException
- */
- public PdfIndirectObject addToBody(PdfObject object, int refNumber, boolean inObjStm) throws IOException {
- PdfIndirectObject iobj = body.add(object, refNumber, inObjStm);
- return iobj;
- }
-
- /** When the document opens it will jump to the destination with
- * this name.
- * @param name the name of the destination to jump to
- */
- public void setOpenAction(String name) {
- pdf.setOpenAction(name);
- }
-
- /** Additional-actions defining the actions to be taken in
- * response to various trigger events affecting the document
- * as a whole. The actions types allowed are: <CODE>DOCUMENT_CLOSE</CODE>,
- * <CODE>WILL_SAVE</CODE>, <CODE>DID_SAVE</CODE>, <CODE>WILL_PRINT</CODE>
- * and <CODE>DID_PRINT</CODE>.
- *
- * @param actionType the action type
- * @param action the action to execute in response to the trigger
- * @throws PdfException on invalid action type
- */
- public void setAdditionalAction(PdfName actionType, PdfAction action) throws PdfException {
- if (!(actionType.equals(DOCUMENT_CLOSE) ||
- actionType.equals(WILL_SAVE) ||
- actionType.equals(DID_SAVE) ||
- actionType.equals(WILL_PRINT) ||
- actionType.equals(DID_PRINT))) {
- throw new PdfException("Invalid additional action type: " + actionType.toString());
- }
- pdf.addAdditionalAction(actionType, action);
- }
-
- /** When the document opens this <CODE>action</CODE> will be
- * invoked.
- * @param action the action to be invoked
- */
- public void setOpenAction(PdfAction action) {
- pdf.setOpenAction(action);
- }
-
- /** Sets the page labels
- * @param pageLabels the page labels
- */
- public void setPageLabels(PdfPageLabels pageLabels) {
- pdf.setPageLabels(pageLabels);
- }
-
- PdfEncryption getEncryption() {
- return crypto;
- }
-
- RandomAccessFileOrArray getReaderFile(PdfReader reader) {
- return currentPdfReaderInstance.getReaderFile();
- }
-
- protected int getNewObjectNumber(PdfReader reader, int number, int generation) {
- return currentPdfReaderInstance.getNewObjectNumber(number, generation);
- }
-
- /** Gets a page from other PDF document. The page can be used as
- * any other PdfTemplate. Note that calling this method more than
- * once with the same parameters will retrieve the same object.
- * @param reader the PDF document where the page is
- * @param pageNumber the page number. The first page is 1
- * @return the template representing the imported page
- */
- public PdfImportedPage getImportedPage(PdfReader reader, int pageNumber) {
- PdfReaderInstance inst = (PdfReaderInstance)importedPages.get(reader);
- if (inst == null) {
- inst = reader.getPdfReaderInstance(this);
- importedPages.put(reader, inst);
- }
- return inst.getImportedPage(pageNumber);
- }
-
- /** Adds a JavaScript action at the document level. When the document
- * opens all this JavaScript runs.
- * @param js The JavaScrip action
- */
- public void addJavaScript(PdfAction js) {
- pdf.addJavaScript(js);
- }
-
- /** Adds a JavaScript action at the document level. When the document
- * opens all this JavaScript runs.
- * @param code the JavaScript code
- * @param unicode select JavaScript unicode. Note that the internal
- * Acrobat JavaScript engine does not support unicode,
- * so this may or may not work for you
- */
- public void addJavaScript(String code, boolean unicode) {
- addJavaScript(PdfAction.javaScript(code, this, unicode));
- }
-
- /** Adds a JavaScript action at the document level. When the document
- * opens all this JavaScript runs.
- * @param code the JavaScript code
- */
- public void addJavaScript(String code) {
- addJavaScript(code, false);
- }
-
- /** Sets the crop box. The crop box should not be rotated even if the
- * page is rotated. This change only takes effect in the next
- * page.
- * @param crop the crop box
- */
- public void setCropBoxSize(Rectangle crop) {
- pdf.setCropBoxSize(crop);
- }
-
- /** Gets a reference to a page existing or not. If the page does not exist
- * yet the reference will be created in advance. If on closing the document, a
- * page number greater than the total number of pages was requested, an
- * exception is thrown.
- * @param page the page number. The first page is 1
- * @return the reference to the page
- */
- public PdfIndirectReference getPageReference(int page) {
- --page;
- if (page < 0)
- throw new IndexOutOfBoundsException("The page numbers start at 1.");
- PdfIndirectReference ref;
- if (page < pageReferences.size()) {
- ref = (PdfIndirectReference)pageReferences.get(page);
- if (ref == null) {
- ref = body.getPdfIndirectReference();
- pageReferences.set(page, ref);
- }
- }
- else {
- int empty = page - pageReferences.size();
- for (int k = 0; k < empty; ++k)
- pageReferences.add(null);
- ref = body.getPdfIndirectReference();
- pageReferences.add(ref);
- }
- return ref;
- }
-
- PdfIndirectReference getCurrentPage() {
- return getPageReference(currentPageNumber);
- }
-
- int getCurrentPageNumber() {
- return currentPageNumber;
- }
-
- /** Adds the <CODE>PdfAnnotation</CODE> to the calculation order
- * array.
- * @param annot the <CODE>PdfAnnotation</CODE> to be added
- */
- public void addCalculationOrder(PdfFormField annot) {
- pdf.addCalculationOrder(annot);
- }
-
- /** Set the signature flags.
- * @param f the flags. This flags are ORed with current ones
- */
- public void setSigFlags(int f) {
- pdf.setSigFlags(f);
- }
-
- /** Adds a <CODE>PdfAnnotation</CODE> or a <CODE>PdfFormField</CODE>
- * to the document. Only the top parent of a <CODE>PdfFormField</CODE>
- * needs to be added.
- * @param annot the <CODE>PdfAnnotation</CODE> or the <CODE>PdfFormField</CODE> to add
- */
- public void addAnnotation(PdfAnnotation annot) {
- pdf.addAnnotation(annot);
- }
-
- void addAnnotation(PdfAnnotation annot, int page) {
- addAnnotation(annot);
- }
-
- /** Sets the PDF version. Must be used right before the document
- * is opened. Valid options are VERSION_1_2, VERSION_1_3,
- * VERSION_1_4, VERSION_1_5 and VERSION_1_6. VERSION_1_4 is the default.
- * @param version the version number
- */
- public void setPdfVersion(char version) {
- if (HEADER.length > VPOINT)
- HEADER[VPOINT] = (byte)version;
- }
-
- /** Reorder the pages in the document. A <CODE>null</CODE> argument value
- * only returns the number of pages to process. It is
- * advisable to issue a <CODE>Document.newPage()</CODE>
- * before using this method.
- * @return the total number of pages
- * @param order an array with the new page sequence. It must have the
- * same size as the number of pages.
- * @throws DocumentException if all the pages are not present in the array
- */
- public int reorderPages(int order[]) throws DocumentException {
- return root.reorderPages(order);
- }
-
- /** Gets the space/character extra spacing ratio for
- * fully justified text.
- * @return the space/character extra spacing ratio
- */
- public float getSpaceCharRatio() {
- return spaceCharRatio;
- }
-
- /** Sets the ratio between the extra word spacing and the extra character spacing
- * when the text is fully justified.
- * Extra word spacing will grow <CODE>spaceCharRatio</CODE> times more than extra character spacing.
- * If the ratio is <CODE>PdfWriter.NO_SPACE_CHAR_RATIO</CODE> then the extra character spacing
- * will be zero.
- * @param spaceCharRatio the ratio between the extra word spacing and the extra character spacing
- */
- public void setSpaceCharRatio(float spaceCharRatio) {
- if (spaceCharRatio < 0.001f)
- this.spaceCharRatio = 0.001f;
- else
- this.spaceCharRatio = spaceCharRatio;
- }
-
- /** Sets the run direction. This is only used as a placeholder
- * as it does not affect anything.
- * @param runDirection the run direction
- */
- public void setRunDirection(int runDirection) {
- if (runDirection < RUN_DIRECTION_NO_BIDI || runDirection > RUN_DIRECTION_RTL)
- throw new RuntimeException("Invalid run direction: " + runDirection);
- this.runDirection = runDirection;
- }
-
- /** Gets the run direction.
- * @return the run direction
- */
- public int getRunDirection() {
- return runDirection;
- }
-
- /**
- * Sets the display duration for the page (for presentations)
- * @param seconds the number of seconds to display the page
- */
- public void setDuration(int seconds) {
- pdf.setDuration(seconds);
- }
-
- /**
- * Sets the transition for the page
- * @param transition the Transition object
- */
- public void setTransition(PdfTransition transition) {
- pdf.setTransition(transition);
- }
-
- /** Writes the reader to the document and frees the memory used by it.
- * The main use is when concatenating multiple documents to keep the
- * memory usage restricted to the current appending document.
- * @param reader the <CODE>PdfReader</CODE> to free
- * @throws IOException on error
- */
- public void freeReader(PdfReader reader) throws IOException {
- currentPdfReaderInstance = (PdfReaderInstance)importedPages.get(reader);
- if (currentPdfReaderInstance == null)
- return;
- currentPdfReaderInstance.writeAllPages();
- currentPdfReaderInstance = null;
- importedPages.remove(reader);
- }
-
- /** Sets the open and close page additional action.
- * @param actionType the action type. It can be <CODE>PdfWriter.PAGE_OPEN</CODE>
- * or <CODE>PdfWriter.PAGE_CLOSE</CODE>
- * @param action the action to perform
- * @throws PdfException if the action type is invalid
- */
- public void setPageAction(PdfName actionType, PdfAction action) throws PdfException {
- if (!actionType.equals(PAGE_OPEN) && !actionType.equals(PAGE_CLOSE))
- throw new PdfException("Invalid page additional action type: " + actionType.toString());
- pdf.setPageAction(actionType, action);
- }
-
- /** Gets the current document size. This size only includes
- * the data already writen to the output stream, it does not
- * include templates or fonts. It is usefull if used with
- * <CODE>freeReader()</CODE> when concatenating many documents
- * and an idea of the current size is needed.
- * @return the approximate size without fonts or templates
- */
- public int getCurrentDocumentSize() {
- return body.offset() + body.size() * 20 + 0x48;
- }
-
- /** Getter for property strictImageSequence.
- * @return value of property strictImageSequence
- *
- */
- public boolean isStrictImageSequence() {
- return pdf.isStrictImageSequence();
- }
-
- /** Sets the image sequence to follow the text in strict order.
- * @param strictImageSequence new value of property strictImageSequence
- *
- */
- public void setStrictImageSequence(boolean strictImageSequence) {
- pdf.setStrictImageSequence(strictImageSequence);
- }
-
- /**
- * If you use setPageEmpty(false), invoking newPage() after a blank page will add a newPage.
- * @param pageEmpty the state
- */
- public void setPageEmpty(boolean pageEmpty) {
- pdf.setPageEmpty(pageEmpty);
- }
-
- /** Gets the info dictionary for changing.
- * @return the info dictionary
- */
- public PdfDictionary getInfo() {
- return ((PdfDocument)document).getInfo();
- }
-
- /**
- * Sets extra keys to the catalog.
- * @return the catalog to change
- */
- public PdfDictionary getExtraCatalog() {
- if (extraCatalog == null)
- extraCatalog = new PdfDictionary();
- return this.extraCatalog;
- }
-
- /**
- * Sets the document in a suitable way to do page reordering.
- */
- public void setLinearPageMode() {
- root.setLinearMode(null);
- }
-
- /** Getter for property group.
- * @return Value of property group.
- *
- */
- public PdfDictionary getGroup() {
- return this.group;
- }
-
- /** Setter for property group.
- * @param group New value of property group.
- *
- */
- public void setGroup(PdfDictionary group) {
- this.group = group;
- }
-
- /**
- * Sets the PDFX conformance level. Allowed values are PDFX1A2001 and PDFX32002. It
- * must be called before opening the document.
- * @param pdfxConformance the conformance level
- */
- public void setPDFXConformance(int pdfxConformance) {
- if (this.pdfxConformance == pdfxConformance)
- return;
- if (pdf.isOpen())
- throw new PdfXConformanceException("PDFX conformance can only be set before opening the document.");
- if (crypto != null)
- throw new PdfXConformanceException("A PDFX conforming document cannot be encrypted.");
- if (pdfxConformance != PDFXNONE)
- setPdfVersion(VERSION_1_3);
- this.pdfxConformance = pdfxConformance;
- }
-
- /**
- * Gets the PDFX conformance level.
- * @return the PDFX conformance level
- */
- public int getPDFXConformance() {
- return pdfxConformance;
- }
-
- static void checkPDFXConformance(PdfWriter writer, int key, Object obj1) {
- if (writer == null || writer.pdfxConformance == PDFXNONE)
- return;
- int conf = writer.pdfxConformance;
- switch (key) {
- case PDFXKEY_COLOR:
- switch (conf) {
- case PDFX1A2001:
- if (obj1 instanceof ExtendedColor) {
- ExtendedColor ec = (ExtendedColor)obj1;
- switch (ec.getType()) {
- case ExtendedColor.TYPE_CMYK:
- case ExtendedColor.TYPE_GRAY:
- return;
- case ExtendedColor.TYPE_RGB:
- throw new PdfXConformanceException("Colorspace RGB is not allowed.");
- case ExtendedColor.TYPE_SEPARATION:
- SpotColor sc = (SpotColor)ec;
- checkPDFXConformance(writer, PDFXKEY_COLOR, sc.getPdfSpotColor().getAlternativeCS());
- break;
- case ExtendedColor.TYPE_SHADING:
- ShadingColor xc = (ShadingColor)ec;
- checkPDFXConformance(writer, PDFXKEY_COLOR, xc.getPdfShadingPattern().getShading().getColorSpace());
- break;
- case ExtendedColor.TYPE_PATTERN:
- PatternColor pc = (PatternColor)ec;
- checkPDFXConformance(writer, PDFXKEY_COLOR, pc.getPainter().getDefaultColor());
- break;
- }
- }
- else if (obj1 instanceof Color)
- throw new PdfXConformanceException("Colorspace RGB is not allowed.");
- break;
- }
- break;
- case PDFXKEY_CMYK:
- break;
- case PDFXKEY_RGB:
- if (conf == PDFX1A2001)
- throw new PdfXConformanceException("Colorspace RGB is not allowed.");
- break;
- case PDFXKEY_FONT:
- if (!((BaseFont)obj1).isEmbedded())
- throw new PdfXConformanceException("All the fonts must be embedded.");
- break;
- case PDFXKEY_IMAGE:
- PdfImage image = (PdfImage)obj1;
- if (image.get(PdfName.SMASK) != null)
- throw new PdfXConformanceException("The /SMask key is not allowed in images.");
- switch (conf) {
- case PDFX1A2001:
- PdfObject cs = image.get(PdfName.COLORSPACE);
- if (cs == null)
- return;
- if (cs.isName()) {
- if (PdfName.DEVICERGB.equals(cs))
- throw new PdfXConformanceException("Colorspace RGB is not allowed.");
- }
- else if (cs.isArray()) {
- if (PdfName.CALRGB.equals((PdfObject)((PdfArray)cs).getArrayList().get(0)))
- throw new PdfXConformanceException("Colorspace CalRGB is not allowed.");
- }
- break;
- }
- break;
- case PDFXKEY_GSTATE:
- PdfDictionary gs = (PdfDictionary)obj1;
- PdfObject obj = gs.get(PdfName.BM);
- if (obj != null && !PdfGState.BM_NORMAL.equals(obj) && !PdfGState.BM_COMPATIBLE.equals(obj))
- throw new PdfXConformanceException("Blend mode " + obj.toString() + " not allowed.");
- obj = gs.get(PdfName.CA);
- double v = 0.0;
- if (obj != null && (v = ((PdfNumber)obj).doubleValue()) != 1.0)
- throw new PdfXConformanceException("Transparency is not allowed: /CA = " + v);
- obj = gs.get(PdfName.ca);
- v = 0.0;
- if (obj != null && (v = ((PdfNumber)obj).doubleValue()) != 1.0)
- throw new PdfXConformanceException("Transparency is not allowed: /ca = " + v);
- break;
- case PDFXKEY_LAYER:
- throw new PdfXConformanceException("Layers are not allowed.");
- }
- }
-
- /**
- * Sets the values of the output intent dictionary. Null values are allowed to
- * suppress any key.
- * @param outputConditionIdentifier a value
- * @param outputCondition a value
- * @param registryName a value
- * @param info a value
- * @param destOutputProfile a value
- * @throws IOException on error
- */
- public void setOutputIntents(String outputConditionIdentifier, String outputCondition, String registryName, String info, byte destOutputProfile[]) throws IOException {
- getExtraCatalog();
- PdfDictionary out = new PdfDictionary(PdfName.OUTPUTINTENT);
- if (outputCondition != null)
- out.put(PdfName.OUTPUTCONDITION, new PdfString(outputCondition, PdfObject.TEXT_UNICODE));
- if (outputConditionIdentifier != null)
- out.put(PdfName.OUTPUTCONDITIONIDENTIFIER, new PdfString(outputConditionIdentifier, PdfObject.TEXT_UNICODE));
- if (registryName != null)
- out.put(PdfName.REGISTRYNAME, new PdfString(registryName, PdfObject.TEXT_UNICODE));
- if (info != null)
- out.put(PdfName.INFO, new PdfString(registryName, PdfObject.TEXT_UNICODE));
- if (destOutputProfile != null) {
- PdfStream stream = new PdfStream(destOutputProfile);
- stream.flateCompress();
- out.put(PdfName.DESTOUTPUTPROFILE, addToBody(stream).getIndirectReference());
- }
- out.put(PdfName.S, PdfName.GTS_PDFX);
- extraCatalog.put(PdfName.OUTPUTINTENTS, new PdfArray(out));
- }
-
- private static String getNameString(PdfDictionary dic, PdfName key) {
- PdfObject obj = PdfReader.getPdfObject(dic.get(key));
- if (obj == null || !obj.isString())
- return null;
- return ((PdfString)obj).toUnicodeString();
- }
-
- /**
- * Copies the output intent dictionary from other document to this one.
- * @param reader the other document
- * @param checkExistence <CODE>true</CODE> to just check for the existence of a valid output intent
- * dictionary, <CODE>false</CODE> to insert the dictionary if it exists
- * @throws IOException on error
- * @return <CODE>true</CODE> if the output intent dictionary exists, <CODE>false</CODE>
- * otherwise
- */
- public boolean setOutputIntents(PdfReader reader, boolean checkExistence) throws IOException {
- PdfDictionary catalog = reader.getCatalog();
- PdfArray outs = (PdfArray)PdfReader.getPdfObject(catalog.get(PdfName.OUTPUTINTENTS));
- if (outs == null)
- return false;
- ArrayList arr = outs.getArrayList();
- if (arr.size() == 0)
- return false;
- PdfDictionary out = (PdfDictionary)PdfReader.getPdfObject((PdfObject)arr.get(0));
- PdfObject obj = PdfReader.getPdfObject(out.get(PdfName.S));
- if (obj == null || !PdfName.GTS_PDFX.equals(obj))
- return false;
- if (checkExistence)
- return true;
- PRStream stream = (PRStream)PdfReader.getPdfObject(out.get(PdfName.DESTOUTPUTPROFILE));
- byte destProfile[] = null;
- if (stream != null) {
- destProfile = PdfReader.getStreamBytes(stream);
- }
- setOutputIntents(getNameString(out, PdfName.OUTPUTCONDITIONIDENTIFIER), getNameString(out, PdfName.OUTPUTCONDITION),
- getNameString(out, PdfName.REGISTRYNAME), getNameString(out, PdfName.INFO), destProfile);
- return true;
- }
-
- /**
- * Sets the page box sizes. Allowed names are: "crop", "trim", "art" and "bleed".
- * @param boxName the box size
- * @param size the size
- */
- public void setBoxSize(String boxName, Rectangle size) {
- pdf.setBoxSize(boxName, size);
- }
-
- /**
- * Gets the default colorspaces.
- * @return the default colorspaces
- */
- public PdfDictionary getDefaultColorspace() {
- return defaultColorspace;
- }
-
- /**
- * Sets the default colorspace that will be applied to all the document.
- * The colorspace is only applied if another colorspace with the same name
- * is not present in the content.
- * <p>
- * The colorspace is applied immediately when creating templates and at the page
- * end for the main document content.
- * @param key the name of the colorspace. It can be <CODE>PdfName.DEFAULTGRAY</CODE>, <CODE>PdfName.DEFAULTRGB</CODE>
- * or <CODE>PdfName.DEFAULTCMYK</CODE>
- * @param cs the colorspace. A <CODE>null</CODE> or <CODE>PdfNull</CODE> removes any colorspace with the same name
- */
- public void setDefaultColorspace(PdfName key, PdfObject cs) {
- if (cs == null || cs.isNull())
- defaultColorspace.remove(key);
- defaultColorspace.put(key, cs);
- }
-
- /**
- * Gets the 1.5 compression status.
- * @return <code>true</code> if the 1.5 compression is on
- */
- public boolean isFullCompression() {
- return this.fullCompression;
- }
-
- /**
- * Sets the document's compression to the new 1.5 mode with object streams and xref
- * streams. It can be set at any time but once set it can't be unset.
- * <p>
- * If set before opening the document it will also set the pdf version to 1.5.
- */
- public void setFullCompression() {
- this.fullCompression = true;
- setPdfVersion(VERSION_1_5);
- }
-
- /**
- * Gets the <B>Optional Content Properties Dictionary</B>. Each call fills the dictionary with the current layer
- * state. It's advisable to only call this method right before close and do any modifications
- * at that time.
- * @return the Optional Content Properties Dictionary
- */
- public PdfOCProperties getOCProperties() {
- fillOCProperties(true);
- return OCProperties;
- }
-
- /**
- * Sets a collection of optional content groups whose states are intended to follow
- * a "radio button" paradigm. That is, the state of at most one optional
- * content group in the array should be ON at a time: if one group is turned
- * ON, all others must be turned OFF.
- * @param group the radio group
- */
- public void addOCGRadioGroup(ArrayList group) {
- PdfArray ar = new PdfArray();
- for (int k = 0; k < group.size(); ++k) {
- PdfLayer layer = (PdfLayer)group.get(k);
- if (layer.getTitle() == null)
- ar.add(layer.getRef());
- }
- if (ar.size() == 0)
- return;
- OCGRadioGroup.add(ar);
- }
-
- /**
- * Sets the the thumbnail image for the current page.
- * @param image the image
- * @throws PdfException on error
- * @throws DocumentException or error
- */
- public void setThumbnail(Image image) throws PdfException, DocumentException {
- pdf.setThumbnail(image);
- }
-
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/PdfXConformanceException.java b/LibrarySource/com/lowagie/text/pdf/PdfXConformanceException.java
deleted file mode 100644
index 574f229..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PdfXConformanceException.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * $Id: PdfXConformanceException.java,v 1.2 2005/02/17 09:20:54 blowagie Exp $
- * $Name: $
- *
- * Copyright 2004 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999-2005 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000-2005 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/**
- *
- * @author psoares
- */
-public class PdfXConformanceException extends RuntimeException {
-
- /** Creates a new instance of PdfXConformanceException. */
- public PdfXConformanceException() {
- }
-
- /**
- * Creates a new instance of PdfXConformanceException.
- * @param s
- */
- public PdfXConformanceException(String s) {
- super(s);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/Pfm2afm.java b/LibrarySource/com/lowagie/text/pdf/Pfm2afm.java
deleted file mode 100644
index 0e24461..0000000
--- a/LibrarySource/com/lowagie/text/pdf/Pfm2afm.java
+++ /dev/null
@@ -1,774 +0,0 @@
-/*
- * Copyright 2005 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-/********************************************************************
- * *
- * Title: pfm2afm - Convert Windows .pfm files to .afm files *
- * *
- * Author: Ken Borgendale 10/9/91 Version 1.0 *
- * *
- * Function: *
- * Convert a Windows .pfm (Printer Font Metrics) file to a *
- * .afm (Adobe Font Metrics) file. The purpose of this is *
- * to allow fonts put out for Windows to be used with OS/2. *
- * *
- * Syntax: *
- * pfm2afm infile [outfile] -a *
- * *
- * Copyright: *
- * pfm2afm - Copyright (C) IBM Corp., 1991 *
- * *
- * This code is released for public use as long as the *
- * copyright remains intact. This code is provided asis *
- * without any warrenties, express or implied. *
- * *
- * Notes: *
- * 1. Much of the information in the original .afm file is *
- * lost when the .pfm file is created, and thus cannot be *
- * reconstructed by this utility. This is especially true *
- * of data for characters not in the Windows character set. *
- * *
- * 2. This module is coded to be compiled by the MSC 6.0. *
- * For other compilers, be careful of the packing of the *
- * PFM structure. *
- * *
- ********************************************************************/
-
-/********************************************************************
- * *
- * Modifications by Rod Smith, 5/22/96 *
- * *
- * These changes look for the strings "italic", "bold", "black", *
- * and "light" in the font's name and set the weight accordingly *
- * and adds an ItalicAngle line with a value of "0" or "-12.00". *
- * This allows OS/2 programs such as DeScribe to handle the bold *
- * and italic attributes appropriately, which was not the case *
- * when I used the original version on fonts from the KeyFonts *
- * Pro 2002 font CD. *
- * *
- * I've also increased the size of the buffer used to load the *
- * .PFM file; the old size was inadequate for most of the fonts *
- * from the SoftKey collection. *
- * *
- * Compiled with Watcom C 10.6 *
- * *
- ********************************************************************/
-
-/********************************************************************
- * *
- * Further modifications, 4/21/98, by Rod Smith *
- * *
- * Minor changes to get the program to compile with gcc under *
- * Linux (Red Hat 5.0, to be precise). I had to add an itoa *
- * function from the net (the function was buggy, so I had to fix *
- * it, too!). I also made the program more friendly towards *
- * files with mixed-case filenames. *
- * *
- ********************************************************************/
-package com.lowagie.text.pdf;
-
-import java.util.*;
-import java.io.*;
-
-/**
- * Converts a PFM file into an AFM file.
- */
-public class Pfm2afm {
- private RandomAccessFileOrArray in;
- private PrintWriter out;
-
- /** Creates a new instance of Pfm2afm */
- private Pfm2afm(RandomAccessFileOrArray in, OutputStream out) throws IOException {
- this.in = in;
- this.out = new PrintWriter(new OutputStreamWriter(out, "ISO-8859-1"));
- }
-
- /**
- * Converts a PFM file into an AFM file.
- * @param in the PFM file
- * @param out the AFM file
- * @throws IOException on error
- */
- public static void convert(RandomAccessFileOrArray in, OutputStream out) throws IOException {
- Pfm2afm p = new Pfm2afm(in, out);
- p.openpfm();
- p.putheader();
- p.putchartab();
- p.putkerntab();
- p.puttrailer();
- p.out.flush();
- }
-
- public static void main(String[] args) {
- try {
- RandomAccessFileOrArray in = new RandomAccessFileOrArray(args[0]);
- OutputStream out = new FileOutputStream(args[1]);
- convert(in, out);
- in.close();
- out.close();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private String readString(int n) throws IOException {
- byte b[] = new byte[n];
- in.readFully(b);
- int k;
- for (k = 0; k < b.length; ++k) {
- if (b[k] == 0)
- break;
- }
- return new String(b, 0, k, "ISO-8859-1");
- }
-
- private String readString() throws IOException {
- StringBuffer buf = new StringBuffer();
- while (true) {
- int c = in.read();
- if (c <= 0)
- break;
- buf.append((char)c);
- }
- return buf.toString();
- }
-
- private void outval(int n) {
- out.print(' ');
- out.print(n);
- }
-
- /*
- * Output a character entry
- */
- private void outchar(int code, int width, String name) {
- out.print("C ");
- outval(code);
- out.print(" ; WX ");
- outval(width);
- if (name != null) {
- out.print(" ; N ");
- out.print(name);
- }
- out.print(" ;\n");
- }
-
- private void openpfm() throws IOException {
- in.seek(0);
- vers = in.readShortLE();
- h_len = in.readIntLE();
- copyright = readString(60);
- type = in.readShortLE();
- points = in.readShortLE();
- verres = in.readShortLE();
- horres = in.readShortLE();
- ascent = in.readShortLE();
- intleading = in.readShortLE();
- extleading = in.readShortLE();
- italic = (byte)in.read();
- uline = (byte)in.read();
- overs = (byte)in.read();
- weight = in.readShortLE();
- charset = (byte)in.read();
- pixwidth = in.readShortLE();
- pixheight = in.readShortLE();
- kind = (byte)in.read();
- avgwidth = in.readShortLE();
- maxwidth = in.readShortLE();
- firstchar = in.read();
- lastchar = in.read();
- defchar = (byte)in.read();
- brkchar = (byte)in.read();
- widthby = in.readShortLE();
- device = in.readIntLE();
- face = in.readIntLE();
- bits = in.readIntLE();
- bitoff = in.readIntLE();
- extlen = in.readShortLE();
- psext = in.readIntLE();
- chartab = in.readIntLE();
- res1 = in.readIntLE();
- kernpairs = in.readIntLE();
- res2 = in.readIntLE();
- fontname = in.readIntLE();
- if (h_len != in.length() || extlen != 30 || fontname < 75 || fontname > 512)
- throw new IOException("Not a valid PFM file.");
- in.seek(psext + 14);
- capheight = in.readShortLE();
- xheight = in.readShortLE();
- ascender = in.readShortLE();
- descender = in.readShortLE();
- }
-
- private void putheader() throws IOException {
- out.print("StartFontMetrics 2.0\n");
- if (copyright.length() > 0)
- out.print("Comment " + copyright + '\n');
- out.print("FontName ");
- in.seek(fontname);
- String fname = readString();
- out.print(fname);
- out.print("\nEncodingScheme ");
- if (charset != 0)
- out.print("FontSpecific\n");
- else
- out.print("AdobeStandardEncoding\n");
- /*
- * The .pfm is missing full name, so construct from font name by
- * changing the hyphen to a space. This actually works in a lot
- * of cases.
- */
- out.print("FullName " + fname.replace('-', ' '));
- if (face != 0) {
- in.seek(face);
- out.print("\nFamilyName " + readString());
- }
-
- out.print("\nWeight ");
- if (weight > 475 || fname.toLowerCase().indexOf("bold") >= 0)
- out.print("Bold");
- else if ((weight < 325 && weight != 0) || fname.toLowerCase().indexOf("light") >= 0)
- out.print("Light");
- else if (fname.toLowerCase().indexOf("black") >= 0)
- out.print("Black");
- else
- out.print("Medium");
-
- out.print("\nItalicAngle ");
- if (italic != 0 || fname.toLowerCase().indexOf("italic") >= 0)
- out.print("-12.00");
- /* this is a typical value; something else may work better for a
- specific font */
- else
- out.print("0");
-
- /*
- * The mono flag in the pfm actually indicates whether there is a
- * table of font widths, not if they are all the same.
- */
- out.print("\nIsFixedPitch ");
- if ((kind & 1) == 0 || /* Flag for mono */
- avgwidth == maxwidth ) { /* Avg width = max width */
- out.print("true");
- isMono = true;
- }
- else {
- out.print("false");
- isMono = false;
- }
-
- /*
- * The font bounding box is lost, but try to reconstruct it.
- * Much of this is just guess work. The bounding box is required in
- * the .afm, but is not used by the PM font installer.
- */
- out.print("\nFontBBox");
- if (isMono)
- outval(-20); /* Just guess at left bounds */
- else
- outval(-100);
- outval(-(descender+5)); /* Descender is given as positive value */
- outval(maxwidth+10);
- outval(ascent+5);
-
- /*
- * Give other metrics that were kept
- */
- out.print("\nCapHeight");
- outval(capheight);
- out.print("\nXHeight");
- outval(xheight);
- out.print("\nDescender");
- outval(descender);
- out.print("\nAscender");
- outval(ascender);
- out.print('\n');
- }
-
- private void putchartab() throws IOException {
- int count = lastchar - firstchar + 1;
- int ctabs[] = new int[count];
- in.seek(chartab);
- for (int k = 0; k < count; ++k)
- ctabs[k] = in.readUnsignedShortLE();
- int back[] = new int[256];
- if (charset == 0) {
- for (int i = firstchar; i <= lastchar; ++i) {
- if (Win2PSStd[i] != 0)
- back[Win2PSStd[i]] = i;
- }
- }
- /* Put out the header */
- out.print("StartCharMetrics");
- outval(count);
- out.print('\n');
-
- /* Put out all encoded chars */
- if (charset != 0) {
- /*
- * If the charset is not the Windows standard, just put out
- * unnamed entries.
- */
- for (int i = firstchar; i <= lastchar; i++) {
- if (ctabs[i - firstchar] != 0) {
- outchar(i, ctabs[i - firstchar], null);
- }
- }
- }
- else {
- for (int i = 0; i < 256; i++) {
- int j = back[i];
- if (j != 0) {
- outchar(i, ctabs[j - firstchar], WinChars[j]);
- ctabs[j - firstchar] = 0;
- }
- }
- /* Put out all non-encoded chars */
- for (int i = firstchar; i <= lastchar; i++) {
- if (ctabs[i - firstchar] != 0) {
- outchar(-1, ctabs[i - firstchar], WinChars[i]);
- }
- }
- }
- /* Put out the trailer */
- out.print("EndCharMetrics\n");
-
- }
-
- private void putkerntab() throws IOException {
- if (kernpairs == 0)
- return;
- in.seek(kernpairs);
- int count = in.readUnsignedShortLE();
- int nzero = 0;
- int kerns[] = new int[count * 3];
- for (int k = 0; k < kerns.length;) {
- kerns[k++] = in.read();
- kerns[k++] = in.read();
- if ((kerns[k++] = in.readShortLE()) != 0)
- ++nzero;
- }
- if (nzero == 0)
- return;
- out.print("StartKernData\nStartKernPairs");
- outval(nzero);
- out.print('\n');
- for (int k = 0; k < kerns.length; k += 3) {
- if (kerns[k + 2] != 0) {
- out.print("KPX ");
- out.print(WinChars[kerns[k]]);
- out.print(' ');
- out.print(WinChars[kerns[k + 1]]);
- outval(kerns[k + 2]);
- out.print('\n');
- }
- }
- /* Put out trailer */
- out.print("EndKernPairs\nEndKernData\n");
- }
-
-
- private void puttrailer() {
- out.print("EndFontMetrics\n");
- }
-
- private short vers;
- private int h_len; /* Total length of .pfm file */
- private String copyright; /* Copyright string [60]*/
- private short type;
- private short points;
- private short verres;
- private short horres;
- private short ascent;
- private short intleading;
- private short extleading;
- private byte italic;
- private byte uline;
- private byte overs;
- private short weight;
- private byte charset; /* 0=windows, otherwise nomap */
- private short pixwidth; /* Width for mono fonts */
- private short pixheight;
- private byte kind; /* Lower bit off in mono */
- private short avgwidth; /* Mono if avg=max width */
- private short maxwidth; /* Use to compute bounding box */
- private int firstchar; /* First char in table */
- private int lastchar; /* Last char in table */
- private byte defchar;
- private byte brkchar;
- private short widthby;
- private int device;
- private int face; /* Face name */
- private int bits;
- private int bitoff;
- private short extlen;
- private int psext; /* PostScript extension */
- private int chartab; /* Character width tables */
- private int res1;
- private int kernpairs; /* Kerning pairs */
- private int res2;
- private int fontname; /* Font name */
-
-/*
- * Some metrics from the PostScript extension
- */
- private short capheight; /* Cap height */
- private short xheight; /* X height */
- private short ascender; /* Ascender */
- private short descender; /* Descender (positive) */
-
-
- private boolean isMono;
-/*
- * Translate table from 1004 to psstd. 1004 is an extension of the
- * Windows translate table used in PM.
- */
- private int Win2PSStd[] = {
- 0, 0, 0, 0, 197, 198, 199, 0, 202, 0, 205, 206, 207, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 32, 33, 34, 35, 36, 37, 38, 169, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 193, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
- 0, 0, 184, 0, 185, 188, 178, 179, 94, 189, 0, 172, 234, 0, 0, 0,
- 0, 96, 0, 170, 186, 0, 177, 208, 126, 0, 0, 173, 250, 0, 0, 0,
- 0, 161, 162, 163, 168, 165, 0, 167, 200, 0, 227, 171, 0, 0, 0, 0,
- 0, 0, 0, 0, 194, 0, 182, 180, 203, 0, 235, 187, 0, 0, 0, 191,
- 0, 0, 0, 0, 0, 0, 225, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 233, 0, 0, 0, 0, 0, 0, 251,
- 0, 0, 0, 0, 0, 0, 241, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 249, 0, 0, 0, 0, 0, 0, 0
- };
-
-/*
- * Character class. This is a minor attempt to overcome the problem that
- * in the pfm file, all unused characters are given the width of space.
- */
- private int WinClass[] = {
- 0, 0, 0, 0, 2, 2, 2, 0, 2, 0, 2, 2, 2, 0, 0, 0, /* 00 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 10 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 20 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 30 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 40 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 50 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 60 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, /* 70 */
- 0, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, /* 80 */
- 0, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, /* 90 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* a0 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* b0 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* c0 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* d0 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e0 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 /* f0 */
- };
-
-/*
- * Windows chararacter names. Give a name to the usused locations
- * for when the all flag is specified.
- */
- private String WinChars[] = {
- "W00", /* 00 */
- "W01", /* 01 */
- "W02", /* 02 */
- "W03", /* 03 */
- "macron", /* 04 */
- "breve", /* 05 */
- "dotaccent", /* 06 */
- "W07", /* 07 */
- "ring", /* 08 */
- "W09", /* 09 */
- "W0a", /* 0a */
- "W0b", /* 0b */
- "W0c", /* 0c */
- "W0d", /* 0d */
- "W0e", /* 0e */
- "W0f", /* 0f */
- "hungarumlaut", /* 10 */
- "ogonek", /* 11 */
- "caron", /* 12 */
- "W13", /* 13 */
- "W14", /* 14 */
- "W15", /* 15 */
- "W16", /* 16 */
- "W17", /* 17 */
- "W18", /* 18 */
- "W19", /* 19 */
- "W1a", /* 1a */
- "W1b", /* 1b */
- "W1c", /* 1c */
- "W1d", /* 1d */
- "W1e", /* 1e */
- "W1f", /* 1f */
- "space", /* 20 */
- "exclam", /* 21 */
- "quotedbl", /* 22 */
- "numbersign", /* 23 */
- "dollar", /* 24 */
- "percent", /* 25 */
- "ampersand", /* 26 */
- "quotesingle", /* 27 */
- "parenleft", /* 28 */
- "parenright", /* 29 */
- "asterisk", /* 2A */
- "plus", /* 2B */
- "comma", /* 2C */
- "hyphen", /* 2D */
- "period", /* 2E */
- "slash", /* 2F */
- "zero", /* 30 */
- "one", /* 31 */
- "two", /* 32 */
- "three", /* 33 */
- "four", /* 34 */
- "five", /* 35 */
- "six", /* 36 */
- "seven", /* 37 */
- "eight", /* 38 */
- "nine", /* 39 */
- "colon", /* 3A */
- "semicolon", /* 3B */
- "less", /* 3C */
- "equal", /* 3D */
- "greater", /* 3E */
- "question", /* 3F */
- "at", /* 40 */
- "A", /* 41 */
- "B", /* 42 */
- "C", /* 43 */
- "D", /* 44 */
- "E", /* 45 */
- "F", /* 46 */
- "G", /* 47 */
- "H", /* 48 */
- "I", /* 49 */
- "J", /* 4A */
- "K", /* 4B */
- "L", /* 4C */
- "M", /* 4D */
- "N", /* 4E */
- "O", /* 4F */
- "P", /* 50 */
- "Q", /* 51 */
- "R", /* 52 */
- "S", /* 53 */
- "T", /* 54 */
- "U", /* 55 */
- "V", /* 56 */
- "W", /* 57 */
- "X", /* 58 */
- "Y", /* 59 */
- "Z", /* 5A */
- "bracketleft", /* 5B */
- "backslash", /* 5C */
- "bracketright", /* 5D */
- "asciicircum", /* 5E */
- "underscore", /* 5F */
- "grave", /* 60 */
- "a", /* 61 */
- "b", /* 62 */
- "c", /* 63 */
- "d", /* 64 */
- "e", /* 65 */
- "f", /* 66 */
- "g", /* 67 */
- "h", /* 68 */
- "i", /* 69 */
- "j", /* 6A */
- "k", /* 6B */
- "l", /* 6C */
- "m", /* 6D */
- "n", /* 6E */
- "o", /* 6F */
- "p", /* 70 */
- "q", /* 71 */
- "r", /* 72 */
- "s", /* 73 */
- "t", /* 74 */
- "u", /* 75 */
- "v", /* 76 */
- "w", /* 77 */
- "x", /* 78 */
- "y", /* 79 */
- "z", /* 7A */
- "braceleft", /* 7B */
- "bar", /* 7C */
- "braceright", /* 7D */
- "asciitilde", /* 7E */
- "W7f", /* 7F */
- "W80", /* 80 */
- "W81", /* 81 */
- "quotesinglbase", /* 82 */
- "W83", /* 83 */
- "quotedblbase", /* 84 */
- "ellipsis", /* 85 */
- "dagger", /* 86 */
- "daggerdbl", /* 87 */
- "asciicircum", /* 88 */
- "perthousand", /* 89 */
- "Scaron", /* 8A */
- "guilsinglleft", /* 8B */
- "OE", /* 8C */
- "W8d", /* 8D */
- "W8e", /* 8E */
- "W8f", /* 8F */
- "W90", /* 90 */
- "quoteleft", /* 91 */
- "quoteright", /* 92 */
- "quotedblleft", /* 93 */
- "quotedblright", /* 94 */
- "bullet1", /* 95 */
- "endash", /* 96 */
- "emdash", /* 97 */
- "asciitilde", /* 98 */
- "trademark", /* 99 */
- "scaron", /* 9A */
- "guilsinglright", /* 9B */
- "oe", /* 9C */
- "W9d", /* 9D */
- "W9e", /* 9E */
- "Ydieresis", /* 9F */
- "reqspace", /* A0 */
- "exclamdown", /* A1 */
- "cent", /* A2 */
- "sterling", /* A3 */
- "currency", /* A4 */
- "yen", /* A5 */
- "brokenbar", /* A6 */
- "section", /* A7 */
- "dieresis", /* A8 */
- "copyright", /* A9 */
- "ordfeminine", /* AA */
- "guillemotleft", /* AB */
- "logicalnot", /* AC */
- "syllable", /* AD */
- "registered", /* AE */
- "overbar", /* AF */
- "degree", /* B0 */
- "plusminus", /* B1 */
- "twosuperior", /* B2 */
- "threesuperior", /* B3 */
- "acute", /* B4 */
- "mu", /* B5 */
- "paragraph", /* B6 */
- "periodcentered", /* B7 */
- "cedilla", /* B8 */
- "onesuperior", /* B9 */
- "ordmasculine", /* BA */
- "guillemotright", /* BB */
- "onequarter", /* BC */
- "onehalf", /* BD */
- "threequarters", /* BE */
- "questiondown", /* BF */
- "Agrave", /* C0 */
- "Aacute", /* C1 */
- "Acircumflex", /* C2 */
- "Atilde", /* C3 */
- "Adieresis", /* C4 */
- "Aring", /* C5 */
- "AE", /* C6 */
- "Ccedilla", /* C7 */
- "Egrave", /* C8 */
- "Eacute", /* C9 */
- "Ecircumflex", /* CA */
- "Edieresis", /* CB */
- "Igrave", /* CC */
- "Iacute", /* CD */
- "Icircumflex", /* CE */
- "Idieresis", /* CF */
- "Eth", /* D0 */
- "Ntilde", /* D1 */
- "Ograve", /* D2 */
- "Oacute", /* D3 */
- "Ocircumflex", /* D4 */
- "Otilde", /* D5 */
- "Odieresis", /* D6 */
- "multiply", /* D7 */
- "Oslash", /* D8 */
- "Ugrave", /* D9 */
- "Uacute", /* DA */
- "Ucircumflex", /* DB */
- "Udieresis", /* DC */
- "Yacute", /* DD */
- "Thorn", /* DE */
- "germandbls", /* DF */
- "agrave", /* E0 */
- "aacute", /* E1 */
- "acircumflex", /* E2 */
- "atilde", /* E3 */
- "adieresis", /* E4 */
- "aring", /* E5 */
- "ae", /* E6 */
- "ccedilla", /* E7 */
- "egrave", /* E8 */
- "eacute", /* E9 */
- "ecircumflex", /* EA */
- "edieresis", /* EB */
- "igrave", /* EC */
- "iacute", /* ED */
- "icircumflex", /* EE */
- "idieresis", /* EF */
- "eth", /* F0 */
- "ntilde", /* F1 */
- "ograve", /* F2 */
- "oacute", /* F3 */
- "ocircumflex", /* F4 */
- "otilde", /* F5 */
- "odieresis", /* F6 */
- "divide", /* F7 */
- "oslash", /* F8 */
- "ugrave", /* F9 */
- "uacute", /* FA */
- "ucircumflex", /* FB */
- "udieresis", /* FC */
- "yacute", /* FD */
- "thorn", /* FE */
- "ydieresis" /* FF */
- };
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/PushbuttonField.java b/LibrarySource/com/lowagie/text/pdf/PushbuttonField.java
deleted file mode 100644
index 0f8c69d..0000000
--- a/LibrarySource/com/lowagie/text/pdf/PushbuttonField.java
+++ /dev/null
@@ -1,602 +0,0 @@
-/*
- * Copyright 2005 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.Image;
-import com.lowagie.text.DocumentException;
-import java.io.IOException;
-/**
- * Creates a pushbutton field. It supports all the text and icon alignments.
- * The icon may be an image or a template.
- * <p>
- * Example usage:
- * <p>
- * <PRE>
- * Document document = new Document(PageSize.A4, 50, 50, 50, 50);
- * PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("output.pdf"));
- * document.open();
- * PdfContentByte cb = writer.getDirectContent();
- * Image img = Image.getInstance("image.png");
- * PushbuttonField bt = new PushbuttonField(writer, new Rectangle(100, 100, 200, 200), "Button1");
- * bt.setText("My Caption");
- * bt.setFontSize(0);
- * bt.setImage(img);
- * bt.setLayout(PushbuttonField.LAYOUT_ICON_TOP_LABEL_BOTTOM);
- * bt.setBackgroundColor(Color.cyan);
- * bt.setBorderStyle(PdfBorderDictionary.STYLE_SOLID);
- * bt.setBorderColor(Color.red);
- * bt.setBorderWidth(3);
- * PdfFormField ff = bt.getButton();
- * PdfAction ac = PdfAction.createSubmitForm("http://www.submit-site.com", null, 0);
- * ff.setAction(ac);
- * writer.addAnnotation(ff);
- * document.close();
- * </PRE>
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class PushbuttonField extends BaseField {
-
- /** A layout option */
- public static final int LAYOUT_LABEL_ONLY = 1;
- /** A layout option */
- public static final int LAYOUT_ICON_ONLY = 2;
- /** A layout option */
- public static final int LAYOUT_ICON_TOP_LABEL_BOTTOM = 3;
- /** A layout option */
- public static final int LAYOUT_LABEL_TOP_ICON_BOTTOM = 4;
- /** A layout option */
- public static final int LAYOUT_ICON_LEFT_LABEL_RIGHT = 5;
- /** A layout option */
- public static final int LAYOUT_LABEL_LEFT_ICON_RIGHT = 6;
- /** A layout option */
- public static final int LAYOUT_LABEL_OVER_ICON = 7;
- /** An icon scaling option */
- public static final int SCALE_ICON_ALWAYS = 1;
- /** An icon scaling option */
- public static final int SCALE_ICON_NEVER = 2;
- /** An icon scaling option */
- public static final int SCALE_ICON_IS_TOO_BIG = 3;
- /** An icon scaling option */
- public static final int SCALE_ICON_IS_TOO_SMALL = 4;
-
- /**
- * Holds value of property layout.
- */
- private int layout = LAYOUT_LABEL_ONLY;
-
- /**
- * Holds value of property image.
- */
- private Image image;
-
- /**
- * Holds value of property template.
- */
- private PdfTemplate template;
-
- /**
- * Holds value of property scaleIcon.
- */
- private int scaleIcon = SCALE_ICON_ALWAYS;
-
- /**
- * Holds value of property proportionalIcon.
- */
- private boolean proportionalIcon = true;
-
- /**
- * Holds value of property iconVerticalAdjustment.
- */
- private float iconVerticalAdjustment = 0.5f;
-
- /**
- * Holds value of property iconHorizontalAdjustment.
- */
- private float iconHorizontalAdjustment = 0.5f;
-
- /**
- * Holds value of property iconFitToBounds.
- */
- private boolean iconFitToBounds;
-
- private PdfTemplate tp;
-
- /**
- * Creates a new instance of PushbuttonField
- * @param writer the document <CODE>PdfWriter</CODE>
- * @param box the field location and dimensions
- * @param fieldName the field name. If <CODE>null</CODE> only the widget keys
- * will be included in the field allowing it to be used as a kid field.
- */
- public PushbuttonField(PdfWriter writer, Rectangle box, String fieldName) {
- super(writer, box, fieldName);
- }
-
- /**
- * Getter for property layout.
- * @return Value of property layout.
- */
- public int getLayout() {
- return this.layout;
- }
-
- /**
- * Sets the icon and label layout. Possible values are <CODE>LAYOUT_LABEL_ONLY</CODE>,
- * <CODE>LAYOUT_ICON_ONLY</CODE>, <CODE>LAYOUT_ICON_TOP_LABEL_BOTTOM</CODE>,
- * <CODE>LAYOUT_LABEL_TOP_ICON_BOTTOM</CODE>, <CODE>LAYOUT_ICON_LEFT_LABEL_RIGHT</CODE>,
- * <CODE>LAYOUT_LABEL_LEFT_ICON_RIGHT</CODE> and <CODE>LAYOUT_LABEL_OVER_ICON</CODE>.
- * The default is <CODE>LAYOUT_LABEL_ONLY</CODE>.
- * @param layout New value of property layout.
- */
- public void setLayout(int layout) {
- if (layout < LAYOUT_LABEL_ONLY || layout > LAYOUT_LABEL_OVER_ICON)
- throw new IllegalArgumentException("Layout out of bounds.");
- this.layout = layout;
- }
-
- /**
- * Getter for property image.
- * @return Value of property image.
- */
- public Image getImage() {
- return this.image;
- }
-
- /**
- * Sets the icon as an image.
- * @param image the image
- */
- public void setImage(Image image) {
- this.image = image;
- template = null;
- }
-
- /**
- * Getter for property template.
- * @return Value of property template.
- */
- public PdfTemplate getTemplate() {
- return this.template;
- }
-
- /**
- * Sets the icon as a template.
- * @param template the template
- */
- public void setTemplate(PdfTemplate template) {
- this.template = template;
- image = null;
- }
-
- /**
- * Getter for property scaleIcon.
- * @return Value of property scaleIcon.
- */
- public int getScaleIcon() {
- return this.scaleIcon;
- }
-
- /**
- * Sets the way the icon will be scaled. Possible values are
- * <CODE>SCALE_ICON_ALWAYS</CODE>, <CODE>SCALE_ICON_NEVER</CODE>,
- * <CODE>SCALE_ICON_IS_TOO_BIG</CODE> and <CODE>SCALE_ICON_IS_TOO_SMALL</CODE>.
- * The default is <CODE>SCALE_ICON_ALWAYS</CODE>.
- * @param scaleIcon the way the icon will be scaled
- */
- public void setScaleIcon(int scaleIcon) {
- if (scaleIcon < SCALE_ICON_ALWAYS || scaleIcon > SCALE_ICON_IS_TOO_SMALL)
- scaleIcon = SCALE_ICON_ALWAYS;
- this.scaleIcon = scaleIcon;
- }
-
- /**
- * Getter for property proportionalIcon.
- * @return Value of property proportionalIcon.
- */
- public boolean isProportionalIcon() {
- return this.proportionalIcon;
- }
-
- /**
- * Sets the way the icon is scaled. If <CODE>true</CODE> the icon is scaled proportionally,
- * if <CODE>false</CODE> the scaling is done anamorphicaly.
- * @param proportionalIcon the way the icon is scaled
- */
- public void setProportionalIcon(boolean proportionalIcon) {
- this.proportionalIcon = proportionalIcon;
- }
-
- /**
- * Getter for property iconVerticalAdjustment.
- * @return Value of property iconVerticalAdjustment.
- */
- public float getIconVerticalAdjustment() {
- return this.iconVerticalAdjustment;
- }
-
- /**
- * A number between 0 and 1 indicating the fraction of leftover space to allocate at the bottom of the icon.
- * A value of 0 positions the icon at the bottom of the annotation rectangle.
- * A value of 0.5 centers it within the rectangle. The default is 0.5.
- * @param iconVerticalAdjustment a number between 0 and 1 indicating the fraction of leftover space to allocate at the bottom of the icon
- */
- public void setIconVerticalAdjustment(float iconVerticalAdjustment) {
- if (iconVerticalAdjustment < 0)
- iconVerticalAdjustment = 0;
- else if (iconVerticalAdjustment > 1)
- iconVerticalAdjustment = 1;
- this.iconVerticalAdjustment = iconVerticalAdjustment;
- }
-
- /**
- * Getter for property iconHorizontalAdjustment.
- * @return Value of property iconHorizontalAdjustment.
- */
- public float getIconHorizontalAdjustment() {
- return this.iconHorizontalAdjustment;
- }
-
- /**
- * A number between 0 and 1 indicating the fraction of leftover space to allocate at the left of the icon.
- * A value of 0 positions the icon at the left of the annotation rectangle.
- * A value of 0.5 centers it within the rectangle. The default is 0.5.
- * @param iconHorizontalAdjustment a number between 0 and 1 indicating the fraction of leftover space to allocate at the left of the icon
- */
- public void setIconHorizontalAdjustment(float iconHorizontalAdjustment) {
- if (iconHorizontalAdjustment < 0)
- iconHorizontalAdjustment = 0;
- else if (iconHorizontalAdjustment > 1)
- iconHorizontalAdjustment = 1;
- this.iconHorizontalAdjustment = iconHorizontalAdjustment;
- }
-
- private float calculateFontSize(float w, float h) throws IOException, DocumentException {
- BaseFont ufont = getRealFont();
- float fsize = fontSize;
- if (fsize == 0) {
- float bw = ufont.getWidthPoint(text, 1);
- if (bw == 0)
- fsize = 12;
- else
- fsize = w / bw;
- float nfsize = h / (1 - ufont.getFontDescriptor(BaseFont.DESCENT, 1));
- fsize = Math.min(fsize, nfsize);
- if (fsize < 4)
- fsize = 4;
- }
- return fsize;
- }
-
- /**
- * Gets the button appearance.
- * @throws IOException on error
- * @throws DocumentException on error
- * @return the button appearance
- */
- protected PdfAppearance getAppearance() throws IOException, DocumentException {
- PdfAppearance app = getBorderAppearance();
- Rectangle box = new Rectangle(app.getBoundingBox());
- if ((text == null || text.length() == 0) && (layout == LAYOUT_LABEL_ONLY || (image == null && template == null))) {
- return app;
- }
- if (layout == LAYOUT_ICON_ONLY && image == null && template == null)
- return app;
- BaseFont ufont = getRealFont();
- boolean borderExtra = borderStyle == PdfBorderDictionary.STYLE_BEVELED || borderStyle == PdfBorderDictionary.STYLE_INSET;
- float h = box.height() - borderWidth * 2;
- float bw2 = borderWidth;
- if (borderExtra) {
- h -= borderWidth * 2;
- bw2 *= 2;
- }
- float offsetX = (borderExtra ? 2 * borderWidth : borderWidth);
- offsetX = Math.max(offsetX, 1);
- float offX = Math.min(bw2, offsetX);
- tp = null;
- Rectangle bounds = null;
- float textX = Float.NaN;
- float textY = 0;
- float fsize = fontSize;
- float wt = box.width() - 2 * offX - 2;
- float ht = box.height() - 2 * offX;
- float adj = (iconFitToBounds ? 0 : offX + 1);
- int nlayout = layout;
- if (image == null && template == null)
- nlayout = LAYOUT_LABEL_ONLY;
- Rectangle iconBox = null;
- while (true) {
- switch (nlayout) {
- case LAYOUT_LABEL_ONLY:
- case LAYOUT_LABEL_OVER_ICON:
- if (text != null && text.length() > 0 && wt > 0 && ht > 0) {
- fsize = calculateFontSize(wt, ht);
- textX = (box.width() - ufont.getWidthPoint(text, fsize)) / 2;
- textY = (box.height() - ufont.getFontDescriptor(BaseFont.ASCENT, fsize)) / 2;
- }
- case LAYOUT_ICON_ONLY:
- if (nlayout == LAYOUT_LABEL_OVER_ICON || nlayout == LAYOUT_ICON_ONLY)
- iconBox = new Rectangle(box.left() + adj, box.bottom() + adj, box.right() - adj, box.top() - adj);
- break;
- case LAYOUT_ICON_TOP_LABEL_BOTTOM:
- if (text == null || text.length() == 0 || wt <= 0 || ht <= 0) {
- nlayout = LAYOUT_ICON_ONLY;
- continue;
- }
- float nht = box.height() * 0.35f - offX;
- if (nht > 0)
- fsize = calculateFontSize(wt, nht);
- else
- fsize = 4;
- textX = (box.width() - ufont.getWidthPoint(text, fsize)) / 2;
- textY = offX - ufont.getFontDescriptor(BaseFont.DESCENT, fsize);
- iconBox = new Rectangle(box.left() + adj, textY + fsize, box.right() - adj, box.top() - adj);
- break;
- case LAYOUT_LABEL_TOP_ICON_BOTTOM:
- if (text == null || text.length() == 0 || wt <= 0 || ht <= 0) {
- nlayout = LAYOUT_ICON_ONLY;
- continue;
- }
- nht = box.height() * 0.35f - offX;
- if (nht > 0)
- fsize = calculateFontSize(wt, nht);
- else
- fsize = 4;
- textX = (box.width() - ufont.getWidthPoint(text, fsize)) / 2;
- textY = box.height() - offX - fsize;
- if (textY < offX)
- textY = offX;
- iconBox = new Rectangle(box.left() + adj, box.bottom() + adj, box.right() - adj, textY + ufont.getFontDescriptor(BaseFont.DESCENT, fsize));
- break;
- case LAYOUT_LABEL_LEFT_ICON_RIGHT:
- if (text == null || text.length() == 0 || wt <= 0 || ht <= 0) {
- nlayout = LAYOUT_ICON_ONLY;
- continue;
- }
- float nw = box.width() * 0.35f - offX;
- if (nw > 0)
- fsize = calculateFontSize(wt, nw);
- else
- fsize = 4;
- if (ufont.getWidthPoint(text, fsize) >= wt) {
- nlayout = LAYOUT_LABEL_ONLY;
- fsize = fontSize;
- continue;
- }
- textX = offX + 1;
- textY = (box.height() - ufont.getFontDescriptor(BaseFont.ASCENT, fsize)) / 2;
- iconBox = new Rectangle(textX + ufont.getWidthPoint(text, fsize), box.bottom() + adj, box.right() - adj, box.top() - adj);
- break;
- case LAYOUT_ICON_LEFT_LABEL_RIGHT:
- if (text == null || text.length() == 0 || wt <= 0 || ht <= 0) {
- nlayout = LAYOUT_ICON_ONLY;
- continue;
- }
- nw = box.width() * 0.35f - offX;
- if (nw > 0)
- fsize = calculateFontSize(wt, nw);
- else
- fsize = 4;
- if (ufont.getWidthPoint(text, fsize) >= wt) {
- nlayout = LAYOUT_LABEL_ONLY;
- fsize = fontSize;
- continue;
- }
- textX = box.width() - ufont.getWidthPoint(text, fsize) - offX - 1;
- textY = (box.height() - ufont.getFontDescriptor(BaseFont.ASCENT, fsize)) / 2;
- iconBox = new Rectangle(box.left() + adj, box.bottom() + adj, textX - 1, box.top() - adj);
- break;
- }
- break;
- }
- if (textY < box.bottom() + offX)
- textY = box.bottom() + offX;
- if (iconBox != null && (iconBox.width() <= 0 || iconBox.height() <= 0))
- iconBox = null;
- if (iconBox != null) {
- if (image != null) {
- tp = new PdfTemplate(writer);
- tp.setBoundingBox(new Rectangle(image));
- writer.addDirectTemplateSimple(tp, new PdfName("FRM"));
- tp.addImage(image, image.width(), 0, 0, image.height(), 0, 0);
- }
- else if (template != null) {
- tp = new PdfTemplate(writer);
- tp.setBoundingBox(new Rectangle(template.getWidth(), template.getHeight()));
- writer.addDirectTemplateSimple(tp, new PdfName("FRM"));
- tp.addTemplate(template, template.getBoundingBox().left(), template.getBoundingBox().bottom());
- }
- }
- if (tp != null) {
- float icx = iconBox.width() / tp.getBoundingBox().width();
- float icy = iconBox.height() / tp.getBoundingBox().height();
- if (proportionalIcon) {
- switch (scaleIcon) {
- case SCALE_ICON_IS_TOO_BIG:
- icx = Math.min(icx, icy);
- icx = Math.min(icx, 1);
- break;
- case SCALE_ICON_IS_TOO_SMALL:
- icx = Math.min(icx, icy);
- icx = Math.max(icx, 1);
- break;
- case SCALE_ICON_NEVER:
- icx = 1;
- break;
- default:
- icx = Math.min(icx, icy);
- break;
- }
- icy = icx;
- }
- else {
- switch (scaleIcon) {
- case SCALE_ICON_IS_TOO_BIG:
- icx = Math.min(icx, 1);
- icy = Math.min(icy, 1);
- break;
- case SCALE_ICON_IS_TOO_SMALL:
- icx = Math.max(icx, 1);
- icy = Math.max(icy, 1);
- break;
- case SCALE_ICON_NEVER:
- icx = icy = 1;
- break;
- default:
- break;
- }
- }
- float xpos = iconBox.left() + (iconBox.width() - (tp.getBoundingBox().width() * icx)) * iconHorizontalAdjustment;
- float ypos = iconBox.bottom() + (iconBox.height() - (tp.getBoundingBox().height() * icy)) * iconVerticalAdjustment;
- app.saveState();
- app.rectangle(iconBox.left(), iconBox.bottom(), iconBox.width(), iconBox.height());
- app.clip();
- app.newPath();
- app.addTemplate(tp, icx, 0, 0, icy, xpos, ypos);
- app.restoreState();
- }
- if (!Float.isNaN(textX)) {
- app.saveState();
- app.rectangle(offX, offX, box.width() - 2 * offX, box.height() - 2 * offX);
- app.clip();
- app.newPath();
- if (textColor == null)
- app.resetGrayFill();
- else
- app.setColorFill(textColor);
- app.beginText();
- app.setFontAndSize(ufont, fsize);
- app.setTextMatrix(textX, textY);
- app.showText(text);
- app.endText();
- app.restoreState();
- }
- return app;
- }
-
- /**
- * Gets the pushbutton field.
- * @throws IOException on error
- * @throws DocumentException on error
- * @return the pushbutton field
- */
- public PdfFormField getField() throws IOException, DocumentException {
- PdfFormField field = PdfFormField.createPushButton(writer);
- field.setWidget(box, PdfAnnotation.HIGHLIGHT_INVERT);
- if (fieldName != null) {
- field.setFieldName(fieldName);
- if ((options & READ_ONLY) != 0)
- field.setFieldFlags(PdfFormField.FF_READ_ONLY);
- if ((options & REQUIRED) != 0)
- field.setFieldFlags(PdfFormField.FF_REQUIRED);
- }
- if (text != null)
- field.setMKNormalCaption(text);
- if (rotation != 0)
- field.setMKRotation(rotation);
- field.setBorderStyle(new PdfBorderDictionary(borderWidth, borderStyle, new PdfDashPattern(3)));
- PdfAppearance tpa = getAppearance();
- field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, tpa);
- PdfAppearance da = (PdfAppearance)tpa.getDuplicate();
- da.setFontAndSize(getRealFont(), fontSize);
- if (textColor == null)
- da.setGrayFill(0);
- else
- da.setColorFill(textColor);
- field.setDefaultAppearanceString(da);
- if (borderColor != null)
- field.setMKBorderColor(borderColor);
- if (backgroundColor != null)
- field.setMKBackgroundColor(backgroundColor);
- switch (visibility) {
- case HIDDEN:
- field.setFlags(PdfAnnotation.FLAGS_PRINT | PdfAnnotation.FLAGS_HIDDEN);
- break;
- case VISIBLE_BUT_DOES_NOT_PRINT:
- break;
- case HIDDEN_BUT_PRINTABLE:
- field.setFlags(PdfAnnotation.FLAGS_PRINT | PdfAnnotation.FLAGS_NOVIEW);
- break;
- default:
- field.setFlags(PdfAnnotation.FLAGS_PRINT);
- break;
- }
- if (tp != null)
- field.setMKNormalIcon(tp);
- field.setMKTextPosition(layout - 1);
- PdfName scale = PdfName.A;
- if (scaleIcon == SCALE_ICON_IS_TOO_BIG)
- scale = PdfName.B;
- else if (scaleIcon == SCALE_ICON_IS_TOO_SMALL)
- scale = PdfName.S;
- else if (scaleIcon == SCALE_ICON_NEVER)
- scale = PdfName.N;
- field.setMKIconFit(scale, proportionalIcon ? PdfName.P : PdfName.A, iconHorizontalAdjustment,
- iconVerticalAdjustment, iconFitToBounds);
- return field;
- }
-
- /**
- * Getter for property iconFitToBounds.
- * @return Value of property iconFitToBounds.
- */
- public boolean isIconFitToBounds() {
- return this.iconFitToBounds;
- }
-
- /**
- * If <CODE>true</CODE> the icon will be scaled to fit fully within the bounds of the annotation,
- * if <CODE>false</CODE> the border width will be taken into account. The default
- * is <CODE>false</CODE>.
- * @param iconFitToBounds if <CODE>true</CODE> the icon will be scaled to fit fully within the bounds of the annotation,
- * if <CODE>false</CODE> the border width will be taken into account
- */
- public void setIconFitToBounds(boolean iconFitToBounds) {
- this.iconFitToBounds = iconFitToBounds;
- }
-
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/RadioCheckField.java b/LibrarySource/com/lowagie/text/pdf/RadioCheckField.java
deleted file mode 100644
index 4740484..0000000
--- a/LibrarySource/com/lowagie/text/pdf/RadioCheckField.java
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
- * Copyright 2005 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.ExceptionConverter;
-import com.lowagie.text.DocumentException;
-import java.io.IOException;
-
-/**
- * Creates a radio or a check field.
- * <p>
- * Example usage:
- * <p>
- * <PRE>
- * Document document = new Document(PageSize.A4, 50, 50, 50, 50);
- * PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("output.pdf"));
- * document.open();
- * PdfContentByte cb = writer.getDirectContent();
- * RadioCheckField bt = new RadioCheckField(writer, new Rectangle(100, 100, 200, 200), "radio", "v1");
- * bt.setCheckType(RadioCheckField.TYPE_CIRCLE);
- * bt.setBackgroundColor(Color.CYAN);
- * bt.setBorderStyle(PdfBorderDictionary.STYLE_SOLID);
- * bt.setBorderColor(Color.red);
- * bt.setTextColor(Color.yellow);
- * bt.setBorderWidth(BaseField.BORDER_WIDTH_THICK);
- * bt.setChecked(false);
- * PdfFormField f1 = bt.getRadioField();
- * bt.setOnValue("v2");
- * bt.setChecked(true);
- * bt.setBox(new Rectangle(100, 300, 200, 400));
- * PdfFormField f2 = bt.getRadioField();
- * bt.setChecked(false);
- * PdfFormField top = bt.getRadioGroup(true, false);
- * bt.setOnValue("v3");
- * bt.setBox(new Rectangle(100, 500, 200, 600));
- * PdfFormField f3 = bt.getRadioField();
- * top.addKid(f1);
- * top.addKid(f2);
- * top.addKid(f3);
- * writer.addAnnotation(top);
- * bt = new RadioCheckField(writer, new Rectangle(300, 300, 400, 400), "check1", "Yes");
- * bt.setCheckType(RadioCheckField.TYPE_CHECK);
- * bt.setBorderWidth(BaseField.BORDER_WIDTH_THIN);
- * bt.setBorderColor(Color.black);
- * bt.setBackgroundColor(Color.white);
- * PdfFormField ck = bt.getCheckField();
- * writer.addAnnotation(ck);
- * document.close();
- * </PRE>
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class RadioCheckField extends BaseField {
-
- /** A field with the symbol check */
- public static final int TYPE_CHECK = 1;
- /** A field with the symbol circle */
- public static final int TYPE_CIRCLE = 2;
- /** A field with the symbol cross */
- public static final int TYPE_CROSS = 3;
- /** A field with the symbol diamond */
- public static final int TYPE_DIAMOND = 4;
- /** A field with the symbol square */
- public static final int TYPE_SQUARE = 5;
- /** A field with the symbol star */
- public static final int TYPE_STAR = 6;
-
- private static String typeChars[] = {"4", "l", "8", "u", "n", "H"};
-
- /**
- * Holds value of property checkType.
- */
- private int checkType;
-
- /**
- * Holds value of property onValue.
- */
- private String onValue;
-
- /**
- * Holds value of property checked.
- */
- private boolean checked;
-
- /**
- * Creates a new instance of RadioCheckField
- * @param writer the document <CODE>PdfWriter</CODE>
- * @param box the field location and dimensions
- * @param fieldName the field name. It must not be <CODE>null</CODE>
- * @param onValue the value when the field is checked
- */
- public RadioCheckField(PdfWriter writer, Rectangle box, String fieldName, String onValue) {
- super(writer, box, fieldName);
- setOnValue(onValue);
- setCheckType(TYPE_CIRCLE);
- }
-
- /**
- * Getter for property checkType.
- * @return Value of property checkType.
- */
- public int getCheckType() {
- return this.checkType;
- }
-
- /**
- * Sets the checked symbol. It can be
- * <CODE>TYPE_CHECK</CODE>,
- * <CODE>TYPE_CIRCLE</CODE>,
- * <CODE>TYPE_CROSS</CODE>,
- * <CODE>TYPE_DIAMOND</CODE>,
- * <CODE>TYPE_SQUARE</CODE> and
- * <CODE>TYPE_STAR</CODE>.
- * @param checkType the checked symbol
- */
- public void setCheckType(int checkType) {
- if (checkType < TYPE_CHECK || checkType > TYPE_STAR)
- checkType = TYPE_CIRCLE;
- this.checkType = checkType;
- setText(typeChars[checkType - 1]);
- try {
- setFont(BaseFont.createFont(BaseFont.ZAPFDINGBATS, BaseFont.WINANSI, false));
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- /**
- * Getter for property onValue.
- * @return Value of property onValue.
- */
- public String getOnValue() {
- return this.onValue;
- }
-
- /**
- * Sets the value when the field is checked.
- * @param onValue the value when the field is checked
- */
- public void setOnValue(String onValue) {
- this.onValue = onValue;
- }
-
- /**
- * Getter for property checked.
- * @return Value of property checked.
- */
- public boolean isChecked() {
- return this.checked;
- }
-
- /**
- * Sets the state of the field to checked or unchecked.
- * @param checked the state of the field, <CODE>true</CODE> for checked
- * and <CODE>false</CODE> for unchecked
- */
- public void setChecked(boolean checked) {
- this.checked = checked;
- }
-
- /**
- * Gets the field appearance.
- * @param isRadio <CODE>true</CODE> for a radio field and <CODE>false</CODE>
- * for a check field
- * @param on <CODE>true</CODE> for the checked state, <CODE>false</CODE>
- * otherwise
- * @throws IOException on error
- * @throws DocumentException on error
- * @return the appearance
- */
- public PdfAppearance getAppearance(boolean isRadio, boolean on) throws IOException, DocumentException {
- if (isRadio && checkType == TYPE_CIRCLE)
- return getAppearanceRadioCircle(on);
- PdfAppearance app = getBorderAppearance();
- if (!on)
- return app;
- BaseFont ufont = getRealFont();
- boolean borderExtra = borderStyle == PdfBorderDictionary.STYLE_BEVELED || borderStyle == PdfBorderDictionary.STYLE_INSET;
- float h = box.height() - borderWidth * 2;
- float bw2 = borderWidth;
- if (borderExtra) {
- h -= borderWidth * 2;
- bw2 *= 2;
- }
- float offsetX = (borderExtra ? 2 * borderWidth : borderWidth);
- offsetX = Math.max(offsetX, 1);
- float offX = Math.min(bw2, offsetX);
- float wt = box.width() - 2 * offX;
- float ht = box.height() - 2 * offX;
- float fsize = fontSize;
- if (fsize == 0) {
- float bw = ufont.getWidthPoint(text, 1);
- if (bw == 0)
- fsize = 12;
- else
- fsize = wt / bw;
- float nfsize = h / (ufont.getFontDescriptor(BaseFont.ASCENT, 1));
- fsize = Math.min(fsize, nfsize);
- }
- app.saveState();
- app.rectangle(offX, offX, box.width() - 2 * offX, box.height() - 2 * offX);
- app.clip();
- app.newPath();
- if (textColor == null)
- app.resetGrayFill();
- else
- app.setColorFill(textColor);
- app.beginText();
- app.setFontAndSize(ufont, fsize);
- app.setTextMatrix((box.width() - ufont.getWidthPoint(text, fsize)) / 2,
- (box.height() - ufont.getAscentPoint(text, fsize)) / 2);
- app.showText(text);
- app.endText();
- app.restoreState();
- return app;
- }
-
- /**
- * Gets the special field appearance for the radio circle.
- * @param on <CODE>true</CODE> for the checked state, <CODE>false</CODE>
- * otherwise
- * @return the appearance
- */
- public PdfAppearance getAppearanceRadioCircle(boolean on) {
- PdfAppearance app = writer.getDirectContent().createAppearance(box.width(), box.height());
- switch (rotation) {
- case 90:
- app.setMatrix(0, 1, -1, 0, box.height(), 0);
- break;
- case 180:
- app.setMatrix(-1, 0, 0, -1, box.width(), box.height());
- break;
- case 270:
- app.setMatrix(0, -1, 1, 0, 0, box.width());
- break;
- }
- Rectangle box = new Rectangle(app.getBoundingBox());
- float cx = box.width() / 2;
- float cy = box.height() / 2;
- float r = (Math.min(box.width(), box.height()) - borderWidth) / 2;
- if (r <= 0)
- return app;
- if (backgroundColor != null) {
- app.setColorFill(backgroundColor);
- app.circle(cx, cy, r + borderWidth / 2);
- app.fill();
- }
- if (borderWidth > 0 && borderColor != null) {
- app.setLineWidth(borderWidth);
- app.setColorStroke(borderColor);
- app.circle(cx, cy, r);
- app.stroke();
- }
- if (on) {
- if (textColor == null)
- app.resetGrayFill();
- else
- app.setColorFill(textColor);
- app.circle(cx, cy, r / 2);
- app.fill();
- }
- return app;
- }
-
- /**
- * Gets a radio group. It's composed of the field specific keys, without the widget
- * ones. This field is to be used as a field aggregator with {@link PdfFormField#addKid(PdfFormField) addKid()}.
- * @param noToggleToOff if <CODE>true</CODE>, exactly one radio button must be selected at all
- * times; clicking the currently selected button has no effect.
- * If <CODE>false</CODE>, clicking
- * the selected button deselects it, leaving no button selected.
- * @param radiosInUnison if <CODE>true</CODE>, a group of radio buttons within a radio button field that
- * use the same value for the on state will turn on and off in unison; that is if
- * one is checked, they are all checked. If <CODE>false</CODE>, the buttons are mutually exclusive
- * (the same behavior as HTML radio buttons)
- * @return the radio group
- */
- public PdfFormField getRadioGroup(boolean noToggleToOff, boolean radiosInUnison) {
- PdfFormField field = PdfFormField.createRadioButton(writer, noToggleToOff);
- if (radiosInUnison)
- field.setFieldFlags(PdfFormField.FF_RADIOSINUNISON);
- field.setFieldName(fieldName);
- if ((options & READ_ONLY) != 0)
- field.setFieldFlags(PdfFormField.FF_READ_ONLY);
- if ((options & REQUIRED) != 0)
- field.setFieldFlags(PdfFormField.FF_REQUIRED);
- field.setValueAsName(checked ? onValue : "Off");
- return field;
- }
-
- /**
- * Gets the radio field. It's only composed of the widget keys and must be used
- * with {@link #getRadioGroup(boolean,boolean)}.
- * @return the radio field
- * @throws IOException on error
- * @throws DocumentException on error
- */
- public PdfFormField getRadioField() throws IOException, DocumentException {
- return getField(true);
- }
-
- /**
- * Gets the check field.
- * @return the check field
- * @throws IOException on error
- * @throws DocumentException on error
- */
- public PdfFormField getCheckField() throws IOException, DocumentException {
- return getField(false);
- }
-
- /**
- * Gets a radio or check field.
- * @param isRadio <CODE>true</CODE> to get a radio field, <CODE>false</CODE> to get
- * a check field
- * @throws IOException on error
- * @throws DocumentException on error
- * @return the field
- */
- protected PdfFormField getField(boolean isRadio) throws IOException, DocumentException {
- PdfFormField field = null;
- if (isRadio)
- field = PdfFormField.createEmpty(writer);
- else
- field = PdfFormField.createCheckBox(writer);
- field.setWidget(box, PdfAnnotation.HIGHLIGHT_INVERT);
- if (!isRadio) {
- field.setFieldName(fieldName);
- if ((options & READ_ONLY) != 0)
- field.setFieldFlags(PdfFormField.FF_READ_ONLY);
- if ((options & REQUIRED) != 0)
- field.setFieldFlags(PdfFormField.FF_REQUIRED);
- field.setValueAsName(checked ? onValue : "Off");
- }
- if (text != null)
- field.setMKNormalCaption(text);
- if (rotation != 0)
- field.setMKRotation(rotation);
- field.setBorderStyle(new PdfBorderDictionary(borderWidth, borderStyle, new PdfDashPattern(3)));
- PdfAppearance tpon = getAppearance(isRadio, true);
- PdfAppearance tpoff = getAppearance(isRadio, false);
- field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, onValue, tpon);
- field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpoff);
- field.setAppearanceState(checked ? onValue : "Off");
- PdfAppearance da = (PdfAppearance)tpon.getDuplicate();
- da.setFontAndSize(getRealFont(), fontSize);
- if (textColor == null)
- da.setGrayFill(0);
- else
- da.setColorFill(textColor);
- field.setDefaultAppearanceString(da);
- if (borderColor != null)
- field.setMKBorderColor(borderColor);
- if (backgroundColor != null)
- field.setMKBackgroundColor(backgroundColor);
- switch (visibility) {
- case HIDDEN:
- field.setFlags(PdfAnnotation.FLAGS_PRINT | PdfAnnotation.FLAGS_HIDDEN);
- break;
- case VISIBLE_BUT_DOES_NOT_PRINT:
- break;
- case HIDDEN_BUT_PRINTABLE:
- field.setFlags(PdfAnnotation.FLAGS_PRINT | PdfAnnotation.FLAGS_NOVIEW);
- break;
- default:
- field.setFlags(PdfAnnotation.FLAGS_PRINT);
- break;
- }
- return field;
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/RandomAccessFileOrArray.java b/LibrarySource/com/lowagie/text/pdf/RandomAccessFileOrArray.java
deleted file mode 100644
index 908a09f..0000000
--- a/LibrarySource/com/lowagie/text/pdf/RandomAccessFileOrArray.java
+++ /dev/null
@@ -1,594 +0,0 @@
-/*
- * $Id: RandomAccessFileOrArray.java,v 1.11 2002/06/20 13:30:25 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.DataInputStream;
-import java.io.DataInput;
-import java.io.IOException;
-import java.io.EOFException;
-import java.io.RandomAccessFile;
-import java.io.File;
-import java.io.InputStream;
-import java.io.ByteArrayOutputStream;
-import java.net.URL;
-/** An implementation of a RandomAccessFile for input only
- * that accepts a file or a byte array as data source.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class RandomAccessFileOrArray implements DataInput {
-
- RandomAccessFile rf;
- String filename;
- byte arrayIn[];
- int arrayInPtr;
- byte back;
- boolean isBack = false;
-
- /** Holds value of property startOffset. */
- private int startOffset = 0;
-
- public RandomAccessFileOrArray(String filename) throws IOException {
- File file = new File(filename);
- if (!file.canRead()) {
- if (filename.startsWith("file:/") || filename.startsWith("http://") || filename.startsWith("https://") || filename.startsWith("jar:")) {
- InputStream is = new URL(filename).openStream();
- try {
- this.arrayIn = InputStreamToArray(is);
- return;
- }
- finally {
- try {is.close();}catch(IOException ioe){}
- }
- }
- else {
- InputStream is = BaseFont.getResourceStream(filename);
- if (is == null)
- throw new IOException(filename + " not found as file or resource.");
- try {
- this.arrayIn = InputStreamToArray(is);
- return;
- }
- finally {
- try {is.close();}catch(IOException ioe){}
- }
- }
- }
- this.filename = filename;
- rf = new RandomAccessFile(filename, "r");
- }
-
- public RandomAccessFileOrArray(URL url) throws IOException {
- InputStream is = url.openStream();
- try {
- this.arrayIn = InputStreamToArray(is);
- }
- finally {
- try {is.close();}catch(IOException ioe){}
- }
- }
-
- public RandomAccessFileOrArray(InputStream is) throws IOException {
- this.arrayIn = InputStreamToArray(is);
- }
-
- public byte[] InputStreamToArray(InputStream is) throws IOException {
- byte b[] = new byte[8192];
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- while (true) {
- int read = is.read(b);
- if (read < 1)
- break;
- out.write(b, 0, read);
- }
- return out.toByteArray();
- }
-
- public RandomAccessFileOrArray(byte arrayIn[]) {
- this.arrayIn = arrayIn;
- }
-
- public RandomAccessFileOrArray(RandomAccessFileOrArray file) {
- filename = file.filename;
- arrayIn = file.arrayIn;
- startOffset = file.startOffset;
- }
-
- public void pushBack(byte b) {
- back = b;
- isBack = true;
- }
-
- public int read() throws IOException {
- if(isBack) {
- isBack = false;
- return back & 0xff;
- }
- if (arrayIn == null)
- return rf.read();
- else {
- if (arrayInPtr >= arrayIn.length)
- return -1;
- return arrayIn[arrayInPtr++] & 0xff;
- }
- }
-
- public int read(byte[] b, int off, int len) throws IOException {
- if (len == 0)
- return 0;
- int n = 0;
- if (isBack) {
- isBack = false;
- if (len == 1) {
- b[off] = back;
- return 1;
- }
- else {
- n = 1;
- b[off++] = back;
- --len;
- }
- }
- if (arrayIn == null) {
- return rf.read(b, off, len) + n;
- }
- else {
- if (arrayInPtr >= arrayIn.length)
- return -1;
- if (arrayInPtr + len > arrayIn.length)
- len = arrayIn.length - arrayInPtr;
- System.arraycopy(arrayIn, arrayInPtr, b, off, len);
- arrayInPtr += len;
- return len + n;
- }
- }
-
- public int read(byte b[]) throws IOException {
- return read(b, 0, b.length);
- }
-
- public void readFully(byte b[]) throws IOException {
- readFully(b, 0, b.length);
- }
-
- public void readFully(byte b[], int off, int len) throws IOException {
- int n = 0;
- do {
- int count = read(b, off + n, len - n);
- if (count < 0)
- throw new EOFException();
- n += count;
- } while (n < len);
- }
-
- public long skip(long n) throws IOException {
- return skipBytes((int)n);
- }
-
- public int skipBytes(int n) throws IOException {
- if (n <= 0) {
- return 0;
- }
- int adj = 0;
- if (isBack) {
- isBack = false;
- if (n == 1) {
- return 1;
- }
- else {
- --n;
- adj = 1;
- }
- }
- int pos;
- int len;
- int newpos;
-
- pos = getFilePointer();
- len = length();
- newpos = pos + n;
- if (newpos > len) {
- newpos = len;
- }
- seek(newpos);
-
- /* return the actual number of bytes skipped */
- return newpos - pos + adj;
- }
-
- public void reOpen() throws IOException {
- if (filename != null && rf == null)
- rf = new RandomAccessFile(filename, "r");
- seek(0);
- }
-
- protected void insureOpen() throws IOException {
- if (filename != null && rf == null) {
- reOpen();
- }
- }
-
- public boolean isOpen() {
- return (filename == null || rf != null);
- }
-
- public void close() throws IOException {
- isBack = false;
- if (rf != null) {
- rf.close();
- rf = null;
- }
- }
-
- public int length() throws IOException {
- if (arrayIn == null) {
- insureOpen();
- return (int)rf.length() - startOffset;
- }
- else
- return arrayIn.length - startOffset;
- }
-
- public void seek(int pos) throws IOException {
- pos += startOffset;
- isBack = false;
- if (arrayIn == null) {
- insureOpen();
- rf.seek(pos);
- }
- else
- arrayInPtr = pos;
- }
-
- public void seek(long pos) throws IOException {
- seek((int)pos);
- }
-
- public int getFilePointer() throws IOException {
- insureOpen();
- int n = isBack ? 1 : 0;
- if (arrayIn == null) {
- return (int)rf.getFilePointer() - n - startOffset;
- }
- else
- return arrayInPtr - n - startOffset;
- }
-
- public boolean readBoolean() throws IOException {
- int ch = this.read();
- if (ch < 0)
- throw new EOFException();
- return (ch != 0);
- }
-
- public byte readByte() throws IOException {
- int ch = this.read();
- if (ch < 0)
- throw new EOFException();
- return (byte)(ch);
- }
-
- public int readUnsignedByte() throws IOException {
- int ch = this.read();
- if (ch < 0)
- throw new EOFException();
- return ch;
- }
-
- public short readShort() throws IOException {
- int ch1 = this.read();
- int ch2 = this.read();
- if ((ch1 | ch2) < 0)
- throw new EOFException();
- return (short)((ch1 << 8) + ch2);
- }
-
- /**
- * Reads a signed 16-bit number from this stream in little-endian order.
- * The method reads two
- * bytes from this stream, starting at the current stream pointer.
- * If the two bytes read, in order, are
- * <code>b1</code> and <code>b2</code>, where each of the two values is
- * between <code>0</code> and <code>255</code>, inclusive, then the
- * result is equal to:
- * <blockquote><pre>
- * (short)((b2 << 8) | b1)
- * </pre></blockquote>
- * <p>
- * This method blocks until the two bytes are read, the end of the
- * stream is detected, or an exception is thrown.
- *
- * @return the next two bytes of this stream, interpreted as a signed
- * 16-bit number.
- * @exception EOFException if this stream reaches the end before reading
- * two bytes.
- * @exception IOException if an I/O error occurs.
- */
- public final short readShortLE() throws IOException {
- int ch1 = this.read();
- int ch2 = this.read();
- if ((ch1 | ch2) < 0)
- throw new EOFException();
- return (short)((ch2 << 8) + (ch1 << 0));
- }
-
- public int readUnsignedShort() throws IOException {
- int ch1 = this.read();
- int ch2 = this.read();
- if ((ch1 | ch2) < 0)
- throw new EOFException();
- return (ch1 << 8) + ch2;
- }
-
- /**
- * Reads an unsigned 16-bit number from this stream in little-endian order.
- * This method reads
- * two bytes from the stream, starting at the current stream pointer.
- * If the bytes read, in order, are
- * <code>b1</code> and <code>b2</code>, where
- * <code>0 <= b1, b2 <= 255</code>,
- * then the result is equal to:
- * <blockquote><pre>
- * (b2 << 8) | b1
- * </pre></blockquote>
- * <p>
- * This method blocks until the two bytes are read, the end of the
- * stream is detected, or an exception is thrown.
- *
- * @return the next two bytes of this stream, interpreted as an
- * unsigned 16-bit integer.
- * @exception EOFException if this stream reaches the end before reading
- * two bytes.
- * @exception IOException if an I/O error occurs.
- */
- public final int readUnsignedShortLE() throws IOException {
- int ch1 = this.read();
- int ch2 = this.read();
- if ((ch1 | ch2) < 0)
- throw new EOFException();
- return (ch2 << 8) + (ch1 << 0);
- }
-
- public char readChar() throws IOException {
- int ch1 = this.read();
- int ch2 = this.read();
- if ((ch1 | ch2) < 0)
- throw new EOFException();
- return (char)((ch1 << 8) + ch2);
- }
-
- /**
- * Reads a Unicode character from this stream in little-endian order.
- * This method reads two
- * bytes from the stream, starting at the current stream pointer.
- * If the bytes read, in order, are
- * <code>b1</code> and <code>b2</code>, where
- * <code>0 <= b1, b2 <= 255</code>,
- * then the result is equal to:
- * <blockquote><pre>
- * (char)((b2 << 8) | b1)
- * </pre></blockquote>
- * <p>
- * This method blocks until the two bytes are read, the end of the
- * stream is detected, or an exception is thrown.
- *
- * @return the next two bytes of this stream as a Unicode character.
- * @exception EOFException if this stream reaches the end before reading
- * two bytes.
- * @exception IOException if an I/O error occurs.
- */
- public final char readCharLE() throws IOException {
- int ch1 = this.read();
- int ch2 = this.read();
- if ((ch1 | ch2) < 0)
- throw new EOFException();
- return (char)((ch2 << 8) + (ch1 << 0));
- }
-
- public int readInt() throws IOException {
- int ch1 = this.read();
- int ch2 = this.read();
- int ch3 = this.read();
- int ch4 = this.read();
- if ((ch1 | ch2 | ch3 | ch4) < 0)
- throw new EOFException();
- return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + ch4);
- }
-
- /**
- * Reads a signed 32-bit integer from this stream in little-endian order.
- * This method reads 4
- * bytes from the stream, starting at the current stream pointer.
- * If the bytes read, in order, are <code>b1</code>,
- * <code>b2</code>, <code>b3</code>, and <code>b4</code>, where
- * <code>0 <= b1, b2, b3, b4 <= 255</code>,
- * then the result is equal to:
- * <blockquote><pre>
- * (b4 << 24) | (b3 << 16) + (b2 << 8) + b1
- * </pre></blockquote>
- * <p>
- * This method blocks until the four bytes are read, the end of the
- * stream is detected, or an exception is thrown.
- *
- * @return the next four bytes of this stream, interpreted as an
- * <code>int</code>.
- * @exception EOFException if this stream reaches the end before reading
- * four bytes.
- * @exception IOException if an I/O error occurs.
- */
- public final int readIntLE() throws IOException {
- int ch1 = this.read();
- int ch2 = this.read();
- int ch3 = this.read();
- int ch4 = this.read();
- if ((ch1 | ch2 | ch3 | ch4) < 0)
- throw new EOFException();
- return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0));
- }
-
- /**
- * Reads an unsigned 32-bit integer from this stream. This method reads 4
- * bytes from the stream, starting at the current stream pointer.
- * If the bytes read, in order, are <code>b1</code>,
- * <code>b2</code>, <code>b3</code>, and <code>b4</code>, where
- * <code>0 <= b1, b2, b3, b4 <= 255</code>,
- * then the result is equal to:
- * <blockquote><pre>
- * (b1 << 24) | (b2 << 16) + (b3 << 8) + b4
- * </pre></blockquote>
- * <p>
- * This method blocks until the four bytes are read, the end of the
- * stream is detected, or an exception is thrown.
- *
- * @return the next four bytes of this stream, interpreted as a
- * <code>long</code>.
- * @exception EOFException if this stream reaches the end before reading
- * four bytes.
- * @exception IOException if an I/O error occurs.
- */
- public final long readUnsignedInt() throws IOException {
- long ch1 = this.read();
- long ch2 = this.read();
- long ch3 = this.read();
- long ch4 = this.read();
- if ((ch1 | ch2 | ch3 | ch4) < 0)
- throw new EOFException();
- return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0));
- }
-
- public final long readUnsignedIntLE() throws IOException {
- long ch1 = this.read();
- long ch2 = this.read();
- long ch3 = this.read();
- long ch4 = this.read();
- if ((ch1 | ch2 | ch3 | ch4) < 0)
- throw new EOFException();
- return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0));
- }
-
- public long readLong() throws IOException {
- return ((long)(readInt()) << 32) + (readInt() & 0xFFFFFFFFL);
- }
-
- public final long readLongLE() throws IOException {
- int i1 = readIntLE();
- int i2 = readIntLE();
- return ((long)i2 << 32) + (i1 & 0xFFFFFFFFL);
- }
-
- public float readFloat() throws IOException {
- return Float.intBitsToFloat(readInt());
- }
-
- public final float readFloatLE() throws IOException {
- return Float.intBitsToFloat(readIntLE());
- }
-
- public double readDouble() throws IOException {
- return Double.longBitsToDouble(readLong());
- }
-
- public final double readDoubleLE() throws IOException {
- return Double.longBitsToDouble(readLongLE());
- }
-
- public String readLine() throws IOException {
- StringBuffer input = new StringBuffer();
- int c = -1;
- boolean eol = false;
-
- while (!eol) {
- switch (c = read()) {
- case -1:
- case '\n':
- eol = true;
- break;
- case '\r':
- eol = true;
- int cur = getFilePointer();
- if ((read()) != '\n') {
- seek(cur);
- }
- break;
- default:
- input.append((char)c);
- break;
- }
- }
-
- if ((c == -1) && (input.length() == 0)) {
- return null;
- }
- return input.toString();
- }
-
- public String readUTF() throws IOException {
- return DataInputStream.readUTF(this);
- }
-
- /** Getter for property startOffset.
- * @return Value of property startOffset.
- *
- */
- public int getStartOffset() {
- return this.startOffset;
- }
-
- /** Setter for property startOffset.
- * @param startOffset New value of property startOffset.
- *
- */
- public void setStartOffset(int startOffset) {
- this.startOffset = startOffset;
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/SequenceList.java b/LibrarySource/com/lowagie/text/pdf/SequenceList.java
deleted file mode 100644
index c1c336d..0000000
--- a/LibrarySource/com/lowagie/text/pdf/SequenceList.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Copyright 2004 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import java.util.List;
-import java.util.LinkedList;
-import java.util.ListIterator;
-
-/**
- * This class expands a string into a list of numbers. The main use is to select a
- * range of pages.
- * <p>
- * The general systax is:<br>
- * [!][o][odd][e][even]start-end
- * <p>
- * You can have multiple ranges separated by commas ','. The '!' modifier removes the
- * range from what is already selected. The range changes are incremental, that is,
- * numbers are added or deleted as the range appears. The start or the end, but not both, can be ommited.
- */
-public class SequenceList {
- protected static final int COMMA = 1;
- protected static final int MINUS = 2;
- protected static final int NOT = 3;
- protected static final int TEXT = 4;
- protected static final int NUMBER = 5;
- protected static final int END = 6;
- protected static final char EOT = '\uffff';
-
- private static final int FIRST = 0;
- private static final int DIGIT = 1;
- private static final int OTHER = 2;
- private static final int DIGIT2 = 3;
- private static final String NOT_OTHER = "-,!0123456789";
-
- protected char text[];
- protected int ptr;
- protected int number;
- protected String other;
-
- protected int low;
- protected int high;
- protected boolean odd;
- protected boolean even;
- protected boolean inverse;
-
- protected SequenceList(String range) {
- ptr = 0;
- text = range.toCharArray();
- }
-
- protected char nextChar() {
- while (true) {
- if (ptr >= text.length)
- return EOT;
- char c = text[ptr++];
- if (c > ' ')
- return c;
- }
- }
-
- protected void putBack() {
- --ptr;
- if (ptr < 0)
- ptr = 0;
- }
-
- protected int getType() {
- StringBuffer buf = new StringBuffer();
- int state = FIRST;
- while (true) {
- char c = nextChar();
- if (c == EOT) {
- if (state == DIGIT) {
- number = Integer.parseInt(other = buf.toString());
- return NUMBER;
- }
- else if (state == OTHER) {
- other = buf.toString().toLowerCase();
- return TEXT;
- }
- return END;
- }
- switch (state) {
- case FIRST:
- switch (c) {
- case '!':
- return NOT;
- case '-':
- return MINUS;
- case ',':
- return COMMA;
- }
- buf.append(c);
- if (c >= '0' && c <= '9')
- state = DIGIT;
- else
- state = OTHER;
- break;
- case DIGIT:
- if (c >= '0' && c <= '9')
- buf.append(c);
- else {
- putBack();
- number = Integer.parseInt(other = buf.toString());
- return NUMBER;
- }
- break;
- case OTHER:
- if (NOT_OTHER.indexOf(c) < 0)
- buf.append(c);
- else {
- putBack();
- other = buf.toString().toLowerCase();
- return TEXT;
- }
- break;
- }
- }
- }
-
- private void otherProc() {
- if (other.equals("odd") || other.equals("o")) {
- odd = true;
- even = false;
- }
- else if (other.equals("even") || other.equals("e")) {
- odd = false;
- even = true;
- }
- }
-
- protected boolean getAttributes() {
- low = -1;
- high = -1;
- odd = even = inverse = false;
- int state = OTHER;
- while (true) {
- int type = getType();
- if (type == END || type == COMMA) {
- if (state == DIGIT)
- high = low;
- return (type == END);
- }
- switch (state) {
- case OTHER:
- switch (type) {
- case NOT:
- inverse = true;
- break;
- case MINUS:
- state = DIGIT2;
- break;
- default:
- if (type == NUMBER) {
- low = number;
- state = DIGIT;
- }
- else
- otherProc();
- break;
- }
- break;
- case DIGIT:
- switch (type) {
- case NOT:
- inverse = true;
- state = OTHER;
- high = low;
- break;
- case MINUS:
- state = DIGIT2;
- break;
- default:
- high = low;
- state = OTHER;
- otherProc();
- break;
- }
- break;
- case DIGIT2:
- switch (type) {
- case NOT:
- inverse = true;
- state = OTHER;
- break;
- case MINUS:
- break;
- case NUMBER:
- high = number;
- state = OTHER;
- break;
- default:
- state = OTHER;
- otherProc();
- break;
- }
- break;
- }
- }
- }
-
- /**
- * Generates a list of numbers from a string.
- * @param ranges the comma separated ranges
- * @param maxNumber the maximum number in the range
- * @return a list with the numbers as <CODE>Integer</CODE>
- */
- public static List expand(String ranges, int maxNumber) {
- SequenceList parse = new SequenceList(ranges);
- LinkedList list = new LinkedList();
- boolean sair = false;
- while (!sair) {
- sair = parse.getAttributes();
- if (parse.low == -1 && parse.high == -1)
- continue;
- if (parse.low < 1)
- parse.low = 1;
- if (parse.high < 1 || parse.high > maxNumber)
- parse.high = maxNumber;
- if (parse.low > maxNumber)
- parse.low = maxNumber;
-
- //System.out.println("low="+parse.low+",high="+parse.high+",odd="+parse.odd+",even="+parse.even+",inverse="+parse.inverse);
- int inc = 1;
- if (parse.inverse) {
- if (parse.low > parse.high) {
- int t = parse.low;
- parse.low = parse.high;
- parse.high = t;
- }
- for (ListIterator it = list.listIterator(); it.hasNext();) {
- int n = ((Integer)it.next()).intValue();
- if (parse.even && (n & 1) == 1)
- continue;
- if (parse.odd && (n & 1) == 0)
- continue;
- if (n >= parse.low && n <= parse.high)
- it.remove();
- }
- }
- else {
- if (parse.low > parse.high) {
- inc = -1;
- if (parse.odd || parse.even) {
- --inc;
- if (parse.even)
- parse.low &= ~1;
- else
- parse.low -= ((parse.low & 1) == 1 ? 0 : 1);
- }
- for (int k = parse.low; k >= parse.high; k += inc)
- list.add(new Integer(k));
- }
- else {
- if (parse.odd || parse.even) {
- ++inc;
- if (parse.odd)
- parse.low |= 1;
- else
- parse.low += ((parse.low & 1) == 1 ? 1 : 0);
- }
- for (int k = parse.low; k <= parse.high; k += inc)
- list.add(new Integer(k));
- }
- }
-// for (int k = 0; k < list.size(); ++k)
-// System.out.print(((Integer)list.get(k)).intValue() + ",");
-// System.out.println();
- }
- return list;
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/ShadingColor.java b/LibrarySource/com/lowagie/text/pdf/ShadingColor.java
deleted file mode 100644
index 1727c85..0000000
--- a/LibrarySource/com/lowagie/text/pdf/ShadingColor.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/** Implements a shading pattern as a <code>Color</code>.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class ShadingColor extends ExtendedColor {
-
- PdfShadingPattern shadingPattern;
-
- /**
- * Creates a shading color.
- * @param shadingPattern
- */
- public ShadingColor(PdfShadingPattern shadingPattern) {
- super(TYPE_SHADING, .5f, .5f, .5f);
- this.shadingPattern = shadingPattern;
- }
-
- /**
- * Gets the shading pattern.
- * @return a shading pattern.
- */
- public PdfShadingPattern getPdfShadingPattern() {
- return shadingPattern;
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/SimpleBookmark.java b/LibrarySource/com/lowagie/text/pdf/SimpleBookmark.java
deleted file mode 100644
index a8c34d0..0000000
--- a/LibrarySource/com/lowagie/text/pdf/SimpleBookmark.java
+++ /dev/null
@@ -1,745 +0,0 @@
-/*
- * Copyright 2003 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.StringTokenizer;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.InputStream;
-import java.io.Writer;
-import java.io.Reader;
-import java.io.BufferedWriter;
-import java.io.OutputStreamWriter;
-import java.util.Stack;
-/**
- * Bookmark processing in a simple way. It has some limitations, mainly the only
- * action types supported are GoTo, GoToR, URI and Launch.
- * <p>
- * The list structure is composed by a number of HashMap, keyed by strings, one HashMap
- * for each bookmark.
- * The element values are all strings with the exception of the key "Kids" that has
- * another list for the child bookmarks.
- * <p>
- * All the bookmarks have a "Title" with the
- * bookmark title and optionally a "Style" that can be "bold", "italic" or a
- * combination of both. They can also have a "Color" key with a value of three
- * floats separated by spaces. The key "Open" can have the values "true" or "false" and
- * signals the open status of the children. It's "true" by default.
- * <p>
- * The actions and the parameters can be:
- * <ul>
- * <li>"Action" = "GoTo" - "Page" | "Named"
- * <ul>
- * <li>"Page" = "3 XYZ 70 400 null" - page number followed by a destination (/XYZ is also accepted)
- * <li>"Named" = "named_destination"
- * </ul>
- * <li>"Action" = "GoToR" - "Page" | "Named" | "NamedN", "File", ["NewWindow"]
- * <ul>
- * <li>"Page" = "3 XYZ 70 400 null" - page number followed by a destination (/XYZ is also accepted)
- * <li>"Named" = "named_destination_as_a_string"
- * <li>"NamedN" = "named_destination_as_a_name"
- * <li>"File" - "the_file_to_open"
- * <li>"NewWindow" - "true" or "false"
- * </ul>
- * <li>"Action" = "URI" - "URI"
- * <ul>
- * <li>"URI" = "http://sf.net" - URI to jump to
- * </ul>
- * <li>"Action" = "Launch" - "File"
- * <ul>
- * <li>"File" - "the_file_to_open_or_execute"
- * </ul>
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class SimpleBookmark implements SimpleXMLDocHandler {
-
- private ArrayList topList;
- private Stack attr = new Stack();
-
- /** Creates a new instance of SimpleBookmark */
- private SimpleBookmark() {
- }
-
- private static List bookmarkDepth(PdfReader reader, PdfDictionary outline, IntHashtable pages) {
- ArrayList list = new ArrayList();
- while (outline != null) {
- HashMap map = new HashMap();
- PdfString title = (PdfString)PdfReader.getPdfObjectRelease(outline.get(PdfName.TITLE));
- map.put("Title", title.toUnicodeString());
- PdfArray color = (PdfArray)PdfReader.getPdfObjectRelease(outline.get(PdfName.C));
- if (color != null && color.getArrayList().size() == 3) {
- ByteBuffer out = new ByteBuffer();
- ArrayList arr = color.getArrayList();
- out.append(((PdfNumber)arr.get(0)).floatValue()).append(' ');
- out.append(((PdfNumber)arr.get(1)).floatValue()).append(' ');
- out.append(((PdfNumber)arr.get(2)).floatValue());
- map.put("Color", PdfEncodings.convertToString(out.toByteArray(), null));
- }
- PdfNumber style = (PdfNumber)PdfReader.getPdfObjectRelease(outline.get(PdfName.F));
- if (style != null) {
- int f = style.intValue();
- String s = "";
- if ((f & 1) != 0)
- s += "italic ";
- if ((f & 2) != 0)
- s += "bold ";
- s = s.trim();
- if (s.length() != 0)
- map.put("Style", s);
- }
- PdfNumber count = (PdfNumber)PdfReader.getPdfObjectRelease(outline.get(PdfName.COUNT));
- if (count != null && count.intValue() < 0)
- map.put("Open", "false");
- try {
- PdfObject dest = PdfReader.getPdfObjectRelease(outline.get(PdfName.DEST));
- if (dest != null) {
- mapGotoBookmark(map, dest, pages); //changed by ujihara 2004-06-13
- }
- else {
- PdfDictionary action = (PdfDictionary)PdfReader.getPdfObjectRelease(outline.get(PdfName.A));
- if (action != null) {
- if (PdfName.GOTO.equals(PdfReader.getPdfObjectRelease(action.get(PdfName.S)))) {
- dest = PdfReader.getPdfObjectRelease(action.get(PdfName.D));
- if (dest != null) {
- mapGotoBookmark(map, dest, pages);
- }
- }
- else if (PdfName.URI.equals(PdfReader.getPdfObjectRelease(action.get(PdfName.S)))) {
- map.put("Action", "URI");
- map.put("URI", ((PdfString)PdfReader.getPdfObjectRelease(action.get(PdfName.URI))).toUnicodeString());
- }
- else if (PdfName.GOTOR.equals(PdfReader.getPdfObjectRelease(action.get(PdfName.S)))) {
- dest = PdfReader.getPdfObjectRelease(action.get(PdfName.D));
- if (dest != null) {
- if (dest.isString())
- map.put("Named", dest.toString());
- else if (dest.isName())
- map.put("NamedN", PdfName.decodeName(dest.toString()));
- else if (dest.isArray()) {
- ArrayList arr = ((PdfArray)dest).getArrayList();
- StringBuffer s = new StringBuffer();
- s.append(arr.get(0).toString());
- s.append(' ').append(arr.get(1).toString());
- for (int k = 2; k < arr.size(); ++k)
- s.append(' ').append(arr.get(k).toString());
- map.put("Page", s.toString());
- }
- }
- map.put("Action", "GoToR");
- PdfObject file = PdfReader.getPdfObjectRelease(action.get(PdfName.F));
- if (file != null) {
- if (file.isString())
- map.put("File", ((PdfString)file).toUnicodeString());
- else if (file.isDictionary()) {
- file = PdfReader.getPdfObject(((PdfDictionary)file).get(PdfName.F));
- if (file.isString())
- map.put("File", ((PdfString)file).toUnicodeString());
- }
- }
- PdfObject newWindow = PdfReader.getPdfObjectRelease(action.get(PdfName.NEWWINDOW));
- if (newWindow != null)
- map.put("NewWindow", newWindow.toString());
- }
- else if (PdfName.LAUNCH.equals(PdfReader.getPdfObjectRelease(action.get(PdfName.S)))) {
- map.put("Action", "Launch");
- PdfObject file = PdfReader.getPdfObjectRelease(action.get(PdfName.F));
- if (file == null)
- file = PdfReader.getPdfObjectRelease(action.get(PdfName.WIN));
- if (file != null) {
- if (file.isString())
- map.put("File", ((PdfString)file).toUnicodeString());
- else if (file.isDictionary()) {
- file = PdfReader.getPdfObjectRelease(((PdfDictionary)file).get(PdfName.F));
- if (file.isString())
- map.put("File", ((PdfString)file).toUnicodeString());
- }
- }
- }
- }
- }
- }
- catch (Exception e) {
- //empty on purpose
- }
- PdfDictionary first = (PdfDictionary)PdfReader.getPdfObjectRelease(outline.get(PdfName.FIRST));
- if (first != null) {
- map.put("Kids", bookmarkDepth(reader, first, pages));
- }
- list.add(map);
- outline = (PdfDictionary)PdfReader.getPdfObjectRelease(outline.get(PdfName.NEXT));
- }
- return list;
- }
-
- private static void mapGotoBookmark(HashMap map, PdfObject dest, IntHashtable pages)
- {
- if (dest.isString())
- map.put("Named", dest.toString());
- else if (dest.isName())
- map.put("Named", PdfName.decodeName(dest.toString()));
- else if (dest.isArray())
- map.put("Page", makeBookmarkParam((PdfArray)dest, pages)); //changed by ujihara 2004-06-13
- map.put("Action", "GoTo");
- }
-
- private static String makeBookmarkParam(PdfArray dest, IntHashtable pages)
- {
- ArrayList arr = ((PdfArray)dest).getArrayList();
- StringBuffer s = new StringBuffer();
- s.append(pages.get(getNumber((PdfIndirectReference)arr.get(0)))); //changed by ujihara 2004-06-13
- s.append(' ').append(arr.get(1).toString().substring(1));
- for (int k = 2; k < arr.size(); ++k)
- s.append(' ').append(arr.get(k).toString());
- return s.toString();
- }
-
- /**
- * Gets number of indirect. If type of directed indirect is PAGES, it refers PAGE object through KIDS.
- * (Contributed by Kazuya Ujihara)
- * @param indirect
- * 2004-06-13
- */
- private static int getNumber(PdfIndirectReference indirect)
- {
- PdfDictionary pdfObj = (PdfDictionary)PdfReader.getPdfObjectRelease(indirect);
- if (pdfObj.contains(PdfName.TYPE) && pdfObj.get(PdfName.TYPE).equals(PdfName.PAGES) && pdfObj.contains(PdfName.KIDS))
- {
- PdfArray kids = (PdfArray)pdfObj.get(PdfName.KIDS);
- indirect = (PdfIndirectReference)kids.arrayList.get(0);
- }
- return indirect.getNumber();
- }
-
- /**
- * Gets a <CODE>List</CODE> with the bookmarks. It returns <CODE>null</CODE> if
- * the document doesn't have any bookmarks.
- * @param reader the document
- * @return a <CODE>List</CODE> with the bookmarks or <CODE>null</CODE> if the
- * document doesn't have any
- */
- public static List getBookmark(PdfReader reader) {
- PdfDictionary catalog = reader.getCatalog();
- PdfDictionary outlines = (PdfDictionary)PdfReader.getPdfObjectRelease(catalog.get(PdfName.OUTLINES));
- if (outlines == null)
- return null;
- IntHashtable pages = new IntHashtable();
- int numPages = reader.getNumberOfPages();
- for (int k = 1; k <= numPages; ++k) {
- pages.put(reader.getPageOrigRef(k).getNumber(), k);
- reader.releasePage(k);
- }
- return bookmarkDepth(reader, (PdfDictionary)PdfReader.getPdfObjectRelease(outlines.get(PdfName.FIRST)), pages);
- }
-
- /**
- * Removes the bookmark entries for a number of page ranges. The page ranges
- * consists of a number of pairs with the start/end page range. The page numbers
- * are inclusive.
- * @param list the bookmarks
- * @param pageRange the page ranges, always in pairs.
- */
- public static void eliminatePages(List list, int pageRange[]) {
- if (list == null)
- return;
- for (Iterator it = list.listIterator(); it.hasNext();) {
- HashMap map = (HashMap)it.next();
- boolean hit = false;
- if ("GoTo".equals(map.get("Action"))) {
- String page = (String)map.get("Page");
- if (page != null) {
- page = page.trim();
- int idx = page.indexOf(' ');
- int pageNum;
- if (idx < 0)
- pageNum = Integer.parseInt(page);
- else
- pageNum = Integer.parseInt(page.substring(0, idx));
- int len = pageRange.length & 0xfffffffe;
- for (int k = 0; k < len; k += 2) {
- if (pageNum >= pageRange[k] && pageNum <= pageRange[k + 1]) {
- hit = true;
- break;
- }
- }
- }
- }
- List kids = (List)map.get("Kids");
- if (kids != null) {
- eliminatePages(kids, pageRange);
- if (kids.size() == 0) {
- map.remove("Kids");
- kids = null;
- }
- }
- if (hit) {
- if (kids == null)
- it.remove();
- else {
- map.remove("Action");
- map.remove("Page");
- map.remove("Named");
- }
- }
- }
- }
-
- /**
- * For the pages in range add the <CODE>pageShift</CODE> to the page number.
- * The page ranges
- * consists of a number of pairs with the start/end page range. The page numbers
- * are inclusive.
- * @param list the bookmarks
- * @param pageShift the number to add to the pages in range
- * @param pageRange the page ranges, always in pairs. It can be <CODE>null</CODE>
- * to include all the pages
- */
- public static void shiftPageNumbers(List list, int pageShift, int pageRange[]) {
- if (list == null)
- return;
- for (Iterator it = list.listIterator(); it.hasNext();) {
- HashMap map = (HashMap)it.next();
- if ("GoTo".equals(map.get("Action"))) {
- String page = (String)map.get("Page");
- if (page != null) {
- page = page.trim();
- int idx = page.indexOf(' ');
- int pageNum;
- if (idx < 0)
- pageNum = Integer.parseInt(page);
- else
- pageNum = Integer.parseInt(page.substring(0, idx));
- boolean hit = false;
- if (pageRange == null)
- hit = true;
- else {
- int len = pageRange.length & 0xfffffffe;
- for (int k = 0; k < len; k += 2) {
- if (pageNum >= pageRange[k] && pageNum <= pageRange[k + 1]) {
- hit = true;
- break;
- }
- }
- }
- if (hit) {
- if (idx < 0)
- page = (pageNum + pageShift) + "";
- else
- page = (pageNum + pageShift) + page.substring(idx);
- }
- map.put("Page", page);
- }
- }
- List kids = (List)map.get("Kids");
- if (kids != null)
- shiftPageNumbers(kids, pageShift, pageRange);
- }
- }
-
- static void createOutlineAction(PdfDictionary outline, HashMap map, PdfWriter writer, boolean namedAsNames) throws IOException {
- try {
- String action = (String)map.get("Action");
- if ("GoTo".equals(action)) {
- String p;
- if ((p = (String)map.get("Named")) != null) {
- if (namedAsNames)
- outline.put(PdfName.DEST, new PdfName(p));
- else
- outline.put(PdfName.DEST, new PdfString(p, null));
- }
- else if ((p = (String)map.get("Page")) != null) {
- PdfArray ar = new PdfArray();
- StringTokenizer tk = new StringTokenizer(p);
- int n = Integer.parseInt(tk.nextToken());
- ar.add(writer.getPageReference(n));
- if (!tk.hasMoreTokens()) {
- ar.add(PdfName.XYZ);
- ar.add(new float[]{0, 10000, 0});
- }
- else {
- String fn = tk.nextToken();
- if (fn.startsWith("/"))
- fn = fn.substring(1);
- ar.add(new PdfName(fn));
- for (int k = 0; k < 4 && tk.hasMoreTokens(); ++k) {
- fn = tk.nextToken();
- if (fn.equals("null"))
- ar.add(PdfNull.PDFNULL);
- else
- ar.add(new PdfNumber(fn));
- }
- }
- outline.put(PdfName.DEST, ar);
- }
- }
- else if ("GoToR".equals(action)) {
- String p;
- PdfDictionary dic = new PdfDictionary();
- if ((p = (String)map.get("Named")) != null)
- dic.put(PdfName.D, new PdfString(p, null));
- else if ((p = (String)map.get("NamedN")) != null)
- dic.put(PdfName.D, new PdfName(p));
- else if ((p = (String)map.get("Page")) != null){
- PdfArray ar = new PdfArray();
- StringTokenizer tk = new StringTokenizer(p);
- ar.add(new PdfNumber(tk.nextToken()));
- if (!tk.hasMoreTokens()) {
- ar.add(PdfName.XYZ);
- ar.add(new float[]{0, 10000, 0});
- }
- else {
- String fn = tk.nextToken();
- if (fn.startsWith("/"))
- fn = fn.substring(1);
- ar.add(new PdfName(fn));
- for (int k = 0; k < 4 && tk.hasMoreTokens(); ++k) {
- fn = tk.nextToken();
- if (fn.equals("null"))
- ar.add(PdfNull.PDFNULL);
- else
- ar.add(new PdfNumber(fn));
- }
- }
- dic.put(PdfName.D, ar);
- }
- String file = (String)map.get("File");
- if (dic.size() > 0 && file != null) {
- dic.put(PdfName.S, PdfName.GOTOR);
- dic.put(PdfName.F, new PdfString(file));
- String nw = (String)map.get("NewWindow");
- if (nw != null) {
- if (nw.equals("true"))
- dic.put(PdfName.NEWWINDOW, PdfBoolean.PDFTRUE);
- else if (nw.equals("false"))
- dic.put(PdfName.NEWWINDOW, PdfBoolean.PDFFALSE);
- }
- outline.put(PdfName.A, dic);
- }
- }
- else if ("URI".equals(action)) {
- String uri = (String)map.get("URI");
- if (uri != null) {
- PdfDictionary dic = new PdfDictionary();
- dic.put(PdfName.S, PdfName.URI);
- dic.put(PdfName.URI, new PdfString(uri));
- outline.put(PdfName.A, dic);
- }
- }
- else if ("Launch".equals(action)) {
- String file = (String)map.get("File");
- if (file != null) {
- PdfDictionary dic = new PdfDictionary();
- dic.put(PdfName.S, PdfName.LAUNCH);
- dic.put(PdfName.F, new PdfString(file));
- outline.put(PdfName.A, dic);
- }
- }
- }
- catch (Exception e) {
- // empty on purpose
- }
- }
-
- static Object[] iterateOutlines(PdfWriter writer, PdfIndirectReference parent, List kids, boolean namedAsNames) throws IOException {
- PdfIndirectReference refs[] = new PdfIndirectReference[kids.size()];
- for (int k = 0; k < refs.length; ++k)
- refs[k] = writer.getPdfIndirectReference();
- int ptr = 0;
- int count = 0;
- for (Iterator it = kids.listIterator(); it.hasNext(); ++ptr) {
- HashMap map = (HashMap)it.next();
- Object lower[] = null;
- List subKid = (List)map.get("Kids");
- if (subKid != null && subKid.size() > 0)
- lower = iterateOutlines(writer, refs[ptr], subKid, namedAsNames);
- PdfDictionary outline = new PdfDictionary();
- ++count;
- if (lower != null) {
- outline.put(PdfName.FIRST, (PdfIndirectReference)lower[0]);
- outline.put(PdfName.LAST, (PdfIndirectReference)lower[1]);
- int n = ((Integer)lower[2]).intValue();
- int tc;
- if ("false".equals(map.get("Open"))) {
- outline.put(PdfName.COUNT, new PdfNumber(-n));
- }
- else {
- outline.put(PdfName.COUNT, new PdfNumber(n));
- count += n;
- }
- }
- outline.put(PdfName.PARENT, parent);
- if (ptr > 0)
- outline.put(PdfName.PREV, refs[ptr - 1]);
- if (ptr < refs.length - 1)
- outline.put(PdfName.NEXT, refs[ptr + 1]);
- outline.put(PdfName.TITLE, new PdfString((String)map.get("Title"), PdfObject.TEXT_UNICODE));
- String color = (String)map.get("Color");
- if (color != null) {
- try {
- PdfArray arr = new PdfArray();
- StringTokenizer tk = new StringTokenizer(color);
- for (int k = 0; k < 3; ++k) {
- float f = Float.valueOf(tk.nextToken()).intValue();
- if (f < 0) f = 0;
- if (f > 1) f = 1;
- arr.add(new PdfNumber(f));
- }
- outline.put(PdfName.C, arr);
- } catch(Exception e){} //in case it's malformed
- }
- String style = (String)map.get("Style");
- if (style != null) {
- style = style.toLowerCase();
- int bits = 0;
- if (style.indexOf("italic") >= 0)
- bits |= 1;
- if (style.indexOf("bold") >= 0)
- bits |= 2;
- if (bits != 0)
- outline.put(PdfName.F, new PdfNumber(bits));
- }
- createOutlineAction(outline, map, writer, namedAsNames);
- writer.addToBody(outline, refs[ptr]);
- }
- return new Object[]{refs[0], refs[refs.length - 1], new Integer(count)};
- }
-
- /**
- * Exports the bookmarks to XML. Only of use if the generation is to be include in
- * some other XML document.
- * @param list the bookmarks
- * @param out the export destination. The writer is not closed
- * @param indent the indentation level. Pretty printing significant only
- * @param onlyASCII codes above 127 will always be escaped with &#nn; if <CODE>true</CODE>,
- * whatever the encoding
- * @throws IOException on error
- */
- public static void exportToXMLNode(List list, Writer out, int indent, boolean onlyASCII) throws IOException {
- String dep = "";
- for (int k = 0; k < indent; ++k)
- dep += " ";
- for (Iterator it = list.iterator(); it.hasNext();) {
- HashMap map = (HashMap)it.next();
- String title = null;
- out.write(dep);
- out.write("<Title ");
- List kids = null;
- for (Iterator e = map.keySet().iterator(); e.hasNext();) {
- String key = (String)e.next();
- if (key.equals("Title")) {
- title = (String)map.get(key);
- continue;
- }
- else if (key.equals("Kids")) {
- kids = (List)map.get(key);
- continue;
- }
- else {
- out.write(key);
- out.write("=\"");
- String value = (String)map.get(key);
- if (key.equals("Named") || key.equals("NamedN"))
- value = SimpleNamedDestination.escapeBinaryString(value);
- out.write(SimpleXMLParser.escapeXML(value, onlyASCII));
- out.write("\" ");
- }
- }
- out.write(">");
- if (title == null)
- title = "";
- out.write(SimpleXMLParser.escapeXML(title, onlyASCII));
- if (kids != null) {
- out.write("\n");
- exportToXMLNode(kids, out, indent + 1, onlyASCII);
- out.write(dep);
- }
- out.write("</Title>\n");
- }
- }
-
- /**
- * Exports the bookmarks to XML. The DTD for this XML is:
- * <p>
- * <pre>
- * <?xml version='1.0' encoding='UTF-8'?>
- * <!ELEMENT Title (#PCDATA|Title)*>
- * <!ATTLIST Title
- * Action CDATA #IMPLIED
- * Open CDATA #IMPLIED
- * Page CDATA #IMPLIED
- * URI CDATA #IMPLIED
- * File CDATA #IMPLIED
- * Named CDATA #IMPLIED
- * NamedN CDATA #IMPLIED
- * NewWindow CDATA #IMPLIED
- * Style CDATA #IMPLIED
- * Color CDATA #IMPLIED
- * >
- * <!ELEMENT Bookmark (Title)*>
- * </pre>
- * @param list the bookmarks
- * @param out the export destination. The stream is not closed
- * @param encoding the encoding according to IANA conventions
- * @param onlyASCII codes above 127 will always be escaped with &#nn; if <CODE>true</CODE>,
- * whatever the encoding
- * @throws IOException on error
- */
- public static void exportToXML(List list, OutputStream out, String encoding, boolean onlyASCII) throws IOException {
- String jenc = SimpleXMLParser.getJavaEncoding(encoding);
- Writer wrt = new BufferedWriter(new OutputStreamWriter(out, jenc));
- exportToXML(list, wrt, encoding, onlyASCII);
- }
-
- /**
- * Exports the bookmarks to XML.
- * @param list the bookmarks
- * @param wrt the export destination. The writer is not closed
- * @param encoding the encoding according to IANA conventions
- * @param onlyASCII codes above 127 will always be escaped with &#nn; if <CODE>true</CODE>,
- * whatever the encoding
- * @throws IOException on error
- */
- public static void exportToXML(List list, Writer wrt, String encoding, boolean onlyASCII) throws IOException {
- wrt.write("<?xml version=\"1.0\" encoding=\"");
- wrt.write(SimpleXMLParser.escapeXML(encoding, onlyASCII));
- wrt.write("\"?>\n<Bookmark>\n");
- exportToXMLNode(list, wrt, 1, onlyASCII);
- wrt.write("</Bookmark>\n");
- wrt.flush();
- }
-
- /**
- * Import the bookmarks from XML.
- * @param in the XML source. The stream is not closed
- * @throws IOException on error
- * @return the bookmarks
- */
- public static List importFromXML(InputStream in) throws IOException {
- SimpleBookmark book = new SimpleBookmark();
- SimpleXMLParser.parse(book, in);
- return book.topList;
- }
-
- /**
- * Import the bookmarks from XML.
- * @param in the XML source. The reader is not closed
- * @throws IOException on error
- * @return the bookmarks
- */
- public static List importFromXML(Reader in) throws IOException {
- SimpleBookmark book = new SimpleBookmark();
- SimpleXMLParser.parse(book, in);
- return book.topList;
- }
-
- public void endDocument() {
- }
-
- public void endElement(String tag) {
- if (tag.equals("Bookmark")) {
- if (attr.isEmpty())
- return;
- else
- throw new RuntimeException("Bookmark end tag out of place.");
- }
- if (!tag.equals("Title"))
- throw new RuntimeException("Invalid end tag - " + tag);
- HashMap attributes = (HashMap)attr.pop();
- String title = (String)attributes.get("Title");
- attributes.put("Title", title.trim());
- String named = (String)attributes.get("Named");
- if (named != null)
- attributes.put("Named", SimpleNamedDestination.unEscapeBinaryString(named));
- named = (String)attributes.get("NamedN");
- if (named != null)
- attributes.put("NamedN", SimpleNamedDestination.unEscapeBinaryString(named));
- if (attr.isEmpty())
- topList.add(attributes);
- else {
- HashMap parent = (HashMap)attr.peek();
- List kids = (List)parent.get("Kids");
- if (kids == null) {
- kids = new ArrayList();
- parent.put("Kids", kids);
- }
- kids.add(attributes);
- }
- }
-
- public void startDocument() {
- }
-
- public void startElement(String tag, HashMap h) {
- if (topList == null) {
- if (tag.equals("Bookmark")) {
- topList = new ArrayList();
- return;
- }
- else
- throw new RuntimeException("Root element is not Bookmark.");
- }
- if (!tag.equals("Title"))
- throw new RuntimeException("Tag " + tag + " not allowed.");
- HashMap attributes = new HashMap(h);
- attributes.put("Title", "");
- attributes.remove("Kids");
- attr.push(attributes);
- }
-
- public void text(String str) {
- if (attr.isEmpty())
- return;
- HashMap attributes = (HashMap)attr.peek();
- String title = (String)attributes.get("Title");
- title += str;
- attributes.put("Title", title);
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/SimpleNamedDestination.java b/LibrarySource/com/lowagie/text/pdf/SimpleNamedDestination.java
deleted file mode 100644
index 0bbaa38..0000000
--- a/LibrarySource/com/lowagie/text/pdf/SimpleNamedDestination.java
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * Copyright 2004 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.io.BufferedWriter;
-import java.io.InputStream;
-import java.io.Reader;
-
-/**
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class SimpleNamedDestination implements SimpleXMLDocHandler {
-
- private HashMap xmlNames;
- private HashMap xmlLast;
-
- private SimpleNamedDestination() {
- }
-
- public static HashMap getNamedDestination(PdfReader reader, boolean fromNames) {
- IntHashtable pages = new IntHashtable();
- int numPages = reader.getNumberOfPages();
- for (int k = 1; k <= numPages; ++k)
- pages.put(reader.getPageOrigRef(k).getNumber(), k);
- HashMap names = fromNames ? reader.getNamedDestinationFromNames() : reader.getNamedDestinationFromStrings();
- for (Iterator it = names.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry)it.next();
- ArrayList arr = ((PdfArray)entry.getValue()).getArrayList();
- StringBuffer s = new StringBuffer();
- try {
- s.append(pages.get(((PdfIndirectReference)arr.get(0)).getNumber()));
- s.append(' ').append(arr.get(1).toString().substring(1));
- for (int k = 2; k < arr.size(); ++k)
- s.append(' ').append(arr.get(k).toString());
- entry.setValue(s.toString());
- }
- catch (Exception e) {
- it.remove();
- }
- }
- return names;
- }
-
- /**
- * Exports the bookmarks to XML. The DTD for this XML is:
- * <p>
- * <pre>
- * <?xml version='1.0' encoding='UTF-8'?>
- * <!ELEMENT Name (#PCDATA)>
- * <!ATTLIST Name
- * Page CDATA #IMPLIED
- * >
- * <!ELEMENT Destination (Name)*>
- * </pre>
- * @param names the names
- * @param out the export destination. The stream is not closed
- * @param encoding the encoding according to IANA conventions
- * @param onlyASCII codes above 127 will always be escaped with &#nn; if <CODE>true</CODE>,
- * whatever the encoding
- * @throws IOException on error
- */
- public static void exportToXML(HashMap names, OutputStream out, String encoding, boolean onlyASCII) throws IOException {
- String jenc = SimpleXMLParser.getJavaEncoding(encoding);
- Writer wrt = new BufferedWriter(new OutputStreamWriter(out, jenc));
- exportToXML(names, wrt, encoding, onlyASCII);
- }
-
- /**
- * Exports the bookmarks to XML.
- * @param names the names
- * @param wrt the export destination. The writer is not closed
- * @param encoding the encoding according to IANA conventions
- * @param onlyASCII codes above 127 will always be escaped with &#nn; if <CODE>true</CODE>,
- * whatever the encoding
- * @throws IOException on error
- */
- public static void exportToXML(HashMap names, Writer wrt, String encoding, boolean onlyASCII) throws IOException {
- wrt.write("<?xml version=\"1.0\" encoding=\"");
- wrt.write(SimpleXMLParser.escapeXML(encoding, onlyASCII));
- wrt.write("\"?>\n<Destination>\n");
- for (Iterator it = names.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry)it.next();
- String key = (String)entry.getKey();
- String value = (String)entry.getValue();
- wrt.write(" <Name Page=\"");
- wrt.write(SimpleXMLParser.escapeXML(value, onlyASCII));
- wrt.write("\">");
- wrt.write(SimpleXMLParser.escapeXML(escapeBinaryString(key), onlyASCII));
- wrt.write("</Name>\n");
- }
- wrt.write("</Destination>\n");
- wrt.flush();
- }
-
- /**
- * Import the names from XML.
- * @param in the XML source. The stream is not closed
- * @throws IOException on error
- * @return the names
- */
- public static HashMap importFromXML(InputStream in) throws IOException {
- SimpleNamedDestination names = new SimpleNamedDestination();
- SimpleXMLParser.parse(names, in);
- return names.xmlNames;
- }
-
- /**
- * Import the names from XML.
- * @param in the XML source. The reader is not closed
- * @throws IOException on error
- * @return the names
- */
- public static HashMap importFromXML(Reader in) throws IOException {
- SimpleNamedDestination names = new SimpleNamedDestination();
- SimpleXMLParser.parse(names, in);
- return names.xmlNames;
- }
-
- static PdfArray createDestinationArray(String value, PdfWriter writer) throws IOException {
- PdfArray ar = new PdfArray();
- StringTokenizer tk = new StringTokenizer(value);
- int n = Integer.parseInt(tk.nextToken());
- ar.add(writer.getPageReference(n));
- if (!tk.hasMoreTokens()) {
- ar.add(PdfName.XYZ);
- ar.add(new float[]{0, 10000, 0});
- }
- else {
- String fn = tk.nextToken();
- if (fn.startsWith("/"))
- fn = fn.substring(1);
- ar.add(new PdfName(fn));
- for (int k = 0; k < 4 && tk.hasMoreTokens(); ++k) {
- fn = tk.nextToken();
- if (fn.equals("null"))
- ar.add(PdfNull.PDFNULL);
- else
- ar.add(new PdfNumber(fn));
- }
- }
- return ar;
- }
-
- public static PdfDictionary outputNamedDestinationAsNames(HashMap names, PdfWriter writer) throws IOException {
- PdfDictionary dic = new PdfDictionary();
- for (Iterator it = names.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry)it.next();
- try {
- String key = (String)entry.getKey();
- String value = (String)entry.getValue();
- PdfArray ar = createDestinationArray(value, writer);
- PdfName kn = new PdfName(key);
- dic.put(kn, ar);
- }
- catch (Exception e) {
- // empty on purpose
- }
- }
- return dic;
- }
-
- public static PdfDictionary outputNamedDestinationAsStrings(HashMap names, PdfWriter writer) throws IOException {
- HashMap n2 = new HashMap(names);
- for (Iterator it = n2.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry)it.next();
- try {
- String value = (String)entry.getValue();
- PdfArray ar = createDestinationArray(value, writer);
- entry.setValue(writer.addToBody(ar).getIndirectReference());
- }
- catch (Exception e) {
- it.remove();
- }
- }
- return PdfNameTree.writeTree(n2, writer);
- }
-
- public static String escapeBinaryString(String s) {
- StringBuffer buf = new StringBuffer();
- char cc[] = s.toCharArray();
- int len = cc.length;
- for (int k = 0; k < len; ++k) {
- char c = cc[k];
- if (c < ' ') {
- buf.append('\\');
- String octal = "00" + Integer.toOctalString((int)c);
- buf.append(octal.substring(octal.length() - 3));
- }
- else if (c == '\\')
- buf.append("\\\\");
- else
- buf.append(c);
- }
- return buf.toString();
- }
-
- public static String unEscapeBinaryString(String s) {
- StringBuffer buf = new StringBuffer();
- char cc[] = s.toCharArray();
- int len = cc.length;
- for (int k = 0; k < len; ++k) {
- char c = cc[k];
- if (c == '\\') {
- if (++k >= len) {
- buf.append('\\');
- break;
- }
- c = cc[k];
- if (c >= '0' && c <= '7') {
- int n = c - '0';
- ++k;
- for (int j = 0; j < 2 && k < len; ++j) {
- c = cc[k];
- if (c >= '0' && c <= '7') {
- ++k;
- n = n * 8 + c - '0';
- }
- else {
- break;
- }
- }
- --k;
- buf.append((char)n);
- }
- else
- buf.append(c);
- }
- else
- buf.append(c);
- }
- return buf.toString();
- }
-
- public void endDocument() {
- }
-
- public void endElement(String tag) {
- if (tag.equals("Destination")) {
- if (xmlLast == null && xmlNames != null)
- return;
- else
- throw new RuntimeException("Destination end tag out of place.");
- }
- if (!tag.equals("Name"))
- throw new RuntimeException("Invalid end tag - " + tag);
- if (xmlLast == null || xmlNames == null)
- throw new RuntimeException("Name end tag out of place.");
- if (!xmlLast.containsKey("Page"))
- throw new RuntimeException("Page attribute missing.");
- xmlNames.put(unEscapeBinaryString((String)xmlLast.get("Name")), xmlLast.get("Page"));
- xmlLast = null;
- }
-
- public void startDocument() {
- }
-
- public void startElement(String tag, HashMap h) {
- if (xmlNames == null) {
- if (tag.equals("Destination")) {
- xmlNames = new HashMap();
- return;
- }
- else
- throw new RuntimeException("Root element is not Destination.");
- }
- if (!tag.equals("Name"))
- throw new RuntimeException("Tag " + tag + " not allowed.");
- if (xmlLast != null)
- throw new RuntimeException("Nested tags are not allowed.");
- xmlLast = new HashMap(h);
- xmlLast.put("Name", "");
- }
-
- public void text(String str) {
- if (xmlLast == null)
- return;
- String name = (String)xmlLast.get("Name");
- name += str;
- xmlLast.put("Name", name);
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/SimpleXMLDocHandler.java b/LibrarySource/com/lowagie/text/pdf/SimpleXMLDocHandler.java
deleted file mode 100644
index 9713432..0000000
--- a/LibrarySource/com/lowagie/text/pdf/SimpleXMLDocHandler.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright 2003 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import java.util.HashMap;
-
-/**
- * The handler for the events fired by <CODE>SimpleXMLParser</CODE>.
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public interface SimpleXMLDocHandler {
- /**
- * Called when a start tag is found.
- * @param tag the tag name
- * @param h the tag's attributes
- */
- public void startElement(String tag, HashMap h);
- /**
- * Called when an end tag is found.
- * @param tag the tag name
- */
- public void endElement(String tag);
- /**
- * Called when the document starts to be parsed.
- */
- public void startDocument();
- /**
- * Called after the document is parsed.
- */
- public void endDocument();
- /**
- * Called when a text element is found.
- * @param str the text element, probably a fragment.
- */
- public void text(String str);
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/SimpleXMLDocHandlerComment.java b/LibrarySource/com/lowagie/text/pdf/SimpleXMLDocHandlerComment.java
deleted file mode 100644
index c8cc3c2..0000000
--- a/LibrarySource/com/lowagie/text/pdf/SimpleXMLDocHandlerComment.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2003 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-/**
- * The handler for the events fired by <CODE>SimpleXMLParser</CODE>.
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public interface SimpleXMLDocHandlerComment {
- /**
- * Called when a comment is found.
- * @param text the comment text
- */
- public void comment(String text);
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/SimpleXMLParser.java b/LibrarySource/com/lowagie/text/pdf/SimpleXMLParser.java
deleted file mode 100644
index 7461abb..0000000
--- a/LibrarySource/com/lowagie/text/pdf/SimpleXMLParser.java
+++ /dev/null
@@ -1,1177 +0,0 @@
-/*
- * Copyright 2003 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-
-import java.io.*;
-import java.util.Stack;
-import java.util.HashMap;
-
-/**
- * A simple XML and HTML parser. This parser is, like the SAX parser,
- * an event based parser, but with much less functionality.
- * <p>
- * The parser can:
- * <p>
- * <ul>
- * <li>It recognizes the encoding used
- * <li>It recognizes all the elements' start tags and end tags
- * <li>It lists attributes, where attribute values can be enclosed in single or double quotes
- * <li>It recognizes the <code><[CDATA[ ... ]]></code> construct
- * <li>It recognizes the standard entities: &, <, >, ", and ', as well as numeric entities
- * <li>It maps lines ending in <code>\r\n</code> and <code>\r</code> to <code>\n</code> on input, in accordance with the XML Specification, Section 2.11
- * </ul>
- * <p>
- * The code is based on <A HREF="http://www.javaworld.com/javaworld/javatips/javatip128/">
- * http://www.javaworld.com/javaworld/javatips/javatip128/</A> with some extra
- * code from XERCES to recognize the encoding.
- */
-public class SimpleXMLParser {
- private static final HashMap fIANA2JavaMap = new HashMap();
- private static final HashMap entityMap = new HashMap();
-
- private static int popMode(Stack st) {
- if(!st.empty())
- return ((Integer)st.pop()).intValue();
- else
- return PRE;
- }
-
- private final static int
- TEXT = 1,
- ENTITY = 2,
- OPEN_TAG = 3,
- CLOSE_TAG = 4,
- START_TAG = 5,
- ATTRIBUTE_LVALUE = 6,
- ATTRIBUTE_EQUAL = 9,
- ATTRIBUTE_RVALUE = 10,
- QUOTE = 7,
- IN_TAG = 8,
- SINGLE_TAG = 12,
- COMMENT = 13,
- DONE = 11,
- DOCTYPE = 14,
- PRE = 15,
- CDATA = 16;
-
- private SimpleXMLParser() {
- }
-
- /**
- * Parses the XML document firing the events to the handler.
- * @param doc the document handler
- * @param in the document. The encoding is deduced from the stream. The stream is not closed
- * @throws IOException on error
- */
- public static void parse(SimpleXMLDocHandler doc, InputStream in) throws IOException {
- byte b4[] = new byte[4];
- int count = in.read(b4);
- if (count != 4)
- throw new IOException("Insufficient length.");
- String encoding = getEncodingName(b4);
- String decl = null;
- if (encoding.equals("UTF-8")) {
- StringBuffer sb = new StringBuffer();
- int c;
- while ((c = in.read()) != -1) {
- if (c == '>')
- break;
- sb.append((char)c);
- }
- decl = sb.toString();
- }
- else if (encoding.equals("CP037")) {
- ByteArrayOutputStream bi = new ByteArrayOutputStream();
- int c;
- while ((c = in.read()) != -1) {
- if (c == 0x6e) // that's '>' in ebcdic
- break;
- bi.write(c);
- }
- decl = new String(bi.toByteArray(), "CP037");
- }
- if (decl != null) {
- decl = getDeclaredEncoding(decl);
- if (decl != null)
- encoding = decl;
- }
- parse(doc, new InputStreamReader(in, getJavaEncoding(encoding)));
- }
-
- private static String getDeclaredEncoding(String decl) {
- if (decl == null)
- return null;
- int idx = decl.indexOf("encoding");
- if (idx < 0)
- return null;
- int idx1 = decl.indexOf('"', idx);
- int idx2 = decl.indexOf('\'', idx);
- if (idx1 == idx2)
- return null;
- if ((idx1 < 0 && idx2 > 0) || (idx2 > 0 && idx2 < idx1)) {
- int idx3 = decl.indexOf('\'', idx2 + 1);
- if (idx3 < 0)
- return null;
- return decl.substring(idx2 + 1, idx3);
- }
- if ((idx2 < 0 && idx1 > 0) || (idx1 > 0 && idx1 < idx2)) {
- int idx3 = decl.indexOf('"', idx1 + 1);
- if (idx3 < 0)
- return null;
- return decl.substring(idx1 + 1, idx3);
- }
- return null;
- }
-
- /**
- * Gets the java encoding from the IANA encoding. If the encoding cannot be found
- * it returns the input.
- * @param iana the IANA encoding
- * @return the java encoding
- */
- public static String getJavaEncoding(String iana) {
- String IANA = iana.toUpperCase();
- String jdec = (String)fIANA2JavaMap.get(IANA);
- if (jdec == null)
- jdec = iana;
- return jdec;
- }
-
- public static void parse(SimpleXMLDocHandler doc,Reader r) throws IOException {
- parse(doc, null, r, false);
- }
-
- /**
- * Parses the XML document firing the events to the handler.
- * @param doc the document handler
- * @param r the document. The encoding is already resolved. The reader is not closed
- * @throws IOException on error
- */
- public static void parse(SimpleXMLDocHandler doc, SimpleXMLDocHandlerComment comment, Reader r, boolean html) throws IOException {
- BufferedReader reader;
- if (r instanceof BufferedReader)
- reader = (BufferedReader)r;
- else
- reader = new BufferedReader(r);
- Stack st = new Stack();
- int depth = 0;
- int mode = PRE;
- int c = 0;
- int quotec = '"';
- depth = 0;
- StringBuffer sb = new StringBuffer();
- StringBuffer etag = new StringBuffer();
- String tagName = null;
- String lvalue = null;
- String rvalue = null;
- HashMap attrs = null;
- st = new Stack();
- doc.startDocument();
- int line=1, col=0;
- boolean eol = false;
- if (html)
- mode = TEXT;
- int pushBack = -1;
- while(true) {
- if (pushBack != -1) {
- c = pushBack;
- pushBack = -1;
- }
- else
- c = reader.read();
- if (c == -1)
- break;
-
- // We need to map \r, \r\n, and \n to \n
- // See XML spec section 2.11
- if(c == '\n' && eol) {
- eol = false;
- continue;
- } else if(eol) {
- eol = false;
- } else if(c == '\n') {
- line++;
- col=0;
- } else if(c == '\r') {
- eol = true;
- c = '\n';
- line++;
- col=0;
- } else {
- col++;
- }
-
- if(mode == DONE) {
- doc.endDocument();
- return;
-
- // We are between tags collecting text.
- } else if(mode == TEXT) {
- if(c == '<') {
- st.push(new Integer(mode));
- mode = START_TAG;
- if(sb.length() > 0) {
- doc.text(sb.toString());
- sb.setLength(0);
- }
- } else if(c == '&') {
- st.push(new Integer(mode));
- mode = ENTITY;
- etag.setLength(0);
- } else
- sb.append((char)c);
-
- // we are processing a closing tag: e.g. </foo>
- } else if(mode == CLOSE_TAG) {
- if(c == '>') {
- mode = popMode(st);
- tagName = sb.toString();
- if (html)
- tagName = tagName.toLowerCase();
- sb.setLength(0);
- depth--;
- if(!html && depth==0)
- mode = DONE;
- doc.endElement(tagName);
- } else {
- if (!Character.isWhitespace((char)c))
- sb.append((char)c);
- }
-
- // we are processing CDATA
- } else if(mode == CDATA) {
- if(c == '>'
- && sb.toString().endsWith("]]")) {
- sb.setLength(sb.length()-2);
- doc.text(sb.toString());
- sb.setLength(0);
- mode = popMode(st);
- } else
- sb.append((char)c);
-
- // we are processing a comment. We are inside
- // the <!-- .... --> looking for the -->.
- } else if(mode == COMMENT) {
- if(c == '>'
- && sb.toString().endsWith("--")) {
- if (comment != null) {
- sb.setLength(sb.length() - 2);
- comment.comment(sb.toString());
- }
- sb.setLength(0);
- mode = popMode(st);
- } else
- sb.append((char)c);
-
- // We are outside the root tag element
- } else if(mode == PRE) {
- if(c == '<') {
- mode = TEXT;
- st.push(new Integer(mode));
- mode = START_TAG;
- }
-
- // We are inside one of these <? ... ?>
- // or one of these <!DOCTYPE ... >
- } else if(mode == DOCTYPE) {
- if(c == '>') {
- mode = popMode(st);
- if(mode == TEXT) mode = PRE;
- }
-
- // we have just seen a < and
- // are wondering what we are looking at
- // <foo>, </foo>, <!-- ... --->, etc.
- } else if(mode == START_TAG) {
- mode = popMode(st);
- if(c == '/') {
- st.push(new Integer(mode));
- mode = CLOSE_TAG;
- } else if (c == '?') {
- mode = DOCTYPE;
- } else {
- st.push(new Integer(mode));
- mode = OPEN_TAG;
- tagName = null;
- attrs = new HashMap();
- sb.append((char)c);
- }
-
- // we are processing an entity, e.g. <, », etc.
- } else if(mode == ENTITY) {
- if(c == ';') {
- mode = popMode(st);
- String cent = etag.toString();
- etag.setLength(0);
- if(cent.startsWith("#x")) {
- try {
- char ci = (char)Integer.parseInt(cent.substring(2),16);
- sb.append(ci);
- }
- catch (Exception es) {
- sb.append('&').append(cent).append(';');
- }
- }
- else if(cent.startsWith("#")) {
- try {
- char ci = (char)Integer.parseInt(cent.substring(1));
- sb.append(ci);
- }
- catch (Exception es) {
- sb.append('&').append(cent).append(';');
- }
- }
- else {
- char ce = decodeEntity(cent);
- if (ce == '\0')
- sb.append('&').append(cent).append(';');
- else
- sb.append(ce);
- }
- } else if ((c != '#' && (c < '0' || c > '9') && (c < 'a' || c > 'z')
- && (c < 'A' || c > 'Z')) || etag.length() >= 7) {
- mode = popMode(st);
- pushBack = c;
- sb.append('&').append(etag.toString());
- etag.setLength(0);
- }
- else {
- etag.append((char)c);
- }
-
- // we have just seen something like this:
- // <foo a="b"/
- // and are looking for the final >.
- } else if(mode == SINGLE_TAG) {
- if(tagName == null)
- tagName = sb.toString();
- if (html)
- tagName = tagName.toLowerCase();
- if(c != '>')
- exc("Expected > for tag: <"+tagName+"/>",line,col);
- doc.startElement(tagName,attrs);
- doc.endElement(tagName);
- if(!html && depth==0) {
- doc.endDocument();
- return;
- }
- sb.setLength(0);
- attrs = new HashMap();
- tagName = null;
- mode = popMode(st);
-
- // we are processing something
- // like this <foo ... >. It could
- // still be a <!-- ... --> or something.
- } else if(mode == OPEN_TAG) {
- if(c == '>') {
- if(tagName == null)
- tagName = sb.toString();
- if (html)
- tagName = tagName.toLowerCase();
- sb.setLength(0);
- depth++;
- doc.startElement(tagName,attrs);
- tagName = null;
- attrs = new HashMap();
- mode = popMode(st);
- } else if(c == '/') {
- mode = SINGLE_TAG;
- } else if(c == '-' && sb.toString().equals("!-")) {
- mode = COMMENT;
- sb.setLength(0);
- } else if(c == '[' && sb.toString().equals("![CDATA")) {
- mode = CDATA;
- sb.setLength(0);
- } else if(c == 'E' && sb.toString().equals("!DOCTYP")) {
- sb.setLength(0);
- mode = DOCTYPE;
- } else if(Character.isWhitespace((char)c)) {
- tagName = sb.toString();
- if (html)
- tagName = tagName.toLowerCase();
- sb.setLength(0);
- mode = IN_TAG;
- } else {
- sb.append((char)c);
- }
-
- // We are processing the quoted right-hand side
- // of an element's attribute.
- } else if(mode == QUOTE) {
- if (html && quotec == ' ' && c == '>') {
- rvalue = sb.toString();
- sb.setLength(0);
- attrs.put(lvalue,rvalue);
- mode = popMode(st);
- doc.startElement(tagName,attrs);
- depth++;
- tagName = null;
- attrs = new HashMap();
- }
- else if (html && quotec == ' ' && Character.isWhitespace((char)c)) {
- rvalue = sb.toString();
- sb.setLength(0);
- attrs.put(lvalue,rvalue);
- mode = IN_TAG;
- }
- else if (html && quotec == ' ') {
- sb.append((char)c);
- }
- else if(c == quotec) {
- rvalue = sb.toString();
- sb.setLength(0);
- attrs.put(lvalue,rvalue);
- mode = IN_TAG;
- // See section the XML spec, section 3.3.3
- // on normalization processing.
- } else if(" \r\n\u0009".indexOf(c)>=0) {
- sb.append(' ');
- } else if(c == '&') {
- st.push(new Integer(mode));
- mode = ENTITY;
- etag.setLength(0);
- } else {
- sb.append((char)c);
- }
-
- } else if(mode == ATTRIBUTE_RVALUE) {
- if(c == '"' || c == '\'') {
- quotec = c;
- mode = QUOTE;
- } else if(Character.isWhitespace((char)c)) {
- ;
- } else if (html && c == '>') {
- attrs.put(lvalue,sb.toString());
- sb.setLength(0);
- mode = popMode(st);
- doc.startElement(tagName,attrs);
- depth++;
- tagName = null;
- attrs = new HashMap();
- } else if (html) {
- sb.append((char)c);
- quotec = ' ';
- mode = QUOTE;
- } else {
- exc("Error in attribute processing",line,col);
- }
-
- } else if(mode == ATTRIBUTE_LVALUE) {
- if(Character.isWhitespace((char)c)) {
- lvalue = sb.toString();
- if (html)
- lvalue = lvalue.toLowerCase();
- sb.setLength(0);
- mode = ATTRIBUTE_EQUAL;
- } else if(c == '=') {
- lvalue = sb.toString();
- if (html)
- lvalue = lvalue.toLowerCase();
- sb.setLength(0);
- mode = ATTRIBUTE_RVALUE;
- } else if (html && c == '>') {
- sb.setLength(0);
- mode = popMode(st);
- doc.startElement(tagName,attrs);
- depth++;
- tagName = null;
- attrs = new HashMap();
- } else {
- sb.append((char)c);
- }
-
- } else if(mode == ATTRIBUTE_EQUAL) {
- if(c == '=') {
- mode = ATTRIBUTE_RVALUE;
- } else if(Character.isWhitespace((char)c)) {
- ;
- } else if (html && c == '>') {
- sb.setLength(0);
- mode = popMode(st);
- doc.startElement(tagName,attrs);
- depth++;
- tagName = null;
- attrs = new HashMap();
- } else if (html && c == '/') {
- sb.setLength(0);
- mode = SINGLE_TAG;
- } else if (html) {
- sb.setLength(0);
- sb.append((char)c);
- mode = ATTRIBUTE_LVALUE;
- } else {
- exc("Error in attribute processing.",line,col);
- }
-
- } else if(mode == IN_TAG) {
- if(c == '>') {
- mode = popMode(st);
- doc.startElement(tagName,attrs);
- depth++;
- tagName = null;
- attrs = new HashMap();
- } else if(c == '/') {
- mode = SINGLE_TAG;
- } else if(Character.isWhitespace((char)c)) {
- ;
- } else {
- mode = ATTRIBUTE_LVALUE;
- sb.append((char)c);
- }
- }
- }
- if(html || mode == DONE) {
- if (html && mode == TEXT)
- doc.text(sb.toString());
- doc.endDocument();
- }
- else
- exc("missing end tag",line,col);
- }
- private static void exc(String s,int line,int col) throws IOException {
- throw new IOException(s+" near line "+line+", column "+col);
- }
-
- /**
- * Escapes a string with the appropriated XML codes.
- * @param s the string to be escaped
- * @param onlyASCII codes above 127 will always be escaped with &#nn; if <CODE>true</CODE>
- * @return the escaped string
- */
- public static String escapeXML(String s, boolean onlyASCII) {
- char cc[] = s.toCharArray();
- int len = cc.length;
- StringBuffer sb = new StringBuffer();
- for (int k = 0; k < len; ++k) {
- int c = cc[k];
- switch (c) {
- case '<':
- sb.append("<");
- break;
- case '>':
- sb.append(">");
- break;
- case '&':
- sb.append("&");
- break;
- case '"':
- sb.append(""");
- break;
- case '\'':
- sb.append("'");
- break;
- default:
- if (onlyASCII && c > 127)
- sb.append("&#").append(c).append(";");
- else
- sb.append((char)c);
- }
- }
- return sb.toString();
- }
-
- public static char decodeEntity(String s) {
- Character c = (Character)entityMap.get(s);
- if (c == null)
- return '\0';
- else
- return c.charValue();
- }
-
- private static String getEncodingName(byte[] b4) {
-
- // UTF-16, with BOM
- int b0 = b4[0] & 0xFF;
- int b1 = b4[1] & 0xFF;
- if (b0 == 0xFE && b1 == 0xFF) {
- // UTF-16, big-endian
- return "UTF-16BE";
- }
- if (b0 == 0xFF && b1 == 0xFE) {
- // UTF-16, little-endian
- return "UTF-16LE";
- }
-
- // UTF-8 with a BOM
- int b2 = b4[2] & 0xFF;
- if (b0 == 0xEF && b1 == 0xBB && b2 == 0xBF) {
- return "UTF-8";
- }
-
- // other encodings
- int b3 = b4[3] & 0xFF;
- if (b0 == 0x00 && b1 == 0x00 && b2 == 0x00 && b3 == 0x3C) {
- // UCS-4, big endian (1234)
- return "ISO-10646-UCS-4";
- }
- if (b0 == 0x3C && b1 == 0x00 && b2 == 0x00 && b3 == 0x00) {
- // UCS-4, little endian (4321)
- return "ISO-10646-UCS-4";
- }
- if (b0 == 0x00 && b1 == 0x00 && b2 == 0x3C && b3 == 0x00) {
- // UCS-4, unusual octet order (2143)
- // REVISIT: What should this be?
- return "ISO-10646-UCS-4";
- }
- if (b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x00) {
- // UCS-4, unusual octect order (3412)
- // REVISIT: What should this be?
- return "ISO-10646-UCS-4";
- }
- if (b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x3F) {
- // UTF-16, big-endian, no BOM
- // (or could turn out to be UCS-2...
- // REVISIT: What should this be?
- return "UTF-16BE";
- }
- if (b0 == 0x3C && b1 == 0x00 && b2 == 0x3F && b3 == 0x00) {
- // UTF-16, little-endian, no BOM
- // (or could turn out to be UCS-2...
- return "UTF-16LE";
- }
- if (b0 == 0x4C && b1 == 0x6F && b2 == 0xA7 && b3 == 0x94) {
- // EBCDIC
- // a la xerces1, return CP037 instead of EBCDIC here
- return "CP037";
- }
-
- // default encoding
- return "UTF-8";
- }
-
- static {
- // add IANA to Java encoding mappings.
- fIANA2JavaMap.put("BIG5", "Big5");
- fIANA2JavaMap.put("CSBIG5", "Big5");
- fIANA2JavaMap.put("CP037", "CP037");
- fIANA2JavaMap.put("IBM037", "CP037");
- fIANA2JavaMap.put("CSIBM037", "CP037");
- fIANA2JavaMap.put("EBCDIC-CP-US", "CP037");
- fIANA2JavaMap.put("EBCDIC-CP-CA", "CP037");
- fIANA2JavaMap.put("EBCDIC-CP-NL", "CP037");
- fIANA2JavaMap.put("EBCDIC-CP-WT", "CP037");
- fIANA2JavaMap.put("IBM277", "CP277");
- fIANA2JavaMap.put("CP277", "CP277");
- fIANA2JavaMap.put("CSIBM277", "CP277");
- fIANA2JavaMap.put("EBCDIC-CP-DK", "CP277");
- fIANA2JavaMap.put("EBCDIC-CP-NO", "CP277");
- fIANA2JavaMap.put("IBM278", "CP278");
- fIANA2JavaMap.put("CP278", "CP278");
- fIANA2JavaMap.put("CSIBM278", "CP278");
- fIANA2JavaMap.put("EBCDIC-CP-FI", "CP278");
- fIANA2JavaMap.put("EBCDIC-CP-SE", "CP278");
- fIANA2JavaMap.put("IBM280", "CP280");
- fIANA2JavaMap.put("CP280", "CP280");
- fIANA2JavaMap.put("CSIBM280", "CP280");
- fIANA2JavaMap.put("EBCDIC-CP-IT", "CP280");
- fIANA2JavaMap.put("IBM284", "CP284");
- fIANA2JavaMap.put("CP284", "CP284");
- fIANA2JavaMap.put("CSIBM284", "CP284");
- fIANA2JavaMap.put("EBCDIC-CP-ES", "CP284");
- fIANA2JavaMap.put("EBCDIC-CP-GB", "CP285");
- fIANA2JavaMap.put("IBM285", "CP285");
- fIANA2JavaMap.put("CP285", "CP285");
- fIANA2JavaMap.put("CSIBM285", "CP285");
- fIANA2JavaMap.put("EBCDIC-CP-FR", "CP297");
- fIANA2JavaMap.put("IBM297", "CP297");
- fIANA2JavaMap.put("CP297", "CP297");
- fIANA2JavaMap.put("CSIBM297", "CP297");
- fIANA2JavaMap.put("EBCDIC-CP-AR1", "CP420");
- fIANA2JavaMap.put("IBM420", "CP420");
- fIANA2JavaMap.put("CP420", "CP420");
- fIANA2JavaMap.put("CSIBM420", "CP420");
- fIANA2JavaMap.put("EBCDIC-CP-HE", "CP424");
- fIANA2JavaMap.put("IBM424", "CP424");
- fIANA2JavaMap.put("CP424", "CP424");
- fIANA2JavaMap.put("CSIBM424", "CP424");
- fIANA2JavaMap.put("EBCDIC-CP-CH", "CP500");
- fIANA2JavaMap.put("IBM500", "CP500");
- fIANA2JavaMap.put("CP500", "CP500");
- fIANA2JavaMap.put("CSIBM500", "CP500");
- fIANA2JavaMap.put("EBCDIC-CP-CH", "CP500");
- fIANA2JavaMap.put("EBCDIC-CP-BE", "CP500");
- fIANA2JavaMap.put("IBM868", "CP868");
- fIANA2JavaMap.put("CP868", "CP868");
- fIANA2JavaMap.put("CSIBM868", "CP868");
- fIANA2JavaMap.put("CP-AR", "CP868");
- fIANA2JavaMap.put("IBM869", "CP869");
- fIANA2JavaMap.put("CP869", "CP869");
- fIANA2JavaMap.put("CSIBM869", "CP869");
- fIANA2JavaMap.put("CP-GR", "CP869");
- fIANA2JavaMap.put("IBM870", "CP870");
- fIANA2JavaMap.put("CP870", "CP870");
- fIANA2JavaMap.put("CSIBM870", "CP870");
- fIANA2JavaMap.put("EBCDIC-CP-ROECE", "CP870");
- fIANA2JavaMap.put("EBCDIC-CP-YU", "CP870");
- fIANA2JavaMap.put("IBM871", "CP871");
- fIANA2JavaMap.put("CP871", "CP871");
- fIANA2JavaMap.put("CSIBM871", "CP871");
- fIANA2JavaMap.put("EBCDIC-CP-IS", "CP871");
- fIANA2JavaMap.put("IBM918", "CP918");
- fIANA2JavaMap.put("CP918", "CP918");
- fIANA2JavaMap.put("CSIBM918", "CP918");
- fIANA2JavaMap.put("EBCDIC-CP-AR2", "CP918");
- fIANA2JavaMap.put("EUC-JP", "EUCJIS");
- fIANA2JavaMap.put("CSEUCPkdFmtJapanese", "EUCJIS");
- fIANA2JavaMap.put("EUC-KR", "KSC5601");
- fIANA2JavaMap.put("GB2312", "GB2312");
- fIANA2JavaMap.put("CSGB2312", "GB2312");
- fIANA2JavaMap.put("ISO-2022-JP", "JIS");
- fIANA2JavaMap.put("CSISO2022JP", "JIS");
- fIANA2JavaMap.put("ISO-2022-KR", "ISO2022KR");
- fIANA2JavaMap.put("CSISO2022KR", "ISO2022KR");
- fIANA2JavaMap.put("ISO-2022-CN", "ISO2022CN");
-
- fIANA2JavaMap.put("X0201", "JIS0201");
- fIANA2JavaMap.put("CSISO13JISC6220JP", "JIS0201");
- fIANA2JavaMap.put("X0208", "JIS0208");
- fIANA2JavaMap.put("ISO-IR-87", "JIS0208");
- fIANA2JavaMap.put("X0208dbiJIS_X0208-1983", "JIS0208");
- fIANA2JavaMap.put("CSISO87JISX0208", "JIS0208");
- fIANA2JavaMap.put("X0212", "JIS0212");
- fIANA2JavaMap.put("ISO-IR-159", "JIS0212");
- fIANA2JavaMap.put("CSISO159JISX02121990", "JIS0212");
- fIANA2JavaMap.put("SHIFT_JIS", "SJIS");
- fIANA2JavaMap.put("CSSHIFT_JIS", "SJIS");
- fIANA2JavaMap.put("MS_Kanji", "SJIS");
-
- // Add support for Cp1252 and its friends
- fIANA2JavaMap.put("WINDOWS-1250", "Cp1250");
- fIANA2JavaMap.put("WINDOWS-1251", "Cp1251");
- fIANA2JavaMap.put("WINDOWS-1252", "Cp1252");
- fIANA2JavaMap.put("WINDOWS-1253", "Cp1253");
- fIANA2JavaMap.put("WINDOWS-1254", "Cp1254");
- fIANA2JavaMap.put("WINDOWS-1255", "Cp1255");
- fIANA2JavaMap.put("WINDOWS-1256", "Cp1256");
- fIANA2JavaMap.put("WINDOWS-1257", "Cp1257");
- fIANA2JavaMap.put("WINDOWS-1258", "Cp1258");
- fIANA2JavaMap.put("TIS-620", "TIS620");
-
- fIANA2JavaMap.put("ISO-8859-1", "ISO8859_1");
- fIANA2JavaMap.put("ISO-IR-100", "ISO8859_1");
- fIANA2JavaMap.put("ISO_8859-1", "ISO8859_1");
- fIANA2JavaMap.put("LATIN1", "ISO8859_1");
- fIANA2JavaMap.put("CSISOLATIN1", "ISO8859_1");
- fIANA2JavaMap.put("L1", "ISO8859_1");
- fIANA2JavaMap.put("IBM819", "ISO8859_1");
- fIANA2JavaMap.put("CP819", "ISO8859_1");
-
- fIANA2JavaMap.put("ISO-8859-2", "ISO8859_2");
- fIANA2JavaMap.put("ISO-IR-101", "ISO8859_2");
- fIANA2JavaMap.put("ISO_8859-2", "ISO8859_2");
- fIANA2JavaMap.put("LATIN2", "ISO8859_2");
- fIANA2JavaMap.put("CSISOLATIN2", "ISO8859_2");
- fIANA2JavaMap.put("L2", "ISO8859_2");
-
- fIANA2JavaMap.put("ISO-8859-3", "ISO8859_3");
- fIANA2JavaMap.put("ISO-IR-109", "ISO8859_3");
- fIANA2JavaMap.put("ISO_8859-3", "ISO8859_3");
- fIANA2JavaMap.put("LATIN3", "ISO8859_3");
- fIANA2JavaMap.put("CSISOLATIN3", "ISO8859_3");
- fIANA2JavaMap.put("L3", "ISO8859_3");
-
- fIANA2JavaMap.put("ISO-8859-4", "ISO8859_4");
- fIANA2JavaMap.put("ISO-IR-110", "ISO8859_4");
- fIANA2JavaMap.put("ISO_8859-4", "ISO8859_4");
- fIANA2JavaMap.put("LATIN4", "ISO8859_4");
- fIANA2JavaMap.put("CSISOLATIN4", "ISO8859_4");
- fIANA2JavaMap.put("L4", "ISO8859_4");
-
- fIANA2JavaMap.put("ISO-8859-5", "ISO8859_5");
- fIANA2JavaMap.put("ISO-IR-144", "ISO8859_5");
- fIANA2JavaMap.put("ISO_8859-5", "ISO8859_5");
- fIANA2JavaMap.put("CYRILLIC", "ISO8859_5");
- fIANA2JavaMap.put("CSISOLATINCYRILLIC", "ISO8859_5");
-
- fIANA2JavaMap.put("ISO-8859-6", "ISO8859_6");
- fIANA2JavaMap.put("ISO-IR-127", "ISO8859_6");
- fIANA2JavaMap.put("ISO_8859-6", "ISO8859_6");
- fIANA2JavaMap.put("ECMA-114", "ISO8859_6");
- fIANA2JavaMap.put("ASMO-708", "ISO8859_6");
- fIANA2JavaMap.put("ARABIC", "ISO8859_6");
- fIANA2JavaMap.put("CSISOLATINARABIC", "ISO8859_6");
-
- fIANA2JavaMap.put("ISO-8859-7", "ISO8859_7");
- fIANA2JavaMap.put("ISO-IR-126", "ISO8859_7");
- fIANA2JavaMap.put("ISO_8859-7", "ISO8859_7");
- fIANA2JavaMap.put("ELOT_928", "ISO8859_7");
- fIANA2JavaMap.put("ECMA-118", "ISO8859_7");
- fIANA2JavaMap.put("GREEK", "ISO8859_7");
- fIANA2JavaMap.put("CSISOLATINGREEK", "ISO8859_7");
- fIANA2JavaMap.put("GREEK8", "ISO8859_7");
-
- fIANA2JavaMap.put("ISO-8859-8", "ISO8859_8");
- fIANA2JavaMap.put("ISO-8859-8-I", "ISO8859_8"); // added since this encoding only differs w.r.t. presentation
- fIANA2JavaMap.put("ISO-IR-138", "ISO8859_8");
- fIANA2JavaMap.put("ISO_8859-8", "ISO8859_8");
- fIANA2JavaMap.put("HEBREW", "ISO8859_8");
- fIANA2JavaMap.put("CSISOLATINHEBREW", "ISO8859_8");
-
- fIANA2JavaMap.put("ISO-8859-9", "ISO8859_9");
- fIANA2JavaMap.put("ISO-IR-148", "ISO8859_9");
- fIANA2JavaMap.put("ISO_8859-9", "ISO8859_9");
- fIANA2JavaMap.put("LATIN5", "ISO8859_9");
- fIANA2JavaMap.put("CSISOLATIN5", "ISO8859_9");
- fIANA2JavaMap.put("L5", "ISO8859_9");
-
- fIANA2JavaMap.put("KOI8-R", "KOI8_R");
- fIANA2JavaMap.put("CSKOI8-R", "KOI8_R");
- fIANA2JavaMap.put("US-ASCII", "ASCII");
- fIANA2JavaMap.put("ISO-IR-6", "ASCII");
- fIANA2JavaMap.put("ANSI_X3.4-1986", "ASCII");
- fIANA2JavaMap.put("ISO_646.IRV:1991", "ASCII");
- fIANA2JavaMap.put("ASCII", "ASCII");
- fIANA2JavaMap.put("CSASCII", "ASCII");
- fIANA2JavaMap.put("ISO646-US", "ASCII");
- fIANA2JavaMap.put("US", "ASCII");
- fIANA2JavaMap.put("IBM367", "ASCII");
- fIANA2JavaMap.put("CP367", "ASCII");
- fIANA2JavaMap.put("UTF-8", "UTF8");
- fIANA2JavaMap.put("UTF-16", "Unicode");
- fIANA2JavaMap.put("UTF-16BE", "UnicodeBig");
- fIANA2JavaMap.put("UTF-16LE", "UnicodeLittle");
-
- entityMap.put("nbsp", new Character('\u00a0')); // no-break space = non-breaking space, U+00A0 ISOnum
- entityMap.put("iexcl", new Character('\u00a1')); // inverted exclamation mark, U+00A1 ISOnum
- entityMap.put("cent", new Character('\u00a2')); // cent sign, U+00A2 ISOnum
- entityMap.put("pound", new Character('\u00a3')); // pound sign, U+00A3 ISOnum
- entityMap.put("curren", new Character('\u00a4')); // currency sign, U+00A4 ISOnum
- entityMap.put("yen", new Character('\u00a5')); // yen sign = yuan sign, U+00A5 ISOnum
- entityMap.put("brvbar", new Character('\u00a6')); // broken bar = broken vertical bar, U+00A6 ISOnum
- entityMap.put("sect", new Character('\u00a7')); // section sign, U+00A7 ISOnum
- entityMap.put("uml", new Character('\u00a8')); // diaeresis = spacing diaeresis, U+00A8 ISOdia
- entityMap.put("copy", new Character('\u00a9')); // copyright sign, U+00A9 ISOnum
- entityMap.put("ordf", new Character('\u00aa')); // feminine ordinal indicator, U+00AA ISOnum
- entityMap.put("laquo", new Character('\u00ab')); // left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum
- entityMap.put("not", new Character('\u00ac')); // not sign, U+00AC ISOnum
- entityMap.put("shy", new Character('\u00ad')); // soft hyphen = discretionary hyphen, U+00AD ISOnum
- entityMap.put("reg", new Character('\u00ae')); // registered sign = registered trade mark sign, U+00AE ISOnum
- entityMap.put("macr", new Character('\u00af')); // macron = spacing macron = overline = APL overbar, U+00AF ISOdia
- entityMap.put("deg", new Character('\u00b0')); // degree sign, U+00B0 ISOnum
- entityMap.put("plusmn", new Character('\u00b1')); // plus-minus sign = plus-or-minus sign, U+00B1 ISOnum
- entityMap.put("sup2", new Character('\u00b2')); // superscript two = superscript digit two = squared, U+00B2 ISOnum
- entityMap.put("sup3", new Character('\u00b3')); // superscript three = superscript digit three = cubed, U+00B3 ISOnum
- entityMap.put("acute", new Character('\u00b4')); // acute accent = spacing acute, U+00B4 ISOdia
- entityMap.put("micro", new Character('\u00b5')); // micro sign, U+00B5 ISOnum
- entityMap.put("para", new Character('\u00b6')); // pilcrow sign = paragraph sign, U+00B6 ISOnum
- entityMap.put("middot", new Character('\u00b7')); // middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum
- entityMap.put("cedil", new Character('\u00b8')); // cedilla = spacing cedilla, U+00B8 ISOdia
- entityMap.put("sup1", new Character('\u00b9')); // superscript one = superscript digit one, U+00B9 ISOnum
- entityMap.put("ordm", new Character('\u00ba')); // masculine ordinal indicator, U+00BA ISOnum
- entityMap.put("raquo", new Character('\u00bb')); // right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum
- entityMap.put("frac14", new Character('\u00bc')); // vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum
- entityMap.put("frac12", new Character('\u00bd')); // vulgar fraction one half = fraction one half, U+00BD ISOnum
- entityMap.put("frac34", new Character('\u00be')); // vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum
- entityMap.put("iquest", new Character('\u00bf')); // inverted question mark = turned question mark, U+00BF ISOnum
- entityMap.put("Agrave", new Character('\u00c0')); // latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1
- entityMap.put("Aacute", new Character('\u00c1')); // latin capital letter A with acute, U+00C1 ISOlat1
- entityMap.put("Acirc", new Character('\u00c2')); // latin capital letter A with circumflex, U+00C2 ISOlat1
- entityMap.put("Atilde", new Character('\u00c3')); // latin capital letter A with tilde, U+00C3 ISOlat1
- entityMap.put("Auml", new Character('\u00c4')); // latin capital letter A with diaeresis, U+00C4 ISOlat1
- entityMap.put("Aring", new Character('\u00c5')); // latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1
- entityMap.put("AElig", new Character('\u00c6')); // latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1
- entityMap.put("Ccedil", new Character('\u00c7')); // latin capital letter C with cedilla, U+00C7 ISOlat1
- entityMap.put("Egrave", new Character('\u00c8')); // latin capital letter E with grave, U+00C8 ISOlat1
- entityMap.put("Eacute", new Character('\u00c9')); // latin capital letter E with acute, U+00C9 ISOlat1
- entityMap.put("Ecirc", new Character('\u00ca')); // latin capital letter E with circumflex, U+00CA ISOlat1
- entityMap.put("Euml", new Character('\u00cb')); // latin capital letter E with diaeresis, U+00CB ISOlat1
- entityMap.put("Igrave", new Character('\u00cc')); // latin capital letter I with grave, U+00CC ISOlat1
- entityMap.put("Iacute", new Character('\u00cd')); // latin capital letter I with acute, U+00CD ISOlat1
- entityMap.put("Icirc", new Character('\u00ce')); // latin capital letter I with circumflex, U+00CE ISOlat1
- entityMap.put("Iuml", new Character('\u00cf')); // latin capital letter I with diaeresis, U+00CF ISOlat1
- entityMap.put("ETH", new Character('\u00d0')); // latin capital letter ETH, U+00D0 ISOlat1
- entityMap.put("Ntilde", new Character('\u00d1')); // latin capital letter N with tilde, U+00D1 ISOlat1
- entityMap.put("Ograve", new Character('\u00d2')); // latin capital letter O with grave, U+00D2 ISOlat1
- entityMap.put("Oacute", new Character('\u00d3')); // latin capital letter O with acute, U+00D3 ISOlat1
- entityMap.put("Ocirc", new Character('\u00d4')); // latin capital letter O with circumflex, U+00D4 ISOlat1
- entityMap.put("Otilde", new Character('\u00d5')); // latin capital letter O with tilde, U+00D5 ISOlat1
- entityMap.put("Ouml", new Character('\u00d6')); // latin capital letter O with diaeresis, U+00D6 ISOlat1
- entityMap.put("times", new Character('\u00d7')); // multiplication sign, U+00D7 ISOnum
- entityMap.put("Oslash", new Character('\u00d8')); // latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1
- entityMap.put("Ugrave", new Character('\u00d9')); // latin capital letter U with grave, U+00D9 ISOlat1
- entityMap.put("Uacute", new Character('\u00da')); // latin capital letter U with acute, U+00DA ISOlat1
- entityMap.put("Ucirc", new Character('\u00db')); // latin capital letter U with circumflex, U+00DB ISOlat1
- entityMap.put("Uuml", new Character('\u00dc')); // latin capital letter U with diaeresis, U+00DC ISOlat1
- entityMap.put("Yacute", new Character('\u00dd')); // latin capital letter Y with acute, U+00DD ISOlat1
- entityMap.put("THORN", new Character('\u00de')); // latin capital letter THORN, U+00DE ISOlat1
- entityMap.put("szlig", new Character('\u00df')); // latin small letter sharp s = ess-zed, U+00DF ISOlat1
- entityMap.put("agrave", new Character('\u00e0')); // latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1
- entityMap.put("aacute", new Character('\u00e1')); // latin small letter a with acute, U+00E1 ISOlat1
- entityMap.put("acirc", new Character('\u00e2')); // latin small letter a with circumflex, U+00E2 ISOlat1
- entityMap.put("atilde", new Character('\u00e3')); // latin small letter a with tilde, U+00E3 ISOlat1
- entityMap.put("auml", new Character('\u00e4')); // latin small letter a with diaeresis, U+00E4 ISOlat1
- entityMap.put("aring", new Character('\u00e5')); // latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1
- entityMap.put("aelig", new Character('\u00e6')); // latin small letter ae = latin small ligature ae, U+00E6 ISOlat1
- entityMap.put("ccedil", new Character('\u00e7')); // latin small letter c with cedilla, U+00E7 ISOlat1
- entityMap.put("egrave", new Character('\u00e8')); // latin small letter e with grave, U+00E8 ISOlat1
- entityMap.put("eacute", new Character('\u00e9')); // latin small letter e with acute, U+00E9 ISOlat1
- entityMap.put("ecirc", new Character('\u00ea')); // latin small letter e with circumflex, U+00EA ISOlat1
- entityMap.put("euml", new Character('\u00eb')); // latin small letter e with diaeresis, U+00EB ISOlat1
- entityMap.put("igrave", new Character('\u00ec')); // latin small letter i with grave, U+00EC ISOlat1
- entityMap.put("iacute", new Character('\u00ed')); // latin small letter i with acute, U+00ED ISOlat1
- entityMap.put("icirc", new Character('\u00ee')); // latin small letter i with circumflex, U+00EE ISOlat1
- entityMap.put("iuml", new Character('\u00ef')); // latin small letter i with diaeresis, U+00EF ISOlat1
- entityMap.put("eth", new Character('\u00f0')); // latin small letter eth, U+00F0 ISOlat1
- entityMap.put("ntilde", new Character('\u00f1')); // latin small letter n with tilde, U+00F1 ISOlat1
- entityMap.put("ograve", new Character('\u00f2')); // latin small letter o with grave, U+00F2 ISOlat1
- entityMap.put("oacute", new Character('\u00f3')); // latin small letter o with acute, U+00F3 ISOlat1
- entityMap.put("ocirc", new Character('\u00f4')); // latin small letter o with circumflex, U+00F4 ISOlat1
- entityMap.put("otilde", new Character('\u00f5')); // latin small letter o with tilde, U+00F5 ISOlat1
- entityMap.put("ouml", new Character('\u00f6')); // latin small letter o with diaeresis, U+00F6 ISOlat1
- entityMap.put("divide", new Character('\u00f7')); // division sign, U+00F7 ISOnum
- entityMap.put("oslash", new Character('\u00f8')); // latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1
- entityMap.put("ugrave", new Character('\u00f9')); // latin small letter u with grave, U+00F9 ISOlat1
- entityMap.put("uacute", new Character('\u00fa')); // latin small letter u with acute, U+00FA ISOlat1
- entityMap.put("ucirc", new Character('\u00fb')); // latin small letter u with circumflex, U+00FB ISOlat1
- entityMap.put("uuml", new Character('\u00fc')); // latin small letter u with diaeresis, U+00FC ISOlat1
- entityMap.put("yacute", new Character('\u00fd')); // latin small letter y with acute, U+00FD ISOlat1
- entityMap.put("thorn", new Character('\u00fe')); // latin small letter thorn, U+00FE ISOlat1
- entityMap.put("yuml", new Character('\u00ff')); // latin small letter y with diaeresis, U+00FF ISOlat1
- // Latin Extended-B
- entityMap.put("fnof", new Character('\u0192')); // latin small f with hook = function = florin, U+0192 ISOtech
- // Greek
- entityMap.put("Alpha", new Character('\u0391')); // greek capital letter alpha, U+0391
- entityMap.put("Beta", new Character('\u0392')); // greek capital letter beta, U+0392
- entityMap.put("Gamma", new Character('\u0393')); // greek capital letter gamma, U+0393 ISOgrk3
- entityMap.put("Delta", new Character('\u0394')); // greek capital letter delta, U+0394 ISOgrk3
- entityMap.put("Epsilon", new Character('\u0395')); // greek capital letter epsilon, U+0395
- entityMap.put("Zeta", new Character('\u0396')); // greek capital letter zeta, U+0396
- entityMap.put("Eta", new Character('\u0397')); // greek capital letter eta, U+0397
- entityMap.put("Theta", new Character('\u0398')); // greek capital letter theta, U+0398 ISOgrk3
- entityMap.put("Iota", new Character('\u0399')); // greek capital letter iota, U+0399
- entityMap.put("Kappa", new Character('\u039a')); // greek capital letter kappa, U+039A
- entityMap.put("Lambda", new Character('\u039b')); // greek capital letter lambda, U+039B ISOgrk3
- entityMap.put("Mu", new Character('\u039c')); // greek capital letter mu, U+039C
- entityMap.put("Nu", new Character('\u039d')); // greek capital letter nu, U+039D
- entityMap.put("Xi", new Character('\u039e')); // greek capital letter xi, U+039E ISOgrk3
- entityMap.put("Omicron", new Character('\u039f')); // greek capital letter omicron, U+039F
- entityMap.put("Pi", new Character('\u03a0')); // greek capital letter pi, U+03A0 ISOgrk3
- entityMap.put("Rho", new Character('\u03a1')); // greek capital letter rho, U+03A1
- // there is no Sigmaf, and no U+03A2 character either
- entityMap.put("Sigma", new Character('\u03a3')); // greek capital letter sigma, U+03A3 ISOgrk3
- entityMap.put("Tau", new Character('\u03a4')); // greek capital letter tau, U+03A4
- entityMap.put("Upsilon", new Character('\u03a5')); // greek capital letter upsilon, U+03A5 ISOgrk3
- entityMap.put("Phi", new Character('\u03a6')); // greek capital letter phi, U+03A6 ISOgrk3
- entityMap.put("Chi", new Character('\u03a7')); // greek capital letter chi, U+03A7
- entityMap.put("Psi", new Character('\u03a8')); // greek capital letter psi, U+03A8 ISOgrk3
- entityMap.put("Omega", new Character('\u03a9')); // greek capital letter omega, U+03A9 ISOgrk3
- entityMap.put("alpha", new Character('\u03b1')); // greek small letter alpha, U+03B1 ISOgrk3
- entityMap.put("beta", new Character('\u03b2')); // greek small letter beta, U+03B2 ISOgrk3
- entityMap.put("gamma", new Character('\u03b3')); // greek small letter gamma, U+03B3 ISOgrk3
- entityMap.put("delta", new Character('\u03b4')); // greek small letter delta, U+03B4 ISOgrk3
- entityMap.put("epsilon", new Character('\u03b5')); // greek small letter epsilon, U+03B5 ISOgrk3
- entityMap.put("zeta", new Character('\u03b6')); // greek small letter zeta, U+03B6 ISOgrk3
- entityMap.put("eta", new Character('\u03b7')); // greek small letter eta, U+03B7 ISOgrk3
- entityMap.put("theta", new Character('\u03b8')); // greek small letter theta, U+03B8 ISOgrk3
- entityMap.put("iota", new Character('\u03b9')); // greek small letter iota, U+03B9 ISOgrk3
- entityMap.put("kappa", new Character('\u03ba')); // greek small letter kappa, U+03BA ISOgrk3
- entityMap.put("lambda", new Character('\u03bb')); // greek small letter lambda, U+03BB ISOgrk3
- entityMap.put("mu", new Character('\u03bc')); // greek small letter mu, U+03BC ISOgrk3
- entityMap.put("nu", new Character('\u03bd')); // greek small letter nu, U+03BD ISOgrk3
- entityMap.put("xi", new Character('\u03be')); // greek small letter xi, U+03BE ISOgrk3
- entityMap.put("omicron", new Character('\u03bf')); // greek small letter omicron, U+03BF NEW
- entityMap.put("pi", new Character('\u03c0')); // greek small letter pi, U+03C0 ISOgrk3
- entityMap.put("rho", new Character('\u03c1')); // greek small letter rho, U+03C1 ISOgrk3
- entityMap.put("sigmaf", new Character('\u03c2')); // greek small letter final sigma, U+03C2 ISOgrk3
- entityMap.put("sigma", new Character('\u03c3')); // greek small letter sigma, U+03C3 ISOgrk3
- entityMap.put("tau", new Character('\u03c4')); // greek small letter tau, U+03C4 ISOgrk3
- entityMap.put("upsilon", new Character('\u03c5')); // greek small letter upsilon, U+03C5 ISOgrk3
- entityMap.put("phi", new Character('\u03c6')); // greek small letter phi, U+03C6 ISOgrk3
- entityMap.put("chi", new Character('\u03c7')); // greek small letter chi, U+03C7 ISOgrk3
- entityMap.put("psi", new Character('\u03c8')); // greek small letter psi, U+03C8 ISOgrk3
- entityMap.put("omega", new Character('\u03c9')); // greek small letter omega, U+03C9 ISOgrk3
- entityMap.put("thetasym", new Character('\u03d1')); // greek small letter theta symbol, U+03D1 NEW
- entityMap.put("upsih", new Character('\u03d2')); // greek upsilon with hook symbol, U+03D2 NEW
- entityMap.put("piv", new Character('\u03d6')); // greek pi symbol, U+03D6 ISOgrk3
- // General Punctuation
- entityMap.put("bull", new Character('\u2022')); // bullet = black small circle, U+2022 ISOpub
- // bullet is NOT the same as bullet operator, U+2219
- entityMap.put("hellip", new Character('\u2026')); // horizontal ellipsis = three dot leader, U+2026 ISOpub
- entityMap.put("prime", new Character('\u2032')); // prime = minutes = feet, U+2032 ISOtech
- entityMap.put("Prime", new Character('\u2033')); // double prime = seconds = inches, U+2033 ISOtech
- entityMap.put("oline", new Character('\u203e')); // overline = spacing overscore, U+203E NEW
- entityMap.put("frasl", new Character('\u2044')); // fraction slash, U+2044 NEW
- // Letterlike Symbols
- entityMap.put("weierp", new Character('\u2118')); // script capital P = power set = Weierstrass p, U+2118 ISOamso
- entityMap.put("image", new Character('\u2111')); // blackletter capital I = imaginary part, U+2111 ISOamso
- entityMap.put("real", new Character('\u211c')); // blackletter capital R = real part symbol, U+211C ISOamso
- entityMap.put("trade", new Character('\u2122')); // trade mark sign, U+2122 ISOnum
- entityMap.put("alefsym", new Character('\u2135')); // alef symbol = first transfinite cardinal, U+2135 NEW
- // alef symbol is NOT the same as hebrew letter alef,
- // U+05D0 although the same glyph could be used to depict both characters
- // Arrows
- entityMap.put("larr", new Character('\u2190')); // leftwards arrow, U+2190 ISOnum
- entityMap.put("uarr", new Character('\u2191')); // upwards arrow, U+2191 ISOnum
- entityMap.put("rarr", new Character('\u2192')); // rightwards arrow, U+2192 ISOnum
- entityMap.put("darr", new Character('\u2193')); // downwards arrow, U+2193 ISOnum
- entityMap.put("harr", new Character('\u2194')); // left right arrow, U+2194 ISOamsa
- entityMap.put("crarr", new Character('\u21b5')); // downwards arrow with corner leftwards = carriage return, U+21B5 NEW
- entityMap.put("lArr", new Character('\u21d0')); // leftwards double arrow, U+21D0 ISOtech
- // ISO 10646 does not say that lArr is the same as the 'is implied by' arrow
- // but also does not have any other character for that function. So ? lArr can
- // be used for 'is implied by' as ISOtech suggests
- entityMap.put("uArr", new Character('\u21d1')); // upwards double arrow, U+21D1 ISOamsa
- entityMap.put("rArr", new Character('\u21d2')); // rightwards double arrow, U+21D2 ISOtech
- // ISO 10646 does not say this is the 'implies' character but does not have
- // another character with this function so ?
- // rArr can be used for 'implies' as ISOtech suggests
- entityMap.put("dArr", new Character('\u21d3')); // downwards double arrow, U+21D3 ISOamsa
- entityMap.put("hArr", new Character('\u21d4')); // left right double arrow, U+21D4 ISOamsa
- // Mathematical Operators
- entityMap.put("forall", new Character('\u2200')); // for all, U+2200 ISOtech
- entityMap.put("part", new Character('\u2202')); // partial differential, U+2202 ISOtech
- entityMap.put("exist", new Character('\u2203')); // there exists, U+2203 ISOtech
- entityMap.put("empty", new Character('\u2205')); // empty set = null set = diameter, U+2205 ISOamso
- entityMap.put("nabla", new Character('\u2207')); // nabla = backward difference, U+2207 ISOtech
- entityMap.put("isin", new Character('\u2208')); // element of, U+2208 ISOtech
- entityMap.put("notin", new Character('\u2209')); // not an element of, U+2209 ISOtech
- entityMap.put("ni", new Character('\u220b')); // contains as member, U+220B ISOtech
- // should there be a more memorable name than 'ni'?
- entityMap.put("prod", new Character('\u220f')); // n-ary product = product sign, U+220F ISOamsb
- // prod is NOT the same character as U+03A0 'greek capital letter pi' though
- // the same glyph might be used for both
- entityMap.put("sum", new Character('\u2211')); // n-ary sumation, U+2211 ISOamsb
- // sum is NOT the same character as U+03A3 'greek capital letter sigma'
- // though the same glyph might be used for both
- entityMap.put("minus", new Character('\u2212')); // minus sign, U+2212 ISOtech
- entityMap.put("lowast", new Character('\u2217')); // asterisk operator, U+2217 ISOtech
- entityMap.put("radic", new Character('\u221a')); // square root = radical sign, U+221A ISOtech
- entityMap.put("prop", new Character('\u221d')); // proportional to, U+221D ISOtech
- entityMap.put("infin", new Character('\u221e')); // infinity, U+221E ISOtech
- entityMap.put("ang", new Character('\u2220')); // angle, U+2220 ISOamso
- entityMap.put("and", new Character('\u2227')); // logical and = wedge, U+2227 ISOtech
- entityMap.put("or", new Character('\u2228')); // logical or = vee, U+2228 ISOtech
- entityMap.put("cap", new Character('\u2229')); // intersection = cap, U+2229 ISOtech
- entityMap.put("cup", new Character('\u222a')); // union = cup, U+222A ISOtech
- entityMap.put("int", new Character('\u222b')); // integral, U+222B ISOtech
- entityMap.put("there4", new Character('\u2234')); // therefore, U+2234 ISOtech
- entityMap.put("sim", new Character('\u223c')); // tilde operator = varies with = similar to, U+223C ISOtech
- // tilde operator is NOT the same character as the tilde, U+007E,
- // although the same glyph might be used to represent both
- entityMap.put("cong", new Character('\u2245')); // approximately equal to, U+2245 ISOtech
- entityMap.put("asymp", new Character('\u2248')); // almost equal to = asymptotic to, U+2248 ISOamsr
- entityMap.put("ne", new Character('\u2260')); // not equal to, U+2260 ISOtech
- entityMap.put("equiv", new Character('\u2261')); // identical to, U+2261 ISOtech
- entityMap.put("le", new Character('\u2264')); // less-than or equal to, U+2264 ISOtech
- entityMap.put("ge", new Character('\u2265')); // greater-than or equal to, U+2265 ISOtech
- entityMap.put("sub", new Character('\u2282')); // subset of, U+2282 ISOtech
- entityMap.put("sup", new Character('\u2283')); // superset of, U+2283 ISOtech
- // note that nsup, 'not a superset of, U+2283' is not covered by the Symbol
- // font encoding and is not included. Should it be, for symmetry?
- // It is in ISOamsn
- entityMap.put("nsub", new Character('\u2284')); // not a subset of, U+2284 ISOamsn
- entityMap.put("sube", new Character('\u2286')); // subset of or equal to, U+2286 ISOtech
- entityMap.put("supe", new Character('\u2287')); // superset of or equal to, U+2287 ISOtech
- entityMap.put("oplus", new Character('\u2295')); // circled plus = direct sum, U+2295 ISOamsb
- entityMap.put("otimes", new Character('\u2297')); // circled times = vector product, U+2297 ISOamsb
- entityMap.put("perp", new Character('\u22a5')); // up tack = orthogonal to = perpendicular, U+22A5 ISOtech
- entityMap.put("sdot", new Character('\u22c5')); // dot operator, U+22C5 ISOamsb
- // dot operator is NOT the same character as U+00B7 middle dot
- // Miscellaneous Technical
- entityMap.put("lceil", new Character('\u2308')); // left ceiling = apl upstile, U+2308 ISOamsc
- entityMap.put("rceil", new Character('\u2309')); // right ceiling, U+2309 ISOamsc
- entityMap.put("lfloor", new Character('\u230a')); // left floor = apl downstile, U+230A ISOamsc
- entityMap.put("rfloor", new Character('\u230b')); // right floor, U+230B ISOamsc
- entityMap.put("lang", new Character('\u2329')); // left-pointing angle bracket = bra, U+2329 ISOtech
- // lang is NOT the same character as U+003C 'less than'
- // or U+2039 'single left-pointing angle quotation mark'
- entityMap.put("rang", new Character('\u232a')); // right-pointing angle bracket = ket, U+232A ISOtech
- // rang is NOT the same character as U+003E 'greater than'
- // or U+203A 'single right-pointing angle quotation mark'
- // Geometric Shapes
- entityMap.put("loz", new Character('\u25ca')); // lozenge, U+25CA ISOpub
- // Miscellaneous Symbols
- entityMap.put("spades", new Character('\u2660')); // black spade suit, U+2660 ISOpub
- // black here seems to mean filled as opposed to hollow
- entityMap.put("clubs", new Character('\u2663')); // black club suit = shamrock, U+2663 ISOpub
- entityMap.put("hearts", new Character('\u2665')); // black heart suit = valentine, U+2665 ISOpub
- entityMap.put("diams", new Character('\u2666')); // black diamond suit, U+2666 ISOpub
- // C0 Controls and Basic Latin
- entityMap.put("quot", new Character('\u0022')); // quotation mark = APL quote, U+0022 ISOnum
- entityMap.put("amp", new Character('\u0026')); // ampersand, U+0026 ISOnum
- entityMap.put("apos", new Character('\''));
- entityMap.put("lt", new Character('\u003c')); // less-than sign, U+003C ISOnum
- entityMap.put("gt", new Character('\u003e')); // greater-than sign, U+003E ISOnum
- // Latin Extended-A
- entityMap.put("OElig", new Character('\u0152')); // latin capital ligature OE, U+0152 ISOlat2
- entityMap.put("oelig", new Character('\u0153')); // latin small ligature oe, U+0153 ISOlat2
- // ligature is a misnomer, this is a separate character in some languages
- entityMap.put("Scaron", new Character('\u0160')); // latin capital letter S with caron, U+0160 ISOlat2
- entityMap.put("scaron", new Character('\u0161')); // latin small letter s with caron, U+0161 ISOlat2
- entityMap.put("Yuml", new Character('\u0178')); // latin capital letter Y with diaeresis, U+0178 ISOlat2
- // Spacing Modifier Letters
- entityMap.put("circ", new Character('\u02c6')); // modifier letter circumflex accent, U+02C6 ISOpub
- entityMap.put("tilde", new Character('\u02dc')); // small tilde, U+02DC ISOdia
- // General Punctuation
- entityMap.put("ensp", new Character('\u2002')); // en space, U+2002 ISOpub
- entityMap.put("emsp", new Character('\u2003')); // em space, U+2003 ISOpub
- entityMap.put("thinsp", new Character('\u2009')); // thin space, U+2009 ISOpub
- entityMap.put("zwnj", new Character('\u200c')); // zero width non-joiner, U+200C NEW RFC 2070
- entityMap.put("zwj", new Character('\u200d')); // zero width joiner, U+200D NEW RFC 2070
- entityMap.put("lrm", new Character('\u200e')); // left-to-right mark, U+200E NEW RFC 2070
- entityMap.put("rlm", new Character('\u200f')); // right-to-left mark, U+200F NEW RFC 2070
- entityMap.put("ndash", new Character('\u2013')); // en dash, U+2013 ISOpub
- entityMap.put("mdash", new Character('\u2014')); // em dash, U+2014 ISOpub
- entityMap.put("lsquo", new Character('\u2018')); // left single quotation mark, U+2018 ISOnum
- entityMap.put("rsquo", new Character('\u2019')); // right single quotation mark, U+2019 ISOnum
- entityMap.put("sbquo", new Character('\u201a')); // single low-9 quotation mark, U+201A NEW
- entityMap.put("ldquo", new Character('\u201c')); // left double quotation mark, U+201C ISOnum
- entityMap.put("rdquo", new Character('\u201d')); // right double quotation mark, U+201D ISOnum
- entityMap.put("bdquo", new Character('\u201e')); // double low-9 quotation mark, U+201E NEW
- entityMap.put("dagger", new Character('\u2020')); // dagger, U+2020 ISOpub
- entityMap.put("Dagger", new Character('\u2021')); // double dagger, U+2021 ISOpub
- entityMap.put("permil", new Character('\u2030')); // per mille sign, U+2030 ISOtech
- entityMap.put("lsaquo", new Character('\u2039')); // single left-pointing angle quotation mark, U+2039 ISO proposed
- // lsaquo is proposed but not yet ISO standardized
- entityMap.put("rsaquo", new Character('\u203a')); // single right-pointing angle quotation mark, U+203A ISO proposed
- // rsaquo is proposed but not yet ISO standardized
- entityMap.put("euro", new Character('\u20ac')); // euro sign, U+20AC NEW
-
-
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/SpotColor.java b/LibrarySource/com/lowagie/text/pdf/SpotColor.java
deleted file mode 100644
index 6b74fc9..0000000
--- a/LibrarySource/com/lowagie/text/pdf/SpotColor.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * $Id: SpotColor.java,v 1.13 2002/07/09 11:28:24 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-/**
- *
- * @author psoares
- */
-public class SpotColor extends ExtendedColor {
-
- PdfSpotColor spot;
- float tint;
-
- public SpotColor(PdfSpotColor spot, float tint) {
- super(TYPE_SEPARATION,
- (float)spot.getAlternativeCS().getRed() / 255f * tint,
- (float)spot.getAlternativeCS().getGreen() / 255f * tint,
- (float)spot.getAlternativeCS().getBlue() / 255f * tint);
- this.spot = spot;
- this.tint = tint;
- }
-
- public SpotColor(PdfSpotColor spot) {
- this(spot, spot.getTint());
- }
-
- public PdfSpotColor getPdfSpotColor() {
- return spot;
- }
-
- public float getTint() {
- return tint;
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/TextField.java b/LibrarySource/com/lowagie/text/pdf/TextField.java
deleted file mode 100644
index 89eda88..0000000
--- a/LibrarySource/com/lowagie/text/pdf/TextField.java
+++ /dev/null
@@ -1,556 +0,0 @@
-/*
- * Copyright 2003-2005 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import headless.awt.Color;
-import com.lowagie.text.Element;
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.Rectangle;
-import java.io.IOException;
-import java.util.ArrayList;
-
-/** Supports text, combo and list fields generating the correct appearances.
- * All the option in the Acrobat GUI are supported in an easy to use API.
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class TextField extends BaseField {
-
- /** Holds value of property defaultText. */
- private String defaultText;
-
- /** Holds value of property choices. */
- private String[] choices;
-
- /** Holds value of property choiceExports. */
- private String[] choiceExports;
-
- /** Holds value of property choiceSelection. */
- private int choiceSelection;
-
- private int topFirst;
- /** Creates a new <CODE>TextField</CODE>.
- * @param writer the document <CODE>PdfWriter</CODE>
- * @param box the field location and dimensions
- * @param fieldName the field name. If <CODE>null</CODE> only the widget keys
- * will be included in the field allowing it to be used as a kid field.
- */
- public TextField(PdfWriter writer, Rectangle box, String fieldName) {
- super(writer, box, fieldName);
- }
-
- /**
- * Gets the appearance for this TextField.
- * @return the appearance object for this TextField
- * @throws IOException
- * @throws DocumentException
- */
- public PdfAppearance getAppearance() throws IOException, DocumentException {
- PdfAppearance app = getBorderAppearance();
- app.beginVariableText();
- if (text == null || text.length() == 0) {
- app.endVariableText();
- return app;
- }
- BaseFont ufont = getRealFont();
- boolean borderExtra = borderStyle == PdfBorderDictionary.STYLE_BEVELED || borderStyle == PdfBorderDictionary.STYLE_INSET;
- float h = box.height() - borderWidth * 2;
- float bw2 = borderWidth;
- if (borderExtra) {
- h -= borderWidth * 2;
- bw2 *= 2;
- }
- float offsetX = (borderExtra ? 2 * borderWidth : borderWidth);
- offsetX = Math.max(offsetX, 1);
- float offX = Math.min(bw2, offsetX);
- app.saveState();
- app.rectangle(offX, offX, box.width() - 2 * offX, box.height() - 2 * offX);
- app.clip();
- app.newPath();
- if (textColor == null)
- app.setGrayFill(0);
- else
- app.setColorFill(textColor);
- app.beginText();
- if ((options & MULTILINE) != 0) {
- float usize = fontSize;
- float width = box.width() - 3 * offsetX;
- ArrayList breaks = getHardBreaks(text);
- ArrayList lines = breaks;
- float factor = ufont.getFontDescriptor(BaseFont.BBOXURY, 1) - ufont.getFontDescriptor(BaseFont.BBOXLLY, 1);
- if (usize == 0) {
- usize = h / breaks.size() / factor;
- if (usize > 4) {
- if (usize > 12)
- usize = 12;
- float step = Math.max((usize - 4) / 10, 0.2f);
- for (; usize > 4; usize -= step) {
- lines = breakLines(breaks, ufont, usize, width);
- if (lines.size() * usize * factor <= h)
- break;
- }
- }
- if (usize <= 4) {
- usize = 4;
- lines = breakLines(breaks, ufont, usize, width);
- }
- }
- else
- lines = breakLines(breaks, ufont, usize, width);
- app.setFontAndSize(ufont, usize);
- app.setLeading(usize * factor);
- float offsetY = offsetX + h - ufont.getFontDescriptor(BaseFont.BBOXURY, usize);
- String nt = (String)lines.get(0);
- if (alignment == Element.ALIGN_RIGHT) {
- float wd = ufont.getWidthPoint(nt, usize);
- app.moveText(box.width() - 2 * offsetX - wd, offsetY);
- }
- else if (alignment == Element.ALIGN_CENTER) {
- nt = nt.trim();
- float wd = ufont.getWidthPoint(nt, usize);
- app.moveText(box.width() / 2 - wd / 2, offsetY);
- }
- else
- app.moveText(2 * offsetX, offsetY);
- app.showText(nt);
- int maxline = (int)(h / usize / factor) + 1;
- maxline = Math.min(maxline, lines.size());
- for (int k = 1; k < maxline; ++k) {
- nt = (String)lines.get(k);
- if (alignment == Element.ALIGN_RIGHT) {
- float wd = ufont.getWidthPoint(nt, usize);
- app.moveText(box.width() - 2 * offsetX - wd - app.getXTLM(), 0);
- }
- else if (alignment == Element.ALIGN_CENTER) {
- nt = nt.trim();
- float wd = ufont.getWidthPoint(nt, usize);
- app.moveText(box.width() / 2 - wd / 2 - app.getXTLM(), 0);
- }
- app.newlineShowText(nt);
- }
- }
- else {
- float usize = fontSize;
- if (usize == 0) {
- float maxCalculatedSize = h / (ufont.getFontDescriptor(BaseFont.BBOXURX, 1) - ufont.getFontDescriptor(BaseFont.BBOXLLY, 1));
- float wd = ufont.getWidthPoint(text, 1);
- if (wd == 0)
- usize = maxCalculatedSize;
- else
- usize = (box.width() - 2 * offsetX) / wd;
- if (usize > maxCalculatedSize)
- usize = maxCalculatedSize;
- if (usize < 4)
- usize = 4;
- }
- app.setFontAndSize(ufont, usize);
- float offsetY = offX + ((box.height() - 2*offX) - ufont.getFontDescriptor(BaseFont.ASCENT, usize)) / 2;
- if (offsetY < offX)
- offsetY = offX;
- if (offsetY - offX < -ufont.getFontDescriptor(BaseFont.DESCENT, usize)) {
- float ny = -ufont.getFontDescriptor(BaseFont.DESCENT, usize) + offX;
- float dy = box.height() - offX - ufont.getFontDescriptor(BaseFont.ASCENT, usize);
- offsetY = Math.min(ny, Math.max(offsetY, dy));
- }
- if ((options & COMB) != 0 && maxCharacterLength > 0) {
- int textLen = Math.min(maxCharacterLength, text.length());
- int position = 0;
- if (alignment == Element.ALIGN_RIGHT) {
- position = maxCharacterLength - textLen;
- }
- else if (alignment == Element.ALIGN_CENTER) {
- position = (maxCharacterLength - textLen) / 2;
- }
- float step = box.width() / maxCharacterLength;
- float start = step / 2 + position * step;
- for (int k = 0; k < textLen; ++k) {
- String c = text.substring(k, k + 1);
- float wd = ufont.getWidthPoint(c, usize);
- app.setTextMatrix(start - wd / 2, offsetY);
- app.showText(c);
- start += step;
- }
- }
- else {
- if (alignment == Element.ALIGN_RIGHT) {
- float wd = ufont.getWidthPoint(text, usize);
- app.moveText(box.width() - 2 * offsetX - wd, offsetY);
- }
- else if (alignment == Element.ALIGN_CENTER) {
- float wd = ufont.getWidthPoint(text, usize);
- app.moveText(box.width() / 2 - wd / 2, offsetY);
- }
- else
- app.moveText(2 * offsetX, offsetY);
- app.showText(text);
- }
- }
- app.endText();
- app.restoreState();
- app.endVariableText();
- return app;
- }
-
- PdfAppearance getListAppearance() throws IOException, DocumentException {
- PdfAppearance app = getBorderAppearance();
- app.beginVariableText();
- if (choices == null || choices.length == 0) {
- app.endVariableText();
- return app;
- }
- int topChoice = choiceSelection;
- if (topChoice >= choices.length) {
- topChoice = choices.length - 1;
- }
- if (topChoice < 0)
- topChoice = 0;
- BaseFont ufont = getRealFont();
- float usize = fontSize;
- if (usize == 0)
- usize = 12;
- boolean borderExtra = borderStyle == PdfBorderDictionary.STYLE_BEVELED || borderStyle == PdfBorderDictionary.STYLE_INSET;
- float h = box.height() - borderWidth * 2;
- if (borderExtra)
- h -= borderWidth * 2;
- float offsetX = (borderExtra ? 2 * borderWidth : borderWidth);
- float leading = ufont.getFontDescriptor(BaseFont.BBOXURY, usize) - ufont.getFontDescriptor(BaseFont.BBOXLLY, usize);
- int maxFit = (int)(h / leading) + 1;
- int first = 0;
- int last = 0;
- last = topChoice + maxFit / 2 + 1;
- first = last - maxFit;
- if (first < 0) {
- last += first;
- first = 0;
- }
-// first = topChoice;
- last = first + maxFit;
- if (last > choices.length)
- last = choices.length;
- topFirst = first;
- app.saveState();
- app.rectangle(offsetX, offsetX, box.width() - 2 * offsetX, box.height() - 2 * offsetX);
- app.clip();
- app.newPath();
- Color mColor;
- if (textColor == null)
- mColor = new GrayColor(0);
- else
- mColor = textColor;
- app.setColorFill(new Color(10, 36, 106));
- app.rectangle(offsetX, offsetX + h - (topChoice - first + 1) * leading, box.width() - 2 * offsetX, leading);
- app.fill();
- app.beginText();
- app.setFontAndSize(ufont, usize);
- app.setLeading(leading);
- app.moveText(offsetX * 2, offsetX + h - ufont.getFontDescriptor(BaseFont.BBOXURY, usize) + leading);
- app.setColorFill(mColor);
- for (int idx = first; idx < last; ++idx) {
- if (idx == topChoice) {
- app.setGrayFill(1);
- app.newlineShowText(choices[idx]);
- app.setColorFill(mColor);
- }
- else
- app.newlineShowText(choices[idx]);
- }
- app.endText();
- app.restoreState();
- app.endVariableText();
- return app;
- }
-
- /** Gets a new text field.
- * @throws IOException on error
- * @throws DocumentException on error
- * @return a new text field
- */
- public PdfFormField getTextField() throws IOException, DocumentException {
- if (maxCharacterLength <= 0)
- options &= ~COMB;
- if ((options & COMB) != 0)
- options &= ~MULTILINE;
- PdfFormField field = PdfFormField.createTextField(writer, false, false, maxCharacterLength);
- field.setWidget(box, PdfAnnotation.HIGHLIGHT_INVERT);
- switch (alignment) {
- case Element.ALIGN_CENTER:
- field.setQuadding(PdfFormField.Q_CENTER);
- break;
- case Element.ALIGN_RIGHT:
- field.setQuadding(PdfFormField.Q_RIGHT);
- break;
- }
- if (rotation != 0)
- field.setMKRotation(rotation);
- if (fieldName != null) {
- field.setFieldName(fieldName);
- field.setValueAsString(text);
- if (defaultText != null)
- field.setDefaultValueAsString(defaultText);
- if ((options & READ_ONLY) != 0)
- field.setFieldFlags(PdfFormField.FF_READ_ONLY);
- if ((options & REQUIRED) != 0)
- field.setFieldFlags(PdfFormField.FF_REQUIRED);
- if ((options & MULTILINE) != 0)
- field.setFieldFlags(PdfFormField.FF_MULTILINE);
- if ((options & DO_NOT_SCROLL) != 0)
- field.setFieldFlags(PdfFormField.FF_DONOTSCROLL);
- if ((options & PASSWORD) != 0)
- field.setFieldFlags(PdfFormField.FF_PASSWORD);
- if ((options & FILE_SELECTION) != 0)
- field.setFieldFlags(PdfFormField.FF_FILESELECT);
- if ((options & DO_NOT_SPELL_CHECK) != 0)
- field.setFieldFlags(PdfFormField.FF_DONOTSPELLCHECK);
- if ((options & COMB) != 0)
- field.setFieldFlags(PdfFormField.FF_COMB);
- }
- field.setBorderStyle(new PdfBorderDictionary(borderWidth, borderStyle, new PdfDashPattern(3)));
- PdfAppearance tp = getAppearance();
- field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp);
- PdfAppearance da = (PdfAppearance)tp.getDuplicate();
- da.setFontAndSize(getRealFont(), fontSize);
- if (textColor == null)
- da.setGrayFill(0);
- else
- da.setColorFill(textColor);
- field.setDefaultAppearanceString(da);
- if (borderColor != null)
- field.setMKBorderColor(borderColor);
- if (backgroundColor != null)
- field.setMKBackgroundColor(backgroundColor);
- switch (visibility) {
- case HIDDEN:
- field.setFlags(PdfAnnotation.FLAGS_PRINT | PdfAnnotation.FLAGS_HIDDEN);
- break;
- case VISIBLE_BUT_DOES_NOT_PRINT:
- break;
- case HIDDEN_BUT_PRINTABLE:
- field.setFlags(PdfAnnotation.FLAGS_PRINT | PdfAnnotation.FLAGS_NOVIEW);
- break;
- default:
- field.setFlags(PdfAnnotation.FLAGS_PRINT);
- break;
- }
- return field;
- }
-
- /** Gets a new combo field.
- * @throws IOException on error
- * @throws DocumentException on error
- * @return a new combo field
- */
- public PdfFormField getComboField() throws IOException, DocumentException {
- return getChoiceField(false);
- }
-
- /** Gets a new list field.
- * @throws IOException on error
- * @throws DocumentException on error
- * @return a new list field
- */
- public PdfFormField getListField() throws IOException, DocumentException {
- return getChoiceField(true);
- }
-
- protected PdfFormField getChoiceField(boolean isList) throws IOException, DocumentException {
- options &= (~MULTILINE) & (~COMB);
- String uchoices[] = choices;
- if (uchoices == null)
- uchoices = new String[0];
- int topChoice = choiceSelection;
- if (topChoice >= uchoices.length)
- topChoice = uchoices.length - 1;
- text = "";
- if (topChoice >= 0)
- text = uchoices[topChoice];
- if (topChoice < 0)
- topChoice = 0;
- PdfFormField field = null;
- String mix[][] = null;
- if (choiceExports == null) {
- if (isList)
- field = PdfFormField.createList(writer, uchoices, topChoice);
- else
- field = PdfFormField.createCombo(writer, (options & EDIT) != 0, uchoices, topChoice);
- }
- else {
- mix = new String[uchoices.length][2];
- for (int k = 0; k < mix.length; ++k)
- mix[k][0] = mix[k][1] = uchoices[k];
- int top = Math.min(uchoices.length, choiceExports.length);
- for (int k = 0; k < top; ++k) {
- if (choiceExports[k] != null)
- mix[k][0] = choiceExports[k];
- }
- if (isList)
- field = PdfFormField.createList(writer, mix, topChoice);
- else
- field = PdfFormField.createCombo(writer, (options & EDIT) != 0, mix, topChoice);
- }
- field.setWidget(box, PdfAnnotation.HIGHLIGHT_INVERT);
- if (rotation != 0)
- field.setMKRotation(rotation);
- if (fieldName != null) {
- field.setFieldName(fieldName);
- if (uchoices.length > 0) {
- if (mix != null) {
- field.setValueAsString(mix[topChoice][0]);
- field.setDefaultValueAsString(mix[topChoice][0]);
- }
- else {
- field.setValueAsString(text);
- field.setDefaultValueAsString(text);
- }
- }
- if ((options & READ_ONLY) != 0)
- field.setFieldFlags(PdfFormField.FF_READ_ONLY);
- if ((options & REQUIRED) != 0)
- field.setFieldFlags(PdfFormField.FF_REQUIRED);
- if ((options & DO_NOT_SPELL_CHECK) != 0)
- field.setFieldFlags(PdfFormField.FF_DONOTSPELLCHECK);
- }
- field.setBorderStyle(new PdfBorderDictionary(borderWidth, borderStyle, new PdfDashPattern(3)));
- PdfAppearance tp;
- if (isList) {
- tp = getListAppearance();
- if (topFirst > 0)
- field.put(PdfName.TI, new PdfNumber(topFirst));
- }
- else
- tp = getAppearance();
- field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp);
- PdfAppearance da = (PdfAppearance)tp.getDuplicate();
- da.setFontAndSize(getRealFont(), fontSize);
- if (textColor == null)
- da.setGrayFill(0);
- else
- da.setColorFill(textColor);
- field.setDefaultAppearanceString(da);
- if (borderColor != null)
- field.setMKBorderColor(borderColor);
- if (backgroundColor != null)
- field.setMKBackgroundColor(backgroundColor);
- switch (visibility) {
- case HIDDEN:
- field.setFlags(PdfAnnotation.FLAGS_PRINT | PdfAnnotation.FLAGS_HIDDEN);
- break;
- case VISIBLE_BUT_DOES_NOT_PRINT:
- break;
- case HIDDEN_BUT_PRINTABLE:
- field.setFlags(PdfAnnotation.FLAGS_PRINT | PdfAnnotation.FLAGS_NOVIEW);
- break;
- default:
- field.setFlags(PdfAnnotation.FLAGS_PRINT);
- break;
- }
- return field;
- }
-
- /** Gets the default text.
- * @return the default text
- */
- public String getDefaultText() {
- return this.defaultText;
- }
-
- /** Sets the default text. It is only meaningful for text fields.
- * @param defaultText the default text
- */
- public void setDefaultText(String defaultText) {
- this.defaultText = defaultText;
- }
-
- /** Gets the choices to be presented to the user in list/combo
- * fields.
- * @return the choices to be presented to the user
- */
- public String[] getChoices() {
- return this.choices;
- }
-
- /** Sets the choices to be presented to the user in list/combo
- * fields.
- * @param choices the choices to be presented to the user
- */
- public void setChoices(String[] choices) {
- this.choices = choices;
- }
-
- /** Gets the export values in list/combo fields.
- * @return the export values in list/combo fields
- */
- public String[] getChoiceExports() {
- return this.choiceExports;
- }
-
- /** Sets the export values in list/combo fields. If this array
- * is <CODE>null</CODE> then the choice values will also be used
- * as the export values.
- * @param choiceExports the export values in list/combo fields
- */
- public void setChoiceExports(String[] choiceExports) {
- this.choiceExports = choiceExports;
- }
-
- /** Gets the zero based index of the selected item.
- * @return the zero based index of the selected item
- */
- public int getChoiceSelection() {
- return this.choiceSelection;
- }
-
- /** Sets the zero based index of the selected item.
- * @param choiceSelection the zero based index of the selected item
- */
- public void setChoiceSelection(int choiceSelection) {
- this.choiceSelection = choiceSelection;
- }
-
- int getTopFirst() {
- return topFirst;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/TrueTypeFont.java b/LibrarySource/com/lowagie/text/pdf/TrueTypeFont.java
deleted file mode 100644
index b774e93..0000000
--- a/LibrarySource/com/lowagie/text/pdf/TrueTypeFont.java
+++ /dev/null
@@ -1,1300 +0,0 @@
-/*
- * $Id: TrueTypeFont.java,v 1.55 2004/12/14 15:15:59 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.*;
-import java.util.HashMap;
-import java.util.ArrayList;
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.ExceptionConverter;
-/** Reads a Truetype font
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-class TrueTypeFont extends BaseFont {
-
- /** The code pages possible for a True Type font.
- */
- static final String codePages[] = {
- "1252 Latin 1",
- "1250 Latin 2: Eastern Europe",
- "1251 Cyrillic",
- "1253 Greek",
- "1254 Turkish",
- "1255 Hebrew",
- "1256 Arabic",
- "1257 Windows Baltic",
- "1258 Vietnamese",
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- "874 Thai",
- "932 JIS/Japan",
- "936 Chinese: Simplified chars--PRC and Singapore",
- "949 Korean Wansung",
- "950 Chinese: Traditional chars--Taiwan and Hong Kong",
- "1361 Korean Johab",
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- "Macintosh Character Set (US Roman)",
- "OEM Character Set",
- "Symbol Character Set",
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- "869 IBM Greek",
- "866 MS-DOS Russian",
- "865 MS-DOS Nordic",
- "864 Arabic",
- "863 MS-DOS Canadian French",
- "862 Hebrew",
- "861 MS-DOS Icelandic",
- "860 MS-DOS Portuguese",
- "857 IBM Turkish",
- "855 IBM Cyrillic; primarily Russian",
- "852 Latin 2",
- "775 MS-DOS Baltic",
- "737 Greek; former 437 G",
- "708 Arabic; ASMO 708",
- "850 WE/Latin 1",
- "437 US"};
-
- protected boolean justNames = false;
- /** Contains the location of the several tables. The key is the name of
- * the table and the value is an <CODE>int[2]</CODE> where position 0
- * is the offset from the start of the file and position 1 is the length
- * of the table.
- */
- protected HashMap tables;
- /** The file in use.
- */
- protected RandomAccessFileOrArray rf;
- /** The file name.
- */
- protected String fileName;
-
- protected boolean cff = false;
-
- protected int cffOffset;
-
- protected int cffLength;
-
- /** The offset from the start of the file to the table directory.
- * It is 0 for TTF and may vary for TTC depending on the chosen font.
- */
- protected int directoryOffset;
- /** The index for the TTC font. It is an empty <CODE>String</CODE> for a
- * TTF file.
- */
- protected String ttcIndex;
- /** The style modifier */
- protected String style = "";
- /** The content of table 'head'.
- */
- protected FontHeader head = new FontHeader();
- /** The content of table 'hhea'.
- */
- protected HorizontalHeader hhea = new HorizontalHeader();
- /** The content of table 'OS/2'.
- */
- protected WindowsMetrics os_2 = new WindowsMetrics();
- /** The width of the glyphs. This is essentially the content of table
- * 'hmtx' normalized to 1000 units.
- */
- protected int GlyphWidths[];
-
- protected int bboxes[][];
- /** The map containing the code information for the table 'cmap', encoding 1.0.
- * The key is the code and the value is an <CODE>int[2]</CODE> where position 0
- * is the glyph number and position 1 is the glyph width normalized to 1000
- * units.
- */
- protected HashMap cmap10;
- /** The map containing the code information for the table 'cmap', encoding 3.1
- * in Unicode.
- * <P>
- * The key is the code and the value is an <CODE>int</CODE>[2] where position 0
- * is the glyph number and position 1 is the glyph width normalized to 1000
- * units.
- */
- protected HashMap cmap31;
- /** The map containing the kerning information. It represents the content of
- * table 'kern'. The key is an <CODE>Integer</CODE> where the top 16 bits
- * are the glyph number for the first character and the lower 16 bits are the
- * glyph number for the second character. The value is the amount of kerning in
- * normalized 1000 units as an <CODE>Integer</CODE>. This value is usually negative.
- */
- protected IntHashtable kerning = new IntHashtable();
- /**
- * The font name.
- * This name is usually extracted from the table 'name' with
- * the 'Name ID' 6.
- */
- protected String fontName;
-
- /** The full name of the font
- */
- protected String fullName[][];
-
- /** The family name of the font
- */
- protected String familyName[][];
- /** The italic angle. It is usually extracted from the 'post' table or in it's
- * absence with the code:
- * <P>
- * <PRE>
- * -Math.atan2(hhea.caretSlopeRun, hhea.caretSlopeRise) * 180 / Math.PI
- * </PRE>
- */
- protected double italicAngle;
- /** <CODE>true</CODE> if all the glyphs have the same width.
- */
- protected boolean isFixedPitch = false;
-
- /** The components of table 'head'.
- */
- protected static class FontHeader {
- /** A variable. */
- int flags;
- /** A variable. */
- int unitsPerEm;
- /** A variable. */
- short xMin;
- /** A variable. */
- short yMin;
- /** A variable. */
- short xMax;
- /** A variable. */
- short yMax;
- /** A variable. */
- int macStyle;
- }
-
- /** The components of table 'hhea'.
- */
- protected static class HorizontalHeader {
- /** A variable. */
- short Ascender;
- /** A variable. */
- short Descender;
- /** A variable. */
- short LineGap;
- /** A variable. */
- int advanceWidthMax;
- /** A variable. */
- short minLeftSideBearing;
- /** A variable. */
- short minRightSideBearing;
- /** A variable. */
- short xMaxExtent;
- /** A variable. */
- short caretSlopeRise;
- /** A variable. */
- short caretSlopeRun;
- /** A variable. */
- int numberOfHMetrics;
- }
-
- /** The components of table 'OS/2'.
- */
- protected static class WindowsMetrics {
- /** A variable. */
- short xAvgCharWidth;
- /** A variable. */
- int usWeightClass;
- /** A variable. */
- int usWidthClass;
- /** A variable. */
- short fsType;
- /** A variable. */
- short ySubscriptXSize;
- /** A variable. */
- short ySubscriptYSize;
- /** A variable. */
- short ySubscriptXOffset;
- /** A variable. */
- short ySubscriptYOffset;
- /** A variable. */
- short ySuperscriptXSize;
- /** A variable. */
- short ySuperscriptYSize;
- /** A variable. */
- short ySuperscriptXOffset;
- /** A variable. */
- short ySuperscriptYOffset;
- /** A variable. */
- short yStrikeoutSize;
- /** A variable. */
- short yStrikeoutPosition;
- /** A variable. */
- short sFamilyClass;
- /** A variable. */
- byte panose[] = new byte[10];
- /** A variable. */
- byte achVendID[] = new byte[4];
- /** A variable. */
- int fsSelection;
- /** A variable. */
- int usFirstCharIndex;
- /** A variable. */
- int usLastCharIndex;
- /** A variable. */
- short sTypoAscender;
- /** A variable. */
- short sTypoDescender;
- /** A variable. */
- short sTypoLineGap;
- /** A variable. */
- int usWinAscent;
- /** A variable. */
- int usWinDescent;
- /** A variable. */
- int ulCodePageRange1;
- /** A variable. */
- int ulCodePageRange2;
- /** A variable. */
- int sCapHeight;
- }
-
- /** This constructor is present to allow extending the class.
- */
- protected TrueTypeFont() {
- }
-
- TrueTypeFont(String ttFile, String enc, boolean emb, byte ttfAfm[]) throws DocumentException, IOException {
- this(ttFile, enc, emb, ttfAfm, false);
- }
-
- /** Creates a new TrueType font.
- * @param ttFile the location of the font on file. The file must end in '.ttf' or
- * '.ttc' but can have modifiers after the name
- * @param enc the encoding to be applied to this font
- * @param emb true if the font is to be embedded in the PDF
- * @param ttfAfm the font as a <CODE>byte</CODE> array
- * @throws DocumentException the font is invalid
- * @throws IOException the font file could not be read
- */
- TrueTypeFont(String ttFile, String enc, boolean emb, byte ttfAfm[], boolean justNames) throws DocumentException, IOException {
- this.justNames = justNames;
- String nameBase = getBaseName(ttFile);
- String ttcName = getTTCName(nameBase);
- if (nameBase.length() < ttFile.length()) {
- style = ttFile.substring(nameBase.length());
- }
- encoding = enc;
- embedded = emb;
- fileName = ttcName;
- fontType = FONT_TYPE_TT;
- ttcIndex = "";
- if (ttcName.length() < nameBase.length())
- ttcIndex = nameBase.substring(ttcName.length() + 1);
- if (fileName.toLowerCase().endsWith(".ttf") || fileName.toLowerCase().endsWith(".otf") || fileName.toLowerCase().endsWith(".ttc")) {
- process(ttfAfm);
- if (!justNames && embedded && os_2.fsType == 2)
- throw new DocumentException(fileName + style + " cannot be embedded due to licensing restrictions.");
- }
- else
- throw new DocumentException(fileName + style + " is not a TTF, OTF or TTC font file.");
- PdfEncodings.convertToBytes(" ", enc); // check if the encoding exists
- createEncoding();
- }
-
- /** Gets the name from a composed TTC file name.
- * If I have for input "myfont.ttc,2" the return will
- * be "myfont.ttc".
- * @param name the full name
- * @return the simple file name
- */
- protected static String getTTCName(String name) {
- int idx = name.toLowerCase().indexOf(".ttc,");
- if (idx < 0)
- return name;
- else
- return name.substring(0, idx + 4);
- }
-
-
- /**
- * Reads the tables 'head', 'hhea', 'OS/2' and 'post' filling several variables.
- * @throws DocumentException the font is invalid
- * @throws IOException the font file could not be read
- */
- void fillTables() throws DocumentException, IOException {
- int table_location[];
- table_location = (int[])tables.get("head");
- if (table_location == null)
- throw new DocumentException("Table 'head' does not exist in " + fileName + style);
- rf.seek(table_location[0] + 16);
- head.flags = rf.readUnsignedShort();
- head.unitsPerEm = rf.readUnsignedShort();
- rf.skipBytes(16);
- head.xMin = rf.readShort();
- head.yMin = rf.readShort();
- head.xMax = rf.readShort();
- head.yMax = rf.readShort();
- head.macStyle = rf.readUnsignedShort();
-
- table_location = (int[])tables.get("hhea");
- if (table_location == null)
- throw new DocumentException("Table 'hhea' does not exist " + fileName + style);
- rf.seek(table_location[0] + 4);
- hhea.Ascender = rf.readShort();
- hhea.Descender = rf.readShort();
- hhea.LineGap = rf.readShort();
- hhea.advanceWidthMax = rf.readUnsignedShort();
- hhea.minLeftSideBearing = rf.readShort();
- hhea.minRightSideBearing = rf.readShort();
- hhea.xMaxExtent = rf.readShort();
- hhea.caretSlopeRise = rf.readShort();
- hhea.caretSlopeRun = rf.readShort();
- rf.skipBytes(12);
- hhea.numberOfHMetrics = rf.readUnsignedShort();
-
- table_location = (int[])tables.get("OS/2");
- if (table_location == null)
- throw new DocumentException("Table 'OS/2' does not exist in " + fileName + style);
- rf.seek(table_location[0]);
- int version = rf.readUnsignedShort();
- os_2.xAvgCharWidth = rf.readShort();
- os_2.usWeightClass = rf.readUnsignedShort();
- os_2.usWidthClass = rf.readUnsignedShort();
- os_2.fsType = rf.readShort();
- os_2.ySubscriptXSize = rf.readShort();
- os_2.ySubscriptYSize = rf.readShort();
- os_2.ySubscriptXOffset = rf.readShort();
- os_2.ySubscriptYOffset = rf.readShort();
- os_2.ySuperscriptXSize = rf.readShort();
- os_2.ySuperscriptYSize = rf.readShort();
- os_2.ySuperscriptXOffset = rf.readShort();
- os_2.ySuperscriptYOffset = rf.readShort();
- os_2.yStrikeoutSize = rf.readShort();
- os_2.yStrikeoutPosition = rf.readShort();
- os_2.sFamilyClass = rf.readShort();
- rf.readFully(os_2.panose);
- rf.skipBytes(16);
- rf.readFully(os_2.achVendID);
- os_2.fsSelection = rf.readUnsignedShort();
- os_2.usFirstCharIndex = rf.readUnsignedShort();
- os_2.usLastCharIndex = rf.readUnsignedShort();
- os_2.sTypoAscender = rf.readShort();
- os_2.sTypoDescender = rf.readShort();
- if (os_2.sTypoDescender > 0)
- os_2.sTypoDescender = (short)(-os_2.sTypoDescender);
- os_2.sTypoLineGap = rf.readShort();
- os_2.usWinAscent = rf.readUnsignedShort();
- os_2.usWinDescent = rf.readUnsignedShort();
- os_2.ulCodePageRange1 = 0;
- os_2.ulCodePageRange2 = 0;
- if (version > 0) {
- os_2.ulCodePageRange1 = rf.readInt();
- os_2.ulCodePageRange2 = rf.readInt();
- }
- if (version > 1) {
- rf.skipBytes(2);
- os_2.sCapHeight = rf.readShort();
- }
- else
- os_2.sCapHeight = (int)(0.7 * head.unitsPerEm);
-
- table_location = (int[])tables.get("post");
- if (table_location == null) {
- italicAngle = -Math.atan2(hhea.caretSlopeRun, hhea.caretSlopeRise) * 180 / Math.PI;
- return;
- }
- rf.seek(table_location[0] + 4);
- short mantissa = rf.readShort();
- int fraction = rf.readUnsignedShort();
- italicAngle = (double)mantissa + (double)fraction / 16384.0;
- rf.skipBytes(4);
- isFixedPitch = rf.readInt() != 0;
- }
-
- /**
- * Gets the Postscript font name.
- * @throws DocumentException the font is invalid
- * @throws IOException the font file could not be read
- * @return the Postscript font name
- */
- String getBaseFont() throws DocumentException, IOException {
- int table_location[];
- table_location = (int[])tables.get("name");
- if (table_location == null)
- throw new DocumentException("Table 'name' does not exist in " + fileName + style);
- rf.seek(table_location[0] + 2);
- int numRecords = rf.readUnsignedShort();
- int startOfStorage = rf.readUnsignedShort();
- for (int k = 0; k < numRecords; ++k) {
- int platformID = rf.readUnsignedShort();
- int platformEncodingID = rf.readUnsignedShort();
- int languageID = rf.readUnsignedShort();
- int nameID = rf.readUnsignedShort();
- int length = rf.readUnsignedShort();
- int offset = rf.readUnsignedShort();
- if (nameID == 6) {
- rf.seek(table_location[0] + startOfStorage + offset);
- if (platformID == 0 || platformID == 3)
- return readUnicodeString(length);
- else
- return readStandardString(length);
- }
- }
- File file = new File(fileName);
- return file.getName().replace(' ', '-');
- }
-
- /** Extracts the names of the font in all the languages available.
- * @param id the name id to retrieve
- * @throws DocumentException on error
- * @throws IOException on error
- */
- String[][] getNames(int id) throws DocumentException, IOException {
- int table_location[];
- table_location = (int[])tables.get("name");
- if (table_location == null)
- throw new DocumentException("Table 'name' does not exist in " + fileName + style);
- rf.seek(table_location[0] + 2);
- int numRecords = rf.readUnsignedShort();
- int startOfStorage = rf.readUnsignedShort();
- ArrayList names = new ArrayList();
- for (int k = 0; k < numRecords; ++k) {
- int platformID = rf.readUnsignedShort();
- int platformEncodingID = rf.readUnsignedShort();
- int languageID = rf.readUnsignedShort();
- int nameID = rf.readUnsignedShort();
- int length = rf.readUnsignedShort();
- int offset = rf.readUnsignedShort();
- if (nameID == id) {
- int pos = rf.getFilePointer();
- rf.seek(table_location[0] + startOfStorage + offset);
- String name;
- if (platformID == 0 || platformID == 3 || (platformID == 2 && platformEncodingID == 1)){
- name = readUnicodeString(length);
- }
- else {
- name = readStandardString(length);
- }
- names.add(new String[]{String.valueOf(platformID),
- String.valueOf(platformEncodingID), String.valueOf(languageID), name});
- rf.seek(pos);
- }
- }
- String thisName[][] = new String[names.size()][];
- for (int k = 0; k < names.size(); ++k)
- thisName[k] = (String[])names.get(k);
- return thisName;
- }
-
- void checkCff() throws DocumentException, IOException {
- int table_location[];
- table_location = (int[])tables.get("CFF ");
- if (table_location != null) {
- cff = true;
- cffOffset = table_location[0];
- cffLength = table_location[1];
- }
- }
-
- /** Reads the font data.
- * @param ttfAfm the font as a <CODE>byte</CODE> array, possibly <CODE>null</CODE>
- * @throws DocumentException the font is invalid
- * @throws IOException the font file could not be read
- */
- void process(byte ttfAfm[]) throws DocumentException, IOException {
- tables = new HashMap();
-
- try {
- if (ttfAfm == null)
- rf = new RandomAccessFileOrArray(fileName);
- else
- rf = new RandomAccessFileOrArray(ttfAfm);
- if (ttcIndex.length() > 0) {
- int dirIdx = Integer.parseInt(ttcIndex);
- if (dirIdx < 0)
- throw new DocumentException("The font index for " + fileName + " must be positive.");
- String mainTag = readStandardString(4);
- if (!mainTag.equals("ttcf"))
- throw new DocumentException(fileName + " is not a valid TTC file.");
- rf.skipBytes(4);
- int dirCount = rf.readInt();
- if (dirIdx >= dirCount)
- throw new DocumentException("The font index for " + fileName + " must be between 0 and " + (dirCount - 1) + ". It was " + dirIdx + ".");
- rf.skipBytes(dirIdx * 4);
- directoryOffset = rf.readInt();
- }
- rf.seek(directoryOffset);
- int ttId = rf.readInt();
- if (ttId != 0x00010000 && ttId != 0x4F54544F)
- throw new DocumentException(fileName + " is not a valid TTF or OTF file.");
- int num_tables = rf.readUnsignedShort();
- rf.skipBytes(6);
- for (int k = 0; k < num_tables; ++k) {
- String tag = readStandardString(4);
- rf.skipBytes(4);
- int table_location[] = new int[2];
- table_location[0] = rf.readInt();
- table_location[1] = rf.readInt();
- tables.put(tag, table_location);
- }
- checkCff();
- fontName = getBaseFont();
- fullName = getNames(4); //full name
- familyName = getNames(1); //family name
- if (!justNames) {
- fillTables();
- readGlyphWidths();
- readCMaps();
- readKerning();
- readBbox();
- GlyphWidths = null;
- }
- }
- finally {
- if (rf != null) {
- rf.close();
- if (!embedded)
- rf = null;
- }
- }
- }
-
- /** Reads a <CODE>String</CODE> from the font file as bytes using the Cp1252
- * encoding.
- * @param length the length of bytes to read
- * @return the <CODE>String</CODE> read
- * @throws IOException the font file could not be read
- */
- protected String readStandardString(int length) throws IOException {
- byte buf[] = new byte[length];
- rf.readFully(buf);
- try {
- return new String(buf, WINANSI);
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- /** Reads a Unicode <CODE>String</CODE> from the font file. Each character is
- * represented by two bytes.
- * @param length the length of bytes to read. The <CODE>String</CODE> will have <CODE>length</CODE>/2
- * characters
- * @return the <CODE>String</CODE> read
- * @throws IOException the font file could not be read
- */
- protected String readUnicodeString(int length) throws IOException {
- StringBuffer buf = new StringBuffer();
- length /= 2;
- for (int k = 0; k < length; ++k) {
- buf.append(rf.readChar());
- }
- return buf.toString();
- }
-
- /** Reads the glyphs widths. The widths are extracted from the table 'hmtx'.
- * The glyphs are normalized to 1000 units.
- * @throws DocumentException the font is invalid
- * @throws IOException the font file could not be read
- */
- protected void readGlyphWidths() throws DocumentException, IOException {
- int table_location[];
- table_location = (int[])tables.get("hmtx");
- if (table_location == null)
- throw new DocumentException("Table 'hmtx' does not exist in " + fileName + style);
- rf.seek(table_location[0]);
- GlyphWidths = new int[hhea.numberOfHMetrics];
- for (int k = 0; k < hhea.numberOfHMetrics; ++k) {
- GlyphWidths[k] = (rf.readUnsignedShort() * 1000) / head.unitsPerEm;
- rf.readUnsignedShort();
- }
- }
-
- /** Gets a glyph width.
- * @param glyph the glyph to get the width of
- * @return the width of the glyph in normalized 1000 units
- */
- protected int getGlyphWidth(int glyph) {
- if (glyph >= GlyphWidths.length)
- glyph = GlyphWidths.length - 1;
- return GlyphWidths[glyph];
- }
-
- private void readBbox() throws DocumentException, IOException {
- int tableLocation[];
- tableLocation = (int[])tables.get("head");
- if (tableLocation == null)
- throw new DocumentException("Table 'head' does not exist in " + fileName + style);
- rf.seek(tableLocation[0] + TrueTypeFontSubSet.HEAD_LOCA_FORMAT_OFFSET);
- boolean locaShortTable = (rf.readUnsignedShort() == 0);
- tableLocation = (int[])tables.get("loca");
- if (tableLocation == null)
- return;
- rf.seek(tableLocation[0]);
- int locaTable[];
- if (locaShortTable) {
- int entries = tableLocation[1] / 2;
- locaTable = new int[entries];
- for (int k = 0; k < entries; ++k)
- locaTable[k] = rf.readUnsignedShort() * 2;
- }
- else {
- int entries = tableLocation[1] / 4;
- locaTable = new int[entries];
- for (int k = 0; k < entries; ++k)
- locaTable[k] = rf.readInt();
- }
- tableLocation = (int[])tables.get("glyf");
- if (tableLocation == null)
- throw new DocumentException("Table 'glyf' does not exist in " + fileName + style);
- int tableGlyphOffset = tableLocation[0];
- bboxes = new int[locaTable.length - 1][];
- for (int glyph = 0; glyph < locaTable.length - 1; ++glyph) {
- int start = locaTable[glyph];
- if (start != locaTable[glyph + 1]) {
- rf.seek(tableGlyphOffset + start + 2);
- bboxes[glyph] = new int[]{
- (rf.readShort() * 1000) / head.unitsPerEm,
- (rf.readShort() * 1000) / head.unitsPerEm,
- (rf.readShort() * 1000) / head.unitsPerEm,
- (rf.readShort() * 1000) / head.unitsPerEm};
- }
- }
- }
-
- /** Reads the several maps from the table 'cmap'. The maps of interest are 1.0 for symbolic
- * fonts and 3.1 for all others. A symbolic font is defined as having the map 3.0.
- * @throws DocumentException the font is invalid
- * @throws IOException the font file could not be read
- */
- void readCMaps() throws DocumentException, IOException {
- int table_location[];
- table_location = (int[])tables.get("cmap");
- if (table_location == null)
- throw new DocumentException("Table 'cmap' does not exist in " + fileName + style);
- rf.seek(table_location[0]);
- rf.skipBytes(2);
- int num_tables = rf.readUnsignedShort();
- fontSpecific = false;
- int map10 = 0;
- int map31 = 0;
- int map30 = 0;
- for (int k = 0; k < num_tables; ++k) {
- int platId = rf.readUnsignedShort();
- int platSpecId = rf.readUnsignedShort();
- int offset = rf.readInt();
- if (platId == 3 && platSpecId == 0) {
- fontSpecific = true;
- map30 = offset;
- }
- else if (platId == 3 && platSpecId == 1) {
- map31 = offset;
- }
- if (platId == 1 && platSpecId == 0) {
- map10 = offset;
- }
- }
- if (map10 > 0) {
- rf.seek(table_location[0] + map10);
- int format = rf.readUnsignedShort();
- switch (format) {
- case 0:
- cmap10 = readFormat0();
- break;
- case 4:
- cmap10 = readFormat4();
- break;
- case 6:
- cmap10 = readFormat6();
- break;
- }
- }
- if (map31 > 0) {
- rf.seek(table_location[0] + map31);
- int format = rf.readUnsignedShort();
- if (format == 4) {
- cmap31 = readFormat4();
- }
- }
- if (map30 > 0) {
- rf.seek(table_location[0] + map30);
- int format = rf.readUnsignedShort();
- if (format == 4) {
- cmap10 = readFormat4();
- }
- }
- }
-
- /** The information in the maps of the table 'cmap' is coded in several formats.
- * Format 0 is the Apple standard character to glyph index mapping table.
- * @return a <CODE>HashMap</CODE> representing this map
- * @throws IOException the font file could not be read
- */
- HashMap readFormat0() throws IOException {
- HashMap h = new HashMap();
- rf.skipBytes(4);
- for (int k = 0; k < 256; ++k) {
- int r[] = new int[2];
- r[0] = rf.readUnsignedByte();
- r[1] = getGlyphWidth(r[0]);
- h.put(new Integer(k), r);
- }
- return h;
- }
-
- /** The information in the maps of the table 'cmap' is coded in several formats.
- * Format 4 is the Microsoft standard character to glyph index mapping table.
- * @return a <CODE>HashMap</CODE> representing this map
- * @throws IOException the font file could not be read
- */
- HashMap readFormat4() throws IOException {
- HashMap h = new HashMap();
- int table_lenght = rf.readUnsignedShort();
- rf.skipBytes(2);
- int segCount = rf.readUnsignedShort() / 2;
- rf.skipBytes(6);
- int endCount[] = new int[segCount];
- for (int k = 0; k < segCount; ++k) {
- endCount[k] = rf.readUnsignedShort();
- }
- rf.skipBytes(2);
- int startCount[] = new int[segCount];
- for (int k = 0; k < segCount; ++k) {
- startCount[k] = rf.readUnsignedShort();
- }
- int idDelta[] = new int[segCount];
- for (int k = 0; k < segCount; ++k) {
- idDelta[k] = rf.readUnsignedShort();
- }
- int idRO[] = new int[segCount];
- for (int k = 0; k < segCount; ++k) {
- idRO[k] = rf.readUnsignedShort();
- }
- int glyphId[] = new int[table_lenght / 2 - 8 - segCount * 4];
- for (int k = 0; k < glyphId.length; ++k) {
- glyphId[k] = rf.readUnsignedShort();
- }
- for (int k = 0; k < segCount; ++k) {
- int glyph;
- for (int j = startCount[k]; j <= endCount[k] && j != 0xFFFF; ++j) {
- if (idRO[k] == 0) {
- glyph = (j + idDelta[k]) & 0xFFFF;
- }
- else {
- int idx = k + idRO[k] / 2 - segCount + j - startCount[k];
- if (idx >= glyphId.length)
- continue;
- glyph = (glyphId[idx] + idDelta[k]) & 0xFFFF;
- }
- int r[] = new int[2];
- r[0] = glyph;
- r[1] = getGlyphWidth(r[0]);
- h.put(new Integer(fontSpecific ? ((j & 0xff00) == 0xf000 ? j & 0xff : j) : j), r);
- }
- }
- return h;
- }
-
- /** The information in the maps of the table 'cmap' is coded in several formats.
- * Format 6 is a trimmed table mapping. It is similar to format 0 but can have
- * less than 256 entries.
- * @return a <CODE>HashMap</CODE> representing this map
- * @throws IOException the font file could not be read
- */
- HashMap readFormat6() throws IOException {
- HashMap h = new HashMap();
- rf.skipBytes(4);
- int start_code = rf.readUnsignedShort();
- int code_count = rf.readUnsignedShort();
- for (int k = 0; k < code_count; ++k) {
- int r[] = new int[2];
- r[0] = rf.readUnsignedShort();
- r[1] = getGlyphWidth(r[0]);
- h.put(new Integer(k + start_code), r);
- }
- return h;
- }
-
- /** Reads the kerning information from the 'kern' table.
- * @throws IOException the font file could not be read
- */
- void readKerning() throws IOException {
- int table_location[];
- table_location = (int[])tables.get("kern");
- if (table_location == null)
- return;
- rf.seek(table_location[0] + 2);
- int nTables = rf.readUnsignedShort();
- int checkpoint = table_location[0] + 4;
- int length = 0;
- for (int k = 0; k < nTables; ++k) {
- checkpoint += length;
- rf.seek(checkpoint);
- rf.skipBytes(2);
- length = rf.readUnsignedShort();
- int coverage = rf.readUnsignedShort();
- if ((coverage & 0xfff7) == 0x0001) {
- int nPairs = rf.readUnsignedShort();
- rf.skipBytes(6);
- for (int j = 0; j < nPairs; ++j) {
- int pair = rf.readInt();
- int value = ((int)rf.readShort() * 1000) / head.unitsPerEm;
- kerning.put(pair, value);
- }
- }
- }
- }
-
- /** Gets the kerning between two Unicode chars.
- * @param char1 the first char
- * @param char2 the second char
- * @return the kerning to be applied
- */
- public int getKerning(char char1, char char2) {
- int metrics[] = getMetricsTT(char1);
- if (metrics == null)
- return 0;
- int c1 = metrics[0];
- metrics = getMetricsTT(char2);
- if (metrics == null)
- return 0;
- int c2 = metrics[0];
- return kerning.get((c1 << 16) + c2);
- }
-
- /** Gets the width from the font according to the unicode char <CODE>c</CODE>.
- * If the <CODE>name</CODE> is null it's a symbolic font.
- * @param c the unicode char
- * @param name the glyph name
- * @return the width of the char
- */
- int getRawWidth(int c, String name) {
- HashMap map = null;
- if (name == null || cmap31 == null)
- map = cmap10;
- else
- map = cmap31;
- if (map == null)
- return 0;
- int metric[] = (int[])map.get(new Integer(c));
- if (metric == null)
- return 0;
- return metric[1];
- }
-
- /** Generates the font descriptor for this font.
- * @return the PdfDictionary containing the font descriptor or <CODE>null</CODE>
- * @param subsetPrefix the subset prefix
- * @param fontStream the indirect reference to a PdfStream containing the font or <CODE>null</CODE>
- * @throws DocumentException if there is an error
- */
- protected PdfDictionary getFontDescriptor(PdfIndirectReference fontStream, String subsetPrefix) throws DocumentException {
- PdfDictionary dic = new PdfDictionary(PdfName.FONTDESCRIPTOR);
- dic.put(PdfName.ASCENT, new PdfNumber((int)os_2.sTypoAscender * 1000 / head.unitsPerEm));
- dic.put(PdfName.CAPHEIGHT, new PdfNumber((int)os_2.sCapHeight * 1000 / head.unitsPerEm));
- dic.put(PdfName.DESCENT, new PdfNumber((int)os_2.sTypoDescender * 1000 / head.unitsPerEm));
- dic.put(PdfName.FONTBBOX, new PdfRectangle(
- (int)head.xMin * 1000 / head.unitsPerEm,
- (int)head.yMin * 1000 / head.unitsPerEm,
- (int)head.xMax * 1000 / head.unitsPerEm,
- (int)head.yMax * 1000 / head.unitsPerEm));
- if (cff) {
- if (encoding.startsWith("Identity-"))
- dic.put(PdfName.FONTNAME, new PdfName(fontName+"-"+encoding));
- else
- dic.put(PdfName.FONTNAME, new PdfName(fontName + style));
- }
- else
- dic.put(PdfName.FONTNAME, new PdfName(subsetPrefix + fontName + style));
- dic.put(PdfName.ITALICANGLE, new PdfNumber(italicAngle));
- dic.put(PdfName.STEMV, new PdfNumber(80));
- if (fontStream != null) {
- if (cff)
- dic.put(PdfName.FONTFILE3, fontStream);
- else
- dic.put(PdfName.FONTFILE2, fontStream);
- }
- int flags = 0;
- if (isFixedPitch)
- flags |= 1;
- flags |= fontSpecific ? 4 : 32;
- if ((head.macStyle & 2) != 0)
- flags |= 64;
- if ((head.macStyle & 1) != 0)
- flags |= 262144;
- dic.put(PdfName.FLAGS, new PdfNumber(flags));
-
- return dic;
- }
-
- /** Generates the font dictionary for this font.
- * @return the PdfDictionary containing the font dictionary
- * @param subsetPrefix the subset prefx
- * @param firstChar the first valid character
- * @param lastChar the last valid character
- * @param shortTag a 256 bytes long <CODE>byte</CODE> array where each unused byte is represented by 0
- * @param fontDescriptor the indirect reference to a PdfDictionary containing the font descriptor or <CODE>null</CODE>
- * @throws DocumentException if there is an error
- */
- protected PdfDictionary getFontBaseType(PdfIndirectReference fontDescriptor, String subsetPrefix, int firstChar, int lastChar, byte shortTag[]) throws DocumentException {
- PdfDictionary dic = new PdfDictionary(PdfName.FONT);
- if (cff) {
- dic.put(PdfName.SUBTYPE, PdfName.TYPE1);
- dic.put(PdfName.BASEFONT, new PdfName(fontName + style));
- }
- else {
- dic.put(PdfName.SUBTYPE, PdfName.TRUETYPE);
- dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix + fontName + style));
- }
- dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix + fontName + style));
- if (!fontSpecific) {
- for (int k = firstChar; k <= lastChar; ++k) {
- if (!differences[k].equals(notdef)) {
- firstChar = k;
- break;
- }
- }
- if (encoding.equals("Cp1252") || encoding.equals("MacRoman"))
- dic.put(PdfName.ENCODING, encoding.equals("Cp1252") ? PdfName.WIN_ANSI_ENCODING : PdfName.MAC_ROMAN_ENCODING);
- else {
- PdfDictionary enc = new PdfDictionary(PdfName.ENCODING);
- PdfArray dif = new PdfArray();
- boolean gap = true;
- for (int k = firstChar; k <= lastChar; ++k) {
- if (shortTag[k] != 0) {
- if (gap) {
- dif.add(new PdfNumber(k));
- gap = false;
- }
- dif.add(new PdfName(differences[k]));
- }
- else
- gap = true;
- }
- enc.put(PdfName.DIFFERENCES, dif);
- dic.put(PdfName.ENCODING, enc);
- }
- }
- dic.put(PdfName.FIRSTCHAR, new PdfNumber(firstChar));
- dic.put(PdfName.LASTCHAR, new PdfNumber(lastChar));
- PdfArray wd = new PdfArray();
- for (int k = firstChar; k <= lastChar; ++k) {
- if (shortTag[k] == 0)
- wd.add(new PdfNumber(0));
- else
- wd.add(new PdfNumber(widths[k]));
- }
- dic.put(PdfName.WIDTHS, wd);
- if (fontDescriptor != null)
- dic.put(PdfName.FONTDESCRIPTOR, fontDescriptor);
- return dic;
- }
-
- private byte[] getFullFont() throws IOException {
- RandomAccessFileOrArray rf2 = new RandomAccessFileOrArray(rf);
- rf2.reOpen();
- byte b[] = new byte[rf2.length()];
- rf2.readFully(b);
- rf2.close();
- return b;
- }
-
- /** Outputs to the writer the font dictionaries and streams.
- * @param writer the writer for this document
- * @param ref the font indirect reference
- * @param params several parameters that depend on the font type
- * @throws IOException on error
- * @throws DocumentException error in generating the object
- */
- void writeFont(PdfWriter writer, PdfIndirectReference ref, Object params[]) throws DocumentException, IOException {
- int firstChar = ((Integer)params[0]).intValue();
- int lastChar = ((Integer)params[1]).intValue();
- byte shortTag[] = (byte[])params[2];
- if (!subset) {
- firstChar = 0;
- lastChar = shortTag.length - 1;
- for (int k = 0; k < shortTag.length; ++k)
- shortTag[k] = 1;
- }
- PdfIndirectReference ind_font = null;
- PdfObject pobj = null;
- PdfIndirectObject obj = null;
- String subsetPrefix = "";
- if (embedded) {
- if (cff) {
- RandomAccessFileOrArray rf2 = new RandomAccessFileOrArray(rf);
- byte b[] = new byte[cffLength];
- try {
- rf2.reOpen();
- rf2.seek(cffOffset);
- rf2.readFully(b);
- }
- finally {
- try {
- rf2.close();
- }
- catch (Exception e) {
- // empty on purpose
- }
- }
- pobj = new StreamFont(b, "Type1C");
- obj = writer.addToBody(pobj);
- ind_font = obj.getIndirectReference();
- }
- else {
- if (subset)
- subsetPrefix = createSubsetPrefix();
- HashMap glyphs = new HashMap();
- for (int k = firstChar; k <= lastChar; ++k) {
- if (shortTag[k] != 0) {
- int metrics[];
- if (fontSpecific)
- metrics = getMetricsTT(k);
- else
- metrics = getMetricsTT(unicodeDifferences[k]);
- if (metrics != null)
- glyphs.put(new Integer(metrics[0]), null);
- }
- }
- TrueTypeFontSubSet sb = new TrueTypeFontSubSet(fileName, new RandomAccessFileOrArray(rf), glyphs, directoryOffset, true);
- byte b[] = sb.process();
- int lengths[] = new int[]{b.length};
- pobj = new StreamFont(b, lengths);
- obj = writer.addToBody(pobj);
- ind_font = obj.getIndirectReference();
- }
- }
- pobj = getFontDescriptor(ind_font, subsetPrefix);
- if (pobj != null){
- obj = writer.addToBody(pobj);
- ind_font = obj.getIndirectReference();
- }
- pobj = getFontBaseType(ind_font, subsetPrefix, firstChar, lastChar, shortTag);
- writer.addToBody(pobj, ref);
- }
-
- /** Gets the font parameter identified by <CODE>key</CODE>. Valid values
- * for <CODE>key</CODE> are <CODE>ASCENT</CODE>, <CODE>CAPHEIGHT</CODE>, <CODE>DESCENT</CODE>
- * and <CODE>ITALICANGLE</CODE>.
- * @param key the parameter to be extracted
- * @param fontSize the font size in points
- * @return the parameter in points
- */
- public float getFontDescriptor(int key, float fontSize) {
- switch (key) {
- case ASCENT:
- return (float)os_2.sTypoAscender * fontSize / (float)head.unitsPerEm;
- case CAPHEIGHT:
- return (float)os_2.sCapHeight * fontSize / (float)head.unitsPerEm;
- case DESCENT:
- return (float)os_2.sTypoDescender * fontSize / (float)head.unitsPerEm;
- case ITALICANGLE:
- return (float)italicAngle;
- case BBOXLLX:
- return fontSize * (int)head.xMin / head.unitsPerEm;
- case BBOXLLY:
- return fontSize * (int)head.yMin / head.unitsPerEm;
- case BBOXURX:
- return fontSize * (int)head.xMax / head.unitsPerEm;
- case BBOXURY:
- return fontSize * (int)head.yMax / head.unitsPerEm;
- case AWT_ASCENT:
- return fontSize * (int)hhea.Ascender / head.unitsPerEm;
- case AWT_DESCENT:
- return fontSize * (int)hhea.Descender / head.unitsPerEm;
- case AWT_LEADING:
- return fontSize * (int)hhea.LineGap / head.unitsPerEm;
- case AWT_MAXADVANCE:
- return fontSize * (int)hhea.advanceWidthMax / head.unitsPerEm;
- }
- return 0;
- }
-
- /** Gets the glyph index and metrics for a character.
- * @param c the character
- * @return an <CODE>int</CODE> array with {glyph index, width}
- */
- public int[] getMetricsTT(int c) {
- if (!fontSpecific && cmap31 != null)
- return (int[])cmap31.get(new Integer(c));
- if (fontSpecific && cmap10 != null)
- return (int[])cmap10.get(new Integer(c));
- if (cmap31 != null)
- return (int[])cmap31.get(new Integer(c));
- if (cmap10 != null)
- return (int[])cmap10.get(new Integer(c));
- return null;
- }
-
- /** Gets the postscript font name.
- * @return the postscript font name
- */
- public String getPostscriptFontName() {
- return fontName;
- }
-
- /** Gets the code pages supported by the font.
- * @return the code pages supported by the font
- */
- public String[] getCodePagesSupported() {
- long cp = (((long)os_2.ulCodePageRange2) << 32) + ((long)os_2.ulCodePageRange1 & 0xffffffffL);
- int count = 0;
- long bit = 1;
- for (int k = 0; k < 64; ++k) {
- if ((cp & bit) != 0 && codePages[k] != null)
- ++count;
- bit <<= 1;
- }
- String ret[] = new String[count];
- count = 0;
- bit = 1;
- for (int k = 0; k < 64; ++k) {
- if ((cp & bit) != 0 && codePages[k] != null)
- ret[count++] = codePages[k];
- bit <<= 1;
- }
- return ret;
- }
-
- /** Gets the full name of the font. If it is a True Type font
- * each array element will have {Platform ID, Platform Encoding ID,
- * Language ID, font name}. The interpretation of this values can be
- * found in the Open Type specification, chapter 2, in the 'name' table.<br>
- * For the other fonts the array has a single element with {"", "", "",
- * font name}.
- * @return the full name of the font
- */
- public String[][] getFullFontName() {
- return fullName;
- }
-
- /** Gets the family name of the font. If it is a True Type font
- * each array element will have {Platform ID, Platform Encoding ID,
- * Language ID, font name}. The interpretation of this values can be
- * found in the Open Type specification, chapter 2, in the 'name' table.<br>
- * For the other fonts the array has a single element with {"", "", "",
- * font name}.
- * @return the family name of the font
- */
- public String[][] getFamilyFontName() {
- return familyName;
- }
-
- /** Checks if the font has any kerning pairs.
- * @return <CODE>true</CODE> if the font has any kerning pairs
- */
- public boolean hasKernPairs() {
- return kerning.size() > 0;
- }
-
- /**
- * Sets the font name that will appear in the pdf font dictionary.
- * Use with care as it can easily make a font unreadable if not embedded.
- * @param name the new font name
- */
- public void setPostscriptFontName(String name) {
- fontName = name;
- }
-
- /**
- * Sets the kerning between two Unicode chars.
- * @param char1 the first char
- * @param char2 the second char
- * @param kern the kerning to apply in normalized 1000 units
- * @return <code>true</code> if the kerning was applied, <code>false</code> otherwise
- */
- public boolean setKerning(char char1, char char2, int kern) {
- int metrics[] = getMetricsTT(char1);
- if (metrics == null)
- return false;
- int c1 = metrics[0];
- metrics = getMetricsTT(char2);
- if (metrics == null)
- return false;
- int c2 = metrics[0];
- kerning.put((c1 << 16) + c2, kern);
- return true;
- }
-
- protected int[] getRawCharBBox(int c, String name) {
- HashMap map = null;
- if (name == null || cmap31 == null)
- map = cmap10;
- else
- map = cmap31;
- if (map == null)
- return null;
- int metric[] = (int[])map.get(new Integer(c));
- if (metric == null || bboxes == null)
- return null;
- return bboxes[metric[0]];
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/TrueTypeFontSubSet.java b/LibrarySource/com/lowagie/text/pdf/TrueTypeFontSubSet.java
deleted file mode 100644
index 9f8bc38..0000000
--- a/LibrarySource/com/lowagie/text/pdf/TrueTypeFontSubSet.java
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * $Id: TrueTypeFontSubSet.java,v 1.15 2002/07/09 11:28:24 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.*;
-import java.util.HashMap;
-import java.util.ArrayList;
-import java.util.Arrays;
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.ExceptionConverter;
-
-/** Subsets a True Type font by removing the unneeded glyphs from
- * the font.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-class TrueTypeFontSubSet {
- static final String tableNamesSimple[] = {"cvt ", "fpgm", "glyf", "head",
- "hhea", "hmtx", "loca", "maxp", "prep"};
- static final String tableNamesCmap[] = {"cmap", "cvt ", "fpgm", "glyf", "head",
- "hhea", "hmtx", "loca", "maxp", "prep"};
- static final int entrySelectors[] = {0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4};
- static final int TABLE_CHECKSUM = 0;
- static final int TABLE_OFFSET = 1;
- static final int TABLE_LENGTH = 2;
- static final int HEAD_LOCA_FORMAT_OFFSET = 51;
-
- static final int ARG_1_AND_2_ARE_WORDS = 1;
- static final int WE_HAVE_A_SCALE = 8;
- static final int MORE_COMPONENTS = 32;
- static final int WE_HAVE_AN_X_AND_Y_SCALE = 64;
- static final int WE_HAVE_A_TWO_BY_TWO = 128;
-
-
- /** Contains the location of the several tables. The key is the name of
- * the table and the value is an <CODE>int[3]</CODE> where position 0
- * is the checksum, position 1 is the offset from the start of the file
- * and position 2 is the length of the table.
- */
- protected HashMap tableDirectory;
- /** The file in use.
- */
- protected RandomAccessFileOrArray rf;
- /** The file name.
- */
- protected String fileName;
- protected boolean includeCmap;
- protected boolean locaShortTable;
- protected int locaTable[];
- protected HashMap glyphsUsed;
- protected ArrayList glyphsInList;
- protected int tableGlyphOffset;
- protected int newLocaTable[];
- protected byte newLocaTableOut[];
- protected byte newGlyfTable[];
- protected int glyfTableRealSize;
- protected int locaTableRealSize;
- protected byte outFont[];
- protected int fontPtr;
- protected int directoryOffset;
-
- /** Creates a new TrueTypeFontSubSet
- * @param directoryOffset The offset from the start of the file to the table directory
- * @param fileName the file name of the font
- * @param glyphsUsed the glyphs used
- * @param includeCmap <CODE>true</CODE> if the table cmap is to be included in the generated font
- */
- TrueTypeFontSubSet(String fileName, RandomAccessFileOrArray rf, HashMap glyphsUsed, int directoryOffset, boolean includeCmap) {
- this.fileName = fileName;
- this.rf = rf;
- this.glyphsUsed = glyphsUsed;
- this.includeCmap = includeCmap;
- this.directoryOffset = directoryOffset;
- glyphsInList = new ArrayList(glyphsUsed.keySet());
- }
-
- /** Does the actual work of subsetting the font.
- * @throws IOException on error
- * @throws DocumentException on error
- * @return the subset font
- */
- byte[] process() throws IOException, DocumentException {
- try {
- rf.reOpen();
- createTableDirectory();
- readLoca();
- flatGlyphs();
- createNewGlyphTables();
- locaTobytes();
- assembleFont();
- return outFont;
- }
- finally {
- try {
- rf.close();
- }
- catch (Exception e) {
- // empty on purpose
- }
- }
- }
-
- protected void assembleFont() throws IOException, DocumentException {
- int tableLocation[];
- int fullFontSize = 0;
- String tableNames[];
- if (includeCmap)
- tableNames = tableNamesCmap;
- else
- tableNames = tableNamesSimple;
- int tablesUsed = 2;
- int len = 0;
- for (int k = 0; k < tableNames.length; ++k) {
- String name = tableNames[k];
- if (name.equals("glyf") || name.equals("loca"))
- continue;
- tableLocation = (int[])tableDirectory.get(name);
- if (tableLocation == null)
- continue;
- ++tablesUsed;
- fullFontSize += (tableLocation[TABLE_LENGTH] + 3) & (~3);
- }
- fullFontSize += newLocaTableOut.length;
- fullFontSize += newGlyfTable.length;
- int ref = 16 * tablesUsed + 12;
- fullFontSize += ref;
- outFont = new byte[fullFontSize];
- fontPtr = 0;
- writeFontInt(0x00010000);
- writeFontShort(tablesUsed);
- int selector = entrySelectors[tablesUsed];
- writeFontShort((1 << selector) * 16);
- writeFontShort(selector);
- writeFontShort((tablesUsed - (1 << selector)) * 16);
- for (int k = 0; k < tableNames.length; ++k) {
- String name = tableNames[k];
- tableLocation = (int[])tableDirectory.get(name);
- if (tableLocation == null)
- continue;
- writeFontString(name);
- if (name.equals("glyf")) {
- writeFontInt(calculateChecksum(newGlyfTable));
- len = glyfTableRealSize;
- }
- else if (name.equals("loca")) {
- writeFontInt(calculateChecksum(newLocaTableOut));
- len = locaTableRealSize;
- }
- else {
- writeFontInt(tableLocation[TABLE_CHECKSUM]);
- len = tableLocation[TABLE_LENGTH];
- }
- writeFontInt(ref);
- writeFontInt(len);
- ref += (len + 3) & (~3);
- }
- for (int k = 0; k < tableNames.length; ++k) {
- String name = tableNames[k];
- tableLocation = (int[])tableDirectory.get(name);
- if (tableLocation == null)
- continue;
- if (name.equals("glyf")) {
- System.arraycopy(newGlyfTable, 0, outFont, fontPtr, newGlyfTable.length);
- fontPtr += newGlyfTable.length;
- newGlyfTable = null;
- }
- else if (name.equals("loca")) {
- System.arraycopy(newLocaTableOut, 0, outFont, fontPtr, newLocaTableOut.length);
- fontPtr += newLocaTableOut.length;
- newLocaTableOut = null;
- }
- else {
- rf.seek(tableLocation[TABLE_OFFSET]);
- rf.readFully(outFont, fontPtr, tableLocation[TABLE_LENGTH]);
- fontPtr += (tableLocation[TABLE_LENGTH] + 3) & (~3);
- }
- }
- }
-
- protected void createTableDirectory() throws IOException, DocumentException {
- tableDirectory = new HashMap();
- rf.seek(directoryOffset);
- int id = rf.readInt();
- if (id != 0x00010000)
- throw new DocumentException(fileName + " is not a true type file.");
- int num_tables = rf.readUnsignedShort();
- rf.skipBytes(6);
- for (int k = 0; k < num_tables; ++k) {
- String tag = readStandardString(4);
- int tableLocation[] = new int[3];
- tableLocation[TABLE_CHECKSUM] = rf.readInt();
- tableLocation[TABLE_OFFSET] = rf.readInt();
- tableLocation[TABLE_LENGTH] = rf.readInt();
- tableDirectory.put(tag, tableLocation);
- }
- }
-
- protected void readLoca() throws IOException, DocumentException {
- int tableLocation[];
- tableLocation = (int[])tableDirectory.get("head");
- if (tableLocation == null)
- throw new DocumentException("Table 'head' does not exist in " + fileName);
- rf.seek(tableLocation[TABLE_OFFSET] + HEAD_LOCA_FORMAT_OFFSET);
- locaShortTable = (rf.readUnsignedShort() == 0);
- tableLocation = (int[])tableDirectory.get("loca");
- if (tableLocation == null)
- throw new DocumentException("Table 'loca' does not exist in " + fileName);
- rf.seek(tableLocation[TABLE_OFFSET]);
- if (locaShortTable) {
- int entries = tableLocation[TABLE_LENGTH] / 2;
- locaTable = new int[entries];
- for (int k = 0; k < entries; ++k)
- locaTable[k] = rf.readUnsignedShort() * 2;
- }
- else {
- int entries = tableLocation[TABLE_LENGTH] / 4;
- locaTable = new int[entries];
- for (int k = 0; k < entries; ++k)
- locaTable[k] = rf.readInt();
- }
- }
-
- protected void createNewGlyphTables() throws IOException {
- newLocaTable = new int[locaTable.length];
- int activeGlyphs[] = new int[glyphsInList.size()];
- for (int k = 0; k < activeGlyphs.length; ++k)
- activeGlyphs[k] = ((Integer)glyphsInList.get(k)).intValue();
- Arrays.sort(activeGlyphs);
- int glyfSize = 0;
- for (int k = 0; k < activeGlyphs.length; ++k) {
- int glyph = activeGlyphs[k];
- glyfSize += locaTable[glyph + 1] - locaTable[glyph];
- }
- glyfTableRealSize = glyfSize;
- glyfSize = (glyfSize + 3) & (~3);
- newGlyfTable = new byte[glyfSize];
- int glyfPtr = 0;
- int listGlyf = 0;
- for (int k = 0; k < newLocaTable.length; ++k) {
- newLocaTable[k] = glyfPtr;
- if (listGlyf < activeGlyphs.length && activeGlyphs[listGlyf] == k) {
- ++listGlyf;
- newLocaTable[k] = glyfPtr;
- int start = locaTable[k];
- int len = locaTable[k + 1] - start;
- if (len > 0) {
- rf.seek(tableGlyphOffset + start);
- rf.readFully(newGlyfTable, glyfPtr, len);
- glyfPtr += len;
- }
- }
- }
- }
-
- protected void locaTobytes() {
- if (locaShortTable)
- locaTableRealSize = newLocaTable.length * 2;
- else
- locaTableRealSize = newLocaTable.length * 4;
- newLocaTableOut = new byte[(locaTableRealSize + 3) & (~3)];
- outFont = newLocaTableOut;
- fontPtr = 0;
- for (int k = 0; k < newLocaTable.length; ++k) {
- if (locaShortTable)
- writeFontShort(newLocaTable[k] / 2);
- else
- writeFontInt(newLocaTable[k]);
- }
-
- }
-
- protected void flatGlyphs() throws IOException, DocumentException {
- int tableLocation[];
- tableLocation = (int[])tableDirectory.get("glyf");
- if (tableLocation == null)
- throw new DocumentException("Table 'glyf' does not exist in " + fileName);
- Integer glyph0 = new Integer(0);
- if (!glyphsUsed.containsKey(glyph0)) {
- glyphsUsed.put(glyph0, null);
- glyphsInList.add(glyph0);
- }
- tableGlyphOffset = tableLocation[TABLE_OFFSET];
- for (int k = 0; k < glyphsInList.size(); ++k) {
- int glyph = ((Integer)glyphsInList.get(k)).intValue();
- checkGlyphComposite(glyph);
- }
- }
-
- protected void checkGlyphComposite(int glyph) throws IOException {
- int start = locaTable[glyph];
- if (start == locaTable[glyph + 1]) // no contour
- return;
- rf.seek(tableGlyphOffset + start);
- int numContours = rf.readShort();
- if (numContours >= 0)
- return;
- rf.skipBytes(8);
- for(;;) {
- int flags = rf.readUnsignedShort();
- Integer cGlyph = new Integer(rf.readUnsignedShort());
- if (!glyphsUsed.containsKey(cGlyph)) {
- glyphsUsed.put(cGlyph, null);
- glyphsInList.add(cGlyph);
- }
- if ((flags & MORE_COMPONENTS) == 0)
- return;
- int skip;
- if ((flags & ARG_1_AND_2_ARE_WORDS) != 0)
- skip = 4;
- else
- skip = 2;
- if ((flags & WE_HAVE_A_SCALE) != 0)
- skip += 2;
- else if ((flags & WE_HAVE_AN_X_AND_Y_SCALE) != 0)
- skip += 4;
- if ((flags & WE_HAVE_A_TWO_BY_TWO) != 0)
- skip += 8;
- rf.skipBytes(skip);
- }
- }
-
- /** Reads a <CODE>String</CODE> from the font file as bytes using the Cp1252
- * encoding.
- * @param length the length of bytes to read
- * @return the <CODE>String</CODE> read
- * @throws IOException the font file could not be read
- */
- protected String readStandardString(int length) throws IOException {
- byte buf[] = new byte[length];
- rf.readFully(buf);
- try {
- return new String(buf, BaseFont.WINANSI);
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- protected void writeFontShort(int n) {
- outFont[fontPtr++] = (byte)(n >> 8);
- outFont[fontPtr++] = (byte)(n);
- }
-
- protected void writeFontInt(int n) {
- outFont[fontPtr++] = (byte)(n >> 24);
- outFont[fontPtr++] = (byte)(n >> 16);
- outFont[fontPtr++] = (byte)(n >> 8);
- outFont[fontPtr++] = (byte)(n);
- }
-
- protected void writeFontString(String s) {
- byte b[] = PdfEncodings.convertToBytes(s, BaseFont.WINANSI);
- System.arraycopy(b, 0, outFont, fontPtr, b.length);
- fontPtr += b.length;
- }
-
- protected int calculateChecksum(byte b[]) {
- int len = b.length / 4;
- int v0 = 0;
- int v1 = 0;
- int v2 = 0;
- int v3 = 0;
- int ptr = 0;
- for (int k = 0; k < len; ++k) {
- v3 += (int)b[ptr++] & 0xff;
- v2 += (int)b[ptr++] & 0xff;
- v1 += (int)b[ptr++] & 0xff;
- v0 += (int)b[ptr++] & 0xff;
- }
- return v0 + (v1 << 8) + (v2 << 16) + (v3 << 24);
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/TrueTypeFontUnicode.java b/LibrarySource/com/lowagie/text/pdf/TrueTypeFontUnicode.java
deleted file mode 100644
index 51fb026..0000000
--- a/LibrarySource/com/lowagie/text/pdf/TrueTypeFontUnicode.java
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
- * $Id: TrueTypeFontUnicode.java,v 1.3 2003/11/17 12:53:06 stoledo Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashMap;
-
-import com.lowagie.text.DocumentException;
-/** Represents a True Type font with Unicode encoding. All the character
- * in the font can be used directly by using the encoding Identity-H or
- * Identity-V. This is the only way to represent some character sets such
- * as Thai.
- * @author Paulo Soares (psoares at consiste.pt)
- */
-class TrueTypeFontUnicode extends TrueTypeFont implements Comparator{
-
- /** <CODE>true</CODE> if the encoding is vertical.
- */
- boolean vertical = false;
-
- /** Creates a new TrueType font addressed by Unicode characters. The font
- * will always be embedded.
- * @param ttFile the location of the font on file. The file must end in '.ttf'.
- * The modifiers after the name are ignored.
- * @param enc the encoding to be applied to this font
- * @param emb true if the font is to be embedded in the PDF
- * @param ttfAfm the font as a <CODE>byte</CODE> array
- * @throws DocumentException the font is invalid
- * @throws IOException the font file could not be read
- */
- TrueTypeFontUnicode(String ttFile, String enc, boolean emb, byte ttfAfm[]) throws DocumentException, IOException {
- String nameBase = getBaseName(ttFile);
- String ttcName = getTTCName(nameBase);
- if (nameBase.length() < ttFile.length()) {
- style = ttFile.substring(nameBase.length());
- }
- encoding = enc;
- embedded = emb;
- fileName = ttcName;
- ttcIndex = "";
- if (ttcName.length() < nameBase.length())
- ttcIndex = nameBase.substring(ttcName.length() + 1);
- fontType = FONT_TYPE_TTUNI;
- if ((fileName.toLowerCase().endsWith(".ttf") || fileName.toLowerCase().endsWith(".otf") || fileName.toLowerCase().endsWith(".ttc")) && ((enc.equals(IDENTITY_H) || enc.equals(IDENTITY_V)) && emb)) {
- process(ttfAfm);
- if (os_2.fsType == 2)
- throw new DocumentException(fileName + style + " cannot be embedded due to licensing restrictions.");
- // Sivan
- if ((cmap31 == null && !fontSpecific) || (cmap10 == null && fontSpecific))
- directTextToByte=true;
- //throw new DocumentException(fileName + " " + style + " does not contain an usable cmap.");
- if (fontSpecific) {
- fontSpecific = false;
- String tempEncoding = encoding;
- encoding = "";
- createEncoding();
- encoding = tempEncoding;
- fontSpecific = true;
- }
- }
- else
- throw new DocumentException(fileName + " " + style + " is not a TTF font file.");
- vertical = enc.endsWith("V");
- }
-
-/**
- * Gets the width of a <CODE>String</CODE> in normalized 1000 units.
- * @param text the <CODE>String</CODE> to get the witdth of
- * @return the width in normalized 1000 units
- */
- public int getWidth(String text)
- {
- if (vertical)
- return text.length() * 1000;
- int total = 0;
- if (fontSpecific) {
- char cc[] = text.toCharArray();
- char ptr = 0;
- int len = cc.length;
- for (int k = 0; k < len; ++k) {
- char c = cc[k];
- if ((c & 0xff00) == 0 || (c & 0xff00) == 0xf000)
- total += getRawWidth(c & 0xff, null);
- }
- }
- else {
- int len = text.length();
- for (int k = 0; k < len; ++k)
- total += getRawWidth(text.charAt(k), encoding);
- }
- return total;
- }
-
- /** Creates a ToUnicode CMap to allow copy and paste from Acrobat.
- * @param metrics metrics[0] contains the glyph index and metrics[2]
- * contains the Unicode code
- * @throws DocumentException on error
- * @return the stream representing this CMap or <CODE>null</CODE>
- */
- private PdfStream getToUnicode(Object metrics[]) throws DocumentException {
- if (metrics.length == 0)
- return null;
- StringBuffer buf = new StringBuffer(
- "/CIDInit /ProcSet findresource begin\n" +
- "12 dict begin\n" +
- "begincmap\n" +
- "/CIDSystemInfo\n" +
- "<< /Registry (Adobe)\n" +
- "/Ordering (UCS)\n" +
- "/Supplement 0\n" +
- ">> def\n" +
- "/CMapName /Adobe-Identity-UCS def\n" +
- "/CMapType 2 def\n" +
- "1 begincodespacerange\n" +
- toHex(((int[])metrics[0])[0]) + toHex(((int[])metrics[metrics.length - 1])[0]) + "\n" +
- "endcodespacerange\n");
- int size = 0;
- for (int k = 0; k < metrics.length; ++k) {
- if (size == 0) {
- if (k != 0) {
- buf.append("endbfrange\n");
- }
- size = Math.min(100, metrics.length - k);
- buf.append(size).append(" beginbfrange\n");
- }
- --size;
- int metric[] = (int[])metrics[k];
- String fromTo = toHex(metric[0]);
- buf.append(fromTo).append(fromTo).append(toHex(metric[2])).append("\n");
- }
- buf.append(
- "endbfrange\n" +
- "endcmap\n" +
- "CMapName currentdict /CMap defineresource pop\n" +
- "end end\n");
- String s = buf.toString();
- PdfStream stream = new PdfStream(PdfEncodings.convertToBytes(s, null));
- stream.flateCompress();
- return stream;
- }
-
- /** Gets an hex string in the format "<HHHH>".
- * @param n the number
- * @return the hex string
- */
- static String toHex(int n) {
- String s = Integer.toHexString(n);
- return "<0000".substring(0, 5 - s.length()) + s + ">";
- }
-
- /** Generates the CIDFontTyte2 dictionary.
- * @param fontDescriptor the indirect reference to the font descriptor
- * @param subsetPrefix the subset prefix
- * @param metrics the horizontal width metrics
- * @return a stream
- */
- private PdfDictionary getCIDFontType2(PdfIndirectReference fontDescriptor, String subsetPrefix, Object metrics[]) {
- PdfDictionary dic = new PdfDictionary(PdfName.FONT);
- // sivan; cff
- if (cff) {
- dic.put(PdfName.SUBTYPE, PdfName.CIDFONTTYPE0);
- dic.put(PdfName.BASEFONT, new PdfName(fontName+"-"+encoding));
- }
- else {
- dic.put(PdfName.SUBTYPE, PdfName.CIDFONTTYPE2);
- dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix + fontName));
- }
- dic.put(PdfName.FONTDESCRIPTOR, fontDescriptor);
- if (!cff)
- dic.put(PdfName.CIDTOGIDMAP,PdfName.IDENTITY);
- PdfDictionary cdic = new PdfDictionary();
- cdic.put(PdfName.REGISTRY, new PdfString("Adobe"));
- cdic.put(PdfName.ORDERING, new PdfString("Identity"));
- cdic.put(PdfName.SUPPLEMENT, new PdfNumber(0));
- dic.put(PdfName.CIDSYSTEMINFO, cdic);
- if (!vertical) {
- dic.put(PdfName.DW, new PdfNumber(1000));
- StringBuffer buf = new StringBuffer("[");
- int lastNumber = -10;
- boolean firstTime = true;
- for (int k = 0; k < metrics.length; ++k) {
- int metric[] = (int[])metrics[k];
- if (metric[1] == 1000)
- continue;
- int m = metric[0];
- if (m == lastNumber + 1) {
- buf.append(" ").append(metric[1]);
- }
- else {
- if (!firstTime) {
- buf.append("]");
- }
- firstTime = false;
- buf.append(m).append("[").append(metric[1]);
- }
- lastNumber = m;
- }
- if (buf.length() > 1) {
- buf.append("]]");
- dic.put(PdfName.W, new PdfLiteral(buf.toString()));
- }
- }
- return dic;
- }
-
- /** Generates the font dictionary.
- * @param descendant the descendant dictionary
- * @param subsetPrefix the subset prefix
- * @param toUnicode the ToUnicode stream
- * @return the stream
- */
- private PdfDictionary getFontBaseType(PdfIndirectReference descendant, String subsetPrefix, PdfIndirectReference toUnicode) {
- PdfDictionary dic = new PdfDictionary(PdfName.FONT);
-
- dic.put(PdfName.SUBTYPE, PdfName.TYPE0);
- // The PDF Reference manual advises to add -encoding to CID font names
- if (cff)
- dic.put(PdfName.BASEFONT, new PdfName(fontName+"-"+encoding));
- //dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix+fontName));
- else
- dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix + fontName));
- //dic.put(PdfName.BASEFONT, new PdfName(fontName));
- dic.put(PdfName.ENCODING, new PdfName(encoding));
- dic.put(PdfName.DESCENDANTFONTS, new PdfArray(descendant));
- if (toUnicode != null)
- dic.put(PdfName.TOUNICODE, toUnicode);
- return dic;
- }
-
- /** The method used to sort the metrics array.
- * @param o1 the first element
- * @param o2 the second element
- * @return the comparisation
- */
- public int compare(Object o1, Object o2) {
- int m1 = ((int[])o1)[0];
- int m2 = ((int[])o2)[0];
- if (m1 < m2)
- return -1;
- if (m1 == m2)
- return 0;
- return 1;
- }
-
- /** Outputs to the writer the font dictionaries and streams.
- * @param writer the writer for this document
- * @param ref the font indirect reference
- * @param params several parameters that depend on the font type
- * @throws IOException on error
- * @throws DocumentException error in generating the object
- */
- void writeFont(PdfWriter writer, PdfIndirectReference ref, Object params[]) throws DocumentException, IOException {
- HashMap longTag = (HashMap)params[0];
- Object metrics[] = longTag.values().toArray();
- Arrays.sort(metrics, this);
- PdfIndirectReference ind_font = null;
- PdfObject pobj = null;
- PdfIndirectObject obj = null;
- // sivan: cff
- if (cff) {
- RandomAccessFileOrArray rf2 = new RandomAccessFileOrArray(rf);
- byte b[] = new byte[cffLength];
- try {
- rf2.reOpen();
- rf2.seek(cffOffset);
- rf2.readFully(b);
- } finally {
- try {
- rf2.close();
- } catch (Exception e) {
- // empty on purpose
- }
- }
- /*
- CFFFont cffFont = new CFFFont(new RandomAccessFileOrArray(b));
- // test if we can find the font by name and if it's a type1 CFF
- if (cffFont.exists(fontName) && !cffFont.isCID(fontName)) {
- byte[] cid = cffFont.getCID( (cffFont.getNames())[0] );
- if (cid != null) b=cid;
- }
-
- */
-
- CFFFontSubset cff = new CFFFontSubset(new RandomAccessFileOrArray(b),longTag);
- b = cff.Process( (cff.getNames())[0] );
-
- // if the font is already CID, or not found by name, or
- // getCID returned null, we just use the data in the CFF
- // table and hope for the best.
-
-
- // for debugging, force a reparsing
- /*
- java.lang.System.err.println("");
- java.lang.System.err.println("");
- java.lang.System.err.println("");
- CFFFont dummy = new CFFFont(java.nio.ByteBuffer.wrap(b));
- java.lang.System.err.println("");
- java.lang.System.err.println("");
- java.lang.System.err.println("");
- */
- pobj = new StreamFont(b, "CIDFontType0C");
- obj = writer.addToBody(pobj);
- ind_font = obj.getIndirectReference();
- } else {
- TrueTypeFontSubSet sb = new TrueTypeFontSubSet(fileName, new RandomAccessFileOrArray(rf), longTag, directoryOffset, false);
- byte b[] = sb.process();
- int lengths[] = new int[]{b.length};
- pobj = new StreamFont(b, lengths);
- obj = writer.addToBody(pobj);
- ind_font = obj.getIndirectReference();
- }
- String subsetPrefix = createSubsetPrefix();
- //if (cff) subsetPrefix = "";
- PdfDictionary dic = getFontDescriptor(ind_font, subsetPrefix);
- obj = writer.addToBody(dic);
- ind_font = obj.getIndirectReference();
-
- pobj = getCIDFontType2(ind_font, subsetPrefix, metrics);
- obj = writer.addToBody(pobj);
- ind_font = obj.getIndirectReference();
-
- pobj = getToUnicode(metrics);
- PdfIndirectReference toUnicodeRef = null;
-
- if (pobj != null) {
- obj = writer.addToBody(pobj);
- toUnicodeRef = obj.getIndirectReference();
- }
-
- pobj = getFontBaseType(ind_font, subsetPrefix, toUnicodeRef);
- writer.addToBody(pobj, ref);
- }
-
- /** A forbidden operation. Will throw a null pointer exception.
- * @param text the text
- * @return always <CODE>null</CODE>
- */
- byte[] convertToBytes(String text)
- {
- return null;
- }
-
- /**
- * Checks if a character exists in this font.
- * @param c the character to check
- * @return <CODE>true</CODE> if the character has a glyph,
- * <CODE>false</CODE> otherwise
- */
- public boolean charExists(char c) {
- HashMap map = null;
- if (fontSpecific)
- map = cmap10;
- else
- map = cmap31;
- if (map == null)
- return false;
- if (fontSpecific) {
- if ((c & 0xff00) == 0 || (c & 0xff00) == 0xf000)
- return map.get(new Integer(c & 0xff)) != null;
- else
- return false;
- }
- else
- return map.get(new Integer(c)) != null;
- }
-
- /**
- * Sets the character advance.
- * @param c the character
- * @param advance the character advance normalized to 1000 units
- * @return <CODE>true</CODE> if the advance was set,
- * <CODE>false</CODE> otherwise
- */
- public boolean setCharAdvance(char c, int advance) {
- HashMap map = null;
- if (fontSpecific)
- map = cmap10;
- else
- map = cmap31;
- if (map == null)
- return false;
- int m[] = null;
- if (fontSpecific) {
- if ((c & 0xff00) == 0 || (c & 0xff00) == 0xf000)
- m = (int[])map.get(new Integer(c & 0xff));
- else
- return false;
- }
- else
- m = (int[])map.get(new Integer(c));
- if (m == null)
- return false;
- else
- m[1] = advance;
- return true;
- }
-
- public int[] getCharBBox(char c) {
- if (bboxes == null)
- return null;
- HashMap map = null;
- if (fontSpecific)
- map = cmap10;
- else
- map = cmap31;
- if (map == null)
- return null;
- int m[] = null;
- if (fontSpecific) {
- if ((c & 0xff00) == 0 || (c & 0xff00) == 0xf000)
- m = (int[])map.get(new Integer(c & 0xff));
- else
- return null;
- }
- else
- m = (int[])map.get(new Integer(c));
- if (m == null)
- return null;
- return bboxes[m[0]];
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/Type1Font.java b/LibrarySource/com/lowagie/text/pdf/Type1Font.java
deleted file mode 100644
index fb13693..0000000
--- a/LibrarySource/com/lowagie/text/pdf/Type1Font.java
+++ /dev/null
@@ -1,808 +0,0 @@
-/*
- * $Id: Type1Font.java,v 1.59 2004/12/14 15:16:00 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import com.lowagie.text.ExceptionConverter;
-import com.lowagie.text.DocumentException;
-import java.util.HashMap;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-import com.lowagie.text.pdf.fonts.FontsResourceAnchor;
-import java.io.*;
-
-/** Reads a Type1 font
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-class Type1Font extends BaseFont
-{
- private static FontsResourceAnchor resourceAnchor;
-
- /** The PFB file if the input was made with a <CODE>byte</CODE> array.
- */
- protected byte pfb[];
-/** The Postscript font name.
- */
- private String FontName;
-/** The full name of the font.
- */
- private String FullName;
-/** The family name of the font.
- */
- private String FamilyName;
-/** The weight of the font: normal, bold, etc.
- */
- private String Weight = "";
-/** The italic angle of the font, usually 0.0 or negative.
- */
- private float ItalicAngle = 0.0f;
-/** <CODE>true</CODE> if all the characters have the same
- * width.
- */
- private boolean IsFixedPitch = false;
-/** The character set of the font.
- */
- private String CharacterSet;
-/** The llx of the FontBox.
- */
- private int llx = -50;
-/** The lly of the FontBox.
- */
- private int lly = -200;
-/** The lurx of the FontBox.
- */
- private int urx = 1000;
-/** The ury of the FontBox.
- */
- private int ury = 900;
-/** The underline position.
- */
- private int UnderlinePosition = -100;
-/** The underline thickness.
- */
- private int UnderlineThickness = 50;
-/** The font's encoding name. This encoding is 'StandardEncoding' or
- * 'AdobeStandardEncoding' for a font that can be totally encoded
- * according to the characters names. For all other names the
- * font is treated as symbolic.
- */
- private String EncodingScheme = "FontSpecific";
-/** A variable.
- */
- private int CapHeight = 700;
-/** A variable.
- */
- private int XHeight = 480;
-/** A variable.
- */
- private int Ascender = 800;
-/** A variable.
- */
- private int Descender = -200;
-/** A variable.
- */
- private int StdHW;
-/** A variable.
- */
- private int StdVW = 80;
-
-/** Represents the section CharMetrics in the AFM file. Each
- * value of this array contains a <CODE>Object[4]</CODE> with an
- * Integer, Integer, String and int[]. This is the code, width, name and char bbox.
- * The key is the name of the char and also an Integer with the char number.
- */
- private HashMap CharMetrics = new HashMap();
-/** Represents the section KernPairs in the AFM file. The key is
- * the name of the first character and the value is a <CODE>Object[]</CODE>
- * with 2 elements for each kern pair. Position 0 is the name of
- * the second character and position 1 is the kerning distance. This is
- * repeated for all the pairs.
- */
- private HashMap KernPairs = new HashMap();
-/** The file in use.
- */
- private String fileName;
-/** <CODE>true</CODE> if this font is one of the 14 built in fonts.
- */
- private boolean builtinFont = false;
-/** Types of records in a PFB file. ASCII is 1 and BINARY is 2.
- * They have to appear in the PFB file in this sequence.
- */
- private static final int pfbTypes[] = {1, 2, 1};
-
- /** Creates a new Type1 font.
- * @param ttfAfm the AFM file if the input is made with a <CODE>byte</CODE> array
- * @param pfb the PFB file if the input is made with a <CODE>byte</CODE> array
- * @param afmFile the name of one of the 14 built-in fonts or the location of an AFM file. The file must end in '.afm'
- * @param enc the encoding to be applied to this font
- * @param emb true if the font is to be embedded in the PDF
- * @throws DocumentException the AFM file is invalid
- * @throws IOException the AFM file could not be read
- */
- Type1Font(String afmFile, String enc, boolean emb, byte ttfAfm[], byte pfb[]) throws DocumentException, IOException
- {
- if (emb && ttfAfm != null && pfb == null)
- throw new DocumentException("Two byte arrays are needed if the Type1 font is embedded.");
- if (emb && ttfAfm != null)
- this.pfb = pfb;
- encoding = enc;
- embedded = emb;
- fileName = afmFile;
- fontType = FONT_TYPE_T1;
- RandomAccessFileOrArray rf = null;
- InputStream is = null;
- if (BuiltinFonts14.containsKey(afmFile)) {
- embedded = false;
- builtinFont = true;
- byte buf[] = new byte[1024];
- try {
- if (resourceAnchor == null)
- resourceAnchor = new FontsResourceAnchor();
- is = getResourceStream(RESOURCE_PATH + afmFile + ".afm", resourceAnchor.getClass().getClassLoader());
- if (is == null) {
- String msg = afmFile + " not found as resource. (The *.afm files must exist as resources in the package com.lowagie.text.pdf.fonts)";
- System.err.println(msg);
- throw new DocumentException(msg);
- }
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- while (true) {
- int size = is.read(buf);
- if (size < 0)
- break;
- out.write(buf, 0, size);
- }
- buf = out.toByteArray();
- }
- finally {
- if (is != null) {
- try {
- is.close();
- }
- catch (Exception e) {
- // empty on purpose
- }
- }
- }
- try {
- rf = new RandomAccessFileOrArray(buf);
- process(rf);
- }
- finally {
- if (rf != null) {
- try {
- rf.close();
- }
- catch (Exception e) {
- // empty on purpose
- }
- }
- }
- }
- else if (afmFile.toLowerCase().endsWith(".afm")) {
- try {
- if (ttfAfm == null)
- rf = new RandomAccessFileOrArray(afmFile);
- else
- rf = new RandomAccessFileOrArray(ttfAfm);
- process(rf);
- }
- finally {
- if (rf != null) {
- try {
- rf.close();
- }
- catch (Exception e) {
- // empty on purpose
- }
- }
- }
- }
- else if (afmFile.toLowerCase().endsWith(".pfm")) {
- try {
- ByteArrayOutputStream ba = new ByteArrayOutputStream();
- if (ttfAfm == null)
- rf = new RandomAccessFileOrArray(afmFile);
- else
- rf = new RandomAccessFileOrArray(ttfAfm);
- Pfm2afm.convert(rf, ba);
- rf.close();
- rf = new RandomAccessFileOrArray(ba.toByteArray());
- process(rf);
- }
- finally {
- if (rf != null) {
- try {
- rf.close();
- }
- catch (Exception e) {
- // empty on purpose
- }
- }
- }
- }
- else
- throw new DocumentException(afmFile + " is not an AFM or PFM font file.");
- try {
- EncodingScheme = EncodingScheme.trim();
- if (EncodingScheme.equals("AdobeStandardEncoding") || EncodingScheme.equals("StandardEncoding")) {
- fontSpecific = false;
- }
- PdfEncodings.convertToBytes(" ", enc); // check if the encoding exists
- createEncoding();
- }
- catch (RuntimeException re) {
- throw re;
- }
- catch (Exception e) {
- throw new DocumentException(e);
- }
- }
-
-/** Gets the width from the font according to the <CODE>name</CODE> or,
- * if the <CODE>name</CODE> is null, meaning it is a symbolic font,
- * the char <CODE>c</CODE>.
- * @param c the char if the font is symbolic
- * @param name the glyph name
- * @return the width of the char
- */
- int getRawWidth(int c, String name) {
- Object metrics[];
- if (name == null) { // font specific
- metrics = (Object[])CharMetrics.get(new Integer(c));
- }
- else {
- if (name.equals(".notdef"))
- return 0;
- metrics = (Object[])CharMetrics.get(name);
- }
- if (metrics != null)
- return ((Integer)(metrics[1])).intValue();
- return 0;
- }
-
-/** Gets the kerning between two Unicode characters. The characters
- * are converted to names and this names are used to find the kerning
- * pairs in the <CODE>HashMap</CODE> <CODE>KernPairs</CODE>.
- * @param char1 the first char
- * @param char2 the second char
- * @return the kerning to be applied
- */
- public int getKerning(char char1, char char2)
- {
- String first = GlyphList.unicodeToName((int)char1);
- if (first == null)
- return 0;
- String second = GlyphList.unicodeToName((int)char2);
- if (second == null)
- return 0;
- Object obj[] = (Object[])KernPairs.get(first);
- if (obj == null)
- return 0;
- for (int k = 0; k < obj.length; k += 2) {
- if (second.equals(obj[k]))
- return ((Integer)obj[k + 1]).intValue();
- }
- return 0;
- }
-
-
- /** Reads the font metrics
- * @param rf the AFM file
- * @throws DocumentException the AFM file is invalid
- * @throws IOException the AFM file could not be read
- */
- public void process(RandomAccessFileOrArray rf) throws DocumentException, IOException
- {
- String line;
- boolean isMetrics = false;
- while ((line = rf.readLine()) != null)
- {
- StringTokenizer tok = new StringTokenizer(line);
- if (!tok.hasMoreTokens())
- continue;
- String ident = tok.nextToken();
- if (ident.equals("FontName"))
- FontName = tok.nextToken("\u00ff").substring(1);
- else if (ident.equals("FullName"))
- FullName = tok.nextToken("\u00ff").substring(1);
- else if (ident.equals("FamilyName"))
- FamilyName = tok.nextToken("\u00ff").substring(1);
- else if (ident.equals("Weight"))
- Weight = tok.nextToken("\u00ff").substring(1);
- else if (ident.equals("ItalicAngle"))
- ItalicAngle = Float.valueOf(tok.nextToken()).floatValue();
- else if (ident.equals("IsFixedPitch"))
- IsFixedPitch = tok.nextToken().equals("true");
- else if (ident.equals("CharacterSet"))
- CharacterSet = tok.nextToken("\u00ff").substring(1);
- else if (ident.equals("FontBBox"))
- {
- llx = (int)Float.valueOf(tok.nextToken()).floatValue();
- lly = (int)Float.valueOf(tok.nextToken()).floatValue();
- urx = (int)Float.valueOf(tok.nextToken()).floatValue();
- ury = (int)Float.valueOf(tok.nextToken()).floatValue();
- }
- else if (ident.equals("UnderlinePosition"))
- UnderlinePosition = (int)Float.valueOf(tok.nextToken()).floatValue();
- else if (ident.equals("UnderlineThickness"))
- UnderlineThickness = (int)Float.valueOf(tok.nextToken()).floatValue();
- else if (ident.equals("EncodingScheme"))
- EncodingScheme = tok.nextToken("\u00ff").substring(1);
- else if (ident.equals("CapHeight"))
- CapHeight = (int)Float.valueOf(tok.nextToken()).floatValue();
- else if (ident.equals("XHeight"))
- XHeight = (int)Float.valueOf(tok.nextToken()).floatValue();
- else if (ident.equals("Ascender"))
- Ascender = (int)Float.valueOf(tok.nextToken()).floatValue();
- else if (ident.equals("Descender"))
- Descender = (int)Float.valueOf(tok.nextToken()).floatValue();
- else if (ident.equals("StdHW"))
- StdHW = (int)Float.valueOf(tok.nextToken()).floatValue();
- else if (ident.equals("StdVW"))
- StdVW = (int)Float.valueOf(tok.nextToken()).floatValue();
- else if (ident.equals("StartCharMetrics"))
- {
- isMetrics = true;
- break;
- }
- }
- if (!isMetrics)
- throw new DocumentException("Missing StartCharMetrics in " + fileName);
- while ((line = rf.readLine()) != null)
- {
- StringTokenizer tok = new StringTokenizer(line);
- if (!tok.hasMoreTokens())
- continue;
- String ident = tok.nextToken();
- if (ident.equals("EndCharMetrics"))
- {
- isMetrics = false;
- break;
- }
- Integer C = new Integer(-1);
- Integer WX = new Integer(250);
- String N = "";
- int B[] = null;
-
- tok = new StringTokenizer(line, ";");
- while (tok.hasMoreTokens())
- {
- StringTokenizer tokc = new StringTokenizer(tok.nextToken());
- if (!tokc.hasMoreTokens())
- continue;
- ident = tokc.nextToken();
- if (ident.equals("C"))
- C = Integer.valueOf(tokc.nextToken());
- else if (ident.equals("WX"))
- WX = new Integer(Float.valueOf(tokc.nextToken()).intValue());
- else if (ident.equals("N"))
- N = tokc.nextToken();
- else if (ident.equals("B")) {
- B = new int[]{Integer.parseInt(tokc.nextToken()),
- Integer.parseInt(tokc.nextToken()),
- Integer.parseInt(tokc.nextToken()),
- Integer.parseInt(tokc.nextToken())};
- }
- }
- Object metrics[] = new Object[]{C, WX, N, B};
- if (C.intValue() >= 0)
- CharMetrics.put(C, metrics);
- CharMetrics.put(N, metrics);
- }
- if (isMetrics)
- throw new DocumentException("Missing EndCharMetrics in " + fileName);
- while ((line = rf.readLine()) != null)
- {
- StringTokenizer tok = new StringTokenizer(line);
- if (!tok.hasMoreTokens())
- continue;
- String ident = tok.nextToken();
- if (ident.equals("EndFontMetrics"))
- return;
- if (ident.equals("StartKernPairs"))
- {
- isMetrics = true;
- break;
- }
- }
- if (!isMetrics)
- throw new DocumentException("Missing EndFontMetrics in " + fileName);
- while ((line = rf.readLine()) != null)
- {
- StringTokenizer tok = new StringTokenizer(line);
- if (!tok.hasMoreTokens())
- continue;
- String ident = tok.nextToken();
- if (ident.equals("KPX"))
- {
- String first = tok.nextToken();
- String second = tok.nextToken();
- Integer width = new Integer(Float.valueOf(tok.nextToken()).intValue());
- Object relates[] = (Object[])KernPairs.get(first);
- if (relates == null)
- KernPairs.put(first, new Object[]{second, width});
- else
- {
- int n = relates.length;
- Object relates2[] = new Object[n + 2];
- System.arraycopy(relates, 0, relates2, 0, n);
- relates2[n] = second;
- relates2[n + 1] = width;
- KernPairs.put(first, relates2);
- }
- }
- else if (ident.equals("EndKernPairs"))
- {
- isMetrics = false;
- break;
- }
- }
- if (isMetrics)
- throw new DocumentException("Missing EndKernPairs in " + fileName);
- rf.close();
- }
-
-/** If the embedded flag is <CODE>false</CODE> or if the font is
- * one of the 14 built in types, it returns <CODE>null</CODE>,
- * otherwise the font is read and output in a PdfStream object.
- * @return the PdfStream containing the font or <CODE>null</CODE>
- * @throws DocumentException if there is an error reading the font
- */
- private PdfStream getFontStream() throws DocumentException
- {
- if (builtinFont || !embedded)
- return null;
- RandomAccessFileOrArray rf = null;
- try {
- String filePfb = fileName.substring(0, fileName.length() - 3) + "pfb";
- if (pfb == null)
- rf = new RandomAccessFileOrArray(filePfb);
- else
- rf = new RandomAccessFileOrArray(pfb);
- int fileLength = rf.length();
- byte st[] = new byte[fileLength - 18];
- int lengths[] = new int[3];
- int bytePtr = 0;
- for (int k = 0; k < 3; ++k) {
- if (rf.read() != 0x80)
- throw new DocumentException("Start marker missing in " + filePfb);
- if (rf.read() != pfbTypes[k])
- throw new DocumentException("Incorrect segment type in " + filePfb);
- int size = rf.read();
- size += rf.read() << 8;
- size += rf.read() << 16;
- size += rf.read() << 24;
- lengths[k] = size;
- while (size != 0) {
- int got = rf.read(st, bytePtr, size);
- if (got < 0)
- throw new DocumentException("Premature end in " + filePfb);
- bytePtr += got;
- size -= got;
- }
- }
- return new StreamFont(st, lengths);
- }
- catch (Exception e) {
- throw new DocumentException(e);
- }
- finally {
- if (rf != null) {
- try {
- rf.close();
- }
- catch (Exception e) {
- // empty on purpose
- }
- }
- }
- }
-
-/** Generates the font descriptor for this font or <CODE>null</CODE> if it is
- * one of the 14 built in fonts.
- * @param fontStream the indirect reference to a PdfStream containing the font or <CODE>null</CODE>
- * @return the PdfDictionary containing the font descriptor or <CODE>null</CODE>
- */
- private PdfDictionary getFontDescriptor(PdfIndirectReference fontStream)
- {
- if (builtinFont)
- return null;
- PdfDictionary dic = new PdfDictionary(PdfName.FONTDESCRIPTOR);
- dic.put(PdfName.ASCENT, new PdfNumber(Ascender));
- dic.put(PdfName.CAPHEIGHT, new PdfNumber(CapHeight));
- dic.put(PdfName.DESCENT, new PdfNumber(Descender));
- dic.put(PdfName.FONTBBOX, new PdfRectangle(llx, lly, urx, ury));
- dic.put(PdfName.FONTNAME, new PdfName(FontName));
- dic.put(PdfName.ITALICANGLE, new PdfNumber(ItalicAngle));
- dic.put(PdfName.STEMV, new PdfNumber(StdVW));
- if (fontStream != null)
- dic.put(PdfName.FONTFILE, fontStream);
- int flags = 0;
- if (IsFixedPitch)
- flags |= 1;
- flags |= fontSpecific ? 4 : 32;
- if (ItalicAngle < 0)
- flags |= 64;
- if (FontName.indexOf("Caps") >= 0 || FontName.endsWith("SC"))
- flags |= 131072;
- if (Weight.equals("Bold"))
- flags |= 262144;
- dic.put(PdfName.FLAGS, new PdfNumber(flags));
-
- return dic;
- }
-
- /** Generates the font dictionary for this font.
- * @return the PdfDictionary containing the font dictionary
- * @param firstChar the first valid character
- * @param lastChar the last valid character
- * @param shortTag a 256 bytes long <CODE>byte</CODE> array where each unused byte is represented by 0
- * @param fontDescriptor the indirect reference to a PdfDictionary containing the font descriptor or <CODE>null</CODE>
- */
- private PdfDictionary getFontBaseType(PdfIndirectReference fontDescriptor, int firstChar, int lastChar, byte shortTag[])
- {
- PdfDictionary dic = new PdfDictionary(PdfName.FONT);
- dic.put(PdfName.SUBTYPE, PdfName.TYPE1);
- dic.put(PdfName.BASEFONT, new PdfName(FontName));
- boolean stdEncoding = encoding.equals("Cp1252") || encoding.equals("MacRoman");
- if (!fontSpecific) {
- for (int k = firstChar; k <= lastChar; ++k) {
- if (!differences[k].equals(notdef)) {
- firstChar = k;
- break;
- }
- }
- if (stdEncoding)
- dic.put(PdfName.ENCODING, encoding.equals("Cp1252") ? PdfName.WIN_ANSI_ENCODING : PdfName.MAC_ROMAN_ENCODING);
- else {
- PdfDictionary enc = new PdfDictionary(PdfName.ENCODING);
- PdfArray dif = new PdfArray();
- boolean gap = true;
- for (int k = firstChar; k <= lastChar; ++k) {
- if (shortTag[k] != 0) {
- if (gap) {
- dif.add(new PdfNumber(k));
- gap = false;
- }
- dif.add(new PdfName(differences[k]));
- }
- else
- gap = true;
- }
- enc.put(PdfName.DIFFERENCES, dif);
- dic.put(PdfName.ENCODING, enc);
- }
- }
- if (forceWidthsOutput || !(builtinFont && (fontSpecific || stdEncoding))) {
- dic.put(PdfName.FIRSTCHAR, new PdfNumber(firstChar));
- dic.put(PdfName.LASTCHAR, new PdfNumber(lastChar));
- PdfArray wd = new PdfArray();
- for (int k = firstChar; k <= lastChar; ++k) {
- if (shortTag[k] == 0)
- wd.add(new PdfNumber(0));
- else
- wd.add(new PdfNumber(widths[k]));
- }
- dic.put(PdfName.WIDTHS, wd);
- }
- if (!builtinFont && fontDescriptor != null)
- dic.put(PdfName.FONTDESCRIPTOR, fontDescriptor);
- return dic;
- }
-
- /** Outputs to the writer the font dictionaries and streams.
- * @param writer the writer for this document
- * @param ref the font indirect reference
- * @param params several parameters that depend on the font type
- * @throws IOException on error
- * @throws DocumentException error in generating the object
- */
- void writeFont(PdfWriter writer, PdfIndirectReference ref, Object params[]) throws DocumentException, IOException {
- int firstChar = ((Integer)params[0]).intValue();
- int lastChar = ((Integer)params[1]).intValue();
- byte shortTag[] = (byte[])params[2];
- if (!subset) {
- firstChar = 0;
- lastChar = shortTag.length - 1;
- for (int k = 0; k < shortTag.length; ++k)
- shortTag[k] = 1;
- }
- PdfIndirectReference ind_font = null;
- PdfObject pobj = null;
- PdfIndirectObject obj = null;
- pobj = getFontStream();
- if (pobj != null){
- obj = writer.addToBody(pobj);
- ind_font = obj.getIndirectReference();
- }
- pobj = getFontDescriptor(ind_font);
- if (pobj != null){
- obj = writer.addToBody(pobj);
- ind_font = obj.getIndirectReference();
- }
- pobj = getFontBaseType(ind_font, firstChar, lastChar, shortTag);
- writer.addToBody(pobj, ref);
- }
-
- /** Gets the font parameter identified by <CODE>key</CODE>. Valid values
- * for <CODE>key</CODE> are <CODE>ASCENT</CODE>, <CODE>CAPHEIGHT</CODE>, <CODE>DESCENT</CODE>,
- * <CODE>ITALICANGLE</CODE>, <CODE>BBOXLLX</CODE>, <CODE>BBOXLLY</CODE>, <CODE>BBOXURX</CODE>
- * and <CODE>BBOXURY</CODE>.
- * @param key the parameter to be extracted
- * @param fontSize the font size in points
- * @return the parameter in points
- */
- public float getFontDescriptor(int key, float fontSize) {
- switch (key) {
- case AWT_ASCENT:
- case ASCENT:
- return Ascender * fontSize / 1000;
- case CAPHEIGHT:
- return CapHeight * fontSize / 1000;
- case AWT_DESCENT:
- case DESCENT:
- return Descender * fontSize / 1000;
- case ITALICANGLE:
- return ItalicAngle;
- case BBOXLLX:
- return llx * fontSize / 1000;
- case BBOXLLY:
- return lly * fontSize / 1000;
- case BBOXURX:
- return urx * fontSize / 1000;
- case BBOXURY:
- return ury * fontSize / 1000;
- case AWT_LEADING:
- return 0;
- case AWT_MAXADVANCE:
- return (urx - llx) * fontSize / 1000;
- }
- return 0;
- }
-
- /** Gets the postscript font name.
- * @return the postscript font name
- */
- public String getPostscriptFontName() {
- return FontName;
- }
-
- /** Gets the full name of the font. If it is a True Type font
- * each array element will have {Platform ID, Platform Encoding ID,
- * Language ID, font name}. The interpretation of this values can be
- * found in the Open Type specification, chapter 2, in the 'name' table.<br>
- * For the other fonts the array has a single element with {"", "", "",
- * font name}.
- * @return the full name of the font
- */
- public String[][] getFullFontName() {
- return new String[][]{{"", "", "", FullName}};
- }
-
- /** Gets the family name of the font. If it is a True Type font
- * each array element will have {Platform ID, Platform Encoding ID,
- * Language ID, font name}. The interpretation of this values can be
- * found in the Open Type specification, chapter 2, in the 'name' table.<br>
- * For the other fonts the array has a single element with {"", "", "",
- * font name}.
- * @return the family name of the font
- */
- public String[][] getFamilyFontName() {
- return new String[][]{{"", "", "", FamilyName}};
- }
-
- /** Checks if the font has any kerning pairs.
- * @return <CODE>true</CODE> if the font has any kerning pairs
- */
- public boolean hasKernPairs() {
- return KernPairs.size() > 0;
- }
-
- /**
- * Sets the font name that will appear in the pdf font dictionary.
- * Use with care as it can easily make a font unreadable if not embedded.
- * @param name the new font name
- */
- public void setPostscriptFontName(String name) {
- FontName = name;
- }
-
- /**
- * Sets the kerning between two Unicode chars.
- * @param char1 the first char
- * @param char2 the second char
- * @param kern the kerning to apply in normalized 1000 units
- * @return <code>true</code> if the kerning was applied, <code>false</code> otherwise
- */
- public boolean setKerning(char char1, char char2, int kern) {
- String first = GlyphList.unicodeToName((int)char1);
- if (first == null)
- return false;
- String second = GlyphList.unicodeToName((int)char2);
- if (second == null)
- return false;
- Object obj[] = (Object[])KernPairs.get(first);
- if (obj == null) {
- obj = new Object[]{second, new Integer(kern)};
- KernPairs.put(first, obj);
- return true;
- }
- for (int k = 0; k < obj.length; k += 2) {
- if (second.equals(obj[k])) {
- obj[k + 1] = new Integer(kern);
- return true;
- }
- }
- int size = obj.length;
- Object obj2[] = new Object[size + 2];
- System.arraycopy(obj, 0, obj2, 0, size);
- obj2[size] = second;
- obj2[size + 1] = new Integer(kern);
- KernPairs.put(first, obj2);
- return true;
- }
-
- protected int[] getRawCharBBox(int c, String name) {
- Object metrics[];
- if (name == null) { // font specific
- metrics = (Object[])CharMetrics.get(new Integer(c));
- }
- else {
- if (name.equals(".notdef"))
- return null;
- metrics = (Object[])CharMetrics.get(name);
- }
- if (metrics != null)
- return ((int[])(metrics[3]));
- return null;
- }
-
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/VerticalText.java b/LibrarySource/com/lowagie/text/pdf/VerticalText.java
deleted file mode 100644
index 04d5e67..0000000
--- a/LibrarySource/com/lowagie/text/pdf/VerticalText.java
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- *
- * Copyright 2002 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf;
-import java.util.ArrayList;
-import java.util.Iterator;
-import com.lowagie.text.Phrase;
-import com.lowagie.text.Chunk;
-import com.lowagie.text.Element;
-import com.lowagie.text.DocumentException;
-import headless.awt.Color;
-
-/** Writes text vertically. Note that the naming is done according
- * to horizontal text although it referrs to vertical text.
- * A line with the alignment Element.LEFT_ALIGN will actually
- * be top aligned.
- */
-public class VerticalText {
-
-/** Signals that there are no more text available. */
- public static final int NO_MORE_TEXT = 1;
-
-/** Signals that there is no more column. */
- public static final int NO_MORE_COLUMN = 2;
-
-/** The chunks that form the text. */
- protected ArrayList chunks = new ArrayList();
-
- /** The <CODE>PdfContent</CODE> where the text will be written to. */
- protected PdfContentByte text;
-
- /** The column alignment. Default is left alignment. */
- protected int alignment = Element.ALIGN_LEFT;
-
- /** Marks the chunks to be eliminated when the line is written. */
- protected int currentChunkMarker = -1;
-
- /** The chunk created by the splitting. */
- protected PdfChunk currentStandbyChunk;
-
- /** The chunk created by the splitting. */
- protected String splittedChunkText;
-
- /** The leading
- */
- protected float leading;
-
- /** The X coordinate.
- */
- protected float startX;
-
- /** The Y coordinate.
- */
- protected float startY;
-
- /** The maximum number of vertical lines.
- */
- protected int maxLines;
-
- /** The height of the text.
- */
- protected float height;
-
- /** Creates new VerticalText
- * @param text the place where the text will be written to. Can
- * be a template.
- */
- public VerticalText(PdfContentByte text) {
- this.text = text;
- }
-
- /**
- * Adds a <CODE>Phrase</CODE> to the current text array.
- * @param phrase the text
- */
- public void addText(Phrase phrase) {
- for (Iterator j = phrase.getChunks().iterator(); j.hasNext();) {
- chunks.add(new PdfChunk((Chunk)j.next(), null));
- }
- }
-
- /**
- * Adds a <CODE>Chunk</CODE> to the current text array.
- * @param chunk the text
- */
- public void addText(Chunk chunk) {
- chunks.add(new PdfChunk(chunk, null));
- }
-
- /** Sets the layout.
- * @param startX the top right X line position
- * @param startY the top right Y line position
- * @param height the height of the lines
- * @param maxLines the maximum number of lines
- * @param leading the separation between the lines
- */
- public void setVerticalLayout(float startX, float startY, float height, int maxLines, float leading) {
- this.startX = startX;
- this.startY = startY;
- this.height = height;
- this.maxLines = maxLines;
- setLeading(leading);
- }
-
- /** Sets the separation between the vertical lines.
- * @param leading the vertical line separation
- */
- public void setLeading(float leading) {
- this.leading = leading;
- }
-
- /** Gets the separation between the vertical lines.
- * @return the vertical line separation
- */
- public float getLeading() {
- return leading;
- }
-
- /**
- * Creates a line from the chunk array.
- * @param width the width of the line
- * @return the line or null if no more chunks
- */
- protected PdfLine createLine(float width) {
- if (chunks.size() == 0)
- return null;
- splittedChunkText = null;
- currentStandbyChunk = null;
- PdfLine line = new PdfLine(0, width, alignment, 0);
- String total;
- for (currentChunkMarker = 0; currentChunkMarker < chunks.size(); ++currentChunkMarker) {
- PdfChunk original = (PdfChunk)(chunks.get(currentChunkMarker));
- total = original.toString();
- currentStandbyChunk = line.add(original);
- if (currentStandbyChunk != null) {
- splittedChunkText = original.toString();
- original.setValue(total);
- return line;
- }
- }
- return line;
- }
-
- /**
- * Normalizes the list of chunks when the line is accepted.
- */
- protected void shortenChunkArray() {
- if (currentChunkMarker < 0)
- return;
- if (currentChunkMarker >= chunks.size()) {
- chunks.clear();
- return;
- }
- PdfChunk split = (PdfChunk)(chunks.get(currentChunkMarker));
- split.setValue(splittedChunkText);
- chunks.set(currentChunkMarker, currentStandbyChunk);
- for (int j = currentChunkMarker - 1; j >= 0; --j)
- chunks.remove(j);
- }
-
- /**
- * Outputs the lines to the document. It is equivalent to <CODE>go(false)</CODE>.
- * @return returns the result of the operation. It can be <CODE>NO_MORE_TEXT</CODE>
- * and/or <CODE>NO_MORE_COLUMN</CODE>
- * @throws DocumentException on error
- */
- public int go() throws DocumentException {
- return go(false);
- }
-
- /**
- * Outputs the lines to the document. The output can be simulated.
- * @param simulate <CODE>true</CODE> to simulate the writting to the document
- * @return returns the result of the operation. It can be <CODE>NO_MORE_TEXT</CODE>
- * and/or <CODE>NO_MORE_COLUMN</CODE>
- * @throws DocumentException on error
- */
- public int go(boolean simulate) throws DocumentException {
- boolean dirty = false;
- PdfContentByte graphics = null;
- if (text != null) {
- graphics = text.getDuplicate();
- }
- else if (simulate == false)
- throw new NullPointerException("VerticalText.go with simulate==false and text==null.");
- int status = 0;
- for (;;) {
- if (maxLines <= 0) {
- status = NO_MORE_COLUMN;
- if (chunks.size() == 0)
- status |= NO_MORE_TEXT;
- break;
- }
- if (chunks.size() == 0) {
- status = NO_MORE_TEXT;
- break;
- }
- PdfLine line = createLine(height);
- if (!simulate && !dirty) {
- text.beginText();
- dirty = true;
- }
- shortenChunkArray();
- if (!simulate) {
- text.setTextMatrix(startX, startY - line.indentLeft());
- writeLine(line, text, graphics);
- }
- --maxLines;
- startX -= leading;
- }
- if (dirty) {
- text.endText();
- text.add(graphics);
- }
- return status;
- }
-
- void writeLine(PdfLine line, PdfContentByte text, PdfContentByte graphics) throws DocumentException {
- PdfFont currentFont = null;
- PdfChunk chunk;
- for (Iterator j = line.iterator(); j.hasNext(); ) {
- chunk = (PdfChunk) j.next();
-
- if (chunk.font().compareTo(currentFont) != 0) {
- currentFont = chunk.font();
- text.setFontAndSize(currentFont.getFont(), currentFont.size());
- }
- Color color = chunk.color();
- if (color != null)
- text.setColorFill(color);
- text.showText(chunk.toString());
- if (color != null)
- text.resetRGBColorFill();
- }
- }
-
- /** Sets the new text origin.
- * @param startX the X coordinate
- * @param startY the Y coordinate
- */
- public void setOrigin(float startX, float startY) {
- this.startX = startX;
- this.startY = startY;
- }
-
- /** Gets the X coordinate where the next line will be writen. This value will change
- * after each call to <code>go()</code>.
- * @return the X coordinate
- */
- public float getOriginX() {
- return startX;
- }
-
- /** Gets the Y coordinate where the next line will be writen.
- * @return the Y coordinate
- */
- public float getOriginY() {
- return startY;
- }
-
- /** Gets the maximum number of available lines. This value will change
- * after each call to <code>go()</code>.
- * @return Value of property maxLines.
- */
- public int getMaxLines() {
- return maxLines;
- }
-
- /** Sets the maximum number of lines.
- * @param maxLines the maximum number of lines
- */
- public void setMaxLines(int maxLines) {
- this.maxLines = maxLines;
- }
-
- /** Gets the height of the line
- * @return the height
- */
- public float getHeight() {
- return height;
- }
-
- /** Sets the height of the line
- * @param height the new height
- */
- public void setHeight(float height) {
- this.height = height;
- }
-
- /**
- * Sets the alignment.
- * @param alignment the alignment
- */
- public void setAlignment(int alignment) {
- this.alignment = alignment;
- }
-
- /**
- * Gets the alignment.
- * @return the alignment
- */
- public int getAlignment() {
- return alignment;
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/XfdfReader.java b/LibrarySource/com/lowagie/text/pdf/XfdfReader.java
deleted file mode 100644
index 9bbd42b..0000000
--- a/LibrarySource/com/lowagie/text/pdf/XfdfReader.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- *
- * Copyright 2004 by Leonard Rosenthol.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.FileInputStream;
-import java.util.HashMap;
-import java.util.Stack;
-
-/**
- * Reads a XFDF.
- * @author Leonard Rosenthol (leonardr at pdfsages.com)
- */
-public class XfdfReader implements SimpleXMLDocHandler {
- // stuff used during parsing to handle state
- private boolean foundRoot = false;
- private Stack fieldNames = new Stack();
- private Stack fieldValues = new Stack();
-
- // storage for the field list and their values
- HashMap fields;
-
- // storage for the path to referenced PDF, if any
- String fileSpec;
-
- /** Reads an XFDF form.
- * @param filename the file name of the form
- * @throws IOException on error
- */
- public XfdfReader(String filename) throws IOException {
- FileInputStream fin = null;
- try {
- fin = new FileInputStream(filename);
- SimpleXMLParser.parse(this, fin);
- }
- finally {
- try{fin.close();}catch(Exception e){}
- }
- }
-
- /** Reads an XFDF form.
- * @param xfdfIn the byte array with the form
- * @throws IOException on error
- */
- public XfdfReader(byte xfdfIn[]) throws IOException {
- SimpleXMLParser.parse( this, new ByteArrayInputStream(xfdfIn));
- }
-
- /** Gets all the fields. The map is keyed by the fully qualified
- * field name and the value is a merged <CODE>PdfDictionary</CODE>
- * with the field content.
- * @return all the fields
- */
- public HashMap getFields() {
- return fields;
- }
-
- /** Gets the field value.
- * @param name the fully qualified field name
- * @return the field's value
- */
- public String getField(String name) {
- return (String)fields.get(name);
- }
-
- /** Gets the field value or <CODE>null</CODE> if the field does not
- * exist or has no value defined.
- * @param name the fully qualified field name
- * @return the field value or <CODE>null</CODE>
- */
- public String getFieldValue(String name) {
- String field = (String)fields.get(name);
- if (field == null)
- return null;
- else
- return field;
- }
-
- /** Gets the PDF file specification contained in the FDF.
- * @return the PDF file specification contained in the FDF
- */
- public String getFileSpec() {
- return fileSpec;
- }
-
- /**
- * Called when a start tag is found.
- * @param tag the tag name
- * @param h the tag's attributes
- */
- public void startElement(String tag, HashMap h)
- {
- if ( !foundRoot ) {
- if (!tag.equals("xfdf"))
- throw new RuntimeException("Root element is not Bookmark.");
- else
- foundRoot = true;
- }
-
- if ( tag.equals("xfdf") ){
-
- } else if ( tag.equals("f") ) {
- fileSpec = (String)h.get( "href" );
- } else if ( tag.equals("fields") ) {
- fields = new HashMap(); // init it!
- } else if ( tag.equals("field") ) {
- String fName = (String) h.get( "name" );
- fieldNames.push( fName );
- } else if ( tag.equals("value") ) {
- fieldValues.push( (String)"" );
- }
- }
- /**
- * Called when an end tag is found.
- * @param tag the tag name
- */
- public void endElement(String tag) {
- if ( tag.equals("value") ) {
- String fName = "";
- for (int k = 0; k < fieldNames.size(); ++k) {
- fName += "." + (String)fieldNames.elementAt(k);
- }
- if (fName.startsWith("."))
- fName = fName.substring(1);
- String fVal = (String) fieldValues.pop();
- fields.put( fName, fVal );
- }
- else if (tag.equals("field") ) {
- if (!fieldNames.isEmpty())
- fieldNames.pop();
- }
- }
-
- /**
- * Called when the document starts to be parsed.
- */
- public void startDocument()
- {
- fileSpec = new String(""); // and this too...
- }
- /**
- * Called after the document is parsed.
- */
- public void endDocument()
- {
-
- }
- /**
- * Called when a text element is found.
- * @param str the text element, probably a fragment.
- */
- public void text(String str)
- {
- if (fieldNames.isEmpty() || fieldValues.isEmpty())
- return;
-
- String val = (String)fieldValues.pop();
- val += str;
- fieldValues.push(val);
- }
-}
\ No newline at end of file
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/BmpImage.java b/LibrarySource/com/lowagie/text/pdf/codec/BmpImage.java
deleted file mode 100644
index f3d4db6..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/BmpImage.java
+++ /dev/null
@@ -1,1307 +0,0 @@
-/*
- * Copyright 2003 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- *
- *
- * The original JAI codecs have the following license
- *
- * Copyright (c) 2001 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * -Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * -Redistribution in binary form must reproduct the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
- * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
- * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
- * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
- * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
- * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
- * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
- * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
- * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that Software is not designed,licensed or intended for use in
- * the design, construction, operation or maintenance of any nuclear facility.
- */
-package com.lowagie.text.pdf.codec;
-
-import com.lowagie.text.pdf.*;
-import com.lowagie.text.*;
-import java.io.*;
-import java.util.HashMap;
-import java.net.URL;
-
-/** Reads a BMP image. All types of BMP can be read.
- * <p>
- * It is based in the JAI codec.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class BmpImage {
-
- // BMP variables
- private InputStream inputStream;
- private long bitmapFileSize;
- private long bitmapOffset;
- private long compression;
- private long imageSize;
- private byte palette[];
- private int imageType;
- private int numBands;
- private boolean isBottomUp;
- private int bitsPerPixel;
- private int redMask, greenMask, blueMask, alphaMask;
- public HashMap properties = new HashMap();
- private long xPelsPerMeter;
- private long yPelsPerMeter;
- // BMP Image types
- private static final int VERSION_2_1_BIT = 0;
- private static final int VERSION_2_4_BIT = 1;
- private static final int VERSION_2_8_BIT = 2;
- private static final int VERSION_2_24_BIT = 3;
-
- private static final int VERSION_3_1_BIT = 4;
- private static final int VERSION_3_4_BIT = 5;
- private static final int VERSION_3_8_BIT = 6;
- private static final int VERSION_3_24_BIT = 7;
-
- private static final int VERSION_3_NT_16_BIT = 8;
- private static final int VERSION_3_NT_32_BIT = 9;
-
- private static final int VERSION_4_1_BIT = 10;
- private static final int VERSION_4_4_BIT = 11;
- private static final int VERSION_4_8_BIT = 12;
- private static final int VERSION_4_16_BIT = 13;
- private static final int VERSION_4_24_BIT = 14;
- private static final int VERSION_4_32_BIT = 15;
-
- // Color space types
- private static final int LCS_CALIBRATED_RGB = 0;
- private static final int LCS_sRGB = 1;
- private static final int LCS_CMYK = 2;
-
- // Compression Types
- private static final int BI_RGB = 0;
- private static final int BI_RLE8 = 1;
- private static final int BI_RLE4 = 2;
- private static final int BI_BITFIELDS = 3;
-
- int width;
- int height;
-
- BmpImage(InputStream is, boolean noHeader, int size) throws IOException {
- bitmapFileSize = size;
- bitmapOffset = 0;
- process(is, noHeader);
- }
-
- /** Reads a BMP from an url.
- * @param url the url
- * @throws IOException on error
- * @return the image
- */
- public static Image getImage(URL url) throws IOException {
- InputStream is = null;
- try {
- is = url.openStream();
- Image img = getImage(is);
- img.setUrl(url);
- return img;
- }
- finally {
- if (is != null) {
- is.close();
- }
- }
- }
-
- /** Reads a BMP from a stream. The stream is not closed.
- * @param is the stream
- * @throws IOException on error
- * @return the image
- */
- public static Image getImage(InputStream is) throws IOException {
- return getImage(is, false, 0);
- }
-
- /** Reads a BMP from a stream. The stream is not closed.
- * The BMP may not have a header and be considered as a plain DIB.
- * @param is the stream
- * @param noHeader true to process a plain DIB
- * @param size the size of the DIB. Not used for a BMP
- * @throws IOException on error
- * @return the image
- */
- public static Image getImage(InputStream is, boolean noHeader, int size) throws IOException {
- BmpImage bmp = new BmpImage(is, noHeader, size);
- try {
- Image img = bmp.getImage();
- img.setDpi((int)((double)bmp.xPelsPerMeter * 0.0254), (int)((double)bmp.xPelsPerMeter * 0.0254));
- img.setOriginalType(Image.ORIGINAL_BMP);
- return img;
- }
- catch (BadElementException be) {
- throw new ExceptionConverter(be);
- }
- }
-
- /** Reads a BMP from a file.
- * @param file the file
- * @throws IOException on error
- * @return the image
- */
- public static Image getImage(String file) throws IOException {
- return getImage(Image.toURL(file));
- }
-
- /** Reads a BMP from a byte array.
- * @param data the byte array
- * @throws IOException on error
- * @return the image
- */
- public static Image getImage(byte data[]) throws IOException {
- InputStream is = null;
- try {
- is = new ByteArrayInputStream(data);
- Image img = getImage(is);
- img.setOriginalData(data);
- return img;
- }
- finally {
- if (is != null) {
- is.close();
- }
- }
- }
-
-
- protected void process(InputStream stream, boolean noHeader) throws IOException {
- if (noHeader || stream instanceof BufferedInputStream) {
- inputStream = stream;
- } else {
- inputStream = new BufferedInputStream(stream);
- }
- if (!noHeader) {
- // Start File Header
- if (!(readUnsignedByte(inputStream) == 'B' &&
- readUnsignedByte(inputStream) == 'M')) {
- throw new
- RuntimeException("Invalid magic value for BMP file.");
- }
-
- // Read file size
- bitmapFileSize = readDWord(inputStream);
-
- // Read the two reserved fields
- readWord(inputStream);
- readWord(inputStream);
-
- // Offset to the bitmap from the beginning
- bitmapOffset = readDWord(inputStream);
-
- // End File Header
- }
- // Start BitmapCoreHeader
- long size = readDWord(inputStream);
-
- if (size == 12) {
- width = readWord(inputStream);
- height = readWord(inputStream);
- } else {
- width = readLong(inputStream);
- height = readLong(inputStream);
- }
-
- int planes = readWord(inputStream);
- bitsPerPixel = readWord(inputStream);
-
- properties.put("color_planes", new Integer(planes));
- properties.put("bits_per_pixel", new Integer(bitsPerPixel));
-
- // As BMP always has 3 rgb bands, except for Version 5,
- // which is bgra
- numBands = 3;
- if (bitmapOffset == 0)
- bitmapOffset = size;
- if (size == 12) {
- // Windows 2.x and OS/2 1.x
- properties.put("bmp_version", "BMP v. 2.x");
-
- // Classify the image type
- if (bitsPerPixel == 1) {
- imageType = VERSION_2_1_BIT;
- } else if (bitsPerPixel == 4) {
- imageType = VERSION_2_4_BIT;
- } else if (bitsPerPixel == 8) {
- imageType = VERSION_2_8_BIT;
- } else if (bitsPerPixel == 24) {
- imageType = VERSION_2_24_BIT;
- }
-
- // Read in the palette
- int numberOfEntries = (int)((bitmapOffset-14-size) / 3);
- int sizeOfPalette = numberOfEntries*3;
- if (bitmapOffset == size) {
- switch (imageType) {
- case VERSION_2_1_BIT:
- sizeOfPalette = 2 * 3;
- break;
- case VERSION_2_4_BIT:
- sizeOfPalette = 16 * 3;
- break;
- case VERSION_2_8_BIT:
- sizeOfPalette = 256 * 3;
- break;
- case VERSION_2_24_BIT:
- sizeOfPalette = 0;
- break;
- }
- bitmapOffset = size + sizeOfPalette;
- }
- palette = new byte[sizeOfPalette];
- inputStream.read(palette, 0, sizeOfPalette);
- properties.put("palette", palette);
- } else {
-
- compression = readDWord(inputStream);
- imageSize = readDWord(inputStream);
- xPelsPerMeter = readLong(inputStream);
- yPelsPerMeter = readLong(inputStream);
- long colorsUsed = readDWord(inputStream);
- long colorsImportant = readDWord(inputStream);
-
- switch((int)compression) {
- case BI_RGB:
- properties.put("compression", "BI_RGB");
- break;
-
- case BI_RLE8:
- properties.put("compression", "BI_RLE8");
- break;
-
- case BI_RLE4:
- properties.put("compression", "BI_RLE4");
- break;
-
- case BI_BITFIELDS:
- properties.put("compression", "BI_BITFIELDS");
- break;
- }
-
- properties.put("x_pixels_per_meter", new Long(xPelsPerMeter));
- properties.put("y_pixels_per_meter", new Long(yPelsPerMeter));
- properties.put("colors_used", new Long(colorsUsed));
- properties.put("colors_important", new Long(colorsImportant));
-
- if (size == 40) {
- // Windows 3.x and Windows NT
- switch((int)compression) {
-
- case BI_RGB: // No compression
- case BI_RLE8: // 8-bit RLE compression
- case BI_RLE4: // 4-bit RLE compression
-
- if (bitsPerPixel == 1) {
- imageType = VERSION_3_1_BIT;
- } else if (bitsPerPixel == 4) {
- imageType = VERSION_3_4_BIT;
- } else if (bitsPerPixel == 8) {
- imageType = VERSION_3_8_BIT;
- } else if (bitsPerPixel == 24) {
- imageType = VERSION_3_24_BIT;
- } else if (bitsPerPixel == 16) {
- imageType = VERSION_3_NT_16_BIT;
- redMask = 0x7C00;
- greenMask = 0x3E0;
- blueMask = 0x1F;
- properties.put("red_mask", new Integer(redMask));
- properties.put("green_mask", new Integer(greenMask));
- properties.put("blue_mask", new Integer(blueMask));
- } else if (bitsPerPixel == 32) {
- imageType = VERSION_3_NT_32_BIT;
- redMask = 0x00FF0000;
- greenMask = 0x0000FF00;
- blueMask = 0x000000FF;
- properties.put("red_mask", new Integer(redMask));
- properties.put("green_mask", new Integer(greenMask));
- properties.put("blue_mask", new Integer(blueMask));
- }
-
- // Read in the palette
- int numberOfEntries = (int)((bitmapOffset-14-size) / 4);
- int sizeOfPalette = numberOfEntries*4;
- if (bitmapOffset == size) {
- switch (imageType) {
- case VERSION_3_1_BIT:
- sizeOfPalette = (int)(colorsUsed == 0 ? 2 : colorsUsed) * 4;
- break;
- case VERSION_3_4_BIT:
- sizeOfPalette = (int)(colorsUsed == 0 ? 16 : colorsUsed) * 4;
- break;
- case VERSION_3_8_BIT:
- sizeOfPalette = (int)(colorsUsed == 0 ? 256 : colorsUsed) * 4;
- break;
- default:
- sizeOfPalette = 0;
- break;
- }
- bitmapOffset = size + sizeOfPalette;
- }
- palette = new byte[sizeOfPalette];
- inputStream.read(palette, 0, sizeOfPalette);
- properties.put("palette", palette);
-
- properties.put("bmp_version", "BMP v. 3.x");
- break;
-
- case BI_BITFIELDS:
-
- if (bitsPerPixel == 16) {
- imageType = VERSION_3_NT_16_BIT;
- } else if (bitsPerPixel == 32) {
- imageType = VERSION_3_NT_32_BIT;
- }
-
- // BitsField encoding
- redMask = (int)readDWord(inputStream);
- greenMask = (int)readDWord(inputStream);
- blueMask = (int)readDWord(inputStream);
-
- properties.put("red_mask", new Integer(redMask));
- properties.put("green_mask", new Integer(greenMask));
- properties.put("blue_mask", new Integer(blueMask));
-
- if (colorsUsed != 0) {
- // there is a palette
- sizeOfPalette = (int)colorsUsed*4;
- palette = new byte[sizeOfPalette];
- inputStream.read(palette, 0, sizeOfPalette);
- properties.put("palette", palette);
- }
-
- properties.put("bmp_version", "BMP v. 3.x NT");
- break;
-
- default:
- throw new
- RuntimeException("Invalid compression specified in BMP file.");
- }
- } else if (size == 108) {
- // Windows 4.x BMP
-
- properties.put("bmp_version", "BMP v. 4.x");
-
- // rgb masks, valid only if comp is BI_BITFIELDS
- redMask = (int)readDWord(inputStream);
- greenMask = (int)readDWord(inputStream);
- blueMask = (int)readDWord(inputStream);
- // Only supported for 32bpp BI_RGB argb
- alphaMask = (int)readDWord(inputStream);
- long csType = readDWord(inputStream);
- int redX = readLong(inputStream);
- int redY = readLong(inputStream);
- int redZ = readLong(inputStream);
- int greenX = readLong(inputStream);
- int greenY = readLong(inputStream);
- int greenZ = readLong(inputStream);
- int blueX = readLong(inputStream);
- int blueY = readLong(inputStream);
- int blueZ = readLong(inputStream);
- long gammaRed = readDWord(inputStream);
- long gammaGreen = readDWord(inputStream);
- long gammaBlue = readDWord(inputStream);
-
- if (bitsPerPixel == 1) {
- imageType = VERSION_4_1_BIT;
- } else if (bitsPerPixel == 4) {
- imageType = VERSION_4_4_BIT;
- } else if (bitsPerPixel == 8) {
- imageType = VERSION_4_8_BIT;
- } else if (bitsPerPixel == 16) {
- imageType = VERSION_4_16_BIT;
- if ((int)compression == BI_RGB) {
- redMask = 0x7C00;
- greenMask = 0x3E0;
- blueMask = 0x1F;
- }
- } else if (bitsPerPixel == 24) {
- imageType = VERSION_4_24_BIT;
- } else if (bitsPerPixel == 32) {
- imageType = VERSION_4_32_BIT;
- if ((int)compression == BI_RGB) {
- redMask = 0x00FF0000;
- greenMask = 0x0000FF00;
- blueMask = 0x000000FF;
- }
- }
-
- properties.put("red_mask", new Integer(redMask));
- properties.put("green_mask", new Integer(greenMask));
- properties.put("blue_mask", new Integer(blueMask));
- properties.put("alpha_mask", new Integer(alphaMask));
-
- // Read in the palette
- int numberOfEntries = (int)((bitmapOffset-14-size) / 4);
- int sizeOfPalette = numberOfEntries*4;
- if (bitmapOffset == size) {
- switch (imageType) {
- case VERSION_4_1_BIT:
- sizeOfPalette = (int)(colorsUsed == 0 ? 2 : colorsUsed) * 4;
- break;
- case VERSION_4_4_BIT:
- sizeOfPalette = (int)(colorsUsed == 0 ? 16 : colorsUsed) * 4;
- break;
- case VERSION_4_8_BIT:
- sizeOfPalette = (int)(colorsUsed == 0 ? 256 : colorsUsed) * 4;
- break;
- default:
- sizeOfPalette = 0;
- break;
- }
- bitmapOffset = size + sizeOfPalette;
- }
- palette = new byte[sizeOfPalette];
- inputStream.read(palette, 0, sizeOfPalette);
-
- if (palette != null || palette.length != 0) {
- properties.put("palette", palette);
- }
-
- switch((int)csType) {
- case LCS_CALIBRATED_RGB:
- // All the new fields are valid only for this case
- properties.put("color_space", "LCS_CALIBRATED_RGB");
- properties.put("redX", new Integer(redX));
- properties.put("redY", new Integer(redY));
- properties.put("redZ", new Integer(redZ));
- properties.put("greenX", new Integer(greenX));
- properties.put("greenY", new Integer(greenY));
- properties.put("greenZ", new Integer(greenZ));
- properties.put("blueX", new Integer(blueX));
- properties.put("blueY", new Integer(blueY));
- properties.put("blueZ", new Integer(blueZ));
- properties.put("gamma_red", new Long(gammaRed));
- properties.put("gamma_green", new Long(gammaGreen));
- properties.put("gamma_blue", new Long(gammaBlue));
-
- // break;
- throw new
- RuntimeException("Not implemented yet.");
-
- case LCS_sRGB:
- // Default Windows color space
- properties.put("color_space", "LCS_sRGB");
- break;
-
- case LCS_CMYK:
- properties.put("color_space", "LCS_CMYK");
- // break;
- throw new
- RuntimeException("Not implemented yet.");
- }
-
- } else {
- properties.put("bmp_version", "BMP v. 5.x");
- throw new
- RuntimeException("BMP version 5 not implemented yet.");
- }
- }
-
- if (height > 0) {
- // bottom up image
- isBottomUp = true;
- } else {
- // top down image
- isBottomUp = false;
- height = Math.abs(height);
- }
- // When number of bitsPerPixel is <= 8, we use IndexColorModel.
- if (bitsPerPixel == 1 || bitsPerPixel == 4 || bitsPerPixel == 8) {
-
- numBands = 1;
-
-
- // Create IndexColorModel from the palette.
- byte r[], g[], b[];
- int sizep;
- if (imageType == VERSION_2_1_BIT ||
- imageType == VERSION_2_4_BIT ||
- imageType == VERSION_2_8_BIT) {
-
- sizep = palette.length/3;
-
- if (sizep > 256) {
- sizep = 256;
- }
-
- int off;
- r = new byte[sizep];
- g = new byte[sizep];
- b = new byte[sizep];
- for (int i=0; i<sizep; i++) {
- off = 3 * i;
- b[i] = palette[off];
- g[i] = palette[off+1];
- r[i] = palette[off+2];
- }
- } else {
- sizep = palette.length/4;
-
- if (sizep > 256) {
- sizep = 256;
- }
-
- int off;
- r = new byte[sizep];
- g = new byte[sizep];
- b = new byte[sizep];
- for (int i=0; i<sizep; i++) {
- off = 4 * i;
- b[i] = palette[off];
- g[i] = palette[off+1];
- r[i] = palette[off+2];
- }
- }
-
- } else if (bitsPerPixel == 16) {
- numBands = 3;
- } else if (bitsPerPixel == 32) {
- numBands = alphaMask == 0 ? 3 : 4;
-
- // The number of bands in the SampleModel is determined by
- // the length of the mask array passed in.
- int[] bitMasks = numBands == 3 ?
- new int[] {redMask, greenMask, blueMask} :
- new int[] {redMask, greenMask, blueMask, alphaMask};
-
- } else {
- numBands = 3;
- }
- }
-
- private byte[] getPalette(int group) {
- if (palette == null)
- return null;
- byte np[] = new byte[palette.length / group * 3];
- int e = palette.length / group;
- for (int k = 0; k < e; ++k) {
- int src = k * group;
- int dest = k * 3;
- np[dest + 2] = palette[src++];
- np[dest + 1] = palette[src++];
- np[dest] = palette[src];
- }
- return np;
- }
-
- private Image getImage() throws IOException, BadElementException {
- byte bdata[] = null; // buffer for byte data
- short sdata[] = null; // buffer for short data
- int idata[] = null; // buffer for int data
-
- // if (sampleModel.getDataType() == DataBuffer.TYPE_BYTE)
- // bdata = (byte[])((DataBufferByte)tile.getDataBuffer()).getData();
- // else if (sampleModel.getDataType() == DataBuffer.TYPE_USHORT)
- // sdata = (short[])((DataBufferUShort)tile.getDataBuffer()).getData();
- // else if (sampleModel.getDataType() == DataBuffer.TYPE_INT)
- // idata = (int[])((DataBufferInt)tile.getDataBuffer()).getData();
-
- // There should only be one tile.
- switch(imageType) {
-
- case VERSION_2_1_BIT:
- // no compression
- return read1Bit(3);
-
- case VERSION_2_4_BIT:
- // no compression
- return read4Bit(3);
-
- case VERSION_2_8_BIT:
- // no compression
- return read8Bit(3);
-
- case VERSION_2_24_BIT:
- // no compression
- bdata = new byte[width * height * 3];
- read24Bit(bdata);
- return new ImgRaw(width, height, 3, 8, bdata);
-
- case VERSION_3_1_BIT:
- // 1-bit images cannot be compressed.
- return read1Bit(4);
-
- case VERSION_3_4_BIT:
- switch((int)compression) {
- case BI_RGB:
- return read4Bit(4);
-
- case BI_RLE4:
- return readRLE4();
-
- default:
- throw new
- RuntimeException("Invalid compression specified for BMP file.");
- }
-
- case VERSION_3_8_BIT:
- switch((int)compression) {
- case BI_RGB:
- return read8Bit(4);
-
- case BI_RLE8:
- return readRLE8();
-
- default:
- throw new
- RuntimeException("Invalid compression specified for BMP file.");
- }
-
- case VERSION_3_24_BIT:
- // 24-bit images are not compressed
- bdata = new byte[width * height * 3];
- read24Bit(bdata);
- return new ImgRaw(width, height, 3, 8, bdata);
-
- case VERSION_3_NT_16_BIT:
- return read1632Bit(false);
-
- case VERSION_3_NT_32_BIT:
- return read1632Bit(true);
-
- case VERSION_4_1_BIT:
- return read1Bit(4);
-
- case VERSION_4_4_BIT:
- switch((int)compression) {
-
- case BI_RGB:
- return read4Bit(4);
-
- case BI_RLE4:
- return readRLE4();
-
- default:
- throw new
- RuntimeException("Invalid compression specified for BMP file.");
- }
-
- case VERSION_4_8_BIT:
- switch((int)compression) {
-
- case BI_RGB:
- return read8Bit(4);
-
- case BI_RLE8:
- return readRLE8();
-
- default:
- throw new
- RuntimeException("Invalid compression specified for BMP file.");
- }
-
- case VERSION_4_16_BIT:
- return read1632Bit(false);
-
- case VERSION_4_24_BIT:
- bdata = new byte[width * height * 3];
- read24Bit(bdata);
- return new ImgRaw(width, height, 3, 8, bdata);
-
- case VERSION_4_32_BIT:
- return read1632Bit(true);
- }
- return null;
- }
-
- private Image indexedModel(byte bdata[], int bpc, int paletteEntries) throws BadElementException {
- Image img = new ImgRaw(width, height, 1, bpc, bdata);
- PdfArray colorspace = new PdfArray();
- colorspace.add(PdfName.INDEXED);
- colorspace.add(PdfName.DEVICERGB);
- byte np[] = getPalette(paletteEntries);
- int len = np.length;
- colorspace.add(new PdfNumber(len / 3 - 1));
- colorspace.add(new PdfString(np));
- PdfDictionary ad = new PdfDictionary();
- ad.put(PdfName.COLORSPACE, colorspace);
- img.setAdditional(ad);
- return img;
- }
-
- // Deal with 1 Bit images using IndexColorModels
- private Image read1Bit(int paletteEntries) throws IOException, BadElementException {
- byte bdata[] = new byte[((width + 7) / 8) * height];
- int padding = 0;
- int bytesPerScanline = (int)Math.ceil((double)width/8.0);
-
- int remainder = bytesPerScanline % 4;
- if (remainder != 0) {
- padding = 4 - remainder;
- }
-
- int imSize = (bytesPerScanline + padding) * height;
-
- // Read till we have the whole image
- byte values[] = new byte[imSize];
- int bytesRead = 0;
- while (bytesRead < imSize) {
- bytesRead += inputStream.read(values, bytesRead,
- imSize - bytesRead);
- }
-
- if (isBottomUp) {
-
- // Convert the bottom up image to a top down format by copying
- // one scanline from the bottom to the top at a time.
-
- for (int i=0; i<height; i++) {
- System.arraycopy(values,
- imSize - (i+1)*(bytesPerScanline + padding),
- bdata,
- i*bytesPerScanline, bytesPerScanline);
- }
- } else {
-
- for (int i=0; i<height; i++) {
- System.arraycopy(values,
- i * (bytesPerScanline + padding),
- bdata,
- i * bytesPerScanline,
- bytesPerScanline);
- }
- }
- return indexedModel(bdata, 1, paletteEntries);
- }
-
- // Method to read a 4 bit BMP image data
- private Image read4Bit(int paletteEntries) throws IOException, BadElementException {
- byte bdata[] = new byte[((width + 1) / 2) * height];
-
- // Padding bytes at the end of each scanline
- int padding = 0;
-
- int bytesPerScanline = (int)Math.ceil((double)width/2.0);
- int remainder = bytesPerScanline % 4;
- if (remainder != 0) {
- padding = 4 - remainder;
- }
-
- int imSize = (bytesPerScanline + padding) * height;
-
- // Read till we have the whole image
- byte values[] = new byte[imSize];
- int bytesRead = 0;
- while (bytesRead < imSize) {
- bytesRead += inputStream.read(values, bytesRead,
- imSize - bytesRead);
- }
-
- if (isBottomUp) {
-
- // Convert the bottom up image to a top down format by copying
- // one scanline from the bottom to the top at a time.
- for (int i=0; i<height; i++) {
- System.arraycopy(values,
- imSize - (i+1)*(bytesPerScanline + padding),
- bdata,
- i*bytesPerScanline,
- bytesPerScanline);
- }
- } else {
- for (int i=0; i<height; i++) {
- System.arraycopy(values,
- i * (bytesPerScanline + padding),
- bdata,
- i * bytesPerScanline,
- bytesPerScanline);
- }
- }
- return indexedModel(bdata, 4, paletteEntries);
- }
-
- // Method to read 8 bit BMP image data
- private Image read8Bit(int paletteEntries) throws IOException, BadElementException {
- byte bdata[] = new byte[width * height];
- // Padding bytes at the end of each scanline
- int padding = 0;
-
- // width * bitsPerPixel should be divisible by 32
- int bitsPerScanline = width * 8;
- if ( bitsPerScanline%32 != 0) {
- padding = (bitsPerScanline/32 + 1)*32 - bitsPerScanline;
- padding = (int)Math.ceil(padding/8.0);
- }
-
- int imSize = (width + padding) * height;
-
- // Read till we have the whole image
- byte values[] = new byte[imSize];
- int bytesRead = 0;
- while (bytesRead < imSize) {
- bytesRead += inputStream.read(values, bytesRead, imSize - bytesRead);
- }
-
- if (isBottomUp) {
-
- // Convert the bottom up image to a top down format by copying
- // one scanline from the bottom to the top at a time.
- for (int i=0; i<height; i++) {
- System.arraycopy(values,
- imSize - (i+1) * (width + padding),
- bdata,
- i * width,
- width);
- }
- } else {
- for (int i=0; i<height; i++) {
- System.arraycopy(values,
- i * (width + padding),
- bdata,
- i * width,
- width);
- }
- }
- return indexedModel(bdata, 8, paletteEntries);
- }
-
- // Method to read 24 bit BMP image data
- private void read24Bit(byte[] bdata) {
- // Padding bytes at the end of each scanline
- int padding = 0;
-
- // width * bitsPerPixel should be divisible by 32
- int bitsPerScanline = width * 24;
- if ( bitsPerScanline%32 != 0) {
- padding = (bitsPerScanline/32 + 1)*32 - bitsPerScanline;
- padding = (int)Math.ceil(padding/8.0);
- }
-
-
- int imSize = ((width * 3 + 3) / 4 * 4) * height;
- // Read till we have the whole image
- byte values[] = new byte[imSize];
- try {
- int bytesRead = 0;
- while (bytesRead < imSize) {
- int r = inputStream.read(values, bytesRead,
- imSize - bytesRead);
- if (r < 0)
- break;
- bytesRead += r;
- }
- } catch (IOException ioe) {
- throw new ExceptionConverter(ioe);
- }
-
- int l=0, count;
-
- if (isBottomUp) {
- int max = width*height*3-1;
-
- count = -padding;
- for (int i=0; i<height; i++) {
- l = max - (i+1)*width*3 + 1;
- count += padding;
- for (int j=0; j<width; j++) {
- bdata[l + 2] = values[count++];
- bdata[l + 1] = values[count++];
- bdata[l] = values[count++];
- l += 3;
- }
- }
- } else {
- count = -padding;
- for (int i=0; i<height; i++) {
- count += padding;
- for (int j=0; j<width; j++) {
- bdata[l + 2] = values[count++];
- bdata[l + 1] = values[count++];
- bdata[l] = values[count++];
- l += 3;
- }
- }
- }
- }
-
- private int findMask(int mask) {
- int k = 0;
- for (; k < 32; ++k) {
- if ((mask & 1) == 1)
- break;
- mask >>>= 1;
- }
- return mask;
- }
-
- private int findShift(int mask) {
- int k = 0;
- for (; k < 32; ++k) {
- if ((mask & 1) == 1)
- break;
- mask >>>= 1;
- }
- return k;
- }
-
- private Image read1632Bit(boolean is32) throws IOException, BadElementException {
-
- int red_mask = findMask(redMask);
- int red_shift = findShift(redMask);
- int red_factor = red_mask + 1;
- int green_mask = findMask(greenMask);
- int green_shift = findShift(greenMask);
- int green_factor = green_mask + 1;
- int blue_mask = findMask(blueMask);
- int blue_shift = findShift(blueMask);
- int blue_factor = blue_mask + 1;
- byte bdata[] = new byte[width * height * 3];
- // Padding bytes at the end of each scanline
- int padding = 0;
-
- if (!is32) {
- // width * bitsPerPixel should be divisible by 32
- int bitsPerScanline = width * 16;
- if ( bitsPerScanline%32 != 0) {
- padding = (bitsPerScanline/32 + 1)*32 - bitsPerScanline;
- padding = (int)Math.ceil(padding/8.0);
- }
- }
-
- int imSize = (int)imageSize;
- if (imSize == 0) {
- imSize = (int)(bitmapFileSize - bitmapOffset);
- }
-
- int l=0;
- int v;
- if (isBottomUp) {
- int max = width*height-1;
-
- for (int i=height - 1; i >= 0; --i) {
- l = width * 3 * i;
- for (int j=0; j<width; j++) {
- if (is32)
- v = (int)readDWord(inputStream);
- else
- v = readWord(inputStream);
- bdata[l++] = (byte)(((v >>> red_shift) & red_mask) * 256 / red_factor);
- bdata[l++] = (byte)(((v >>> green_shift) & green_mask) * 256 / green_factor);
- bdata[l++] = (byte)(((v >>> blue_shift) & blue_mask) * 256 / blue_factor);
- }
- for (int m=0; m<padding; m++) {
- inputStream.read();
- }
- }
- } else {
- for (int i=0; i<height; i++) {
- for (int j=0; j<width; j++) {
- if (is32)
- v = (int)readDWord(inputStream);
- else
- v = readWord(inputStream);
- bdata[l++] = (byte)(((v >>> red_shift) & red_mask) * 256 / red_factor);
- bdata[l++] = (byte)(((v >>> green_shift) & green_mask) * 256 / green_factor);
- bdata[l++] = (byte)(((v >>> blue_shift) & blue_mask) * 256 / blue_factor);
- }
- for (int m=0; m<padding; m++) {
- inputStream.read();
- }
- }
- }
- return new ImgRaw(width, height, 3, 8, bdata);
- }
-
- private Image readRLE8() throws IOException, BadElementException {
-
- // If imageSize field is not provided, calculate it.
- int imSize = (int)imageSize;
- if (imSize == 0) {
- imSize = (int)(bitmapFileSize - bitmapOffset);
- }
-
- int padding = 0;
- // If width is not 32 bit aligned, then while uncompressing each
- // scanline will have padding bytes, calculate the amount of padding
- int remainder = width % 4;
- if (remainder != 0) {
- padding = 4 - remainder;
- }
-
- // Read till we have the whole image
- byte values[] = new byte[imSize];
- int bytesRead = 0;
- while (bytesRead < imSize) {
- bytesRead += inputStream.read(values, bytesRead,
- imSize - bytesRead);
- }
-
- // Since data is compressed, decompress it
- byte val[] = decodeRLE(true, values);
-
- // Uncompressed data does not have any padding
- imSize = width * height;
-
- if (isBottomUp) {
-
- // Convert the bottom up image to a top down format by copying
- // one scanline from the bottom to the top at a time.
- // int bytesPerScanline = (int)Math.ceil((double)width/8.0);
- byte temp[] = new byte[val.length];
- int bytesPerScanline = width;
- for (int i=0; i<height; i++) {
- System.arraycopy(val,
- imSize - (i+1)*(bytesPerScanline),
- temp,
- i*bytesPerScanline, bytesPerScanline);
- }
- val = temp;
- }
- return indexedModel(val, 8, 4);
- }
-
- private Image readRLE4() throws IOException, BadElementException {
-
- // If imageSize field is not specified, calculate it.
- int imSize = (int)imageSize;
- if (imSize == 0) {
- imSize = (int)(bitmapFileSize - bitmapOffset);
- }
-
- int padding = 0;
- // If width is not 32 byte aligned, then while uncompressing each
- // scanline will have padding bytes, calculate the amount of padding
- int remainder = width % 4;
- if (remainder != 0) {
- padding = 4 - remainder;
- }
-
- // Read till we have the whole image
- byte values[] = new byte[imSize];
- int bytesRead = 0;
- while (bytesRead < imSize) {
- bytesRead += inputStream.read(values, bytesRead,
- imSize - bytesRead);
- }
-
- // Decompress the RLE4 compressed data.
- byte val[] = decodeRLE(false, values);
-
- // Invert it as it is bottom up format.
- if (isBottomUp) {
-
- byte inverted[] = val;
- val = new byte[width * height];
- int l = 0, index, lineEnd;
-
- for (int i = height-1; i >= 0; i--) {
- index = i * width;
- lineEnd = l + width;
- while(l != lineEnd) {
- val[l++] = inverted[index++];
- }
- }
- }
- int stride = ((width + 1) / 2);
- byte bdata[] = new byte[stride * height];
- int ptr = 0;
- boolean flip = true;
- int sh = 0;
- for (int h = 0; h < height; ++h) {
- for (int w = 0; w < width; ++w) {
- if ((w & 1) == 0)
- bdata[sh + w / 2] = (byte)(val[ptr++] << 4);
- else
- bdata[sh + w / 2] |= (byte)(val[ptr++] & 0x0f);
- }
- sh += stride;
- }
- return indexedModel(bdata, 4, 4);
- }
-
- private byte[] decodeRLE(boolean is8, byte values[]) {
- byte val[] = new byte[width * height];
- try {
- int ptr = 0;
- int x = 0;
- int q = 0;
- for (int y = 0; y < height && ptr < values.length;) {
- int count = values[ptr++] & 0xff;
- if (count != 0) {
- // encoded mode
- int bt = values[ptr++] & 0xff;
- if (is8) {
- for (int i = count; i != 0; --i) {
- val[q++] = (byte)bt;
- }
- }
- else {
- for (int i = 0; i < count; ++i) {
- val[q++] = (byte)((i & 1) == 1 ? (bt & 0x0f) : ((bt >>> 4) & 0x0f));
- }
- }
- x += count;
- }
- else {
- // escape mode
- count = values[ptr++] & 0xff;
- if (count == 1)
- break;
- switch (count) {
- case 0:
- x = 0;
- ++y;
- q = y * width;
- break;
- case 2:
- // delta mode
- x += values[ptr++] & 0xff;
- y += values[ptr++] & 0xff;
- q = y * width + x;
- break;
- default:
- // absolute mode
- if (is8) {
- for (int i = count; i != 0; --i)
- val[q++] = (byte)(values[ptr++] & 0xff);
- }
- else {
- int bt = 0;
- for (int i = 0; i < count; ++i) {
- if ((i & 1) == 0)
- bt = values[ptr++] & 0xff;
- val[q++] = (byte)((i & 1) == 1 ? (bt & 0x0f) : ((bt >>> 4) & 0x0f));
- }
- }
- x += count;
- // read pad byte
- if (is8) {
- if ((count & 1) == 1)
- ++ptr;
- }
- else {
- if ((count & 3) == 1 || (count & 3) == 2)
- ++ptr;
- }
- break;
- }
- }
- }
- }
- catch (Exception e) {
- //empty on purpose
- }
-
- return val;
- }
-
- // Windows defined data type reading methods - everything is little endian
-
- // Unsigned 8 bits
- private int readUnsignedByte(InputStream stream) throws IOException {
- return (stream.read() & 0xff);
- }
-
- // Unsigned 2 bytes
- private int readUnsignedShort(InputStream stream) throws IOException {
- int b1 = readUnsignedByte(stream);
- int b2 = readUnsignedByte(stream);
- return ((b2 << 8) | b1) & 0xffff;
- }
-
- // Signed 16 bits
- private int readShort(InputStream stream) throws IOException {
- int b1 = readUnsignedByte(stream);
- int b2 = readUnsignedByte(stream);
- return (b2 << 8) | b1;
- }
-
- // Unsigned 16 bits
- private int readWord(InputStream stream) throws IOException {
- return readUnsignedShort(stream);
- }
-
- // Unsigned 4 bytes
- private long readUnsignedInt(InputStream stream) throws IOException {
- int b1 = readUnsignedByte(stream);
- int b2 = readUnsignedByte(stream);
- int b3 = readUnsignedByte(stream);
- int b4 = readUnsignedByte(stream);
- long l = (long)((b4 << 24) | (b3 << 16) | (b2 << 8) | b1);
- return l & 0xffffffff;
- }
-
- // Signed 4 bytes
- private int readInt(InputStream stream) throws IOException {
- int b1 = readUnsignedByte(stream);
- int b2 = readUnsignedByte(stream);
- int b3 = readUnsignedByte(stream);
- int b4 = readUnsignedByte(stream);
- return (b4 << 24) | (b3 << 16) | (b2 << 8) | b1;
- }
-
- // Unsigned 4 bytes
- private long readDWord(InputStream stream) throws IOException {
- return readUnsignedInt(stream);
- }
-
- // 32 bit signed value
- private int readLong(InputStream stream) throws IOException {
- return readInt(stream);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/CCITTG4Encoder.java b/LibrarySource/com/lowagie/text/pdf/codec/CCITTG4Encoder.java
deleted file mode 100644
index 9fe7b94..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/CCITTG4Encoder.java
+++ /dev/null
@@ -1,509 +0,0 @@
-/*
- * Copyright (c) 2001 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * -Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * -Redistribution in binary form must reproduct the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
- * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
- * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
- * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
- * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
- * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
- * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
- * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
- * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that Software is not designed,licensed or intended for use in
- * the design, construction, operation or maintenance of any nuclear facility.
- *
- * Modified by Paulo Soares for iText.
- */
-package com.lowagie.text.pdf.codec;
-import com.lowagie.text.pdf.*;
-
-public class CCITTG4Encoder {
-
- /**
- * The CCITT numerical definition of white.
- */
- private static final int WHITE = 0;
-
- /**
- * The CCITT numerical definition of black.
- */
- private static final int BLACK = 1;
-
- // --- Begin tables for CCITT compression ---
-
- private static byte[] byteTable = new byte[] {
- 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, // 0 to 15
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 16 to 31
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 32 to 47
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 48 to 63
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 to 79
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 80 to 95
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 to 111
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 112 to 127
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 128 to 143
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 144 to 159
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 160 to 175
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 176 to 191
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 192 to 207
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 208 to 223
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 224 to 239
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 240 to 255
- };
-
- /**
- * Terminating codes for black runs.
- */
- private static int[] termCodesBlack = new int[] {
- /* 0 0x0000 */ 0x0dc0000a, 0x40000003, 0xc0000002, 0x80000002,
- /* 4 0x0004 */ 0x60000003, 0x30000004, 0x20000004, 0x18000005,
- /* 8 0x0008 */ 0x14000006, 0x10000006, 0x08000007, 0x0a000007,
- /* 12 0x000c */ 0x0e000007, 0x04000008, 0x07000008, 0x0c000009,
- /* 16 0x0010 */ 0x05c0000a, 0x0600000a, 0x0200000a, 0x0ce0000b,
- /* 20 0x0014 */ 0x0d00000b, 0x0d80000b, 0x06e0000b, 0x0500000b,
- /* 24 0x0018 */ 0x02e0000b, 0x0300000b, 0x0ca0000c, 0x0cb0000c,
- /* 28 0x001c */ 0x0cc0000c, 0x0cd0000c, 0x0680000c, 0x0690000c,
- /* 32 0x0020 */ 0x06a0000c, 0x06b0000c, 0x0d20000c, 0x0d30000c,
- /* 36 0x0024 */ 0x0d40000c, 0x0d50000c, 0x0d60000c, 0x0d70000c,
- /* 40 0x0028 */ 0x06c0000c, 0x06d0000c, 0x0da0000c, 0x0db0000c,
- /* 44 0x002c */ 0x0540000c, 0x0550000c, 0x0560000c, 0x0570000c,
- /* 48 0x0030 */ 0x0640000c, 0x0650000c, 0x0520000c, 0x0530000c,
- /* 52 0x0034 */ 0x0240000c, 0x0370000c, 0x0380000c, 0x0270000c,
- /* 56 0x0038 */ 0x0280000c, 0x0580000c, 0x0590000c, 0x02b0000c,
- /* 60 0x003c */ 0x02c0000c, 0x05a0000c, 0x0660000c, 0x0670000c
- };
-
- /**
- * Terminating codes for white runs.
- */
- private static int[] termCodesWhite = new int[] {
- /* 0 0x0000 */ 0x35000008, 0x1c000006, 0x70000004, 0x80000004,
- /* 4 0x0004 */ 0xb0000004, 0xc0000004, 0xe0000004, 0xf0000004,
- /* 8 0x0008 */ 0x98000005, 0xa0000005, 0x38000005, 0x40000005,
- /* 12 0x000c */ 0x20000006, 0x0c000006, 0xd0000006, 0xd4000006,
- /* 16 0x0010 */ 0xa8000006, 0xac000006, 0x4e000007, 0x18000007,
- /* 20 0x0014 */ 0x10000007, 0x2e000007, 0x06000007, 0x08000007,
- /* 24 0x0018 */ 0x50000007, 0x56000007, 0x26000007, 0x48000007,
- /* 28 0x001c */ 0x30000007, 0x02000008, 0x03000008, 0x1a000008,
- /* 32 0x0020 */ 0x1b000008, 0x12000008, 0x13000008, 0x14000008,
- /* 36 0x0024 */ 0x15000008, 0x16000008, 0x17000008, 0x28000008,
- /* 40 0x0028 */ 0x29000008, 0x2a000008, 0x2b000008, 0x2c000008,
- /* 44 0x002c */ 0x2d000008, 0x04000008, 0x05000008, 0x0a000008,
- /* 48 0x0030 */ 0x0b000008, 0x52000008, 0x53000008, 0x54000008,
- /* 52 0x0034 */ 0x55000008, 0x24000008, 0x25000008, 0x58000008,
- /* 56 0x0038 */ 0x59000008, 0x5a000008, 0x5b000008, 0x4a000008,
- /* 60 0x003c */ 0x4b000008, 0x32000008, 0x33000008, 0x34000008
- };
-
- /**
- * Make-up codes for black runs.
- */
- private static int[] makeupCodesBlack = new int[] {
- /* 0 0x0000 */ 0x00000000, 0x03c0000a, 0x0c80000c, 0x0c90000c,
- /* 4 0x0004 */ 0x05b0000c, 0x0330000c, 0x0340000c, 0x0350000c,
- /* 8 0x0008 */ 0x0360000d, 0x0368000d, 0x0250000d, 0x0258000d,
- /* 12 0x000c */ 0x0260000d, 0x0268000d, 0x0390000d, 0x0398000d,
- /* 16 0x0010 */ 0x03a0000d, 0x03a8000d, 0x03b0000d, 0x03b8000d,
- /* 20 0x0014 */ 0x0290000d, 0x0298000d, 0x02a0000d, 0x02a8000d,
- /* 24 0x0018 */ 0x02d0000d, 0x02d8000d, 0x0320000d, 0x0328000d,
- /* 28 0x001c */ 0x0100000b, 0x0180000b, 0x01a0000b, 0x0120000c,
- /* 32 0x0020 */ 0x0130000c, 0x0140000c, 0x0150000c, 0x0160000c,
- /* 36 0x0024 */ 0x0170000c, 0x01c0000c, 0x01d0000c, 0x01e0000c,
- /* 40 0x0028 */ 0x01f0000c, 0x00000000, 0x00000000, 0x00000000,
- /* 44 0x002c */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- /* 48 0x0030 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- /* 52 0x0034 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- /* 56 0x0038 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000
- };
-
- /**
- * Make-up codes for white runs.
- */
- private static int[] makeupCodesWhite = new int[] {
- /* 0 0x0000 */ 0x00000000, 0xd8000005, 0x90000005, 0x5c000006,
- /* 4 0x0004 */ 0x6e000007, 0x36000008, 0x37000008, 0x64000008,
- /* 8 0x0008 */ 0x65000008, 0x68000008, 0x67000008, 0x66000009,
- /* 12 0x000c */ 0x66800009, 0x69000009, 0x69800009, 0x6a000009,
- /* 16 0x0010 */ 0x6a800009, 0x6b000009, 0x6b800009, 0x6c000009,
- /* 20 0x0014 */ 0x6c800009, 0x6d000009, 0x6d800009, 0x4c000009,
- /* 24 0x0018 */ 0x4c800009, 0x4d000009, 0x60000006, 0x4d800009,
- /* 28 0x001c */ 0x0100000b, 0x0180000b, 0x01a0000b, 0x0120000c,
- /* 32 0x0020 */ 0x0130000c, 0x0140000c, 0x0150000c, 0x0160000c,
- /* 36 0x0024 */ 0x0170000c, 0x01c0000c, 0x01d0000c, 0x01e0000c,
- /* 40 0x0028 */ 0x01f0000c, 0x00000000, 0x00000000, 0x00000000,
- /* 44 0x002c */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- /* 48 0x0030 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- /* 52 0x0034 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- /* 56 0x0038 */ 0x00000000, 0x00000000, 0x00000000, 0x00000000
- };
-
- /**
- * Pass mode table.
- */
- private static int[] passMode = new int[] {
- 0x10000004 // 0001
- };
-
- /**
- * Vertical mode table.
- */
- private static int[] vertMode = new int[] {
- 0x06000007, // 0000011
- 0x0c000006, // 000011
- 0x60000003, // 011
- 0x80000001, // 1
- 0x40000003, // 010
- 0x08000006, // 000010
- 0x04000007 // 0000010
- };
-
- /**
- * Horizontal mode table.
- */
- private static int[] horzMode = new int[] {
- 0x20000003 // 001
- };
-
- /**
- * Black and white terminating code table.
- */
- private static int[][] termCodes =
- new int[][] {termCodesWhite, termCodesBlack};
-
- /**
- * Black and white make-up code table.
- */
- private static int[][] makeupCodes =
- new int[][] {makeupCodesWhite, makeupCodesBlack};
-
- /**
- * Black and white pass mode table.
- */
- private static int[][] pass = new int[][] {passMode, passMode};
-
- /**
- * Black and white vertical mode table.
- */
- private static int[][] vert = new int[][] {vertMode, vertMode};
-
- /**
- * Black and white horizontal mode table.
- */
- private static int[][] horz = new int[][] {horzMode, horzMode};
-
- // --- End tables for CCITT compression ---
-
- /**
- * Output bit buffer.
- */
- private int bits;
-
- /**
- * Number of bits in the output bit buffer.
- */
- private int ndex;
- private ByteBuffer outBuf = new ByteBuffer(1024);
- private int width;
- private int lineStride;
- byte[] refData = null;
-
- /**
- * Constructs a <code>TIFFFaxEncoder</code> for CCITT bilevel encoding.
- */
- public CCITTG4Encoder(int width) {
- this.width = width;
- lineStride = (width + 7) / 8;
- initBitBuf();
- }
-
- public static byte[] compress(byte[] data, int width, int height) {
- CCITTG4Encoder g4 = new CCITTG4Encoder(width);
- int yPos = 0;
- while (height-- != 0) {
- g4.encodeT6Line(data, yPos);
- yPos += g4.lineStride;
- }
- return g4.close();
- }
-
- public void encodeT6Lines(byte data[], int lineAddr, int height) {
- int yPos = lineAddr;
- while (height-- != 0) {
- encodeT6Line(data, yPos);
- yPos += lineStride;
- }
- }
- /**
- * Return min of <code>maxOffset</code> or offset of first pixel
- * different from pixel at <code>bitOffset</code>.
- */
- private int nextState(byte[] data,
- int base,
- int bitOffset,
- int maxOffset) {
- if(data == null) {
- return maxOffset;
- }
-
- int next = base + (bitOffset>>>3);
- int end = base + (maxOffset>>>3);
- if(end == data.length) { // Prevents out of bounds exception below
- end--;
- }
- if (next == data.length) // and so does this
- --next;
- int extra = bitOffset & 0x7;
-
- int testbyte;
- if((data[next] & (0x80 >>> extra)) != 0) { // look for "0"
- testbyte = ~(data[next]) & (0xff >>> extra);
- while (next < end) {
- if (testbyte != 0) {
- break;
- }
- testbyte = ~(data[++next]) & 0xff;
- }
- } else { // look for "1"
- if ((testbyte = (data[next] & (0xff >>> extra))) != 0) {
- bitOffset = (next-base)*8 + byteTable[testbyte];
- return ((bitOffset < maxOffset) ? bitOffset : maxOffset);
- }
- while (next < end) {
- if ((testbyte = data[++next]&0xff) != 0) {
- // "1" is in current byte
- bitOffset = (next-base)*8 + byteTable[testbyte];
- return ((bitOffset < maxOffset) ? bitOffset : maxOffset);
- }
- }
- }
- bitOffset = (next-base)*8 + byteTable[testbyte];
- return ((bitOffset < maxOffset) ? bitOffset : maxOffset);
- }
-
- /**
- * Initialize bit buffer machinery.
- */
- private void initBitBuf() {
- ndex = 0;
- bits = 0x00000000;
- }
-
- /**
- * Get code for run and add to compressed bitstream.
- */
- private void add1DBits(
- int count, // #pixels in run
- int color) // color of run
- {
- int sixtyfours;
- int mask;
-
- if (count < 0)
- return;
- sixtyfours = count >>> 6; // count / 64;
- count = count & 0x3f; // count % 64
- if (sixtyfours != 0) {
- for ( ; sixtyfours > 40; sixtyfours -= 40) {
- mask = makeupCodes[color][40];
- bits |= (mask & 0xfff80000) >>> ndex;
- ndex += (int)(mask & 0x0000ffff);
- while (ndex > 7) {
- outBuf.append((byte)(bits >>> 24));
- bits <<= 8;
- ndex -= 8;
- }
- }
-
- mask = makeupCodes[color][sixtyfours];
- bits |= (mask & 0xfff80000) >>> ndex;
- ndex += (int)(mask & 0x0000ffff);
- while (ndex > 7) {
- outBuf.append((byte)(bits >>> 24));
- bits <<= 8;
- ndex -= 8;
- }
- }
-
- mask = termCodes[color][count];
- bits |= (mask & 0xfff80000) >>> ndex;
- ndex += (int)(mask & 0x0000ffff);
- while (ndex > 7) {
- outBuf.append((byte)(bits >>> 24));
- bits <<= 8;
- ndex -= 8;
- }
- }
-
- /**
- * Place entry from mode table into compressed bitstream.
- */
- private void add2DBits(
- int[][] mode, // 2-D mode to be encoded
- int entry) // mode entry (0 unless vertical)
- {
- int mask;
- int color = 0;
-
- mask = mode[color][entry];
- bits |= (mask & 0xfff80000) >>> ndex;
- ndex += (int)(mask & 0x0000ffff);
- while (ndex > 7) {
- outBuf.append((byte)(bits >>> 24));
- bits <<= 8;
- ndex -= 8;
- }
- }
-
- /**
- * Add an End-of-Line (EOL == 0x001) to the compressed bitstream
- * with optional byte alignment.
- */
- private void addEOL(boolean is1DMode,// 1D encoding
- boolean addFill, // byte aligned EOLs
- boolean add1 // add1 ? EOL+1 : EOL+0
- )
- {
-
- //
- // Add zero-valued fill bits such that the EOL is aligned as
- //
- // xxxx 0000 0000 0001
- //
- if(addFill) {
- //
- // Simply increment the bit count. No need to feed bits into
- // the output buffer at this point as there are at most 7 bits
- // in the bit buffer, at most 7 are added here, and at most
- // 13 below making the total 7+7+13 = 27 before the bit feed
- // at the end of this routine.
- //
- ndex += ((ndex <= 4) ? 4 - ndex : 12 - ndex);
- }
-
- //
- // Write EOL into buffer
- //
- if(is1DMode) {
- bits |= 0x00100000 >>> ndex;
- ndex += 12;
- } else {
- bits |= (add1 ? 0x00180000 : 0x00100000) >>> ndex;
- ndex += 13;
- }
-
- while (ndex > 7) {
- outBuf.append((byte)(bits >>> 24));
- bits <<= 8;
- ndex -= 8;
- }
- }
-
- /**
- * Add an End-of-Facsimile-Block (EOFB == 0x001001) to the compressed
- * bitstream.
- */
- private void addEOFB()
- {
- //
- // eofb code
- //
- bits |= 0x00100100 >>> ndex;
-
- //
- // eofb code length
- //
- ndex += 24;
-
- //
- // flush all pending bits
- //
- while(ndex > 0) {
- outBuf.append((byte)(bits >>> 24));
- bits <<= 8;
- ndex -= 8;
- }
- }
-
- public void encodeT6Line(byte data[], int lineAddr) {
- int a0 = 0;
- int last = a0 + width;
-
- int testbit =
- ((data[lineAddr + (a0>>>3)]&0xff) >>>
- (7-(a0 & 0x7))) & 0x1;
- int a1 = testbit != 0 ?
- a0 : nextState(data, lineAddr, a0, last);
-
- testbit = refData == null ?
- 0: ((refData[(a0>>>3)]&0xff) >>>
- (7-(a0 & 0x7))) & 0x1;
- int b1 = testbit != 0 ?
- a0 : nextState(refData, 0, a0, last);
-
- //
- // The current color is set to WHITE at line start
- //
- int color = WHITE;
-
- while(true) {
- int b2 = nextState(refData, 0, b1, last);
- if(b2 < a1) { // pass mode
- add2DBits(pass, 0);
- a0 = b2;
- } else {
- int tmp = b1 - a1 + 3;
- if((tmp <= 6) && (tmp >= 0)) { // vertical mode
- add2DBits(vert, tmp);
- a0 = a1;
- } else { // horizontal mode
- int a2 = nextState(data, lineAddr, a1, last);
- add2DBits(horz, 0);
- add1DBits(a1-a0, color);
- add1DBits(a2-a1, color^1);
- if (a2 <= a0)
- throw new RuntimeException("G4 encoding error.");
- a0 = a2;
- }
- }
- if(a0 >= last) {
- break;
- }
- color = ((data[lineAddr + (a0>>>3)]&0xff) >>>
- (7-(a0 & 0x7))) & 0x1;
- a1 = nextState(data, lineAddr, a0, last);
- b1 = nextState(refData, 0, a0, last);
- testbit = refData == null ?
- 0: ((refData[(b1>>>3)]&0xff) >>>
- (7-(b1 & 0x7))) & 0x1;
- if(testbit == color) {
- b1 = nextState(refData, 0, b1, last);
- }
- }
-
- if (refData == null)
- refData = new byte[lineStride + 1];
- System.arraycopy(data, lineAddr, refData, 0, lineStride);
- }
-
- public byte[] close() {
- addEOFB();
- return outBuf.toByteArray();
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/GifImage.java b/LibrarySource/com/lowagie/text/pdf/codec/GifImage.java
deleted file mode 100644
index 0981417..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/GifImage.java
+++ /dev/null
@@ -1,592 +0,0 @@
-/*
- * Copyright 2003 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf.codec;
-
-import com.lowagie.text.pdf.*;
-import com.lowagie.text.*;
-import java.io.*;
-import java.net.URL;
-import java.util.ArrayList;
-
-/** Reads gif images of all types. All the images in a gif are read in the constructors
- * and can be retrieved with other methods.
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class GifImage {
-
- protected DataInputStream in;
- protected int width; // full image width
- protected int height; // full image height
- protected boolean gctFlag; // global color table used
-
- protected int bgIndex; // background color index
- protected int bgColor; // background color
- protected int pixelAspect; // pixel aspect ratio
-
- protected boolean lctFlag; // local color table flag
- protected boolean interlace; // interlace flag
- protected int lctSize; // local color table size
-
- protected int ix, iy, iw, ih; // current image rectangle
-
- protected byte[] block = new byte[256]; // current data block
- protected int blockSize = 0; // block size
-
- // last graphic control extension info
- protected int dispose = 0; // 0=no action; 1=leave in place; 2=restore to bg; 3=restore to prev
- protected boolean transparency = false; // use transparent color
- protected int delay = 0; // delay in milliseconds
- protected int transIndex; // transparent color index
-
- protected static final int MaxStackSize = 4096; // max decoder pixel stack size
-
- // LZW decoder working arrays
- protected short[] prefix;
- protected byte[] suffix;
- protected byte[] pixelStack;
- protected byte[] pixels;
-
- protected byte m_out[];
- protected int m_bpc;
- protected int m_gbpc;
- protected byte m_global_table[];
- protected byte m_local_table[];
- protected byte m_curr_table[];
- protected int m_line_stride;
- protected byte fromData[];
- protected URL fromUrl;
-
-
- protected ArrayList frames = new ArrayList(); // frames read from current file
-
- /** Reads gif images from an URL.
- * @param url the URL
- * @throws IOException on error
- */
- public GifImage(URL url) throws IOException {
- fromUrl = url;
- InputStream is = null;
- try {
- is = url.openStream();
- process(is);
- }
- finally {
- if (is != null) {
- is.close();
- }
- }
- }
-
- /** Reads gif images from a file.
- * @param file the file
- * @throws IOException on error
- */
- public GifImage(String file) throws IOException {
- this(Image.toURL(file));
- }
-
- /** Reads gif images from a byte array.
- * @param data the byte array
- * @throws IOException on error
- */
- public GifImage(byte data[]) throws IOException {
- fromData = data;
- InputStream is = null;
- try {
- is = new ByteArrayInputStream(data);
- process(is);
- }
- finally {
- if (is != null) {
- is.close();
- }
- }
- }
-
- /** Reads gif images from a stream. The stream is not closed.
- * @param is the stream
- * @throws IOException on error
- */
- public GifImage(InputStream is) throws IOException {
- process(is);
- }
-
- /** Gets the number of frames the gif has.
- * @return the number of frames the gif has
- */
- public int getFrameCount() {
- return frames.size();
- }
-
- /** Gets the image from a frame. The first frame is 1.
- * @param frame the frame to get the image from
- * @return the image
- */
- public Image getImage(int frame) {
- GifFrame gf = (GifFrame)frames.get(frame - 1);
- return gf.image;
- }
-
- /** Gets the [x,y] position of the frame in reference to the
- * logical screen.
- * @param frame the frame
- * @return the [x,y] position of the frame
- */
- public int[] getFramePosition(int frame) {
- GifFrame gf = (GifFrame)frames.get(frame - 1);
- return new int[]{gf.ix, gf.iy};
-
- }
-
- /** Gets the logical screen. The images may be smaller and placed
- * in some position in this screen to playback some animation.
- * No image will be be bigger that this.
- * @return the logical screen dimensions as [x,y]
- */
- public int[] getLogicalScreen() {
- return new int[]{width, height};
- }
-
- void process(InputStream is) throws IOException {
- in = new DataInputStream(new BufferedInputStream(is));
- readHeader();
- readContents();
- if (frames.size() == 0)
- throw new IOException("The file does not contain any valid image.");
- }
-
- /**
- * Reads GIF file header information.
- */
- protected void readHeader() throws IOException {
- String id = "";
- for (int i = 0; i < 6; i++)
- id += (char)in.read();
- if (!id.startsWith("GIF8")) {
- throw new IOException("Gif signature nor found.");
- }
-
- readLSD();
- if (gctFlag) {
- m_global_table = readColorTable(m_gbpc);
- }
- }
-
- /**
- * Reads Logical Screen Descriptor
- */
- protected void readLSD() throws IOException {
-
- // logical screen size
- width = readShort();
- height = readShort();
-
- // packed fields
- int packed = in.read();
- gctFlag = (packed & 0x80) != 0; // 1 : global color table flag
- m_gbpc = (packed & 7) + 1;
- bgIndex = in.read(); // background color index
- pixelAspect = in.read(); // pixel aspect ratio
- }
-
- /**
- * Reads next 16-bit value, LSB first
- */
- protected int readShort() throws IOException {
- // read 16-bit value, LSB first
- return in.read() | (in.read() << 8);
- }
-
- /**
- * Reads next variable length block from input.
- *
- * @return number of bytes stored in "buffer"
- */
- protected int readBlock() throws IOException {
- blockSize = in.read();
- if (blockSize <= 0)
- return blockSize = 0;
- for (int k = 0; k < blockSize; ++k) {
- int v = in.read();
- if (v < 0) {
- return blockSize = k;
- }
- block[k] = (byte)v;
- }
- return blockSize;
- }
-
- protected byte[] readColorTable(int bpc) throws IOException {
- int ncolors = 1 << bpc;
- int nbytes = 3*ncolors;
- bpc = newBpc(bpc);
- byte table[] = new byte[(1 << bpc) * 3];
- in.readFully(table, 0, nbytes);
- return table;
- }
-
-
- static protected int newBpc(int bpc) {
- switch (bpc) {
- case 1:
- case 2:
- case 4:
- break;
- case 3:
- return 4;
- default:
- return 8;
- }
- return bpc;
- }
-
- protected void readContents() throws IOException {
- // read GIF file content blocks
- boolean done = false;
- while (!done) {
- int code = in.read();
- switch (code) {
-
- case 0x2C: // image separator
- readImage();
- break;
-
- case 0x21: // extension
- code = in.read();
- switch (code) {
-
- case 0xf9: // graphics control extension
- readGraphicControlExt();
- break;
-
- case 0xff: // application extension
- readBlock();
- skip(); // don't care
- break;
-
- default: // uninteresting extension
- skip();
- }
- break;
-
- default:
- done = true;
- break;
- }
- }
- }
-
- /**
- * Reads next frame image
- */
- protected void readImage() throws IOException {
- ix = readShort(); // (sub)image position & size
- iy = readShort();
- iw = readShort();
- ih = readShort();
-
- int packed = in.read();
- lctFlag = (packed & 0x80) != 0; // 1 - local color table flag
- interlace = (packed & 0x40) != 0; // 2 - interlace flag
- // 3 - sort flag
- // 4-5 - reserved
- lctSize = 2 << (packed & 7); // 6-8 - local color table size
- m_bpc = newBpc(m_gbpc);
- if (lctFlag) {
- m_curr_table = readColorTable((packed & 7) + 1); // read table
- m_bpc = newBpc((packed & 7) + 1);
- }
- else {
- m_curr_table = m_global_table;
- }
- if (transparency && transIndex >= m_curr_table.length / 3)
- transparency = false;
- if (transparency && m_bpc == 1) { // Acrobat 5.05 doesn't like this combination
- byte tp[] = new byte[12];
- System.arraycopy(m_curr_table, 0, tp, 0, 6);
- m_curr_table = tp;
- m_bpc = 2;
- }
- boolean skipZero = decodeImageData(); // decode pixel data
- if (!skipZero)
- skip();
-
- Image img = null;
- try {
- img = new ImgRaw(iw, ih, 1, m_bpc, m_out);
- PdfArray colorspace = new PdfArray();
- colorspace.add(PdfName.INDEXED);
- colorspace.add(PdfName.DEVICERGB);
- int len = m_curr_table.length;
- colorspace.add(new PdfNumber(len / 3 - 1));
- colorspace.add(new PdfString(m_curr_table));
- PdfDictionary ad = new PdfDictionary();
- ad.put(PdfName.COLORSPACE, colorspace);
- img.setAdditional(ad);
- if (transparency) {
- img.setTransparency(new int[]{transIndex, transIndex});
- }
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- img.setOriginalType(Image.ORIGINAL_GIF);
- img.setOriginalData(fromData);
- img.setUrl(fromUrl);
- GifFrame gf = new GifFrame();
- gf.image = img;
- gf.ix = ix;
- gf.iy = iy;
- frames.add(gf); // add image to frame list
-
- resetFrame();
-
- }
-
- protected boolean decodeImageData() throws IOException {
- int NullCode = -1;
- int npix = iw * ih;
- int available, clear, code_mask, code_size, end_of_information, in_code, old_code,
- bits, code, count, i, datum, data_size, first, top, bi, pi;
- boolean skipZero = false;
-
- if (prefix == null)
- prefix = new short[MaxStackSize];
- if (suffix == null)
- suffix = new byte[MaxStackSize];
- if (pixelStack == null)
- pixelStack = new byte[MaxStackSize+1];
-
- m_line_stride = (iw * m_bpc + 7) / 8;
- m_out = new byte[m_line_stride * ih];
- int pass = 1;
- int inc = interlace ? 8 : 1;
- int line = 0;
- int xpos = 0;
-
- // Initialize GIF data stream decoder.
-
- data_size = in.read();
- clear = 1 << data_size;
- end_of_information = clear + 1;
- available = clear + 2;
- old_code = NullCode;
- code_size = data_size + 1;
- code_mask = (1 << code_size) - 1;
- for (code = 0; code < clear; code++) {
- prefix[code] = 0;
- suffix[code] = (byte) code;
- }
-
- // Decode GIF pixel stream.
-
- datum = bits = count = first = top = pi = bi = 0;
-
- for (i = 0; i < npix; ) {
- if (top == 0) {
- if (bits < code_size) {
- // Load bytes until there are enough bits for a code.
- if (count == 0) {
- // Read a new data block.
- count = readBlock();
- if (count <= 0) {
- skipZero = true;
- break;
- }
- bi = 0;
- }
- datum += (((int) block[bi]) & 0xff) << bits;
- bits += 8;
- bi++;
- count--;
- continue;
- }
-
- // Get the next code.
-
- code = datum & code_mask;
- datum >>= code_size;
- bits -= code_size;
-
- // Interpret the code
-
- if ((code > available) || (code == end_of_information))
- break;
- if (code == clear) {
- // Reset decoder.
- code_size = data_size + 1;
- code_mask = (1 << code_size) - 1;
- available = clear + 2;
- old_code = NullCode;
- continue;
- }
- if (old_code == NullCode) {
- pixelStack[top++] = suffix[code];
- old_code = code;
- first = code;
- continue;
- }
- in_code = code;
- if (code == available) {
- pixelStack[top++] = (byte) first;
- code = old_code;
- }
- while (code > clear) {
- pixelStack[top++] = suffix[code];
- code = prefix[code];
- }
- first = ((int) suffix[code]) & 0xff;
-
- // Add a new string to the string table,
-
- if (available >= MaxStackSize)
- break;
- pixelStack[top++] = (byte) first;
- prefix[available] = (short) old_code;
- suffix[available] = (byte) first;
- available++;
- if (((available & code_mask) == 0) && (available < MaxStackSize)) {
- code_size++;
- code_mask += available;
- }
- old_code = in_code;
- }
-
- // Pop a pixel off the pixel stack.
-
- top--;
- i++;
-
- setPixel(xpos, line, pixelStack[top]);
- ++xpos;
- if (xpos >= iw) {
- xpos = 0;
- line += inc;
- if (line >= ih) {
- if (interlace) {
- do {
- pass++;
- switch (pass) {
- case 2:
- line = 4;
- break;
- case 3:
- line = 2;
- inc = 4;
- break;
- case 4:
- line = 1;
- inc = 2;
- break;
- default: // this shouldn't happen
- line = ih - 1;
- inc = 0;
- }
- } while (line >= ih);
- }
- else {
- line = ih - 1; // this shouldn't happen
- inc = 0;
- }
- }
- }
- }
- return skipZero;
- }
-
-
- protected void setPixel(int x, int y, int v) {
- if (m_bpc == 8) {
- int pos = x + iw * y;
- m_out[pos] = (byte)v;
- }
- else {
- int pos = m_line_stride * y + x / (8 / m_bpc);
- int vout = v << (8 - m_bpc * (x % (8 / m_bpc))- m_bpc);
- m_out[pos] |= vout;
- }
- }
-
- /**
- * Resets frame state for reading next image.
- */
- protected void resetFrame() {
- boolean transparency = false;
- int delay = 0;
- }
-
- /**
- * Reads Graphics Control Extension values
- */
- protected void readGraphicControlExt() throws IOException {
- in.read(); // block size
- int packed = in.read(); // packed fields
- dispose = (packed & 0x1c) >> 2; // disposal method
- if (dispose == 0)
- dispose = 1; // elect to keep old image if discretionary
- transparency = (packed & 1) != 0;
- delay = readShort() * 10; // delay in milliseconds
- transIndex = in.read(); // transparent color index
- in.read(); // block terminator
- }
-
- /**
- * Skips variable length blocks up to and including
- * next zero length block.
- */
- protected void skip() throws IOException {
- do {
- readBlock();
- } while (blockSize > 0);
- }
-
- static class GifFrame {
- Image image;
- int ix;
- int iy;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/PngImage.java b/LibrarySource/com/lowagie/text/pdf/codec/PngImage.java
deleted file mode 100644
index 95b1a4d..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/PngImage.java
+++ /dev/null
@@ -1,989 +0,0 @@
-/*
- * Copyright 2003 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- *
- *
- * The original JAI codecs have the following license
- *
- * Copyright (c) 2001 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * -Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * -Redistribution in binary form must reproduct the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
- * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
- * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
- * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
- * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
- * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
- * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
- * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
- * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that Software is not designed,licensed or intended for use in
- * the design, construction, operation or maintenance of any nuclear facility.
- */
-
-package com.lowagie.text.pdf.codec;
-
-import headless.awt.color.ICC_Profile;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.zip.Inflater;
-import java.util.zip.InflaterInputStream;
-
-import com.lowagie.text.ExceptionConverter;
-import com.lowagie.text.Image;
-import com.lowagie.text.ImgRaw;
-import com.lowagie.text.pdf.ByteBuffer;
-import com.lowagie.text.pdf.PdfArray;
-import com.lowagie.text.pdf.PdfDictionary;
-import com.lowagie.text.pdf.PdfLiteral;
-import com.lowagie.text.pdf.PdfName;
-import com.lowagie.text.pdf.PdfNumber;
-import com.lowagie.text.pdf.PdfObject;
-import com.lowagie.text.pdf.PdfReader;
-import com.lowagie.text.pdf.PdfString;
-
-/** Reads a PNG image. All types of PNG can be read.
- * <p>
- * It is based in part in the JAI codec.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class PngImage {
-/** Some PNG specific values. */
- public static final int[] PNGID = {137, 80, 78, 71, 13, 10, 26, 10};
-
-/** A PNG marker. */
- public static final String IHDR = "IHDR";
-
-/** A PNG marker. */
- public static final String PLTE = "PLTE";
-
-/** A PNG marker. */
- public static final String IDAT = "IDAT";
-
-/** A PNG marker. */
- public static final String IEND = "IEND";
-
-/** A PNG marker. */
- public static final String tRNS = "tRNS";
-
-/** A PNG marker. */
- public static final String pHYs = "pHYs";
-
-/** A PNG marker. */
- public static final String gAMA = "gAMA";
-
-/** A PNG marker. */
- public static final String cHRM = "cHRM";
-
-/** A PNG marker. */
- public static final String sRGB = "sRGB";
-
-/** A PNG marker. */
- public static final String iCCP = "iCCP";
-
- private static final int TRANSFERSIZE = 4096;
- private static final int PNG_FILTER_NONE = 0;
- private static final int PNG_FILTER_SUB = 1;
- private static final int PNG_FILTER_UP = 2;
- private static final int PNG_FILTER_AVERAGE = 3;
- private static final int PNG_FILTER_PAETH = 4;
- private static final PdfName intents[] = {PdfName.PERCEPTUAL,
- PdfName.RELATIVECALORIMETRIC,PdfName.SATURATION,PdfName.ABSOLUTECALORIMETRIC};
-
- InputStream is;
- DataInputStream dataStream;
- int width;
- int height;
- int bitDepth;
- int colorType;
- int compressionMethod;
- int filterMethod;
- int interlaceMethod;
- PdfDictionary additional = new PdfDictionary();
- byte image[];
- byte smask[];
- byte trans[];
- NewByteArrayOutputStream idat = new NewByteArrayOutputStream();
- int dpiX;
- int dpiY;
- float XYRatio;
- boolean genBWMask;
- boolean palShades;
- int transRedGray = -1;
- int transGreen = -1;
- int transBlue = -1;
- int inputBands;
- int bytesPerPixel; // number of bytes per input pixel
- byte colorTable[];
- float gamma = 1f;
- boolean hasCHRM = false;
- float xW, yW, xR, yR, xG, yG, xB, yB;
- PdfName intent;
- ICC_Profile icc_profile;
-
-
-
- /** Creates a new instance of PngImage */
- PngImage(InputStream is) {
- this.is = is;
- }
-
- /** Reads a PNG from an url.
- * @param url the url
- * @throws IOException on error
- * @return the image
- */
- public static Image getImage(URL url) throws IOException {
- InputStream is = null;
- try {
- is = url.openStream();
- Image img = getImage(is);
- img.setUrl(url);
- return img;
- }
- finally {
- if (is != null) {
- is.close();
- }
- }
- }
-
- /** Reads a PNG from a stream.
- * @param is the stream
- * @throws IOException on error
- * @return the image
- */
- public static Image getImage(InputStream is) throws IOException {
- PngImage png = new PngImage(is);
- return png.getImage();
- }
-
- /** Reads a PNG from a file.
- * @param file the file
- * @throws IOException on error
- * @return the image
- */
- public static Image getImage(String file) throws IOException {
- return getImage(Image.toURL(file));
- }
-
- /** Reads a PNG from a byte array.
- * @param data the byte array
- * @throws IOException on error
- * @return the image
- */
- public static Image getImage(byte data[]) throws IOException {
- InputStream is = null;
- try {
- is = new ByteArrayInputStream(data);
- Image img = getImage(is);
- img.setOriginalData(data);
- return img;
- }
- finally {
- if (is != null) {
- is.close();
- }
- }
- }
-
- boolean checkMarker(String s) {
- if (s.length() != 4)
- return false;
- for (int k = 0; k < 4; ++k) {
- char c = s.charAt(k);
- if ((c < 'a' || c > 'z') && (c < 'A' || c > 'Z'))
- return false;
- }
- return true;
- }
-
- void readPng() throws IOException {
- for (int i = 0; i < PNGID.length; i++) {
- if (PNGID[i] != is.read()) {
- throw new IOException("File is not a valid PNG.");
- }
- }
- byte buffer[] = new byte[TRANSFERSIZE];
- while (true) {
- int len = getInt(is);
- String marker = getString(is);
- if (len < 0 || !checkMarker(marker))
- throw new IOException("Corrupted PNG file.");
- if (IDAT.equals(marker)) {
- int size;
- while (len != 0) {
- size = is.read(buffer, 0, Math.min(len, TRANSFERSIZE));
- if (size < 0)
- return;
- idat.write(buffer, 0, size);
- len -= size;
- }
- }
- else if (tRNS.equals(marker)) {
- switch (colorType) {
- case 0:
- if (len >= 2) {
- len -= 2;
- int gray = getWord(is);
- if (bitDepth == 16)
- transRedGray = gray;
- else
- additional.put(PdfName.MASK, new PdfLiteral("["+gray+" "+gray+"]"));
- }
- break;
- case 2:
- if (len >= 6) {
- len -= 6;
- int red = getWord(is);
- int green = getWord(is);
- int blue = getWord(is);
- if (bitDepth == 16) {
- transRedGray = red;
- transGreen = green;
- transBlue = blue;
- }
- else
- additional.put(PdfName.MASK, new PdfLiteral("["+red+" "+red+" "+green+" "+green+" "+blue+" "+blue+"]"));
- }
- break;
- case 3:
- if (len > 0) {
- trans = new byte[len];
- for (int k = 0; k < len; ++k)
- trans[k] = (byte)is.read();
- len = 0;
- }
- break;
- }
- Image.skip(is, len);
- }
- else if (IHDR.equals(marker)) {
- width = getInt(is);
- height = getInt(is);
-
- bitDepth = is.read();
- colorType = is.read();
- compressionMethod = is.read();
- filterMethod = is.read();
- interlaceMethod = is.read();
- }
- else if (PLTE.equals(marker)) {
- if (colorType == 3) {
- PdfArray colorspace = new PdfArray();
- colorspace.add(PdfName.INDEXED);
- colorspace.add(getColorspace());
- colorspace.add(new PdfNumber(len / 3 - 1));
- ByteBuffer colortable = new ByteBuffer();
- while ((len--) > 0) {
- colortable.append_i(is.read());
- }
- colorspace.add(new PdfString(colorTable = colortable.toByteArray()));
- additional.put(PdfName.COLORSPACE, colorspace);
- }
- else {
- Image.skip(is, len);
- }
- }
- else if (pHYs.equals(marker)) {
- int dx = getInt(is);
- int dy = getInt(is);
- int unit = is.read();
- if (unit == 1) {
- dpiX = (int)((float)dx * 0.0254f);
- dpiY = (int)((float)dy * 0.0254f);
- }
- else {
- if (dy != 0)
- XYRatio = (float)dx / (float)dy;
- }
- }
- else if (cHRM.equals(marker)) {
- xW = (float)getInt(is) / 100000f;
- yW = (float)getInt(is) / 100000f;
- xR = (float)getInt(is) / 100000f;
- yR = (float)getInt(is) / 100000f;
- xG = (float)getInt(is) / 100000f;
- yG = (float)getInt(is) / 100000f;
- xB = (float)getInt(is) / 100000f;
- yB = (float)getInt(is) / 100000f;
- hasCHRM = !(Math.abs(xW)<0.0001f||Math.abs(yW)<0.0001f||Math.abs(xR)<0.0001f||Math.abs(yR)<0.0001f||Math.abs(xG)<0.0001f||Math.abs(yG)<0.0001f||Math.abs(xB)<0.0001f||Math.abs(yB)<0.0001f);
- }
- else if (sRGB.equals(marker)) {
- int ri = is.read();
- intent = intents[ri];
- gamma = 2.2f;
- xW = 0.3127f;
- yW = 0.329f;
- xR = 0.64f;
- yR = 0.33f;
- xG = 0.3f;
- yG = 0.6f;
- xB = 0.15f;
- yB = 0.06f;
- hasCHRM = true;
- }
- else if (gAMA.equals(marker)) {
- int gm = getInt(is);
- if (gm != 0) {
- gamma = 100000f / (float)gm;
- if (!hasCHRM) {
- xW = 0.3127f;
- yW = 0.329f;
- xR = 0.64f;
- yR = 0.33f;
- xG = 0.3f;
- yG = 0.6f;
- xB = 0.15f;
- yB = 0.06f;
- hasCHRM = true;
- }
- }
- }
- else if (iCCP.equals(marker)) {
- do {
- --len;
- } while (is.read() != 0);
- is.read();
- --len;
- byte icccom[] = new byte[len];
- int p = 0;
- while (len > 0) {
- int r = is.read(icccom, p, len);
- if (r < 0)
- throw new IOException("Premature end of file.");
- p += r;
- len -= r;
- }
- byte iccp[] = PdfReader.FlateDecode(icccom, true);
- icccom = null;
- try {
- icc_profile = ICC_Profile.getInstance(iccp);
- }
- catch (Exception e) {
- icc_profile = null;
- }
- }
- else if (IEND.equals(marker)) {
- break;
- }
- else {
- Image.skip(is, len);
- }
- Image.skip(is, 4);
- }
- }
-
- PdfObject getColorspace() {
- if (icc_profile != null) {
- if ((colorType & 2) == 0)
- return PdfName.DEVICEGRAY;
- else
- return PdfName.DEVICERGB;
- }
- if (gamma == 1f && !hasCHRM) {
- if ((colorType & 2) == 0)
- return PdfName.DEVICEGRAY;
- else
- return PdfName.DEVICERGB;
- }
- else {
- PdfArray array = new PdfArray();
- PdfDictionary dic = new PdfDictionary();
- if ((colorType & 2) == 0) {
- if (gamma == 1f)
- return PdfName.DEVICEGRAY;
- array.add(PdfName.CALGRAY);
- dic.put(PdfName.GAMMA, new PdfNumber(gamma));
- dic.put(PdfName.WHITEPOINT, new PdfLiteral("[1 1 1]"));
- array.add(dic);
- }
- else {
- PdfObject wp = new PdfLiteral("[1 1 1]");
- array.add(PdfName.CALRGB);
- if (gamma != 1f) {
- PdfArray gm = new PdfArray();
- PdfNumber n = new PdfNumber(gamma);
- gm.add(n);
- gm.add(n);
- gm.add(n);
- dic.put(PdfName.GAMMA, gm);
- }
- if (hasCHRM) {
- float z = yW*((xG-xB)*yR-(xR-xB)*yG+(xR-xG)*yB);
- float YA = yR*((xG-xB)*yW-(xW-xB)*yG+(xW-xG)*yB)/z;
- float XA = YA*xR/yR;
- float ZA = YA*((1-xR)/yR-1);
- float YB = -yG*((xR-xB)*yW-(xW-xB)*yR+(xW-xR)*yB)/z;
- float XB = YB*xG/yG;
- float ZB = YB*((1-xG)/yG-1);
- float YC = yB*((xR-xG)*yW-(xW-xG)*yW+(xW-xR)*yG)/z;
- float XC = YC*xB/yB;
- float ZC = YC*((1-xB)/yB-1);
- float XW = XA+XB+XC;
- float YW = 1;//YA+YB+YC;
- float ZW = ZA+ZB+ZC;
- PdfArray wpa = new PdfArray();
- wpa.add(new PdfNumber(XW));
- wpa.add(new PdfNumber(YW));
- wpa.add(new PdfNumber(ZW));
- wp = wpa;
- PdfArray matrix = new PdfArray();
- matrix.add(new PdfNumber(XA));
- matrix.add(new PdfNumber(YA));
- matrix.add(new PdfNumber(ZA));
- matrix.add(new PdfNumber(XB));
- matrix.add(new PdfNumber(YB));
- matrix.add(new PdfNumber(ZB));
- matrix.add(new PdfNumber(XC));
- matrix.add(new PdfNumber(YC));
- matrix.add(new PdfNumber(ZC));
- dic.put(PdfName.MATRIX, matrix);
- }
- dic.put(PdfName.WHITEPOINT, wp);
- array.add(dic);
- }
- return array;
- }
- }
-
- Image getImage() throws IOException {
- readPng();
- try {
- int pal0 = 0;
- int palIdx = 0;
- palShades = false;
- if (trans != null) {
- for (int k = 0; k < trans.length; ++k) {
- int n = trans[k] & 0xff;
- if (n == 0) {
- ++pal0;
- palIdx = k;
- }
- if (n != 0 && n != 255) {
- palShades = true;
- break;
- }
- }
- }
- if ((colorType & 4) != 0)
- palShades = true;
- genBWMask = (!palShades && (pal0 > 1 || transRedGray >= 0));
- if (!palShades && !genBWMask && pal0 == 1) {
- additional.put(PdfName.MASK, new PdfLiteral("["+palIdx+" "+palIdx+"]"));
- }
- boolean needDecode = (interlaceMethod == 1) || (bitDepth == 16) || ((colorType & 4) != 0) || palShades || genBWMask;
- switch (colorType) {
- case 0:
- inputBands = 1;
- break;
- case 2:
- inputBands = 3;
- break;
- case 3:
- inputBands = 1;
- break;
- case 4:
- inputBands = 2;
- break;
- case 6:
- inputBands = 4;
- break;
- }
- if (needDecode)
- decodeIdat();
- int components = inputBands;
- if ((colorType & 4) != 0)
- --components;
- int bpc = bitDepth;
- if (bpc == 16)
- bpc = 8;
- Image img;
- if (image != null)
- img = Image.getInstance(width, height, components, bpc, image);
- else {
- img = new ImgRaw(width, height, components, bpc, idat.toByteArray());
- img.setDeflated(true);
- PdfDictionary decodeparms = new PdfDictionary();
- decodeparms.put(PdfName.BITSPERCOMPONENT, new PdfNumber(bitDepth));
- decodeparms.put(PdfName.PREDICTOR, new PdfNumber(15));
- decodeparms.put(PdfName.COLUMNS, new PdfNumber(width));
- decodeparms.put(PdfName.COLORS, new PdfNumber((colorType == 3 || (colorType & 2) == 0) ? 1 : 3));
- additional.put(PdfName.DECODEPARMS, decodeparms);
- }
- if (additional.get(PdfName.COLORSPACE) == null)
- additional.put(PdfName.COLORSPACE, getColorspace());
- if (intent != null)
- additional.put(PdfName.INTENT, intent);
- if (additional.size() > 0)
- img.setAdditional(additional);
- if (icc_profile != null)
- img.tagICC(icc_profile);
- if (palShades) {
- Image im2 = Image.getInstance(width, height, 1, 8, smask);
- im2.makeMask();
- img.setImageMask(im2);
- }
- if (genBWMask) {
- Image im2 = Image.getInstance(width, height, 1, 1, smask);
- im2.makeMask();
- img.setImageMask(im2);
- }
- img.setDpi(dpiX, dpiY);
- img.setXYRatio(XYRatio);
- img.setOriginalType(Image.ORIGINAL_PNG);
- return img;
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- void decodeIdat() {
- int nbitDepth = bitDepth;
- if (nbitDepth == 16)
- nbitDepth = 8;
- int size = -1;
- bytesPerPixel = (bitDepth == 16) ? 2 : 1;
- switch (colorType) {
- case 0:
- size = (nbitDepth * width + 7) / 8 * height;
- break;
- case 2:
- size = width * 3 * height;
- bytesPerPixel *= 3;
- break;
- case 3:
- if (interlaceMethod == 1)
- size = (nbitDepth * width + 7) / 8 * height;
- bytesPerPixel = 1;
- break;
- case 4:
- size = width * height;
- bytesPerPixel *= 2;
- break;
- case 6:
- size = width * 3 * height;
- bytesPerPixel *= 4;
- break;
- }
- if (size >= 0)
- image = new byte[size];
- if (palShades)
- smask = new byte[width * height];
- else if (genBWMask)
- smask = new byte[(width + 7) / 8 * height];
- ByteArrayInputStream bai = new ByteArrayInputStream(idat.getBuf(), 0, idat.size());
- InputStream infStream = new InflaterInputStream(bai, new Inflater());
- dataStream = new DataInputStream(infStream);
-
- if (interlaceMethod != 1) {
- decodePass(0, 0, 1, 1, width, height);
- }
- else {
- decodePass(0, 0, 8, 8, (width + 7)/8, (height + 7)/8);
- decodePass(4, 0, 8, 8, (width + 3)/8, (height + 7)/8);
- decodePass(0, 4, 4, 8, (width + 3)/4, (height + 3)/8);
- decodePass(2, 0, 4, 4, (width + 1)/4, (height + 3)/4);
- decodePass(0, 2, 2, 4, (width + 1)/2, (height + 1)/4);
- decodePass(1, 0, 2, 2, width/2, (height + 1)/2);
- decodePass(0, 1, 1, 2, width, height/2);
- }
-
- }
-
- void decodePass( int xOffset, int yOffset,
- int xStep, int yStep,
- int passWidth, int passHeight) {
- if ((passWidth == 0) || (passHeight == 0)) {
- return;
- }
-
- int bytesPerRow = (inputBands*passWidth*bitDepth + 7)/8;
- byte[] curr = new byte[bytesPerRow];
- byte[] prior = new byte[bytesPerRow];
-
- // Decode the (sub)image row-by-row
- int srcY, dstY;
- for (srcY = 0, dstY = yOffset;
- srcY < passHeight;
- srcY++, dstY += yStep) {
- // Read the filter type byte and a row of data
- int filter = 0;
- try {
- filter = dataStream.read();
- dataStream.readFully(curr, 0, bytesPerRow);
- } catch (Exception e) {
- // empty on purpose
- }
-
- switch (filter) {
- case PNG_FILTER_NONE:
- break;
- case PNG_FILTER_SUB:
- decodeSubFilter(curr, bytesPerRow, bytesPerPixel);
- break;
- case PNG_FILTER_UP:
- decodeUpFilter(curr, prior, bytesPerRow);
- break;
- case PNG_FILTER_AVERAGE:
- decodeAverageFilter(curr, prior, bytesPerRow, bytesPerPixel);
- break;
- case PNG_FILTER_PAETH:
- decodePaethFilter(curr, prior, bytesPerRow, bytesPerPixel);
- break;
- default:
- // Error -- uknown filter type
- throw new RuntimeException("PNG filter unknown.");
- }
-
- processPixels(curr, xOffset, xStep, dstY, passWidth);
-
- // Swap curr and prior
- byte[] tmp = prior;
- prior = curr;
- curr = tmp;
- }
- }
-
- void processPixels(byte curr[], int xOffset, int step, int y, int width) {
- int srcX, dstX;
-
- int out[] = getPixel(curr);
- int sizes = 0;
- switch (colorType) {
- case 0:
- case 3:
- case 4:
- sizes = 1;
- break;
- case 2:
- case 6:
- sizes = 3;
- break;
- }
- if (image != null) {
- dstX = xOffset;
- int yStride = (sizes*this.width*(bitDepth == 16 ? 8 : bitDepth)+ 7)/8;
- for (srcX = 0; srcX < width; srcX++) {
- setPixel(image, out, inputBands * srcX, sizes, dstX, y, bitDepth, yStride);
- dstX += step;
- }
- }
- if (palShades) {
- if ((colorType & 4) != 0) {
- if (bitDepth == 16) {
- for (int k = 0; k < width; ++k)
- out[k * inputBands + sizes] >>>= 8;
- }
- int yStride = this.width;
- dstX = xOffset;
- for (srcX = 0; srcX < width; srcX++) {
- setPixel(smask, out, inputBands * srcX + sizes, 1, dstX, y, 8, yStride);
- dstX += step;
- }
- }
- else { //colorType 3
- int yStride = this.width;
- int v[] = new int[1];
- dstX = xOffset;
- for (srcX = 0; srcX < width; srcX++) {
- int idx = out[srcX];
- int r = 255;
- if (idx < trans.length)
- v[0] = trans[idx];
- setPixel(smask, v, 0, 1, dstX, y, 8, yStride);
- dstX += step;
- }
- }
- }
- else if (genBWMask) {
- switch (colorType) {
- case 3: {
- int yStride = (this.width + 7) / 8;
- int v[] = new int[1];
- dstX = xOffset;
- for (srcX = 0; srcX < width; srcX++) {
- int idx = out[srcX];
- int r = 0;
- if (idx < trans.length)
- v[0] = (trans[idx] == 0 ? 1 : 0);
- setPixel(smask, v, 0, 1, dstX, y, 1, yStride);
- dstX += step;
- }
- break;
- }
- case 0: {
- int yStride = (this.width + 7) / 8;
- int v[] = new int[1];
- dstX = xOffset;
- for (srcX = 0; srcX < width; srcX++) {
- int g = out[srcX];
- v[0] = (g == transRedGray ? 1 : 0);
- setPixel(smask, v, 0, 1, dstX, y, 1, yStride);
- dstX += step;
- }
- break;
- }
- case 2: {
- int yStride = (this.width + 7) / 8;
- int v[] = new int[1];
- dstX = xOffset;
- for (srcX = 0; srcX < width; srcX++) {
- int markRed = inputBands * srcX;
- v[0] = (out[markRed] == transRedGray && out[markRed + 1] == transGreen
- && out[markRed + 2] == transBlue ? 1 : 0);
- setPixel(smask, v, 0, 1, dstX, y, 1, yStride);
- dstX += step;
- }
- break;
- }
- }
- }
- }
-
- static int getPixel(byte image[], int x, int y, int bitDepth, int bytesPerRow) {
- if (bitDepth == 8) {
- int pos = bytesPerRow * y + x;
- return image[pos] & 0xff;
- }
- else {
- int pos = bytesPerRow * y + x / (8 / bitDepth);
- int v = image[pos] >> (8 - bitDepth * (x % (8 / bitDepth))- bitDepth);
- return v & ((1 << bitDepth) - 1);
- }
- }
-
- static void setPixel(byte image[], int data[], int offset, int size, int x, int y, int bitDepth, int bytesPerRow) {
- if (bitDepth == 8) {
- int pos = bytesPerRow * y + size * x;
- for (int k = 0; k < size; ++k)
- image[pos + k] = (byte)data[k + offset];
- }
- else if (bitDepth == 16) {
- int pos = bytesPerRow * y + size * x;
- for (int k = 0; k < size; ++k)
- image[pos + k] = (byte)(data[k + offset] >>> 8);
- }
- else {
- int pos = bytesPerRow * y + x / (8 / bitDepth);
- int v = data[offset] << (8 - bitDepth * (x % (8 / bitDepth))- bitDepth);
- image[pos] |= v;
- }
- }
-
- int[] getPixel(byte curr[]) {
- switch (bitDepth) {
- case 8: {
- int out[] = new int[curr.length];
- for (int k = 0; k < out.length; ++k)
- out[k] = curr[k] & 0xff;
- return out;
- }
- case 16: {
- int out[] = new int[curr.length / 2];
- for (int k = 0; k < out.length; ++k)
- out[k] = ((curr[k * 2] & 0xff) << 8) + (curr[k * 2 + 1] & 0xff);
- return out;
- }
- default: {
- int out[] = new int[curr.length * 8 / bitDepth];
- int idx = 0;
- int passes = 8 / bitDepth;
- int mask = (1 << bitDepth) - 1;
- for (int k = 0; k < curr.length; ++k) {
- for (int j = passes - 1; j >= 0; --j) {
- out[idx++] = (curr[k] >>> (bitDepth * j)) & mask;
- }
- }
- return out;
- }
- }
- }
-
- private static void decodeSubFilter(byte[] curr, int count, int bpp) {
- for (int i = bpp; i < count; i++) {
- int val;
-
- val = curr[i] & 0xff;
- val += curr[i - bpp] & 0xff;
-
- curr[i] = (byte)val;
- }
- }
-
- private static void decodeUpFilter(byte[] curr, byte[] prev,
- int count) {
- for (int i = 0; i < count; i++) {
- int raw = curr[i] & 0xff;
- int prior = prev[i] & 0xff;
-
- curr[i] = (byte)(raw + prior);
- }
- }
-
- private static void decodeAverageFilter(byte[] curr, byte[] prev,
- int count, int bpp) {
- int raw, priorPixel, priorRow;
-
- for (int i = 0; i < bpp; i++) {
- raw = curr[i] & 0xff;
- priorRow = prev[i] & 0xff;
-
- curr[i] = (byte)(raw + priorRow/2);
- }
-
- for (int i = bpp; i < count; i++) {
- raw = curr[i] & 0xff;
- priorPixel = curr[i - bpp] & 0xff;
- priorRow = prev[i] & 0xff;
-
- curr[i] = (byte)(raw + (priorPixel + priorRow)/2);
- }
- }
-
- private static int paethPredictor(int a, int b, int c) {
- int p = a + b - c;
- int pa = Math.abs(p - a);
- int pb = Math.abs(p - b);
- int pc = Math.abs(p - c);
-
- if ((pa <= pb) && (pa <= pc)) {
- return a;
- } else if (pb <= pc) {
- return b;
- } else {
- return c;
- }
- }
-
- private static void decodePaethFilter(byte[] curr, byte[] prev,
- int count, int bpp) {
- int raw, priorPixel, priorRow, priorRowPixel;
-
- for (int i = 0; i < bpp; i++) {
- raw = curr[i] & 0xff;
- priorRow = prev[i] & 0xff;
-
- curr[i] = (byte)(raw + priorRow);
- }
-
- for (int i = bpp; i < count; i++) {
- raw = curr[i] & 0xff;
- priorPixel = curr[i - bpp] & 0xff;
- priorRow = prev[i] & 0xff;
- priorRowPixel = prev[i - bpp] & 0xff;
-
- curr[i] = (byte)(raw + paethPredictor(priorPixel,
- priorRow,
- priorRowPixel));
- }
- }
-
- static class NewByteArrayOutputStream extends ByteArrayOutputStream {
- public byte[] getBuf() {
- return buf;
- }
- }
-
-/**
- * Gets an <CODE>int</CODE> from an <CODE>InputStream</CODE>.
- *
- * @param is an <CODE>InputStream</CODE>
- * @return the value of an <CODE>int</CODE>
- */
-
- public static final int getInt(InputStream is) throws IOException {
- return (is.read() << 24) + (is.read() << 16) + (is.read() << 8) + is.read();
- }
-
-/**
- * Gets a <CODE>word</CODE> from an <CODE>InputStream</CODE>.
- *
- * @param is an <CODE>InputStream</CODE>
- * @return the value of an <CODE>int</CODE>
- */
-
- public static final int getWord(InputStream is) throws IOException {
- return (is.read() << 8) + is.read();
- }
-
-/**
- * Gets a <CODE>String</CODE> from an <CODE>InputStream</CODE>.
- *
- * @param is an <CODE>InputStream</CODE>
- * @return the value of an <CODE>int</CODE>
- */
-
- public static final String getString(InputStream is) throws IOException {
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < 4; i++) {
- buf.append((char)is.read());
- }
- return buf.toString();
- }
-
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/TIFFConstants.java b/LibrarySource/com/lowagie/text/pdf/codec/TIFFConstants.java
deleted file mode 100644
index 35bc9c2..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/TIFFConstants.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Copyright (c) 2001 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * -Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * -Redistribution in binary form must reproduct the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
- * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
- * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
- * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
- * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
- * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
- * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
- * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
- * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that Software is not designed,licensed or intended for use in
- * the design, construction, operation or maintenance of any nuclear facility.
- */
-package com.lowagie.text.pdf.codec;
-
-/**
- * A baseline TIFF reader. The reader has some functionality in addition to
- * the baseline specifications for Bilevel images, for which the group 3 and
- * group 4 decompression schemes have been implemented. Support for LZW
- * decompression has also been added. Support for Horizontal differencing
- * predictor decoding is also included, when used with LZW compression.
- * However, this support is limited to data with bitsPerSample value of 8.
- * When reading in RGB images, support for alpha and extraSamples being
- * present has been added. Support for reading in images with 16 bit samples
- * has been added. Support for the SampleFormat tag (signed samples as well
- * as floating-point samples) has also been added. In all other cases, support
- * is limited to Baseline specifications.
- *
- *
- */
-public class TIFFConstants {
-
-/*
- * TIFF Tag Definitions (from tifflib).
- */
- public static final int TIFFTAG_SUBFILETYPE = 254; /* subfile data descriptor */
- public static final int FILETYPE_REDUCEDIMAGE = 0x1; /* reduced resolution version */
- public static final int FILETYPE_PAGE = 0x2; /* one page of many */
- public static final int FILETYPE_MASK = 0x4; /* transparency mask */
- public static final int TIFFTAG_OSUBFILETYPE = 255; /* +kind of data in subfile */
- public static final int OFILETYPE_IMAGE = 1; /* full resolution image data */
- public static final int OFILETYPE_REDUCEDIMAGE = 2; /* reduced size image data */
- public static final int OFILETYPE_PAGE = 3; /* one page of many */
- public static final int TIFFTAG_IMAGEWIDTH = 256; /* image width in pixels */
- public static final int TIFFTAG_IMAGELENGTH = 257; /* image height in pixels */
- public static final int TIFFTAG_BITSPERSAMPLE = 258; /* bits per channel (sample) */
- public static final int TIFFTAG_COMPRESSION = 259; /* data compression technique */
- public static final int COMPRESSION_NONE = 1; /* dump mode */
- public static final int COMPRESSION_CCITTRLE = 2; /* CCITT modified Huffman RLE */
- public static final int COMPRESSION_CCITTFAX3 = 3; /* CCITT Group 3 fax encoding */
- public static final int COMPRESSION_CCITTFAX4 = 4; /* CCITT Group 4 fax encoding */
- public static final int COMPRESSION_LZW = 5; /* Lempel-Ziv & Welch */
- public static final int COMPRESSION_OJPEG = 6; /* !6.0 JPEG */
- public static final int COMPRESSION_JPEG = 7; /* %JPEG DCT compression */
- public static final int COMPRESSION_NEXT = 32766; /* NeXT 2-bit RLE */
- public static final int COMPRESSION_CCITTRLEW = 32771; /* #1 w/ word alignment */
- public static final int COMPRESSION_PACKBITS = 32773; /* Macintosh RLE */
- public static final int COMPRESSION_THUNDERSCAN = 32809; /* ThunderScan RLE */
- /* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly at etsinc.com) */
- public static final int COMPRESSION_IT8CTPAD = 32895; /* IT8 CT w/padding */
- public static final int COMPRESSION_IT8LW = 32896; /* IT8 Linework RLE */
- public static final int COMPRESSION_IT8MP = 32897; /* IT8 Monochrome picture */
- public static final int COMPRESSION_IT8BL = 32898; /* IT8 Binary line art */
- /* compression codes 32908-32911 are reserved for Pixar */
- public static final int COMPRESSION_PIXARFILM = 32908; /* Pixar companded 10bit LZW */
- public static final int COMPRESSION_PIXARLOG = 32909; /* Pixar companded 11bit ZIP */
- public static final int COMPRESSION_DEFLATE = 32946; /* Deflate compression */
- public static final int COMPRESSION_ADOBE_DEFLATE = 8; /* Deflate compression, as recognized by Adobe */
- /* compression code 32947 is reserved for Oceana Matrix <dev at oceana.com> */
- public static final int COMPRESSION_DCS = 32947; /* Kodak DCS encoding */
- public static final int COMPRESSION_JBIG = 34661; /* ISO JBIG */
- public static final int COMPRESSION_SGILOG = 34676; /* SGI Log Luminance RLE */
- public static final int COMPRESSION_SGILOG24 = 34677; /* SGI Log 24-bit packed */
- public static final int TIFFTAG_PHOTOMETRIC = 262; /* photometric interpretation */
- public static final int PHOTOMETRIC_MINISWHITE = 0; /* min value is white */
- public static final int PHOTOMETRIC_MINISBLACK = 1; /* min value is black */
- public static final int PHOTOMETRIC_RGB = 2; /* RGB color model */
- public static final int PHOTOMETRIC_PALETTE = 3; /* color map indexed */
- public static final int PHOTOMETRIC_MASK = 4; /* $holdout mask */
- public static final int PHOTOMETRIC_SEPARATED = 5; /* !color separations */
- public static final int PHOTOMETRIC_YCBCR = 6; /* !CCIR 601 */
- public static final int PHOTOMETRIC_CIELAB = 8; /* !1976 CIE L*a*b* */
- public static final int PHOTOMETRIC_LOGL = 32844; /* CIE Log2(L) */
- public static final int PHOTOMETRIC_LOGLUV = 32845; /* CIE Log2(L) (u',v') */
- public static final int TIFFTAG_THRESHHOLDING = 263; /* +thresholding used on data */
- public static final int THRESHHOLD_BILEVEL = 1; /* b&w art scan */
- public static final int THRESHHOLD_HALFTONE = 2; /* or dithered scan */
- public static final int THRESHHOLD_ERRORDIFFUSE = 3; /* usually floyd-steinberg */
- public static final int TIFFTAG_CELLWIDTH = 264; /* +dithering matrix width */
- public static final int TIFFTAG_CELLLENGTH = 265; /* +dithering matrix height */
- public static final int TIFFTAG_FILLORDER = 266; /* data order within a byte */
- public static final int FILLORDER_MSB2LSB = 1; /* most significant -> least */
- public static final int FILLORDER_LSB2MSB = 2; /* least significant -> most */
- public static final int TIFFTAG_DOCUMENTNAME = 269; /* name of doc. image is from */
- public static final int TIFFTAG_IMAGEDESCRIPTION = 270; /* info about image */
- public static final int TIFFTAG_MAKE = 271; /* scanner manufacturer name */
- public static final int TIFFTAG_MODEL = 272; /* scanner model name/number */
- public static final int TIFFTAG_STRIPOFFSETS = 273; /* offsets to data strips */
- public static final int TIFFTAG_ORIENTATION = 274; /* +image orientation */
- public static final int ORIENTATION_TOPLEFT = 1; /* row 0 top, col 0 lhs */
- public static final int ORIENTATION_TOPRIGHT = 2; /* row 0 top, col 0 rhs */
- public static final int ORIENTATION_BOTRIGHT = 3; /* row 0 bottom, col 0 rhs */
- public static final int ORIENTATION_BOTLEFT = 4; /* row 0 bottom, col 0 lhs */
- public static final int ORIENTATION_LEFTTOP = 5; /* row 0 lhs, col 0 top */
- public static final int ORIENTATION_RIGHTTOP = 6; /* row 0 rhs, col 0 top */
- public static final int ORIENTATION_RIGHTBOT = 7; /* row 0 rhs, col 0 bottom */
- public static final int ORIENTATION_LEFTBOT = 8; /* row 0 lhs, col 0 bottom */
- public static final int TIFFTAG_SAMPLESPERPIXEL = 277; /* samples per pixel */
- public static final int TIFFTAG_ROWSPERSTRIP = 278; /* rows per strip of data */
- public static final int TIFFTAG_STRIPBYTECOUNTS = 279; /* bytes counts for strips */
- public static final int TIFFTAG_MINSAMPLEVALUE = 280; /* +minimum sample value */
- public static final int TIFFTAG_MAXSAMPLEVALUE = 281; /* +maximum sample value */
- public static final int TIFFTAG_XRESOLUTION = 282; /* pixels/resolution in x */
- public static final int TIFFTAG_YRESOLUTION = 283; /* pixels/resolution in y */
- public static final int TIFFTAG_PLANARCONFIG = 284; /* storage organization */
- public static final int PLANARCONFIG_CONTIG = 1; /* single image plane */
- public static final int PLANARCONFIG_SEPARATE = 2; /* separate planes of data */
- public static final int TIFFTAG_PAGENAME = 285; /* page name image is from */
- public static final int TIFFTAG_XPOSITION = 286; /* x page offset of image lhs */
- public static final int TIFFTAG_YPOSITION = 287; /* y page offset of image lhs */
- public static final int TIFFTAG_FREEOFFSETS = 288; /* +byte offset to free block */
- public static final int TIFFTAG_FREEBYTECOUNTS = 289; /* +sizes of free blocks */
- public static final int TIFFTAG_GRAYRESPONSEUNIT = 290; /* $gray scale curve accuracy */
- public static final int GRAYRESPONSEUNIT_10S = 1; /* tenths of a unit */
- public static final int GRAYRESPONSEUNIT_100S = 2; /* hundredths of a unit */
- public static final int GRAYRESPONSEUNIT_1000S = 3; /* thousandths of a unit */
- public static final int GRAYRESPONSEUNIT_10000S = 4; /* ten-thousandths of a unit */
- public static final int GRAYRESPONSEUNIT_100000S = 5; /* hundred-thousandths */
- public static final int TIFFTAG_GRAYRESPONSECURVE = 291; /* $gray scale response curve */
- public static final int TIFFTAG_GROUP3OPTIONS = 292; /* 32 flag bits */
- public static final int GROUP3OPT_2DENCODING = 0x1; /* 2-dimensional coding */
- public static final int GROUP3OPT_UNCOMPRESSED = 0x2; /* data not compressed */
- public static final int GROUP3OPT_FILLBITS = 0x4; /* fill to byte boundary */
- public static final int TIFFTAG_GROUP4OPTIONS = 293; /* 32 flag bits */
- public static final int GROUP4OPT_UNCOMPRESSED = 0x2; /* data not compressed */
- public static final int TIFFTAG_RESOLUTIONUNIT = 296; /* units of resolutions */
- public static final int RESUNIT_NONE = 1; /* no meaningful units */
- public static final int RESUNIT_INCH = 2; /* english */
- public static final int RESUNIT_CENTIMETER = 3; /* metric */
- public static final int TIFFTAG_PAGENUMBER = 297; /* page numbers of multi-page */
- public static final int TIFFTAG_COLORRESPONSEUNIT = 300; /* $color curve accuracy */
- public static final int COLORRESPONSEUNIT_10S = 1; /* tenths of a unit */
- public static final int COLORRESPONSEUNIT_100S = 2; /* hundredths of a unit */
- public static final int COLORRESPONSEUNIT_1000S = 3; /* thousandths of a unit */
- public static final int COLORRESPONSEUNIT_10000S = 4; /* ten-thousandths of a unit */
- public static final int COLORRESPONSEUNIT_100000S = 5; /* hundred-thousandths */
- public static final int TIFFTAG_TRANSFERFUNCTION = 301; /* !colorimetry info */
- public static final int TIFFTAG_SOFTWARE = 305; /* name & release */
- public static final int TIFFTAG_DATETIME = 306; /* creation date and time */
- public static final int TIFFTAG_ARTIST = 315; /* creator of image */
- public static final int TIFFTAG_HOSTCOMPUTER = 316; /* machine where created */
- public static final int TIFFTAG_PREDICTOR = 317; /* prediction scheme w/ LZW */
- public static final int TIFFTAG_WHITEPOINT = 318; /* image white point */
- public static final int TIFFTAG_PRIMARYCHROMATICITIES = 319; /* !primary chromaticities */
- public static final int TIFFTAG_COLORMAP = 320; /* RGB map for pallette image */
- public static final int TIFFTAG_HALFTONEHINTS = 321; /* !highlight+shadow info */
- public static final int TIFFTAG_TILEWIDTH = 322; /* !rows/data tile */
- public static final int TIFFTAG_TILELENGTH = 323; /* !cols/data tile */
- public static final int TIFFTAG_TILEOFFSETS = 324; /* !offsets to data tiles */
- public static final int TIFFTAG_TILEBYTECOUNTS = 325; /* !byte counts for tiles */
- public static final int TIFFTAG_BADFAXLINES = 326; /* lines w/ wrong pixel count */
- public static final int TIFFTAG_CLEANFAXDATA = 327; /* regenerated line info */
- public static final int CLEANFAXDATA_CLEAN = 0; /* no errors detected */
- public static final int CLEANFAXDATA_REGENERATED = 1; /* receiver regenerated lines */
- public static final int CLEANFAXDATA_UNCLEAN = 2; /* uncorrected errors exist */
- public static final int TIFFTAG_CONSECUTIVEBADFAXLINES = 328; /* max consecutive bad lines */
- public static final int TIFFTAG_SUBIFD = 330; /* subimage descriptors */
- public static final int TIFFTAG_INKSET = 332; /* !inks in separated image */
- public static final int INKSET_CMYK = 1; /* !cyan-magenta-yellow-black */
- public static final int TIFFTAG_INKNAMES = 333; /* !ascii names of inks */
- public static final int TIFFTAG_NUMBEROFINKS = 334; /* !number of inks */
- public static final int TIFFTAG_DOTRANGE = 336; /* !0% and 100% dot codes */
- public static final int TIFFTAG_TARGETPRINTER = 337; /* !separation target */
- public static final int TIFFTAG_EXTRASAMPLES = 338; /* !info about extra samples */
- public static final int EXTRASAMPLE_UNSPECIFIED = 0; /* !unspecified data */
- public static final int EXTRASAMPLE_ASSOCALPHA = 1; /* !associated alpha data */
- public static final int EXTRASAMPLE_UNASSALPHA = 2; /* !unassociated alpha data */
- public static final int TIFFTAG_SAMPLEFORMAT = 339; /* !data sample format */
- public static final int SAMPLEFORMAT_UINT = 1; /* !unsigned integer data */
- public static final int SAMPLEFORMAT_INT = 2; /* !signed integer data */
- public static final int SAMPLEFORMAT_IEEEFP = 3; /* !IEEE floating point data */
- public static final int SAMPLEFORMAT_VOID = 4; /* !untyped data */
- public static final int SAMPLEFORMAT_COMPLEXINT = 5; /* !complex signed int */
- public static final int SAMPLEFORMAT_COMPLEXIEEEFP = 6; /* !complex ieee floating */
- public static final int TIFFTAG_SMINSAMPLEVALUE = 340; /* !variable MinSampleValue */
- public static final int TIFFTAG_SMAXSAMPLEVALUE = 341; /* !variable MaxSampleValue */
- public static final int TIFFTAG_JPEGTABLES = 347; /* %JPEG table stream */
-/*
- * Tags 512-521 are obsoleted by Technical Note #2
- * which specifies a revised JPEG-in-TIFF scheme.
- */
- public static final int TIFFTAG_JPEGPROC = 512; /* !JPEG processing algorithm */
- public static final int JPEGPROC_BASELINE = 1; /* !baseline sequential */
- public static final int JPEGPROC_LOSSLESS = 14; /* !Huffman coded lossless */
- public static final int TIFFTAG_JPEGIFOFFSET = 513; /* !pointer to SOI marker */
- public static final int TIFFTAG_JPEGIFBYTECOUNT = 514; /* !JFIF stream length */
- public static final int TIFFTAG_JPEGRESTARTINTERVAL = 515; /* !restart interval length */
- public static final int TIFFTAG_JPEGLOSSLESSPREDICTORS = 517; /* !lossless proc predictor */
- public static final int TIFFTAG_JPEGPOINTTRANSFORM = 518; /* !lossless point transform */
- public static final int TIFFTAG_JPEGQTABLES = 519; /* !Q matrice offsets */
- public static final int TIFFTAG_JPEGDCTABLES = 520; /* !DCT table offsets */
- public static final int TIFFTAG_JPEGACTABLES = 521; /* !AC coefficient offsets */
- public static final int TIFFTAG_YCBCRCOEFFICIENTS = 529; /* !RGB -> YCbCr transform */
- public static final int TIFFTAG_YCBCRSUBSAMPLING = 530; /* !YCbCr subsampling factors */
- public static final int TIFFTAG_YCBCRPOSITIONING = 531; /* !subsample positioning */
- public static final int YCBCRPOSITION_CENTERED = 1; /* !as in PostScript Level 2 */
- public static final int YCBCRPOSITION_COSITED = 2; /* !as in CCIR 601-1 */
- public static final int TIFFTAG_REFERENCEBLACKWHITE = 532; /* !colorimetry info */
- /* tags 32952-32956 are private tags registered to Island Graphics */
- public static final int TIFFTAG_REFPTS = 32953; /* image reference points */
- public static final int TIFFTAG_REGIONTACKPOINT = 32954; /* region-xform tack point */
- public static final int TIFFTAG_REGIONWARPCORNERS = 32955; /* warp quadrilateral */
- public static final int TIFFTAG_REGIONAFFINE = 32956; /* affine transformation mat */
- /* tags 32995-32999 are private tags registered to SGI */
- public static final int TIFFTAG_MATTEING = 32995; /* $use ExtraSamples */
- public static final int TIFFTAG_DATATYPE = 32996; /* $use SampleFormat */
- public static final int TIFFTAG_IMAGEDEPTH = 32997; /* z depth of image */
- public static final int TIFFTAG_TILEDEPTH = 32998; /* z depth/data tile */
- /* tags 33300-33309 are private tags registered to Pixar */
-/*
- * TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH
- * are set when an image has been cropped out of a larger image.
- * They reflect the size of the original uncropped image.
- * The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used
- * to determine the position of the smaller image in the larger one.
- */
- public static final int TIFFTAG_PIXAR_IMAGEFULLWIDTH = 33300; /* full image size in x */
- public static final int TIFFTAG_PIXAR_IMAGEFULLLENGTH = 33301; /* full image size in y */
- /* Tags 33302-33306 are used to identify special image modes and data
- * used by Pixar's texture formats.
- */
- public static final int TIFFTAG_PIXAR_TEXTUREFORMAT = 33302; /* texture map format */
- public static final int TIFFTAG_PIXAR_WRAPMODES = 33303; /* s & t wrap modes */
- public static final int TIFFTAG_PIXAR_FOVCOT = 33304; /* cotan(fov) for env. maps */
- public static final int TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN = 33305;
- public static final int TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA = 33306;
- /* tag 33405 is a private tag registered to Eastman Kodak */
- public static final int TIFFTAG_WRITERSERIALNUMBER = 33405; /* device serial number */
- /* tag 33432 is listed in the 6.0 spec w/ unknown ownership */
- public static final int TIFFTAG_COPYRIGHT = 33432; /* copyright string */
- /* IPTC TAG from RichTIFF specifications */
- public static final int TIFFTAG_RICHTIFFIPTC = 33723;
- /* 34016-34029 are reserved for ANSI IT8 TIFF/IT <dkelly at etsinc.com) */
- public static final int TIFFTAG_IT8SITE = 34016; /* site name */
- public static final int TIFFTAG_IT8COLORSEQUENCE = 34017; /* color seq. [RGB,CMYK,etc] */
- public static final int TIFFTAG_IT8HEADER = 34018; /* DDES Header */
- public static final int TIFFTAG_IT8RASTERPADDING = 34019; /* raster scanline padding */
- public static final int TIFFTAG_IT8BITSPERRUNLENGTH = 34020; /* # of bits in short run */
- public static final int TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH = 34021;/* # of bits in long run */
- public static final int TIFFTAG_IT8COLORTABLE = 34022; /* LW colortable */
- public static final int TIFFTAG_IT8IMAGECOLORINDICATOR = 34023; /* BP/BL image color switch */
- public static final int TIFFTAG_IT8BKGCOLORINDICATOR = 34024; /* BP/BL bg color switch */
- public static final int TIFFTAG_IT8IMAGECOLORVALUE = 34025; /* BP/BL image color value */
- public static final int TIFFTAG_IT8BKGCOLORVALUE = 34026; /* BP/BL bg color value */
- public static final int TIFFTAG_IT8PIXELINTENSITYRANGE = 34027; /* MP pixel intensity value */
- public static final int TIFFTAG_IT8TRANSPARENCYINDICATOR = 34028; /* HC transparency switch */
- public static final int TIFFTAG_IT8COLORCHARACTERIZATION = 34029; /* color character. table */
- /* tags 34232-34236 are private tags registered to Texas Instruments */
- public static final int TIFFTAG_FRAMECOUNT = 34232; /* Sequence Frame Count */
- /* tag 34750 is a private tag registered to Adobe? */
- public static final int TIFFTAG_ICCPROFILE = 34675; /* ICC profile data */
- /* tag 34377 is private tag registered to Adobe for PhotoShop */
- public static final int TIFFTAG_PHOTOSHOP = 34377;
- /* tag 34750 is a private tag registered to Pixel Magic */
- public static final int TIFFTAG_JBIGOPTIONS = 34750; /* JBIG options */
- /* tags 34908-34914 are private tags registered to SGI */
- public static final int TIFFTAG_FAXRECVPARAMS = 34908; /* encoded Class 2 ses. parms */
- public static final int TIFFTAG_FAXSUBADDRESS = 34909; /* received SubAddr string */
- public static final int TIFFTAG_FAXRECVTIME = 34910; /* receive time (secs) */
- /* tags 37439-37443 are registered to SGI <gregl at sgi.com> */
- public static final int TIFFTAG_STONITS = 37439; /* Sample value to Nits */
- /* tag 34929 is a private tag registered to FedEx */
- public static final int TIFFTAG_FEDEX_EDR = 34929; /* unknown use */
- /* tag 65535 is an undefined tag used by Eastman Kodak */
- public static final int TIFFTAG_DCSHUESHIFTVALUES = 65535; /* hue shift correction data */
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/TIFFDirectory.java b/LibrarySource/com/lowagie/text/pdf/codec/TIFFDirectory.java
deleted file mode 100644
index 1bcbd71..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/TIFFDirectory.java
+++ /dev/null
@@ -1,657 +0,0 @@
-/*
- * Copyright (c) 2001 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * -Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * -Redistribution in binary form must reproduct the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
- * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
- * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
- * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
- * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
- * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
- * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
- * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
- * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that Software is not designed,licensed or intended for use in
- * the design, construction, operation or maintenance of any nuclear facility.
- */
-package com.lowagie.text.pdf.codec;
-import java.io.IOException;
-import java.io.EOFException;
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.ArrayList;
-import com.lowagie.text.pdf.RandomAccessFileOrArray;
-
-/**
- * A class representing an Image File Directory (IFD) from a TIFF 6.0
- * stream. The TIFF file format is described in more detail in the
- * comments for the TIFFDescriptor class.
- *
- * <p> A TIFF IFD consists of a set of TIFFField tags. Methods are
- * provided to query the set of tags and to obtain the raw field
- * array. In addition, convenience methods are provided for acquiring
- * the values of tags that contain a single value that fits into a
- * byte, int, long, float, or double.
- *
- * <p> Every TIFF file is made up of one or more public IFDs that are
- * joined in a linked list, rooted in the file header. A file may
- * also contain so-called private IFDs that are referenced from
- * tag data and do not appear in the main list.
- *
- * <p><b> This class is not a committed part of the JAI API. It may
- * be removed or changed in future releases of JAI.</b>
- *
- * @see TIFFField
- */
-public class TIFFDirectory extends Object implements Serializable {
-
- /** A boolean storing the endianness of the stream. */
- boolean isBigEndian;
-
- /** The number of entries in the IFD. */
- int numEntries;
-
- /** An array of TIFFFields. */
- TIFFField[] fields;
-
- /** A Hashtable indexing the fields by tag number. */
- Hashtable fieldIndex = new Hashtable();
-
- /** The offset of this IFD. */
- long IFDOffset = 8;
-
- /** The offset of the next IFD. */
- long nextIFDOffset = 0;
-
- /** The default constructor. */
- TIFFDirectory() {}
-
- private static boolean isValidEndianTag(int endian) {
- return ((endian == 0x4949) || (endian == 0x4d4d));
- }
-
- /**
- * Constructs a TIFFDirectory from a SeekableStream.
- * The directory parameter specifies which directory to read from
- * the linked list present in the stream; directory 0 is normally
- * read but it is possible to store multiple images in a single
- * TIFF file by maintaing multiple directories.
- *
- * @param stream a SeekableStream to read from.
- * @param directory the index of the directory to read.
- */
- public TIFFDirectory(RandomAccessFileOrArray stream, int directory)
- throws IOException {
-
- long global_save_offset = stream.getFilePointer();
- long ifd_offset;
-
- // Read the TIFF header
- stream.seek(0L);
- int endian = stream.readUnsignedShort();
- if (!isValidEndianTag(endian)) {
- throw new
- IllegalArgumentException("Bad endianness tag (not 0x4949 or 0x4d4d).");
- }
- isBigEndian = (endian == 0x4d4d);
-
- int magic = readUnsignedShort(stream);
- if (magic != 42) {
- throw new
- IllegalArgumentException("Bad magic number, should be 42.");
- }
-
- // Get the initial ifd offset as an unsigned int (using a long)
- ifd_offset = readUnsignedInt(stream);
-
- for (int i = 0; i < directory; i++) {
- if (ifd_offset == 0L) {
- throw new
- IllegalArgumentException("Directory number too large.");
- }
-
- stream.seek(ifd_offset);
- int entries = readUnsignedShort(stream);
- stream.skip(12*entries);
-
- ifd_offset = readUnsignedInt(stream);
- }
-
- stream.seek(ifd_offset);
- initialize(stream);
- stream.seek(global_save_offset);
- }
-
- /**
- * Constructs a TIFFDirectory by reading a SeekableStream.
- * The ifd_offset parameter specifies the stream offset from which
- * to begin reading; this mechanism is sometimes used to store
- * private IFDs within a TIFF file that are not part of the normal
- * sequence of IFDs.
- *
- * @param stream a SeekableStream to read from.
- * @param ifd_offset the long byte offset of the directory.
- * @param directory the index of the directory to read beyond the
- * one at the current stream offset; zero indicates the IFD
- * at the current offset.
- */
- public TIFFDirectory(RandomAccessFileOrArray stream, long ifd_offset, int directory)
- throws IOException {
-
- long global_save_offset = stream.getFilePointer();
- stream.seek(0L);
- int endian = stream.readUnsignedShort();
- if (!isValidEndianTag(endian)) {
- throw new
- IllegalArgumentException("Bad endianness tag (not 0x4949 or 0x4d4d).");
- }
- isBigEndian = (endian == 0x4d4d);
-
- // Seek to the first IFD.
- stream.seek(ifd_offset);
-
- // Seek to desired IFD if necessary.
- int dirNum = 0;
- while(dirNum < directory) {
- // Get the number of fields in the current IFD.
- int numEntries = readUnsignedShort(stream);
-
- // Skip to the next IFD offset value field.
- stream.seek(ifd_offset + 12*numEntries);
-
- // Read the offset to the next IFD beyond this one.
- ifd_offset = readUnsignedInt(stream);
-
- // Seek to the next IFD.
- stream.seek(ifd_offset);
-
- // Increment the directory.
- dirNum++;
- }
-
- initialize(stream);
- stream.seek(global_save_offset);
- }
-
- private static final int[] sizeOfType = {
- 0, // 0 = n/a
- 1, // 1 = byte
- 1, // 2 = ascii
- 2, // 3 = short
- 4, // 4 = long
- 8, // 5 = rational
- 1, // 6 = sbyte
- 1, // 7 = undefined
- 2, // 8 = sshort
- 4, // 9 = slong
- 8, // 10 = srational
- 4, // 11 = float
- 8 // 12 = double
- };
-
- private void initialize(RandomAccessFileOrArray stream) throws IOException {
- long nextTagOffset = 0L;
- long maxOffset = (long) stream.length();
- int i, j;
-
- IFDOffset = stream.getFilePointer();
-
- numEntries = readUnsignedShort(stream);
- fields = new TIFFField[numEntries];
-
- for (i = 0; (i < numEntries) && (nextTagOffset < maxOffset); i++) {
- int tag = readUnsignedShort(stream);
- int type = readUnsignedShort(stream);
- int count = (int)(readUnsignedInt(stream));
- int value = 0;
- boolean processTag = true;
-
- // The place to return to to read the next tag
- nextTagOffset = stream.getFilePointer() + 4;
-
- try {
- // If the tag data can't fit in 4 bytes, the next 4 bytes
- // contain the starting offset of the data
- if (count*sizeOfType[type] > 4) {
- long valueOffset = readUnsignedInt(stream);
-
- // bounds check offset for EOF
- if (valueOffset < maxOffset) {
- stream.seek(valueOffset);
- }
- else {
- // bad offset pointer .. skip tag
- processTag = false;
- }
- }
- } catch (ArrayIndexOutOfBoundsException ae) {
- // if the data type is unknown we should skip this TIFF Field
- processTag = false;
- }
-
- if (processTag) {
- fieldIndex.put(new Integer(tag), new Integer(i));
- Object obj = null;
-
- switch (type) {
- case TIFFField.TIFF_BYTE:
- case TIFFField.TIFF_SBYTE:
- case TIFFField.TIFF_UNDEFINED:
- case TIFFField.TIFF_ASCII:
- byte[] bvalues = new byte[count];
- stream.readFully(bvalues, 0, count);
-
- if (type == TIFFField.TIFF_ASCII) {
-
- // Can be multiple strings
- int index = 0, prevIndex = 0;
- ArrayList v = new ArrayList();
-
- while (index < count) {
-
- while ((index < count) && (bvalues[index++] != 0));
-
- // When we encountered zero, means one string has ended
- v.add(new String(bvalues, prevIndex,
- (index - prevIndex)) );
- prevIndex = index;
- }
-
- count = v.size();
- String strings[] = new String[count];
- for (int c = 0 ; c < count; c++) {
- strings[c] = (String)v.get(c);
- }
-
- obj = strings;
- } else {
- obj = bvalues;
- }
-
- break;
-
- case TIFFField.TIFF_SHORT:
- char[] cvalues = new char[count];
- for (j = 0; j < count; j++) {
- cvalues[j] = (char)(readUnsignedShort(stream));
- }
- obj = cvalues;
- break;
-
- case TIFFField.TIFF_LONG:
- long[] lvalues = new long[count];
- for (j = 0; j < count; j++) {
- lvalues[j] = readUnsignedInt(stream);
- }
- obj = lvalues;
- break;
-
- case TIFFField.TIFF_RATIONAL:
- long[][] llvalues = new long[count][2];
- for (j = 0; j < count; j++) {
- llvalues[j][0] = readUnsignedInt(stream);
- llvalues[j][1] = readUnsignedInt(stream);
- }
- obj = llvalues;
- break;
-
- case TIFFField.TIFF_SSHORT:
- short[] svalues = new short[count];
- for (j = 0; j < count; j++) {
- svalues[j] = readShort(stream);
- }
- obj = svalues;
- break;
-
- case TIFFField.TIFF_SLONG:
- int[] ivalues = new int[count];
- for (j = 0; j < count; j++) {
- ivalues[j] = readInt(stream);
- }
- obj = ivalues;
- break;
-
- case TIFFField.TIFF_SRATIONAL:
- int[][] iivalues = new int[count][2];
- for (j = 0; j < count; j++) {
- iivalues[j][0] = readInt(stream);
- iivalues[j][1] = readInt(stream);
- }
- obj = iivalues;
- break;
-
- case TIFFField.TIFF_FLOAT:
- float[] fvalues = new float[count];
- for (j = 0; j < count; j++) {
- fvalues[j] = readFloat(stream);
- }
- obj = fvalues;
- break;
-
- case TIFFField.TIFF_DOUBLE:
- double[] dvalues = new double[count];
- for (j = 0; j < count; j++) {
- dvalues[j] = readDouble(stream);
- }
- obj = dvalues;
- break;
-
- default:
- break;
- }
-
- fields[i] = new TIFFField(tag, type, count, obj);
- }
-
- stream.seek(nextTagOffset);
- }
-
- // Read the offset of the next IFD.
- nextIFDOffset = readUnsignedInt(stream);
- }
-
- /** Returns the number of directory entries. */
- public int getNumEntries() {
- return numEntries;
- }
-
- /**
- * Returns the value of a given tag as a TIFFField,
- * or null if the tag is not present.
- */
- public TIFFField getField(int tag) {
- Integer i = (Integer)fieldIndex.get(new Integer(tag));
- if (i == null) {
- return null;
- } else {
- return fields[i.intValue()];
- }
- }
-
- /**
- * Returns true if a tag appears in the directory.
- */
- public boolean isTagPresent(int tag) {
- return fieldIndex.containsKey(new Integer(tag));
- }
-
- /**
- * Returns an ordered array of ints indicating the tag
- * values.
- */
- public int[] getTags() {
- int[] tags = new int[fieldIndex.size()];
- Enumeration e = fieldIndex.keys();
- int i = 0;
-
- while (e.hasMoreElements()) {
- tags[i++] = ((Integer)e.nextElement()).intValue();
- }
-
- return tags;
- }
-
- /**
- * Returns an array of TIFFFields containing all the fields
- * in this directory.
- */
- public TIFFField[] getFields() {
- return fields;
- }
-
- /**
- * Returns the value of a particular index of a given tag as a
- * byte. The caller is responsible for ensuring that the tag is
- * present and has type TIFFField.TIFF_SBYTE, TIFF_BYTE, or
- * TIFF_UNDEFINED.
- */
- public byte getFieldAsByte(int tag, int index) {
- Integer i = (Integer)fieldIndex.get(new Integer(tag));
- byte [] b = (fields[i.intValue()]).getAsBytes();
- return b[index];
- }
-
- /**
- * Returns the value of index 0 of a given tag as a
- * byte. The caller is responsible for ensuring that the tag is
- * present and has type TIFFField.TIFF_SBYTE, TIFF_BYTE, or
- * TIFF_UNDEFINED.
- */
- public byte getFieldAsByte(int tag) {
- return getFieldAsByte(tag, 0);
- }
-
- /**
- * Returns the value of a particular index of a given tag as a
- * long. The caller is responsible for ensuring that the tag is
- * present and has type TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED,
- * TIFF_SHORT, TIFF_SSHORT, TIFF_SLONG or TIFF_LONG.
- */
- public long getFieldAsLong(int tag, int index) {
- Integer i = (Integer)fieldIndex.get(new Integer(tag));
- return (fields[i.intValue()]).getAsLong(index);
- }
-
- /**
- * Returns the value of index 0 of a given tag as a
- * long. The caller is responsible for ensuring that the tag is
- * present and has type TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED,
- * TIFF_SHORT, TIFF_SSHORT, TIFF_SLONG or TIFF_LONG.
- */
- public long getFieldAsLong(int tag) {
- return getFieldAsLong(tag, 0);
- }
-
- /**
- * Returns the value of a particular index of a given tag as a
- * float. The caller is responsible for ensuring that the tag is
- * present and has numeric type (all but TIFF_UNDEFINED and
- * TIFF_ASCII).
- */
- public float getFieldAsFloat(int tag, int index) {
- Integer i = (Integer)fieldIndex.get(new Integer(tag));
- return fields[i.intValue()].getAsFloat(index);
- }
-
- /**
- * Returns the value of index 0 of a given tag as a float. The
- * caller is responsible for ensuring that the tag is present and
- * has numeric type (all but TIFF_UNDEFINED and TIFF_ASCII).
- */
- public float getFieldAsFloat(int tag) {
- return getFieldAsFloat(tag, 0);
- }
-
- /**
- * Returns the value of a particular index of a given tag as a
- * double. The caller is responsible for ensuring that the tag is
- * present and has numeric type (all but TIFF_UNDEFINED and
- * TIFF_ASCII).
- */
- public double getFieldAsDouble(int tag, int index) {
- Integer i = (Integer)fieldIndex.get(new Integer(tag));
- return fields[i.intValue()].getAsDouble(index);
- }
-
- /**
- * Returns the value of index 0 of a given tag as a double. The
- * caller is responsible for ensuring that the tag is present and
- * has numeric type (all but TIFF_UNDEFINED and TIFF_ASCII).
- */
- public double getFieldAsDouble(int tag) {
- return getFieldAsDouble(tag, 0);
- }
-
- // Methods to read primitive data types from the stream
-
- private short readShort(RandomAccessFileOrArray stream)
- throws IOException {
- if (isBigEndian) {
- return stream.readShort();
- } else {
- return stream.readShortLE();
- }
- }
-
- private int readUnsignedShort(RandomAccessFileOrArray stream)
- throws IOException {
- if (isBigEndian) {
- return stream.readUnsignedShort();
- } else {
- return stream.readUnsignedShortLE();
- }
- }
-
- private int readInt(RandomAccessFileOrArray stream)
- throws IOException {
- if (isBigEndian) {
- return stream.readInt();
- } else {
- return stream.readIntLE();
- }
- }
-
- private long readUnsignedInt(RandomAccessFileOrArray stream)
- throws IOException {
- if (isBigEndian) {
- return stream.readUnsignedInt();
- } else {
- return stream.readUnsignedIntLE();
- }
- }
-
- private long readLong(RandomAccessFileOrArray stream)
- throws IOException {
- if (isBigEndian) {
- return stream.readLong();
- } else {
- return stream.readLongLE();
- }
- }
-
- private float readFloat(RandomAccessFileOrArray stream)
- throws IOException {
- if (isBigEndian) {
- return stream.readFloat();
- } else {
- return stream.readFloatLE();
- }
- }
-
- private double readDouble(RandomAccessFileOrArray stream)
- throws IOException {
- if (isBigEndian) {
- return stream.readDouble();
- } else {
- return stream.readDoubleLE();
- }
- }
-
- private static int readUnsignedShort(RandomAccessFileOrArray stream,
- boolean isBigEndian)
- throws IOException {
- if (isBigEndian) {
- return stream.readUnsignedShort();
- } else {
- return stream.readUnsignedShortLE();
- }
- }
-
- private static long readUnsignedInt(RandomAccessFileOrArray stream,
- boolean isBigEndian)
- throws IOException {
- if (isBigEndian) {
- return stream.readUnsignedInt();
- } else {
- return stream.readUnsignedIntLE();
- }
- }
-
- // Utilities
-
- /**
- * Returns the number of image directories (subimages) stored in a
- * given TIFF file, represented by a <code>SeekableStream</code>.
- */
- public static int getNumDirectories(RandomAccessFileOrArray stream)
- throws IOException{
- long pointer = stream.getFilePointer(); // Save stream pointer
-
- stream.seek(0L);
- int endian = stream.readUnsignedShort();
- if (!isValidEndianTag(endian)) {
- throw new
- IllegalArgumentException("Bad endianness tag (not 0x4949 or 0x4d4d).");
- }
- boolean isBigEndian = (endian == 0x4d4d);
- int magic = readUnsignedShort(stream, isBigEndian);
- if (magic != 42) {
- throw new
- IllegalArgumentException("Bad magic number, should be 42.");
- }
-
- stream.seek(4L);
- long offset = readUnsignedInt(stream, isBigEndian);
-
- int numDirectories = 0;
- while (offset != 0L) {
- ++numDirectories;
-
- // EOFException means IFD was probably not properly terminated.
- try {
- stream.seek(offset);
- int entries = readUnsignedShort(stream, isBigEndian);
- stream.skip(12*entries);
- offset = readUnsignedInt(stream, isBigEndian);
- } catch(EOFException eof) {
- numDirectories--;
- break;
- }
- }
-
- stream.seek(pointer); // Reset stream pointer
- return numDirectories;
- }
-
- /**
- * Returns a boolean indicating whether the byte order used in the
- * the TIFF file is big-endian (i.e. whether the byte order is from
- * the most significant to the least significant)
- */
- public boolean isBigEndian() {
- return isBigEndian;
- }
-
- /**
- * Returns the offset of the IFD corresponding to this
- * <code>TIFFDirectory</code>.
- */
- public long getIFDOffset() {
- return IFDOffset;
- }
-
- /**
- * Returns the offset of the next IFD after the IFD corresponding to this
- * <code>TIFFDirectory</code>.
- */
- public long getNextIFDOffset() {
- return nextIFDOffset;
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/TIFFFaxDecoder.java b/LibrarySource/com/lowagie/text/pdf/codec/TIFFFaxDecoder.java
deleted file mode 100644
index e124303..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/TIFFFaxDecoder.java
+++ /dev/null
@@ -1,1480 +0,0 @@
-/*
- * Copyright (c) 2001 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * -Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * -Redistribution in binary form must reproduct the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
- * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
- * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
- * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
- * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
- * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
- * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
- * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
- * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that Software is not designed,licensed or intended for use in
- * the design, construction, operation or maintenance of any nuclear facility.
- */
-package com.lowagie.text.pdf.codec;
-
-public class TIFFFaxDecoder {
-
- private int bitPointer, bytePointer;
- private byte[] data;
- private int w, h;
- private int fillOrder;
-
- // Data structures needed to store changing elements for the previous
- // and the current scanline
- private int changingElemSize = 0;
- private int prevChangingElems[];
- private int currChangingElems[];
-
- // Element at which to start search in getNextChangingElement
- private int lastChangingElement = 0;
-
- private int compression = 2;
-
- // Variables set by T4Options
- private int uncompressedMode = 0;
- private int fillBits = 0;
- private int oneD;
-
- static int table1[] = {
- 0x00, // 0 bits are left in first byte - SHOULD NOT HAPPEN
- 0x01, // 1 bits are left in first byte
- 0x03, // 2 bits are left in first byte
- 0x07, // 3 bits are left in first byte
- 0x0f, // 4 bits are left in first byte
- 0x1f, // 5 bits are left in first byte
- 0x3f, // 6 bits are left in first byte
- 0x7f, // 7 bits are left in first byte
- 0xff // 8 bits are left in first byte
- };
-
- static int table2[] = {
- 0x00, // 0
- 0x80, // 1
- 0xc0, // 2
- 0xe0, // 3
- 0xf0, // 4
- 0xf8, // 5
- 0xfc, // 6
- 0xfe, // 7
- 0xff // 8
- };
-
- // Table to be used when fillOrder = 2, for flipping bytes.
- static byte flipTable[] = {
- 0, -128, 64, -64, 32, -96, 96, -32,
- 16, -112, 80, -48, 48, -80, 112, -16,
- 8, -120, 72, -56, 40, -88, 104, -24,
- 24, -104, 88, -40, 56, -72, 120, -8,
- 4, -124, 68, -60, 36, -92, 100, -28,
- 20, -108, 84, -44, 52, -76, 116, -12,
- 12, -116, 76, -52, 44, -84, 108, -20,
- 28, -100, 92, -36, 60, -68, 124, -4,
- 2, -126, 66, -62, 34, -94, 98, -30,
- 18, -110, 82, -46, 50, -78, 114, -14,
- 10, -118, 74, -54, 42, -86, 106, -22,
- 26, -102, 90, -38, 58, -70, 122, -6,
- 6, -122, 70, -58, 38, -90, 102, -26,
- 22, -106, 86, -42, 54, -74, 118, -10,
- 14, -114, 78, -50, 46, -82, 110, -18,
- 30, -98, 94, -34, 62, -66, 126, -2,
- 1, -127, 65, -63, 33, -95, 97, -31,
- 17, -111, 81, -47, 49, -79, 113, -15,
- 9, -119, 73, -55, 41, -87, 105, -23,
- 25, -103, 89, -39, 57, -71, 121, -7,
- 5, -123, 69, -59, 37, -91, 101, -27,
- 21, -107, 85, -43, 53, -75, 117, -11,
- 13, -115, 77, -51, 45, -83, 109, -19,
- 29, -99, 93, -35, 61, -67, 125, -3,
- 3, -125, 67, -61, 35, -93, 99, -29,
- 19, -109, 83, -45, 51, -77, 115, -13,
- 11, -117, 75, -53, 43, -85, 107, -21,
- 27, -101, 91, -37, 59, -69, 123, -5,
- 7, -121, 71, -57, 39, -89, 103, -25,
- 23, -105, 87, -41, 55, -73, 119, -9,
- 15, -113, 79, -49, 47, -81, 111, -17,
- 31, -97, 95, -33, 63, -65, 127, -1,
- };
-
- // The main 10 bit white runs lookup table
- static short white[] = {
- // 0 - 7
- 6430, 6400, 6400, 6400, 3225, 3225, 3225, 3225,
- // 8 - 15
- 944, 944, 944, 944, 976, 976, 976, 976,
- // 16 - 23
- 1456, 1456, 1456, 1456, 1488, 1488, 1488, 1488,
- // 24 - 31
- 718, 718, 718, 718, 718, 718, 718, 718,
- // 32 - 39
- 750, 750, 750, 750, 750, 750, 750, 750,
- // 40 - 47
- 1520, 1520, 1520, 1520, 1552, 1552, 1552, 1552,
- // 48 - 55
- 428, 428, 428, 428, 428, 428, 428, 428,
- // 56 - 63
- 428, 428, 428, 428, 428, 428, 428, 428,
- // 64 - 71
- 654, 654, 654, 654, 654, 654, 654, 654,
- // 72 - 79
- 1072, 1072, 1072, 1072, 1104, 1104, 1104, 1104,
- // 80 - 87
- 1136, 1136, 1136, 1136, 1168, 1168, 1168, 1168,
- // 88 - 95
- 1200, 1200, 1200, 1200, 1232, 1232, 1232, 1232,
- // 96 - 103
- 622, 622, 622, 622, 622, 622, 622, 622,
- // 104 - 111
- 1008, 1008, 1008, 1008, 1040, 1040, 1040, 1040,
- // 112 - 119
- 44, 44, 44, 44, 44, 44, 44, 44,
- // 120 - 127
- 44, 44, 44, 44, 44, 44, 44, 44,
- // 128 - 135
- 396, 396, 396, 396, 396, 396, 396, 396,
- // 136 - 143
- 396, 396, 396, 396, 396, 396, 396, 396,
- // 144 - 151
- 1712, 1712, 1712, 1712, 1744, 1744, 1744, 1744,
- // 152 - 159
- 846, 846, 846, 846, 846, 846, 846, 846,
- // 160 - 167
- 1264, 1264, 1264, 1264, 1296, 1296, 1296, 1296,
- // 168 - 175
- 1328, 1328, 1328, 1328, 1360, 1360, 1360, 1360,
- // 176 - 183
- 1392, 1392, 1392, 1392, 1424, 1424, 1424, 1424,
- // 184 - 191
- 686, 686, 686, 686, 686, 686, 686, 686,
- // 192 - 199
- 910, 910, 910, 910, 910, 910, 910, 910,
- // 200 - 207
- 1968, 1968, 1968, 1968, 2000, 2000, 2000, 2000,
- // 208 - 215
- 2032, 2032, 2032, 2032, 16, 16, 16, 16,
- // 216 - 223
- 10257, 10257, 10257, 10257, 12305, 12305, 12305, 12305,
- // 224 - 231
- 330, 330, 330, 330, 330, 330, 330, 330,
- // 232 - 239
- 330, 330, 330, 330, 330, 330, 330, 330,
- // 240 - 247
- 330, 330, 330, 330, 330, 330, 330, 330,
- // 248 - 255
- 330, 330, 330, 330, 330, 330, 330, 330,
- // 256 - 263
- 362, 362, 362, 362, 362, 362, 362, 362,
- // 264 - 271
- 362, 362, 362, 362, 362, 362, 362, 362,
- // 272 - 279
- 362, 362, 362, 362, 362, 362, 362, 362,
- // 280 - 287
- 362, 362, 362, 362, 362, 362, 362, 362,
- // 288 - 295
- 878, 878, 878, 878, 878, 878, 878, 878,
- // 296 - 303
- 1904, 1904, 1904, 1904, 1936, 1936, 1936, 1936,
- // 304 - 311
- -18413, -18413, -16365, -16365, -14317, -14317, -10221, -10221,
- // 312 - 319
- 590, 590, 590, 590, 590, 590, 590, 590,
- // 320 - 327
- 782, 782, 782, 782, 782, 782, 782, 782,
- // 328 - 335
- 1584, 1584, 1584, 1584, 1616, 1616, 1616, 1616,
- // 336 - 343
- 1648, 1648, 1648, 1648, 1680, 1680, 1680, 1680,
- // 344 - 351
- 814, 814, 814, 814, 814, 814, 814, 814,
- // 352 - 359
- 1776, 1776, 1776, 1776, 1808, 1808, 1808, 1808,
- // 360 - 367
- 1840, 1840, 1840, 1840, 1872, 1872, 1872, 1872,
- // 368 - 375
- 6157, 6157, 6157, 6157, 6157, 6157, 6157, 6157,
- // 376 - 383
- 6157, 6157, 6157, 6157, 6157, 6157, 6157, 6157,
- // 384 - 391
- -12275, -12275, -12275, -12275, -12275, -12275, -12275, -12275,
- // 392 - 399
- -12275, -12275, -12275, -12275, -12275, -12275, -12275, -12275,
- // 400 - 407
- 14353, 14353, 14353, 14353, 16401, 16401, 16401, 16401,
- // 408 - 415
- 22547, 22547, 24595, 24595, 20497, 20497, 20497, 20497,
- // 416 - 423
- 18449, 18449, 18449, 18449, 26643, 26643, 28691, 28691,
- // 424 - 431
- 30739, 30739, -32749, -32749, -30701, -30701, -28653, -28653,
- // 432 - 439
- -26605, -26605, -24557, -24557, -22509, -22509, -20461, -20461,
- // 440 - 447
- 8207, 8207, 8207, 8207, 8207, 8207, 8207, 8207,
- // 448 - 455
- 72, 72, 72, 72, 72, 72, 72, 72,
- // 456 - 463
- 72, 72, 72, 72, 72, 72, 72, 72,
- // 464 - 471
- 72, 72, 72, 72, 72, 72, 72, 72,
- // 472 - 479
- 72, 72, 72, 72, 72, 72, 72, 72,
- // 480 - 487
- 72, 72, 72, 72, 72, 72, 72, 72,
- // 488 - 495
- 72, 72, 72, 72, 72, 72, 72, 72,
- // 496 - 503
- 72, 72, 72, 72, 72, 72, 72, 72,
- // 504 - 511
- 72, 72, 72, 72, 72, 72, 72, 72,
- // 512 - 519
- 104, 104, 104, 104, 104, 104, 104, 104,
- // 520 - 527
- 104, 104, 104, 104, 104, 104, 104, 104,
- // 528 - 535
- 104, 104, 104, 104, 104, 104, 104, 104,
- // 536 - 543
- 104, 104, 104, 104, 104, 104, 104, 104,
- // 544 - 551
- 104, 104, 104, 104, 104, 104, 104, 104,
- // 552 - 559
- 104, 104, 104, 104, 104, 104, 104, 104,
- // 560 - 567
- 104, 104, 104, 104, 104, 104, 104, 104,
- // 568 - 575
- 104, 104, 104, 104, 104, 104, 104, 104,
- // 576 - 583
- 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107,
- // 584 - 591
- 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107,
- // 592 - 599
- 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107,
- // 600 - 607
- 4107, 4107, 4107, 4107, 4107, 4107, 4107, 4107,
- // 608 - 615
- 266, 266, 266, 266, 266, 266, 266, 266,
- // 616 - 623
- 266, 266, 266, 266, 266, 266, 266, 266,
- // 624 - 631
- 266, 266, 266, 266, 266, 266, 266, 266,
- // 632 - 639
- 266, 266, 266, 266, 266, 266, 266, 266,
- // 640 - 647
- 298, 298, 298, 298, 298, 298, 298, 298,
- // 648 - 655
- 298, 298, 298, 298, 298, 298, 298, 298,
- // 656 - 663
- 298, 298, 298, 298, 298, 298, 298, 298,
- // 664 - 671
- 298, 298, 298, 298, 298, 298, 298, 298,
- // 672 - 679
- 524, 524, 524, 524, 524, 524, 524, 524,
- // 680 - 687
- 524, 524, 524, 524, 524, 524, 524, 524,
- // 688 - 695
- 556, 556, 556, 556, 556, 556, 556, 556,
- // 696 - 703
- 556, 556, 556, 556, 556, 556, 556, 556,
- // 704 - 711
- 136, 136, 136, 136, 136, 136, 136, 136,
- // 712 - 719
- 136, 136, 136, 136, 136, 136, 136, 136,
- // 720 - 727
- 136, 136, 136, 136, 136, 136, 136, 136,
- // 728 - 735
- 136, 136, 136, 136, 136, 136, 136, 136,
- // 736 - 743
- 136, 136, 136, 136, 136, 136, 136, 136,
- // 744 - 751
- 136, 136, 136, 136, 136, 136, 136, 136,
- // 752 - 759
- 136, 136, 136, 136, 136, 136, 136, 136,
- // 760 - 767
- 136, 136, 136, 136, 136, 136, 136, 136,
- // 768 - 775
- 168, 168, 168, 168, 168, 168, 168, 168,
- // 776 - 783
- 168, 168, 168, 168, 168, 168, 168, 168,
- // 784 - 791
- 168, 168, 168, 168, 168, 168, 168, 168,
- // 792 - 799
- 168, 168, 168, 168, 168, 168, 168, 168,
- // 800 - 807
- 168, 168, 168, 168, 168, 168, 168, 168,
- // 808 - 815
- 168, 168, 168, 168, 168, 168, 168, 168,
- // 816 - 823
- 168, 168, 168, 168, 168, 168, 168, 168,
- // 824 - 831
- 168, 168, 168, 168, 168, 168, 168, 168,
- // 832 - 839
- 460, 460, 460, 460, 460, 460, 460, 460,
- // 840 - 847
- 460, 460, 460, 460, 460, 460, 460, 460,
- // 848 - 855
- 492, 492, 492, 492, 492, 492, 492, 492,
- // 856 - 863
- 492, 492, 492, 492, 492, 492, 492, 492,
- // 864 - 871
- 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059,
- // 872 - 879
- 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059,
- // 880 - 887
- 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059,
- // 888 - 895
- 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059,
- // 896 - 903
- 200, 200, 200, 200, 200, 200, 200, 200,
- // 904 - 911
- 200, 200, 200, 200, 200, 200, 200, 200,
- // 912 - 919
- 200, 200, 200, 200, 200, 200, 200, 200,
- // 920 - 927
- 200, 200, 200, 200, 200, 200, 200, 200,
- // 928 - 935
- 200, 200, 200, 200, 200, 200, 200, 200,
- // 936 - 943
- 200, 200, 200, 200, 200, 200, 200, 200,
- // 944 - 951
- 200, 200, 200, 200, 200, 200, 200, 200,
- // 952 - 959
- 200, 200, 200, 200, 200, 200, 200, 200,
- // 960 - 967
- 232, 232, 232, 232, 232, 232, 232, 232,
- // 968 - 975
- 232, 232, 232, 232, 232, 232, 232, 232,
- // 976 - 983
- 232, 232, 232, 232, 232, 232, 232, 232,
- // 984 - 991
- 232, 232, 232, 232, 232, 232, 232, 232,
- // 992 - 999
- 232, 232, 232, 232, 232, 232, 232, 232,
- // 1000 - 1007
- 232, 232, 232, 232, 232, 232, 232, 232,
- // 1008 - 1015
- 232, 232, 232, 232, 232, 232, 232, 232,
- // 1016 - 1023
- 232, 232, 232, 232, 232, 232, 232, 232,
- };
-
- // Additional make up codes for both White and Black runs
- static short additionalMakeup[] = {
- 28679, 28679, 31752, (short)32777,
- (short)33801, (short)34825, (short)35849, (short)36873,
- (short)29703, (short)29703, (short)30727, (short)30727,
- (short)37897, (short)38921, (short)39945, (short)40969
- };
-
- // Initial black run look up table, uses the first 4 bits of a code
- static short initBlack[] = {
- // 0 - 7
- 3226, 6412, 200, 168, 38, 38, 134, 134,
- // 8 - 15
- 100, 100, 100, 100, 68, 68, 68, 68
- };
-
- //
- static short twoBitBlack[] = {292, 260, 226, 226}; // 0 - 3
-
- // Main black run table, using the last 9 bits of possible 13 bit code
- static short black[] = {
- // 0 - 7
- 62, 62, 30, 30, 0, 0, 0, 0,
- // 8 - 15
- 0, 0, 0, 0, 0, 0, 0, 0,
- // 16 - 23
- 0, 0, 0, 0, 0, 0, 0, 0,
- // 24 - 31
- 0, 0, 0, 0, 0, 0, 0, 0,
- // 32 - 39
- 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225,
- // 40 - 47
- 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225,
- // 48 - 55
- 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225,
- // 56 - 63
- 3225, 3225, 3225, 3225, 3225, 3225, 3225, 3225,
- // 64 - 71
- 588, 588, 588, 588, 588, 588, 588, 588,
- // 72 - 79
- 1680, 1680, 20499, 22547, 24595, 26643, 1776, 1776,
- // 80 - 87
- 1808, 1808, -24557, -22509, -20461, -18413, 1904, 1904,
- // 88 - 95
- 1936, 1936, -16365, -14317, 782, 782, 782, 782,
- // 96 - 103
- 814, 814, 814, 814, -12269, -10221, 10257, 10257,
- // 104 - 111
- 12305, 12305, 14353, 14353, 16403, 18451, 1712, 1712,
- // 112 - 119
- 1744, 1744, 28691, 30739, -32749, -30701, -28653, -26605,
- // 120 - 127
- 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061,
- // 128 - 135
- 424, 424, 424, 424, 424, 424, 424, 424,
- // 136 - 143
- 424, 424, 424, 424, 424, 424, 424, 424,
- // 144 - 151
- 424, 424, 424, 424, 424, 424, 424, 424,
- // 152 - 159
- 424, 424, 424, 424, 424, 424, 424, 424,
- // 160 - 167
- 750, 750, 750, 750, 1616, 1616, 1648, 1648,
- // 168 - 175
- 1424, 1424, 1456, 1456, 1488, 1488, 1520, 1520,
- // 176 - 183
- 1840, 1840, 1872, 1872, 1968, 1968, 8209, 8209,
- // 184 - 191
- 524, 524, 524, 524, 524, 524, 524, 524,
- // 192 - 199
- 556, 556, 556, 556, 556, 556, 556, 556,
- // 200 - 207
- 1552, 1552, 1584, 1584, 2000, 2000, 2032, 2032,
- // 208 - 215
- 976, 976, 1008, 1008, 1040, 1040, 1072, 1072,
- // 216 - 223
- 1296, 1296, 1328, 1328, 718, 718, 718, 718,
- // 224 - 231
- 456, 456, 456, 456, 456, 456, 456, 456,
- // 232 - 239
- 456, 456, 456, 456, 456, 456, 456, 456,
- // 240 - 247
- 456, 456, 456, 456, 456, 456, 456, 456,
- // 248 - 255
- 456, 456, 456, 456, 456, 456, 456, 456,
- // 256 - 263
- 326, 326, 326, 326, 326, 326, 326, 326,
- // 264 - 271
- 326, 326, 326, 326, 326, 326, 326, 326,
- // 272 - 279
- 326, 326, 326, 326, 326, 326, 326, 326,
- // 280 - 287
- 326, 326, 326, 326, 326, 326, 326, 326,
- // 288 - 295
- 326, 326, 326, 326, 326, 326, 326, 326,
- // 296 - 303
- 326, 326, 326, 326, 326, 326, 326, 326,
- // 304 - 311
- 326, 326, 326, 326, 326, 326, 326, 326,
- // 312 - 319
- 326, 326, 326, 326, 326, 326, 326, 326,
- // 320 - 327
- 358, 358, 358, 358, 358, 358, 358, 358,
- // 328 - 335
- 358, 358, 358, 358, 358, 358, 358, 358,
- // 336 - 343
- 358, 358, 358, 358, 358, 358, 358, 358,
- // 344 - 351
- 358, 358, 358, 358, 358, 358, 358, 358,
- // 352 - 359
- 358, 358, 358, 358, 358, 358, 358, 358,
- // 360 - 367
- 358, 358, 358, 358, 358, 358, 358, 358,
- // 368 - 375
- 358, 358, 358, 358, 358, 358, 358, 358,
- // 376 - 383
- 358, 358, 358, 358, 358, 358, 358, 358,
- // 384 - 391
- 490, 490, 490, 490, 490, 490, 490, 490,
- // 392 - 399
- 490, 490, 490, 490, 490, 490, 490, 490,
- // 400 - 407
- 4113, 4113, 6161, 6161, 848, 848, 880, 880,
- // 408 - 415
- 912, 912, 944, 944, 622, 622, 622, 622,
- // 416 - 423
- 654, 654, 654, 654, 1104, 1104, 1136, 1136,
- // 424 - 431
- 1168, 1168, 1200, 1200, 1232, 1232, 1264, 1264,
- // 432 - 439
- 686, 686, 686, 686, 1360, 1360, 1392, 1392,
- // 440 - 447
- 12, 12, 12, 12, 12, 12, 12, 12,
- // 448 - 455
- 390, 390, 390, 390, 390, 390, 390, 390,
- // 456 - 463
- 390, 390, 390, 390, 390, 390, 390, 390,
- // 464 - 471
- 390, 390, 390, 390, 390, 390, 390, 390,
- // 472 - 479
- 390, 390, 390, 390, 390, 390, 390, 390,
- // 480 - 487
- 390, 390, 390, 390, 390, 390, 390, 390,
- // 488 - 495
- 390, 390, 390, 390, 390, 390, 390, 390,
- // 496 - 503
- 390, 390, 390, 390, 390, 390, 390, 390,
- // 504 - 511
- 390, 390, 390, 390, 390, 390, 390, 390,
- };
-
- static byte twoDCodes[] = {
- // 0 - 7
- 80, 88, 23, 71, 30, 30, 62, 62,
- // 8 - 15
- 4, 4, 4, 4, 4, 4, 4, 4,
- // 16 - 23
- 11, 11, 11, 11, 11, 11, 11, 11,
- // 24 - 31
- 11, 11, 11, 11, 11, 11, 11, 11,
- // 32 - 39
- 35, 35, 35, 35, 35, 35, 35, 35,
- // 40 - 47
- 35, 35, 35, 35, 35, 35, 35, 35,
- // 48 - 55
- 51, 51, 51, 51, 51, 51, 51, 51,
- // 56 - 63
- 51, 51, 51, 51, 51, 51, 51, 51,
- // 64 - 71
- 41, 41, 41, 41, 41, 41, 41, 41,
- // 72 - 79
- 41, 41, 41, 41, 41, 41, 41, 41,
- // 80 - 87
- 41, 41, 41, 41, 41, 41, 41, 41,
- // 88 - 95
- 41, 41, 41, 41, 41, 41, 41, 41,
- // 96 - 103
- 41, 41, 41, 41, 41, 41, 41, 41,
- // 104 - 111
- 41, 41, 41, 41, 41, 41, 41, 41,
- // 112 - 119
- 41, 41, 41, 41, 41, 41, 41, 41,
- // 120 - 127
- 41, 41, 41, 41, 41, 41, 41, 41,
- };
-
- /**
- * @param fillOrder The fill order of the compressed data bytes.
- * @param w
- * @param h
- */
- public TIFFFaxDecoder(int fillOrder, int w, int h) {
- this.fillOrder = fillOrder;
- this.w = w;
- this.h = h;
-
- this.bitPointer = 0;
- this.bytePointer = 0;
- this.prevChangingElems = new int[w];
- this.currChangingElems = new int[w];
- }
-
- // One-dimensional decoding methods
-
- public void decode1D(byte[] buffer, byte[] compData,
- int startX, int height) {
- this.data = compData;
-
- int lineOffset = 0;
- int scanlineStride = (w + 7)/8;
-
- bitPointer = 0;
- bytePointer = 0;
-
- for (int i = 0; i < height; i++) {
- decodeNextScanline(buffer, lineOffset, startX);
- lineOffset += scanlineStride;
- }
- }
-
- public void decodeNextScanline(byte[] buffer,
- int lineOffset, int bitOffset) {
- int bits = 0, code = 0, isT = 0;
- int current, entry, twoBits;
- boolean isWhite = true;
- int dstEnd = 0;
-
- // Initialize starting of the changing elements array
- changingElemSize = 0;
-
- // While scanline not complete
- while (bitOffset < w) {
- while (isWhite) {
- // White run
- current = nextNBits(10);
- entry = white[current];
-
- // Get the 3 fields from the entry
- isT = entry & 0x0001;
- bits = (entry >>> 1) & 0x0f;
-
- if (bits == 12) { // Additional Make up code
- // Get the next 2 bits
- twoBits = nextLesserThan8Bits(2);
- // Consolidate the 2 new bits and last 2 bits into 4 bits
- current = ((current << 2) & 0x000c) | twoBits;
- entry = additionalMakeup[current];
- bits = (entry >>> 1) & 0x07; // 3 bits 0000 0111
- code = (entry >>> 4) & 0x0fff; // 12 bits
- bitOffset += code; // Skip white run
-
- updatePointer(4 - bits);
- } else if (bits == 0) { // ERROR
- throw new RuntimeException("Invalid code encountered.");
- } else if (bits == 15) { // EOL
- throw new RuntimeException("EOL code word encountered in White run.");
- } else {
- // 11 bits - 0000 0111 1111 1111 = 0x07ff
- code = (entry >>> 5) & 0x07ff;
- bitOffset += code;
-
- updatePointer(10 - bits);
- if (isT == 0) {
- isWhite = false;
- currChangingElems[changingElemSize++] = bitOffset;
- }
- }
- }
-
- // Check whether this run completed one width, if so
- // advance to next byte boundary for compression = 2.
- if (bitOffset == w) {
- if (compression == 2) {
- advancePointer();
- }
- break;
- }
-
- while (isWhite == false) {
- // Black run
- current = nextLesserThan8Bits(4);
- entry = initBlack[current];
-
- // Get the 3 fields from the entry
- isT = entry & 0x0001;
- bits = (entry >>> 1) & 0x000f;
- code = (entry >>> 5) & 0x07ff;
-
- if (code == 100) {
- current = nextNBits(9);
- entry = black[current];
-
- // Get the 3 fields from the entry
- isT = entry & 0x0001;
- bits = (entry >>> 1) & 0x000f;
- code = (entry >>> 5) & 0x07ff;
-
- if (bits == 12) {
- // Additional makeup codes
- updatePointer(5);
- current = nextLesserThan8Bits(4);
- entry = additionalMakeup[current];
- bits = (entry >>> 1) & 0x07; // 3 bits 0000 0111
- code = (entry >>> 4) & 0x0fff; // 12 bits
-
- setToBlack(buffer, lineOffset, bitOffset, code);
- bitOffset += code;
-
- updatePointer(4 - bits);
- } else if (bits == 15) {
- // EOL code
- throw new RuntimeException("EOL code word encountered in Black run.");
- } else {
- setToBlack(buffer, lineOffset, bitOffset, code);
- bitOffset += code;
-
- updatePointer(9 - bits);
- if (isT == 0) {
- isWhite = true;
- currChangingElems[changingElemSize++] = bitOffset;
- }
- }
- } else if (code == 200) {
- // Is a Terminating code
- current = nextLesserThan8Bits(2);
- entry = twoBitBlack[current];
- code = (entry >>> 5) & 0x07ff;
- bits = (entry >>> 1) & 0x0f;
-
- setToBlack(buffer, lineOffset, bitOffset, code);
- bitOffset += code;
-
- updatePointer(2 - bits);
- isWhite = true;
- currChangingElems[changingElemSize++] = bitOffset;
- } else {
- // Is a Terminating code
- setToBlack(buffer, lineOffset, bitOffset, code);
- bitOffset += code;
-
- updatePointer(4 - bits);
- isWhite = true;
- currChangingElems[changingElemSize++] = bitOffset;
- }
- }
-
- // Check whether this run completed one width
- if (bitOffset == w) {
- if (compression == 2) {
- advancePointer();
- }
- break;
- }
- }
-
- currChangingElems[changingElemSize++] = bitOffset;
- }
-
- // Two-dimensional decoding methods
-
- public void decode2D(byte[] buffer,
- byte compData[],
- int startX,
- int height,
- long tiffT4Options) {
- this.data = compData;
- compression = 3;
-
- bitPointer = 0;
- bytePointer = 0;
-
- int scanlineStride = (w + 7)/8;
-
- int a0, a1, b1, b2;
- int[] b = new int[2];
- int entry, code, bits, color;
- boolean isWhite;
- int currIndex = 0;
- int temp[];
-
- // fillBits - dealt with this in readEOL
- // 1D/2D encoding - dealt with this in readEOL
-
- // uncompressedMode - haven't dealt with this yet.
-
-
- oneD = (int)(tiffT4Options & 0x01);
- uncompressedMode = (int)((tiffT4Options & 0x02) >> 1);
- fillBits = (int)((tiffT4Options & 0x04) >> 2);
-
- // The data must start with an EOL code
- if (readEOL(true) != 1) {
- throw new RuntimeException("First scanline must be 1D encoded.");
- }
-
- int lineOffset = 0;
- int bitOffset;
-
- // Then the 1D encoded scanline data will occur, changing elements
- // array gets set.
- decodeNextScanline(buffer, lineOffset, startX);
- lineOffset += scanlineStride;
-
- for (int lines = 1; lines < height; lines++) {
-
- // Every line must begin with an EOL followed by a bit which
- // indicates whether the following scanline is 1D or 2D encoded.
- if (readEOL(false) == 0) {
- // 2D encoded scanline follows
-
- // Initialize previous scanlines changing elements, and
- // initialize current scanline's changing elements array
- temp = prevChangingElems;
- prevChangingElems = currChangingElems;
- currChangingElems = temp;
- currIndex = 0;
-
- // a0 has to be set just before the start of this scanline.
- a0 = -1;
- isWhite = true;
- bitOffset = startX;
-
- lastChangingElement = 0;
-
- while (bitOffset < w) {
- // Get the next changing element
- getNextChangingElement(a0, isWhite, b);
-
- b1 = b[0];
- b2 = b[1];
-
- // Get the next seven bits
- entry = nextLesserThan8Bits(7);
-
- // Run these through the 2DCodes table
- entry = (int)(twoDCodes[entry] & 0xff);
-
- // Get the code and the number of bits used up
- code = (entry & 0x78) >>> 3;
- bits = entry & 0x07;
-
- if (code == 0) {
- if (!isWhite) {
- setToBlack(buffer, lineOffset, bitOffset,
- b2 - bitOffset);
- }
- bitOffset = a0 = b2;
-
- // Set pointer to consume the correct number of bits.
- updatePointer(7 - bits);
- } else if (code == 1) {
- // Horizontal
- updatePointer(7 - bits);
-
- // identify the next 2 codes.
- int number;
- if (isWhite) {
- number = decodeWhiteCodeWord();
- bitOffset += number;
- currChangingElems[currIndex++] = bitOffset;
-
- number = decodeBlackCodeWord();
- setToBlack(buffer, lineOffset, bitOffset, number);
- bitOffset += number;
- currChangingElems[currIndex++] = bitOffset;
- } else {
- number = decodeBlackCodeWord();
- setToBlack(buffer, lineOffset, bitOffset, number);
- bitOffset += number;
- currChangingElems[currIndex++] = bitOffset;
-
- number = decodeWhiteCodeWord();
- bitOffset += number;
- currChangingElems[currIndex++] = bitOffset;
- }
-
- a0 = bitOffset;
- } else if (code <= 8) {
- // Vertical
- a1 = b1 + (code - 5);
-
- currChangingElems[currIndex++] = a1;
-
- // We write the current color till a1 - 1 pos,
- // since a1 is where the next color starts
- if (!isWhite) {
- setToBlack(buffer, lineOffset, bitOffset,
- a1 - bitOffset);
- }
- bitOffset = a0 = a1;
- isWhite = !isWhite;
-
- updatePointer(7 - bits);
- } else {
- throw new RuntimeException("Invalid code encountered while decoding 2D group 3 compressed data.");
- }
- }
-
- // Add the changing element beyond the current scanline for the
- // other color too
- currChangingElems[currIndex++] = bitOffset;
- changingElemSize = currIndex;
- } else {
- // 1D encoded scanline follows
- decodeNextScanline(buffer, lineOffset, startX);
- }
-
- lineOffset += scanlineStride;
- }
- }
-
- public synchronized void decodeT6(byte[] buffer,
- byte[] compData,
- int startX,
- int height,
- long tiffT6Options) {
- this.data = compData;
- compression = 4;
-
- bitPointer = 0;
- bytePointer = 0;
-
- int scanlineStride = (w + 7)/8;
- int bufferOffset = 0;
-
- int a0, a1, b1, b2;
- int entry, code, bits;
- byte color;
- boolean isWhite;
- int currIndex;
- int temp[];
-
- // Return values from getNextChangingElement
- int[] b = new int[2];
-
- // uncompressedMode - have written some code for this, but this
- // has not been tested due to lack of test images using this optional
-
- uncompressedMode = (int)((tiffT6Options & 0x02) >> 1);
-
- // Local cached reference
- int[] cce = currChangingElems;
-
- // Assume invisible preceding row of all white pixels and insert
- // both black and white changing elements beyond the end of this
- // imaginary scanline.
- changingElemSize = 0;
- cce[changingElemSize++] = w;
- cce[changingElemSize++] = w;
-
- int lineOffset = 0;
- int bitOffset;
-
- for (int lines = 0; lines < height; lines++) {
- // a0 has to be set just before the start of the scanline.
- a0 = -1;
- isWhite = true;
-
- // Assign the changing elements of the previous scanline to
- // prevChangingElems and start putting this new scanline's
- // changing elements into the currChangingElems.
- temp = prevChangingElems;
- prevChangingElems = currChangingElems;
- cce = currChangingElems = temp;
- currIndex = 0;
-
- // Start decoding the scanline at startX in the raster
- bitOffset = startX;
-
- // Reset search start position for getNextChangingElement
- lastChangingElement = 0;
-
- // Till one whole scanline is decoded
- while (bitOffset < w) {
- // Get the next changing element
- getNextChangingElement(a0, isWhite, b);
- b1 = b[0];
- b2 = b[1];
-
- // Get the next seven bits
- entry = nextLesserThan8Bits(7);
- // Run these through the 2DCodes table
- entry = (int)(twoDCodes[entry] & 0xff);
-
- // Get the code and the number of bits used up
- code = (entry & 0x78) >>> 3;
- bits = entry & 0x07;
-
- if (code == 0) { // Pass
- // We always assume WhiteIsZero format for fax.
- if (!isWhite) {
- setToBlack(buffer, lineOffset, bitOffset,
- b2 - bitOffset);
- }
- bitOffset = a0 = b2;
-
- // Set pointer to only consume the correct number of bits.
- updatePointer(7 - bits);
- } else if (code == 1) { // Horizontal
- // Set pointer to only consume the correct number of bits.
- updatePointer(7 - bits);
-
- // identify the next 2 alternating color codes.
- int number;
- if (isWhite) {
- // Following are white and black runs
- number = decodeWhiteCodeWord();
- bitOffset += number;
- cce[currIndex++] = bitOffset;
-
- number = decodeBlackCodeWord();
- setToBlack(buffer, lineOffset, bitOffset, number);
- bitOffset += number;
- cce[currIndex++] = bitOffset;
- } else {
- // First a black run and then a white run follows
- number = decodeBlackCodeWord();
- setToBlack(buffer, lineOffset, bitOffset, number);
- bitOffset += number;
- cce[currIndex++] = bitOffset;
-
- number = decodeWhiteCodeWord();
- bitOffset += number;
- cce[currIndex++] = bitOffset;
- }
-
- a0 = bitOffset;
- } else if (code <= 8) { // Vertical
- a1 = b1 + (code - 5);
- cce[currIndex++] = a1;
-
- // We write the current color till a1 - 1 pos,
- // since a1 is where the next color starts
- if (!isWhite) {
- setToBlack(buffer, lineOffset, bitOffset,
- a1 - bitOffset);
- }
- bitOffset = a0 = a1;
- isWhite = !isWhite;
-
- updatePointer(7 - bits);
- } else if (code == 11) {
- if (nextLesserThan8Bits(3) != 7) {
- throw new RuntimeException("Invalid code encountered while decoding 2D group 4 compressed data.");
- }
-
- int zeros = 0;
- boolean exit = false;
-
- while (!exit) {
- while (nextLesserThan8Bits(1) != 1) {
- zeros++;
- }
-
- if (zeros > 5) {
- // Exit code
-
- // Zeros before exit code
- zeros = zeros - 6;
-
- if (!isWhite && (zeros > 0)) {
- cce[currIndex++] = bitOffset;
- }
-
- // Zeros before the exit code
- bitOffset += zeros;
- if (zeros > 0) {
- // Some zeros have been written
- isWhite = true;
- }
-
- // Read in the bit which specifies the color of
- // the following run
- if (nextLesserThan8Bits(1) == 0) {
- if (!isWhite) {
- cce[currIndex++] = bitOffset;
- }
- isWhite = true;
- } else {
- if (isWhite) {
- cce[currIndex++] = bitOffset;
- }
- isWhite = false;
- }
-
- exit = true;
- }
-
- if (zeros == 5) {
- if (!isWhite) {
- cce[currIndex++] = bitOffset;
- }
- bitOffset += zeros;
-
- // Last thing written was white
- isWhite = true;
- } else {
- bitOffset += zeros;
-
- cce[currIndex++] = bitOffset;
- setToBlack(buffer, lineOffset, bitOffset, 1);
- ++bitOffset;
-
- // Last thing written was black
- isWhite = false;
- }
-
- }
- } else {
- throw new RuntimeException("Invalid code encountered while decoding 2D group 4 compressed data.");
- }
- }
-
- // Add the changing element beyond the current scanline for the
- // other color too
- //make sure that the index does not exceed the bounds of the array
- if(currIndex < cce.length)
- cce[currIndex++] = bitOffset;
-
- // Number of changing elements in this scanline.
- changingElemSize = currIndex;
-
- lineOffset += scanlineStride;
- }
- }
-
- private void setToBlack(byte[] buffer,
- int lineOffset, int bitOffset,
- int numBits) {
- int bitNum = 8*lineOffset + bitOffset;
- int lastBit = bitNum + numBits;
-
- int byteNum = bitNum >> 3;
-
- // Handle bits in first byte
- int shift = bitNum & 0x7;
- if (shift > 0) {
- int maskVal = 1 << (7 - shift);
- byte val = buffer[byteNum];
- while (maskVal > 0 && bitNum < lastBit) {
- val |= maskVal;
- maskVal >>= 1;
- ++bitNum;
- }
- buffer[byteNum] = val;
- }
-
- // Fill in 8 bits at a time
- byteNum = bitNum >> 3;
- while (bitNum < lastBit - 7) {
- buffer[byteNum++] = (byte)255;
- bitNum += 8;
- }
-
- // Fill in remaining bits
- while (bitNum < lastBit) {
- byteNum = bitNum >> 3;
- buffer[byteNum] |= 1 << (7 - (bitNum & 0x7));
- ++bitNum;
- }
- }
-
- // Returns run length
- private int decodeWhiteCodeWord() {
- int current, entry, bits, isT, twoBits, code = -1;
- int runLength = 0;
- boolean isWhite = true;
-
- while (isWhite) {
- current = nextNBits(10);
- entry = white[current];
-
- // Get the 3 fields from the entry
- isT = entry & 0x0001;
- bits = (entry >>> 1) & 0x0f;
-
- if (bits == 12) { // Additional Make up code
- // Get the next 2 bits
- twoBits = nextLesserThan8Bits(2);
- // Consolidate the 2 new bits and last 2 bits into 4 bits
- current = ((current << 2) & 0x000c) | twoBits;
- entry = additionalMakeup[current];
- bits = (entry >>> 1) & 0x07; // 3 bits 0000 0111
- code = (entry >>> 4) & 0x0fff; // 12 bits
- runLength += code;
- updatePointer(4 - bits);
- } else if (bits == 0) { // ERROR
- throw new RuntimeException("Invalid code encountered.");
- } else if (bits == 15) { // EOL
- throw new RuntimeException("EOL code word encountered in White run.");
- } else {
- // 11 bits - 0000 0111 1111 1111 = 0x07ff
- code = (entry >>> 5) & 0x07ff;
- runLength += code;
- updatePointer(10 - bits);
- if (isT == 0) {
- isWhite = false;
- }
- }
- }
-
- return runLength;
- }
-
- // Returns run length
- private int decodeBlackCodeWord() {
- int current, entry, bits, isT, twoBits, code = -1;
- int runLength = 0;
- boolean isWhite = false;
-
- while (!isWhite) {
- current = nextLesserThan8Bits(4);
- entry = initBlack[current];
-
- // Get the 3 fields from the entry
- isT = entry & 0x0001;
- bits = (entry >>> 1) & 0x000f;
- code = (entry >>> 5) & 0x07ff;
-
- if (code == 100) {
- current = nextNBits(9);
- entry = black[current];
-
- // Get the 3 fields from the entry
- isT = entry & 0x0001;
- bits = (entry >>> 1) & 0x000f;
- code = (entry >>> 5) & 0x07ff;
-
- if (bits == 12) {
- // Additional makeup codes
- updatePointer(5);
- current = nextLesserThan8Bits(4);
- entry = additionalMakeup[current];
- bits = (entry >>> 1) & 0x07; // 3 bits 0000 0111
- code = (entry >>> 4) & 0x0fff; // 12 bits
- runLength += code;
-
- updatePointer(4 - bits);
- } else if (bits == 15) {
- // EOL code
- throw new RuntimeException("EOL code word encountered in Black run.");
- } else {
- runLength += code;
- updatePointer(9 - bits);
- if (isT == 0) {
- isWhite = true;
- }
- }
- } else if (code == 200) {
- // Is a Terminating code
- current = nextLesserThan8Bits(2);
- entry = twoBitBlack[current];
- code = (entry >>> 5) & 0x07ff;
- runLength += code;
- bits = (entry >>> 1) & 0x0f;
- updatePointer(2 - bits);
- isWhite = true;
- } else {
- // Is a Terminating code
- runLength += code;
- updatePointer(4 - bits);
- isWhite = true;
- }
- }
-
- return runLength;
- }
-
- private int readEOL(boolean isFirstEOL) {
- if (fillBits == 0) {
- int next12Bits = nextNBits(12);
- if (isFirstEOL && next12Bits == 0) {
-
- // Might have the case of EOL padding being used even
- // though it was not flagged in the T4Options field.
- // This was observed to be the case in TIFFs produced
- // by a well known vendor who shall remain nameless.
-
- if(nextNBits(4) == 1) {
-
- // EOL must be padded: reset the fillBits flag.
-
- fillBits = 1;
- return 1;
- }
- }
- if(next12Bits != 1) {
- throw new RuntimeException("Scanline must begin with EOL code word.");
- }
- } else if (fillBits == 1) {
-
- // First EOL code word xxxx 0000 0000 0001 will occur
- // As many fill bits will be present as required to make
- // the EOL code of 12 bits end on a byte boundary.
-
- int bitsLeft = 8 - bitPointer;
-
- if (nextNBits(bitsLeft) != 0) {
- throw new RuntimeException("All fill bits preceding EOL code must be 0.");
- }
-
- // If the number of bitsLeft is less than 8, then to have a 12
- // bit EOL sequence, two more bytes are certainly going to be
- // required. The first of them has to be all zeros, so ensure
- // that.
- if (bitsLeft < 4) {
- if (nextNBits(8) != 0) {
- throw new RuntimeException("All fill bits preceding EOL code must be 0.");
- }
- }
-
- // There might be a random number of fill bytes with 0s, so
- // loop till the EOL of 0000 0001 is found, as long as all
- // the bytes preceding it are 0's.
- int n;
- while ((n = nextNBits(8)) != 1) {
-
- // If not all zeros
- if (n != 0) {
- throw new RuntimeException("All fill bits preceding EOL code must be 0.");
- }
- }
- }
-
- // If one dimensional encoding mode, then always return 1
- if (oneD == 0) {
- return 1;
- } else {
- // Otherwise for 2D encoding mode,
- // The next one bit signifies 1D/2D encoding of next line.
- return nextLesserThan8Bits(1);
- }
- }
-
- private void getNextChangingElement(int a0, boolean isWhite, int[] ret) {
- // Local copies of instance variables
- int[] pce = this.prevChangingElems;
- int ces = this.changingElemSize;
-
- // If the previous match was at an odd element, we still
- // have to search the preceeding element.
- // int start = lastChangingElement & ~0x1;
- int start = lastChangingElement > 0 ? lastChangingElement - 1 : 0;
- if (isWhite) {
- start &= ~0x1; // Search even numbered elements
- } else {
- start |= 0x1; // Search odd numbered elements
- }
-
- int i = start;
- for (; i < ces; i += 2) {
- int temp = pce[i];
- if (temp > a0) {
- lastChangingElement = i;
- ret[0] = temp;
- break;
- }
- }
-
- if (i + 1 < ces) {
- ret[1] = pce[i + 1];
- }
- }
-
- private int nextNBits(int bitsToGet) {
- byte b, next, next2next;
- int l = data.length - 1;
- int bp = this.bytePointer;
-
- if (fillOrder == 1) {
- b = data[bp];
-
- if (bp == l) {
- next = 0x00;
- next2next = 0x00;
- } else if ((bp + 1) == l) {
- next = data[bp + 1];
- next2next = 0x00;
- } else {
- next = data[bp + 1];
- next2next = data[bp + 2];
- }
- } else if (fillOrder == 2) {
- b = flipTable[data[bp] & 0xff];
-
- if (bp == l) {
- next = 0x00;
- next2next = 0x00;
- } else if ((bp + 1) == l) {
- next = flipTable[data[bp + 1] & 0xff];
- next2next = 0x00;
- } else {
- next = flipTable[data[bp + 1] & 0xff];
- next2next = flipTable[data[bp + 2] & 0xff];
- }
- } else {
- throw new RuntimeException("TIFF_FILL_ORDER tag must be either 1 or 2.");
- }
-
- int bitsLeft = 8 - bitPointer;
- int bitsFromNextByte = bitsToGet - bitsLeft;
- int bitsFromNext2NextByte = 0;
- if (bitsFromNextByte > 8) {
- bitsFromNext2NextByte = bitsFromNextByte - 8;
- bitsFromNextByte = 8;
- }
-
- bytePointer++;
-
- int i1 = (b & table1[bitsLeft]) << (bitsToGet - bitsLeft);
- int i2 = (next & table2[bitsFromNextByte]) >>> (8 - bitsFromNextByte);
-
- int i3 = 0;
- if (bitsFromNext2NextByte != 0) {
- i2 <<= bitsFromNext2NextByte;
- i3 = (next2next & table2[bitsFromNext2NextByte]) >>>
- (8 - bitsFromNext2NextByte);
- i2 |= i3;
- bytePointer++;
- bitPointer = bitsFromNext2NextByte;
- } else {
- if (bitsFromNextByte == 8) {
- bitPointer = 0;
- bytePointer++;
- } else {
- bitPointer = bitsFromNextByte;
- }
- }
-
- int i = i1 | i2;
- return i;
- }
-
- private int nextLesserThan8Bits(int bitsToGet) {
- byte b, next;
- int l = data.length - 1;
- int bp = this.bytePointer;
-
- if (fillOrder == 1) {
- b = data[bp];
- if (bp == l) {
- next = 0x00;
- } else {
- next = data[bp + 1];
- }
- } else if (fillOrder == 2) {
- b = flipTable[data[bp] & 0xff];
- if (bp == l) {
- next = 0x00;
- } else {
- next = flipTable[data[bp + 1] & 0xff];
- }
- } else {
- throw new RuntimeException("TIFF_FILL_ORDER tag must be either 1 or 2.");
- }
-
- int bitsLeft = 8 - bitPointer;
- int bitsFromNextByte = bitsToGet - bitsLeft;
-
- int shift = bitsLeft - bitsToGet;
- int i1, i2;
- if (shift >= 0) {
- i1 = (b & table1[bitsLeft]) >>> shift;
- bitPointer += bitsToGet;
- if (bitPointer == 8) {
- bitPointer = 0;
- bytePointer++;
- }
- } else {
- i1 = (b & table1[bitsLeft]) << (-shift);
- i2 = (next & table2[bitsFromNextByte]) >>> (8 - bitsFromNextByte);
-
- i1 |= i2;
- bytePointer++;
- bitPointer = bitsFromNextByte;
- }
-
- return i1;
- }
-
- // Move pointer backwards by given amount of bits
- private void updatePointer(int bitsToMoveBack) {
- int i = bitPointer - bitsToMoveBack;
-
- if (i < 0) {
- bytePointer--;
- bitPointer = 8 + i;
- } else {
- bitPointer = i;
- }
- }
-
- // Move to the next byte boundary
- private boolean advancePointer() {
- if (bitPointer != 0) {
- bytePointer++;
- bitPointer = 0;
- }
-
- return true;
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/TIFFField.java b/LibrarySource/com/lowagie/text/pdf/codec/TIFFField.java
deleted file mode 100644
index 4bfbb50..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/TIFFField.java
+++ /dev/null
@@ -1,472 +0,0 @@
-/*
- * Copyright (c) 2001 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * -Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * -Redistribution in binary form must reproduct the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
- * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
- * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
- * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
- * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
- * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
- * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
- * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
- * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that Software is not designed,licensed or intended for use in
- * the design, construction, operation or maintenance of any nuclear facility.
- */
-package com.lowagie.text.pdf.codec;
-
-import java.io.Serializable;
-
-/**
- * A class representing a field in a TIFF 6.0 Image File Directory.
- *
- * <p> The TIFF file format is described in more detail in the
- * comments for the TIFFDescriptor class.
- *
- * <p> A field in a TIFF Image File Directory (IFD). A field is defined
- * as a sequence of values of identical data type. TIFF 6.0 defines
- * 12 data types, which are mapped internally onto the Java datatypes
- * byte, int, long, float, and double.
- *
- * <p><b> This class is not a committed part of the JAI API. It may
- * be removed or changed in future releases of JAI.</b>
- *
- * @see TIFFDirectory
- */
-public class TIFFField extends Object implements Comparable, Serializable {
-
- /** Flag for 8 bit unsigned integers. */
- public static final int TIFF_BYTE = 1;
-
- /** Flag for null-terminated ASCII strings. */
- public static final int TIFF_ASCII = 2;
-
- /** Flag for 16 bit unsigned integers. */
- public static final int TIFF_SHORT = 3;
-
- /** Flag for 32 bit unsigned integers. */
- public static final int TIFF_LONG = 4;
-
- /** Flag for pairs of 32 bit unsigned integers. */
- public static final int TIFF_RATIONAL = 5;
-
- /** Flag for 8 bit signed integers. */
- public static final int TIFF_SBYTE = 6;
-
- /** Flag for 8 bit uninterpreted bytes. */
- public static final int TIFF_UNDEFINED = 7;
-
- /** Flag for 16 bit signed integers. */
- public static final int TIFF_SSHORT = 8;
-
- /** Flag for 32 bit signed integers. */
- public static final int TIFF_SLONG = 9;
-
- /** Flag for pairs of 32 bit signed integers. */
- public static final int TIFF_SRATIONAL = 10;
-
- /** Flag for 32 bit IEEE floats. */
- public static final int TIFF_FLOAT = 11;
-
- /** Flag for 64 bit IEEE doubles. */
- public static final int TIFF_DOUBLE = 12;
-
- /** The tag number. */
- int tag;
-
- /** The tag type. */
- int type;
-
- /** The number of data items present in the field. */
- int count;
-
- /** The field data. */
- Object data;
-
- /** The default constructor. */
- TIFFField() {}
-
- /**
- * Constructs a TIFFField with arbitrary data. The data
- * parameter must be an array of a Java type appropriate for the
- * type of the TIFF field. Since there is no available 32-bit
- * unsigned datatype, long is used. The mapping between types is
- * as follows:
- *
- * <table border=1>
- * <tr>
- * <th> TIFF type </th> <th> Java type </th>
- * <tr>
- * <td><tt>TIFF_BYTE</tt></td> <td><tt>byte</tt></td>
- * <tr>
- * <td><tt>TIFF_ASCII</tt></td> <td><tt>String</tt></td>
- * <tr>
- * <td><tt>TIFF_SHORT</tt></td> <td><tt>char</tt></td>
- * <tr>
- * <td><tt>TIFF_LONG</tt></td> <td><tt>long</tt></td>
- * <tr>
- * <td><tt>TIFF_RATIONAL</tt></td> <td><tt>long[2]</tt></td>
- * <tr>
- * <td><tt>TIFF_SBYTE</tt></td> <td><tt>byte</tt></td>
- * <tr>
- * <td><tt>TIFF_UNDEFINED</tt></td> <td><tt>byte</tt></td>
- * <tr>
- * <td><tt>TIFF_SSHORT</tt></td> <td><tt>short</tt></td>
- * <tr>
- * <td><tt>TIFF_SLONG</tt></td> <td><tt>int</tt></td>
- * <tr>
- * <td><tt>TIFF_SRATIONAL</tt></td> <td><tt>int[2]</tt></td>
- * <tr>
- * <td><tt>TIFF_FLOAT</tt></td> <td><tt>float</tt></td>
- * <tr>
- * <td><tt>TIFF_DOUBLE</tt></td> <td><tt>double</tt></td>
- * </table>
- */
- public TIFFField(int tag, int type, int count, Object data) {
- this.tag = tag;
- this.type = type;
- this.count = count;
- this.data = data;
- }
-
- /**
- * Returns the tag number, between 0 and 65535.
- */
- public int getTag() {
- return tag;
- }
-
- /**
- * Returns the type of the data stored in the IFD.
- * For a TIFF6.0 file, the value will equal one of the
- * TIFF_ constants defined in this class. For future
- * revisions of TIFF, higher values are possible.
- *
- */
- public int getType() {
- return type;
- }
-
- /**
- * Returns the number of elements in the IFD.
- */
- public int getCount() {
- return count;
- }
-
- /**
- * Returns the data as an uninterpreted array of bytes.
- * The type of the field must be one of TIFF_BYTE, TIFF_SBYTE,
- * or TIFF_UNDEFINED;
- *
- * <p> For data in TIFF_BYTE format, the application must take
- * care when promoting the data to longer integral types
- * to avoid sign extension.
- *
- * <p> A ClassCastException will be thrown if the field is not
- * of type TIFF_BYTE, TIFF_SBYTE, or TIFF_UNDEFINED.
- */
- public byte[] getAsBytes() {
- return (byte[])data;
- }
-
- /**
- * Returns TIFF_SHORT data as an array of chars (unsigned 16-bit
- * integers).
- *
- * <p> A ClassCastException will be thrown if the field is not
- * of type TIFF_SHORT.
- */
- public char[] getAsChars() {
- return (char[])data;
- }
-
- /**
- * Returns TIFF_SSHORT data as an array of shorts (signed 16-bit
- * integers).
- *
- * <p> A ClassCastException will be thrown if the field is not
- * of type TIFF_SSHORT.
- */
- public short[] getAsShorts() {
- return (short[])data;
- }
-
- /**
- * Returns TIFF_SLONG data as an array of ints (signed 32-bit
- * integers).
- *
- * <p> A ClassCastException will be thrown if the field is not
- * of type TIFF_SLONG.
- */
- public int[] getAsInts() {
- return (int[])data;
- }
-
- /**
- * Returns TIFF_LONG data as an array of longs (signed 64-bit
- * integers).
- *
- * <p> A ClassCastException will be thrown if the field is not
- * of type TIFF_LONG.
- */
- public long[] getAsLongs() {
- return (long[])data;
- }
-
- /**
- * Returns TIFF_FLOAT data as an array of floats.
- *
- * <p> A ClassCastException will be thrown if the field is not
- * of type TIFF_FLOAT.
- */
- public float[] getAsFloats() {
- return (float[])data;
- }
-
- /**
- * Returns TIFF_DOUBLE data as an array of doubles.
- *
- * <p> A ClassCastException will be thrown if the field is not
- * of type TIFF_DOUBLE.
- */
- public double[] getAsDoubles() {
- return (double[])data;
- }
-
- /**
- * Returns TIFF_SRATIONAL data as an array of 2-element arrays of ints.
- *
- * <p> A ClassCastException will be thrown if the field is not
- * of type TIFF_SRATIONAL.
- */
- public int[][] getAsSRationals() {
- return (int[][])data;
- }
-
- /**
- * Returns TIFF_RATIONAL data as an array of 2-element arrays of longs.
- *
- * <p> A ClassCastException will be thrown if the field is not
- * of type TIFF_RATTIONAL.
- */
- public long[][] getAsRationals() {
- return (long[][])data;
- }
-
- /**
- * Returns data in TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED, TIFF_SHORT,
- * TIFF_SSHORT, or TIFF_SLONG format as an int.
- *
- * <p> TIFF_BYTE and TIFF_UNDEFINED data are treated as unsigned;
- * that is, no sign extension will take place and the returned
- * value will be in the range [0, 255]. TIFF_SBYTE data will
- * be returned in the range [-128, 127].
- *
- * <p> A ClassCastException will be thrown if the field is not of
- * type TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED, TIFF_SHORT,
- * TIFF_SSHORT, or TIFF_SLONG.
- */
- public int getAsInt(int index) {
- switch (type) {
- case TIFF_BYTE: case TIFF_UNDEFINED:
- return ((byte[])data)[index] & 0xff;
- case TIFF_SBYTE:
- return ((byte[])data)[index];
- case TIFF_SHORT:
- return ((char[])data)[index] & 0xffff;
- case TIFF_SSHORT:
- return ((short[])data)[index];
- case TIFF_SLONG:
- return ((int[])data)[index];
- default:
- throw new ClassCastException();
- }
- }
-
- /**
- * Returns data in TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED, TIFF_SHORT,
- * TIFF_SSHORT, TIFF_SLONG, or TIFF_LONG format as a long.
- *
- * <p> TIFF_BYTE and TIFF_UNDEFINED data are treated as unsigned;
- * that is, no sign extension will take place and the returned
- * value will be in the range [0, 255]. TIFF_SBYTE data will
- * be returned in the range [-128, 127].
- *
- * <p> A ClassCastException will be thrown if the field is not of
- * type TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED, TIFF_SHORT,
- * TIFF_SSHORT, TIFF_SLONG, or TIFF_LONG.
- */
- public long getAsLong(int index) {
- switch (type) {
- case TIFF_BYTE: case TIFF_UNDEFINED:
- return ((byte[])data)[index] & 0xff;
- case TIFF_SBYTE:
- return ((byte[])data)[index];
- case TIFF_SHORT:
- return ((char[])data)[index] & 0xffff;
- case TIFF_SSHORT:
- return ((short[])data)[index];
- case TIFF_SLONG:
- return ((int[])data)[index];
- case TIFF_LONG:
- return ((long[])data)[index];
- default:
- throw new ClassCastException();
- }
- }
-
- /**
- * Returns data in any numerical format as a float. Data in
- * TIFF_SRATIONAL or TIFF_RATIONAL format are evaluated by
- * dividing the numerator into the denominator using
- * double-precision arithmetic and then truncating to single
- * precision. Data in TIFF_SLONG, TIFF_LONG, or TIFF_DOUBLE
- * format may suffer from truncation.
- *
- * <p> A ClassCastException will be thrown if the field is
- * of type TIFF_UNDEFINED or TIFF_ASCII.
- */
- public float getAsFloat(int index) {
- switch (type) {
- case TIFF_BYTE:
- return ((byte[])data)[index] & 0xff;
- case TIFF_SBYTE:
- return ((byte[])data)[index];
- case TIFF_SHORT:
- return ((char[])data)[index] & 0xffff;
- case TIFF_SSHORT:
- return ((short[])data)[index];
- case TIFF_SLONG:
- return ((int[])data)[index];
- case TIFF_LONG:
- return ((long[])data)[index];
- case TIFF_FLOAT:
- return ((float[])data)[index];
- case TIFF_DOUBLE:
- return (float)((double[])data)[index];
- case TIFF_SRATIONAL:
- int[] ivalue = getAsSRational(index);
- return (float)((double)ivalue[0]/ivalue[1]);
- case TIFF_RATIONAL:
- long[] lvalue = getAsRational(index);
- return (float)((double)lvalue[0]/lvalue[1]);
- default:
- throw new ClassCastException();
- }
- }
-
- /**
- * Returns data in any numerical format as a float. Data in
- * TIFF_SRATIONAL or TIFF_RATIONAL format are evaluated by
- * dividing the numerator into the denominator using
- * double-precision arithmetic.
- *
- * <p> A ClassCastException will be thrown if the field is of
- * type TIFF_UNDEFINED or TIFF_ASCII.
- */
- public double getAsDouble(int index) {
- switch (type) {
- case TIFF_BYTE:
- return ((byte[])data)[index] & 0xff;
- case TIFF_SBYTE:
- return ((byte[])data)[index];
- case TIFF_SHORT:
- return ((char[])data)[index] & 0xffff;
- case TIFF_SSHORT:
- return ((short[])data)[index];
- case TIFF_SLONG:
- return ((int[])data)[index];
- case TIFF_LONG:
- return ((long[])data)[index];
- case TIFF_FLOAT:
- return ((float[])data)[index];
- case TIFF_DOUBLE:
- return ((double[])data)[index];
- case TIFF_SRATIONAL:
- int[] ivalue = getAsSRational(index);
- return (double)ivalue[0]/ivalue[1];
- case TIFF_RATIONAL:
- long[] lvalue = getAsRational(index);
- return (double)lvalue[0]/lvalue[1];
- default:
- throw new ClassCastException();
- }
- }
-
- /**
- * Returns a TIFF_ASCII data item as a String.
- *
- * <p> A ClassCastException will be thrown if the field is not
- * of type TIFF_ASCII.
- */
- public String getAsString(int index) {
- return ((String[])data)[index];
- }
-
- /**
- * Returns a TIFF_SRATIONAL data item as a two-element array
- * of ints.
- *
- * <p> A ClassCastException will be thrown if the field is not
- * of type TIFF_SRATIONAL.
- */
- public int[] getAsSRational(int index) {
- return ((int[][])data)[index];
- }
-
- /**
- * Returns a TIFF_RATIONAL data item as a two-element array
- * of ints.
- *
- * <p> A ClassCastException will be thrown if the field is not
- * of type TIFF_RATIONAL.
- */
- public long[] getAsRational(int index) {
- return ((long[][])data)[index];
- }
-
- /**
- * Compares this <code>TIFFField</code> with another
- * <code>TIFFField</code> by comparing the tags.
- *
- * <p><b>Note: this class has a natural ordering that is inconsistent
- * with <code>equals()</code>.</b>
- *
- * @throws IllegalArgumentException if the parameter is <code>null</code>.
- * @throws ClassCastException if the parameter is not a
- * <code>TIFFField</code>.
- */
- public int compareTo(Object o) {
- if(o == null) {
- throw new IllegalArgumentException();
- }
-
- int oTag = ((TIFFField)o).getTag();
-
- if(tag < oTag) {
- return -1;
- } else if(tag > oTag) {
- return 1;
- } else {
- return 0;
- }
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/TIFFLZWDecoder.java b/LibrarySource/com/lowagie/text/pdf/codec/TIFFLZWDecoder.java
deleted file mode 100644
index f3586e1..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/TIFFLZWDecoder.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (c) 2001 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * -Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * -Redistribution in binary form must reproduct the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
- * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
- * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
- * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
- * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
- * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
- * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
- * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
- * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that Software is not designed,licensed or intended for use in
- * the design, construction, operation or maintenance of any nuclear facility.
- */
-package com.lowagie.text.pdf.codec;
-
-/**
- * A class for performing LZW decoding.
- *
- *
- */
-public class TIFFLZWDecoder {
-
- byte stringTable[][];
- byte data[] = null, uncompData[];
- int tableIndex, bitsToGet = 9;
- int bytePointer, bitPointer;
- int dstIndex;
- int w, h;
- int predictor, samplesPerPixel;
- int nextData = 0;
- int nextBits = 0;
-
- int andTable[] = {
- 511,
- 1023,
- 2047,
- 4095
- };
-
- public TIFFLZWDecoder(int w, int predictor, int samplesPerPixel) {
- this.w = w;
- this.predictor = predictor;
- this.samplesPerPixel = samplesPerPixel;
- }
-
- /**
- * Method to decode LZW compressed data.
- *
- * @param data The compressed data.
- * @param uncompData Array to return the uncompressed data in.
- * @param h The number of rows the compressed data contains.
- */
- public byte[] decode(byte data[], byte uncompData[], int h) {
-
- if(data[0] == (byte)0x00 && data[1] == (byte)0x01) {
- throw new UnsupportedOperationException("TIFF 5.0-style LZW codes are not supported.");
- }
-
- initializeStringTable();
-
- this.data = data;
- this.h = h;
- this.uncompData = uncompData;
-
- // Initialize pointers
- bytePointer = 0;
- bitPointer = 0;
- dstIndex = 0;
-
-
- nextData = 0;
- nextBits = 0;
-
- int code, oldCode = 0;
- byte string[];
-
- while ( ((code = getNextCode()) != 257) &&
- dstIndex < uncompData.length) {
-
- if (code == 256) {
-
- initializeStringTable();
- code = getNextCode();
-
- if (code == 257) {
- break;
- }
-
- writeString(stringTable[code]);
- oldCode = code;
-
- } else {
-
- if (code < tableIndex) {
-
- string = stringTable[code];
-
- writeString(string);
- addStringToTable(stringTable[oldCode], string[0]);
- oldCode = code;
-
- } else {
-
- string = stringTable[oldCode];
- string = composeString(string, string[0]);
- writeString(string);
- addStringToTable(string);
- oldCode = code;
- }
-
- }
-
- }
-
- // Horizontal Differencing Predictor
- if (predictor == 2) {
-
- int count;
- for (int j = 0; j < h; j++) {
-
- count = samplesPerPixel * (j * w + 1);
-
- for (int i = samplesPerPixel; i < w * samplesPerPixel; i++) {
-
- uncompData[count] += uncompData[count - samplesPerPixel];
- count++;
- }
- }
- }
-
- return uncompData;
- }
-
-
- /**
- * Initialize the string table.
- */
- public void initializeStringTable() {
-
- stringTable = new byte[4096][];
-
- for (int i=0; i<256; i++) {
- stringTable[i] = new byte[1];
- stringTable[i][0] = (byte)i;
- }
-
- tableIndex = 258;
- bitsToGet = 9;
- }
-
- /**
- * Write out the string just uncompressed.
- */
- public void writeString(byte string[]) {
-
- for (int i=0; i<string.length; i++) {
- uncompData[dstIndex++] = string[i];
- }
- }
-
- /**
- * Add a new string to the string table.
- */
- public void addStringToTable(byte oldString[], byte newString) {
- int length = oldString.length;
- byte string[] = new byte[length + 1];
- System.arraycopy(oldString, 0, string, 0, length);
- string[length] = newString;
-
- // Add this new String to the table
- stringTable[tableIndex++] = string;
-
- if (tableIndex == 511) {
- bitsToGet = 10;
- } else if (tableIndex == 1023) {
- bitsToGet = 11;
- } else if (tableIndex == 2047) {
- bitsToGet = 12;
- }
- }
-
- /**
- * Add a new string to the string table.
- */
- public void addStringToTable(byte string[]) {
-
- // Add this new String to the table
- stringTable[tableIndex++] = string;
-
- if (tableIndex == 511) {
- bitsToGet = 10;
- } else if (tableIndex == 1023) {
- bitsToGet = 11;
- } else if (tableIndex == 2047) {
- bitsToGet = 12;
- }
- }
-
- /**
- * Append <code>newString</code> to the end of <code>oldString</code>.
- */
- public byte[] composeString(byte oldString[], byte newString) {
- int length = oldString.length;
- byte string[] = new byte[length + 1];
- System.arraycopy(oldString, 0, string, 0, length);
- string[length] = newString;
-
- return string;
- }
-
- // Returns the next 9, 10, 11 or 12 bits
- public int getNextCode() {
- // Attempt to get the next code. The exception is caught to make
- // this robust to cases wherein the EndOfInformation code has been
- // omitted from a strip. Examples of such cases have been observed
- // in practice.
- try {
- nextData = (nextData << 8) | (data[bytePointer++] & 0xff);
- nextBits += 8;
-
- if (nextBits < bitsToGet) {
- nextData = (nextData << 8) | (data[bytePointer++] & 0xff);
- nextBits += 8;
- }
-
- int code =
- (nextData >> (nextBits - bitsToGet)) & andTable[bitsToGet-9];
- nextBits -= bitsToGet;
-
- return code;
- } catch(ArrayIndexOutOfBoundsException e) {
- // Strip not terminated as expected: return EndOfInformation code.
- return 257;
- }
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/TiffImage.java b/LibrarySource/com/lowagie/text/pdf/codec/TiffImage.java
deleted file mode 100644
index 5c05465..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/TiffImage.java
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * Copyright 2003 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf.codec;
-import com.lowagie.text.pdf.*;
-import com.lowagie.text.Image;
-import com.lowagie.text.ExceptionConverter;
-import java.io.*;
-import java.util.zip.*;
-import headless.awt.color.ICC_Profile;
-
-/** Reads TIFF images
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class TiffImage {
-
- /** Gets the number of pages the TIFF document has.
- * @param s the file source
- * @return the number of pages
- */
- public static int getNumberOfPages(RandomAccessFileOrArray s) {
- try {
- return TIFFDirectory.getNumDirectories(s);
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- static int getDpi(TIFFField fd, int resolutionUnit) {
- if (fd == null)
- return 0;
- long res[] = fd.getAsRational(0);
- float frac = (float)res[0] / (float)res[1];
- int dpi = 0;
- switch (resolutionUnit) {
- case TIFFConstants.RESUNIT_INCH:
- case TIFFConstants.RESUNIT_NONE:
- dpi = (int)frac;
- break;
- case TIFFConstants.RESUNIT_CENTIMETER:
- dpi = (int)(frac * 2.54);
- break;
- }
- return dpi;
- }
-
- /** Reads a page from a TIFF image. Direct mode is not used.
- * @param s the file source
- * @param page the page to get. The first page is 1
- * @return the <CODE>Image</CODE>
- */
- public static Image getTiffImage(RandomAccessFileOrArray s, int page) {
- return getTiffImage(s, page, false);
- }
-
- /** Reads a page from a TIFF image.
- * @param s the file source
- * @param page the page to get. The first page is 1
- * @param direct for single strip, CCITT images, generate the image
- * by direct byte copying. It's faster but may not work
- * every time
- * @return the <CODE>Image</CODE>
- */
- public static Image getTiffImage(RandomAccessFileOrArray s, int page, boolean direct) {
- if (page < 1)
- throw new IllegalArgumentException("The page number must be >= 1.");
- try {
- TIFFDirectory dir = new TIFFDirectory(s, page - 1);
- if (dir.isTagPresent(TIFFConstants.TIFFTAG_TILEWIDTH))
- throw new IllegalArgumentException("Tiles are not supported.");
- int compression = (int)dir.getFieldAsLong(TIFFConstants.TIFFTAG_COMPRESSION);
- switch (compression) {
- case TIFFConstants.COMPRESSION_CCITTRLEW:
- case TIFFConstants.COMPRESSION_CCITTRLE:
- case TIFFConstants.COMPRESSION_CCITTFAX3:
- case TIFFConstants.COMPRESSION_CCITTFAX4:
- break;
- default:
- return getTiffImageColor(dir, s);
- }
- Image img = null;
- long tiffT4Options = 0;
- long tiffT6Options = 0;
- int fillOrder = 1;
- int h = (int)dir.getFieldAsLong(TIFFConstants.TIFFTAG_IMAGELENGTH);
- int w = (int)dir.getFieldAsLong(TIFFConstants.TIFFTAG_IMAGEWIDTH);
- int dpiX = 0;
- int dpiY = 0;
- float XYRatio = 0;
- int resolutionUnit = TIFFConstants.RESUNIT_INCH;
- if (dir.isTagPresent(TIFFConstants.TIFFTAG_RESOLUTIONUNIT))
- resolutionUnit = (int)dir.getFieldAsLong(TIFFConstants.TIFFTAG_RESOLUTIONUNIT);
- dpiX = getDpi(dir.getField(TIFFConstants.TIFFTAG_XRESOLUTION), resolutionUnit);
- dpiY = getDpi(dir.getField(TIFFConstants.TIFFTAG_YRESOLUTION), resolutionUnit);
- if (resolutionUnit == TIFFConstants.RESUNIT_NONE) {
- if (dpiY != 0)
- XYRatio = (float)dpiX / (float)dpiY;
- dpiX = 0;
- dpiY = 0;
- }
- long tstrip = 0xFFFFFFFFL;
- if (dir.isTagPresent(TIFFConstants.TIFFTAG_ROWSPERSTRIP))
- tstrip = dir.getFieldAsLong(TIFFConstants.TIFFTAG_ROWSPERSTRIP);
- int rowsStrip = (int)Math.min((long)h, tstrip);
- TIFFField field = dir.getField(TIFFConstants.TIFFTAG_STRIPOFFSETS);
- long offset[] = getArrayLongShort(dir, TIFFConstants.TIFFTAG_STRIPOFFSETS);
- long size[] = getArrayLongShort(dir, TIFFConstants.TIFFTAG_STRIPBYTECOUNTS);
- boolean reverse = false;
- TIFFField fillOrderField = dir.getField(TIFFConstants.TIFFTAG_FILLORDER);
- if (fillOrderField != null)
- fillOrder = fillOrderField.getAsInt(0);
- reverse = (fillOrder == TIFFConstants.FILLORDER_LSB2MSB);
- int params = 0;
- if (dir.isTagPresent(TIFFConstants.TIFFTAG_PHOTOMETRIC)) {
- long photo = dir.getFieldAsLong(TIFFConstants.TIFFTAG_PHOTOMETRIC);
- if (photo == TIFFConstants.PHOTOMETRIC_MINISBLACK)
- params |= Image.CCITT_BLACKIS1;
- }
- int imagecomp = 0;
- switch (compression) {
- case TIFFConstants.COMPRESSION_CCITTRLEW:
- case TIFFConstants.COMPRESSION_CCITTRLE:
- imagecomp = Image.CCITTG3_1D;
- params |= Image.CCITT_ENCODEDBYTEALIGN | Image.CCITT_ENDOFBLOCK;
- break;
- case TIFFConstants.COMPRESSION_CCITTFAX3:
- imagecomp = Image.CCITTG3_1D;
- params |= Image.CCITT_ENDOFLINE | Image.CCITT_ENDOFBLOCK;
- TIFFField t4OptionsField = dir.getField(TIFFConstants.TIFFTAG_GROUP3OPTIONS);
- if (t4OptionsField != null) {
- tiffT4Options = t4OptionsField.getAsLong(0);
- if ((tiffT4Options & TIFFConstants.GROUP3OPT_2DENCODING) != 0)
- compression = Image.CCITTG3_2D;
- if ((tiffT4Options & TIFFConstants.GROUP3OPT_FILLBITS) != 0)
- params |= Image.CCITT_ENCODEDBYTEALIGN;
- }
- break;
- case TIFFConstants.COMPRESSION_CCITTFAX4:
- imagecomp = Image.CCITTG4;
- TIFFField t6OptionsField = dir.getField(TIFFConstants.TIFFTAG_GROUP4OPTIONS);
- if (t6OptionsField != null)
- tiffT6Options = t6OptionsField.getAsLong(0);
- break;
- }
- if (direct && rowsStrip == h) { //single strip, direct
- byte im[] = new byte[(int)size[0]];
- s.seek(offset[0]);
- s.readFully(im);
- img = Image.getInstance((int) w, (int) h, reverse, imagecomp, params, im);
- img.setInverted(true);
- }
- else {
- int rowsLeft = h;
- CCITTG4Encoder g4 = new CCITTG4Encoder((int)w);
- for (int k = 0; k < offset.length; ++k) {
- byte im[] = new byte[(int)size[k]];
- s.seek(offset[k]);
- s.readFully(im);
- int height = Math.min(rowsStrip, rowsLeft);
- TIFFFaxDecoder decoder = new TIFFFaxDecoder(fillOrder, (int)w, height);
- byte outBuf[] = new byte[(w + 7) / 8 * height];
- switch (compression) {
- case TIFFConstants.COMPRESSION_CCITTRLEW:
- case TIFFConstants.COMPRESSION_CCITTRLE:
- decoder.decode1D(outBuf, im, 0, height);
- g4.encodeT6Lines(outBuf, 0, height);
- break;
- case TIFFConstants.COMPRESSION_CCITTFAX3:
- try {
- decoder.decode2D(outBuf, im, 0, height, tiffT4Options);
- }
- catch (Exception e) {
- // let's flip the fill bits and try again...
- tiffT4Options ^= TIFFConstants.GROUP3OPT_FILLBITS;
- try {
- decoder.decode2D(outBuf, im, 0, height, tiffT4Options);
- }
- catch (Exception e2) {
- throw e;
- }
- }
- g4.encodeT6Lines(outBuf, 0, height);
- break;
- case TIFFConstants.COMPRESSION_CCITTFAX4:
- decoder.decodeT6(outBuf, im, 0, height, tiffT6Options);
- g4.encodeT6Lines(outBuf, 0, height);
- break;
- }
- rowsLeft -= rowsStrip;
- }
- byte g4pic[] = g4.close();
- img = Image.getInstance((int) w, (int) h, false, Image.CCITTG4, params & Image.CCITT_BLACKIS1, g4pic);
- }
- img.setDpi(dpiX, dpiY);
- img.setXYRatio(XYRatio);
- if (dir.isTagPresent(TIFFConstants.TIFFTAG_ICCPROFILE)) {
- try {
- TIFFField fd = dir.getField(TIFFConstants.TIFFTAG_ICCPROFILE);
- ICC_Profile icc_prof = ICC_Profile.getInstance(fd.getAsBytes());
- if (icc_prof.getNumComponents() == 1)
- img.tagICC(icc_prof);
- }
- catch (Exception e) {
- //empty
- }
- }
- img.setOriginalType(Image.ORIGINAL_TIFF);
- return img;
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- protected static Image getTiffImageColor(TIFFDirectory dir, RandomAccessFileOrArray s) {
- try {
- int compression = (int)dir.getFieldAsLong(TIFFConstants.TIFFTAG_COMPRESSION);
- int predictor = 1;
- TIFFLZWDecoder lzwDecoder = null;
- switch (compression) {
- case TIFFConstants.COMPRESSION_NONE:
- case TIFFConstants.COMPRESSION_LZW:
- case TIFFConstants.COMPRESSION_PACKBITS:
- case TIFFConstants.COMPRESSION_DEFLATE:
- break;
- default:
- throw new IllegalArgumentException("The compression " + compression + " is not supported.");
- }
- int photometric = (int)dir.getFieldAsLong(TIFFConstants.TIFFTAG_PHOTOMETRIC);
- switch (photometric) {
- case TIFFConstants.PHOTOMETRIC_MINISWHITE:
- case TIFFConstants.PHOTOMETRIC_MINISBLACK:
- case TIFFConstants.PHOTOMETRIC_RGB:
- case TIFFConstants.PHOTOMETRIC_SEPARATED:
- case TIFFConstants.PHOTOMETRIC_PALETTE:
- break;
- default:
- throw new IllegalArgumentException("The photometric " + photometric + " is not supported.");
- }
- if (dir.isTagPresent(TIFFConstants.TIFFTAG_PLANARCONFIG)
- && dir.getFieldAsLong(TIFFConstants.TIFFTAG_PLANARCONFIG) == TIFFConstants.PLANARCONFIG_SEPARATE)
- throw new IllegalArgumentException("Planar images are not supported.");
- if (dir.isTagPresent(TIFFConstants.TIFFTAG_EXTRASAMPLES))
- throw new IllegalArgumentException("Extra samples are not supported.");
- int samplePerPixel = 1;
- if (dir.isTagPresent(TIFFConstants.TIFFTAG_SAMPLESPERPIXEL)) // 1,3,4
- samplePerPixel = (int)dir.getFieldAsLong(TIFFConstants.TIFFTAG_SAMPLESPERPIXEL);
- int bitsPerSample = 1;
- if (dir.isTagPresent(TIFFConstants.TIFFTAG_BITSPERSAMPLE))
- bitsPerSample = (int)dir.getFieldAsLong(TIFFConstants.TIFFTAG_BITSPERSAMPLE);
- switch (bitsPerSample) {
- case 1:
- case 2:
- case 4:
- case 8:
- break;
- default:
- throw new IllegalArgumentException("Bits per sample " + bitsPerSample + " is not supported.");
- }
- Image img = null;
-
- int h = (int)dir.getFieldAsLong(TIFFConstants.TIFFTAG_IMAGELENGTH);
- int w = (int)dir.getFieldAsLong(TIFFConstants.TIFFTAG_IMAGEWIDTH);
- int dpiX = 0;
- int dpiY = 0;
- int resolutionUnit = TIFFConstants.RESUNIT_INCH;
- if (dir.isTagPresent(TIFFConstants.TIFFTAG_RESOLUTIONUNIT))
- resolutionUnit = (int)dir.getFieldAsLong(TIFFConstants.TIFFTAG_RESOLUTIONUNIT);
- dpiX = getDpi(dir.getField(TIFFConstants.TIFFTAG_XRESOLUTION), resolutionUnit);
- dpiY = getDpi(dir.getField(TIFFConstants.TIFFTAG_YRESOLUTION), resolutionUnit);
- int rowsStrip = (int)dir.getFieldAsLong(TIFFConstants.TIFFTAG_ROWSPERSTRIP);
- long offset[] = getArrayLongShort(dir, TIFFConstants.TIFFTAG_STRIPOFFSETS);
- long size[] = getArrayLongShort(dir, TIFFConstants.TIFFTAG_STRIPBYTECOUNTS);
- if (compression == TIFFConstants.COMPRESSION_LZW) {
- TIFFField predictorField = dir.getField(TIFFConstants.TIFFTAG_PREDICTOR);
- if (predictorField != null) {
- predictor = predictorField.getAsInt(0);
- if (predictor != 1 && predictor != 2) {
- throw new RuntimeException("Illegal value for Predictor in TIFF file.");
- }
- if (predictor == 2 && bitsPerSample != 8) {
- throw new RuntimeException(bitsPerSample + "-bit samples are not supported for Horizontal differencing Predictor.");
- }
- }
- lzwDecoder = new TIFFLZWDecoder(w, predictor,
- samplePerPixel);
- }
- int rowsLeft = h;
- ByteArrayOutputStream stream = null;
- DeflaterOutputStream zip = null;
- CCITTG4Encoder g4 = null;
- if (bitsPerSample == 1 && samplePerPixel == 1) {
- g4 = new CCITTG4Encoder(w);
- }
- else {
- stream = new ByteArrayOutputStream();
- zip = new DeflaterOutputStream(stream);
- }
- for (int k = 0; k < offset.length; ++k) {
- byte im[] = new byte[(int)size[k]];
- s.seek(offset[k]);
- s.readFully(im);
- int height = Math.min(rowsStrip, rowsLeft);
- byte outBuf[] = null;
- if (compression != TIFFConstants.COMPRESSION_NONE)
- outBuf = new byte[(w * bitsPerSample * samplePerPixel + 7) / 8 * height];
- switch (compression) {
- case TIFFConstants.COMPRESSION_DEFLATE:
- inflate(im, outBuf);
- break;
- case TIFFConstants.COMPRESSION_NONE:
- outBuf = im;
- break;
- case TIFFConstants.COMPRESSION_PACKBITS:
- decodePackbits(im, outBuf);
- break;
- case TIFFConstants.COMPRESSION_LZW:
- lzwDecoder.decode(im, outBuf, height);
- break;
- }
- if (bitsPerSample == 1 && samplePerPixel == 1) {
- g4.encodeT6Lines(outBuf, 0, height);
- }
- else {
- zip.write(outBuf);
- }
- rowsLeft -= rowsStrip;
- }
- if (bitsPerSample == 1 && samplePerPixel == 1) {
- img = Image.getInstance(w, h, false, Image.CCITTG4,
- photometric == TIFFConstants.PHOTOMETRIC_MINISBLACK ? Image.CCITT_BLACKIS1 : 0, g4.close());
- }
- else {
- zip.close();
- img = Image.getInstance(w, h, samplePerPixel, bitsPerSample, stream.toByteArray());
- img.setDeflated(true);
- }
- img.setDpi(dpiX, dpiY);
- if (dir.isTagPresent(TIFFConstants.TIFFTAG_ICCPROFILE)) {
- try {
- TIFFField fd = dir.getField(TIFFConstants.TIFFTAG_ICCPROFILE);
- ICC_Profile icc_prof = ICC_Profile.getInstance(fd.getAsBytes());
- if (samplePerPixel == icc_prof.getNumComponents())
- img.tagICC(icc_prof);
- }
- catch (Exception e) {
- //empty
- }
- }
- if (dir.isTagPresent(TIFFConstants.TIFFTAG_COLORMAP)) {
- TIFFField fd = dir.getField(TIFFConstants.TIFFTAG_COLORMAP);
- char rgb[] = fd.getAsChars();
- byte palette[] = new byte[rgb.length];
- int gColor = rgb.length / 3;
- int bColor = gColor * 2;
- for (int k = 0; k < gColor; ++k) {
- palette[k * 3] = (byte)(rgb[k] >>> 8);
- palette[k * 3 + 1] = (byte)(rgb[k + gColor] >>> 8);
- palette[k * 3 + 2] = (byte)(rgb[k + bColor] >>> 8);
- }
- PdfArray indexed = new PdfArray();
- indexed.add(PdfName.INDEXED);
- indexed.add(PdfName.DEVICERGB);
- indexed.add(new PdfNumber(gColor - 1));
- indexed.add(new PdfString(palette));
- PdfDictionary additional = new PdfDictionary();
- additional.put(PdfName.COLORSPACE, indexed);
- img.setAdditional(additional);
- }
- if (photometric == TIFFConstants.PHOTOMETRIC_MINISWHITE)
- img.setInverted(true);
- img.setOriginalType(Image.ORIGINAL_TIFF);
- return img;
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
- }
-
- static long[] getArrayLongShort(TIFFDirectory dir, int tag) {
- TIFFField field = dir.getField(tag);
- if (field == null)
- return null;
- long offset[];
- if (field.getType() == TIFFField.TIFF_LONG)
- offset = field.getAsLongs();
- else { // must be short
- char temp[] = field.getAsChars();
- offset = new long[temp.length];
- for (int k = 0; k < temp.length; ++k)
- offset[k] = temp[k];
- }
- return offset;
- }
-
- // Uncompress packbits compressed image data.
- public static void decodePackbits(byte data[], byte[] dst) {
- int srcCount = 0, dstCount = 0;
- byte repeat, b;
-
- while (dstCount < dst.length) {
- b = data[srcCount++];
- if (b >= 0 && b <= 127) {
- // literal run packet
- for (int i=0; i<(b + 1); i++) {
- dst[dstCount++] = data[srcCount++];
- }
-
- } else if (b <= -1 && b >= -127) {
- // 2 byte encoded run packet
- repeat = data[srcCount++];
- for (int i=0; i<(-b + 1); i++) {
- dst[dstCount++] = repeat;
- }
- } else {
- // no-op packet. Do nothing
- srcCount++;
- }
- }
- }
-
- public static void inflate(byte[] deflated, byte[] inflated) {
- Inflater inflater = new Inflater();
- inflater.setInput(deflated);
- try {
- inflater.inflate(inflated);
- }
- catch(DataFormatException dfe) {
- throw new ExceptionConverter(dfe);
- }
- }
-
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/postscript/JavaCharStream.java b/LibrarySource/com/lowagie/text/pdf/codec/postscript/JavaCharStream.java
deleted file mode 100644
index 2950d29..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/postscript/JavaCharStream.java
+++ /dev/null
@@ -1,548 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 2.1 */
-package com.lowagie.text.pdf.codec.postscript;
-
-/**
- * An implementation of interface CharStream, where the stream is assumed to
- * contain only ASCII characters (with java-like unicode escape processing).
- */
-
-public final class JavaCharStream
-{
- public static final boolean staticFlag = false;
- static final int hexval(char c) throws java.io.IOException {
- switch(c)
- {
- case '0' :
- return 0;
- case '1' :
- return 1;
- case '2' :
- return 2;
- case '3' :
- return 3;
- case '4' :
- return 4;
- case '5' :
- return 5;
- case '6' :
- return 6;
- case '7' :
- return 7;
- case '8' :
- return 8;
- case '9' :
- return 9;
-
- case 'a' :
- case 'A' :
- return 10;
- case 'b' :
- case 'B' :
- return 11;
- case 'c' :
- case 'C' :
- return 12;
- case 'd' :
- case 'D' :
- return 13;
- case 'e' :
- case 'E' :
- return 14;
- case 'f' :
- case 'F' :
- return 15;
- }
-
- throw new java.io.IOException(); // Should never come here
- }
-
- public int bufpos = -1;
- int bufsize;
- int available;
- int tokenBegin;
- private int bufline[];
- private int bufcolumn[];
-
- private int column = 0;
- private int line = 1;
-
- private boolean prevCharIsCR = false;
- private boolean prevCharIsLF = false;
-
- private java.io.Reader inputStream;
-
- private char[] nextCharBuf;
- private char[] buffer;
- private int maxNextCharInd = 0;
- private int nextCharInd = -1;
- private int inBuf = 0;
-
- private final void ExpandBuff(boolean wrapAround)
- {
- char[] newbuffer = new char[bufsize + 2048];
- int newbufline[] = new int[bufsize + 2048];
- int newbufcolumn[] = new int[bufsize + 2048];
-
- try
- {
- if (wrapAround)
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- System.arraycopy(buffer, 0, newbuffer,
- bufsize - tokenBegin, bufpos);
- buffer = newbuffer;
-
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
- bufline = newbufline;
-
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
- bufcolumn = newbufcolumn;
-
- bufpos += (bufsize - tokenBegin);
- }
- else
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- buffer = newbuffer;
-
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- bufline = newbufline;
-
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- bufcolumn = newbufcolumn;
-
- bufpos -= tokenBegin;
- }
- }
- catch (Throwable t)
- {
- throw new Error(t.getMessage());
- }
-
- available = (bufsize += 2048);
- tokenBegin = 0;
- }
-
- private final void FillBuff() throws java.io.IOException
- {
- int i;
- if (maxNextCharInd == 4096)
- maxNextCharInd = nextCharInd = 0;
-
- try {
- if ((i = inputStream.read(nextCharBuf, maxNextCharInd,
- 4096 - maxNextCharInd)) == -1)
- {
- inputStream.close();
- throw new java.io.IOException();
- }
- else
- maxNextCharInd += i;
- return;
- }
- catch(java.io.IOException e) {
- if (bufpos != 0)
- {
- --bufpos;
- backup(0);
- }
- else
- {
- bufline[bufpos] = line;
- bufcolumn[bufpos] = column;
- }
- throw e;
- }
- }
-
- private final char ReadByte() throws java.io.IOException
- {
- if (++nextCharInd >= maxNextCharInd)
- FillBuff();
-
- return nextCharBuf[nextCharInd];
- }
-
- public final char BeginToken() throws java.io.IOException
- {
- if (inBuf > 0)
- {
- --inBuf;
-
- if (++bufpos == bufsize)
- bufpos = 0;
-
- tokenBegin = bufpos;
- return buffer[bufpos];
- }
-
- tokenBegin = 0;
- bufpos = -1;
-
- return readChar();
- }
-
- private final void AdjustBuffSize()
- {
- if (available == bufsize)
- {
- if (tokenBegin > 2048)
- {
- bufpos = 0;
- available = tokenBegin;
- }
- else
- ExpandBuff(false);
- }
- else if (available > tokenBegin)
- available = bufsize;
- else if ((tokenBegin - available) < 2048)
- ExpandBuff(true);
- else
- available = tokenBegin;
- }
-
- private final void UpdateLineColumn(char c)
- {
- column++;
-
- if (prevCharIsLF)
- {
- prevCharIsLF = false;
- line += (column = 1);
- }
- else if (prevCharIsCR)
- {
- prevCharIsCR = false;
- if (c == '\n')
- {
- prevCharIsLF = true;
- }
- else
- line += (column = 1);
- }
-
- switch (c)
- {
- case '\r' :
- prevCharIsCR = true;
- break;
- case '\n' :
- prevCharIsLF = true;
- break;
- case '\t' :
- column--;
- column += (8 - (column & 07));
- break;
- default :
- break;
- }
-
- bufline[bufpos] = line;
- bufcolumn[bufpos] = column;
- }
-
- public final char readChar() throws java.io.IOException
- {
- if (inBuf > 0)
- {
- --inBuf;
-
- if (++bufpos == bufsize)
- bufpos = 0;
-
- return buffer[bufpos];
- }
-
- char c;
-
- if (++bufpos == available)
- AdjustBuffSize();
-
- if ((buffer[bufpos] = c = ReadByte()) == '\\')
- {
- UpdateLineColumn(c);
-
- int backSlashCnt = 1;
-
- for (;;) // Read all the backslashes
- {
- if (++bufpos == available)
- AdjustBuffSize();
-
- try
- {
- if ((buffer[bufpos] = c = ReadByte()) != '\\')
- {
- UpdateLineColumn(c);
- // found a non-backslash char.
- if ((c == 'u') && ((backSlashCnt & 1) == 1))
- {
- if (--bufpos < 0)
- bufpos = bufsize - 1;
-
- break;
- }
-
- backup(backSlashCnt);
- return '\\';
- }
- }
- catch(java.io.IOException e)
- {
- if (backSlashCnt > 1)
- backup(backSlashCnt);
-
- return '\\';
- }
-
- UpdateLineColumn(c);
- backSlashCnt++;
- }
-
- // Here, we have seen an odd number of backslash's followed by a 'u'
- try
- {
- while ((c = ReadByte()) == 'u')
- ++column;
-
- buffer[bufpos] = c = (char)(hexval(c) << 12 |
- hexval(ReadByte()) << 8 |
- hexval(ReadByte()) << 4 |
- hexval(ReadByte()));
-
- column += 4;
- }
- catch(java.io.IOException e)
- {
- throw new Error("Invalid escape character at line " + line +
- " column " + column + ".");
- }
-
- if (backSlashCnt == 1)
- return c;
- else
- {
- backup(backSlashCnt - 1);
- return '\\';
- }
- }
- else
- {
- UpdateLineColumn(c);
- return (c);
- }
- }
-
- /**
- * @deprecated
- * @see #getEndColumn
- */
-
- public final int getColumn() {
- return bufcolumn[bufpos];
- }
-
- /**
- * @deprecated
- * @see #getEndLine
- */
-
- public final int getLine() {
- return bufline[bufpos];
- }
-
- public final int getEndColumn() {
- return bufcolumn[bufpos];
- }
-
- public final int getEndLine() {
- return bufline[bufpos];
- }
-
- public final int getBeginColumn() {
- return bufcolumn[tokenBegin];
- }
-
- public final int getBeginLine() {
- return bufline[tokenBegin];
- }
-
- public final void backup(int amount) {
-
- inBuf += amount;
- if ((bufpos -= amount) < 0)
- bufpos += bufsize;
- }
-
- public JavaCharStream(java.io.Reader dstream,
- int startline, int startcolumn, int buffersize)
- {
- inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
-
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- nextCharBuf = new char[4096];
- }
-
- public JavaCharStream(java.io.Reader dstream,
- int startline, int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
- }
-
- public JavaCharStream(java.io.Reader dstream)
- {
- this(dstream, 1, 1, 4096);
- }
- public void ReInit(java.io.Reader dstream,
- int startline, int startcolumn, int buffersize)
- {
- inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
-
- if (buffer == null || buffersize != buffer.length)
- {
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- nextCharBuf = new char[4096];
- }
- prevCharIsLF = prevCharIsCR = false;
- tokenBegin = inBuf = maxNextCharInd = 0;
- nextCharInd = bufpos = -1;
- }
-
- public void ReInit(java.io.Reader dstream,
- int startline, int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
-
- public void ReInit(java.io.Reader dstream)
- {
- ReInit(dstream, 1, 1, 4096);
- }
- public JavaCharStream(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
- }
-
- public JavaCharStream(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
- }
-
- public JavaCharStream(java.io.InputStream dstream)
- {
- this(dstream, 1, 1, 4096);
- }
-
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
- }
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
- public void ReInit(java.io.InputStream dstream)
- {
- ReInit(dstream, 1, 1, 4096);
- }
-
- public final String GetImage()
- {
- if (bufpos >= tokenBegin)
- return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
- else
- return new String(buffer, tokenBegin, bufsize - tokenBegin) +
- new String(buffer, 0, bufpos + 1);
- }
-
- public final char[] GetSuffix(int len)
- {
- char[] ret = new char[len];
-
- if ((bufpos + 1) >= len)
- System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
- else
- {
- System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
- len - bufpos - 1);
- System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
- }
-
- return ret;
- }
-
- public void Done()
- {
- nextCharBuf = null;
- buffer = null;
- bufline = null;
- bufcolumn = null;
- }
-
- /**
- * Method to adjust line and column numbers for the start of a token.<BR>
- */
- public void adjustBeginLineColumn(int newLine, int newCol)
- {
- int start = tokenBegin;
- int len;
-
- if (bufpos >= tokenBegin)
- {
- len = bufpos - tokenBegin + inBuf + 1;
- }
- else
- {
- len = bufsize - tokenBegin + bufpos + 1 + inBuf;
- }
-
- int i = 0, j = 0, k = 0;
- int nextColDiff = 0, columnDiff = 0;
-
- while (i < len &&
- bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
- {
- bufline[j] = newLine;
- nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
- bufcolumn[j] = newCol + columnDiff;
- columnDiff = nextColDiff;
- i++;
- }
-
- if (i < len)
- {
- bufline[j] = newLine++;
- bufcolumn[j] = newCol + columnDiff;
-
- while (i++ < len)
- {
- if (bufline[j = start % bufsize] != bufline[++start % bufsize])
- bufline[j] = newLine++;
- else
- bufline[j] = newLine;
- }
- }
-
- line = bufline[j];
- column = bufcolumn[j];
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/postscript/MetaDoPS.java b/LibrarySource/com/lowagie/text/pdf/codec/postscript/MetaDoPS.java
deleted file mode 100644
index 543ee35..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/postscript/MetaDoPS.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * $Id: MetaDo.java,v 1.28 2003/05/02 09:01:33 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf.codec.postscript;
-
-import java.io.*;
-import headless.awt.*;
-import com.lowagie.text.*;
-import com.lowagie.text.pdf.*;
-
-public class MetaDoPS {
-
- public PdfContentByte cb;
- InputStream in;
- int left;
- int top;
- int right;
- int bottom;
- int inch;
-
- public MetaDoPS(InputStream in, PdfContentByte cb) {
- this.cb = cb;
- this.in = in;
- }
-
- public void readAll() throws IOException, DocumentException {
-
- cb.saveState();
- java.awt.Graphics2D g2 = cb.createGraphicsShapes(PageSize.A4.
- width(), PageSize.A4.height());
- try {
- PAContext context = new PAContext( (Graphics2D) g2,
- new Dimension( (int) PageSize.A4.width(),
- (int) PageSize.A4.height()));
- context.draw(new BufferedInputStream(in));
- // ( (Graphics2D) backBuffer.getGraphics()).dispose();
- in.close();
- }
- catch (IOException ex) {
- ex.printStackTrace();
- }
- catch (PainterException ex) {
- ex.printStackTrace();
- }
-
- cb.restoreState();
-
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PACommand.java b/LibrarySource/com/lowagie/text/pdf/codec/postscript/PACommand.java
deleted file mode 100644
index 6f52e4a..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PACommand.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 1998 by Sun Microsystems, Inc.,
- * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information
- * of Sun Microsystems, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Sun.
- */
-
-package com.lowagie.text.pdf.codec.postscript;
-
-import java.lang.*;
-
-public interface PACommand {
-
- public void execute(PAContext context) throws PainterException;
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAContext.java b/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAContext.java
deleted file mode 100644
index c998fad..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAContext.java
+++ /dev/null
@@ -1,2053 +0,0 @@
-/*
- * Copyright 1998 by Sun Microsystems, Inc.,
- * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information
- * of Sun Microsystems, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Sun.
- */
-
-package com.lowagie.text.pdf.codec.postscript;
-
-import java.lang.*;
-import java.lang.reflect.*;
-import java.util.*;
-import java.io.*;
-import headless.awt.*;
-import headless.awt.geom.*;
-import headless.awt.color.*;
-import headless.awt.font.*;
-
-public class PAContext
- extends Object {
-
- public PAPencil pencil;
- public Stack dictionaries;
- public Stack operands;
- public PAEngine engine;
- PAParser poorscript = null;
- protected Random randomNumberGenerator;
-
- protected Object lastUnknownIdentifier;
-
- public PAContext(Component component) {
- this(new PAPencil(component));
- }
-
- public PAContext(Graphics2D g, Dimension size) {
- this(new PAPencil(g, size));
- }
-
- public PAContext(PAPencil pencil) {
- super();
- this.pencil = pencil;
- this.dictionaries = new Stack();
- this.operands = new Stack();
- this.engine = new PAEngine(this);
- this.dictionaries.push(this.constructSystemDict());
- this.dictionaries.push(this.constructGlobalDict());
- this.dictionaries.push(new HashMap());
- this.randomNumberGenerator = new Random();
- this.lastUnknownIdentifier = null;
- }
-
- public void draw(InputStream inputStream) throws PainterException {
- try {
-
- poorscript = new PAParser(inputStream);
-
- poorscript.parse(this);
- // pencil.graphics.dispose();
- }
- catch (ParseException e) {
- e.printStackTrace();
- throw new PainterException(e.toString());
- }
- }
-
- public Object getLastUnknownIdentifier() {
- return this.lastUnknownIdentifier;
- }
-
- public double[] popNumberOperands(int n) throws PainterException {
- double[] result = new double[n];
- Object objectValue;
- double doubleValue;
-
- for (int i = n - 1; i >= 0; i--) {
- try {
- objectValue = this.operands.pop();
- }
- catch (EmptyStackException e) {
- throw new PainterException("Operand stack is empty");
- }
- if (objectValue instanceof Number) {
- doubleValue = ( (Number) objectValue).doubleValue();
- }
- else {
- throw new PainterException("Number expected on operand stack");
- }
- result[i] = doubleValue;
- }
- return result;
- }
-
- public Object[] popOperands(int n) throws PainterException {
- Object[] result = new Object[n];
- Object objectValue;
-
- for (int i = n - 1; i >= 0; i--) {
- try {
- objectValue = this.operands.pop();
- }
- catch (EmptyStackException e) {
- throw new PainterException("Operand stack is empty");
- }
- result[i] = objectValue;
- }
- return result;
- }
-
- public Object peekOperand() throws PainterException {
- Object objectValue;
-
- try {
- objectValue = this.operands.peek();
- }
- catch (EmptyStackException e) {
- throw new PainterException("Operand stack is empty");
- }
- return objectValue;
- }
-
- public Object findIdentifier(Object identifier) {
- Object result = null;
- int i, n;
-
- n = this.dictionaries.size();
- i = n - 1;
- while (i >= 0 && result == null) {
- HashMap dictionary = (HashMap)this.dictionaries.elementAt(i);
- result = dictionary.get(identifier);
- i--;
- }
- if (result == null) {
- this.lastUnknownIdentifier = identifier;
- }
- return result;
- }
-
- public Object findDictionary(Object identifier) {
- Object result = null;
- HashMap dictionary = null;
- int i, n;
-
- n = this.dictionaries.size();
- i = n - 1;
- while (i >= 0 && result == null) {
- dictionary = (HashMap)this.dictionaries.elementAt(i);
- result = dictionary.get(identifier);
- i--;
- }
- if (result == null) {
- return result;
- }
- else {
- return dictionary;
- }
- }
-
- public void collectArray() throws PainterException {
- ArrayList result;
- Object objectValue;
- int i, n;
- boolean found = false;
-
- n = this.operands.size();
- for (i = n - 1; i >= 0; i--) {
- objectValue = this.operands.elementAt(i);
- if (objectValue instanceof PAToken &&
- ( (PAToken) objectValue).type == PAToken.START_ARRAY) {
- found = true;
- break;
- }
- }
- if (!found) {
- throw new PainterException("No array was started");
- }
- result = new ArrayList(n - i - 1);
- for (int j = 0; j < n - i - 1; j++) {
- result.add(null);
- }
- for (int j = n - 1; j > i; j--) {
- try {
- objectValue = this.operands.pop();
- }
- catch (EmptyStackException e) {
- throw new PainterException("Operand stack is empty");
- }
- result.set(j - i - 1, objectValue);
- }
- try {
- this.operands.pop(); // the start array mark itself
- }
- catch (EmptyStackException e) {
- throw new PainterException("Operand stack is empty");
- }
- this.operands.push(result);
- }
-
- protected HashMap constructGlobalDict() {
- HashMap globalDict = new HashMap();
-
- return globalDict;
- }
-
- protected HashMap constructSystemDict() {
- HashMap systemDict = new HashMap();
-
- // newpath
- systemDict.put("newpath", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- context.pencil.newpath();
- }
- });
-
- // moveto
- systemDict.put("moveto", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(2);
- context.pencil.moveto(data[0], data[1]);
- }
- });
-
- // rmoveto
- systemDict.put("rmoveto", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(2);
- context.pencil.rmoveto(data[0], data[1]);
- }
- });
-
- // lineto
- systemDict.put("lineto", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(2);
- context.pencil.lineto(data[0], data[1]);
- }
- });
-
- // rlineto
- systemDict.put("rlineto", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(2);
- context.pencil.rlineto(data[0], data[1]);
- }
- });
-
- // arc
- systemDict.put("arc", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(5);
- context.pencil.arc(data[0], data[1], data[2], data[3], data[4]);
- }
- });
-
- // arcn
- systemDict.put("arcn", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(5);
- context.pencil.arcn(data[0], data[1], data[2], data[3], data[4]);
- }
- });
-
- // curveto
- systemDict.put("curveto", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(6);
- context.pencil.curveto(data[0], data[1], data[2], data[3], data[4],
- data[5]);
- }
- });
-
- // rcurveto
- systemDict.put("rcurveto", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(6);
- context.pencil.rcurveto(data[0], data[1], data[2], data[3], data[4],
- data[5]);
- }
- });
-
- // closepath
- systemDict.put("closepath", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- context.pencil.closepath();
- }
- });
-
- // gsave
- systemDict.put("gsave", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- context.pencil.gsave();
- }
- });
-
- // grestore
- systemDict.put("grestore", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- context.pencil.grestore();
- }
- });
-
- // translate
- systemDict.put("translate", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- if (context.peekOperand() instanceof Number) {
- double data[];
- AffineTransform at = new AffineTransform();
- AffineTransform ctm = context.pencil.graphics.getTransform();
-
- data = context.popNumberOperands(2);
- at.translate(data[0], data[1]);
- ctm.concatenate(at);
- context.pencil.graphics.setTransform(ctm);
- }
- else {
- Object data[];
-
- data = context.popOperands(3);
- if (! (data[0] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[1] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[2] instanceof ArrayList)) {
- throw new PainterException("wrong arguments");
- }
-
- ArrayList array = (ArrayList) data[2];
-
- if (! (array.size() == 6)) {
- throw new PainterException("wrong arguments");
- }
-
- AffineTransform at = new AffineTransform();
-
- at.translate( ( (Number) data[0]).doubleValue(),
- ( (Number) data[1]).doubleValue());
-
- double[] entries = new double[6];
-
- at.getMatrix(entries);
-
- for (int i = 0; i < 6; i++) {
- array.set(i, new Double(entries[i]));
- }
- context.operands.push(array);
- }
- }
- });
-
- // rotate
- systemDict.put("rotate", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- if (context.peekOperand() instanceof Number) {
- double data[];
- AffineTransform at = new AffineTransform();
- AffineTransform ctm = context.pencil.graphics.getTransform();
-
- data = context.popNumberOperands(1);
- at.rotate(data[0] * Math.PI / 180.0d);
- ctm.concatenate(at);
- context.pencil.graphics.setTransform(ctm);
- }
- else {
- Object data[];
- AffineTransform at = new AffineTransform();
-
- data = context.popOperands(2);
- if (! (data[0] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[1] instanceof ArrayList)) {
- throw new PainterException("wrong arguments");
- }
-
- ArrayList array = (ArrayList) data[1];
-
- if (! (array.size() == 6)) {
- throw new PainterException("wrong arguments");
- }
-
- at.rotate( ( (Number) data[0]).doubleValue());
-
- double[] entries = new double[6];
-
- at.getMatrix(entries);
-
- for (int i = 0; i < 6; i++) {
- array.set(i, new Double(entries[i]));
- }
- context.operands.push(array);
- }
- }
- });
-
- // scale
- systemDict.put("scale", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- if (context.peekOperand() instanceof Number) {
- double data[];
- AffineTransform at = new AffineTransform();
- AffineTransform ctm = context.pencil.graphics.getTransform();
-
- data = context.popNumberOperands(2);
- at.scale(data[0], data[1]);
- ctm.concatenate(at);
- context.pencil.graphics.setTransform(ctm);
- }
- else {
- Object data[];
-
- data = context.popOperands(3);
- if (! (data[0] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[1] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[2] instanceof ArrayList)) {
- throw new PainterException("wrong arguments");
- }
-
- ArrayList array = (ArrayList) data[2];
-
- double[] entries = new double[6];
-
- if (! (array.size() == 6)) {
- throw new PainterException("wrong arguments");
- }
-
- entries[0] = ( (Number) data[0]).doubleValue();
- entries[1] = 0.0d;
- entries[2] = 0.0d;
- entries[3] = ( (Number) data[1]).doubleValue();
- entries[4] = 0.0d;
- entries[5] = 0.0d;
-
- for (int i = 0; i < 6; i++) {
- array.set(i, new Double(entries[i]));
- }
- context.operands.push(array);
- }
- }
- });
-
- // stroke
- systemDict.put("stroke", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- context.pencil.stroke();
- }
- });
-
- // fill
- systemDict.put("fill", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- context.pencil.fill();
- }
- });
-
- // eofill
- systemDict.put("eofill", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- context.pencil.eofill();
- }
- });
-
- // show
- systemDict.put("show", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
-
- data = context.popOperands(1);
- if (! (data[0] instanceof String)) {
- throw new PainterException("wrong arguments");
- }
- context.pencil.show( (String) data[0]);
- }
- });
-
- // stringwidth
- systemDict.put("stringwidth", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- float[] result;
- Font font;
-
- data = context.popOperands(1);
- if (! (data[0] instanceof String)) {
- throw new PainterException("wrong arguments");
- }
- font = context.pencil.graphics.getFont();
- Rectangle2D rect = font.getStringBounds( (String) data[0],
- context.pencil.graphics.
- getFontRenderContext());
- context.operands.push(new Float(rect.getWidth()));
- context.operands.push(new Float(rect.getHeight()));
- }
- });
-
- // showpage
- systemDict.put("showpage", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- context.pencil.showpage();
- }
- });
-
- // findfont
- systemDict.put("findfont", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- PAToken patoken;
- data = context.popOperands(1);
- if (! (data[0] instanceof PAToken)) {
- throw new PainterException("wrong arguments");
- }
- patoken = (PAToken) data[0];
- if (! (patoken.type == PAToken.KEY)) {
- throw new PainterException("wrong arguments");
- }
- context.operands.push(context.pencil.findFont( (String) patoken.value));
- }
- });
-
- // scalefont
- systemDict.put("scalefont", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- data = context.popOperands(2);
- if (! (data[0] instanceof Font)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[1] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- context.operands.push( ( (Font) data[0]).deriveFont( ( (Number) data[1]).
- floatValue()));
- }
- });
-
- // setfont
- systemDict.put("setfont", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- data = context.popOperands(1);
- if (! (data[0] instanceof Font)) {
- throw new PainterException("wrong arguments");
- }
- context.pencil.graphics.setFont( (Font) data[0]);
- }
- });
-
- // def
- systemDict.put("def", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- PAToken patoken;
- data = context.popOperands(2);
- if (! (data[0] instanceof PAToken)) {
- throw new PainterException("wrong arguments");
- }
- patoken = (PAToken) data[0];
- if (! (patoken.type == PAToken.KEY)) {
- throw new PainterException("wrong arguments");
- }
- try {
- ( (HashMap) context.dictionaries.peek()).put(patoken.value, data[1]);
- }
- catch (EmptyStackException e) {
- throw new PainterException(e.toString());
- }
- }
- });
-
- // bind
- systemDict.put("bind", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- PAToken patoken;
- data = context.popOperands(1);
- if (! (data[0] instanceof PAToken)) {
- throw new PainterException("wrong arguments");
- }
- patoken = (PAToken) data[0];
- if (! (patoken.type == PAToken.PROCEDURE)) {
- throw new PainterException("wrong arguments");
- }
- context.engine.bindProcedure(patoken);
- context.operands.push(patoken);
- }
- });
-
- // mul
- systemDict.put("mul", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(2);
- context.operands.push(new Double(data[0] * data[1]));
- }
- });
-
- // div
- systemDict.put("div", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(2);
- context.operands.push(new Double(data[0] / data[1]));
- }
- });
-
- // mod
- systemDict.put("mod", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(2);
- int a, b, m;
- a = (int) data[0];
- b = (int) data[1];
- m = a % b;
- context.operands.push(new Integer(m));
- }
- });
-
- // add
- systemDict.put("add", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(2);
- context.operands.push(new Double(data[0] + data[1]));
- }
- });
-
- // neg
- systemDict.put("neg", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(1);
- context.operands.push(new Double( -data[0]));
- }
- });
-
- // sub
- systemDict.put("sub", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(2);
- context.operands.push(new Double(data[0] - data[1]));
- }
- });
-
- // atan
- systemDict.put("atan", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(2);
- context.operands.push(new Double(Math.atan2(data[0], data[1])));
- }
- });
-
- // sin
- systemDict.put("sin", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(1);
- context.operands.push(new Double(Math.sin(data[0] * Math.PI / 180.0)));
- }
- });
-
- // cos
- systemDict.put("cos", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(1);
- context.operands.push(new Double(Math.cos(data[0] * Math.PI / 180.0)));
- }
- });
-
- // sqrt
- systemDict.put("sqrt", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(1);
- context.operands.push(new Double(Math.sqrt(data[0])));
- }
- });
-
- // exch
- systemDict.put("exch", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
-
- data = context.popOperands(2);
- context.operands.push(data[1]);
- context.operands.push(data[0]);
- }
- });
-
- // dup
- systemDict.put("dup", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
-
- data = context.popOperands(1);
- context.operands.push(data[0]);
- context.operands.push(data[0]);
- }
- });
-
- // roll
- systemDict.put("roll", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- Object rollData[];
-
- data = context.popOperands(2);
- if (! (data[0] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[1] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- int numberOfElements, numberOfPositions, i;
-
- numberOfElements = ( (Number) data[0]).intValue();
- numberOfPositions = ( (Number) data[1]).intValue();
-
- if (numberOfPositions == 0 || numberOfElements <= 0) {
- return;
- }
-
- rollData = context.popOperands(numberOfElements);
-
- if (numberOfPositions < 0) {
- numberOfPositions = -numberOfPositions;
- numberOfPositions = numberOfPositions % numberOfElements;
-
- // downward roll
- for (i = numberOfPositions; i < numberOfElements; i++) {
- context.operands.push(rollData[i]);
- }
- for (i = 0; i < numberOfPositions; i++) {
- context.operands.push(rollData[i]);
- }
- }
- else {
- numberOfPositions = numberOfPositions % numberOfElements;
-
- // upward roll
- for (i = numberOfElements - numberOfPositions; i < numberOfElements;
- i++) {
- context.operands.push(rollData[i]);
- }
- for (i = 0; i < numberOfElements - numberOfPositions; i++) {
- context.operands.push(rollData[i]);
- }
- }
- }
- });
-
- // pop
- systemDict.put("pop", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- context.popOperands(1);
- }
- });
-
- // index
- systemDict.put("index", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- data = context.popOperands(1);
- if (! (data[0] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- int index = ( (Number) data[0]).intValue();
- try {
- context.operands.push(context.operands.elementAt(index));
- }
- catch (ArrayIndexOutOfBoundsException e) {
- throw new PainterException(e.toString());
- }
- }
- });
-
- // mark
- systemDict.put("mark", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- context.operands.push(new PAToken(null, PAToken.MARK));
- }
- });
-
- // cleartomark
- systemDict.put("cleartomark", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data;
- boolean finished = false;
-
- while (!finished) {
- try {
- data = context.operands.pop();
- if (data instanceof PAToken) {
- if ( ( (PAToken) data).type == PAToken.MARK) {
- finished = true;
- }
- }
- }
- catch (EmptyStackException e) {
- throw new PainterException(e.toString());
- }
- }
- }
- });
-
- // copy
- systemDict.put("copy", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- data = context.popOperands(2);
-
- // decide if it's a simple copy or a composite object copy
- if ( (data[0] instanceof PAToken) && (data[1] instanceof PAToken)) {
- // composite object copy
- if ( ( (PAToken) data[0]).type == ( (PAToken) data[1]).type) {
- // our tokens are immutable so a copy is easy
- context.operands.push(data[0]);
- context.operands.push(data[0]);
- }
- else {
- throw new PainterException(
- "copy operation failed because composite objects on stack are not of same type");
- }
- }
- else {
- // restore first arg, we're not interested in it in this simple case
- context.operands.push(data[0]);
-
- if (data[1] instanceof Number) {
- int index = ( (Number) data[1]).intValue();
- int i, n;
- n = context.operands.size();
- Object[] copyData = new Object[index];
- for (i = n - index; i < n; i++) {
- try {
- copyData[i - n + index] = context.operands.elementAt(i);
- }
- catch (ArrayIndexOutOfBoundsException e) {
- throw new PainterException(e.toString());
- }
- }
- for (i = 0; i < index; i++) {
- context.operands.push(copyData[i]);
- }
- }
- else {
- throw new PainterException("I expect a number on stack, dude");
- }
- }
- }
- });
-
- // setgray
- systemDict.put("setgray", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(1);
- context.pencil.graphics.setPaint(new Color( (float) data[0],
- (float) data[0], (float) data[0]));
- }
- });
-
- // setrgbcolor
- systemDict.put("setrgbcolor", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(3);
- float[] fv = new float[3];
- fv[0] = (float) Math.max(Math.min(data[0], 1.0d), 0.0d);
- fv[1] = (float) Math.max(Math.min(data[1], 1.0d), 0.0d);
- fv[2] = (float) Math.max(Math.min(data[2], 1.0d), 0.0d);
- context.pencil.graphics.setPaint(new Color(fv[0], fv[1], fv[2]));
- }
- });
-
- // PENDING(uweh): color stuff still shaky
- // sethsbcolor
- systemDict.put("sethsbcolor", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(3);
- float[] fv = new float[3];
- fv[0] = (float) Math.max(Math.min(data[0], 1.0d), 0.0d);
- fv[1] = (float) Math.max(Math.min(data[1], 1.0d), 0.0d);
- fv[2] = (float) Math.max(Math.min(data[2], 1.0d), 0.0d);
- context.pencil.graphics.setPaint(new Color(fv[0], fv[1], fv[2]));
- }
- });
-
- // PENDING(uweh): I have to convert these puppies myself to rgb ?
- // setcmybcolor
- systemDict.put("setcmybcolor", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
- int rd, gr, bl;
-
- data = context.popNumberOperands(4);
- float[] fv = new float[4];
- fv[0] = (float) data[0];
- fv[1] = (float) data[1];
- fv[2] = (float) data[2];
- fv[3] = (float) data[3];
- rd = (int) (255 * Math.max(0, 1 - fv[0] - fv[3]));
- gr = (int) (255 * Math.max(0, 1 - fv[1] - fv[3]));
- bl = (int) (255 * Math.max(0, 1 - fv[2] - fv[3]));
- context.pencil.graphics.setPaint(new Color(rd, gr, bl));
- }
- });
-
- // setlinewidth
- systemDict.put("setlinewidth", new PACommand() {
- private double minLineWidth(double w, AffineTransform at) {
- double matrix[] = new double[4];
- at.getMatrix(matrix);
- double scale = matrix[0] * matrix[3] - matrix[1] * matrix[2];
- double minlw = .25 / Math.sqrt(Math.abs(scale));
- if (w < minlw) {
- w = minlw;
- }
- return w;
- }
-
- public void execute(PAContext context) throws PainterException {
- double data[];
- BasicStroke newStroke;
- Stroke oldStroke = context.pencil.graphics.getStroke();
- data = context.popNumberOperands(1);
- data[0] = this.minLineWidth(data[0],
- context.pencil.graphics.getTransform());
- if (oldStroke instanceof BasicStroke) {
- newStroke = new BasicStroke( (float) data[0],
- ( (BasicStroke) oldStroke).getEndCap(),
- ( (BasicStroke) oldStroke).getLineJoin(),
- ( (BasicStroke) oldStroke).getMiterLimit(),
- ( (BasicStroke) oldStroke).getDashArray(),
- ( (BasicStroke) oldStroke).getDashPhase());
- }
- else {
- newStroke = new BasicStroke( (float) data[0], BasicStroke.CAP_ROUND,
- BasicStroke.JOIN_ROUND);
- }
- context.pencil.graphics.setStroke(newStroke);
- }
- });
-
- // setlinecap
- systemDict.put("setlinecap", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
- BasicStroke newStroke;
- Stroke oldStroke = context.pencil.graphics.getStroke();
- data = context.popNumberOperands(1);
- if (oldStroke instanceof BasicStroke) {
- newStroke = new BasicStroke( ( (BasicStroke) oldStroke).getLineWidth(),
- (int) data[0],
- ( (BasicStroke) oldStroke).getLineJoin(),
- ( (BasicStroke) oldStroke).getMiterLimit(),
- ( (BasicStroke) oldStroke).getDashArray(),
- ( (BasicStroke) oldStroke).getDashPhase());
- }
- else {
- newStroke = new BasicStroke(1.0f, (int) data[0],
- BasicStroke.JOIN_ROUND);
- }
- context.pencil.graphics.setStroke(newStroke);
- }
- });
-
- // setmiterlimit
- systemDict.put("setmiterlimit", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
- BasicStroke newStroke;
- Stroke oldStroke = context.pencil.graphics.getStroke();
- data = context.popNumberOperands(1);
- if (oldStroke instanceof BasicStroke) {
- newStroke = new BasicStroke( ( (BasicStroke) oldStroke).getLineWidth(),
- ( (BasicStroke) oldStroke).getEndCap(),
- ( (BasicStroke) oldStroke).getLineJoin(),
- (float) data[0],
- ( (BasicStroke) oldStroke).getDashArray(),
- ( (BasicStroke) oldStroke).getDashPhase());
- }
- else {
- newStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
- BasicStroke.JOIN_ROUND, (float) data[0]);
- }
- context.pencil.graphics.setStroke(newStroke);
- }
- });
-
- // setdash
- systemDict.put("setdash", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- BasicStroke newStroke;
- Stroke oldStroke = context.pencil.graphics.getStroke();
- data = context.popOperands(2);
- if (! (data[0] instanceof ArrayList)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[1] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
-
- ArrayList list = (ArrayList) data[0];
-
- if (list.size() == 0) {
- return;
- }
- float[] dashpattern = new float[list.size()];
- for (int i = 0; i < dashpattern.length; i++) {
- dashpattern[i] = ( (Number) list.get(i)).floatValue();
- }
- float dashoffset = ( (Number) data[1]).floatValue();
- if (oldStroke instanceof BasicStroke) {
- newStroke = new BasicStroke( ( (BasicStroke) oldStroke).getLineWidth(),
- ( (BasicStroke) oldStroke).getEndCap(),
- ( (BasicStroke) oldStroke).getLineJoin(),
- ( (BasicStroke) oldStroke).getMiterLimit(),
- dashpattern,
- dashoffset);
- }
- else {
- newStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
- BasicStroke.JOIN_ROUND, 1.0f, dashpattern,
- dashoffset);
- }
- context.pencil.graphics.setStroke(newStroke);
- }
- });
-
- // setlinejoin
- systemDict.put("setlinejoin", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
- BasicStroke newStroke;
- Stroke oldStroke = context.pencil.graphics.getStroke();
- data = context.popNumberOperands(1);
- if (oldStroke instanceof BasicStroke) {
- newStroke = new BasicStroke( ( (BasicStroke) oldStroke).getLineWidth(),
- ( (BasicStroke) oldStroke).getEndCap(),
- (int) data[0],
- ( (BasicStroke) oldStroke).getMiterLimit(),
- ( (BasicStroke) oldStroke).getDashArray(),
- ( (BasicStroke) oldStroke).getDashPhase());
- }
- else {
- newStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, (int) data[0]);
- }
- context.pencil.graphics.setStroke(newStroke);
- }
- });
-
- // dumpstack
- systemDict.put("dumpstack", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Enumeration enumx = context.operands.elements();
- System.out.println("-------------Stack--------------");
- while (enumx.hasMoreElements()) {
- System.out.println(enumx.nextElement());
- }
- System.out.println("--------------------------------");
- }
- });
-
- // for
- systemDict.put("for", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- PAToken patoken;
-
- data = context.popOperands(4);
- if (! (data[3] instanceof PAToken)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[0] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[1] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[2] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- patoken = (PAToken) data[3];
- if (! (patoken.type == PAToken.PROCEDURE)) {
- throw new PainterException("wrong arguments");
- }
- int i0, i1, i2;
- i0 = ( (Number) data[0]).intValue();
- i1 = ( (Number) data[1]).intValue();
- i2 = ( (Number) data[2]).intValue();
-
- if (i1 > 0) {
- for (int i = i0; i <= i2; i += i1) {
- context.operands.push(new Integer(i));
- context.engine.process(patoken);
- }
- }
- else {
- for (int i = i0; i >= i2; i -= i1) {
- context.operands.push(new Integer(i));
- context.engine.process(patoken);
- }
- }
- }
- });
-
- // repeat
- systemDict.put("repeat", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- PAToken patoken;
- data = context.popOperands(2);
- if (! (data[1] instanceof PAToken)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[0] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- patoken = (PAToken) data[1];
- if (! (patoken.type == PAToken.PROCEDURE)) {
- throw new PainterException("wrong arguments");
- }
- int n = ( (Number) data[0]).intValue();
- for (int i = 0; i < n; i++) {
- context.engine.process(patoken);
- }
- }
- });
-
- // true
- systemDict.put("true", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- context.operands.push(new Boolean(true));
- }
- });
-
- // false
- systemDict.put("false", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- context.operands.push(new Boolean(false));
- }
- });
-
- // lt
- systemDict.put("lt", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
-
- data = context.popOperands(2);
- if (! (data[0] instanceof Number) && ! (data[0] instanceof String)) {
- throw new PainterException("wrong arguments");
- }
- if (data[0] instanceof Number) {
- if (! (data[1] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- double d0, d1;
- d0 = ( (Number) data[0]).doubleValue();
- d1 = ( (Number) data[1]).doubleValue();
- if (d0 < d1) {
- context.operands.push(new Boolean(true));
- }
- else {
- context.operands.push(new Boolean(false));
- }
- }
- else {
- if (! (data[1] instanceof String)) {
- throw new PainterException("wrong arguments");
- }
- String s0, s1;
- s0 = (String) data[0];
- s1 = (String) data[1];
- if (s0.compareTo(s1) < 0) {
- context.operands.push(new Boolean(true));
- }
- else {
- context.operands.push(new Boolean(false));
- }
- }
- }
- });
-
- // gt
- systemDict.put("gt", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
-
- data = context.popOperands(2);
- if (! (data[0] instanceof Number) && ! (data[0] instanceof String)) {
- throw new PainterException("wrong arguments");
- }
- if (data[0] instanceof Number) {
- if (! (data[1] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- double d0, d1;
- d0 = ( (Number) data[0]).doubleValue();
- d1 = ( (Number) data[1]).doubleValue();
- if (d0 > d1) {
- context.operands.push(new Boolean(true));
- }
- else {
- context.operands.push(new Boolean(false));
- }
- }
- else {
- if (! (data[1] instanceof String)) {
- throw new PainterException("wrong arguments");
- }
- String s0, s1;
- s0 = (String) data[0];
- s1 = (String) data[1];
- if (s0.compareTo(s1) > 0) {
- context.operands.push(new Boolean(true));
- }
- else {
- context.operands.push(new Boolean(false));
- }
- }
- }
- });
-
- // ne
- systemDict.put("ne", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
-
- data = context.popOperands(2);
- if (! (data[0] instanceof Number) && ! (data[0] instanceof String)) {
- throw new PainterException("wrong arguments");
- }
- if (data[0] instanceof Number) {
- if (! (data[1] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- double d0, d1;
- d0 = ( (Number) data[0]).doubleValue();
- d1 = ( (Number) data[1]).doubleValue();
- if (d0 != d1) {
- context.operands.push(new Boolean(true));
- }
- else {
- context.operands.push(new Boolean(false));
- }
- }
- else {
- if (! (data[1] instanceof String)) {
- throw new PainterException("wrong arguments");
- }
- String s0, s1;
- s0 = (String) data[0];
- s1 = (String) data[1];
- if (s0.equals(s1)) {
- context.operands.push(new Boolean(false));
- }
- else {
- context.operands.push(new Boolean(true));
- }
- }
- }
- });
-
- // eq
- systemDict.put("eq", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
-
- data = context.popOperands(2);
- if (! (data[0] instanceof Number) && ! (data[0] instanceof String)) {
- throw new PainterException("wrong arguments");
- }
- if (data[0] instanceof Number) {
- if (! (data[1] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- double d0, d1;
- d0 = ( (Number) data[0]).doubleValue();
- d1 = ( (Number) data[1]).doubleValue();
- if (d0 == d1) {
- context.operands.push(new Boolean(true));
- }
- else {
- context.operands.push(new Boolean(false));
- }
- }
- else {
- if (! (data[1] instanceof String)) {
- throw new PainterException("wrong arguments");
- }
- String s0, s1;
- s0 = (String) data[0];
- s1 = (String) data[1];
- if (s0.compareTo(s1) == 0) {
- context.operands.push(new Boolean(true));
- }
- else {
- context.operands.push(new Boolean(false));
- }
- }
- }
- });
-
- // if
- systemDict.put("if", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- PAToken patoken;
- data = context.popOperands(2);
- if (! (data[0] instanceof Boolean)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[1] instanceof PAToken)) {
- throw new PainterException("wrong arguments");
- }
- patoken = (PAToken) data[1];
- if (! (patoken.type == PAToken.PROCEDURE)) {
- throw new PainterException("wrong arguments");
- }
- if ( ( (Boolean) data[0]).booleanValue()) {
- context.engine.process(patoken);
- }
- }
- });
-
- // ifelse
- systemDict.put("ifelse", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- PAToken patoken1, patoken2;
- data = context.popOperands(3);
- if (! (data[0] instanceof Boolean)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[1] instanceof PAToken)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[2] instanceof PAToken)) {
- throw new PainterException("wrong arguments");
- }
- patoken1 = (PAToken) data[1];
- patoken2 = (PAToken) data[2];
- if (! (patoken1.type == PAToken.PROCEDURE)) {
- throw new PainterException("wrong arguments");
- }
- if (! (patoken2.type == PAToken.PROCEDURE)) {
- throw new PainterException("wrong arguments");
- }
- if ( ( (Boolean) data[0]).booleanValue()) {
- context.engine.process(patoken1);
- }
- else {
- context.engine.process(patoken2);
- }
- }
- });
-
- // dict
- systemDict.put("dict", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(1);
- context.operands.push(new HashMap());
- }
- });
-
- // userdict
- systemDict.put("userdict", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(1);
- context.operands.push(new HashMap());
- }
- });
- // put
- systemDict.put("put", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- PAToken patoken;
- data = context.popOperands(3);
- if (! (data[0] instanceof HashMap)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[1] instanceof PAToken)) {
- throw new PainterException("wrong arguments");
- }
- patoken = (PAToken) data[1];
- if (! (patoken.type == PAToken.KEY)) {
- throw new PainterException("wrong arguments");
- }
- ( (HashMap) data[0]).put(patoken.value, data[2]);
- }
- });
-
- // get
- systemDict.put("get", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- PAToken patoken;
- data = context.popOperands(2);
- if (! (data[0] instanceof HashMap) && ! (data[0] instanceof ArrayList)) {
- throw new PainterException("wrong arguments");
- }
- if (data[0] instanceof HashMap) {
- if (! (data[1] instanceof PAToken)) {
- throw new PainterException("wrong arguments");
- }
- patoken = (PAToken) data[1];
- if (! (patoken.type == PAToken.KEY)) {
- throw new PainterException("wrong arguments");
- }
- context.operands.push( ( (HashMap) data[0]).get(patoken.value));
- }
- else if (data[0] instanceof ArrayList) {
- if (! (data[1] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- context.operands.push( ( (ArrayList) data[0]).get( ( (Number) data[1]).
- intValue()));
- }
- }
- });
-
- // load
- systemDict.put("load", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- PAToken patoken;
- data = context.popOperands(1);
- if (! (data[0] instanceof PAToken)) {
- throw new PainterException("wrong arguments");
- }
- patoken = (PAToken) data[0];
- if (! (patoken.type == PAToken.KEY)) {
- throw new PainterException("wrong arguments");
- }
- context.operands.push(context.findIdentifier(patoken.value));
- }
- });
-
- // length
- systemDict.put("length", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- PAToken patoken;
- int size = 0;
- data = context.popOperands(1);
- if (data[0] instanceof PAToken) {
- patoken = (PAToken) data[0];
- if (! (patoken.type == PAToken.KEY)) {
- throw new PainterException("wrong arguments");
- }
- size = ( (String) patoken.value).length();
- }
- else if (data[0] instanceof HashMap) {
- size = ( (HashMap) data[0]).size();
- }
- else if (data[0] instanceof ArrayList) {
- size = ( (ArrayList) data[0]).size();
- }
- else if (data[0] instanceof String) {
- size = ( (String) data[0]).length();
- }
- else {
- throw new PainterException("wrong arguments");
- }
-
- context.operands.push(new Integer(size));
- }
- });
-
- // begin
- systemDict.put("begin", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- data = context.popOperands(1);
- if (! (data[0] instanceof HashMap)) {
- throw new PainterException("wrong arguments");
- }
- context.dictionaries.push(data[0]);
- }
- });
-
- // end
- systemDict.put("end", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- try {
- context.dictionaries.pop();
- }
- catch (EmptyStackException e) {
- throw new PainterException("Dictionary stack is empty");
- }
- }
- });
-
- // undef
- systemDict.put("undef", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- PAToken patoken;
- data = context.popOperands(2);
- if (! (data[0] instanceof HashMap)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[1] instanceof PAToken)) {
- throw new PainterException("wrong arguments");
- }
- patoken = (PAToken) data[1];
- if (! (patoken.type == PAToken.KEY)) {
- throw new PainterException("wrong arguments");
- }
- // we don't do an actual undef because we don't care
- }
- });
-
- // known
- systemDict.put("known", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[], foundObject;
- PAToken patoken;
- data = context.popOperands(1);
- if (! (data[0] instanceof PAToken)) {
- throw new PainterException("wrong arguments");
- }
- patoken = (PAToken) data[0];
- if (! (patoken.type == PAToken.KEY)) {
- throw new PainterException("wrong arguments");
- }
- foundObject = context.findIdentifier(patoken.value);
- if (foundObject != null) {
- context.operands.push(new Boolean(true));
- }
- else {
- context.operands.push(new Boolean(false));
- }
- }
- });
-
- // where
- systemDict.put("where", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[], foundObject;
- PAToken patoken;
- data = context.popOperands(1);
- if (! (data[0] instanceof PAToken)) {
- throw new PainterException("wrong arguments");
- }
- patoken = (PAToken) data[0];
- if (! (patoken.type == PAToken.KEY)) {
- throw new PainterException("wrong arguments");
- }
- foundObject = context.findDictionary(patoken.value);
- if (foundObject != null) {
- context.operands.push(foundObject);
- context.operands.push(new Boolean(true));
- }
- else {
- context.operands.push(new Boolean(false));
- }
- }
- });
-
- // aload
- systemDict.put("aload", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- ArrayList list;
- data = context.popOperands(1);
- if (! (data[0] instanceof ArrayList)) {
- throw new PainterException("wrong arguments");
- }
- list = (ArrayList) data[0];
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- context.operands.push(iterator.next());
- }
- context.operands.push(data[0]);
- }
- });
-
- // forall
- systemDict.put("forall", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- ArrayList list;
- PAToken patoken;
-
- data = context.popOperands(2);
- if (! (data[0] instanceof ArrayList)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[1] instanceof PAToken)) {
- throw new PainterException("wrong arguments");
- }
-
- patoken = (PAToken) data[1];
- if (! (patoken.type == PAToken.PROCEDURE)) {
- throw new PainterException("wrong arguments");
- }
-
- list = (ArrayList) data[0];
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- context.operands.push(iterator.next());
- context.engine.process(patoken);
- }
-
- }
- });
-
- // currentflat PENDING(uweh):placeholder for now
- systemDict.put("currentflat", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- context.operands.push(new Float(1.0f));
- }
- });
-
- // setflat PENDING(uweh):placeholder for now
- systemDict.put("setflat", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(1);
- }
- });
-
- // round
- systemDict.put("round", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(1);
- context.operands.push(new Long(Math.round(data[0])));
- }
- });
-
- // abs
- systemDict.put("abs", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(1);
- context.operands.push(new Double(Math.abs(data[0])));
- }
- });
-
- // transform
- systemDict.put("transform", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- if (context.peekOperand() instanceof Number) {
- double data[];
- double[] transformedData = new double[2];
- data = context.popNumberOperands(2);
- AffineTransform at = context.pencil.graphics.getTransform();
- at.transform(data, 0, transformedData, 0, 1);
- context.operands.push(new Double(transformedData[0]));
- context.operands.push(new Double(transformedData[1]));
- }
- else {
- Object data[];
-
- data = context.popOperands(3);
- if (! (data[0] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[1] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[2] instanceof ArrayList)) {
- throw new PainterException("wrong arguments");
- }
-
- ArrayList array = (ArrayList) data[2];
-
- double[] entries = new double[6];
-
- if (! (array.size() == 6)) {
- throw new PainterException("wrong arguments");
- }
-
- for (int i = 0; i < 6; i++) {
- entries[i] = ( (Number) array.get(i)).doubleValue();
- }
-
- AffineTransform at = new AffineTransform(entries);
-
- double numberdata[] = new double[2];
- numberdata[0] = ( (Number) data[0]).doubleValue();
- numberdata[1] = ( (Number) data[0]).doubleValue();
-
- double[] transformedData = new double[2];
-
- at.transform(numberdata, 0, transformedData, 0, 1);
- context.operands.push(new Double(transformedData[0]));
- context.operands.push(new Double(transformedData[1]));
- }
- }
- });
-
- // itransform
- systemDict.put("itransform", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- if (context.peekOperand() instanceof Number) {
- double data[];
- double[] transformedData = new double[2];
- data = context.popNumberOperands(2);
- AffineTransform at = context.pencil.graphics.getTransform();
- try {
- at.inverseTransform(data, 0, transformedData, 0, 1);
- }
- catch (NoninvertibleTransformException e) {
- throw new PainterException(e.toString());
- }
- context.operands.push(new Double(transformedData[0]));
- context.operands.push(new Double(transformedData[1]));
- }
- else {
- Object data[];
-
- data = context.popOperands(3);
- if (! (data[0] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[1] instanceof Number)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[2] instanceof ArrayList)) {
- throw new PainterException("wrong arguments");
- }
-
- ArrayList array = (ArrayList) data[2];
-
- double[] entries = new double[6];
-
- if (! (array.size() == 6)) {
- throw new PainterException("wrong arguments");
- }
-
- for (int i = 0; i < 6; i++) {
- entries[i] = ( (Number) array.get(i)).doubleValue();
- }
-
- AffineTransform at = new AffineTransform(entries);
-
- double numberdata[] = new double[2];
- numberdata[0] = ( (Number) data[0]).doubleValue();
- numberdata[1] = ( (Number) data[0]).doubleValue();
-
- double[] transformedData = new double[2];
-
- try {
- at.inverseTransform(numberdata, 0, transformedData, 0, 1);
- }
- catch (NoninvertibleTransformException e) {
- throw new PainterException(e.toString());
- }
- context.operands.push(new Double(transformedData[0]));
- context.operands.push(new Double(transformedData[1]));
- }
- }
- });
-
- // currentpoint
- // PENDING(uweh): what about CTM, same thing when you construct path
- // this is different than ps, might not work in a few instances
- systemDict.put("currentpoint", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Point2D currentPoint = context.pencil.state.path.getCurrentPoint();
- context.operands.push(new Double(currentPoint.getX()));
- context.operands.push(new Double(currentPoint.getY()));
- }
- });
-
- // clippath
- systemDict.put("clippath", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- context.pencil.clippath();
- }
- });
-
- // matrix
- systemDict.put("matrix", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- ArrayList identityMatrix = new ArrayList(6);
-
- identityMatrix.add(new Double(1.0d));
- identityMatrix.add(new Double(0.0d));
- identityMatrix.add(new Double(0.0d));
- identityMatrix.add(new Double(1.0d));
- identityMatrix.add(new Double(0.0d));
- identityMatrix.add(new Double(0.0d));
- context.operands.push(identityMatrix);
- }
- });
-
- // concatmatrix
- systemDict.put("concatmatrix", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- data = context.popOperands(3);
- if (! (data[0] instanceof ArrayList)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[1] instanceof ArrayList)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[2] instanceof ArrayList)) {
- throw new PainterException("wrong arguments");
- }
- ArrayList arrayOne, arrayTwo, arrayThree;
- AffineTransform atOne, atTwo;
-
- arrayOne = (ArrayList) data[0];
- arrayTwo = (ArrayList) data[1];
- arrayThree = (ArrayList) data[2];
-
- double[] entries = new double[6];
-
- if (! (arrayOne.size() == 6)) {
- throw new PainterException("wrong arguments");
- }
- if (! (arrayTwo.size() == 6)) {
- throw new PainterException("wrong arguments");
- }
- if (! (arrayThree.size() == 6)) {
- throw new PainterException("wrong arguments");
- }
-
- for (int i = 0; i < 6; i++) {
- entries[i] = ( (Number) arrayOne.get(i)).doubleValue();
- }
- atOne = new AffineTransform(entries);
- for (int i = 0; i < 6; i++) {
- entries[i] = ( (Number) arrayTwo.get(i)).doubleValue();
- }
- atTwo = new AffineTransform(entries);
-
- atOne.concatenate(atTwo);
-
- atOne.getMatrix(entries);
- for (int i = 0; i < 6; i++) {
- arrayThree.set(i, new Double(entries[i]));
- }
- context.operands.push(arrayThree);
- }
- });
-
- // pathbbox
- systemDict.put("pathbbox", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Rectangle2D pathBounds = context.pencil.state.path.getBounds2D();
-
- context.operands.push(new Double(pathBounds.getMinX()));
- context.operands.push(new Double(pathBounds.getMinY()));
- context.operands.push(new Double(pathBounds.getMaxX()));
- context.operands.push(new Double(pathBounds.getMaxY()));
- }
- });
-
- // truncate
- systemDict.put("truncate", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
- double truncated;
-
- data = context.popNumberOperands(1);
- if (data[0] < 0) {
- truncated = Math.ceil(data[0]);
- }
- else {
- truncated = Math.floor(data[0]);
- }
- context.operands.push(new Double(truncated));
- }
- });
-
- // rand
- systemDict.put("rand", new PACommand() {
- public void execute(PAContext context) throws PainterException {
-
- context.operands.push(new Integer(randomNumberGenerator.nextInt(231)));
- }
- });
-
- // srand
- systemDict.put("srand", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- double data[];
-
- data = context.popNumberOperands(1);
- randomNumberGenerator = new Random(Math.round(data[0]));
- }
- });
-
- // cvi
- systemDict.put("cvi", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
-
- data = context.popOperands(1);
- if (! (data[0] instanceof Number) && ! (data[0] instanceof String)) {
- throw new PainterException("wrong arguments");
- }
- if (data[0] instanceof Number) {
- int d;
-
- d = ( (Number) data[0]).intValue();
- context.operands.push(new Integer(d));
- }
- else {
- String s;
- s = (String) data[0];
-
- context.operands.push(new Integer(s));
- }
- }
- });
-
- // usertime
- systemDict.put("usertime", new PACommand() {
- public void execute(PAContext context) throws PainterException {
-
- context.operands.push(new Long(System.currentTimeMillis()));
- }
- });
-// save
- systemDict.put("save", new PACommand() {
- public void execute(PAContext context) throws PainterException {
-
- // context.operands.push(new Long(System.currentTimeMillis()));
- }
- });
-// restore
- systemDict.put("restore", new PACommand() {
- public void execute(PAContext context) throws PainterException {
-
- // Object data[];
-
- // data = context.popOperands(1);
-
- }
- });
-// clear
- systemDict.put("clear", new PACommand() {
- public void execute(PAContext context) throws PainterException {
-
- // Object data[];
-
- // data = context.popOperands(1);
-
- }
- });
-// cleardictstack
- systemDict.put("cleardictstack", new PACommand() {
- public void execute(PAContext context) throws PainterException {
-
- // Object data[];
-
- // data = context.popOperands(1);
-
- }
- });
-
- // charpath
- systemDict.put("charpath", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
-
- data = context.popOperands(2);
- if (! (data[0] instanceof String)) {
- throw new PainterException("wrong arguments");
- }
- if (! (data[1] instanceof Boolean)) {
- throw new PainterException("wrong arguments");
- }
-
- context.pencil.charpath( (String) data[0],
- ( (Boolean) data[1]).booleanValue());
- }
- });
-
- // PENDING(uweh): we only support procedure right now and always push false on the stack
- // stopped
- systemDict.put("stopped", new PACommand() {
- public void execute(PAContext context) throws PainterException {
- Object data[];
- PAToken patoken;
-
- data = context.popOperands(1);
- if (! (data[0] instanceof PAToken)) {
- throw new PainterException("wrong arguments");
- }
-
- patoken = (PAToken) data[0];
- if (! (patoken.type == PAToken.PROCEDURE)) {
- throw new PainterException("wrong arguments");
- }
- context.engine.process(patoken);
- context.operands.push(new Boolean(false));
- }
- });
-
- return systemDict;
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAEngine.java b/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAEngine.java
deleted file mode 100644
index 8420bef..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAEngine.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright 1998 by Sun Microsystems, Inc.,
- * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information
- * of Sun Microsystems, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Sun.
- */
-
-package com.lowagie.text.pdf.codec.postscript;
-
-import java.lang.*;
-import java.lang.reflect.*;
-import java.util.*;
-import headless.awt.*;
-import headless.awt.geom.*;
-import headless.awt.color.*;
-import headless.awt.font.*;
-
-
-public class PAEngine extends Object {
-
- static public final int MODE_STACK = 0;
- static public final int MODE_PROCEDURE = 1;
- static public final int MODE_ARRAY = 2;
-
- protected PAContext context;
- protected int mode;
- protected Stack procedure;
- protected int innerProcedures;
-
- public PAEngine(PAContext context){
- super();
- this.context = context;
- this.mode = PAEngine.MODE_STACK;
- }
-
- public void startProcedure() throws PainterException {
- this.procedure = new Stack();
- this.mode = PAEngine.MODE_PROCEDURE;
- this.innerProcedures = 0;
- }
-
- public void endProcedure() throws PainterException {
- this.context.operands.push(new PAToken(this.procedure, PAToken.PROCEDURE));
- this.mode = PAEngine.MODE_STACK;
- }
-
- public void bindProcedure(PAToken patoken){
- Stack oldStack = (Stack) patoken.value;
- Stack newStack = new Stack();
- int i,n;
- n = oldStack.size();
- for(i = 0; i < n; i++){
- Object token = oldStack.elementAt(i);
- if((token instanceof PAToken) && ((PAToken) token).type == PAToken.IDENTIFIER){
- Object foundToken = this.context.findIdentifier(((PAToken) token).value);
- if(foundToken == null){
- newStack.push(token);
- } else {
- newStack.push(foundToken);
- }
- } else {
- newStack.push(token);
- }
- }
- patoken.value = newStack;
- }
-
- public void process(Object token) throws PainterException {
- if(token == null){
- throw new IllegalStateException("Null token encountered; last unknown identifier was " + this.context.getLastUnknownIdentifier());
- }
- // System.out.println("==>"+token.toString());
- if(token instanceof PAToken && ((PAToken) token).type == PAToken.IMMEDIATE){
- Object foundValue = this.context.findIdentifier(((PAToken) token).value);
- this.process(foundValue);
- return;
- }
- if(this.mode == MODE_STACK){
- if(token instanceof PACommand){
- ((PACommand) token).execute(this.context);
- } else if(token instanceof PAToken){
- PAToken patoken = (PAToken) token;
-
- switch(patoken.type){
- case PAToken.IDENTIFIER:
- this.process(this.context.findIdentifier(patoken.value));
- break;
- case PAToken.KEY:
- case PAToken.MARK:
- case PAToken.START_ARRAY:
- this.context.operands.push(token);
- break;
- case PAToken.PROCEDURE:
- Enumeration enumx = ((Vector) patoken.value).elements();
- while(enumx.hasMoreElements()){
- this.process(enumx.nextElement());
- }
- break;
- case PAToken.START_PROCEDURE:
- this.startProcedure();
- break;
- case PAToken.END_ARRAY:
- this.context.collectArray();
- break;
- default:
- throw new IllegalStateException("Unknown token encountered" + token);
- }
- } else {
- this.context.operands.push(token);
- }
- } else if(this.mode == MODE_PROCEDURE){
- if(token instanceof PAToken){
- PAToken patoken = (PAToken) token;
-
- switch(patoken.type){
- case PAToken.START_PROCEDURE:
- this.innerProcedures++;
- this.procedure.push(token);
- break;
- case PAToken.END_PROCEDURE:
- if(this.innerProcedures > 0){
- this.innerProcedures--;
- this.procedure.push(token);
- } else {
- this.endProcedure();
- }
- break;
- default:
- this.procedure.push(token);
- }
- } else {
- this.procedure.push(token);
- }
- }
- }
-
-}
-
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAParser.java b/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAParser.java
deleted file mode 100644
index 2f10272..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAParser.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. PAParser.java */
-package com.lowagie.text.pdf.codec.postscript;
-
-import java.lang.*;
-import java.lang.reflect.*;
-import java.util.*;
-import headless.awt.*;
-import headless.awt.geom.*;
-import headless.awt.color.*;
-import headless.awt.font.*;
-
-import java.io.*;
-import java.net.URL;
-
-public class PAParser extends Object implements PAParserConstants {
-
- void error_skipto(int kind) throws ParseException {
-ParseException e=generateParseException();
-Token t;
-String dump="";
-do{
-if(getToken(1).kind==kind)break;
-t=getNextToken();
-dump+=t.image;
-}while(t.kind!=kind);
-System.out.println("Ignoriere >"+dump+"<");
- }
-
- final public void parse(PAContext context) throws ParseException {
- Token x = null;
- try {
- label_1:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case IDENTIFIER:
- case KEY_IDENTIFIER:
- case IMMEDIATE_IDENTIFIER:
- case LBRACE:
- case RBRACE:
- case LBRACKET:
- case RBRACKET:
- ;
- break;
- default:
- jj_la1[0] = jj_gen;
- break label_1;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case IDENTIFIER:
- case KEY_IDENTIFIER:
- case IMMEDIATE_IDENTIFIER:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTEGER_LITERAL:
- x = jj_consume_token(INTEGER_LITERAL);
- try {
- context.engine.process(new Integer(x.image));
- } catch(NumberFormatException e) {
- {if (true) throw new ParseException(e.toString());}
- } catch(PainterException e) {
- {if (true) throw new ParseException(e.toString());}
- }
- break;
- case FLOATING_POINT_LITERAL:
- x = jj_consume_token(FLOATING_POINT_LITERAL);
- try {
- context.engine.process(new Double(x.image));
- } catch(NumberFormatException e) {
- {if (true) throw new ParseException(e.toString());}
- } catch(PainterException e) {
- {if (true) throw new ParseException(e.toString());}
- }
- break;
- case STRING_LITERAL:
- x = jj_consume_token(STRING_LITERAL);
- try {
- context.engine.process(x.image.substring(1, x.image.length() -1));
- } catch(PainterException e) {
- {if (true) throw new ParseException(e.toString());}
- }
- break;
- case IDENTIFIER:
- x = jj_consume_token(IDENTIFIER);
- try {
- context.engine.process(new PAToken(x.image, PAToken.IDENTIFIER));
- } catch(PainterException e) {
- {if (true) throw new ParseException(e.toString());}
- }
- break;
- case KEY_IDENTIFIER:
- x = jj_consume_token(KEY_IDENTIFIER);
- try {
- context.engine.process(new PAToken(x.image.substring(1, x.image.length()), PAToken.KEY));
- } catch(PainterException e) {
- {if (true) throw new ParseException(e.toString());}
- }
- break;
- case IMMEDIATE_IDENTIFIER:
- x = jj_consume_token(IMMEDIATE_IDENTIFIER);
- try {
- context.engine.process(new PAToken(x.image.substring(2, x.image.length()), PAToken.IMMEDIATE));
- } catch(PainterException e) {
- {if (true) throw new ParseException(e.toString());}
- }
- break;
- default:
- jj_la1[1] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- break;
- case LBRACE:
- jj_consume_token(LBRACE);
- try {
- context.engine.process(new PAToken(null, PAToken.START_PROCEDURE));
- } catch(PainterException e) {
- {if (true) throw new ParseException(e.toString());}
- }
- break;
- case RBRACE:
- jj_consume_token(RBRACE);
- try {
- context.engine.process(new PAToken(null, PAToken.END_PROCEDURE));
- } catch(PainterException e) {
- {if (true) throw new ParseException(e.toString());}
- }
- break;
- case LBRACKET:
- jj_consume_token(LBRACKET);
- try {
- context.engine.process(new PAToken(null, PAToken.START_ARRAY));
- } catch(PainterException e) {
- {if (true) throw new ParseException(e.toString());}
- }
- break;
- case RBRACKET:
- jj_consume_token(RBRACKET);
- try {
- context.engine.process(new PAToken(null, PAToken.END_ARRAY));
- } catch(PainterException e) {
- {if (true) throw new ParseException(e.toString());}
- }
- break;
- default:
- jj_la1[2] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- } catch (ParseException e) {
- //System.out.println("Fehlerhaftes Element in Spalte "+e.currentToken.beginColumn+" in Eingabedatei in Zeile="+e.currentToken.next.beginLine+" in Zeichen Nr. "+e.currentToken.next.beginColumn+". >"+e.currentToken.next.image+"< wurde hier nicht erwartet.");
- //System.err.println("Fehler:"+e);
- e.printStackTrace();
- error_skipto(WHITESPACE);
- }
- }
-
- public PAParserTokenManager token_source;
- JavaCharStream jj_input_stream;
- public Token token, jj_nt;
- private int jj_ntk;
- private int jj_gen;
- final private int[] jj_la1 = new int[3];
- final private int[] jj_la1_0 = {0x79e90,0x1e90,0x79e90,};
-
- public PAParser(java.io.InputStream stream) {
- jj_input_stream = new JavaCharStream(stream, 1, 1);
- token_source = new PAParserTokenManager(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 3; i++) jj_la1[i] = -1;
- }
-
- public void ReInit(java.io.InputStream stream) {
- jj_input_stream.ReInit(stream, 1, 1);
- token_source.ReInit(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 3; i++) jj_la1[i] = -1;
- }
-
- public PAParser(java.io.Reader stream) {
- jj_input_stream = new JavaCharStream(stream, 1, 1);
- token_source = new PAParserTokenManager(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 3; i++) jj_la1[i] = -1;
- }
-
- public void ReInit(java.io.Reader stream) {
- jj_input_stream.ReInit(stream, 1, 1);
- token_source.ReInit(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 3; i++) jj_la1[i] = -1;
- }
-
- public PAParser(PAParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 3; i++) jj_la1[i] = -1;
- }
-
- public void ReInit(PAParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 3; i++) jj_la1[i] = -1;
- }
-
- final private Token jj_consume_token(int kind) throws ParseException {
- Token oldToken;
- if ((oldToken = token).next != null) token = token.next;
- else token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- if (token.kind == kind) {
- jj_gen++;
- return token;
- }
- token = oldToken;
- jj_kind = kind;
- throw generateParseException();
- }
-
- final public Token getNextToken() {
- if (token.next != null) token = token.next;
- else token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- jj_gen++;
- return token;
- }
-
- final public Token getToken(int index) {
- Token t = token;
- for (int i = 0; i < index; i++) {
- if (t.next != null) t = t.next;
- else t = t.next = token_source.getNextToken();
- }
- return t;
- }
-
- final private int jj_ntk() {
- if ((jj_nt=token.next) == null)
- return (jj_ntk = (token.next=token_source.getNextToken()).kind);
- else
- return (jj_ntk = jj_nt.kind);
- }
-
- private java.util.Vector jj_expentries = new java.util.Vector();
- private int[] jj_expentry;
- private int jj_kind = -1;
-
- final public ParseException generateParseException() {
- jj_expentries.removeAllElements();
- boolean[] la1tokens = new boolean[19];
- for (int i = 0; i < 19; i++) {
- la1tokens[i] = false;
- }
- if (jj_kind >= 0) {
- la1tokens[jj_kind] = true;
- jj_kind = -1;
- }
- for (int i = 0; i < 3; i++) {
- if (jj_la1[i] == jj_gen) {
- for (int j = 0; j < 32; j++) {
- if ((jj_la1_0[i] & (1<<j)) != 0) {
- la1tokens[j] = true;
- }
- }
- }
- }
- for (int i = 0; i < 19; i++) {
- if (la1tokens[i]) {
- jj_expentry = new int[1];
- jj_expentry[0] = i;
- jj_expentries.addElement(jj_expentry);
- }
- }
- int[][] exptokseq = new int[jj_expentries.size()][];
- for (int i = 0; i < jj_expentries.size(); i++) {
- exptokseq[i] = (int[])jj_expentries.elementAt(i);
- }
- return new ParseException(token, exptokseq, tokenImage);
- }
-
- final public void enable_tracing() {
- }
-
- final public void disable_tracing() {
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAParserConstants.java b/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAParserConstants.java
deleted file mode 100644
index df02229..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAParserConstants.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. PAParserConstants.java */
-package com.lowagie.text.pdf.codec.postscript;
-
-public interface PAParserConstants {
-
- int EOF = 0;
- int WHITESPACE = 1;
- int INTEGER_LITERAL = 4;
- int DECIMAL_LITERAL = 5;
- int HEX_LITERAL = 6;
- int FLOATING_POINT_LITERAL = 7;
- int EXPONENT = 8;
- int STRING_LITERAL = 9;
- int IDENTIFIER = 10;
- int KEY_IDENTIFIER = 11;
- int IMMEDIATE_IDENTIFIER = 12;
- int LETTER = 13;
- int DIGIT = 14;
- int LBRACE = 15;
- int RBRACE = 16;
- int LBRACKET = 17;
- int RBRACKET = 18;
-
- int DEFAULT = 0;
-
- String[] tokenImage = {
- "<EOF>",
- "<WHITESPACE>",
- "<token of kind 2>",
- "<token of kind 3>",
- "<INTEGER_LITERAL>",
- "<DECIMAL_LITERAL>",
- "<HEX_LITERAL>",
- "<FLOATING_POINT_LITERAL>",
- "<EXPONENT>",
- "<STRING_LITERAL>",
- "<IDENTIFIER>",
- "<KEY_IDENTIFIER>",
- "<IMMEDIATE_IDENTIFIER>",
- "<LETTER>",
- "<DIGIT>",
- "\"{\"",
- "\"}\"",
- "\"[\"",
- "\"]\"",
- };
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAParserTokenManager.java b/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAParserTokenManager.java
deleted file mode 100644
index 6dae4f0..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAParserTokenManager.java
+++ /dev/null
@@ -1,803 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. PAParserTokenManager.java */
-package com.lowagie.text.pdf.codec.postscript;
-import java.lang.*;
-import java.lang.reflect.*;
-import java.util.*;
-import headless.awt.*;
-import headless.awt.geom.*;
-import headless.awt.color.*;
-import headless.awt.font.*;
-import java.io.*;
-import java.net.URL;
-
-public class PAParserTokenManager implements PAParserConstants
-{
- public java.io.PrintStream debugStream = System.out;
- public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
-private final int jjStopStringLiteralDfa_0(int pos, long active0)
-{
- switch (pos)
- {
- default :
- return -1;
- }
-}
-private final int jjStartNfa_0(int pos, long active0)
-{
- return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
-}
-private final int jjStopAtPos(int pos, int kind)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- return pos + 1;
-}
-private final int jjStartNfaWithStates_0(int pos, int kind, int state)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return pos + 1; }
- return jjMoveNfa_0(state, pos + 1);
-}
-private final int jjMoveStringLiteralDfa0_0()
-{
- switch(curChar)
- {
- case 91:
- return jjStopAtPos(0, 17);
- case 93:
- return jjStopAtPos(0, 18);
- case 123:
- return jjStopAtPos(0, 15);
- case 125:
- return jjStopAtPos(0, 16);
- default :
- return jjMoveNfa_0(0, 0);
- }
-}
-private final void jjCheckNAdd(int state)
-{
- if (jjrounds[state] != jjround)
- {
- jjstateSet[jjnewStateCnt++] = state;
- jjrounds[state] = jjround;
- }
-}
-private final void jjAddStates(int start, int end)
-{
- do {
- jjstateSet[jjnewStateCnt++] = jjnextStates[start];
- } while (start++ != end);
-}
-private final void jjCheckNAddTwoStates(int state1, int state2)
-{
- jjCheckNAdd(state1);
- jjCheckNAdd(state2);
-}
-private final void jjCheckNAddStates(int start, int end)
-{
- do {
- jjCheckNAdd(jjnextStates[start]);
- } while (start++ != end);
-}
-private final void jjCheckNAddStates(int start)
-{
- jjCheckNAdd(jjnextStates[start]);
- jjCheckNAdd(jjnextStates[start + 1]);
-}
-static final long[] jjbitVec0 = {
- 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
-};
-static final long[] jjbitVec2 = {
- 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
-};
-static final long[] jjbitVec3 = {
- 0x1ff00000fffffffeL, 0xffffffffffffc000L, 0xffffffffL, 0x600000000000000L
-};
-static final long[] jjbitVec4 = {
- 0x0L, 0x0L, 0x0L, 0xff7fffffff7fffffL
-};
-static final long[] jjbitVec5 = {
- 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
-};
-static final long[] jjbitVec6 = {
- 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffL, 0x0L
-};
-static final long[] jjbitVec7 = {
- 0xffffffffffffffffL, 0xffffffffffffffffL, 0x0L, 0x0L
-};
-static final long[] jjbitVec8 = {
- 0x3fffffffffffL, 0x0L, 0x0L, 0x0L
-};
-private final int jjMoveNfa_0(int startState, int curPos)
-{
- int[] nextStates;
- int startsAt = 0;
- jjnewStateCnt = 70;
- int i = 1;
- jjstateSet[0] = startState;
- int j, kind = 0x7fffffff;
- for (;;)
- {
- if (++jjround == 0x7fffffff)
- ReInitRounds();
- if (curChar < 64)
- {
- long l = 1L << curChar;
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 4)
- kind = 4;
- jjCheckNAddStates(0, 8);
- }
- else if ((0x100003600L & l) != 0L)
- {
- if (kind > 1)
- kind = 1;
- }
- else if (curChar == 45)
- jjCheckNAddStates(9, 14);
- else if (curChar == 37)
- jjCheckNAddStates(15, 18);
- else if (curChar == 47)
- jjstateSet[jjnewStateCnt++] = 25;
- else if (curChar == 36)
- {
- if (kind > 10)
- kind = 10;
- jjCheckNAdd(21);
- }
- else if (curChar == 40)
- jjCheckNAddStates(19, 21);
- else if (curChar == 46)
- jjCheckNAdd(6);
- if (curChar == 47)
- jjstateSet[jjnewStateCnt++] = 23;
- else if (curChar == 48)
- jjstateSet[jjnewStateCnt++] = 2;
- break;
- case 1:
- if (curChar == 48)
- jjstateSet[jjnewStateCnt++] = 2;
- break;
- case 3:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 4)
- kind = 4;
- jjCheckNAddTwoStates(3, 4);
- break;
- case 5:
- if (curChar == 46)
- jjCheckNAdd(6);
- break;
- case 6:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 7)
- kind = 7;
- jjCheckNAddStates(22, 24);
- break;
- case 8:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(9);
- break;
- case 9:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 7)
- kind = 7;
- jjCheckNAddTwoStates(9, 10);
- break;
- case 11:
- if (curChar == 40)
- jjCheckNAddStates(19, 21);
- break;
- case 12:
- if ((0xfffffdffffffdbffL & l) != 0L)
- jjCheckNAddStates(19, 21);
- break;
- case 14:
- if ((0x28000000400L & l) != 0L)
- jjCheckNAddStates(19, 21);
- break;
- case 15:
- if (curChar == 41 && kind > 9)
- kind = 9;
- break;
- case 16:
- if ((0xff000000000000L & l) != 0L)
- jjCheckNAddStates(25, 28);
- break;
- case 17:
- if ((0xff000000000000L & l) != 0L)
- jjCheckNAddStates(19, 21);
- break;
- case 18:
- if ((0xf000000000000L & l) != 0L)
- jjstateSet[jjnewStateCnt++] = 19;
- break;
- case 19:
- if ((0xff000000000000L & l) != 0L)
- jjCheckNAdd(17);
- break;
- case 20:
- if (curChar != 36)
- break;
- if (kind > 10)
- kind = 10;
- jjCheckNAdd(21);
- break;
- case 21:
- if ((0x3ff601000000000L & l) == 0L)
- break;
- if (kind > 10)
- kind = 10;
- jjCheckNAdd(21);
- break;
- case 22:
- if (curChar == 47)
- jjstateSet[jjnewStateCnt++] = 23;
- break;
- case 23:
- if (curChar != 36)
- break;
- if (kind > 11)
- kind = 11;
- jjCheckNAdd(24);
- break;
- case 24:
- if ((0x3ff601000000000L & l) == 0L)
- break;
- if (kind > 11)
- kind = 11;
- jjCheckNAdd(24);
- break;
- case 25:
- if (curChar == 47)
- jjstateSet[jjnewStateCnt++] = 26;
- break;
- case 26:
- if (curChar != 36)
- break;
- if (kind > 12)
- kind = 12;
- jjCheckNAdd(27);
- break;
- case 27:
- if ((0x3ff601000000000L & l) == 0L)
- break;
- if (kind > 12)
- kind = 12;
- jjCheckNAdd(27);
- break;
- case 28:
- if (curChar == 47)
- jjstateSet[jjnewStateCnt++] = 25;
- break;
- case 29:
- if (curChar == 37)
- jjCheckNAddStates(15, 18);
- break;
- case 30:
- if ((0xfffffffffffffbffL & l) != 0L)
- jjCheckNAddTwoStates(30, 31);
- break;
- case 31:
- if (curChar == 10 && kind > 2)
- kind = 2;
- break;
- case 32:
- if ((0xffffffffffffdfffL & l) != 0L)
- jjCheckNAddTwoStates(32, 33);
- break;
- case 33:
- if (curChar == 13 && kind > 3)
- kind = 3;
- break;
- case 34:
- if (curChar == 45)
- jjCheckNAddStates(9, 14);
- break;
- case 35:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 4)
- kind = 4;
- jjCheckNAddTwoStates(35, 4);
- break;
- case 36:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(36, 37);
- break;
- case 37:
- if (curChar != 46)
- break;
- if (kind > 7)
- kind = 7;
- jjCheckNAddStates(29, 31);
- break;
- case 38:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 7)
- kind = 7;
- jjCheckNAddStates(29, 31);
- break;
- case 40:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(41);
- break;
- case 41:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 7)
- kind = 7;
- jjCheckNAddTwoStates(41, 10);
- break;
- case 42:
- if (curChar == 46)
- jjCheckNAdd(43);
- break;
- case 43:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 7)
- kind = 7;
- jjCheckNAddStates(32, 34);
- break;
- case 45:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(46);
- break;
- case 46:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 7)
- kind = 7;
- jjCheckNAddTwoStates(46, 10);
- break;
- case 47:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(47, 48);
- break;
- case 49:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(50);
- break;
- case 50:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 7)
- kind = 7;
- jjCheckNAddTwoStates(50, 10);
- break;
- case 51:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(35, 37);
- break;
- case 53:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(54);
- break;
- case 54:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(54, 10);
- break;
- case 55:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 4)
- kind = 4;
- jjCheckNAddStates(0, 8);
- break;
- case 56:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(56, 57);
- break;
- case 57:
- if (curChar != 46)
- break;
- if (kind > 7)
- kind = 7;
- jjCheckNAddStates(38, 40);
- break;
- case 58:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 7)
- kind = 7;
- jjCheckNAddStates(38, 40);
- break;
- case 60:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(61);
- break;
- case 61:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 7)
- kind = 7;
- jjCheckNAddTwoStates(61, 10);
- break;
- case 62:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(62, 63);
- break;
- case 64:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(65);
- break;
- case 65:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 7)
- kind = 7;
- jjCheckNAddTwoStates(65, 10);
- break;
- case 66:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(41, 43);
- break;
- case 68:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(69);
- break;
- case 69:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(69, 10);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else if (curChar < 128)
- {
- long l = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- case 21:
- if ((0x7fffffe87fffffeL & l) == 0L)
- break;
- if (kind > 10)
- kind = 10;
- jjCheckNAdd(21);
- break;
- case 2:
- if ((0x100000001000000L & l) != 0L)
- jjCheckNAdd(3);
- break;
- case 3:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 4)
- kind = 4;
- jjCheckNAddTwoStates(3, 4);
- break;
- case 4:
- if ((0x100000001000L & l) != 0L && kind > 4)
- kind = 4;
- break;
- case 7:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(44, 45);
- break;
- case 10:
- if ((0x5000000050L & l) != 0L && kind > 7)
- kind = 7;
- break;
- case 12:
- if ((0xffffffffefffffffL & l) != 0L)
- jjCheckNAddStates(19, 21);
- break;
- case 13:
- if (curChar == 92)
- jjAddStates(46, 48);
- break;
- case 14:
- if ((0x14404410000000L & l) != 0L)
- jjCheckNAddStates(19, 21);
- break;
- case 23:
- case 24:
- if ((0x7fffffe87fffffeL & l) == 0L)
- break;
- if (kind > 11)
- kind = 11;
- jjCheckNAdd(24);
- break;
- case 26:
- case 27:
- if ((0x7fffffe87fffffeL & l) == 0L)
- break;
- if (kind > 12)
- kind = 12;
- jjCheckNAdd(27);
- break;
- case 30:
- jjAddStates(49, 50);
- break;
- case 32:
- jjAddStates(51, 52);
- break;
- case 39:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(53, 54);
- break;
- case 44:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(55, 56);
- break;
- case 48:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(57, 58);
- break;
- case 52:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(59, 60);
- break;
- case 59:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(61, 62);
- break;
- case 63:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(63, 64);
- break;
- case 67:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(65, 66);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else
- {
- int hiByte = (int)(curChar >> 8);
- int i1 = hiByte >> 6;
- long l1 = 1L << (hiByte & 077);
- int i2 = (curChar & 0xff) >> 6;
- long l2 = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- case 21:
- if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
- break;
- if (kind > 10)
- kind = 10;
- jjCheckNAdd(21);
- break;
- case 12:
- if (jjCanMove_0(hiByte, i1, i2, l1, l2))
- jjAddStates(19, 21);
- break;
- case 23:
- case 24:
- if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
- break;
- if (kind > 11)
- kind = 11;
- jjCheckNAdd(24);
- break;
- case 26:
- case 27:
- if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
- break;
- if (kind > 12)
- kind = 12;
- jjCheckNAdd(27);
- break;
- case 30:
- if (jjCanMove_0(hiByte, i1, i2, l1, l2))
- jjAddStates(49, 50);
- break;
- case 32:
- if (jjCanMove_0(hiByte, i1, i2, l1, l2))
- jjAddStates(51, 52);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- if (kind != 0x7fffffff)
- {
- jjmatchedKind = kind;
- jjmatchedPos = curPos;
- kind = 0x7fffffff;
- }
- ++curPos;
- if ((i = jjnewStateCnt) == (startsAt = 70 - (jjnewStateCnt = startsAt)))
- return curPos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return curPos; }
- }
-}
-static final int[] jjnextStates = {
- 35, 4, 56, 57, 62, 63, 66, 67, 10, 35, 1, 36, 42, 47, 51, 30,
- 31, 32, 33, 12, 13, 15, 6, 7, 10, 12, 13, 17, 15, 38, 39, 10,
- 43, 44, 10, 51, 52, 10, 58, 59, 10, 66, 67, 10, 8, 9, 14, 16,
- 18, 30, 31, 32, 33, 40, 41, 45, 46, 49, 50, 53, 54, 60, 61, 64,
- 65, 68, 69,
-};
-private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
-{
- switch(hiByte)
- {
- case 0:
- return ((jjbitVec2[i2] & l2) != 0L);
- default :
- if ((jjbitVec0[i1] & l1) != 0L)
- return true;
- return false;
- }
-}
-private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2)
-{
- switch(hiByte)
- {
- case 0:
- return ((jjbitVec4[i2] & l2) != 0L);
- case 48:
- return ((jjbitVec5[i2] & l2) != 0L);
- case 49:
- return ((jjbitVec6[i2] & l2) != 0L);
- case 51:
- return ((jjbitVec7[i2] & l2) != 0L);
- case 61:
- return ((jjbitVec8[i2] & l2) != 0L);
- default :
- if ((jjbitVec3[i1] & l1) != 0L)
- return true;
- return false;
- }
-}
-public static final String[] jjstrLiteralImages = {
-"", null, null, null, null, null, null, null, null, null, null, null, null,
-null, null, "\173", "\175", "\133", "\135", };
-public static final String[] lexStateNames = {
- "DEFAULT",
-};
-static final long[] jjtoToken = {
- 0x79e91L,
-};
-static final long[] jjtoSkip = {
- 0xeL,
-};
-private JavaCharStream input_stream;
-private final int[] jjrounds = new int[70];
-private final int[] jjstateSet = new int[140];
-protected char curChar;
-public PAParserTokenManager(JavaCharStream stream)
-{
- if (JavaCharStream.staticFlag)
- throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
- input_stream = stream;
-}
-public PAParserTokenManager(JavaCharStream stream, int lexState)
-{
- this(stream);
- SwitchTo(lexState);
-}
-public void ReInit(JavaCharStream stream)
-{
- jjmatchedPos = jjnewStateCnt = 0;
- curLexState = defaultLexState;
- input_stream = stream;
- ReInitRounds();
-}
-private final void ReInitRounds()
-{
- int i;
- jjround = 0x80000001;
- for (i = 70; i-- > 0;)
- jjrounds[i] = 0x80000000;
-}
-public void ReInit(JavaCharStream stream, int lexState)
-{
- ReInit(stream);
- SwitchTo(lexState);
-}
-public void SwitchTo(int lexState)
-{
- if (lexState >= 1 || lexState < 0)
- throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
- else
- curLexState = lexState;
-}
-
-private final Token jjFillToken()
-{
- Token t = Token.newToken(jjmatchedKind);
- t.kind = jjmatchedKind;
- String im = jjstrLiteralImages[jjmatchedKind];
- t.image = (im == null) ? input_stream.GetImage() : im;
- t.beginLine = input_stream.getBeginLine();
- t.beginColumn = input_stream.getBeginColumn();
- t.endLine = input_stream.getEndLine();
- t.endColumn = input_stream.getEndColumn();
- return t;
-}
-
-int curLexState = 0;
-int defaultLexState = 0;
-int jjnewStateCnt;
-int jjround;
-int jjmatchedPos;
-int jjmatchedKind;
-
-public final Token getNextToken()
-{
- int kind;
- Token specialToken = null;
- Token matchedToken;
- int curPos = 0;
-
- EOFLoop :
- for (;;)
- {
- try
- {
- curChar = input_stream.BeginToken();
- }
- catch(java.io.IOException e)
- {
- jjmatchedKind = 0;
- matchedToken = jjFillToken();
- return matchedToken;
- }
-
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_0();
- if (jjmatchedKind != 0x7fffffff)
- {
- if (jjmatchedPos + 1 < curPos)
- input_stream.backup(curPos - jjmatchedPos - 1);
- if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
- {
- matchedToken = jjFillToken();
- return matchedToken;
- }
- else
- {
- continue EOFLoop;
- }
- }
- int error_line = input_stream.getEndLine();
- int error_column = input_stream.getEndColumn();
- String error_after = null;
- boolean EOFSeen = false;
- try { input_stream.readChar(); input_stream.backup(1); }
- catch (java.io.IOException e1) {
- EOFSeen = true;
- error_after = curPos <= 1 ? "" : input_stream.GetImage();
- if (curChar == '\n' || curChar == '\r') {
- error_line++;
- error_column = 0;
- }
- else
- error_column++;
- }
- if (!EOFSeen) {
- input_stream.backup(1);
- error_after = curPos <= 1 ? "" : input_stream.GetImage();
- }
- throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
- }
-}
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAPencil.java b/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAPencil.java
deleted file mode 100644
index 65f9fba..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAPencil.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * Copyright 1998 by Sun Microsystems, Inc.,
- * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information
- * of Sun Microsystems, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Sun.
- */
-
-package com.lowagie.text.pdf.codec.postscript;
-
-import java.util.*;
-import headless.awt.*;
-import headless.awt.font.*;
-import headless.awt.geom.*;
-
-
-public class PAPencil extends Object {
-
- static protected class State extends Object implements Cloneable {
- public Stroke stroke;
- public Paint paint;
- public AffineTransform at;
- public Shape clipShape;
- public Font font;
- public Composite composite;
- public GeneralPath path;
-
- public State(){
- this(null);
- }
-
- public State(Graphics2D g){
- if(g == null){
- this.stroke = new BasicStroke();
- this.paint = Color.black;
- this.at = new AffineTransform();
- this.font = new Font("SansSerif", Font.PLAIN, 12);
- this.composite = AlphaComposite.getInstance(AlphaComposite.DST_OVER, 1.0f);
- this.clipShape = null;
- } else {
- this.recordState(g);
- }
- this.path = new GeneralPath();
- }
-
- public void recordState(Graphics2D g){
- this.stroke = g.getStroke();
- this.paint = g.getPaint();
- this.at = g.getTransform();
- this.font = g.getFont();
- this.composite = g.getComposite();
- this.clipShape = g.getClip();
- }
-
- public void stampState(Graphics2D g, Dimension size){
- g.setTransform(new AffineTransform());
- g.setClip(new Rectangle(0, 0, size.width, size.height));
- g.setStroke(this.stroke);
- g.setPaint(this.paint);
- g.setTransform(this.at);
- g.setFont(this.font);
- g.setComposite(this.composite);
- if(this.clipShape != null){
- g.clip(this.clipShape);
- }
- }
-
- public Object clone(){
- try {
- State n = (State)super.clone();
-
- n.at = (AffineTransform) this.at.clone();
- n.path = new GeneralPath();
- n.path.append(this.path, false);
- return n;
- } catch(CloneNotSupportedException e){
- throw new InternalError();
- }
- }
-
- }
-
- //
- // Class Variables
- //
-
- //
- // Instance Variables
- //
-
- /**
- * The canvas size.
- */
- protected Dimension size;
-
- /**
- * The current graphics state.
- */
- protected State state;
-
- /**
- * The stack of graphic states.
- */
- protected Stack gStack;
-
- /**
- * The font hashtable with postscript names as keys
- */
- protected HashMap fonts;
-
- /**
- * The current graphics device
- */
- public Graphics2D graphics;
-
- //
- // Constructors
- //
-
- public PAPencil(Component component){
- this.graphics = (Graphics2D) component.getGraphics();
- this.size = component.getSize();
- this.initgraphics();
- }
-
- public PAPencil(Graphics graphics, Dimension size){
- this.graphics = (Graphics2D) graphics;
- this.size = size;
- this.initgraphics();
- }
-
- //
- // Graphics state management
- //
-
- public void gsave(){
- this.state.recordState(this.graphics);
- State next = (State) this.state.clone();
-
- this.gStack.push(this.state);
- this.state = next;
- }
-
- public void grestore(){
- if(this.gStack.empty()){
- this.initgraphics();
- } else {
- this.state = (State) this.gStack.pop();
- this.state.stampState(this.graphics, this.size);
- }
- }
-
- public void grestoreall(){
- this.initgraphics();
- }
-
- public void initgraphics(){
- // AffineTransform at = new AffineTransform();
-
- // turn anti-aliasing and high-quality rendering on
- this.graphics.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
- this.graphics.setRenderingHints(new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY));
-
- // initialize to a postscript coordinate system
-// at.translate(0, this.size.getHeight());
-// at.scale(1, -1);
-// this.graphics.setTransform(at);
- this.graphics.translate(0, this.size.getHeight());
- this.graphics.scale(1, -1);
-
- // state, stack and page
- this.state = new State(this.graphics);
- this.gStack = new Stack();
- this.erasepage();
- }
-
- //
- // Path definition
- //
-
- public void newpath(){
- this.state.path.reset();
- }
-
- public void moveto(double x, double y){
- this.state.path.moveTo((float) x, (float) y);
- }
-
- public void moveto(Point2D p) {
- this.moveto(p.getX(), p.getY());
- }
-
- public void rmoveto(double dx, double dy) throws PainterException {
- Point2D currentPoint = this.state.path.getCurrentPoint();
-
- if(currentPoint == null){
- throw new PainterException("no current point");
- }
- this.state.path.moveTo((float) (currentPoint.getX() + dx) , (float) (currentPoint.getY() + dy));
- }
-
- public void lineto(double x, double y) throws PainterException {
- Point2D currentPoint = this.state.path.getCurrentPoint();
-
- if(currentPoint == null){
- throw new PainterException("no current point");
- }
- this.state.path.lineTo((float) x, (float) y);
- }
-
- public void lineto(Point2D p) throws PainterException {
- this.lineto(p.getX(), p.getY());
- }
-
- public void rlineto(double dx, double dy) throws PainterException {
- Point2D currentPoint = this.state.path.getCurrentPoint();
-
- if(currentPoint == null){
- throw new PainterException("no current point");
- }
- this.state.path.lineTo((float) (currentPoint.getX() + dx) , (float) (currentPoint.getY() + dy));
- }
-
- public void arc(double cx, double cy, double r, double ang1, double ang2){
- Arc2D.Float arc = new Arc2D.Float((float) cx, (float) cy, (float) r, (float) r,
- (float) ang1, (float) (ang2 - ang1), Arc2D.OPEN);
- Point2D currentPoint = this.state.path.getCurrentPoint();
-
- if(currentPoint == null){
- this.state.path.append(arc, false);
- } else {
- this.state.path.append(arc, true);
- }
- }
-
- public void arcn(double cx, double cy, double r,
- double ang1, double ang2) {
- Arc2D.Float arc = new Arc2D.Float((float) cx, (float) cy, (float) r, (float) r,
- (float) ang1, (float) (ang1 - ang2), Arc2D.OPEN);
- Point2D currentPoint = this.state.path.getCurrentPoint();
-
- if(currentPoint == null){
- this.state.path.append(arc, false);
- } else {
- this.state.path.append(arc, true);
- }
- }
-
- public void curveto(double x1, double y1, double x2, double y2,
- double x3, double y3) throws PainterException {
- Point2D currentPoint = this.state.path.getCurrentPoint();
-
- if(currentPoint == null){
- throw new PainterException("no current point");
- }
- this.state.path.curveTo((float) x1, (float) y1, (float) x2, (float) y2,
- (float) x3, (float) y3);
- }
-
- public void rcurveto(double dx1, double dy1, double dx2, double dy2,
- double dx3, double dy3) throws PainterException {
- Point2D currentPoint = this.state.path.getCurrentPoint();
-
- if(currentPoint == null){
- throw new PainterException("no current point");
- }
- double x0 = currentPoint.getX();
- double y0 = currentPoint.getY();
- this.curveto(x0 + dx1, y0 + dy1, x0 + dx2, y0 + dy2, x0 + dx3,y0 + dy3);
- }
-
- public void closepath(){
- this.state.path.closePath();
- }
-
- // PENDING(uweh): just a placeholder for now
- public void clippath(){
- this.rectpath(0.0d, 0.0d, 800.0d, 800.0d);
- }
-
- public void erasepage(){
- this.graphics.clearRect(0, 0, 800, 800);
- }
-
- public void charpath(String aString, boolean adjustForStroking){
- GlyphVector glyphVector = this.state.font.createGlyphVector(this.graphics.getFontRenderContext(), aString);
-
- Shape glyphShape = glyphVector.getOutline();
- this.state.path.append(glyphShape, false);
- }
-
- public void showpage(){
-
- }
-
- public void show(String string) throws PainterException {
- Point2D currentPoint = this.state.path.getCurrentPoint();
- AffineTransform currentTransform = this.graphics.getTransform();
- Point2D tranformedPoint = currentTransform.transform(currentPoint, null);
-
-
- if(currentPoint == null){
- throw new PainterException("no current point");
- }
- this.graphics.setTransform(new AffineTransform());
- this.graphics.drawString(string, (float) tranformedPoint.getX(), (float) tranformedPoint.getY());
- this.graphics.setTransform(currentTransform);
- }
-
- public void fill(){
- this.graphics.fill(this.state.path);
- this.newpath();
- }
-
- public void eofill(){
- this.state.path.setWindingRule(GeneralPath.WIND_EVEN_ODD);
- this.graphics.fill(this.state.path);
- this.state.path.setWindingRule(GeneralPath.WIND_NON_ZERO);
- this.newpath();
- }
-
- public void stroke(){
- this.graphics.draw(this.state.path);
- this.newpath();
- }
-
- public void rectfill(double x, double y, double width, double height){
- this.gsave();
- this.rectpath(x, y, width, height);
- this.fill();
- this.grestore();
- }
-
- public void rectfill(Rectangle2D rect){
- this.rectfill(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
- }
-
- public void rectstroke(double x, double y, double width, double height){
- this.gsave();
- this.rectpath(x, y, width, height);
- this.stroke();
- this.grestore();
- }
-
- public void rectstroke(Rectangle2D rect){
- this.rectstroke(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
- }
-
- public void rectpath(double x, double y, double width, double height){
- this.newpath();
- this.moveto(x, y);
- try {
- this.rlineto(width, 0);
- this.rlineto(0, height);
- this.rlineto(-width, 0);
- } catch(PainterException e){
- }
- this.closepath();
- }
-
- // convenience
-
- // this guy tries to find an appropiate font
- // if he fails returns whatever font he wants
- public Font findFont(String fontname){
- Font result;
- StringBuffer buffer = new StringBuffer(fontname);
- int i, n;
- n = buffer.length();
-
- for(i = 0; i < n; i++){
- if(buffer.charAt(i) == '-'){
- buffer.setCharAt(i,' ');
- }
- }
-
- fontname = buffer.toString();
-
- if(this.fonts == null){
- // construct the fonts dictionary
- GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment();
- Font[] fontArray = genv.getAllFonts();
- this.fonts = new HashMap();
- for(i = 0; i < fontArray.length; i++){
- String postscriptName = fontArray[i].getPSName();
- this.fonts.put(postscriptName, fontArray[i]);
- }
- }
- result = (Font) this.fonts.get(fontname);
- if(result == null){
- result = new Font("SansSerif", Font.PLAIN, 12);
- }
- return result;
- }
-}
-
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAToken.java b/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAToken.java
deleted file mode 100644
index 0cb6fa3..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PAToken.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 1998 by Sun Microsystems, Inc.,
- * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information
- * of Sun Microsystems, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Sun.
- */
-
-package com.lowagie.text.pdf.codec.postscript;
-
-import java.lang.*;
-import java.lang.reflect.*;
-import java.util.*;
-import headless.awt.*;
-import headless.awt.geom.*;
-import headless.awt.color.*;
-import headless.awt.font.*;
-
-public class PAToken extends Object {
-
- static public final int IDENTIFIER = 0;
- static public final int KEY = 1;
- static public final int PROCEDURE = 2;
- static public final int MARK = 3;
- static public final int START_PROCEDURE = 4;
- static public final int END_PROCEDURE = 5;
- static public final int IMMEDIATE = 6;
- static public final int START_ARRAY = 7;
- static public final int END_ARRAY = 8;
-
- public Object value;
- public int type;
-
- public PAToken(Object value, int type){
- super();
- this.value = value;
- this.type = type;
- }
-
- public String toString(){
- switch(this.type){
- case IDENTIFIER:
- return "IDENTIFIER " + this.value.toString();
- case KEY:
- return "KEY " + this.value.toString();
- case PROCEDURE:
- return "PROCEDURE " + this.value.toString();
- case MARK:
- return "MARK";
- case START_PROCEDURE:
- return "START_PROCEDURE";
- case END_PROCEDURE:
- return "END_PROCEDURE";
- case IMMEDIATE:
- return "IMMEDIATE " + this.value.toString();
- case START_ARRAY:
- return "START_ARRAY";
- case END_ARRAY:
- return "END_ARRAY";
- }
- return this.value.toString();
- }
-
-}
-
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PainterException.java b/LibrarySource/com/lowagie/text/pdf/codec/postscript/PainterException.java
deleted file mode 100644
index 6250891..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/postscript/PainterException.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 1998 by Sun Microsystems, Inc.,
- * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information
- * of Sun Microsystems, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Sun.
- */
-
-package com.lowagie.text.pdf.codec.postscript;
-
-import java.lang.*;
-
-public class PainterException extends Exception {
-
- public PainterException(String msg){
- super(msg);
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/postscript/ParseException.java b/LibrarySource/com/lowagie/text/pdf/codec/postscript/ParseException.java
deleted file mode 100644
index c4a1c9b..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/postscript/ParseException.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 2.1 */
-package com.lowagie.text.pdf.codec.postscript;
-
-/**
- * This exception is thrown when parse errors are encountered.
- * You can explicitly create objects of this exception type by
- * calling the method generateParseException in the generated
- * parser.
- *
- * You can modify this class to customize your error reporting
- * mechanisms so long as you retain the public fields.
- */
-public class ParseException extends Exception {
-
- /**
- * This constructor is used by the method "generateParseException"
- * in the generated parser. Calling this constructor generates
- * a new object of this type with the fields "currentToken",
- * "expectedTokenSequences", and "tokenImage" set. The boolean
- * flag "specialConstructor" is also set to true to indicate that
- * this constructor was used to create this object.
- * This constructor calls its super class with the empty string
- * to force the "toString" method of parent class "Throwable" to
- * print the error message in the form:
- * ParseException: <result of getMessage>
- */
- public ParseException(Token currentTokenVal,
- int[][] expectedTokenSequencesVal,
- String[] tokenImageVal
- )
- {
- super("");
- specialConstructor = true;
- currentToken = currentTokenVal;
- expectedTokenSequences = expectedTokenSequencesVal;
- tokenImage = tokenImageVal;
- }
-
- /**
- * The following constructors are for use by you for whatever
- * purpose you can think of. Constructing the exception in this
- * manner makes the exception behave in the normal way - i.e., as
- * documented in the class "Throwable". The fields "errorToken",
- * "expectedTokenSequences", and "tokenImage" do not contain
- * relevant information. The JavaCC generated code does not use
- * these constructors.
- */
-
- public ParseException() {
- super();
- specialConstructor = false;
- }
-
- public ParseException(String message) {
- super(message);
- specialConstructor = false;
- }
-
- /**
- * This variable determines which constructor was used to create
- * this object and thereby affects the semantics of the
- * "getMessage" method (see below).
- */
- protected boolean specialConstructor;
-
- /**
- * This is the last token that has been consumed successfully. If
- * this object has been created due to a parse error, the token
- * followng this token will (therefore) be the first error token.
- */
- public Token currentToken;
-
- /**
- * Each entry in this array is an array of integers. Each array
- * of integers represents a sequence of tokens (by their ordinal
- * values) that is expected at this point of the parse.
- */
- public int[][] expectedTokenSequences;
-
- /**
- * This is a reference to the "tokenImage" array of the generated
- * parser within which the parse error occurred. This array is
- * defined in the generated ...Constants interface.
- */
- public String[] tokenImage;
-
- /**
- * This method has the standard behavior when this object has been
- * created using the standard constructors. Otherwise, it uses
- * "currentToken" and "expectedTokenSequences" to generate a parse
- * error message and returns it. If this object has been created
- * due to a parse error, and you do not catch it (it gets thrown
- * from the parser), then this method is called during the printing
- * of the final stack trace, and hence the correct error message
- * gets displayed.
- */
- public String getMessage() {
- if (!specialConstructor) {
- return super.getMessage();
- }
- String expected = "";
- int maxSize = 0;
- for (int i = 0; i < expectedTokenSequences.length; i++) {
- if (maxSize < expectedTokenSequences[i].length) {
- maxSize = expectedTokenSequences[i].length;
- }
- for (int j = 0; j < expectedTokenSequences[i].length; j++) {
- expected += tokenImage[expectedTokenSequences[i][j]] + " ";
- }
- if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
- expected += "...";
- }
- expected += eol + " ";
- }
- String retval = "Encountered \"";
- Token tok = currentToken.next;
- for (int i = 0; i < maxSize; i++) {
- if (i != 0) retval += " ";
- if (tok.kind == 0) {
- retval += tokenImage[0];
- break;
- }
- retval += add_escapes(tok.image);
- tok = tok.next;
- }
- retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
- retval += "." + eol;
- if (expectedTokenSequences.length == 1) {
- retval += "Was expecting:" + eol + " ";
- } else {
- retval += "Was expecting one of:" + eol + " ";
- }
- retval += expected;
- return retval;
- }
-
- /**
- * The end of line string for this machine.
- */
- protected String eol = System.getProperty("line.separator", "\n");
-
- /**
- * Used to convert raw characters to their escaped version
- * when these raw version cannot be used as part of an ASCII
- * string literal.
- */
- protected String add_escapes(String str) {
- StringBuffer retval = new StringBuffer();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u" + s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- continue;
- }
- }
- return retval.toString();
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/postscript/Token.java b/LibrarySource/com/lowagie/text/pdf/codec/postscript/Token.java
deleted file mode 100644
index c45f0d3..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/postscript/Token.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. Token.java Version 2.1 */
-package com.lowagie.text.pdf.codec.postscript;
-
-/**
- * Describes the input token stream.
- */
-
-public class Token {
-
- /**
- * An integer that describes the kind of this token. This numbering
- * system is determined by JavaCCParser, and a table of these numbers is
- * stored in the file ...Constants.java.
- */
- public int kind;
-
- /**
- * beginLine and beginColumn describe the position of the first character
- * of this token; endLine and endColumn describe the position of the
- * last character of this token.
- */
- public int beginLine, beginColumn, endLine, endColumn;
-
- /**
- * The string image of the token.
- */
- public String image;
-
- /**
- * A reference to the next regular (non-special) token from the input
- * stream. If this is the last token from the input stream, or if the
- * token manager has not read tokens beyond this one, this field is
- * set to null. This is true only if this token is also a regular
- * token. Otherwise, see below for a description of the contents of
- * this field.
- */
- public Token next;
-
- /**
- * This field is used to access special tokens that occur prior to this
- * token, but after the immediately preceding regular (non-special) token.
- * If there are no such special tokens, this field is set to null.
- * When there are more than one such special token, this field refers
- * to the last of these special tokens, which in turn refers to the next
- * previous special token through its specialToken field, and so on
- * until the first special token (whose specialToken field is null).
- * The next fields of special tokens refer to other special tokens that
- * immediately follow it (without an intervening regular token). If there
- * is no such token, this field is null.
- */
- public Token specialToken;
-
- /**
- * Returns the image.
- */
- public final String toString()
- {
- return image;
- }
-
- /**
- * Returns a new Token object, by default. However, if you want, you
- * can create and return subclass objects based on the value of ofKind.
- * Simply add the cases to the switch for all those special cases.
- * For example, if you have a subclass of Token called IDToken that
- * you want to create if ofKind is ID, simlpy add something like :
- *
- * case MyParserConstants.ID : return new IDToken();
- *
- * to the following switch statement. Then you can cast matchedToken
- * variable to the appropriate type and use it in your lexical actions.
- */
- public static final Token newToken(int ofKind)
- {
- switch(ofKind)
- {
- default : return new Token();
- }
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/postscript/TokenMgrError.java b/LibrarySource/com/lowagie/text/pdf/codec/postscript/TokenMgrError.java
deleted file mode 100644
index 7445bf7..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/postscript/TokenMgrError.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 2.1 */
-package com.lowagie.text.pdf.codec.postscript;
-
-public class TokenMgrError extends Error
-{
- /*
- * Ordinals for various reasons why an Error of this type can be thrown.
- */
-
- /**
- * Lexical error occured.
- */
- static final int LEXICAL_ERROR = 0;
-
- /**
- * An attempt wass made to create a second instance of a static token manager.
- */
- static final int STATIC_LEXER_ERROR = 1;
-
- /**
- * Tried to change to an invalid lexical state.
- */
- static final int INVALID_LEXICAL_STATE = 2;
-
- /**
- * Detected (and bailed out of) an infinite loop in the token manager.
- */
- static final int LOOP_DETECTED = 3;
-
- /**
- * Indicates the reason why the exception is thrown. It will have
- * one of the above 4 values.
- */
- int errorCode;
-
- /**
- * Replaces unprintable characters by their espaced (or unicode escaped)
- * equivalents in the given string
- */
- protected static final String addEscapes(String str) {
- StringBuffer retval = new StringBuffer();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u" + s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- continue;
- }
- }
- return retval.toString();
- }
-
- /**
- * Returns a detailed message for the Error when it is thrown by the
- * token manager to indicate a lexical error.
- * Parameters :
- * EOFSeen : indicates if EOF caused the lexicl error
- * curLexState : lexical state in which this error occured
- * errorLine : line number when the error occured
- * errorColumn : column number when the error occured
- * errorAfter : prefix that was seen before this error occured
- * curchar : the offending character
- * Note: You can customize the lexical error message by modifying this method.
- */
- private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
- return("Lexical error at line " +
- errorLine + ", column " +
- errorColumn + ". Encountered: " +
- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
- "after : \"" + addEscapes(errorAfter) + "\"");
- }
-
- /**
- * You can also modify the body of this method to customize your error messages.
- * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
- * of end-users concern, so you can return something like :
- *
- * "Internal Error : Please file a bug report .... "
- *
- * from this method for such cases in the release version of your parser.
- */
- public String getMessage() {
- return super.getMessage();
- }
-
- /*
- * Constructors of various flavors follow.
- */
-
- public TokenMgrError() {
- }
-
- public TokenMgrError(String message, int reason) {
- super(message);
- errorCode = reason;
- }
-
- public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
- this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/postscript/paparser.jj b/LibrarySource/com/lowagie/text/pdf/codec/postscript/paparser.jj
deleted file mode 100644
index 8aafa1c..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/postscript/paparser.jj
+++ /dev/null
@@ -1,290 +0,0 @@
-options {
- LOOKAHEAD=1;
- JAVA_UNICODE_ESCAPE = true;
- STATIC = false;
-}
-
-PARSER_BEGIN(PAParser)
-
-package com.lowagie.text.pdf.codec.postscript;
-
-import java.lang.*;
-import java.lang.reflect.*;
-import java.util.*;
-import java.awt.*;
-import java.awt.geom.*;
-import java.awt.color.*;
-import java.awt.font.*;
-
-import java.io.*;
-import java.net.URL;
-
-public class PAParser extends Object {
-
-}
-
-PARSER_END(PAParser)
-
-
-/* WHITE SPACE */
-
-SKIP :
-{
- < WHITESPACE: " " | "\t" | "\n" | "\r" | "\f" >
-|
- < "%" ( ~["\n"] )* "\n" >
- |
- < "%" ( ~["\r"] )* "\r" >
-}
-
-/* LITERALS */
-
-TOKEN :
-{
- < INTEGER_LITERAL:
- ("-")? ( <DECIMAL_LITERAL> (["l","L"])?
- | <HEX_LITERAL> (["l","L"])?
- )
- >
-|
- < #DECIMAL_LITERAL: ["0"-"9"] (["0"-"9"])* >
-|
- < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
-|
- < FLOATING_POINT_LITERAL:
- ((["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])?)
- | ("." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])?)
- | ((["0"-"9"])+ <EXPONENT> (["f","F","d","D"])?)
- | ((["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"])
- | ("-" (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])?)
- | ("-" "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])?)
- | ("-" (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])?)
- | ("-" (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"])
- >
-|
- < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
-|
- < STRING_LITERAL:
- "("
- ( (~[")","\\","\n","\r"])
- | ("\\"
- ( ["n","t","b","r","f","\\","'",")", "\n"]
- | ["0"-"7"] ( ["0"-"7"] )?
- | ["0"-"3"] ["0"-"7"] ["0"-"7"]
- )
- )
- )*
- ")"
- >
-}
-
-/* IDENTIFIERS */
-
-TOKEN :
-{
- < IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>|"-"|".")* >
-|
- < KEY_IDENTIFIER: "/" <IDENTIFIER> >
-|
- < IMMEDIATE_IDENTIFIER: "//" <IDENTIFIER> >
-|
- < #LETTER:
- [
- "\u0024",
- "\u0041"-"\u005a",
- "\u005f",
- "\u0061"-"\u007a",
- "\u00c0"-"\u00d6",
- "\u00d8"-"\u00f6",
- "\u00f8"-"\u00ff",
- "\u0100"-"\u1fff",
- "\u3040"-"\u318f",
- "\u3300"-"\u337f",
- "\u3400"-"\u3d2d",
- "\u4e00"-"\u9fff",
- "\uf900"-"\ufaff"
- ]
- >
-|
- < #DIGIT:
- [
- "\u0030"-"\u0039",
- "\u0660"-"\u0669",
- "\u06f0"-"\u06f9",
- "\u0966"-"\u096f",
- "\u09e6"-"\u09ef",
- "\u0a66"-"\u0a6f",
- "\u0ae6"-"\u0aef",
- "\u0b66"-"\u0b6f",
- "\u0be7"-"\u0bef",
- "\u0c66"-"\u0c6f",
- "\u0ce6"-"\u0cef",
- "\u0d66"-"\u0d6f",
- "\u0e50"-"\u0e59",
- "\u0ed0"-"\u0ed9",
- "\u1040"-"\u1049"
- ]
- >
-}
-
-/* SEPARATORS */
-
-TOKEN :
-{
-
- < LBRACE: "{" >
-| < RBRACE: "}" >
-| < LBRACKET: "[" >
-| < RBRACKET: "]" >
-
-}
-
-JAVACODE
-void error_skipto(int kind){
-ParseException e=generateParseException();
-Token t;
-String dump="";
-do{
-if(getToken(1).kind==kind)break;
-t=getNextToken();
-dump+=t.image;
-}while(t.kind!=kind);
-System.out.println("Ignoriere >"+dump+"<");
-}
-
-
-void parse(PAContext context) :
-{
- Token x = null;
-}
-{
- try{
- (
- (
- ( (
- x = <INTEGER_LITERAL>
- {
- try {
- context.engine.process(new Integer(x.image));
- } catch(NumberFormatException e) {
- throw new ParseException(e.toString());
- } catch(PainterException e) {
- throw new ParseException(e.toString());
- }
- }
- )
- |
- (
- x = <FLOATING_POINT_LITERAL>
- {
- try {
- context.engine.process(new Double(x.image));
- } catch(NumberFormatException e) {
- throw new ParseException(e.toString());
- } catch(PainterException e) {
- throw new ParseException(e.toString());
- }
- }
- )
- |
- (
- x = <STRING_LITERAL>
- {
- try {
- context.engine.process(x.image.substring(1, x.image.length() -1));
- } catch(PainterException e) {
- throw new ParseException(e.toString());
- }
- }
- )
- |
- (
- x = <IDENTIFIER>
- {
- try {
- context.engine.process(new PAToken(x.image, PAToken.IDENTIFIER));
- } catch(PainterException e) {
- throw new ParseException(e.toString());
- }
- }
- )
- |
- (
- x = <KEY_IDENTIFIER>
- {
- try {
- context.engine.process(new PAToken(x.image.substring(1, x.image.length()), PAToken.KEY));
- } catch(PainterException e) {
- throw new ParseException(e.toString());
- }
- }
- )
- |
- (
- x = <IMMEDIATE_IDENTIFIER>
- {
- try {
- context.engine.process(new PAToken(x.image.substring(2, x.image.length()), PAToken.IMMEDIATE));
- } catch(PainterException e) {
- throw new ParseException(e.toString());
- }
- }
- ) )
- |
- (
- <LBRACE>
- {
- try {
- context.engine.process(new PAToken(null, PAToken.START_PROCEDURE));
- } catch(PainterException e) {
- throw new ParseException(e.toString());
- }
- }
- )
- |
- (
- <RBRACE>
- {
- try {
- context.engine.process(new PAToken(null, PAToken.END_PROCEDURE));
- } catch(PainterException e) {
- throw new ParseException(e.toString());
- }
- }
- )
- |
- (
- <LBRACKET>
- {
- try {
- context.engine.process(new PAToken(null, PAToken.START_ARRAY));
- } catch(PainterException e) {
- throw new ParseException(e.toString());
- }
- }
- )
- |
- (
- <RBRACKET>
- {
- try {
- context.engine.process(new PAToken(null, PAToken.END_ARRAY));
- } catch(PainterException e) {
- throw new ParseException(e.toString());
- }
- }
- )
- )//{System.out.println(">>>"+token.image+"");System.out.flush();}
- )*
-
- }catch(ParseException e){
- //System.out.println("Fehlerhaftes Element in Spalte "+e.currentToken.beginColumn+" in Eingabedatei in Zeile="+e.currentToken.next.beginLine+" in Zeichen Nr. "+e.currentToken.next.beginColumn+". >"+e.currentToken.next.image+"< wurde hier nicht erwartet.");
- //System.err.println("Fehler:"+e);
- e.printStackTrace();
- error_skipto(WHITESPACE);
- }
-}
-
-
-
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/wmf/InputMeta.java b/LibrarySource/com/lowagie/text/pdf/codec/wmf/InputMeta.java
deleted file mode 100644
index afd9c1e..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/wmf/InputMeta.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * $Id: InputMeta.java,v 1.15 2002/06/18 13:59:57 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf.codec.wmf;
-
-import java.io.*;
-import headless.awt.Color;
-
-public class InputMeta {
-
- InputStream in;
- int length;
-
- public InputMeta(InputStream in) {
- this.in = in;
- }
-
- public int readWord() throws IOException{
- length += 2;
- int k1 = in.read();
- if (k1 < 0)
- return 0;
- return (k1 + (in.read() << 8)) & 0xffff;
- }
-
- public int readShort() throws IOException{
- int k = readWord();
- if (k > 0x7fff)
- k -= 0x10000;
- return k;
- }
-
- public int readInt() throws IOException{
- length += 4;
- int k1 = in.read();
- if (k1 < 0)
- return 0;
- int k2 = in.read() << 8;
- int k3 = in.read() << 16;
- return k1 + k2 + k3 + (in.read() << 24);
- }
-
- public int readByte() throws IOException{
- ++length;
- return in.read() & 0xff;
- }
-
- public void skip(int len) throws IOException{
- length += len;
- while (len > 0) {
- len -= in.skip(len);
- }
- }
-
- public int getLength() {
- return length;
- }
-
- public Color readColor() throws IOException{
- int red = readByte();
- int green = readByte();
- int blue = readByte();
- readByte();
- return new Color(red, green, blue);
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaBrush.java b/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaBrush.java
deleted file mode 100644
index c28ace3..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaBrush.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * $Id: MetaBrush.java,v 1.15 2002/06/18 13:59:57 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf.codec.wmf;
-import java.io.IOException;
-import headless.awt.Color;
-
-public class MetaBrush extends MetaObject {
-
- public static final int BS_SOLID = 0;
- public static final int BS_NULL = 1;
- public static final int BS_HATCHED = 2;
- public static final int BS_PATTERN = 3;
- public static final int BS_DIBPATTERN = 5;
- public static final int HS_HORIZONTAL = 0;
- public static final int HS_VERTICAL = 1;
- public static final int HS_FDIAGONAL = 2;
- public static final int HS_BDIAGONAL = 3;
- public static final int HS_CROSS = 4;
- public static final int HS_DIAGCROSS = 5;
-
- int style = BS_SOLID;
- int hatch;
- Color color = Color.white;
-
- public MetaBrush() {
- type = META_BRUSH;
- }
-
- public void init(InputMeta in) throws IOException {
- style = in.readWord();
- color = in.readColor();
- hatch = in.readWord();
- }
-
- public int getStyle() {
- return style;
- }
-
- public int getHatch() {
- return hatch;
- }
-
- public Color getColor() {
- return color;
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaDo.java b/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaDo.java
deleted file mode 100644
index d335c0b..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaDo.java
+++ /dev/null
@@ -1,760 +0,0 @@
-/*
- * $Id: MetaDo.java,v 1.28 2003/05/02 09:01:33 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf.codec.wmf;
-import java.io.*;
-import com.lowagie.text.pdf.*;
-import com.lowagie.text.pdf.codec.BmpImage;
-import com.lowagie.text.*;
-import headless.awt.Point;
-import headless.awt.Color;
-import java.util.ArrayList;
-
-public class MetaDo {
-
- public static final int META_SETBKCOLOR = 0x0201;
- public static final int META_SETBKMODE = 0x0102;
- public static final int META_SETMAPMODE = 0x0103;
- public static final int META_SETROP2 = 0x0104;
- public static final int META_SETRELABS = 0x0105;
- public static final int META_SETPOLYFILLMODE = 0x0106;
- public static final int META_SETSTRETCHBLTMODE = 0x0107;
- public static final int META_SETTEXTCHAREXTRA = 0x0108;
- public static final int META_SETTEXTCOLOR = 0x0209;
- public static final int META_SETTEXTJUSTIFICATION = 0x020A;
- public static final int META_SETWINDOWORG = 0x020B;
- public static final int META_SETWINDOWEXT = 0x020C;
- public static final int META_SETVIEWPORTORG = 0x020D;
- public static final int META_SETVIEWPORTEXT = 0x020E;
- public static final int META_OFFSETWINDOWORG = 0x020F;
- public static final int META_SCALEWINDOWEXT = 0x0410;
- public static final int META_OFFSETVIEWPORTORG = 0x0211;
- public static final int META_SCALEVIEWPORTEXT = 0x0412;
- public static final int META_LINETO = 0x0213;
- public static final int META_MOVETO = 0x0214;
- public static final int META_EXCLUDECLIPRECT = 0x0415;
- public static final int META_INTERSECTCLIPRECT = 0x0416;
- public static final int META_ARC = 0x0817;
- public static final int META_ELLIPSE = 0x0418;
- public static final int META_FLOODFILL = 0x0419;
- public static final int META_PIE = 0x081A;
- public static final int META_RECTANGLE = 0x041B;
- public static final int META_ROUNDRECT = 0x061C;
- public static final int META_PATBLT = 0x061D;
- public static final int META_SAVEDC = 0x001E;
- public static final int META_SETPIXEL = 0x041F;
- public static final int META_OFFSETCLIPRGN = 0x0220;
- public static final int META_TEXTOUT = 0x0521;
- public static final int META_BITBLT = 0x0922;
- public static final int META_STRETCHBLT = 0x0B23;
- public static final int META_POLYGON = 0x0324;
- public static final int META_POLYLINE = 0x0325;
- public static final int META_ESCAPE = 0x0626;
- public static final int META_RESTOREDC = 0x0127;
- public static final int META_FILLREGION = 0x0228;
- public static final int META_FRAMEREGION = 0x0429;
- public static final int META_INVERTREGION = 0x012A;
- public static final int META_PAINTREGION = 0x012B;
- public static final int META_SELECTCLIPREGION = 0x012C;
- public static final int META_SELECTOBJECT = 0x012D;
- public static final int META_SETTEXTALIGN = 0x012E;
- public static final int META_CHORD = 0x0830;
- public static final int META_SETMAPPERFLAGS = 0x0231;
- public static final int META_EXTTEXTOUT = 0x0a32;
- public static final int META_SETDIBTODEV = 0x0d33;
- public static final int META_SELECTPALETTE = 0x0234;
- public static final int META_REALIZEPALETTE = 0x0035;
- public static final int META_ANIMATEPALETTE = 0x0436;
- public static final int META_SETPALENTRIES = 0x0037;
- public static final int META_POLYPOLYGON = 0x0538;
- public static final int META_RESIZEPALETTE = 0x0139;
- public static final int META_DIBBITBLT = 0x0940;
- public static final int META_DIBSTRETCHBLT = 0x0b41;
- public static final int META_DIBCREATEPATTERNBRUSH = 0x0142;
- public static final int META_STRETCHDIB = 0x0f43;
- public static final int META_EXTFLOODFILL = 0x0548;
- public static final int META_DELETEOBJECT = 0x01f0;
- public static final int META_CREATEPALETTE = 0x00f7;
- public static final int META_CREATEPATTERNBRUSH = 0x01F9;
- public static final int META_CREATEPENINDIRECT = 0x02FA;
- public static final int META_CREATEFONTINDIRECT = 0x02FB;
- public static final int META_CREATEBRUSHINDIRECT = 0x02FC;
- public static final int META_CREATEREGION = 0x06FF;
-
- public PdfContentByte cb;
- public InputMeta in;
- int left;
- int top;
- int right;
- int bottom;
- int inch;
- MetaState state = new MetaState();
-
- public MetaDo(InputStream in, PdfContentByte cb) {
- this.cb = cb;
- this.in = new InputMeta(in);
- }
-
- public void readAll() throws IOException, DocumentException{
- if (in.readInt() != 0x9AC6CDD7) {
- throw new DocumentException("Not a placeable windows metafile");
- }
- in.readWord();
- left = in.readShort();
- top = in.readShort();
- right = in.readShort();
- bottom = in.readShort();
- inch = in.readWord();
- state.setScalingX((float)(right - left) / (float)inch * 72f);
- state.setScalingY((float)(bottom - top) / (float)inch * 72f);
- state.setOffsetWx(left);
- state.setOffsetWy(top);
- state.setExtentWx(right - left);
- state.setExtentWy(bottom - top);
- in.readInt();
- in.readWord();
- in.skip(18);
-
- int tsize;
- int function;
- cb.setLineCap(1);
- cb.setLineJoin(1);
- for (;;) {
- int lenMarker = in.getLength();
- tsize = in.readInt();
- if (tsize < 3)
- break;
- function = in.readWord();
- switch (function) {
- case 0:
- break;
- case META_CREATEPALETTE:
- case META_CREATEREGION:
- case META_DIBCREATEPATTERNBRUSH:
- state.addMetaObject(new MetaObject());
- break;
- case META_CREATEPENINDIRECT:
- {
- MetaPen pen = new MetaPen();
- pen.init(in);
- state.addMetaObject(pen);
- break;
- }
- case META_CREATEBRUSHINDIRECT:
- {
- MetaBrush brush = new MetaBrush();
- brush.init(in);
- state.addMetaObject(brush);
- break;
- }
- case META_CREATEFONTINDIRECT:
- {
- MetaFont font = new MetaFont();
- font.init(in);
- state.addMetaObject(font);
- break;
- }
- case META_SELECTOBJECT:
- {
- int idx = in.readWord();
- state.selectMetaObject(idx, cb);
- break;
- }
- case META_DELETEOBJECT:
- {
- int idx = in.readWord();
- state.deleteMetaObject(idx);
- break;
- }
- case META_SAVEDC:
- state.saveState(cb);
- break;
- case META_RESTOREDC:
- {
- int idx = in.readShort();
- state.restoreState(idx, cb);
- break;
- }
- case META_SETWINDOWORG:
- state.setOffsetWy(in.readShort());
- state.setOffsetWx(in.readShort());
- break;
- case META_SETWINDOWEXT:
- state.setExtentWy(in.readShort());
- state.setExtentWx(in.readShort());
- break;
- case META_MOVETO:
- {
- int y = in.readShort();
- Point p = new Point(in.readShort(), y);
- state.setCurrentPoint(p);
- break;
- }
- case META_LINETO:
- {
- int y = in.readShort();
- int x = in.readShort();
- Point p = state.getCurrentPoint();
- cb.moveTo(state.transformX(p.x), state.transformY(p.y));
- cb.lineTo(state.transformX(x), state.transformY(y));
- cb.stroke();
- state.setCurrentPoint(new Point(x, y));
- break;
- }
- case META_POLYLINE:
- {
- state.setLineJoinPolygon(cb);
- int len = in.readWord();
- int x = in.readShort();
- int y = in.readShort();
- cb.moveTo(state.transformX(x), state.transformY(y));
- for (int k = 1; k < len; ++k) {
- x = in.readShort();
- y = in.readShort();
- cb.lineTo(state.transformX(x), state.transformY(y));
- }
- cb.stroke();
- break;
- }
- case META_POLYGON:
- {
- if (isNullStrokeFill(false))
- break;
- int len = in.readWord();
- int sx = in.readShort();
- int sy = in.readShort();
- cb.moveTo(state.transformX(sx), state.transformY(sy));
- for (int k = 1; k < len; ++k) {
- int x = in.readShort();
- int y = in.readShort();
- cb.lineTo(state.transformX(x), state.transformY(y));
- }
- cb.lineTo(state.transformX(sx), state.transformY(sy));
- strokeAndFill();
- break;
- }
- case META_POLYPOLYGON:
- {
- if (isNullStrokeFill(false))
- break;
- int numPoly = in.readWord();
- int lens[] = new int[numPoly];
- for (int k = 0; k < lens.length; ++k)
- lens[k] = in.readWord();
- for (int j = 0; j < lens.length; ++j) {
- int len = lens[j];
- int sx = in.readShort();
- int sy = in.readShort();
- cb.moveTo(state.transformX(sx), state.transformY(sy));
- for (int k = 1; k < len; ++k) {
- int x = in.readShort();
- int y = in.readShort();
- cb.lineTo(state.transformX(x), state.transformY(y));
- }
- cb.lineTo(state.transformX(sx), state.transformY(sy));
- }
- strokeAndFill();
- break;
- }
- case META_ELLIPSE:
- {
- if (isNullStrokeFill(state.getLineNeutral()))
- break;
- int b = in.readShort();
- int r = in.readShort();
- int t = in.readShort();
- int l = in.readShort();
- cb.arc(state.transformX(l), state.transformY(b), state.transformX(r), state.transformY(t), 0, 360);
- strokeAndFill();
- break;
- }
- case META_ARC:
- {
- if (isNullStrokeFill(state.getLineNeutral()))
- break;
- float yend = state.transformY(in.readShort());
- float xend = state.transformX(in.readShort());
- float ystart = state.transformY(in.readShort());
- float xstart = state.transformX(in.readShort());
- float b = state.transformY(in.readShort());
- float r = state.transformX(in.readShort());
- float t = state.transformY(in.readShort());
- float l = state.transformX(in.readShort());
- float cx = (r + l) / 2;
- float cy = (t + b) / 2;
- float arc1 = getArc(cx, cy, xstart, ystart);
- float arc2 = getArc(cx, cy, xend, yend);
- arc2 -= arc1;
- if (arc2 <= 0)
- arc2 += 360;
- cb.arc(l, b, r, t, arc1, arc2);
- cb.stroke();
- break;
- }
- case META_PIE:
- {
- if (isNullStrokeFill(state.getLineNeutral()))
- break;
- float yend = state.transformY(in.readShort());
- float xend = state.transformX(in.readShort());
- float ystart = state.transformY(in.readShort());
- float xstart = state.transformX(in.readShort());
- float b = state.transformY(in.readShort());
- float r = state.transformX(in.readShort());
- float t = state.transformY(in.readShort());
- float l = state.transformX(in.readShort());
- float cx = (r + l) / 2;
- float cy = (t + b) / 2;
- float arc1 = getArc(cx, cy, xstart, ystart);
- float arc2 = getArc(cx, cy, xend, yend);
- arc2 -= arc1;
- if (arc2 <= 0)
- arc2 += 360;
- ArrayList ar = PdfContentByte.bezierArc(l, b, r, t, arc1, arc2);
- if (ar.size() == 0)
- break;
- float pt[] = (float [])ar.get(0);
- cb.moveTo(cx, cy);
- cb.lineTo(pt[0], pt[1]);
- for (int k = 0; k < ar.size(); ++k) {
- pt = (float [])ar.get(k);
- cb.curveTo(pt[2], pt[3], pt[4], pt[5], pt[6], pt[7]);
- }
- cb.lineTo(cx, cy);
- strokeAndFill();
- break;
- }
- case META_CHORD:
- {
- if (isNullStrokeFill(state.getLineNeutral()))
- break;
- float yend = state.transformY(in.readShort());
- float xend = state.transformX(in.readShort());
- float ystart = state.transformY(in.readShort());
- float xstart = state.transformX(in.readShort());
- float b = state.transformY(in.readShort());
- float r = state.transformX(in.readShort());
- float t = state.transformY(in.readShort());
- float l = state.transformX(in.readShort());
- float cx = (r + l) / 2;
- float cy = (t + b) / 2;
- float arc1 = getArc(cx, cy, xstart, ystart);
- float arc2 = getArc(cx, cy, xend, yend);
- arc2 -= arc1;
- if (arc2 <= 0)
- arc2 += 360;
- ArrayList ar = PdfContentByte.bezierArc(l, b, r, t, arc1, arc2);
- if (ar.size() == 0)
- break;
- float pt[] = (float [])ar.get(0);
- cx = pt[0];
- cy = pt[1];
- cb.moveTo(cx, cy);
- for (int k = 0; k < ar.size(); ++k) {
- pt = (float [])ar.get(k);
- cb.curveTo(pt[2], pt[3], pt[4], pt[5], pt[6], pt[7]);
- }
- cb.lineTo(cx, cy);
- strokeAndFill();
- break;
- }
- case META_RECTANGLE:
- {
- if (isNullStrokeFill(true))
- break;
- float b = state.transformY(in.readShort());
- float r = state.transformX(in.readShort());
- float t = state.transformY(in.readShort());
- float l = state.transformX(in.readShort());
- cb.rectangle(l, b, r - l, t - b);
- strokeAndFill();
- break;
- }
- case META_ROUNDRECT:
- {
- if (isNullStrokeFill(true))
- break;
- float h = state.transformY(0) - state.transformY(in.readShort());
- float w = state.transformX(in.readShort()) - state.transformX(0);
- float b = state.transformY(in.readShort());
- float r = state.transformX(in.readShort());
- float t = state.transformY(in.readShort());
- float l = state.transformX(in.readShort());
- cb.roundRectangle(l, b, r - l, t - b, (h + w) / 4);
- strokeAndFill();
- break;
- }
- case META_INTERSECTCLIPRECT:
- {
- float b = state.transformY(in.readShort());
- float r = state.transformX(in.readShort());
- float t = state.transformY(in.readShort());
- float l = state.transformX(in.readShort());
- cb.rectangle(l, b, r - l, t - b);
- cb.eoClip();
- cb.newPath();
- break;
- }
- case META_EXTTEXTOUT:
- {
- int y = in.readShort();
- int x = in.readShort();
- int count = in.readWord();
- int flag = in.readWord();
- int x1 = 0;
- int y1 = 0;
- int x2 = 0;
- int y2 = 0;
- if ((flag & (MetaFont.ETO_CLIPPED | MetaFont.ETO_OPAQUE)) != 0) {
- x1 = in.readShort();
- y1 = in.readShort();
- x2 = in.readShort();
- y2 = in.readShort();
- }
- byte text[] = new byte[count];
- int k;
- for (k = 0; k < count; ++k) {
- byte c = (byte)in.readByte();
- if (c == 0)
- break;
- text[k] = c;
- }
- String s;
- try {
- s = new String(text, 0, k, "Cp1252");
- }
- catch (UnsupportedEncodingException e) {
- s = new String(text, 0, k);
- }
- outputText(x, y, flag, x1, y1, x2, y2, s);
- break;
- }
- case META_TEXTOUT:
- {
- int count = in.readWord();
- byte text[] = new byte[count];
- int k;
- for (k = 0; k < count; ++k) {
- byte c = (byte)in.readByte();
- if (c == 0)
- break;
- text[k] = c;
- }
- String s;
- try {
- s = new String(text, 0, k, "Cp1252");
- }
- catch (UnsupportedEncodingException e) {
- s = new String(text, 0, k);
- }
- count = (count + 1) & 0xfffe;
- in.skip(count - k);
- int y = in.readShort();
- int x = in.readShort();
- outputText(x, y, 0, 0, 0, 0, 0, s);
- break;
- }
- case META_SETBKCOLOR:
- state.setCurrentBackgroundColor(in.readColor());
- break;
- case META_SETTEXTCOLOR:
- state.setCurrentTextColor(in.readColor());
- break;
- case META_SETTEXTALIGN:
- state.setTextAlign(in.readWord());
- break;
- case META_SETBKMODE:
- state.setBackgroundMode(in.readWord());
- break;
- case META_SETPOLYFILLMODE:
- state.setPolyFillMode(in.readWord());
- break;
- case META_SETPIXEL:
- {
- Color color = in.readColor();
- int y = in.readShort();
- int x = in.readShort();
- cb.saveState();
- cb.setColorFill(color);
- cb.rectangle(state.transformX(x), state.transformY(y), .2f, .2f);
- cb.fill();
- cb.restoreState();
- break;
- }
- case META_DIBSTRETCHBLT:
- case META_STRETCHDIB: {
- int rop = in.readInt();
- if (function == META_STRETCHDIB) {
- /*int usage = */ in.readWord();
- }
- int srcHeight = in.readShort();
- int srcWidth = in.readShort();
- int ySrc = in.readShort();
- int xSrc = in.readShort();
- float destHeight = state.transformY(in.readShort()) - state.transformY(0);
- float destWidth = state.transformX(in.readShort()) - state.transformX(0);
- float yDest = state.transformY(in.readShort());
- float xDest = state.transformX(in.readShort());
- byte b[] = new byte[(tsize * 2) - (in.getLength() - lenMarker)];
- for (int k = 0; k < b.length; ++k)
- b[k] = (byte)in.readByte();
- try {
- ByteArrayInputStream inb = new ByteArrayInputStream(b);
- Image bmp = BmpImage.getImage(inb, true, b.length);
- cb.saveState();
- cb.rectangle(xDest, yDest, destWidth, destHeight);
- cb.clip();
- cb.newPath();
- bmp.scaleAbsolute(destWidth * bmp.width() / srcWidth, -destHeight * bmp.height() / srcHeight);
- bmp.setAbsolutePosition(xDest - destWidth * xSrc / srcWidth, yDest + destHeight * ySrc / srcHeight - bmp.scaledHeight());
- cb.addImage(bmp);
- cb.restoreState();
- }
- catch (Exception e) {
- // empty on purpose
- }
- break;
- }
- }
- in.skip((tsize * 2) - (in.getLength() - lenMarker));
- }
-
- }
-
- public void outputText(int x, int y, int flag, int x1, int y1, int x2, int y2, String text) throws IOException {
- MetaFont font = state.getCurrentFont();
- float refX = state.transformX(x);
- float refY = state.transformY(y);
- float angle = state.transformAngle(font.getAngle());
- float sin = (float)Math.sin(angle);
- float cos = (float)Math.cos(angle);
- float fontSize = font.getFontSize(state);
- BaseFont bf = font.getFont();
- int align = state.getTextAlign();
- float textWidth = bf.getWidthPoint(text, fontSize);
- float tx = 0;
- float ty = 0;
- float descender = bf.getFontDescriptor(BaseFont.DESCENT, fontSize);
- float ury = bf.getFontDescriptor(BaseFont.BBOXURY, fontSize);
- cb.saveState();
- cb.concatCTM(cos, sin, -sin, cos, refX, refY);
- if ((align & MetaState.TA_CENTER) == MetaState.TA_CENTER)
- tx = -textWidth / 2;
- else if ((align & MetaState.TA_RIGHT) == MetaState.TA_RIGHT)
- tx = -textWidth;
- if ((align & MetaState.TA_BASELINE) == MetaState.TA_BASELINE)
- ty = 0;
- else if ((align & MetaState.TA_BOTTOM) == MetaState.TA_BOTTOM)
- ty = -descender;
- else
- ty = -ury;
- Color textColor;
- if (state.getBackgroundMode() == MetaState.OPAQUE) {
- textColor = state.getCurrentBackgroundColor();
- cb.setColorFill(textColor);
- cb.rectangle(tx, ty + descender, textWidth, ury - descender);
- cb.fill();
- }
- textColor = state.getCurrentTextColor();
- cb.setColorFill(textColor);
- cb.beginText();
- cb.setFontAndSize(bf, fontSize);
- cb.setTextMatrix(tx, ty);
- cb.showText(text);
- cb.endText();
- if (font.isUnderline()) {
- cb.rectangle(tx, ty - fontSize / 4, textWidth, fontSize / 15);
- cb.fill();
- }
- if (font.isStrikeout()) {
- cb.rectangle(tx, ty + fontSize / 3, textWidth, fontSize / 15);
- cb.fill();
- }
- cb.restoreState();
- }
-
- public boolean isNullStrokeFill(boolean isRectangle) {
- MetaPen pen = state.getCurrentPen();
- MetaBrush brush = state.getCurrentBrush();
- boolean noPen = (pen.getStyle() == MetaPen.PS_NULL);
- int style = brush.getStyle();
- boolean isBrush = (style == MetaBrush.BS_SOLID || (style == MetaBrush.BS_HATCHED && state.getBackgroundMode() == MetaState.OPAQUE));
- boolean result = noPen && !isBrush;
- if (!noPen) {
- if (isRectangle)
- state.setLineJoinRectangle(cb);
- else
- state.setLineJoinPolygon(cb);
- }
- return result;
- }
-
- public void strokeAndFill(){
- MetaPen pen = state.getCurrentPen();
- MetaBrush brush = state.getCurrentBrush();
- int penStyle = pen.getStyle();
- int brushStyle = brush.getStyle();
- if (penStyle == MetaPen.PS_NULL) {
- cb.closePath();
- if (state.getPolyFillMode() == MetaState.ALTERNATE) {
- cb.eoFill();
- }
- else {
- cb.fill();
- }
- }
- else {
- boolean isBrush = (brushStyle == MetaBrush.BS_SOLID || (brushStyle == MetaBrush.BS_HATCHED && state.getBackgroundMode() == MetaState.OPAQUE));
- if (isBrush) {
- if (state.getPolyFillMode() == MetaState.ALTERNATE)
- cb.closePathEoFillStroke();
- else
- cb.closePathFillStroke();
- }
- else {
- cb.closePathStroke();
- }
- }
- }
-
- static float getArc(float xCenter, float yCenter, float xDot, float yDot) {
- double s = Math.atan2(yDot - yCenter, xDot - xCenter);
- if (s < 0)
- s += Math.PI * 2;
- return (float)(s / Math.PI * 180);
- }
-
- public static byte[] wrapBMP(Image image) throws IOException {
- if (image.getOriginalType() != Image.ORIGINAL_BMP)
- throw new IOException("Only BMP can be wrapped in WMF.");
- InputStream imgIn;
- byte data[] = null;
- if (image.getOriginalData() == null) {
- imgIn = image.url().openStream();
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- int b = 0;
- while ((b = imgIn.read()) != -1)
- out.write(b);
- imgIn.close();
- data = out.toByteArray();
- }
- else
- data = image.getOriginalData();
- int sizeBmpWords = (data.length - 14 + 1) >>> 1;
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- // write metafile header
- writeWord(os, 1);
- writeWord(os, 9);
- writeWord(os, 0x0300);
- writeDWord(os, 9 + 4 + 5 + 5 + (13 + sizeBmpWords) + 3); // total metafile size
- writeWord(os, 1);
- writeDWord(os, 14 + sizeBmpWords); // max record size
- writeWord(os, 0);
- // write records
- writeDWord(os, 4);
- writeWord(os, META_SETMAPMODE);
- writeWord(os, 8);
-
- writeDWord(os, 5);
- writeWord(os, META_SETWINDOWORG);
- writeWord(os, 0);
- writeWord(os, 0);
-
- writeDWord(os, 5);
- writeWord(os, META_SETWINDOWEXT);
- writeWord(os, (int)image.height());
- writeWord(os, (int)image.width());
-
- writeDWord(os, 13 + sizeBmpWords);
- writeWord(os, META_DIBSTRETCHBLT);
- writeDWord(os, 0x00cc0020);
- writeWord(os, (int)image.height());
- writeWord(os, (int)image.width());
- writeWord(os, 0);
- writeWord(os, 0);
- writeWord(os, (int)image.height());
- writeWord(os, (int)image.width());
- writeWord(os, 0);
- writeWord(os, 0);
- os.write(data, 14, data.length - 14);
- if ((data.length & 1) == 1)
- os.write(0);
-// writeDWord(os, 14 + sizeBmpWords);
-// writeWord(os, META_STRETCHDIB);
-// writeDWord(os, 0x00cc0020);
-// writeWord(os, 0);
-// writeWord(os, (int)image.height());
-// writeWord(os, (int)image.width());
-// writeWord(os, 0);
-// writeWord(os, 0);
-// writeWord(os, (int)image.height());
-// writeWord(os, (int)image.width());
-// writeWord(os, 0);
-// writeWord(os, 0);
-// os.write(data, 14, data.length - 14);
-// if ((data.length & 1) == 1)
-// os.write(0);
-
- writeDWord(os, 3);
- writeWord(os, 0);
- os.close();
- return os.toByteArray();
- }
-
- public static void writeWord(OutputStream os, int v) throws IOException {
- os.write(v & 0xff);
- os.write((v >>> 8) & 0xff);
- }
-
- public static void writeDWord(OutputStream os, int v) throws IOException {
- writeWord(os, v & 0xffff);
- writeWord(os, (v >>> 16) & 0xffff);
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaFont.java b/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaFont.java
deleted file mode 100644
index 7daa762..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaFont.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * $Id: MetaFont.java,v 1.20 2002/06/20 13:00:28 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf.codec.wmf;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import com.lowagie.text.pdf.*;
-import com.lowagie.text.ExceptionConverter;
-
-public class MetaFont extends MetaObject {
- static final String fontNames[] = {
- "Courier", "Courier-Bold", "Courier-Oblique", "Courier-BoldOblique",
- "Helvetica", "Helvetica-Bold", "Helvetica-Oblique", "Helvetica-BoldOblique",
- "Times-Roman", "Times-Bold", "Times-Italic", "Times-BoldItalic",
- "Symbol", "ZapfDingbats"};
-
- static final int MARKER_BOLD = 1;
- static final int MARKER_ITALIC = 2;
- static final int MARKER_COURIER = 0;
- static final int MARKER_HELVETICA = 4;
- static final int MARKER_TIMES = 8;
- static final int MARKER_SYMBOL = 12;
-
- static final int DEFAULT_PITCH = 0;
- static final int FIXED_PITCH = 1;
- static final int VARIABLE_PITCH = 2;
- static final int FF_DONTCARE = 0;
- static final int FF_ROMAN = 1;
- static final int FF_SWISS = 2;
- static final int FF_MODERN = 3;
- static final int FF_SCRIPT = 4;
- static final int FF_DECORATIVE = 5;
- static final int BOLDTHRESHOLD = 600;
- static final int nameSize = 32;
- static final int ETO_OPAQUE = 2;
- static final int ETO_CLIPPED = 4;
-
- int height;
- float angle;
- int bold;
- int italic;
- boolean underline;
- boolean strikeout;
- int charset;
- int pitchAndFamily;
- String faceName = "arial";
- BaseFont font = null;
-
- public MetaFont() {
- type = META_FONT;
- }
-
- public void init(InputMeta in) throws IOException {
- height = Math.abs(in.readShort());
- in.skip(2);
- angle = (float)(in.readShort() / 1800.0 * Math.PI);
- in.skip(2);
- bold = (in.readShort() >= BOLDTHRESHOLD ? MARKER_BOLD : 0);
- italic = (in.readByte() != 0 ? MARKER_ITALIC : 0);
- underline = (in.readByte() != 0);
- strikeout = (in.readByte() != 0);
- charset = in.readByte();
- in.skip(3);
- pitchAndFamily = in.readByte();
- byte name[] = new byte[nameSize];
- int k;
- for (k = 0; k < nameSize; ++k) {
- int c = in.readByte();
- if (c == 0) {
- break;
- }
- name[k] = (byte)c;
- }
- try {
- faceName = new String(name, 0, k, "Cp1252");
- }
- catch (UnsupportedEncodingException e) {
- faceName = new String(name, 0, k);
- }
- faceName = faceName.toLowerCase();
- }
-
- public BaseFont getFont() {
- if (font != null)
- return font;
- String fontName;
- if (faceName.indexOf("courier") != -1 || faceName.indexOf("terminal") != -1
- || faceName.indexOf("fixedsys") != -1) {
- fontName = fontNames[MARKER_COURIER + italic + bold];
- }
- else if (faceName.indexOf("ms sans serif") != -1 || faceName.indexOf("arial") != -1
- || faceName.indexOf("system") != -1) {
- fontName = fontNames[MARKER_HELVETICA + italic + bold];
- }
- else if (faceName.indexOf("arial black") != -1) {
- fontName = fontNames[MARKER_HELVETICA + italic + MARKER_BOLD];
- }
- else if (faceName.indexOf("times") != -1 || faceName.indexOf("ms serif") != -1
- || faceName.indexOf("roman") != -1) {
- fontName = fontNames[MARKER_TIMES + italic + bold];
- }
- else if (faceName.indexOf("symbol") != -1) {
- fontName = fontNames[MARKER_SYMBOL];
- }
- else {
- int pitch = pitchAndFamily & 3;
- int family = (pitchAndFamily >> 4) & 7;
- switch (family) {
- case FF_MODERN:
- fontName = fontNames[MARKER_COURIER + italic + bold];
- break;
- case FF_ROMAN:
- fontName = fontNames[MARKER_TIMES + italic + bold];
- break;
- case FF_SWISS:
- case FF_SCRIPT:
- case FF_DECORATIVE:
- fontName = fontNames[MARKER_HELVETICA + italic + bold];
- break;
- default:
- {
- switch (pitch) {
- case FIXED_PITCH:
- fontName = fontNames[MARKER_COURIER + italic + bold];
- break;
- default:
- fontName = fontNames[MARKER_HELVETICA + italic + bold];
- break;
- }
- }
- }
- }
- try {
- font = BaseFont.createFont(fontName, "Cp1252", false);
- }
- catch (Exception e) {
- throw new ExceptionConverter(e);
- }
-
- return font;
- }
-
- public float getAngle() {
- return angle;
- }
-
- public boolean isUnderline() {
- return underline;
- }
-
- public boolean isStrikeout() {
- return strikeout;
- }
-
- public float getFontSize(MetaState state) {
- return Math.abs(state.transformY(height) - state.transformY(0)) * 0.86f;
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaObject.java b/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaObject.java
deleted file mode 100644
index bb0711b..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaObject.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * $Id: MetaObject.java,v 1.15 2002/06/18 13:59:58 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf.codec.wmf;
-
-public class MetaObject {
- public static final int META_NOT_SUPPORTED = 0;
- public static final int META_PEN = 1;
- public static final int META_BRUSH = 2;
- public static final int META_FONT = 3;
- public int type = META_NOT_SUPPORTED;
-
- public MetaObject() {
- }
-
- public MetaObject(int type) {
- this.type = type;
- }
-
- public int getType() {
- return type;
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaPen.java b/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaPen.java
deleted file mode 100644
index 1c53f14..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaPen.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * $Id: MetaPen.java,v 1.15 2002/06/18 13:59:58 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf.codec.wmf;
-import java.io.IOException;
-import headless.awt.Color;
-
-public class MetaPen extends MetaObject {
-
- public static final int PS_SOLID = 0;
- public static final int PS_DASH = 1;
- public static final int PS_DOT = 2;
- public static final int PS_DASHDOT = 3;
- public static final int PS_DASHDOTDOT = 4;
- public static final int PS_NULL = 5;
- public static final int PS_INSIDEFRAME = 6;
-
- int style = PS_SOLID;
- int penWidth = 1;
- Color color = Color.black;
-
- public MetaPen() {
- type = META_PEN;
- }
-
- public void init(InputMeta in) throws IOException {
- style = in.readWord();
- penWidth = in.readShort();
- in.readWord();
- color = in.readColor();
- }
-
- public int getStyle() {
- return style;
- }
-
- public int getPenWidth() {
- return penWidth;
- }
-
- public Color getColor() {
- return color;
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaState.java b/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaState.java
deleted file mode 100644
index b2ccd46..0000000
--- a/LibrarySource/com/lowagie/text/pdf/codec/wmf/MetaState.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * $Id: MetaState.java,v 1.15 2002/06/18 13:59:58 blowagie Exp $
- * $Name: $
- *
- * Copyright 2001, 2002 Paulo Soares
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf.codec.wmf;
-
-import java.util.ArrayList;
-import java.util.Stack;
-import headless.awt.Point;
-import headless.awt.Color;
-import com.lowagie.text.pdf.*;
-
-public class MetaState {
-
- public static final int TA_NOUPDATECP = 0;
- public static final int TA_UPDATECP = 1;
- public static final int TA_LEFT = 0;
- public static final int TA_RIGHT = 2;
- public static final int TA_CENTER = 6;
- public static final int TA_TOP = 0;
- public static final int TA_BOTTOM = 8;
- public static final int TA_BASELINE = 24;
-
- public static final int TRANSPARENT = 1;
- public static final int OPAQUE = 2;
-
- public static final int ALTERNATE = 1;
- public static final int WINDING = 2;
-
- public Stack savedStates;
- public ArrayList MetaObjects;
- public Point currentPoint;
- public MetaPen currentPen;
- public MetaBrush currentBrush;
- public MetaFont currentFont;
- public Color currentBackgroundColor = Color.white;
- public Color currentTextColor = Color.black;
- public int backgroundMode = OPAQUE;
- public int polyFillMode = ALTERNATE;
- public int lineJoin = 1;
- public int textAlign;
- public int offsetWx;
- public int offsetWy;
- public int extentWx;
- public int extentWy;
- public float scalingX;
- public float scalingY;
-
-
- /** Creates new MetaState */
- public MetaState() {
- savedStates = new Stack();
- MetaObjects = new ArrayList();
- currentPoint = new Point(0, 0);
- currentPen = new MetaPen();
- currentBrush = new MetaBrush();
- currentFont = new MetaFont();
- }
-
- public MetaState(MetaState state) {
- setMetaState(state);
- }
-
- public void setMetaState(MetaState state) {
- savedStates = state.savedStates;
- MetaObjects = state.MetaObjects;
- currentPoint = state.currentPoint;
- currentPen = state.currentPen;
- currentBrush = state.currentBrush;
- currentFont = state.currentFont;
- currentBackgroundColor = state.currentBackgroundColor;
- currentTextColor = state.currentTextColor;
- backgroundMode = state.backgroundMode;
- polyFillMode = state.polyFillMode;
- textAlign = state.textAlign;
- lineJoin = state.lineJoin;
- offsetWx = state.offsetWx;
- offsetWy = state.offsetWy;
- extentWx = state.extentWx;
- extentWy = state.extentWy;
- scalingX = state.scalingX;
- scalingY = state.scalingY;
- }
-
- public void addMetaObject(MetaObject object) {
- for (int k = 0; k < MetaObjects.size(); ++k) {
- if (MetaObjects.get(k) == null) {
- MetaObjects.set(k, object);
- return;
- }
- }
- MetaObjects.add(object);
- }
-
- public void selectMetaObject(int index, PdfContentByte cb) {
- MetaObject obj = (MetaObject)MetaObjects.get(index);
- if (obj == null)
- return;
- int style;
- switch (obj.getType()) {
- case MetaObject.META_BRUSH:
- currentBrush = (MetaBrush)obj;
- style = currentBrush.getStyle();
- if (style == MetaBrush.BS_SOLID) {
- Color color = currentBrush.getColor();
- cb.setColorFill(color);
- }
- else if (style == MetaBrush.BS_HATCHED) {
- Color color = currentBackgroundColor;
- cb.setColorFill(color);
- }
- break;
- case MetaObject.META_PEN:
- {
- currentPen = (MetaPen)obj;
- style = currentPen.getStyle();
- if (style != MetaPen.PS_NULL) {
- Color color = currentPen.getColor();
- cb.setColorStroke(color);
- cb.setLineWidth(Math.abs((float)currentPen.getPenWidth() * scalingX / extentWx));
- switch (style) {
- case MetaPen.PS_DASH:
- cb.setLineDash(18, 6, 0);
- break;
- case MetaPen.PS_DASHDOT:
- cb.setLiteral("[9 6 3 6]0 d\n");
- break;
- case MetaPen.PS_DASHDOTDOT:
- cb.setLiteral("[9 3 3 3 3 3]0 d\n");
- break;
- case MetaPen.PS_DOT:
- cb.setLineDash(3, 0);
- break;
- default:
- cb.setLineDash(0);
- break;
- }
- }
- break;
- }
- case MetaObject.META_FONT:
- {
- currentFont = (MetaFont)obj;
- break;
- }
- }
- }
-
- public void deleteMetaObject(int index) {
- MetaObjects.set(index, null);
- }
-
- public void saveState(PdfContentByte cb) {
- cb.saveState();
- MetaState state = new MetaState(this);
- savedStates.push(this);
- }
-
- public void restoreState(int index, PdfContentByte cb) {
- int pops;
- if (index < 0)
- pops = Math.min(-index, savedStates.size());
- else
- pops = Math.max(savedStates.size() - index, 0);
- if (pops == 0)
- return;
- MetaState state = null;
- while (pops-- != 0) {
- cb.restoreState();
- state = (MetaState)savedStates.pop();
- }
- setMetaState(state);
- }
-
- public float transformX(int x) {
- return ((float)x - offsetWx) * scalingX / extentWx;
- }
-
- public float transformY(int y) {
- return (1f - ((float)y - offsetWy) / extentWy) * scalingY;
- }
-
- public void setScalingX(float scalingX) {
- this.scalingX = scalingX;
- }
-
- public void setScalingY(float scalingY) {
- this.scalingY = scalingY;
- }
-
- public void setOffsetWx(int offsetWx) {
- this.offsetWx = offsetWx;
- }
-
- public void setOffsetWy(int offsetWy) {
- this.offsetWy = offsetWy;
- }
-
- public void setExtentWx(int extentWx) {
- this.extentWx = extentWx;
- }
-
- public void setExtentWy(int extentWy) {
- this.extentWy = extentWy;
- }
-
- public float transformAngle(float angle) {
- float ta = extentWy < 0 ? -angle : angle;
- return extentWx < 0 ? 180 - ta : ta;
- }
-
- public void setCurrentPoint(Point p) {
- currentPoint = p;
- }
-
- public Point getCurrentPoint() {
- return currentPoint;
- }
-
- public MetaBrush getCurrentBrush() {
- return currentBrush;
- }
-
- public MetaPen getCurrentPen() {
- return currentPen;
- }
-
- public MetaFont getCurrentFont() {
- return currentFont;
- }
-
- /** Getter for property currentBackgroundColor.
- * @return Value of property currentBackgroundColor.
- */
- public Color getCurrentBackgroundColor() {
- return currentBackgroundColor;
- }
-
- /** Setter for property currentBackgroundColor.
- * @param currentBackgroundColor New value of property currentBackgroundColor.
- */
- public void setCurrentBackgroundColor(Color currentBackgroundColor) {
- this.currentBackgroundColor = currentBackgroundColor;
- }
-
- /** Getter for property currentTextColor.
- * @return Value of property currentTextColor.
- */
- public Color getCurrentTextColor() {
- return currentTextColor;
- }
-
- /** Setter for property currentTextColor.
- * @param currentTextColor New value of property currentTextColor.
- */
- public void setCurrentTextColor(Color currentTextColor) {
- this.currentTextColor = currentTextColor;
- }
-
- /** Getter for property backgroundMode.
- * @return Value of property backgroundMode.
- */
- public int getBackgroundMode() {
- return backgroundMode;
- }
-
- /** Setter for property backgroundMode.
- * @param backgroundMode New value of property backgroundMode.
- */
- public void setBackgroundMode(int backgroundMode) {
- this.backgroundMode = backgroundMode;
- }
-
- /** Getter for property textAlign.
- * @return Value of property textAlign.
- */
- public int getTextAlign() {
- return textAlign;
- }
-
- /** Setter for property textAlign.
- * @param textAlign New value of property textAlign.
- */
- public void setTextAlign(int textAlign) {
- this.textAlign = textAlign;
- }
-
- /** Getter for property polyFillMode.
- * @return Value of property polyFillMode.
- */
- public int getPolyFillMode() {
- return polyFillMode;
- }
-
- /** Setter for property polyFillMode.
- * @param polyFillMode New value of property polyFillMode.
- */
- public void setPolyFillMode(int polyFillMode) {
- this.polyFillMode = polyFillMode;
- }
-
- public void setLineJoinRectangle(PdfContentByte cb) {
- if (lineJoin != 0) {
- lineJoin = 0;
- cb.setLineJoin(0);
- }
- }
-
- public void setLineJoinPolygon(PdfContentByte cb) {
- if (lineJoin == 0) {
- lineJoin = 1;
- cb.setLineJoin(1);
- }
- }
-
- public boolean getLineNeutral() {
- return (lineJoin == 0);
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/fonts/Courier-Bold.afm b/LibrarySource/com/lowagie/text/pdf/fonts/Courier-Bold.afm
deleted file mode 100644
index a8e2309..0000000
--- a/LibrarySource/com/lowagie/text/pdf/fonts/Courier-Bold.afm
+++ /dev/null
@@ -1,343 +0,0 @@
-StartFontMetrics 4.1
-Comment Copyright (c) 1989, 1990, 1991, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
-Comment Creation Date: Mon Jun 23 16:28:00 1997
-Comment UniqueID 43048
-Comment VMusage 41139 52164
-FontName Courier-Bold
-FullName Courier Bold
-FamilyName Courier
-Weight Bold
-ItalicAngle 0
-IsFixedPitch true
-CharacterSet ExtendedRoman
-FontBBox -113 -250 749 801
-UnderlinePosition -100
-UnderlineThickness 50
-Version 003.000
-Notice Copyright (c) 1989, 1990, 1991, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
-EncodingScheme AdobeStandardEncoding
-CapHeight 562
-XHeight 439
-Ascender 629
-Descender -157
-StdHW 84
-StdVW 106
-StartCharMetrics 315
-C 32 ; WX 600 ; N space ; B 0 0 0 0 ;
-C 33 ; WX 600 ; N exclam ; B 202 -15 398 572 ;
-C 34 ; WX 600 ; N quotedbl ; B 135 277 465 562 ;
-C 35 ; WX 600 ; N numbersign ; B 56 -45 544 651 ;
-C 36 ; WX 600 ; N dollar ; B 82 -126 519 666 ;
-C 37 ; WX 600 ; N percent ; B 5 -15 595 616 ;
-C 38 ; WX 600 ; N ampersand ; B 36 -15 546 543 ;
-C 39 ; WX 600 ; N quoteright ; B 171 277 423 562 ;
-C 40 ; WX 600 ; N parenleft ; B 219 -102 461 616 ;
-C 41 ; WX 600 ; N parenright ; B 139 -102 381 616 ;
-C 42 ; WX 600 ; N asterisk ; B 91 219 509 601 ;
-C 43 ; WX 600 ; N plus ; B 71 39 529 478 ;
-C 44 ; WX 600 ; N comma ; B 123 -111 393 174 ;
-C 45 ; WX 600 ; N hyphen ; B 100 203 500 313 ;
-C 46 ; WX 600 ; N period ; B 192 -15 408 171 ;
-C 47 ; WX 600 ; N slash ; B 98 -77 502 626 ;
-C 48 ; WX 600 ; N zero ; B 87 -15 513 616 ;
-C 49 ; WX 600 ; N one ; B 81 0 539 616 ;
-C 50 ; WX 600 ; N two ; B 61 0 499 616 ;
-C 51 ; WX 600 ; N three ; B 63 -15 501 616 ;
-C 52 ; WX 600 ; N four ; B 53 0 507 616 ;
-C 53 ; WX 600 ; N five ; B 70 -15 521 601 ;
-C 54 ; WX 600 ; N six ; B 90 -15 521 616 ;
-C 55 ; WX 600 ; N seven ; B 55 0 494 601 ;
-C 56 ; WX 600 ; N eight ; B 83 -15 517 616 ;
-C 57 ; WX 600 ; N nine ; B 79 -15 510 616 ;
-C 58 ; WX 600 ; N colon ; B 191 -15 407 425 ;
-C 59 ; WX 600 ; N semicolon ; B 123 -111 408 425 ;
-C 60 ; WX 600 ; N less ; B 66 15 523 501 ;
-C 61 ; WX 600 ; N equal ; B 71 118 529 398 ;
-C 62 ; WX 600 ; N greater ; B 77 15 534 501 ;
-C 63 ; WX 600 ; N question ; B 98 -14 501 580 ;
-C 64 ; WX 600 ; N at ; B 16 -15 584 616 ;
-C 65 ; WX 600 ; N A ; B -9 0 609 562 ;
-C 66 ; WX 600 ; N B ; B 30 0 573 562 ;
-C 67 ; WX 600 ; N C ; B 22 -18 560 580 ;
-C 68 ; WX 600 ; N D ; B 30 0 594 562 ;
-C 69 ; WX 600 ; N E ; B 25 0 560 562 ;
-C 70 ; WX 600 ; N F ; B 39 0 570 562 ;
-C 71 ; WX 600 ; N G ; B 22 -18 594 580 ;
-C 72 ; WX 600 ; N H ; B 20 0 580 562 ;
-C 73 ; WX 600 ; N I ; B 77 0 523 562 ;
-C 74 ; WX 600 ; N J ; B 37 -18 601 562 ;
-C 75 ; WX 600 ; N K ; B 21 0 599 562 ;
-C 76 ; WX 600 ; N L ; B 39 0 578 562 ;
-C 77 ; WX 600 ; N M ; B -2 0 602 562 ;
-C 78 ; WX 600 ; N N ; B 8 -12 610 562 ;
-C 79 ; WX 600 ; N O ; B 22 -18 578 580 ;
-C 80 ; WX 600 ; N P ; B 48 0 559 562 ;
-C 81 ; WX 600 ; N Q ; B 32 -138 578 580 ;
-C 82 ; WX 600 ; N R ; B 24 0 599 562 ;
-C 83 ; WX 600 ; N S ; B 47 -22 553 582 ;
-C 84 ; WX 600 ; N T ; B 21 0 579 562 ;
-C 85 ; WX 600 ; N U ; B 4 -18 596 562 ;
-C 86 ; WX 600 ; N V ; B -13 0 613 562 ;
-C 87 ; WX 600 ; N W ; B -18 0 618 562 ;
-C 88 ; WX 600 ; N X ; B 12 0 588 562 ;
-C 89 ; WX 600 ; N Y ; B 12 0 589 562 ;
-C 90 ; WX 600 ; N Z ; B 62 0 539 562 ;
-C 91 ; WX 600 ; N bracketleft ; B 245 -102 475 616 ;
-C 92 ; WX 600 ; N backslash ; B 99 -77 503 626 ;
-C 93 ; WX 600 ; N bracketright ; B 125 -102 355 616 ;
-C 94 ; WX 600 ; N asciicircum ; B 108 250 492 616 ;
-C 95 ; WX 600 ; N underscore ; B 0 -125 600 -75 ;
-C 96 ; WX 600 ; N quoteleft ; B 178 277 428 562 ;
-C 97 ; WX 600 ; N a ; B 35 -15 570 454 ;
-C 98 ; WX 600 ; N b ; B 0 -15 584 626 ;
-C 99 ; WX 600 ; N c ; B 40 -15 545 459 ;
-C 100 ; WX 600 ; N d ; B 20 -15 591 626 ;
-C 101 ; WX 600 ; N e ; B 40 -15 563 454 ;
-C 102 ; WX 600 ; N f ; B 83 0 547 626 ; L i fi ; L l fl ;
-C 103 ; WX 600 ; N g ; B 30 -146 580 454 ;
-C 104 ; WX 600 ; N h ; B 5 0 592 626 ;
-C 105 ; WX 600 ; N i ; B 77 0 523 658 ;
-C 106 ; WX 600 ; N j ; B 63 -146 440 658 ;
-C 107 ; WX 600 ; N k ; B 20 0 585 626 ;
-C 108 ; WX 600 ; N l ; B 77 0 523 626 ;
-C 109 ; WX 600 ; N m ; B -22 0 626 454 ;
-C 110 ; WX 600 ; N n ; B 18 0 592 454 ;
-C 111 ; WX 600 ; N o ; B 30 -15 570 454 ;
-C 112 ; WX 600 ; N p ; B -1 -142 570 454 ;
-C 113 ; WX 600 ; N q ; B 20 -142 591 454 ;
-C 114 ; WX 600 ; N r ; B 47 0 580 454 ;
-C 115 ; WX 600 ; N s ; B 68 -17 535 459 ;
-C 116 ; WX 600 ; N t ; B 47 -15 532 562 ;
-C 117 ; WX 600 ; N u ; B -1 -15 569 439 ;
-C 118 ; WX 600 ; N v ; B -1 0 601 439 ;
-C 119 ; WX 600 ; N w ; B -18 0 618 439 ;
-C 120 ; WX 600 ; N x ; B 6 0 594 439 ;
-C 121 ; WX 600 ; N y ; B -4 -142 601 439 ;
-C 122 ; WX 600 ; N z ; B 81 0 520 439 ;
-C 123 ; WX 600 ; N braceleft ; B 160 -102 464 616 ;
-C 124 ; WX 600 ; N bar ; B 255 -250 345 750 ;
-C 125 ; WX 600 ; N braceright ; B 136 -102 440 616 ;
-C 126 ; WX 600 ; N asciitilde ; B 71 153 530 356 ;
-C 161 ; WX 600 ; N exclamdown ; B 202 -146 398 449 ;
-C 162 ; WX 600 ; N cent ; B 66 -49 518 614 ;
-C 163 ; WX 600 ; N sterling ; B 72 -28 558 611 ;
-C 164 ; WX 600 ; N fraction ; B 25 -60 576 661 ;
-C 165 ; WX 600 ; N yen ; B 10 0 590 562 ;
-C 166 ; WX 600 ; N florin ; B -30 -131 572 616 ;
-C 167 ; WX 600 ; N section ; B 83 -70 517 580 ;
-C 168 ; WX 600 ; N currency ; B 54 49 546 517 ;
-C 169 ; WX 600 ; N quotesingle ; B 227 277 373 562 ;
-C 170 ; WX 600 ; N quotedblleft ; B 71 277 535 562 ;
-C 171 ; WX 600 ; N guillemotleft ; B 8 70 553 446 ;
-C 172 ; WX 600 ; N guilsinglleft ; B 141 70 459 446 ;
-C 173 ; WX 600 ; N guilsinglright ; B 141 70 459 446 ;
-C 174 ; WX 600 ; N fi ; B 12 0 593 626 ;
-C 175 ; WX 600 ; N fl ; B 12 0 593 626 ;
-C 177 ; WX 600 ; N endash ; B 65 203 535 313 ;
-C 178 ; WX 600 ; N dagger ; B 106 -70 494 580 ;
-C 179 ; WX 600 ; N daggerdbl ; B 106 -70 494 580 ;
-C 180 ; WX 600 ; N periodcentered ; B 196 165 404 351 ;
-C 182 ; WX 600 ; N paragraph ; B 6 -70 576 580 ;
-C 183 ; WX 600 ; N bullet ; B 140 132 460 430 ;
-C 184 ; WX 600 ; N quotesinglbase ; B 175 -142 427 143 ;
-C 185 ; WX 600 ; N quotedblbase ; B 65 -142 529 143 ;
-C 186 ; WX 600 ; N quotedblright ; B 61 277 525 562 ;
-C 187 ; WX 600 ; N guillemotright ; B 47 70 592 446 ;
-C 188 ; WX 600 ; N ellipsis ; B 26 -15 574 116 ;
-C 189 ; WX 600 ; N perthousand ; B -113 -15 713 616 ;
-C 191 ; WX 600 ; N questiondown ; B 99 -146 502 449 ;
-C 193 ; WX 600 ; N grave ; B 132 508 395 661 ;
-C 194 ; WX 600 ; N acute ; B 205 508 468 661 ;
-C 195 ; WX 600 ; N circumflex ; B 103 483 497 657 ;
-C 196 ; WX 600 ; N tilde ; B 89 493 512 636 ;
-C 197 ; WX 600 ; N macron ; B 88 505 512 585 ;
-C 198 ; WX 600 ; N breve ; B 83 468 517 631 ;
-C 199 ; WX 600 ; N dotaccent ; B 230 498 370 638 ;
-C 200 ; WX 600 ; N dieresis ; B 128 498 472 638 ;
-C 202 ; WX 600 ; N ring ; B 198 481 402 678 ;
-C 203 ; WX 600 ; N cedilla ; B 205 -206 387 0 ;
-C 205 ; WX 600 ; N hungarumlaut ; B 68 488 588 661 ;
-C 206 ; WX 600 ; N ogonek ; B 169 -199 400 0 ;
-C 207 ; WX 600 ; N caron ; B 103 493 497 667 ;
-C 208 ; WX 600 ; N emdash ; B -10 203 610 313 ;
-C 225 ; WX 600 ; N AE ; B -29 0 602 562 ;
-C 227 ; WX 600 ; N ordfeminine ; B 147 196 453 580 ;
-C 232 ; WX 600 ; N Lslash ; B 39 0 578 562 ;
-C 233 ; WX 600 ; N Oslash ; B 22 -22 578 584 ;
-C 234 ; WX 600 ; N OE ; B -25 0 595 562 ;
-C 235 ; WX 600 ; N ordmasculine ; B 147 196 453 580 ;
-C 241 ; WX 600 ; N ae ; B -4 -15 601 454 ;
-C 245 ; WX 600 ; N dotlessi ; B 77 0 523 439 ;
-C 248 ; WX 600 ; N lslash ; B 77 0 523 626 ;
-C 249 ; WX 600 ; N oslash ; B 30 -24 570 463 ;
-C 250 ; WX 600 ; N oe ; B -18 -15 611 454 ;
-C 251 ; WX 600 ; N germandbls ; B 22 -15 596 626 ;
-C -1 ; WX 600 ; N Idieresis ; B 77 0 523 761 ;
-C -1 ; WX 600 ; N eacute ; B 40 -15 563 661 ;
-C -1 ; WX 600 ; N abreve ; B 35 -15 570 661 ;
-C -1 ; WX 600 ; N uhungarumlaut ; B -1 -15 628 661 ;
-C -1 ; WX 600 ; N ecaron ; B 40 -15 563 667 ;
-C -1 ; WX 600 ; N Ydieresis ; B 12 0 589 761 ;
-C -1 ; WX 600 ; N divide ; B 71 16 529 500 ;
-C -1 ; WX 600 ; N Yacute ; B 12 0 589 784 ;
-C -1 ; WX 600 ; N Acircumflex ; B -9 0 609 780 ;
-C -1 ; WX 600 ; N aacute ; B 35 -15 570 661 ;
-C -1 ; WX 600 ; N Ucircumflex ; B 4 -18 596 780 ;
-C -1 ; WX 600 ; N yacute ; B -4 -142 601 661 ;
-C -1 ; WX 600 ; N scommaaccent ; B 68 -250 535 459 ;
-C -1 ; WX 600 ; N ecircumflex ; B 40 -15 563 657 ;
-C -1 ; WX 600 ; N Uring ; B 4 -18 596 801 ;
-C -1 ; WX 600 ; N Udieresis ; B 4 -18 596 761 ;
-C -1 ; WX 600 ; N aogonek ; B 35 -199 586 454 ;
-C -1 ; WX 600 ; N Uacute ; B 4 -18 596 784 ;
-C -1 ; WX 600 ; N uogonek ; B -1 -199 585 439 ;
-C -1 ; WX 600 ; N Edieresis ; B 25 0 560 761 ;
-C -1 ; WX 600 ; N Dcroat ; B 30 0 594 562 ;
-C -1 ; WX 600 ; N commaaccent ; B 205 -250 397 -57 ;
-C -1 ; WX 600 ; N copyright ; B 0 -18 600 580 ;
-C -1 ; WX 600 ; N Emacron ; B 25 0 560 708 ;
-C -1 ; WX 600 ; N ccaron ; B 40 -15 545 667 ;
-C -1 ; WX 600 ; N aring ; B 35 -15 570 678 ;
-C -1 ; WX 600 ; N Ncommaaccent ; B 8 -250 610 562 ;
-C -1 ; WX 600 ; N lacute ; B 77 0 523 801 ;
-C -1 ; WX 600 ; N agrave ; B 35 -15 570 661 ;
-C -1 ; WX 600 ; N Tcommaaccent ; B 21 -250 579 562 ;
-C -1 ; WX 600 ; N Cacute ; B 22 -18 560 784 ;
-C -1 ; WX 600 ; N atilde ; B 35 -15 570 636 ;
-C -1 ; WX 600 ; N Edotaccent ; B 25 0 560 761 ;
-C -1 ; WX 600 ; N scaron ; B 68 -17 535 667 ;
-C -1 ; WX 600 ; N scedilla ; B 68 -206 535 459 ;
-C -1 ; WX 600 ; N iacute ; B 77 0 523 661 ;
-C -1 ; WX 600 ; N lozenge ; B 66 0 534 740 ;
-C -1 ; WX 600 ; N Rcaron ; B 24 0 599 790 ;
-C -1 ; WX 600 ; N Gcommaaccent ; B 22 -250 594 580 ;
-C -1 ; WX 600 ; N ucircumflex ; B -1 -15 569 657 ;
-C -1 ; WX 600 ; N acircumflex ; B 35 -15 570 657 ;
-C -1 ; WX 600 ; N Amacron ; B -9 0 609 708 ;
-C -1 ; WX 600 ; N rcaron ; B 47 0 580 667 ;
-C -1 ; WX 600 ; N ccedilla ; B 40 -206 545 459 ;
-C -1 ; WX 600 ; N Zdotaccent ; B 62 0 539 761 ;
-C -1 ; WX 600 ; N Thorn ; B 48 0 557 562 ;
-C -1 ; WX 600 ; N Omacron ; B 22 -18 578 708 ;
-C -1 ; WX 600 ; N Racute ; B 24 0 599 784 ;
-C -1 ; WX 600 ; N Sacute ; B 47 -22 553 784 ;
-C -1 ; WX 600 ; N dcaron ; B 20 -15 727 626 ;
-C -1 ; WX 600 ; N Umacron ; B 4 -18 596 708 ;
-C -1 ; WX 600 ; N uring ; B -1 -15 569 678 ;
-C -1 ; WX 600 ; N threesuperior ; B 138 222 433 616 ;
-C -1 ; WX 600 ; N Ograve ; B 22 -18 578 784 ;
-C -1 ; WX 600 ; N Agrave ; B -9 0 609 784 ;
-C -1 ; WX 600 ; N Abreve ; B -9 0 609 784 ;
-C -1 ; WX 600 ; N multiply ; B 81 39 520 478 ;
-C -1 ; WX 600 ; N uacute ; B -1 -15 569 661 ;
-C -1 ; WX 600 ; N Tcaron ; B 21 0 579 790 ;
-C -1 ; WX 600 ; N partialdiff ; B 63 -38 537 728 ;
-C -1 ; WX 600 ; N ydieresis ; B -4 -142 601 638 ;
-C -1 ; WX 600 ; N Nacute ; B 8 -12 610 784 ;
-C -1 ; WX 600 ; N icircumflex ; B 73 0 523 657 ;
-C -1 ; WX 600 ; N Ecircumflex ; B 25 0 560 780 ;
-C -1 ; WX 600 ; N adieresis ; B 35 -15 570 638 ;
-C -1 ; WX 600 ; N edieresis ; B 40 -15 563 638 ;
-C -1 ; WX 600 ; N cacute ; B 40 -15 545 661 ;
-C -1 ; WX 600 ; N nacute ; B 18 0 592 661 ;
-C -1 ; WX 600 ; N umacron ; B -1 -15 569 585 ;
-C -1 ; WX 600 ; N Ncaron ; B 8 -12 610 790 ;
-C -1 ; WX 600 ; N Iacute ; B 77 0 523 784 ;
-C -1 ; WX 600 ; N plusminus ; B 71 24 529 515 ;
-C -1 ; WX 600 ; N brokenbar ; B 255 -175 345 675 ;
-C -1 ; WX 600 ; N registered ; B 0 -18 600 580 ;
-C -1 ; WX 600 ; N Gbreve ; B 22 -18 594 784 ;
-C -1 ; WX 600 ; N Idotaccent ; B 77 0 523 761 ;
-C -1 ; WX 600 ; N summation ; B 15 -10 586 706 ;
-C -1 ; WX 600 ; N Egrave ; B 25 0 560 784 ;
-C -1 ; WX 600 ; N racute ; B 47 0 580 661 ;
-C -1 ; WX 600 ; N omacron ; B 30 -15 570 585 ;
-C -1 ; WX 600 ; N Zacute ; B 62 0 539 784 ;
-C -1 ; WX 600 ; N Zcaron ; B 62 0 539 790 ;
-C -1 ; WX 600 ; N greaterequal ; B 26 0 523 696 ;
-C -1 ; WX 600 ; N Eth ; B 30 0 594 562 ;
-C -1 ; WX 600 ; N Ccedilla ; B 22 -206 560 580 ;
-C -1 ; WX 600 ; N lcommaaccent ; B 77 -250 523 626 ;
-C -1 ; WX 600 ; N tcaron ; B 47 -15 532 703 ;
-C -1 ; WX 600 ; N eogonek ; B 40 -199 563 454 ;
-C -1 ; WX 600 ; N Uogonek ; B 4 -199 596 562 ;
-C -1 ; WX 600 ; N Aacute ; B -9 0 609 784 ;
-C -1 ; WX 600 ; N Adieresis ; B -9 0 609 761 ;
-C -1 ; WX 600 ; N egrave ; B 40 -15 563 661 ;
-C -1 ; WX 600 ; N zacute ; B 81 0 520 661 ;
-C -1 ; WX 600 ; N iogonek ; B 77 -199 523 658 ;
-C -1 ; WX 600 ; N Oacute ; B 22 -18 578 784 ;
-C -1 ; WX 600 ; N oacute ; B 30 -15 570 661 ;
-C -1 ; WX 600 ; N amacron ; B 35 -15 570 585 ;
-C -1 ; WX 600 ; N sacute ; B 68 -17 535 661 ;
-C -1 ; WX 600 ; N idieresis ; B 77 0 523 618 ;
-C -1 ; WX 600 ; N Ocircumflex ; B 22 -18 578 780 ;
-C -1 ; WX 600 ; N Ugrave ; B 4 -18 596 784 ;
-C -1 ; WX 600 ; N Delta ; B 6 0 594 688 ;
-C -1 ; WX 600 ; N thorn ; B -14 -142 570 626 ;
-C -1 ; WX 600 ; N twosuperior ; B 143 230 436 616 ;
-C -1 ; WX 600 ; N Odieresis ; B 22 -18 578 761 ;
-C -1 ; WX 600 ; N mu ; B -1 -142 569 439 ;
-C -1 ; WX 600 ; N igrave ; B 77 0 523 661 ;
-C -1 ; WX 600 ; N ohungarumlaut ; B 30 -15 668 661 ;
-C -1 ; WX 600 ; N Eogonek ; B 25 -199 576 562 ;
-C -1 ; WX 600 ; N dcroat ; B 20 -15 591 626 ;
-C -1 ; WX 600 ; N threequarters ; B -47 -60 648 661 ;
-C -1 ; WX 600 ; N Scedilla ; B 47 -206 553 582 ;
-C -1 ; WX 600 ; N lcaron ; B 77 0 597 626 ;
-C -1 ; WX 600 ; N Kcommaaccent ; B 21 -250 599 562 ;
-C -1 ; WX 600 ; N Lacute ; B 39 0 578 784 ;
-C -1 ; WX 600 ; N trademark ; B -9 230 749 562 ;
-C -1 ; WX 600 ; N edotaccent ; B 40 -15 563 638 ;
-C -1 ; WX 600 ; N Igrave ; B 77 0 523 784 ;
-C -1 ; WX 600 ; N Imacron ; B 77 0 523 708 ;
-C -1 ; WX 600 ; N Lcaron ; B 39 0 637 562 ;
-C -1 ; WX 600 ; N onehalf ; B -47 -60 648 661 ;
-C -1 ; WX 600 ; N lessequal ; B 26 0 523 696 ;
-C -1 ; WX 600 ; N ocircumflex ; B 30 -15 570 657 ;
-C -1 ; WX 600 ; N ntilde ; B 18 0 592 636 ;
-C -1 ; WX 600 ; N Uhungarumlaut ; B 4 -18 638 784 ;
-C -1 ; WX 600 ; N Eacute ; B 25 0 560 784 ;
-C -1 ; WX 600 ; N emacron ; B 40 -15 563 585 ;
-C -1 ; WX 600 ; N gbreve ; B 30 -146 580 661 ;
-C -1 ; WX 600 ; N onequarter ; B -56 -60 656 661 ;
-C -1 ; WX 600 ; N Scaron ; B 47 -22 553 790 ;
-C -1 ; WX 600 ; N Scommaaccent ; B 47 -250 553 582 ;
-C -1 ; WX 600 ; N Ohungarumlaut ; B 22 -18 628 784 ;
-C -1 ; WX 600 ; N degree ; B 86 243 474 616 ;
-C -1 ; WX 600 ; N ograve ; B 30 -15 570 661 ;
-C -1 ; WX 600 ; N Ccaron ; B 22 -18 560 790 ;
-C -1 ; WX 600 ; N ugrave ; B -1 -15 569 661 ;
-C -1 ; WX 600 ; N radical ; B -19 -104 473 778 ;
-C -1 ; WX 600 ; N Dcaron ; B 30 0 594 790 ;
-C -1 ; WX 600 ; N rcommaaccent ; B 47 -250 580 454 ;
-C -1 ; WX 600 ; N Ntilde ; B 8 -12 610 759 ;
-C -1 ; WX 600 ; N otilde ; B 30 -15 570 636 ;
-C -1 ; WX 600 ; N Rcommaaccent ; B 24 -250 599 562 ;
-C -1 ; WX 600 ; N Lcommaaccent ; B 39 -250 578 562 ;
-C -1 ; WX 600 ; N Atilde ; B -9 0 609 759 ;
-C -1 ; WX 600 ; N Aogonek ; B -9 -199 625 562 ;
-C -1 ; WX 600 ; N Aring ; B -9 0 609 801 ;
-C -1 ; WX 600 ; N Otilde ; B 22 -18 578 759 ;
-C -1 ; WX 600 ; N zdotaccent ; B 81 0 520 638 ;
-C -1 ; WX 600 ; N Ecaron ; B 25 0 560 790 ;
-C -1 ; WX 600 ; N Iogonek ; B 77 -199 523 562 ;
-C -1 ; WX 600 ; N kcommaaccent ; B 20 -250 585 626 ;
-C -1 ; WX 600 ; N minus ; B 71 203 529 313 ;
-C -1 ; WX 600 ; N Icircumflex ; B 77 0 523 780 ;
-C -1 ; WX 600 ; N ncaron ; B 18 0 592 667 ;
-C -1 ; WX 600 ; N tcommaaccent ; B 47 -250 532 562 ;
-C -1 ; WX 600 ; N logicalnot ; B 71 103 529 413 ;
-C -1 ; WX 600 ; N odieresis ; B 30 -15 570 638 ;
-C -1 ; WX 600 ; N udieresis ; B -1 -15 569 638 ;
-C -1 ; WX 600 ; N notequal ; B 12 -47 537 563 ;
-C -1 ; WX 600 ; N gcommaaccent ; B 30 -146 580 714 ;
-C -1 ; WX 600 ; N eth ; B 58 -27 543 626 ;
-C -1 ; WX 600 ; N zcaron ; B 81 0 520 667 ;
-C -1 ; WX 600 ; N ncommaaccent ; B 18 -250 592 454 ;
-C -1 ; WX 600 ; N onesuperior ; B 153 230 447 616 ;
-C -1 ; WX 600 ; N imacron ; B 77 0 523 585 ;
-C -1 ; WX 600 ; N Euro ; B 0 0 0 0 ;
-EndCharMetrics
-EndFontMetrics
-
diff --git a/LibrarySource/com/lowagie/text/pdf/fonts/Courier-BoldOblique.afm b/LibrarySource/com/lowagie/text/pdf/fonts/Courier-BoldOblique.afm
deleted file mode 100644
index 9d2f8a2..0000000
--- a/LibrarySource/com/lowagie/text/pdf/fonts/Courier-BoldOblique.afm
+++ /dev/null
@@ -1,343 +0,0 @@
-StartFontMetrics 4.1
-Comment Copyright (c) 1989, 1990, 1991, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
-Comment Creation Date: Mon Jun 23 16:28:46 1997
-Comment UniqueID 43049
-Comment VMusage 17529 79244
-FontName Courier-BoldOblique
-FullName Courier Bold Oblique
-FamilyName Courier
-Weight Bold
-ItalicAngle -12
-IsFixedPitch true
-CharacterSet ExtendedRoman
-FontBBox -57 -250 869 801
-UnderlinePosition -100
-UnderlineThickness 50
-Version 003.000
-Notice Copyright (c) 1989, 1990, 1991, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
-EncodingScheme AdobeStandardEncoding
-CapHeight 562
-XHeight 439
-Ascender 629
-Descender -157
-StdHW 84
-StdVW 106
-StartCharMetrics 315
-C 32 ; WX 600 ; N space ; B 0 0 0 0 ;
-C 33 ; WX 600 ; N exclam ; B 215 -15 495 572 ;
-C 34 ; WX 600 ; N quotedbl ; B 211 277 585 562 ;
-C 35 ; WX 600 ; N numbersign ; B 88 -45 641 651 ;
-C 36 ; WX 600 ; N dollar ; B 87 -126 630 666 ;
-C 37 ; WX 600 ; N percent ; B 101 -15 625 616 ;
-C 38 ; WX 600 ; N ampersand ; B 61 -15 595 543 ;
-C 39 ; WX 600 ; N quoteright ; B 229 277 543 562 ;
-C 40 ; WX 600 ; N parenleft ; B 265 -102 592 616 ;
-C 41 ; WX 600 ; N parenright ; B 117 -102 444 616 ;
-C 42 ; WX 600 ; N asterisk ; B 179 219 598 601 ;
-C 43 ; WX 600 ; N plus ; B 114 39 596 478 ;
-C 44 ; WX 600 ; N comma ; B 99 -111 430 174 ;
-C 45 ; WX 600 ; N hyphen ; B 143 203 567 313 ;
-C 46 ; WX 600 ; N period ; B 206 -15 427 171 ;
-C 47 ; WX 600 ; N slash ; B 90 -77 626 626 ;
-C 48 ; WX 600 ; N zero ; B 135 -15 593 616 ;
-C 49 ; WX 600 ; N one ; B 93 0 562 616 ;
-C 50 ; WX 600 ; N two ; B 61 0 594 616 ;
-C 51 ; WX 600 ; N three ; B 71 -15 571 616 ;
-C 52 ; WX 600 ; N four ; B 81 0 559 616 ;
-C 53 ; WX 600 ; N five ; B 77 -15 621 601 ;
-C 54 ; WX 600 ; N six ; B 135 -15 652 616 ;
-C 55 ; WX 600 ; N seven ; B 147 0 622 601 ;
-C 56 ; WX 600 ; N eight ; B 115 -15 604 616 ;
-C 57 ; WX 600 ; N nine ; B 75 -15 592 616 ;
-C 58 ; WX 600 ; N colon ; B 205 -15 480 425 ;
-C 59 ; WX 600 ; N semicolon ; B 99 -111 481 425 ;
-C 60 ; WX 600 ; N less ; B 120 15 613 501 ;
-C 61 ; WX 600 ; N equal ; B 96 118 614 398 ;
-C 62 ; WX 600 ; N greater ; B 97 15 589 501 ;
-C 63 ; WX 600 ; N question ; B 183 -14 592 580 ;
-C 64 ; WX 600 ; N at ; B 65 -15 642 616 ;
-C 65 ; WX 600 ; N A ; B -9 0 632 562 ;
-C 66 ; WX 600 ; N B ; B 30 0 630 562 ;
-C 67 ; WX 600 ; N C ; B 74 -18 675 580 ;
-C 68 ; WX 600 ; N D ; B 30 0 664 562 ;
-C 69 ; WX 600 ; N E ; B 25 0 670 562 ;
-C 70 ; WX 600 ; N F ; B 39 0 684 562 ;
-C 71 ; WX 600 ; N G ; B 74 -18 675 580 ;
-C 72 ; WX 600 ; N H ; B 20 0 700 562 ;
-C 73 ; WX 600 ; N I ; B 77 0 643 562 ;
-C 74 ; WX 600 ; N J ; B 58 -18 721 562 ;
-C 75 ; WX 600 ; N K ; B 21 0 692 562 ;
-C 76 ; WX 600 ; N L ; B 39 0 636 562 ;
-C 77 ; WX 600 ; N M ; B -2 0 722 562 ;
-C 78 ; WX 600 ; N N ; B 8 -12 730 562 ;
-C 79 ; WX 600 ; N O ; B 74 -18 645 580 ;
-C 80 ; WX 600 ; N P ; B 48 0 643 562 ;
-C 81 ; WX 600 ; N Q ; B 83 -138 636 580 ;
-C 82 ; WX 600 ; N R ; B 24 0 617 562 ;
-C 83 ; WX 600 ; N S ; B 54 -22 673 582 ;
-C 84 ; WX 600 ; N T ; B 86 0 679 562 ;
-C 85 ; WX 600 ; N U ; B 101 -18 716 562 ;
-C 86 ; WX 600 ; N V ; B 84 0 733 562 ;
-C 87 ; WX 600 ; N W ; B 79 0 738 562 ;
-C 88 ; WX 600 ; N X ; B 12 0 690 562 ;
-C 89 ; WX 600 ; N Y ; B 109 0 709 562 ;
-C 90 ; WX 600 ; N Z ; B 62 0 637 562 ;
-C 91 ; WX 600 ; N bracketleft ; B 223 -102 606 616 ;
-C 92 ; WX 600 ; N backslash ; B 222 -77 496 626 ;
-C 93 ; WX 600 ; N bracketright ; B 103 -102 486 616 ;
-C 94 ; WX 600 ; N asciicircum ; B 171 250 556 616 ;
-C 95 ; WX 600 ; N underscore ; B -27 -125 585 -75 ;
-C 96 ; WX 600 ; N quoteleft ; B 297 277 487 562 ;
-C 97 ; WX 600 ; N a ; B 61 -15 593 454 ;
-C 98 ; WX 600 ; N b ; B 13 -15 636 626 ;
-C 99 ; WX 600 ; N c ; B 81 -15 631 459 ;
-C 100 ; WX 600 ; N d ; B 60 -15 645 626 ;
-C 101 ; WX 600 ; N e ; B 81 -15 605 454 ;
-C 102 ; WX 600 ; N f ; B 83 0 677 626 ; L i fi ; L l fl ;
-C 103 ; WX 600 ; N g ; B 40 -146 674 454 ;
-C 104 ; WX 600 ; N h ; B 18 0 615 626 ;
-C 105 ; WX 600 ; N i ; B 77 0 546 658 ;
-C 106 ; WX 600 ; N j ; B 36 -146 580 658 ;
-C 107 ; WX 600 ; N k ; B 33 0 643 626 ;
-C 108 ; WX 600 ; N l ; B 77 0 546 626 ;
-C 109 ; WX 600 ; N m ; B -22 0 649 454 ;
-C 110 ; WX 600 ; N n ; B 18 0 615 454 ;
-C 111 ; WX 600 ; N o ; B 71 -15 622 454 ;
-C 112 ; WX 600 ; N p ; B -32 -142 622 454 ;
-C 113 ; WX 600 ; N q ; B 60 -142 685 454 ;
-C 114 ; WX 600 ; N r ; B 47 0 655 454 ;
-C 115 ; WX 600 ; N s ; B 66 -17 608 459 ;
-C 116 ; WX 600 ; N t ; B 118 -15 567 562 ;
-C 117 ; WX 600 ; N u ; B 70 -15 592 439 ;
-C 118 ; WX 600 ; N v ; B 70 0 695 439 ;
-C 119 ; WX 600 ; N w ; B 53 0 712 439 ;
-C 120 ; WX 600 ; N x ; B 6 0 671 439 ;
-C 121 ; WX 600 ; N y ; B -21 -142 695 439 ;
-C 122 ; WX 600 ; N z ; B 81 0 614 439 ;
-C 123 ; WX 600 ; N braceleft ; B 203 -102 595 616 ;
-C 124 ; WX 600 ; N bar ; B 201 -250 505 750 ;
-C 125 ; WX 600 ; N braceright ; B 114 -102 506 616 ;
-C 126 ; WX 600 ; N asciitilde ; B 120 153 590 356 ;
-C 161 ; WX 600 ; N exclamdown ; B 196 -146 477 449 ;
-C 162 ; WX 600 ; N cent ; B 121 -49 605 614 ;
-C 163 ; WX 600 ; N sterling ; B 106 -28 650 611 ;
-C 164 ; WX 600 ; N fraction ; B 22 -60 708 661 ;
-C 165 ; WX 600 ; N yen ; B 98 0 710 562 ;
-C 166 ; WX 600 ; N florin ; B -57 -131 702 616 ;
-C 167 ; WX 600 ; N section ; B 74 -70 620 580 ;
-C 168 ; WX 600 ; N currency ; B 77 49 644 517 ;
-C 169 ; WX 600 ; N quotesingle ; B 303 277 493 562 ;
-C 170 ; WX 600 ; N quotedblleft ; B 190 277 594 562 ;
-C 171 ; WX 600 ; N guillemotleft ; B 62 70 639 446 ;
-C 172 ; WX 600 ; N guilsinglleft ; B 195 70 545 446 ;
-C 173 ; WX 600 ; N guilsinglright ; B 165 70 514 446 ;
-C 174 ; WX 600 ; N fi ; B 12 0 644 626 ;
-C 175 ; WX 600 ; N fl ; B 12 0 644 626 ;
-C 177 ; WX 600 ; N endash ; B 108 203 602 313 ;
-C 178 ; WX 600 ; N dagger ; B 175 -70 586 580 ;
-C 179 ; WX 600 ; N daggerdbl ; B 121 -70 587 580 ;
-C 180 ; WX 600 ; N periodcentered ; B 248 165 461 351 ;
-C 182 ; WX 600 ; N paragraph ; B 61 -70 700 580 ;
-C 183 ; WX 600 ; N bullet ; B 196 132 523 430 ;
-C 184 ; WX 600 ; N quotesinglbase ; B 144 -142 458 143 ;
-C 185 ; WX 600 ; N quotedblbase ; B 34 -142 560 143 ;
-C 186 ; WX 600 ; N quotedblright ; B 119 277 645 562 ;
-C 187 ; WX 600 ; N guillemotright ; B 71 70 647 446 ;
-C 188 ; WX 600 ; N ellipsis ; B 35 -15 587 116 ;
-C 189 ; WX 600 ; N perthousand ; B -45 -15 743 616 ;
-C 191 ; WX 600 ; N questiondown ; B 100 -146 509 449 ;
-C 193 ; WX 600 ; N grave ; B 272 508 503 661 ;
-C 194 ; WX 600 ; N acute ; B 312 508 609 661 ;
-C 195 ; WX 600 ; N circumflex ; B 212 483 607 657 ;
-C 196 ; WX 600 ; N tilde ; B 199 493 643 636 ;
-C 197 ; WX 600 ; N macron ; B 195 505 637 585 ;
-C 198 ; WX 600 ; N breve ; B 217 468 652 631 ;
-C 199 ; WX 600 ; N dotaccent ; B 348 498 493 638 ;
-C 200 ; WX 600 ; N dieresis ; B 246 498 595 638 ;
-C 202 ; WX 600 ; N ring ; B 319 481 528 678 ;
-C 203 ; WX 600 ; N cedilla ; B 168 -206 368 0 ;
-C 205 ; WX 600 ; N hungarumlaut ; B 171 488 729 661 ;
-C 206 ; WX 600 ; N ogonek ; B 143 -199 367 0 ;
-C 207 ; WX 600 ; N caron ; B 238 493 633 667 ;
-C 208 ; WX 600 ; N emdash ; B 33 203 677 313 ;
-C 225 ; WX 600 ; N AE ; B -29 0 708 562 ;
-C 227 ; WX 600 ; N ordfeminine ; B 188 196 526 580 ;
-C 232 ; WX 600 ; N Lslash ; B 39 0 636 562 ;
-C 233 ; WX 600 ; N Oslash ; B 48 -22 673 584 ;
-C 234 ; WX 600 ; N OE ; B 26 0 701 562 ;
-C 235 ; WX 600 ; N ordmasculine ; B 188 196 543 580 ;
-C 241 ; WX 600 ; N ae ; B 21 -15 652 454 ;
-C 245 ; WX 600 ; N dotlessi ; B 77 0 546 439 ;
-C 248 ; WX 600 ; N lslash ; B 77 0 587 626 ;
-C 249 ; WX 600 ; N oslash ; B 54 -24 638 463 ;
-C 250 ; WX 600 ; N oe ; B 18 -15 662 454 ;
-C 251 ; WX 600 ; N germandbls ; B 22 -15 629 626 ;
-C -1 ; WX 600 ; N Idieresis ; B 77 0 643 761 ;
-C -1 ; WX 600 ; N eacute ; B 81 -15 609 661 ;
-C -1 ; WX 600 ; N abreve ; B 61 -15 658 661 ;
-C -1 ; WX 600 ; N uhungarumlaut ; B 70 -15 769 661 ;
-C -1 ; WX 600 ; N ecaron ; B 81 -15 633 667 ;
-C -1 ; WX 600 ; N Ydieresis ; B 109 0 709 761 ;
-C -1 ; WX 600 ; N divide ; B 114 16 596 500 ;
-C -1 ; WX 600 ; N Yacute ; B 109 0 709 784 ;
-C -1 ; WX 600 ; N Acircumflex ; B -9 0 632 780 ;
-C -1 ; WX 600 ; N aacute ; B 61 -15 609 661 ;
-C -1 ; WX 600 ; N Ucircumflex ; B 101 -18 716 780 ;
-C -1 ; WX 600 ; N yacute ; B -21 -142 695 661 ;
-C -1 ; WX 600 ; N scommaaccent ; B 66 -250 608 459 ;
-C -1 ; WX 600 ; N ecircumflex ; B 81 -15 607 657 ;
-C -1 ; WX 600 ; N Uring ; B 101 -18 716 801 ;
-C -1 ; WX 600 ; N Udieresis ; B 101 -18 716 761 ;
-C -1 ; WX 600 ; N aogonek ; B 61 -199 593 454 ;
-C -1 ; WX 600 ; N Uacute ; B 101 -18 716 784 ;
-C -1 ; WX 600 ; N uogonek ; B 70 -199 592 439 ;
-C -1 ; WX 600 ; N Edieresis ; B 25 0 670 761 ;
-C -1 ; WX 600 ; N Dcroat ; B 30 0 664 562 ;
-C -1 ; WX 600 ; N commaaccent ; B 151 -250 385 -57 ;
-C -1 ; WX 600 ; N copyright ; B 53 -18 667 580 ;
-C -1 ; WX 600 ; N Emacron ; B 25 0 670 708 ;
-C -1 ; WX 600 ; N ccaron ; B 81 -15 633 667 ;
-C -1 ; WX 600 ; N aring ; B 61 -15 593 678 ;
-C -1 ; WX 600 ; N Ncommaaccent ; B 8 -250 730 562 ;
-C -1 ; WX 600 ; N lacute ; B 77 0 639 801 ;
-C -1 ; WX 600 ; N agrave ; B 61 -15 593 661 ;
-C -1 ; WX 600 ; N Tcommaaccent ; B 86 -250 679 562 ;
-C -1 ; WX 600 ; N Cacute ; B 74 -18 675 784 ;
-C -1 ; WX 600 ; N atilde ; B 61 -15 643 636 ;
-C -1 ; WX 600 ; N Edotaccent ; B 25 0 670 761 ;
-C -1 ; WX 600 ; N scaron ; B 66 -17 633 667 ;
-C -1 ; WX 600 ; N scedilla ; B 66 -206 608 459 ;
-C -1 ; WX 600 ; N iacute ; B 77 0 609 661 ;
-C -1 ; WX 600 ; N lozenge ; B 145 0 614 740 ;
-C -1 ; WX 600 ; N Rcaron ; B 24 0 659 790 ;
-C -1 ; WX 600 ; N Gcommaaccent ; B 74 -250 675 580 ;
-C -1 ; WX 600 ; N ucircumflex ; B 70 -15 597 657 ;
-C -1 ; WX 600 ; N acircumflex ; B 61 -15 607 657 ;
-C -1 ; WX 600 ; N Amacron ; B -9 0 633 708 ;
-C -1 ; WX 600 ; N rcaron ; B 47 0 655 667 ;
-C -1 ; WX 600 ; N ccedilla ; B 81 -206 631 459 ;
-C -1 ; WX 600 ; N Zdotaccent ; B 62 0 637 761 ;
-C -1 ; WX 600 ; N Thorn ; B 48 0 620 562 ;
-C -1 ; WX 600 ; N Omacron ; B 74 -18 663 708 ;
-C -1 ; WX 600 ; N Racute ; B 24 0 665 784 ;
-C -1 ; WX 600 ; N Sacute ; B 54 -22 673 784 ;
-C -1 ; WX 600 ; N dcaron ; B 60 -15 861 626 ;
-C -1 ; WX 600 ; N Umacron ; B 101 -18 716 708 ;
-C -1 ; WX 600 ; N uring ; B 70 -15 592 678 ;
-C -1 ; WX 600 ; N threesuperior ; B 193 222 526 616 ;
-C -1 ; WX 600 ; N Ograve ; B 74 -18 645 784 ;
-C -1 ; WX 600 ; N Agrave ; B -9 0 632 784 ;
-C -1 ; WX 600 ; N Abreve ; B -9 0 684 784 ;
-C -1 ; WX 600 ; N multiply ; B 104 39 606 478 ;
-C -1 ; WX 600 ; N uacute ; B 70 -15 599 661 ;
-C -1 ; WX 600 ; N Tcaron ; B 86 0 679 790 ;
-C -1 ; WX 600 ; N partialdiff ; B 91 -38 627 728 ;
-C -1 ; WX 600 ; N ydieresis ; B -21 -142 695 638 ;
-C -1 ; WX 600 ; N Nacute ; B 8 -12 730 784 ;
-C -1 ; WX 600 ; N icircumflex ; B 77 0 577 657 ;
-C -1 ; WX 600 ; N Ecircumflex ; B 25 0 670 780 ;
-C -1 ; WX 600 ; N adieresis ; B 61 -15 595 638 ;
-C -1 ; WX 600 ; N edieresis ; B 81 -15 605 638 ;
-C -1 ; WX 600 ; N cacute ; B 81 -15 649 661 ;
-C -1 ; WX 600 ; N nacute ; B 18 0 639 661 ;
-C -1 ; WX 600 ; N umacron ; B 70 -15 637 585 ;
-C -1 ; WX 600 ; N Ncaron ; B 8 -12 730 790 ;
-C -1 ; WX 600 ; N Iacute ; B 77 0 643 784 ;
-C -1 ; WX 600 ; N plusminus ; B 76 24 614 515 ;
-C -1 ; WX 600 ; N brokenbar ; B 217 -175 489 675 ;
-C -1 ; WX 600 ; N registered ; B 53 -18 667 580 ;
-C -1 ; WX 600 ; N Gbreve ; B 74 -18 684 784 ;
-C -1 ; WX 600 ; N Idotaccent ; B 77 0 643 761 ;
-C -1 ; WX 600 ; N summation ; B 15 -10 672 706 ;
-C -1 ; WX 600 ; N Egrave ; B 25 0 670 784 ;
-C -1 ; WX 600 ; N racute ; B 47 0 655 661 ;
-C -1 ; WX 600 ; N omacron ; B 71 -15 637 585 ;
-C -1 ; WX 600 ; N Zacute ; B 62 0 665 784 ;
-C -1 ; WX 600 ; N Zcaron ; B 62 0 659 790 ;
-C -1 ; WX 600 ; N greaterequal ; B 26 0 627 696 ;
-C -1 ; WX 600 ; N Eth ; B 30 0 664 562 ;
-C -1 ; WX 600 ; N Ccedilla ; B 74 -206 675 580 ;
-C -1 ; WX 600 ; N lcommaaccent ; B 77 -250 546 626 ;
-C -1 ; WX 600 ; N tcaron ; B 118 -15 627 703 ;
-C -1 ; WX 600 ; N eogonek ; B 81 -199 605 454 ;
-C -1 ; WX 600 ; N Uogonek ; B 101 -199 716 562 ;
-C -1 ; WX 600 ; N Aacute ; B -9 0 655 784 ;
-C -1 ; WX 600 ; N Adieresis ; B -9 0 632 761 ;
-C -1 ; WX 600 ; N egrave ; B 81 -15 605 661 ;
-C -1 ; WX 600 ; N zacute ; B 81 0 614 661 ;
-C -1 ; WX 600 ; N iogonek ; B 77 -199 546 658 ;
-C -1 ; WX 600 ; N Oacute ; B 74 -18 645 784 ;
-C -1 ; WX 600 ; N oacute ; B 71 -15 649 661 ;
-C -1 ; WX 600 ; N amacron ; B 61 -15 637 585 ;
-C -1 ; WX 600 ; N sacute ; B 66 -17 609 661 ;
-C -1 ; WX 600 ; N idieresis ; B 77 0 561 618 ;
-C -1 ; WX 600 ; N Ocircumflex ; B 74 -18 645 780 ;
-C -1 ; WX 600 ; N Ugrave ; B 101 -18 716 784 ;
-C -1 ; WX 600 ; N Delta ; B 6 0 594 688 ;
-C -1 ; WX 600 ; N thorn ; B -32 -142 622 626 ;
-C -1 ; WX 600 ; N twosuperior ; B 191 230 542 616 ;
-C -1 ; WX 600 ; N Odieresis ; B 74 -18 645 761 ;
-C -1 ; WX 600 ; N mu ; B 49 -142 592 439 ;
-C -1 ; WX 600 ; N igrave ; B 77 0 546 661 ;
-C -1 ; WX 600 ; N ohungarumlaut ; B 71 -15 809 661 ;
-C -1 ; WX 600 ; N Eogonek ; B 25 -199 670 562 ;
-C -1 ; WX 600 ; N dcroat ; B 60 -15 712 626 ;
-C -1 ; WX 600 ; N threequarters ; B 8 -60 699 661 ;
-C -1 ; WX 600 ; N Scedilla ; B 54 -206 673 582 ;
-C -1 ; WX 600 ; N lcaron ; B 77 0 731 626 ;
-C -1 ; WX 600 ; N Kcommaaccent ; B 21 -250 692 562 ;
-C -1 ; WX 600 ; N Lacute ; B 39 0 636 784 ;
-C -1 ; WX 600 ; N trademark ; B 86 230 869 562 ;
-C -1 ; WX 600 ; N edotaccent ; B 81 -15 605 638 ;
-C -1 ; WX 600 ; N Igrave ; B 77 0 643 784 ;
-C -1 ; WX 600 ; N Imacron ; B 77 0 663 708 ;
-C -1 ; WX 600 ; N Lcaron ; B 39 0 757 562 ;
-C -1 ; WX 600 ; N onehalf ; B 22 -60 716 661 ;
-C -1 ; WX 600 ; N lessequal ; B 26 0 671 696 ;
-C -1 ; WX 600 ; N ocircumflex ; B 71 -15 622 657 ;
-C -1 ; WX 600 ; N ntilde ; B 18 0 643 636 ;
-C -1 ; WX 600 ; N Uhungarumlaut ; B 101 -18 805 784 ;
-C -1 ; WX 600 ; N Eacute ; B 25 0 670 784 ;
-C -1 ; WX 600 ; N emacron ; B 81 -15 637 585 ;
-C -1 ; WX 600 ; N gbreve ; B 40 -146 674 661 ;
-C -1 ; WX 600 ; N onequarter ; B 13 -60 707 661 ;
-C -1 ; WX 600 ; N Scaron ; B 54 -22 689 790 ;
-C -1 ; WX 600 ; N Scommaaccent ; B 54 -250 673 582 ;
-C -1 ; WX 600 ; N Ohungarumlaut ; B 74 -18 795 784 ;
-C -1 ; WX 600 ; N degree ; B 173 243 570 616 ;
-C -1 ; WX 600 ; N ograve ; B 71 -15 622 661 ;
-C -1 ; WX 600 ; N Ccaron ; B 74 -18 689 790 ;
-C -1 ; WX 600 ; N ugrave ; B 70 -15 592 661 ;
-C -1 ; WX 600 ; N radical ; B 67 -104 635 778 ;
-C -1 ; WX 600 ; N Dcaron ; B 30 0 664 790 ;
-C -1 ; WX 600 ; N rcommaaccent ; B 47 -250 655 454 ;
-C -1 ; WX 600 ; N Ntilde ; B 8 -12 730 759 ;
-C -1 ; WX 600 ; N otilde ; B 71 -15 643 636 ;
-C -1 ; WX 600 ; N Rcommaaccent ; B 24 -250 617 562 ;
-C -1 ; WX 600 ; N Lcommaaccent ; B 39 -250 636 562 ;
-C -1 ; WX 600 ; N Atilde ; B -9 0 669 759 ;
-C -1 ; WX 600 ; N Aogonek ; B -9 -199 632 562 ;
-C -1 ; WX 600 ; N Aring ; B -9 0 632 801 ;
-C -1 ; WX 600 ; N Otilde ; B 74 -18 669 759 ;
-C -1 ; WX 600 ; N zdotaccent ; B 81 0 614 638 ;
-C -1 ; WX 600 ; N Ecaron ; B 25 0 670 790 ;
-C -1 ; WX 600 ; N Iogonek ; B 77 -199 643 562 ;
-C -1 ; WX 600 ; N kcommaaccent ; B 33 -250 643 626 ;
-C -1 ; WX 600 ; N minus ; B 114 203 596 313 ;
-C -1 ; WX 600 ; N Icircumflex ; B 77 0 643 780 ;
-C -1 ; WX 600 ; N ncaron ; B 18 0 633 667 ;
-C -1 ; WX 600 ; N tcommaaccent ; B 118 -250 567 562 ;
-C -1 ; WX 600 ; N logicalnot ; B 135 103 617 413 ;
-C -1 ; WX 600 ; N odieresis ; B 71 -15 622 638 ;
-C -1 ; WX 600 ; N udieresis ; B 70 -15 595 638 ;
-C -1 ; WX 600 ; N notequal ; B 30 -47 626 563 ;
-C -1 ; WX 600 ; N gcommaaccent ; B 40 -146 674 714 ;
-C -1 ; WX 600 ; N eth ; B 93 -27 661 626 ;
-C -1 ; WX 600 ; N zcaron ; B 81 0 643 667 ;
-C -1 ; WX 600 ; N ncommaaccent ; B 18 -250 615 454 ;
-C -1 ; WX 600 ; N onesuperior ; B 212 230 514 616 ;
-C -1 ; WX 600 ; N imacron ; B 77 0 575 585 ;
-C -1 ; WX 600 ; N Euro ; B 0 0 0 0 ;
-EndCharMetrics
-EndFontMetrics
-
diff --git a/LibrarySource/com/lowagie/text/pdf/fonts/Courier-Oblique.afm b/LibrarySource/com/lowagie/text/pdf/fonts/Courier-Oblique.afm
deleted file mode 100644
index d7f1b78..0000000
--- a/LibrarySource/com/lowagie/text/pdf/fonts/Courier-Oblique.afm
+++ /dev/null
@@ -1,343 +0,0 @@
-StartFontMetrics 4.1
-Comment Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
-Comment Creation Date: Thu May 1 17:37:52 1997
-Comment UniqueID 43051
-Comment VMusage 16248 75829
-FontName Courier-Oblique
-FullName Courier Oblique
-FamilyName Courier
-Weight Medium
-ItalicAngle -12
-IsFixedPitch true
-CharacterSet ExtendedRoman
-FontBBox -27 -250 849 805
-UnderlinePosition -100
-UnderlineThickness 50
-Version 003.000
-Notice Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
-EncodingScheme AdobeStandardEncoding
-CapHeight 562
-XHeight 426
-Ascender 629
-Descender -157
-StdHW 51
-StdVW 51
-StartCharMetrics 315
-C 32 ; WX 600 ; N space ; B 0 0 0 0 ;
-C 33 ; WX 600 ; N exclam ; B 243 -15 464 572 ;
-C 34 ; WX 600 ; N quotedbl ; B 273 328 532 562 ;
-C 35 ; WX 600 ; N numbersign ; B 133 -32 596 639 ;
-C 36 ; WX 600 ; N dollar ; B 108 -126 596 662 ;
-C 37 ; WX 600 ; N percent ; B 134 -15 599 622 ;
-C 38 ; WX 600 ; N ampersand ; B 87 -15 580 543 ;
-C 39 ; WX 600 ; N quoteright ; B 283 328 495 562 ;
-C 40 ; WX 600 ; N parenleft ; B 313 -108 572 622 ;
-C 41 ; WX 600 ; N parenright ; B 137 -108 396 622 ;
-C 42 ; WX 600 ; N asterisk ; B 212 257 580 607 ;
-C 43 ; WX 600 ; N plus ; B 129 44 580 470 ;
-C 44 ; WX 600 ; N comma ; B 157 -112 370 122 ;
-C 45 ; WX 600 ; N hyphen ; B 152 231 558 285 ;
-C 46 ; WX 600 ; N period ; B 238 -15 382 109 ;
-C 47 ; WX 600 ; N slash ; B 112 -80 604 629 ;
-C 48 ; WX 600 ; N zero ; B 154 -15 575 622 ;
-C 49 ; WX 600 ; N one ; B 98 0 515 622 ;
-C 50 ; WX 600 ; N two ; B 70 0 568 622 ;
-C 51 ; WX 600 ; N three ; B 82 -15 538 622 ;
-C 52 ; WX 600 ; N four ; B 108 0 541 622 ;
-C 53 ; WX 600 ; N five ; B 99 -15 589 607 ;
-C 54 ; WX 600 ; N six ; B 155 -15 629 622 ;
-C 55 ; WX 600 ; N seven ; B 182 0 612 607 ;
-C 56 ; WX 600 ; N eight ; B 132 -15 588 622 ;
-C 57 ; WX 600 ; N nine ; B 93 -15 574 622 ;
-C 58 ; WX 600 ; N colon ; B 238 -15 441 385 ;
-C 59 ; WX 600 ; N semicolon ; B 157 -112 441 385 ;
-C 60 ; WX 600 ; N less ; B 96 42 610 472 ;
-C 61 ; WX 600 ; N equal ; B 109 138 600 376 ;
-C 62 ; WX 600 ; N greater ; B 85 42 599 472 ;
-C 63 ; WX 600 ; N question ; B 222 -15 583 572 ;
-C 64 ; WX 600 ; N at ; B 127 -15 582 622 ;
-C 65 ; WX 600 ; N A ; B 3 0 607 562 ;
-C 66 ; WX 600 ; N B ; B 43 0 616 562 ;
-C 67 ; WX 600 ; N C ; B 93 -18 655 580 ;
-C 68 ; WX 600 ; N D ; B 43 0 645 562 ;
-C 69 ; WX 600 ; N E ; B 53 0 660 562 ;
-C 70 ; WX 600 ; N F ; B 53 0 660 562 ;
-C 71 ; WX 600 ; N G ; B 83 -18 645 580 ;
-C 72 ; WX 600 ; N H ; B 32 0 687 562 ;
-C 73 ; WX 600 ; N I ; B 96 0 623 562 ;
-C 74 ; WX 600 ; N J ; B 52 -18 685 562 ;
-C 75 ; WX 600 ; N K ; B 38 0 671 562 ;
-C 76 ; WX 600 ; N L ; B 47 0 607 562 ;
-C 77 ; WX 600 ; N M ; B 4 0 715 562 ;
-C 78 ; WX 600 ; N N ; B 7 -13 712 562 ;
-C 79 ; WX 600 ; N O ; B 94 -18 625 580 ;
-C 80 ; WX 600 ; N P ; B 79 0 644 562 ;
-C 81 ; WX 600 ; N Q ; B 95 -138 625 580 ;
-C 82 ; WX 600 ; N R ; B 38 0 598 562 ;
-C 83 ; WX 600 ; N S ; B 76 -20 650 580 ;
-C 84 ; WX 600 ; N T ; B 108 0 665 562 ;
-C 85 ; WX 600 ; N U ; B 125 -18 702 562 ;
-C 86 ; WX 600 ; N V ; B 105 -13 723 562 ;
-C 87 ; WX 600 ; N W ; B 106 -13 722 562 ;
-C 88 ; WX 600 ; N X ; B 23 0 675 562 ;
-C 89 ; WX 600 ; N Y ; B 133 0 695 562 ;
-C 90 ; WX 600 ; N Z ; B 86 0 610 562 ;
-C 91 ; WX 600 ; N bracketleft ; B 246 -108 574 622 ;
-C 92 ; WX 600 ; N backslash ; B 249 -80 468 629 ;
-C 93 ; WX 600 ; N bracketright ; B 135 -108 463 622 ;
-C 94 ; WX 600 ; N asciicircum ; B 175 354 587 622 ;
-C 95 ; WX 600 ; N underscore ; B -27 -125 584 -75 ;
-C 96 ; WX 600 ; N quoteleft ; B 343 328 457 562 ;
-C 97 ; WX 600 ; N a ; B 76 -15 569 441 ;
-C 98 ; WX 600 ; N b ; B 29 -15 625 629 ;
-C 99 ; WX 600 ; N c ; B 106 -15 608 441 ;
-C 100 ; WX 600 ; N d ; B 85 -15 640 629 ;
-C 101 ; WX 600 ; N e ; B 106 -15 598 441 ;
-C 102 ; WX 600 ; N f ; B 114 0 662 629 ; L i fi ; L l fl ;
-C 103 ; WX 600 ; N g ; B 61 -157 657 441 ;
-C 104 ; WX 600 ; N h ; B 33 0 592 629 ;
-C 105 ; WX 600 ; N i ; B 95 0 515 657 ;
-C 106 ; WX 600 ; N j ; B 52 -157 550 657 ;
-C 107 ; WX 600 ; N k ; B 58 0 633 629 ;
-C 108 ; WX 600 ; N l ; B 95 0 515 629 ;
-C 109 ; WX 600 ; N m ; B -5 0 615 441 ;
-C 110 ; WX 600 ; N n ; B 26 0 585 441 ;
-C 111 ; WX 600 ; N o ; B 102 -15 588 441 ;
-C 112 ; WX 600 ; N p ; B -24 -157 605 441 ;
-C 113 ; WX 600 ; N q ; B 85 -157 682 441 ;
-C 114 ; WX 600 ; N r ; B 60 0 636 441 ;
-C 115 ; WX 600 ; N s ; B 78 -15 584 441 ;
-C 116 ; WX 600 ; N t ; B 167 -15 561 561 ;
-C 117 ; WX 600 ; N u ; B 101 -15 572 426 ;
-C 118 ; WX 600 ; N v ; B 90 -10 681 426 ;
-C 119 ; WX 600 ; N w ; B 76 -10 695 426 ;
-C 120 ; WX 600 ; N x ; B 20 0 655 426 ;
-C 121 ; WX 600 ; N y ; B -4 -157 683 426 ;
-C 122 ; WX 600 ; N z ; B 99 0 593 426 ;
-C 123 ; WX 600 ; N braceleft ; B 233 -108 569 622 ;
-C 124 ; WX 600 ; N bar ; B 222 -250 485 750 ;
-C 125 ; WX 600 ; N braceright ; B 140 -108 477 622 ;
-C 126 ; WX 600 ; N asciitilde ; B 116 197 600 320 ;
-C 161 ; WX 600 ; N exclamdown ; B 225 -157 445 430 ;
-C 162 ; WX 600 ; N cent ; B 151 -49 588 614 ;
-C 163 ; WX 600 ; N sterling ; B 124 -21 621 611 ;
-C 164 ; WX 600 ; N fraction ; B 84 -57 646 665 ;
-C 165 ; WX 600 ; N yen ; B 120 0 693 562 ;
-C 166 ; WX 600 ; N florin ; B -26 -143 671 622 ;
-C 167 ; WX 600 ; N section ; B 104 -78 590 580 ;
-C 168 ; WX 600 ; N currency ; B 94 58 628 506 ;
-C 169 ; WX 600 ; N quotesingle ; B 345 328 460 562 ;
-C 170 ; WX 600 ; N quotedblleft ; B 262 328 541 562 ;
-C 171 ; WX 600 ; N guillemotleft ; B 92 70 652 446 ;
-C 172 ; WX 600 ; N guilsinglleft ; B 204 70 540 446 ;
-C 173 ; WX 600 ; N guilsinglright ; B 170 70 506 446 ;
-C 174 ; WX 600 ; N fi ; B 3 0 619 629 ;
-C 175 ; WX 600 ; N fl ; B 3 0 619 629 ;
-C 177 ; WX 600 ; N endash ; B 124 231 586 285 ;
-C 178 ; WX 600 ; N dagger ; B 217 -78 546 580 ;
-C 179 ; WX 600 ; N daggerdbl ; B 163 -78 546 580 ;
-C 180 ; WX 600 ; N periodcentered ; B 275 189 434 327 ;
-C 182 ; WX 600 ; N paragraph ; B 100 -78 630 562 ;
-C 183 ; WX 600 ; N bullet ; B 224 130 485 383 ;
-C 184 ; WX 600 ; N quotesinglbase ; B 185 -134 397 100 ;
-C 185 ; WX 600 ; N quotedblbase ; B 115 -134 478 100 ;
-C 186 ; WX 600 ; N quotedblright ; B 213 328 576 562 ;
-C 187 ; WX 600 ; N guillemotright ; B 58 70 618 446 ;
-C 188 ; WX 600 ; N ellipsis ; B 46 -15 575 111 ;
-C 189 ; WX 600 ; N perthousand ; B 59 -15 627 622 ;
-C 191 ; WX 600 ; N questiondown ; B 105 -157 466 430 ;
-C 193 ; WX 600 ; N grave ; B 294 497 484 672 ;
-C 194 ; WX 600 ; N acute ; B 348 497 612 672 ;
-C 195 ; WX 600 ; N circumflex ; B 229 477 581 654 ;
-C 196 ; WX 600 ; N tilde ; B 212 489 629 606 ;
-C 197 ; WX 600 ; N macron ; B 232 525 600 565 ;
-C 198 ; WX 600 ; N breve ; B 279 501 576 609 ;
-C 199 ; WX 600 ; N dotaccent ; B 373 537 478 640 ;
-C 200 ; WX 600 ; N dieresis ; B 272 537 579 640 ;
-C 202 ; WX 600 ; N ring ; B 332 463 500 627 ;
-C 203 ; WX 600 ; N cedilla ; B 197 -151 344 10 ;
-C 205 ; WX 600 ; N hungarumlaut ; B 239 497 683 672 ;
-C 206 ; WX 600 ; N ogonek ; B 189 -172 377 4 ;
-C 207 ; WX 600 ; N caron ; B 262 492 614 669 ;
-C 208 ; WX 600 ; N emdash ; B 49 231 661 285 ;
-C 225 ; WX 600 ; N AE ; B 3 0 655 562 ;
-C 227 ; WX 600 ; N ordfeminine ; B 209 249 512 580 ;
-C 232 ; WX 600 ; N Lslash ; B 47 0 607 562 ;
-C 233 ; WX 600 ; N Oslash ; B 94 -80 625 629 ;
-C 234 ; WX 600 ; N OE ; B 59 0 672 562 ;
-C 235 ; WX 600 ; N ordmasculine ; B 210 249 535 580 ;
-C 241 ; WX 600 ; N ae ; B 41 -15 626 441 ;
-C 245 ; WX 600 ; N dotlessi ; B 95 0 515 426 ;
-C 248 ; WX 600 ; N lslash ; B 95 0 587 629 ;
-C 249 ; WX 600 ; N oslash ; B 102 -80 588 506 ;
-C 250 ; WX 600 ; N oe ; B 54 -15 615 441 ;
-C 251 ; WX 600 ; N germandbls ; B 48 -15 617 629 ;
-C -1 ; WX 600 ; N Idieresis ; B 96 0 623 753 ;
-C -1 ; WX 600 ; N eacute ; B 106 -15 612 672 ;
-C -1 ; WX 600 ; N abreve ; B 76 -15 576 609 ;
-C -1 ; WX 600 ; N uhungarumlaut ; B 101 -15 723 672 ;
-C -1 ; WX 600 ; N ecaron ; B 106 -15 614 669 ;
-C -1 ; WX 600 ; N Ydieresis ; B 133 0 695 753 ;
-C -1 ; WX 600 ; N divide ; B 136 48 573 467 ;
-C -1 ; WX 600 ; N Yacute ; B 133 0 695 805 ;
-C -1 ; WX 600 ; N Acircumflex ; B 3 0 607 787 ;
-C -1 ; WX 600 ; N aacute ; B 76 -15 612 672 ;
-C -1 ; WX 600 ; N Ucircumflex ; B 125 -18 702 787 ;
-C -1 ; WX 600 ; N yacute ; B -4 -157 683 672 ;
-C -1 ; WX 600 ; N scommaaccent ; B 78 -250 584 441 ;
-C -1 ; WX 600 ; N ecircumflex ; B 106 -15 598 654 ;
-C -1 ; WX 600 ; N Uring ; B 125 -18 702 760 ;
-C -1 ; WX 600 ; N Udieresis ; B 125 -18 702 753 ;
-C -1 ; WX 600 ; N aogonek ; B 76 -172 569 441 ;
-C -1 ; WX 600 ; N Uacute ; B 125 -18 702 805 ;
-C -1 ; WX 600 ; N uogonek ; B 101 -172 572 426 ;
-C -1 ; WX 600 ; N Edieresis ; B 53 0 660 753 ;
-C -1 ; WX 600 ; N Dcroat ; B 43 0 645 562 ;
-C -1 ; WX 600 ; N commaaccent ; B 145 -250 323 -58 ;
-C -1 ; WX 600 ; N copyright ; B 53 -18 667 580 ;
-C -1 ; WX 600 ; N Emacron ; B 53 0 660 698 ;
-C -1 ; WX 600 ; N ccaron ; B 106 -15 614 669 ;
-C -1 ; WX 600 ; N aring ; B 76 -15 569 627 ;
-C -1 ; WX 600 ; N Ncommaaccent ; B 7 -250 712 562 ;
-C -1 ; WX 600 ; N lacute ; B 95 0 640 805 ;
-C -1 ; WX 600 ; N agrave ; B 76 -15 569 672 ;
-C -1 ; WX 600 ; N Tcommaaccent ; B 108 -250 665 562 ;
-C -1 ; WX 600 ; N Cacute ; B 93 -18 655 805 ;
-C -1 ; WX 600 ; N atilde ; B 76 -15 629 606 ;
-C -1 ; WX 600 ; N Edotaccent ; B 53 0 660 753 ;
-C -1 ; WX 600 ; N scaron ; B 78 -15 614 669 ;
-C -1 ; WX 600 ; N scedilla ; B 78 -151 584 441 ;
-C -1 ; WX 600 ; N iacute ; B 95 0 612 672 ;
-C -1 ; WX 600 ; N lozenge ; B 94 0 519 706 ;
-C -1 ; WX 600 ; N Rcaron ; B 38 0 642 802 ;
-C -1 ; WX 600 ; N Gcommaaccent ; B 83 -250 645 580 ;
-C -1 ; WX 600 ; N ucircumflex ; B 101 -15 572 654 ;
-C -1 ; WX 600 ; N acircumflex ; B 76 -15 581 654 ;
-C -1 ; WX 600 ; N Amacron ; B 3 0 607 698 ;
-C -1 ; WX 600 ; N rcaron ; B 60 0 636 669 ;
-C -1 ; WX 600 ; N ccedilla ; B 106 -151 614 441 ;
-C -1 ; WX 600 ; N Zdotaccent ; B 86 0 610 753 ;
-C -1 ; WX 600 ; N Thorn ; B 79 0 606 562 ;
-C -1 ; WX 600 ; N Omacron ; B 94 -18 628 698 ;
-C -1 ; WX 600 ; N Racute ; B 38 0 670 805 ;
-C -1 ; WX 600 ; N Sacute ; B 76 -20 650 805 ;
-C -1 ; WX 600 ; N dcaron ; B 85 -15 849 629 ;
-C -1 ; WX 600 ; N Umacron ; B 125 -18 702 698 ;
-C -1 ; WX 600 ; N uring ; B 101 -15 572 627 ;
-C -1 ; WX 600 ; N threesuperior ; B 213 240 501 622 ;
-C -1 ; WX 600 ; N Ograve ; B 94 -18 625 805 ;
-C -1 ; WX 600 ; N Agrave ; B 3 0 607 805 ;
-C -1 ; WX 600 ; N Abreve ; B 3 0 607 732 ;
-C -1 ; WX 600 ; N multiply ; B 103 43 607 470 ;
-C -1 ; WX 600 ; N uacute ; B 101 -15 602 672 ;
-C -1 ; WX 600 ; N Tcaron ; B 108 0 665 802 ;
-C -1 ; WX 600 ; N partialdiff ; B 45 -38 546 710 ;
-C -1 ; WX 600 ; N ydieresis ; B -4 -157 683 620 ;
-C -1 ; WX 600 ; N Nacute ; B 7 -13 712 805 ;
-C -1 ; WX 600 ; N icircumflex ; B 95 0 551 654 ;
-C -1 ; WX 600 ; N Ecircumflex ; B 53 0 660 787 ;
-C -1 ; WX 600 ; N adieresis ; B 76 -15 575 620 ;
-C -1 ; WX 600 ; N edieresis ; B 106 -15 598 620 ;
-C -1 ; WX 600 ; N cacute ; B 106 -15 612 672 ;
-C -1 ; WX 600 ; N nacute ; B 26 0 602 672 ;
-C -1 ; WX 600 ; N umacron ; B 101 -15 600 565 ;
-C -1 ; WX 600 ; N Ncaron ; B 7 -13 712 802 ;
-C -1 ; WX 600 ; N Iacute ; B 96 0 640 805 ;
-C -1 ; WX 600 ; N plusminus ; B 96 44 594 558 ;
-C -1 ; WX 600 ; N brokenbar ; B 238 -175 469 675 ;
-C -1 ; WX 600 ; N registered ; B 53 -18 667 580 ;
-C -1 ; WX 600 ; N Gbreve ; B 83 -18 645 732 ;
-C -1 ; WX 600 ; N Idotaccent ; B 96 0 623 753 ;
-C -1 ; WX 600 ; N summation ; B 15 -10 670 706 ;
-C -1 ; WX 600 ; N Egrave ; B 53 0 660 805 ;
-C -1 ; WX 600 ; N racute ; B 60 0 636 672 ;
-C -1 ; WX 600 ; N omacron ; B 102 -15 600 565 ;
-C -1 ; WX 600 ; N Zacute ; B 86 0 670 805 ;
-C -1 ; WX 600 ; N Zcaron ; B 86 0 642 802 ;
-C -1 ; WX 600 ; N greaterequal ; B 98 0 594 710 ;
-C -1 ; WX 600 ; N Eth ; B 43 0 645 562 ;
-C -1 ; WX 600 ; N Ccedilla ; B 93 -151 658 580 ;
-C -1 ; WX 600 ; N lcommaaccent ; B 95 -250 515 629 ;
-C -1 ; WX 600 ; N tcaron ; B 167 -15 587 717 ;
-C -1 ; WX 600 ; N eogonek ; B 106 -172 598 441 ;
-C -1 ; WX 600 ; N Uogonek ; B 124 -172 702 562 ;
-C -1 ; WX 600 ; N Aacute ; B 3 0 660 805 ;
-C -1 ; WX 600 ; N Adieresis ; B 3 0 607 753 ;
-C -1 ; WX 600 ; N egrave ; B 106 -15 598 672 ;
-C -1 ; WX 600 ; N zacute ; B 99 0 612 672 ;
-C -1 ; WX 600 ; N iogonek ; B 95 -172 515 657 ;
-C -1 ; WX 600 ; N Oacute ; B 94 -18 640 805 ;
-C -1 ; WX 600 ; N oacute ; B 102 -15 612 672 ;
-C -1 ; WX 600 ; N amacron ; B 76 -15 600 565 ;
-C -1 ; WX 600 ; N sacute ; B 78 -15 612 672 ;
-C -1 ; WX 600 ; N idieresis ; B 95 0 545 620 ;
-C -1 ; WX 600 ; N Ocircumflex ; B 94 -18 625 787 ;
-C -1 ; WX 600 ; N Ugrave ; B 125 -18 702 805 ;
-C -1 ; WX 600 ; N Delta ; B 6 0 598 688 ;
-C -1 ; WX 600 ; N thorn ; B -24 -157 605 629 ;
-C -1 ; WX 600 ; N twosuperior ; B 230 249 535 622 ;
-C -1 ; WX 600 ; N Odieresis ; B 94 -18 625 753 ;
-C -1 ; WX 600 ; N mu ; B 72 -157 572 426 ;
-C -1 ; WX 600 ; N igrave ; B 95 0 515 672 ;
-C -1 ; WX 600 ; N ohungarumlaut ; B 102 -15 723 672 ;
-C -1 ; WX 600 ; N Eogonek ; B 53 -172 660 562 ;
-C -1 ; WX 600 ; N dcroat ; B 85 -15 704 629 ;
-C -1 ; WX 600 ; N threequarters ; B 73 -56 659 666 ;
-C -1 ; WX 600 ; N Scedilla ; B 76 -151 650 580 ;
-C -1 ; WX 600 ; N lcaron ; B 95 0 667 629 ;
-C -1 ; WX 600 ; N Kcommaaccent ; B 38 -250 671 562 ;
-C -1 ; WX 600 ; N Lacute ; B 47 0 607 805 ;
-C -1 ; WX 600 ; N trademark ; B 75 263 742 562 ;
-C -1 ; WX 600 ; N edotaccent ; B 106 -15 598 620 ;
-C -1 ; WX 600 ; N Igrave ; B 96 0 623 805 ;
-C -1 ; WX 600 ; N Imacron ; B 96 0 628 698 ;
-C -1 ; WX 600 ; N Lcaron ; B 47 0 632 562 ;
-C -1 ; WX 600 ; N onehalf ; B 65 -57 669 665 ;
-C -1 ; WX 600 ; N lessequal ; B 98 0 645 710 ;
-C -1 ; WX 600 ; N ocircumflex ; B 102 -15 588 654 ;
-C -1 ; WX 600 ; N ntilde ; B 26 0 629 606 ;
-C -1 ; WX 600 ; N Uhungarumlaut ; B 125 -18 761 805 ;
-C -1 ; WX 600 ; N Eacute ; B 53 0 670 805 ;
-C -1 ; WX 600 ; N emacron ; B 106 -15 600 565 ;
-C -1 ; WX 600 ; N gbreve ; B 61 -157 657 609 ;
-C -1 ; WX 600 ; N onequarter ; B 65 -57 674 665 ;
-C -1 ; WX 600 ; N Scaron ; B 76 -20 672 802 ;
-C -1 ; WX 600 ; N Scommaaccent ; B 76 -250 650 580 ;
-C -1 ; WX 600 ; N Ohungarumlaut ; B 94 -18 751 805 ;
-C -1 ; WX 600 ; N degree ; B 214 269 576 622 ;
-C -1 ; WX 600 ; N ograve ; B 102 -15 588 672 ;
-C -1 ; WX 600 ; N Ccaron ; B 93 -18 672 802 ;
-C -1 ; WX 600 ; N ugrave ; B 101 -15 572 672 ;
-C -1 ; WX 600 ; N radical ; B 85 -15 765 792 ;
-C -1 ; WX 600 ; N Dcaron ; B 43 0 645 802 ;
-C -1 ; WX 600 ; N rcommaaccent ; B 60 -250 636 441 ;
-C -1 ; WX 600 ; N Ntilde ; B 7 -13 712 729 ;
-C -1 ; WX 600 ; N otilde ; B 102 -15 629 606 ;
-C -1 ; WX 600 ; N Rcommaaccent ; B 38 -250 598 562 ;
-C -1 ; WX 600 ; N Lcommaaccent ; B 47 -250 607 562 ;
-C -1 ; WX 600 ; N Atilde ; B 3 0 655 729 ;
-C -1 ; WX 600 ; N Aogonek ; B 3 -172 607 562 ;
-C -1 ; WX 600 ; N Aring ; B 3 0 607 750 ;
-C -1 ; WX 600 ; N Otilde ; B 94 -18 655 729 ;
-C -1 ; WX 600 ; N zdotaccent ; B 99 0 593 620 ;
-C -1 ; WX 600 ; N Ecaron ; B 53 0 660 802 ;
-C -1 ; WX 600 ; N Iogonek ; B 96 -172 623 562 ;
-C -1 ; WX 600 ; N kcommaaccent ; B 58 -250 633 629 ;
-C -1 ; WX 600 ; N minus ; B 129 232 580 283 ;
-C -1 ; WX 600 ; N Icircumflex ; B 96 0 623 787 ;
-C -1 ; WX 600 ; N ncaron ; B 26 0 614 669 ;
-C -1 ; WX 600 ; N tcommaaccent ; B 165 -250 561 561 ;
-C -1 ; WX 600 ; N logicalnot ; B 155 108 591 369 ;
-C -1 ; WX 600 ; N odieresis ; B 102 -15 588 620 ;
-C -1 ; WX 600 ; N udieresis ; B 101 -15 575 620 ;
-C -1 ; WX 600 ; N notequal ; B 43 -16 621 529 ;
-C -1 ; WX 600 ; N gcommaaccent ; B 61 -157 657 708 ;
-C -1 ; WX 600 ; N eth ; B 102 -15 639 629 ;
-C -1 ; WX 600 ; N zcaron ; B 99 0 624 669 ;
-C -1 ; WX 600 ; N ncommaaccent ; B 26 -250 585 441 ;
-C -1 ; WX 600 ; N onesuperior ; B 231 249 491 622 ;
-C -1 ; WX 600 ; N imacron ; B 95 0 543 565 ;
-C -1 ; WX 600 ; N Euro ; B 0 0 0 0 ;
-EndCharMetrics
-EndFontMetrics
-
diff --git a/LibrarySource/com/lowagie/text/pdf/fonts/Courier.afm b/LibrarySource/com/lowagie/text/pdf/fonts/Courier.afm
deleted file mode 100644
index f3fe4c1..0000000
--- a/LibrarySource/com/lowagie/text/pdf/fonts/Courier.afm
+++ /dev/null
@@ -1,343 +0,0 @@
-StartFontMetrics 4.1
-Comment Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
-Comment Creation Date: Thu May 1 17:27:09 1997
-Comment UniqueID 43050
-Comment VMusage 39754 50779
-FontName Courier
-FullName Courier
-FamilyName Courier
-Weight Medium
-ItalicAngle 0
-IsFixedPitch true
-CharacterSet ExtendedRoman
-FontBBox -23 -250 715 805
-UnderlinePosition -100
-UnderlineThickness 50
-Version 003.000
-Notice Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
-EncodingScheme AdobeStandardEncoding
-CapHeight 562
-XHeight 426
-Ascender 629
-Descender -157
-StdHW 51
-StdVW 51
-StartCharMetrics 315
-C 32 ; WX 600 ; N space ; B 0 0 0 0 ;
-C 33 ; WX 600 ; N exclam ; B 236 -15 364 572 ;
-C 34 ; WX 600 ; N quotedbl ; B 187 328 413 562 ;
-C 35 ; WX 600 ; N numbersign ; B 93 -32 507 639 ;
-C 36 ; WX 600 ; N dollar ; B 105 -126 496 662 ;
-C 37 ; WX 600 ; N percent ; B 81 -15 518 622 ;
-C 38 ; WX 600 ; N ampersand ; B 63 -15 538 543 ;
-C 39 ; WX 600 ; N quoteright ; B 213 328 376 562 ;
-C 40 ; WX 600 ; N parenleft ; B 269 -108 440 622 ;
-C 41 ; WX 600 ; N parenright ; B 160 -108 331 622 ;
-C 42 ; WX 600 ; N asterisk ; B 116 257 484 607 ;
-C 43 ; WX 600 ; N plus ; B 80 44 520 470 ;
-C 44 ; WX 600 ; N comma ; B 181 -112 344 122 ;
-C 45 ; WX 600 ; N hyphen ; B 103 231 497 285 ;
-C 46 ; WX 600 ; N period ; B 229 -15 371 109 ;
-C 47 ; WX 600 ; N slash ; B 125 -80 475 629 ;
-C 48 ; WX 600 ; N zero ; B 106 -15 494 622 ;
-C 49 ; WX 600 ; N one ; B 96 0 505 622 ;
-C 50 ; WX 600 ; N two ; B 70 0 471 622 ;
-C 51 ; WX 600 ; N three ; B 75 -15 466 622 ;
-C 52 ; WX 600 ; N four ; B 78 0 500 622 ;
-C 53 ; WX 600 ; N five ; B 92 -15 497 607 ;
-C 54 ; WX 600 ; N six ; B 111 -15 497 622 ;
-C 55 ; WX 600 ; N seven ; B 82 0 483 607 ;
-C 56 ; WX 600 ; N eight ; B 102 -15 498 622 ;
-C 57 ; WX 600 ; N nine ; B 96 -15 489 622 ;
-C 58 ; WX 600 ; N colon ; B 229 -15 371 385 ;
-C 59 ; WX 600 ; N semicolon ; B 181 -112 371 385 ;
-C 60 ; WX 600 ; N less ; B 41 42 519 472 ;
-C 61 ; WX 600 ; N equal ; B 80 138 520 376 ;
-C 62 ; WX 600 ; N greater ; B 66 42 544 472 ;
-C 63 ; WX 600 ; N question ; B 129 -15 492 572 ;
-C 64 ; WX 600 ; N at ; B 77 -15 533 622 ;
-C 65 ; WX 600 ; N A ; B 3 0 597 562 ;
-C 66 ; WX 600 ; N B ; B 43 0 559 562 ;
-C 67 ; WX 600 ; N C ; B 41 -18 540 580 ;
-C 68 ; WX 600 ; N D ; B 43 0 574 562 ;
-C 69 ; WX 600 ; N E ; B 53 0 550 562 ;
-C 70 ; WX 600 ; N F ; B 53 0 545 562 ;
-C 71 ; WX 600 ; N G ; B 31 -18 575 580 ;
-C 72 ; WX 600 ; N H ; B 32 0 568 562 ;
-C 73 ; WX 600 ; N I ; B 96 0 504 562 ;
-C 74 ; WX 600 ; N J ; B 34 -18 566 562 ;
-C 75 ; WX 600 ; N K ; B 38 0 582 562 ;
-C 76 ; WX 600 ; N L ; B 47 0 554 562 ;
-C 77 ; WX 600 ; N M ; B 4 0 596 562 ;
-C 78 ; WX 600 ; N N ; B 7 -13 593 562 ;
-C 79 ; WX 600 ; N O ; B 43 -18 557 580 ;
-C 80 ; WX 600 ; N P ; B 79 0 558 562 ;
-C 81 ; WX 600 ; N Q ; B 43 -138 557 580 ;
-C 82 ; WX 600 ; N R ; B 38 0 588 562 ;
-C 83 ; WX 600 ; N S ; B 72 -20 529 580 ;
-C 84 ; WX 600 ; N T ; B 38 0 563 562 ;
-C 85 ; WX 600 ; N U ; B 17 -18 583 562 ;
-C 86 ; WX 600 ; N V ; B -4 -13 604 562 ;
-C 87 ; WX 600 ; N W ; B -3 -13 603 562 ;
-C 88 ; WX 600 ; N X ; B 23 0 577 562 ;
-C 89 ; WX 600 ; N Y ; B 24 0 576 562 ;
-C 90 ; WX 600 ; N Z ; B 86 0 514 562 ;
-C 91 ; WX 600 ; N bracketleft ; B 269 -108 442 622 ;
-C 92 ; WX 600 ; N backslash ; B 118 -80 482 629 ;
-C 93 ; WX 600 ; N bracketright ; B 158 -108 331 622 ;
-C 94 ; WX 600 ; N asciicircum ; B 94 354 506 622 ;
-C 95 ; WX 600 ; N underscore ; B 0 -125 600 -75 ;
-C 96 ; WX 600 ; N quoteleft ; B 224 328 387 562 ;
-C 97 ; WX 600 ; N a ; B 53 -15 559 441 ;
-C 98 ; WX 600 ; N b ; B 14 -15 575 629 ;
-C 99 ; WX 600 ; N c ; B 66 -15 529 441 ;
-C 100 ; WX 600 ; N d ; B 45 -15 591 629 ;
-C 101 ; WX 600 ; N e ; B 66 -15 548 441 ;
-C 102 ; WX 600 ; N f ; B 114 0 531 629 ; L i fi ; L l fl ;
-C 103 ; WX 600 ; N g ; B 45 -157 566 441 ;
-C 104 ; WX 600 ; N h ; B 18 0 582 629 ;
-C 105 ; WX 600 ; N i ; B 95 0 505 657 ;
-C 106 ; WX 600 ; N j ; B 82 -157 410 657 ;
-C 107 ; WX 600 ; N k ; B 43 0 580 629 ;
-C 108 ; WX 600 ; N l ; B 95 0 505 629 ;
-C 109 ; WX 600 ; N m ; B -5 0 605 441 ;
-C 110 ; WX 600 ; N n ; B 26 0 575 441 ;
-C 111 ; WX 600 ; N o ; B 62 -15 538 441 ;
-C 112 ; WX 600 ; N p ; B 9 -157 555 441 ;
-C 113 ; WX 600 ; N q ; B 45 -157 591 441 ;
-C 114 ; WX 600 ; N r ; B 60 0 559 441 ;
-C 115 ; WX 600 ; N s ; B 80 -15 513 441 ;
-C 116 ; WX 600 ; N t ; B 87 -15 530 561 ;
-C 117 ; WX 600 ; N u ; B 21 -15 562 426 ;
-C 118 ; WX 600 ; N v ; B 10 -10 590 426 ;
-C 119 ; WX 600 ; N w ; B -4 -10 604 426 ;
-C 120 ; WX 600 ; N x ; B 20 0 580 426 ;
-C 121 ; WX 600 ; N y ; B 7 -157 592 426 ;
-C 122 ; WX 600 ; N z ; B 99 0 502 426 ;
-C 123 ; WX 600 ; N braceleft ; B 182 -108 437 622 ;
-C 124 ; WX 600 ; N bar ; B 275 -250 326 750 ;
-C 125 ; WX 600 ; N braceright ; B 163 -108 418 622 ;
-C 126 ; WX 600 ; N asciitilde ; B 63 197 540 320 ;
-C 161 ; WX 600 ; N exclamdown ; B 236 -157 364 430 ;
-C 162 ; WX 600 ; N cent ; B 96 -49 500 614 ;
-C 163 ; WX 600 ; N sterling ; B 84 -21 521 611 ;
-C 164 ; WX 600 ; N fraction ; B 92 -57 509 665 ;
-C 165 ; WX 600 ; N yen ; B 26 0 574 562 ;
-C 166 ; WX 600 ; N florin ; B 4 -143 539 622 ;
-C 167 ; WX 600 ; N section ; B 113 -78 488 580 ;
-C 168 ; WX 600 ; N currency ; B 73 58 527 506 ;
-C 169 ; WX 600 ; N quotesingle ; B 259 328 341 562 ;
-C 170 ; WX 600 ; N quotedblleft ; B 143 328 471 562 ;
-C 171 ; WX 600 ; N guillemotleft ; B 37 70 563 446 ;
-C 172 ; WX 600 ; N guilsinglleft ; B 149 70 451 446 ;
-C 173 ; WX 600 ; N guilsinglright ; B 149 70 451 446 ;
-C 174 ; WX 600 ; N fi ; B 3 0 597 629 ;
-C 175 ; WX 600 ; N fl ; B 3 0 597 629 ;
-C 177 ; WX 600 ; N endash ; B 75 231 525 285 ;
-C 178 ; WX 600 ; N dagger ; B 141 -78 459 580 ;
-C 179 ; WX 600 ; N daggerdbl ; B 141 -78 459 580 ;
-C 180 ; WX 600 ; N periodcentered ; B 222 189 378 327 ;
-C 182 ; WX 600 ; N paragraph ; B 50 -78 511 562 ;
-C 183 ; WX 600 ; N bullet ; B 172 130 428 383 ;
-C 184 ; WX 600 ; N quotesinglbase ; B 213 -134 376 100 ;
-C 185 ; WX 600 ; N quotedblbase ; B 143 -134 457 100 ;
-C 186 ; WX 600 ; N quotedblright ; B 143 328 457 562 ;
-C 187 ; WX 600 ; N guillemotright ; B 37 70 563 446 ;
-C 188 ; WX 600 ; N ellipsis ; B 37 -15 563 111 ;
-C 189 ; WX 600 ; N perthousand ; B 3 -15 600 622 ;
-C 191 ; WX 600 ; N questiondown ; B 108 -157 471 430 ;
-C 193 ; WX 600 ; N grave ; B 151 497 378 672 ;
-C 194 ; WX 600 ; N acute ; B 242 497 469 672 ;
-C 195 ; WX 600 ; N circumflex ; B 124 477 476 654 ;
-C 196 ; WX 600 ; N tilde ; B 105 489 503 606 ;
-C 197 ; WX 600 ; N macron ; B 120 525 480 565 ;
-C 198 ; WX 600 ; N breve ; B 153 501 447 609 ;
-C 199 ; WX 600 ; N dotaccent ; B 249 537 352 640 ;
-C 200 ; WX 600 ; N dieresis ; B 148 537 453 640 ;
-C 202 ; WX 600 ; N ring ; B 218 463 382 627 ;
-C 203 ; WX 600 ; N cedilla ; B 224 -151 362 10 ;
-C 205 ; WX 600 ; N hungarumlaut ; B 133 497 540 672 ;
-C 206 ; WX 600 ; N ogonek ; B 211 -172 407 4 ;
-C 207 ; WX 600 ; N caron ; B 124 492 476 669 ;
-C 208 ; WX 600 ; N emdash ; B 0 231 600 285 ;
-C 225 ; WX 600 ; N AE ; B 3 0 550 562 ;
-C 227 ; WX 600 ; N ordfeminine ; B 156 249 442 580 ;
-C 232 ; WX 600 ; N Lslash ; B 47 0 554 562 ;
-C 233 ; WX 600 ; N Oslash ; B 43 -80 557 629 ;
-C 234 ; WX 600 ; N OE ; B 7 0 567 562 ;
-C 235 ; WX 600 ; N ordmasculine ; B 157 249 443 580 ;
-C 241 ; WX 600 ; N ae ; B 19 -15 570 441 ;
-C 245 ; WX 600 ; N dotlessi ; B 95 0 505 426 ;
-C 248 ; WX 600 ; N lslash ; B 95 0 505 629 ;
-C 249 ; WX 600 ; N oslash ; B 62 -80 538 506 ;
-C 250 ; WX 600 ; N oe ; B 19 -15 559 441 ;
-C 251 ; WX 600 ; N germandbls ; B 48 -15 588 629 ;
-C -1 ; WX 600 ; N Idieresis ; B 96 0 504 753 ;
-C -1 ; WX 600 ; N eacute ; B 66 -15 548 672 ;
-C -1 ; WX 600 ; N abreve ; B 53 -15 559 609 ;
-C -1 ; WX 600 ; N uhungarumlaut ; B 21 -15 580 672 ;
-C -1 ; WX 600 ; N ecaron ; B 66 -15 548 669 ;
-C -1 ; WX 600 ; N Ydieresis ; B 24 0 576 753 ;
-C -1 ; WX 600 ; N divide ; B 87 48 513 467 ;
-C -1 ; WX 600 ; N Yacute ; B 24 0 576 805 ;
-C -1 ; WX 600 ; N Acircumflex ; B 3 0 597 787 ;
-C -1 ; WX 600 ; N aacute ; B 53 -15 559 672 ;
-C -1 ; WX 600 ; N Ucircumflex ; B 17 -18 583 787 ;
-C -1 ; WX 600 ; N yacute ; B 7 -157 592 672 ;
-C -1 ; WX 600 ; N scommaaccent ; B 80 -250 513 441 ;
-C -1 ; WX 600 ; N ecircumflex ; B 66 -15 548 654 ;
-C -1 ; WX 600 ; N Uring ; B 17 -18 583 760 ;
-C -1 ; WX 600 ; N Udieresis ; B 17 -18 583 753 ;
-C -1 ; WX 600 ; N aogonek ; B 53 -172 587 441 ;
-C -1 ; WX 600 ; N Uacute ; B 17 -18 583 805 ;
-C -1 ; WX 600 ; N uogonek ; B 21 -172 590 426 ;
-C -1 ; WX 600 ; N Edieresis ; B 53 0 550 753 ;
-C -1 ; WX 600 ; N Dcroat ; B 30 0 574 562 ;
-C -1 ; WX 600 ; N commaaccent ; B 198 -250 335 -58 ;
-C -1 ; WX 600 ; N copyright ; B 0 -18 600 580 ;
-C -1 ; WX 600 ; N Emacron ; B 53 0 550 698 ;
-C -1 ; WX 600 ; N ccaron ; B 66 -15 529 669 ;
-C -1 ; WX 600 ; N aring ; B 53 -15 559 627 ;
-C -1 ; WX 600 ; N Ncommaaccent ; B 7 -250 593 562 ;
-C -1 ; WX 600 ; N lacute ; B 95 0 505 805 ;
-C -1 ; WX 600 ; N agrave ; B 53 -15 559 672 ;
-C -1 ; WX 600 ; N Tcommaaccent ; B 38 -250 563 562 ;
-C -1 ; WX 600 ; N Cacute ; B 41 -18 540 805 ;
-C -1 ; WX 600 ; N atilde ; B 53 -15 559 606 ;
-C -1 ; WX 600 ; N Edotaccent ; B 53 0 550 753 ;
-C -1 ; WX 600 ; N scaron ; B 80 -15 513 669 ;
-C -1 ; WX 600 ; N scedilla ; B 80 -151 513 441 ;
-C -1 ; WX 600 ; N iacute ; B 95 0 505 672 ;
-C -1 ; WX 600 ; N lozenge ; B 18 0 443 706 ;
-C -1 ; WX 600 ; N Rcaron ; B 38 0 588 802 ;
-C -1 ; WX 600 ; N Gcommaaccent ; B 31 -250 575 580 ;
-C -1 ; WX 600 ; N ucircumflex ; B 21 -15 562 654 ;
-C -1 ; WX 600 ; N acircumflex ; B 53 -15 559 654 ;
-C -1 ; WX 600 ; N Amacron ; B 3 0 597 698 ;
-C -1 ; WX 600 ; N rcaron ; B 60 0 559 669 ;
-C -1 ; WX 600 ; N ccedilla ; B 66 -151 529 441 ;
-C -1 ; WX 600 ; N Zdotaccent ; B 86 0 514 753 ;
-C -1 ; WX 600 ; N Thorn ; B 79 0 538 562 ;
-C -1 ; WX 600 ; N Omacron ; B 43 -18 557 698 ;
-C -1 ; WX 600 ; N Racute ; B 38 0 588 805 ;
-C -1 ; WX 600 ; N Sacute ; B 72 -20 529 805 ;
-C -1 ; WX 600 ; N dcaron ; B 45 -15 715 629 ;
-C -1 ; WX 600 ; N Umacron ; B 17 -18 583 698 ;
-C -1 ; WX 600 ; N uring ; B 21 -15 562 627 ;
-C -1 ; WX 600 ; N threesuperior ; B 155 240 406 622 ;
-C -1 ; WX 600 ; N Ograve ; B 43 -18 557 805 ;
-C -1 ; WX 600 ; N Agrave ; B 3 0 597 805 ;
-C -1 ; WX 600 ; N Abreve ; B 3 0 597 732 ;
-C -1 ; WX 600 ; N multiply ; B 87 43 515 470 ;
-C -1 ; WX 600 ; N uacute ; B 21 -15 562 672 ;
-C -1 ; WX 600 ; N Tcaron ; B 38 0 563 802 ;
-C -1 ; WX 600 ; N partialdiff ; B 17 -38 459 710 ;
-C -1 ; WX 600 ; N ydieresis ; B 7 -157 592 620 ;
-C -1 ; WX 600 ; N Nacute ; B 7 -13 593 805 ;
-C -1 ; WX 600 ; N icircumflex ; B 94 0 505 654 ;
-C -1 ; WX 600 ; N Ecircumflex ; B 53 0 550 787 ;
-C -1 ; WX 600 ; N adieresis ; B 53 -15 559 620 ;
-C -1 ; WX 600 ; N edieresis ; B 66 -15 548 620 ;
-C -1 ; WX 600 ; N cacute ; B 66 -15 529 672 ;
-C -1 ; WX 600 ; N nacute ; B 26 0 575 672 ;
-C -1 ; WX 600 ; N umacron ; B 21 -15 562 565 ;
-C -1 ; WX 600 ; N Ncaron ; B 7 -13 593 802 ;
-C -1 ; WX 600 ; N Iacute ; B 96 0 504 805 ;
-C -1 ; WX 600 ; N plusminus ; B 87 44 513 558 ;
-C -1 ; WX 600 ; N brokenbar ; B 275 -175 326 675 ;
-C -1 ; WX 600 ; N registered ; B 0 -18 600 580 ;
-C -1 ; WX 600 ; N Gbreve ; B 31 -18 575 732 ;
-C -1 ; WX 600 ; N Idotaccent ; B 96 0 504 753 ;
-C -1 ; WX 600 ; N summation ; B 15 -10 585 706 ;
-C -1 ; WX 600 ; N Egrave ; B 53 0 550 805 ;
-C -1 ; WX 600 ; N racute ; B 60 0 559 672 ;
-C -1 ; WX 600 ; N omacron ; B 62 -15 538 565 ;
-C -1 ; WX 600 ; N Zacute ; B 86 0 514 805 ;
-C -1 ; WX 600 ; N Zcaron ; B 86 0 514 802 ;
-C -1 ; WX 600 ; N greaterequal ; B 98 0 502 710 ;
-C -1 ; WX 600 ; N Eth ; B 30 0 574 562 ;
-C -1 ; WX 600 ; N Ccedilla ; B 41 -151 540 580 ;
-C -1 ; WX 600 ; N lcommaaccent ; B 95 -250 505 629 ;
-C -1 ; WX 600 ; N tcaron ; B 87 -15 530 717 ;
-C -1 ; WX 600 ; N eogonek ; B 66 -172 548 441 ;
-C -1 ; WX 600 ; N Uogonek ; B 17 -172 583 562 ;
-C -1 ; WX 600 ; N Aacute ; B 3 0 597 805 ;
-C -1 ; WX 600 ; N Adieresis ; B 3 0 597 753 ;
-C -1 ; WX 600 ; N egrave ; B 66 -15 548 672 ;
-C -1 ; WX 600 ; N zacute ; B 99 0 502 672 ;
-C -1 ; WX 600 ; N iogonek ; B 95 -172 505 657 ;
-C -1 ; WX 600 ; N Oacute ; B 43 -18 557 805 ;
-C -1 ; WX 600 ; N oacute ; B 62 -15 538 672 ;
-C -1 ; WX 600 ; N amacron ; B 53 -15 559 565 ;
-C -1 ; WX 600 ; N sacute ; B 80 -15 513 672 ;
-C -1 ; WX 600 ; N idieresis ; B 95 0 505 620 ;
-C -1 ; WX 600 ; N Ocircumflex ; B 43 -18 557 787 ;
-C -1 ; WX 600 ; N Ugrave ; B 17 -18 583 805 ;
-C -1 ; WX 600 ; N Delta ; B 6 0 598 688 ;
-C -1 ; WX 600 ; N thorn ; B -6 -157 555 629 ;
-C -1 ; WX 600 ; N twosuperior ; B 177 249 424 622 ;
-C -1 ; WX 600 ; N Odieresis ; B 43 -18 557 753 ;
-C -1 ; WX 600 ; N mu ; B 21 -157 562 426 ;
-C -1 ; WX 600 ; N igrave ; B 95 0 505 672 ;
-C -1 ; WX 600 ; N ohungarumlaut ; B 62 -15 580 672 ;
-C -1 ; WX 600 ; N Eogonek ; B 53 -172 561 562 ;
-C -1 ; WX 600 ; N dcroat ; B 45 -15 591 629 ;
-C -1 ; WX 600 ; N threequarters ; B 8 -56 593 666 ;
-C -1 ; WX 600 ; N Scedilla ; B 72 -151 529 580 ;
-C -1 ; WX 600 ; N lcaron ; B 95 0 533 629 ;
-C -1 ; WX 600 ; N Kcommaaccent ; B 38 -250 582 562 ;
-C -1 ; WX 600 ; N Lacute ; B 47 0 554 805 ;
-C -1 ; WX 600 ; N trademark ; B -23 263 623 562 ;
-C -1 ; WX 600 ; N edotaccent ; B 66 -15 548 620 ;
-C -1 ; WX 600 ; N Igrave ; B 96 0 504 805 ;
-C -1 ; WX 600 ; N Imacron ; B 96 0 504 698 ;
-C -1 ; WX 600 ; N Lcaron ; B 47 0 554 562 ;
-C -1 ; WX 600 ; N onehalf ; B 0 -57 611 665 ;
-C -1 ; WX 600 ; N lessequal ; B 98 0 502 710 ;
-C -1 ; WX 600 ; N ocircumflex ; B 62 -15 538 654 ;
-C -1 ; WX 600 ; N ntilde ; B 26 0 575 606 ;
-C -1 ; WX 600 ; N Uhungarumlaut ; B 17 -18 590 805 ;
-C -1 ; WX 600 ; N Eacute ; B 53 0 550 805 ;
-C -1 ; WX 600 ; N emacron ; B 66 -15 548 565 ;
-C -1 ; WX 600 ; N gbreve ; B 45 -157 566 609 ;
-C -1 ; WX 600 ; N onequarter ; B 0 -57 600 665 ;
-C -1 ; WX 600 ; N Scaron ; B 72 -20 529 802 ;
-C -1 ; WX 600 ; N Scommaaccent ; B 72 -250 529 580 ;
-C -1 ; WX 600 ; N Ohungarumlaut ; B 43 -18 580 805 ;
-C -1 ; WX 600 ; N degree ; B 123 269 477 622 ;
-C -1 ; WX 600 ; N ograve ; B 62 -15 538 672 ;
-C -1 ; WX 600 ; N Ccaron ; B 41 -18 540 802 ;
-C -1 ; WX 600 ; N ugrave ; B 21 -15 562 672 ;
-C -1 ; WX 600 ; N radical ; B 3 -15 597 792 ;
-C -1 ; WX 600 ; N Dcaron ; B 43 0 574 802 ;
-C -1 ; WX 600 ; N rcommaaccent ; B 60 -250 559 441 ;
-C -1 ; WX 600 ; N Ntilde ; B 7 -13 593 729 ;
-C -1 ; WX 600 ; N otilde ; B 62 -15 538 606 ;
-C -1 ; WX 600 ; N Rcommaaccent ; B 38 -250 588 562 ;
-C -1 ; WX 600 ; N Lcommaaccent ; B 47 -250 554 562 ;
-C -1 ; WX 600 ; N Atilde ; B 3 0 597 729 ;
-C -1 ; WX 600 ; N Aogonek ; B 3 -172 608 562 ;
-C -1 ; WX 600 ; N Aring ; B 3 0 597 750 ;
-C -1 ; WX 600 ; N Otilde ; B 43 -18 557 729 ;
-C -1 ; WX 600 ; N zdotaccent ; B 99 0 502 620 ;
-C -1 ; WX 600 ; N Ecaron ; B 53 0 550 802 ;
-C -1 ; WX 600 ; N Iogonek ; B 96 -172 504 562 ;
-C -1 ; WX 600 ; N kcommaaccent ; B 43 -250 580 629 ;
-C -1 ; WX 600 ; N minus ; B 80 232 520 283 ;
-C -1 ; WX 600 ; N Icircumflex ; B 96 0 504 787 ;
-C -1 ; WX 600 ; N ncaron ; B 26 0 575 669 ;
-C -1 ; WX 600 ; N tcommaaccent ; B 87 -250 530 561 ;
-C -1 ; WX 600 ; N logicalnot ; B 87 108 513 369 ;
-C -1 ; WX 600 ; N odieresis ; B 62 -15 538 620 ;
-C -1 ; WX 600 ; N udieresis ; B 21 -15 562 620 ;
-C -1 ; WX 600 ; N notequal ; B 15 -16 540 529 ;
-C -1 ; WX 600 ; N gcommaaccent ; B 45 -157 566 708 ;
-C -1 ; WX 600 ; N eth ; B 62 -15 538 629 ;
-C -1 ; WX 600 ; N zcaron ; B 99 0 502 669 ;
-C -1 ; WX 600 ; N ncommaaccent ; B 26 -250 575 441 ;
-C -1 ; WX 600 ; N onesuperior ; B 172 249 428 622 ;
-C -1 ; WX 600 ; N imacron ; B 95 0 505 565 ;
-C -1 ; WX 600 ; N Euro ; B 0 0 0 0 ;
-EndCharMetrics
-EndFontMetrics
-
diff --git a/LibrarySource/com/lowagie/text/pdf/fonts/FontsResourceAnchor.java b/LibrarySource/com/lowagie/text/pdf/fonts/FontsResourceAnchor.java
deleted file mode 100644
index 37de4bc..0000000
--- a/LibrarySource/com/lowagie/text/pdf/fonts/FontsResourceAnchor.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2004 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-package com.lowagie.text.pdf.fonts;
-
-/**
- * A class to facilitate the loading of resources
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class FontsResourceAnchor {
-
- /**
- * Creates a FontsResourceAnchor
- */
- public FontsResourceAnchor() {
- }
-
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/fonts/Helvetica-Bold.afm b/LibrarySource/com/lowagie/text/pdf/fonts/Helvetica-Bold.afm
deleted file mode 100644
index 3991be4..0000000
--- a/LibrarySource/com/lowagie/text/pdf/fonts/Helvetica-Bold.afm
+++ /dev/null
@@ -1,2828 +0,0 @@
-StartFontMetrics 4.1
-Comment Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved.
-Comment Creation Date: Thu May 1 12:43:52 1997
-Comment UniqueID 43052
-Comment VMusage 37169 48194
-FontName Helvetica-Bold
-FullName Helvetica Bold
-FamilyName Helvetica
-Weight Bold
-ItalicAngle 0
-IsFixedPitch false
-CharacterSet ExtendedRoman
-FontBBox -170 -228 1003 962
-UnderlinePosition -100
-UnderlineThickness 50
-Version 002.000
-Notice Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved.Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries.
-EncodingScheme AdobeStandardEncoding
-CapHeight 718
-XHeight 532
-Ascender 718
-Descender -207
-StdHW 118
-StdVW 140
-StartCharMetrics 315
-C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
-C 33 ; WX 333 ; N exclam ; B 90 0 244 718 ;
-C 34 ; WX 474 ; N quotedbl ; B 98 447 376 718 ;
-C 35 ; WX 556 ; N numbersign ; B 18 0 538 698 ;
-C 36 ; WX 556 ; N dollar ; B 30 -115 523 775 ;
-C 37 ; WX 889 ; N percent ; B 28 -19 861 710 ;
-C 38 ; WX 722 ; N ampersand ; B 54 -19 701 718 ;
-C 39 ; WX 278 ; N quoteright ; B 69 445 209 718 ;
-C 40 ; WX 333 ; N parenleft ; B 35 -208 314 734 ;
-C 41 ; WX 333 ; N parenright ; B 19 -208 298 734 ;
-C 42 ; WX 389 ; N asterisk ; B 27 387 362 718 ;
-C 43 ; WX 584 ; N plus ; B 40 0 544 506 ;
-C 44 ; WX 278 ; N comma ; B 64 -168 214 146 ;
-C 45 ; WX 333 ; N hyphen ; B 27 215 306 345 ;
-C 46 ; WX 278 ; N period ; B 64 0 214 146 ;
-C 47 ; WX 278 ; N slash ; B -33 -19 311 737 ;
-C 48 ; WX 556 ; N zero ; B 32 -19 524 710 ;
-C 49 ; WX 556 ; N one ; B 69 0 378 710 ;
-C 50 ; WX 556 ; N two ; B 26 0 511 710 ;
-C 51 ; WX 556 ; N three ; B 27 -19 516 710 ;
-C 52 ; WX 556 ; N four ; B 27 0 526 710 ;
-C 53 ; WX 556 ; N five ; B 27 -19 516 698 ;
-C 54 ; WX 556 ; N six ; B 31 -19 520 710 ;
-C 55 ; WX 556 ; N seven ; B 25 0 528 698 ;
-C 56 ; WX 556 ; N eight ; B 32 -19 524 710 ;
-C 57 ; WX 556 ; N nine ; B 30 -19 522 710 ;
-C 58 ; WX 333 ; N colon ; B 92 0 242 512 ;
-C 59 ; WX 333 ; N semicolon ; B 92 -168 242 512 ;
-C 60 ; WX 584 ; N less ; B 38 -8 546 514 ;
-C 61 ; WX 584 ; N equal ; B 40 87 544 419 ;
-C 62 ; WX 584 ; N greater ; B 38 -8 546 514 ;
-C 63 ; WX 611 ; N question ; B 60 0 556 727 ;
-C 64 ; WX 975 ; N at ; B 118 -19 856 737 ;
-C 65 ; WX 722 ; N A ; B 20 0 702 718 ;
-C 66 ; WX 722 ; N B ; B 76 0 669 718 ;
-C 67 ; WX 722 ; N C ; B 44 -19 684 737 ;
-C 68 ; WX 722 ; N D ; B 76 0 685 718 ;
-C 69 ; WX 667 ; N E ; B 76 0 621 718 ;
-C 70 ; WX 611 ; N F ; B 76 0 587 718 ;
-C 71 ; WX 778 ; N G ; B 44 -19 713 737 ;
-C 72 ; WX 722 ; N H ; B 71 0 651 718 ;
-C 73 ; WX 278 ; N I ; B 64 0 214 718 ;
-C 74 ; WX 556 ; N J ; B 22 -18 484 718 ;
-C 75 ; WX 722 ; N K ; B 87 0 722 718 ;
-C 76 ; WX 611 ; N L ; B 76 0 583 718 ;
-C 77 ; WX 833 ; N M ; B 69 0 765 718 ;
-C 78 ; WX 722 ; N N ; B 69 0 654 718 ;
-C 79 ; WX 778 ; N O ; B 44 -19 734 737 ;
-C 80 ; WX 667 ; N P ; B 76 0 627 718 ;
-C 81 ; WX 778 ; N Q ; B 44 -52 737 737 ;
-C 82 ; WX 722 ; N R ; B 76 0 677 718 ;
-C 83 ; WX 667 ; N S ; B 39 -19 629 737 ;
-C 84 ; WX 611 ; N T ; B 14 0 598 718 ;
-C 85 ; WX 722 ; N U ; B 72 -19 651 718 ;
-C 86 ; WX 667 ; N V ; B 19 0 648 718 ;
-C 87 ; WX 944 ; N W ; B 16 0 929 718 ;
-C 88 ; WX 667 ; N X ; B 14 0 653 718 ;
-C 89 ; WX 667 ; N Y ; B 15 0 653 718 ;
-C 90 ; WX 611 ; N Z ; B 25 0 586 718 ;
-C 91 ; WX 333 ; N bracketleft ; B 63 -196 309 722 ;
-C 92 ; WX 278 ; N backslash ; B -33 -19 311 737 ;
-C 93 ; WX 333 ; N bracketright ; B 24 -196 270 722 ;
-C 94 ; WX 584 ; N asciicircum ; B 62 323 522 698 ;
-C 95 ; WX 556 ; N underscore ; B 0 -125 556 -75 ;
-C 96 ; WX 278 ; N quoteleft ; B 69 454 209 727 ;
-C 97 ; WX 556 ; N a ; B 29 -14 527 546 ;
-C 98 ; WX 611 ; N b ; B 61 -14 578 718 ;
-C 99 ; WX 556 ; N c ; B 34 -14 524 546 ;
-C 100 ; WX 611 ; N d ; B 34 -14 551 718 ;
-C 101 ; WX 556 ; N e ; B 23 -14 528 546 ;
-C 102 ; WX 333 ; N f ; B 10 0 318 727 ; L i fi ; L l fl ;
-C 103 ; WX 611 ; N g ; B 40 -217 553 546 ;
-C 104 ; WX 611 ; N h ; B 65 0 546 718 ;
-C 105 ; WX 278 ; N i ; B 69 0 209 725 ;
-C 106 ; WX 278 ; N j ; B 3 -214 209 725 ;
-C 107 ; WX 556 ; N k ; B 69 0 562 718 ;
-C 108 ; WX 278 ; N l ; B 69 0 209 718 ;
-C 109 ; WX 889 ; N m ; B 64 0 826 546 ;
-C 110 ; WX 611 ; N n ; B 65 0 546 546 ;
-C 111 ; WX 611 ; N o ; B 34 -14 578 546 ;
-C 112 ; WX 611 ; N p ; B 62 -207 578 546 ;
-C 113 ; WX 611 ; N q ; B 34 -207 552 546 ;
-C 114 ; WX 389 ; N r ; B 64 0 373 546 ;
-C 115 ; WX 556 ; N s ; B 30 -14 519 546 ;
-C 116 ; WX 333 ; N t ; B 10 -6 309 676 ;
-C 117 ; WX 611 ; N u ; B 66 -14 545 532 ;
-C 118 ; WX 556 ; N v ; B 13 0 543 532 ;
-C 119 ; WX 778 ; N w ; B 10 0 769 532 ;
-C 120 ; WX 556 ; N x ; B 15 0 541 532 ;
-C 121 ; WX 556 ; N y ; B 10 -214 539 532 ;
-C 122 ; WX 500 ; N z ; B 20 0 480 532 ;
-C 123 ; WX 389 ; N braceleft ; B 48 -196 365 722 ;
-C 124 ; WX 280 ; N bar ; B 84 -225 196 775 ;
-C 125 ; WX 389 ; N braceright ; B 24 -196 341 722 ;
-C 126 ; WX 584 ; N asciitilde ; B 61 163 523 343 ;
-C 161 ; WX 333 ; N exclamdown ; B 90 -186 244 532 ;
-C 162 ; WX 556 ; N cent ; B 34 -118 524 628 ;
-C 163 ; WX 556 ; N sterling ; B 28 -16 541 718 ;
-C 164 ; WX 167 ; N fraction ; B -170 -19 336 710 ;
-C 165 ; WX 556 ; N yen ; B -9 0 565 698 ;
-C 166 ; WX 556 ; N florin ; B -10 -210 516 737 ;
-C 167 ; WX 556 ; N section ; B 34 -184 522 727 ;
-C 168 ; WX 556 ; N currency ; B -3 76 559 636 ;
-C 169 ; WX 238 ; N quotesingle ; B 70 447 168 718 ;
-C 170 ; WX 500 ; N quotedblleft ; B 64 454 436 727 ;
-C 171 ; WX 556 ; N guillemotleft ; B 88 76 468 484 ;
-C 172 ; WX 333 ; N guilsinglleft ; B 83 76 250 484 ;
-C 173 ; WX 333 ; N guilsinglright ; B 83 76 250 484 ;
-C 174 ; WX 611 ; N fi ; B 10 0 542 727 ;
-C 175 ; WX 611 ; N fl ; B 10 0 542 727 ;
-C 177 ; WX 556 ; N endash ; B 0 227 556 333 ;
-C 178 ; WX 556 ; N dagger ; B 36 -171 520 718 ;
-C 179 ; WX 556 ; N daggerdbl ; B 36 -171 520 718 ;
-C 180 ; WX 278 ; N periodcentered ; B 58 172 220 334 ;
-C 182 ; WX 556 ; N paragraph ; B -8 -191 539 700 ;
-C 183 ; WX 350 ; N bullet ; B 10 194 340 524 ;
-C 184 ; WX 278 ; N quotesinglbase ; B 69 -146 209 127 ;
-C 185 ; WX 500 ; N quotedblbase ; B 64 -146 436 127 ;
-C 186 ; WX 500 ; N quotedblright ; B 64 445 436 718 ;
-C 187 ; WX 556 ; N guillemotright ; B 88 76 468 484 ;
-C 188 ; WX 1000 ; N ellipsis ; B 92 0 908 146 ;
-C 189 ; WX 1000 ; N perthousand ; B -3 -19 1003 710 ;
-C 191 ; WX 611 ; N questiondown ; B 55 -195 551 532 ;
-C 193 ; WX 333 ; N grave ; B -23 604 225 750 ;
-C 194 ; WX 333 ; N acute ; B 108 604 356 750 ;
-C 195 ; WX 333 ; N circumflex ; B -10 604 343 750 ;
-C 196 ; WX 333 ; N tilde ; B -17 610 350 737 ;
-C 197 ; WX 333 ; N macron ; B -6 604 339 678 ;
-C 198 ; WX 333 ; N breve ; B -2 604 335 750 ;
-C 199 ; WX 333 ; N dotaccent ; B 104 614 230 729 ;
-C 200 ; WX 333 ; N dieresis ; B 6 614 327 729 ;
-C 202 ; WX 333 ; N ring ; B 59 568 275 776 ;
-C 203 ; WX 333 ; N cedilla ; B 6 -228 245 0 ;
-C 205 ; WX 333 ; N hungarumlaut ; B 9 604 486 750 ;
-C 206 ; WX 333 ; N ogonek ; B 71 -228 304 0 ;
-C 207 ; WX 333 ; N caron ; B -10 604 343 750 ;
-C 208 ; WX 1000 ; N emdash ; B 0 227 1000 333 ;
-C 225 ; WX 1000 ; N AE ; B 5 0 954 718 ;
-C 227 ; WX 370 ; N ordfeminine ; B 22 401 347 737 ;
-C 232 ; WX 611 ; N Lslash ; B -20 0 583 718 ;
-C 233 ; WX 778 ; N Oslash ; B 33 -27 744 745 ;
-C 234 ; WX 1000 ; N OE ; B 37 -19 961 737 ;
-C 235 ; WX 365 ; N ordmasculine ; B 6 401 360 737 ;
-C 241 ; WX 889 ; N ae ; B 29 -14 858 546 ;
-C 245 ; WX 278 ; N dotlessi ; B 69 0 209 532 ;
-C 248 ; WX 278 ; N lslash ; B -18 0 296 718 ;
-C 249 ; WX 611 ; N oslash ; B 22 -29 589 560 ;
-C 250 ; WX 944 ; N oe ; B 34 -14 912 546 ;
-C 251 ; WX 611 ; N germandbls ; B 69 -14 579 731 ;
-C -1 ; WX 278 ; N Idieresis ; B -21 0 300 915 ;
-C -1 ; WX 556 ; N eacute ; B 23 -14 528 750 ;
-C -1 ; WX 556 ; N abreve ; B 29 -14 527 750 ;
-C -1 ; WX 611 ; N uhungarumlaut ; B 66 -14 625 750 ;
-C -1 ; WX 556 ; N ecaron ; B 23 -14 528 750 ;
-C -1 ; WX 667 ; N Ydieresis ; B 15 0 653 915 ;
-C -1 ; WX 584 ; N divide ; B 40 -42 544 548 ;
-C -1 ; WX 667 ; N Yacute ; B 15 0 653 936 ;
-C -1 ; WX 722 ; N Acircumflex ; B 20 0 702 936 ;
-C -1 ; WX 556 ; N aacute ; B 29 -14 527 750 ;
-C -1 ; WX 722 ; N Ucircumflex ; B 72 -19 651 936 ;
-C -1 ; WX 556 ; N yacute ; B 10 -214 539 750 ;
-C -1 ; WX 556 ; N scommaaccent ; B 30 -228 519 546 ;
-C -1 ; WX 556 ; N ecircumflex ; B 23 -14 528 750 ;
-C -1 ; WX 722 ; N Uring ; B 72 -19 651 962 ;
-C -1 ; WX 722 ; N Udieresis ; B 72 -19 651 915 ;
-C -1 ; WX 556 ; N aogonek ; B 29 -224 545 546 ;
-C -1 ; WX 722 ; N Uacute ; B 72 -19 651 936 ;
-C -1 ; WX 611 ; N uogonek ; B 66 -228 545 532 ;
-C -1 ; WX 667 ; N Edieresis ; B 76 0 621 915 ;
-C -1 ; WX 722 ; N Dcroat ; B -5 0 685 718 ;
-C -1 ; WX 250 ; N commaaccent ; B 64 -228 199 -50 ;
-C -1 ; WX 737 ; N copyright ; B -11 -19 749 737 ;
-C -1 ; WX 667 ; N Emacron ; B 76 0 621 864 ;
-C -1 ; WX 556 ; N ccaron ; B 34 -14 524 750 ;
-C -1 ; WX 556 ; N aring ; B 29 -14 527 776 ;
-C -1 ; WX 722 ; N Ncommaaccent ; B 69 -228 654 718 ;
-C -1 ; WX 278 ; N lacute ; B 69 0 329 936 ;
-C -1 ; WX 556 ; N agrave ; B 29 -14 527 750 ;
-C -1 ; WX 611 ; N Tcommaaccent ; B 14 -228 598 718 ;
-C -1 ; WX 722 ; N Cacute ; B 44 -19 684 936 ;
-C -1 ; WX 556 ; N atilde ; B 29 -14 527 737 ;
-C -1 ; WX 667 ; N Edotaccent ; B 76 0 621 915 ;
-C -1 ; WX 556 ; N scaron ; B 30 -14 519 750 ;
-C -1 ; WX 556 ; N scedilla ; B 30 -228 519 546 ;
-C -1 ; WX 278 ; N iacute ; B 69 0 329 750 ;
-C -1 ; WX 494 ; N lozenge ; B 10 0 484 745 ;
-C -1 ; WX 722 ; N Rcaron ; B 76 0 677 936 ;
-C -1 ; WX 778 ; N Gcommaaccent ; B 44 -228 713 737 ;
-C -1 ; WX 611 ; N ucircumflex ; B 66 -14 545 750 ;
-C -1 ; WX 556 ; N acircumflex ; B 29 -14 527 750 ;
-C -1 ; WX 722 ; N Amacron ; B 20 0 702 864 ;
-C -1 ; WX 389 ; N rcaron ; B 18 0 373 750 ;
-C -1 ; WX 556 ; N ccedilla ; B 34 -228 524 546 ;
-C -1 ; WX 611 ; N Zdotaccent ; B 25 0 586 915 ;
-C -1 ; WX 667 ; N Thorn ; B 76 0 627 718 ;
-C -1 ; WX 778 ; N Omacron ; B 44 -19 734 864 ;
-C -1 ; WX 722 ; N Racute ; B 76 0 677 936 ;
-C -1 ; WX 667 ; N Sacute ; B 39 -19 629 936 ;
-C -1 ; WX 743 ; N dcaron ; B 34 -14 750 718 ;
-C -1 ; WX 722 ; N Umacron ; B 72 -19 651 864 ;
-C -1 ; WX 611 ; N uring ; B 66 -14 545 776 ;
-C -1 ; WX 333 ; N threesuperior ; B 8 271 326 710 ;
-C -1 ; WX 778 ; N Ograve ; B 44 -19 734 936 ;
-C -1 ; WX 722 ; N Agrave ; B 20 0 702 936 ;
-C -1 ; WX 722 ; N Abreve ; B 20 0 702 936 ;
-C -1 ; WX 584 ; N multiply ; B 40 1 545 505 ;
-C -1 ; WX 611 ; N uacute ; B 66 -14 545 750 ;
-C -1 ; WX 611 ; N Tcaron ; B 14 0 598 936 ;
-C -1 ; WX 494 ; N partialdiff ; B 11 -21 494 750 ;
-C -1 ; WX 556 ; N ydieresis ; B 10 -214 539 729 ;
-C -1 ; WX 722 ; N Nacute ; B 69 0 654 936 ;
-C -1 ; WX 278 ; N icircumflex ; B -37 0 316 750 ;
-C -1 ; WX 667 ; N Ecircumflex ; B 76 0 621 936 ;
-C -1 ; WX 556 ; N adieresis ; B 29 -14 527 729 ;
-C -1 ; WX 556 ; N edieresis ; B 23 -14 528 729 ;
-C -1 ; WX 556 ; N cacute ; B 34 -14 524 750 ;
-C -1 ; WX 611 ; N nacute ; B 65 0 546 750 ;
-C -1 ; WX 611 ; N umacron ; B 66 -14 545 678 ;
-C -1 ; WX 722 ; N Ncaron ; B 69 0 654 936 ;
-C -1 ; WX 278 ; N Iacute ; B 64 0 329 936 ;
-C -1 ; WX 584 ; N plusminus ; B 40 0 544 506 ;
-C -1 ; WX 280 ; N brokenbar ; B 84 -150 196 700 ;
-C -1 ; WX 737 ; N registered ; B -11 -19 748 737 ;
-C -1 ; WX 778 ; N Gbreve ; B 44 -19 713 936 ;
-C -1 ; WX 278 ; N Idotaccent ; B 64 0 214 915 ;
-C -1 ; WX 600 ; N summation ; B 14 -10 585 706 ;
-C -1 ; WX 667 ; N Egrave ; B 76 0 621 936 ;
-C -1 ; WX 389 ; N racute ; B 64 0 384 750 ;
-C -1 ; WX 611 ; N omacron ; B 34 -14 578 678 ;
-C -1 ; WX 611 ; N Zacute ; B 25 0 586 936 ;
-C -1 ; WX 611 ; N Zcaron ; B 25 0 586 936 ;
-C -1 ; WX 549 ; N greaterequal ; B 26 0 523 704 ;
-C -1 ; WX 722 ; N Eth ; B -5 0 685 718 ;
-C -1 ; WX 722 ; N Ccedilla ; B 44 -228 684 737 ;
-C -1 ; WX 278 ; N lcommaaccent ; B 69 -228 213 718 ;
-C -1 ; WX 389 ; N tcaron ; B 10 -6 421 878 ;
-C -1 ; WX 556 ; N eogonek ; B 23 -228 528 546 ;
-C -1 ; WX 722 ; N Uogonek ; B 72 -228 651 718 ;
-C -1 ; WX 722 ; N Aacute ; B 20 0 702 936 ;
-C -1 ; WX 722 ; N Adieresis ; B 20 0 702 915 ;
-C -1 ; WX 556 ; N egrave ; B 23 -14 528 750 ;
-C -1 ; WX 500 ; N zacute ; B 20 0 480 750 ;
-C -1 ; WX 278 ; N iogonek ; B 16 -224 249 725 ;
-C -1 ; WX 778 ; N Oacute ; B 44 -19 734 936 ;
-C -1 ; WX 611 ; N oacute ; B 34 -14 578 750 ;
-C -1 ; WX 556 ; N amacron ; B 29 -14 527 678 ;
-C -1 ; WX 556 ; N sacute ; B 30 -14 519 750 ;
-C -1 ; WX 278 ; N idieresis ; B -21 0 300 729 ;
-C -1 ; WX 778 ; N Ocircumflex ; B 44 -19 734 936 ;
-C -1 ; WX 722 ; N Ugrave ; B 72 -19 651 936 ;
-C -1 ; WX 612 ; N Delta ; B 6 0 608 688 ;
-C -1 ; WX 611 ; N thorn ; B 62 -208 578 718 ;
-C -1 ; WX 333 ; N twosuperior ; B 9 283 324 710 ;
-C -1 ; WX 778 ; N Odieresis ; B 44 -19 734 915 ;
-C -1 ; WX 611 ; N mu ; B 66 -207 545 532 ;
-C -1 ; WX 278 ; N igrave ; B -50 0 209 750 ;
-C -1 ; WX 611 ; N ohungarumlaut ; B 34 -14 625 750 ;
-C -1 ; WX 667 ; N Eogonek ; B 76 -224 639 718 ;
-C -1 ; WX 611 ; N dcroat ; B 34 -14 650 718 ;
-C -1 ; WX 834 ; N threequarters ; B 16 -19 799 710 ;
-C -1 ; WX 667 ; N Scedilla ; B 39 -228 629 737 ;
-C -1 ; WX 400 ; N lcaron ; B 69 0 408 718 ;
-C -1 ; WX 722 ; N Kcommaaccent ; B 87 -228 722 718 ;
-C -1 ; WX 611 ; N Lacute ; B 76 0 583 936 ;
-C -1 ; WX 1000 ; N trademark ; B 44 306 956 718 ;
-C -1 ; WX 556 ; N edotaccent ; B 23 -14 528 729 ;
-C -1 ; WX 278 ; N Igrave ; B -50 0 214 936 ;
-C -1 ; WX 278 ; N Imacron ; B -33 0 312 864 ;
-C -1 ; WX 611 ; N Lcaron ; B 76 0 583 718 ;
-C -1 ; WX 834 ; N onehalf ; B 26 -19 794 710 ;
-C -1 ; WX 549 ; N lessequal ; B 29 0 526 704 ;
-C -1 ; WX 611 ; N ocircumflex ; B 34 -14 578 750 ;
-C -1 ; WX 611 ; N ntilde ; B 65 0 546 737 ;
-C -1 ; WX 722 ; N Uhungarumlaut ; B 72 -19 681 936 ;
-C -1 ; WX 667 ; N Eacute ; B 76 0 621 936 ;
-C -1 ; WX 556 ; N emacron ; B 23 -14 528 678 ;
-C -1 ; WX 611 ; N gbreve ; B 40 -217 553 750 ;
-C -1 ; WX 834 ; N onequarter ; B 26 -19 766 710 ;
-C -1 ; WX 667 ; N Scaron ; B 39 -19 629 936 ;
-C -1 ; WX 667 ; N Scommaaccent ; B 39 -228 629 737 ;
-C -1 ; WX 778 ; N Ohungarumlaut ; B 44 -19 734 936 ;
-C -1 ; WX 400 ; N degree ; B 57 426 343 712 ;
-C -1 ; WX 611 ; N ograve ; B 34 -14 578 750 ;
-C -1 ; WX 722 ; N Ccaron ; B 44 -19 684 936 ;
-C -1 ; WX 611 ; N ugrave ; B 66 -14 545 750 ;
-C -1 ; WX 549 ; N radical ; B 10 -46 512 850 ;
-C -1 ; WX 722 ; N Dcaron ; B 76 0 685 936 ;
-C -1 ; WX 389 ; N rcommaaccent ; B 64 -228 373 546 ;
-C -1 ; WX 722 ; N Ntilde ; B 69 0 654 923 ;
-C -1 ; WX 611 ; N otilde ; B 34 -14 578 737 ;
-C -1 ; WX 722 ; N Rcommaaccent ; B 76 -228 677 718 ;
-C -1 ; WX 611 ; N Lcommaaccent ; B 76 -228 583 718 ;
-C -1 ; WX 722 ; N Atilde ; B 20 0 702 923 ;
-C -1 ; WX 722 ; N Aogonek ; B 20 -224 742 718 ;
-C -1 ; WX 722 ; N Aring ; B 20 0 702 962 ;
-C -1 ; WX 778 ; N Otilde ; B 44 -19 734 923 ;
-C -1 ; WX 500 ; N zdotaccent ; B 20 0 480 729 ;
-C -1 ; WX 667 ; N Ecaron ; B 76 0 621 936 ;
-C -1 ; WX 278 ; N Iogonek ; B -11 -228 222 718 ;
-C -1 ; WX 556 ; N kcommaaccent ; B 69 -228 562 718 ;
-C -1 ; WX 584 ; N minus ; B 40 197 544 309 ;
-C -1 ; WX 278 ; N Icircumflex ; B -37 0 316 936 ;
-C -1 ; WX 611 ; N ncaron ; B 65 0 546 750 ;
-C -1 ; WX 333 ; N tcommaaccent ; B 10 -228 309 676 ;
-C -1 ; WX 584 ; N logicalnot ; B 40 108 544 419 ;
-C -1 ; WX 611 ; N odieresis ; B 34 -14 578 729 ;
-C -1 ; WX 611 ; N udieresis ; B 66 -14 545 729 ;
-C -1 ; WX 549 ; N notequal ; B 15 -49 540 570 ;
-C -1 ; WX 611 ; N gcommaaccent ; B 40 -217 553 850 ;
-C -1 ; WX 611 ; N eth ; B 34 -14 578 737 ;
-C -1 ; WX 500 ; N zcaron ; B 20 0 480 750 ;
-C -1 ; WX 611 ; N ncommaaccent ; B 65 -228 546 546 ;
-C -1 ; WX 333 ; N onesuperior ; B 26 283 237 710 ;
-C -1 ; WX 278 ; N imacron ; B -8 0 285 678 ;
-C -1 ; WX 556 ; N Euro ; B 0 0 0 0 ;
-EndCharMetrics
-StartKernData
-StartKernPairs 2481
-KPX A C -40
-KPX A Cacute -40
-KPX A Ccaron -40
-KPX A Ccedilla -40
-KPX A G -50
-KPX A Gbreve -50
-KPX A Gcommaaccent -50
-KPX A O -40
-KPX A Oacute -40
-KPX A Ocircumflex -40
-KPX A Odieresis -40
-KPX A Ograve -40
-KPX A Ohungarumlaut -40
-KPX A Omacron -40
-KPX A Oslash -40
-KPX A Otilde -40
-KPX A Q -40
-KPX A T -90
-KPX A Tcaron -90
-KPX A Tcommaaccent -90
-KPX A U -50
-KPX A Uacute -50
-KPX A Ucircumflex -50
-KPX A Udieresis -50
-KPX A Ugrave -50
-KPX A Uhungarumlaut -50
-KPX A Umacron -50
-KPX A Uogonek -50
-KPX A Uring -50
-KPX A V -80
-KPX A W -60
-KPX A Y -110
-KPX A Yacute -110
-KPX A Ydieresis -110
-KPX A u -30
-KPX A uacute -30
-KPX A ucircumflex -30
-KPX A udieresis -30
-KPX A ugrave -30
-KPX A uhungarumlaut -30
-KPX A umacron -30
-KPX A uogonek -30
-KPX A uring -30
-KPX A v -40
-KPX A w -30
-KPX A y -30
-KPX A yacute -30
-KPX A ydieresis -30
-KPX Aacute C -40
-KPX Aacute Cacute -40
-KPX Aacute Ccaron -40
-KPX Aacute Ccedilla -40
-KPX Aacute G -50
-KPX Aacute Gbreve -50
-KPX Aacute Gcommaaccent -50
-KPX Aacute O -40
-KPX Aacute Oacute -40
-KPX Aacute Ocircumflex -40
-KPX Aacute Odieresis -40
-KPX Aacute Ograve -40
-KPX Aacute Ohungarumlaut -40
-KPX Aacute Omacron -40
-KPX Aacute Oslash -40
-KPX Aacute Otilde -40
-KPX Aacute Q -40
-KPX Aacute T -90
-KPX Aacute Tcaron -90
-KPX Aacute Tcommaaccent -90
-KPX Aacute U -50
-KPX Aacute Uacute -50
-KPX Aacute Ucircumflex -50
-KPX Aacute Udieresis -50
-KPX Aacute Ugrave -50
-KPX Aacute Uhungarumlaut -50
-KPX Aacute Umacron -50
-KPX Aacute Uogonek -50
-KPX Aacute Uring -50
-KPX Aacute V -80
-KPX Aacute W -60
-KPX Aacute Y -110
-KPX Aacute Yacute -110
-KPX Aacute Ydieresis -110
-KPX Aacute u -30
-KPX Aacute uacute -30
-KPX Aacute ucircumflex -30
-KPX Aacute udieresis -30
-KPX Aacute ugrave -30
-KPX Aacute uhungarumlaut -30
-KPX Aacute umacron -30
-KPX Aacute uogonek -30
-KPX Aacute uring -30
-KPX Aacute v -40
-KPX Aacute w -30
-KPX Aacute y -30
-KPX Aacute yacute -30
-KPX Aacute ydieresis -30
-KPX Abreve C -40
-KPX Abreve Cacute -40
-KPX Abreve Ccaron -40
-KPX Abreve Ccedilla -40
-KPX Abreve G -50
-KPX Abreve Gbreve -50
-KPX Abreve Gcommaaccent -50
-KPX Abreve O -40
-KPX Abreve Oacute -40
-KPX Abreve Ocircumflex -40
-KPX Abreve Odieresis -40
-KPX Abreve Ograve -40
-KPX Abreve Ohungarumlaut -40
-KPX Abreve Omacron -40
-KPX Abreve Oslash -40
-KPX Abreve Otilde -40
-KPX Abreve Q -40
-KPX Abreve T -90
-KPX Abreve Tcaron -90
-KPX Abreve Tcommaaccent -90
-KPX Abreve U -50
-KPX Abreve Uacute -50
-KPX Abreve Ucircumflex -50
-KPX Abreve Udieresis -50
-KPX Abreve Ugrave -50
-KPX Abreve Uhungarumlaut -50
-KPX Abreve Umacron -50
-KPX Abreve Uogonek -50
-KPX Abreve Uring -50
-KPX Abreve V -80
-KPX Abreve W -60
-KPX Abreve Y -110
-KPX Abreve Yacute -110
-KPX Abreve Ydieresis -110
-KPX Abreve u -30
-KPX Abreve uacute -30
-KPX Abreve ucircumflex -30
-KPX Abreve udieresis -30
-KPX Abreve ugrave -30
-KPX Abreve uhungarumlaut -30
-KPX Abreve umacron -30
-KPX Abreve uogonek -30
-KPX Abreve uring -30
-KPX Abreve v -40
-KPX Abreve w -30
-KPX Abreve y -30
-KPX Abreve yacute -30
-KPX Abreve ydieresis -30
-KPX Acircumflex C -40
-KPX Acircumflex Cacute -40
-KPX Acircumflex Ccaron -40
-KPX Acircumflex Ccedilla -40
-KPX Acircumflex G -50
-KPX Acircumflex Gbreve -50
-KPX Acircumflex Gcommaaccent -50
-KPX Acircumflex O -40
-KPX Acircumflex Oacute -40
-KPX Acircumflex Ocircumflex -40
-KPX Acircumflex Odieresis -40
-KPX Acircumflex Ograve -40
-KPX Acircumflex Ohungarumlaut -40
-KPX Acircumflex Omacron -40
-KPX Acircumflex Oslash -40
-KPX Acircumflex Otilde -40
-KPX Acircumflex Q -40
-KPX Acircumflex T -90
-KPX Acircumflex Tcaron -90
-KPX Acircumflex Tcommaaccent -90
-KPX Acircumflex U -50
-KPX Acircumflex Uacute -50
-KPX Acircumflex Ucircumflex -50
-KPX Acircumflex Udieresis -50
-KPX Acircumflex Ugrave -50
-KPX Acircumflex Uhungarumlaut -50
-KPX Acircumflex Umacron -50
-KPX Acircumflex Uogonek -50
-KPX Acircumflex Uring -50
-KPX Acircumflex V -80
-KPX Acircumflex W -60
-KPX Acircumflex Y -110
-KPX Acircumflex Yacute -110
-KPX Acircumflex Ydieresis -110
-KPX Acircumflex u -30
-KPX Acircumflex uacute -30
-KPX Acircumflex ucircumflex -30
-KPX Acircumflex udieresis -30
-KPX Acircumflex ugrave -30
-KPX Acircumflex uhungarumlaut -30
-KPX Acircumflex umacron -30
-KPX Acircumflex uogonek -30
-KPX Acircumflex uring -30
-KPX Acircumflex v -40
-KPX Acircumflex w -30
-KPX Acircumflex y -30
-KPX Acircumflex yacute -30
-KPX Acircumflex ydieresis -30
-KPX Adieresis C -40
-KPX Adieresis Cacute -40
-KPX Adieresis Ccaron -40
-KPX Adieresis Ccedilla -40
-KPX Adieresis G -50
-KPX Adieresis Gbreve -50
-KPX Adieresis Gcommaaccent -50
-KPX Adieresis O -40
-KPX Adieresis Oacute -40
-KPX Adieresis Ocircumflex -40
-KPX Adieresis Odieresis -40
-KPX Adieresis Ograve -40
-KPX Adieresis Ohungarumlaut -40
-KPX Adieresis Omacron -40
-KPX Adieresis Oslash -40
-KPX Adieresis Otilde -40
-KPX Adieresis Q -40
-KPX Adieresis T -90
-KPX Adieresis Tcaron -90
-KPX Adieresis Tcommaaccent -90
-KPX Adieresis U -50
-KPX Adieresis Uacute -50
-KPX Adieresis Ucircumflex -50
-KPX Adieresis Udieresis -50
-KPX Adieresis Ugrave -50
-KPX Adieresis Uhungarumlaut -50
-KPX Adieresis Umacron -50
-KPX Adieresis Uogonek -50
-KPX Adieresis Uring -50
-KPX Adieresis V -80
-KPX Adieresis W -60
-KPX Adieresis Y -110
-KPX Adieresis Yacute -110
-KPX Adieresis Ydieresis -110
-KPX Adieresis u -30
-KPX Adieresis uacute -30
-KPX Adieresis ucircumflex -30
-KPX Adieresis udieresis -30
-KPX Adieresis ugrave -30
-KPX Adieresis uhungarumlaut -30
-KPX Adieresis umacron -30
-KPX Adieresis uogonek -30
-KPX Adieresis uring -30
-KPX Adieresis v -40
-KPX Adieresis w -30
-KPX Adieresis y -30
-KPX Adieresis yacute -30
-KPX Adieresis ydieresis -30
-KPX Agrave C -40
-KPX Agrave Cacute -40
-KPX Agrave Ccaron -40
-KPX Agrave Ccedilla -40
-KPX Agrave G -50
-KPX Agrave Gbreve -50
-KPX Agrave Gcommaaccent -50
-KPX Agrave O -40
-KPX Agrave Oacute -40
-KPX Agrave Ocircumflex -40
-KPX Agrave Odieresis -40
-KPX Agrave Ograve -40
-KPX Agrave Ohungarumlaut -40
-KPX Agrave Omacron -40
-KPX Agrave Oslash -40
-KPX Agrave Otilde -40
-KPX Agrave Q -40
-KPX Agrave T -90
-KPX Agrave Tcaron -90
-KPX Agrave Tcommaaccent -90
-KPX Agrave U -50
-KPX Agrave Uacute -50
-KPX Agrave Ucircumflex -50
-KPX Agrave Udieresis -50
-KPX Agrave Ugrave -50
-KPX Agrave Uhungarumlaut -50
-KPX Agrave Umacron -50
-KPX Agrave Uogonek -50
-KPX Agrave Uring -50
-KPX Agrave V -80
-KPX Agrave W -60
-KPX Agrave Y -110
-KPX Agrave Yacute -110
-KPX Agrave Ydieresis -110
-KPX Agrave u -30
-KPX Agrave uacute -30
-KPX Agrave ucircumflex -30
-KPX Agrave udieresis -30
-KPX Agrave ugrave -30
-KPX Agrave uhungarumlaut -30
-KPX Agrave umacron -30
-KPX Agrave uogonek -30
-KPX Agrave uring -30
-KPX Agrave v -40
-KPX Agrave w -30
-KPX Agrave y -30
-KPX Agrave yacute -30
-KPX Agrave ydieresis -30
-KPX Amacron C -40
-KPX Amacron Cacute -40
-KPX Amacron Ccaron -40
-KPX Amacron Ccedilla -40
-KPX Amacron G -50
-KPX Amacron Gbreve -50
-KPX Amacron Gcommaaccent -50
-KPX Amacron O -40
-KPX Amacron Oacute -40
-KPX Amacron Ocircumflex -40
-KPX Amacron Odieresis -40
-KPX Amacron Ograve -40
-KPX Amacron Ohungarumlaut -40
-KPX Amacron Omacron -40
-KPX Amacron Oslash -40
-KPX Amacron Otilde -40
-KPX Amacron Q -40
-KPX Amacron T -90
-KPX Amacron Tcaron -90
-KPX Amacron Tcommaaccent -90
-KPX Amacron U -50
-KPX Amacron Uacute -50
-KPX Amacron Ucircumflex -50
-KPX Amacron Udieresis -50
-KPX Amacron Ugrave -50
-KPX Amacron Uhungarumlaut -50
-KPX Amacron Umacron -50
-KPX Amacron Uogonek -50
-KPX Amacron Uring -50
-KPX Amacron V -80
-KPX Amacron W -60
-KPX Amacron Y -110
-KPX Amacron Yacute -110
-KPX Amacron Ydieresis -110
-KPX Amacron u -30
-KPX Amacron uacute -30
-KPX Amacron ucircumflex -30
-KPX Amacron udieresis -30
-KPX Amacron ugrave -30
-KPX Amacron uhungarumlaut -30
-KPX Amacron umacron -30
-KPX Amacron uogonek -30
-KPX Amacron uring -30
-KPX Amacron v -40
-KPX Amacron w -30
-KPX Amacron y -30
-KPX Amacron yacute -30
-KPX Amacron ydieresis -30
-KPX Aogonek C -40
-KPX Aogonek Cacute -40
-KPX Aogonek Ccaron -40
-KPX Aogonek Ccedilla -40
-KPX Aogonek G -50
-KPX Aogonek Gbreve -50
-KPX Aogonek Gcommaaccent -50
-KPX Aogonek O -40
-KPX Aogonek Oacute -40
-KPX Aogonek Ocircumflex -40
-KPX Aogonek Odieresis -40
-KPX Aogonek Ograve -40
-KPX Aogonek Ohungarumlaut -40
-KPX Aogonek Omacron -40
-KPX Aogonek Oslash -40
-KPX Aogonek Otilde -40
-KPX Aogonek Q -40
-KPX Aogonek T -90
-KPX Aogonek Tcaron -90
-KPX Aogonek Tcommaaccent -90
-KPX Aogonek U -50
-KPX Aogonek Uacute -50
-KPX Aogonek Ucircumflex -50
-KPX Aogonek Udieresis -50
-KPX Aogonek Ugrave -50
-KPX Aogonek Uhungarumlaut -50
-KPX Aogonek Umacron -50
-KPX Aogonek Uogonek -50
-KPX Aogonek Uring -50
-KPX Aogonek V -80
-KPX Aogonek W -60
-KPX Aogonek Y -110
-KPX Aogonek Yacute -110
-KPX Aogonek Ydieresis -110
-KPX Aogonek u -30
-KPX Aogonek uacute -30
-KPX Aogonek ucircumflex -30
-KPX Aogonek udieresis -30
-KPX Aogonek ugrave -30
-KPX Aogonek uhungarumlaut -30
-KPX Aogonek umacron -30
-KPX Aogonek uogonek -30
-KPX Aogonek uring -30
-KPX Aogonek v -40
-KPX Aogonek w -30
-KPX Aogonek y -30
-KPX Aogonek yacute -30
-KPX Aogonek ydieresis -30
-KPX Aring C -40
-KPX Aring Cacute -40
-KPX Aring Ccaron -40
-KPX Aring Ccedilla -40
-KPX Aring G -50
-KPX Aring Gbreve -50
-KPX Aring Gcommaaccent -50
-KPX Aring O -40
-KPX Aring Oacute -40
-KPX Aring Ocircumflex -40
-KPX Aring Odieresis -40
-KPX Aring Ograve -40
-KPX Aring Ohungarumlaut -40
-KPX Aring Omacron -40
-KPX Aring Oslash -40
-KPX Aring Otilde -40
-KPX Aring Q -40
-KPX Aring T -90
-KPX Aring Tcaron -90
-KPX Aring Tcommaaccent -90
-KPX Aring U -50
-KPX Aring Uacute -50
-KPX Aring Ucircumflex -50
-KPX Aring Udieresis -50
-KPX Aring Ugrave -50
-KPX Aring Uhungarumlaut -50
-KPX Aring Umacron -50
-KPX Aring Uogonek -50
-KPX Aring Uring -50
-KPX Aring V -80
-KPX Aring W -60
-KPX Aring Y -110
-KPX Aring Yacute -110
-KPX Aring Ydieresis -110
-KPX Aring u -30
-KPX Aring uacute -30
-KPX Aring ucircumflex -30
-KPX Aring udieresis -30
-KPX Aring ugrave -30
-KPX Aring uhungarumlaut -30
-KPX Aring umacron -30
-KPX Aring uogonek -30
-KPX Aring uring -30
-KPX Aring v -40
-KPX Aring w -30
-KPX Aring y -30
-KPX Aring yacute -30
-KPX Aring ydieresis -30
-KPX Atilde C -40
-KPX Atilde Cacute -40
-KPX Atilde Ccaron -40
-KPX Atilde Ccedilla -40
-KPX Atilde G -50
-KPX Atilde Gbreve -50
-KPX Atilde Gcommaaccent -50
-KPX Atilde O -40
-KPX Atilde Oacute -40
-KPX Atilde Ocircumflex -40
-KPX Atilde Odieresis -40
-KPX Atilde Ograve -40
-KPX Atilde Ohungarumlaut -40
-KPX Atilde Omacron -40
-KPX Atilde Oslash -40
-KPX Atilde Otilde -40
-KPX Atilde Q -40
-KPX Atilde T -90
-KPX Atilde Tcaron -90
-KPX Atilde Tcommaaccent -90
-KPX Atilde U -50
-KPX Atilde Uacute -50
-KPX Atilde Ucircumflex -50
-KPX Atilde Udieresis -50
-KPX Atilde Ugrave -50
-KPX Atilde Uhungarumlaut -50
-KPX Atilde Umacron -50
-KPX Atilde Uogonek -50
-KPX Atilde Uring -50
-KPX Atilde V -80
-KPX Atilde W -60
-KPX Atilde Y -110
-KPX Atilde Yacute -110
-KPX Atilde Ydieresis -110
-KPX Atilde u -30
-KPX Atilde uacute -30
-KPX Atilde ucircumflex -30
-KPX Atilde udieresis -30
-KPX Atilde ugrave -30
-KPX Atilde uhungarumlaut -30
-KPX Atilde umacron -30
-KPX Atilde uogonek -30
-KPX Atilde uring -30
-KPX Atilde v -40
-KPX Atilde w -30
-KPX Atilde y -30
-KPX Atilde yacute -30
-KPX Atilde ydieresis -30
-KPX B A -30
-KPX B Aacute -30
-KPX B Abreve -30
-KPX B Acircumflex -30
-KPX B Adieresis -30
-KPX B Agrave -30
-KPX B Amacron -30
-KPX B Aogonek -30
-KPX B Aring -30
-KPX B Atilde -30
-KPX B U -10
-KPX B Uacute -10
-KPX B Ucircumflex -10
-KPX B Udieresis -10
-KPX B Ugrave -10
-KPX B Uhungarumlaut -10
-KPX B Umacron -10
-KPX B Uogonek -10
-KPX B Uring -10
-KPX D A -40
-KPX D Aacute -40
-KPX D Abreve -40
-KPX D Acircumflex -40
-KPX D Adieresis -40
-KPX D Agrave -40
-KPX D Amacron -40
-KPX D Aogonek -40
-KPX D Aring -40
-KPX D Atilde -40
-KPX D V -40
-KPX D W -40
-KPX D Y -70
-KPX D Yacute -70
-KPX D Ydieresis -70
-KPX D comma -30
-KPX D period -30
-KPX Dcaron A -40
-KPX Dcaron Aacute -40
-KPX Dcaron Abreve -40
-KPX Dcaron Acircumflex -40
-KPX Dcaron Adieresis -40
-KPX Dcaron Agrave -40
-KPX Dcaron Amacron -40
-KPX Dcaron Aogonek -40
-KPX Dcaron Aring -40
-KPX Dcaron Atilde -40
-KPX Dcaron V -40
-KPX Dcaron W -40
-KPX Dcaron Y -70
-KPX Dcaron Yacute -70
-KPX Dcaron Ydieresis -70
-KPX Dcaron comma -30
-KPX Dcaron period -30
-KPX Dcroat A -40
-KPX Dcroat Aacute -40
-KPX Dcroat Abreve -40
-KPX Dcroat Acircumflex -40
-KPX Dcroat Adieresis -40
-KPX Dcroat Agrave -40
-KPX Dcroat Amacron -40
-KPX Dcroat Aogonek -40
-KPX Dcroat Aring -40
-KPX Dcroat Atilde -40
-KPX Dcroat V -40
-KPX Dcroat W -40
-KPX Dcroat Y -70
-KPX Dcroat Yacute -70
-KPX Dcroat Ydieresis -70
-KPX Dcroat comma -30
-KPX Dcroat period -30
-KPX F A -80
-KPX F Aacute -80
-KPX F Abreve -80
-KPX F Acircumflex -80
-KPX F Adieresis -80
-KPX F Agrave -80
-KPX F Amacron -80
-KPX F Aogonek -80
-KPX F Aring -80
-KPX F Atilde -80
-KPX F a -20
-KPX F aacute -20
-KPX F abreve -20
-KPX F acircumflex -20
-KPX F adieresis -20
-KPX F agrave -20
-KPX F amacron -20
-KPX F aogonek -20
-KPX F aring -20
-KPX F atilde -20
-KPX F comma -100
-KPX F period -100
-KPX J A -20
-KPX J Aacute -20
-KPX J Abreve -20
-KPX J Acircumflex -20
-KPX J Adieresis -20
-KPX J Agrave -20
-KPX J Amacron -20
-KPX J Aogonek -20
-KPX J Aring -20
-KPX J Atilde -20
-KPX J comma -20
-KPX J period -20
-KPX J u -20
-KPX J uacute -20
-KPX J ucircumflex -20
-KPX J udieresis -20
-KPX J ugrave -20
-KPX J uhungarumlaut -20
-KPX J umacron -20
-KPX J uogonek -20
-KPX J uring -20
-KPX K O -30
-KPX K Oacute -30
-KPX K Ocircumflex -30
-KPX K Odieresis -30
-KPX K Ograve -30
-KPX K Ohungarumlaut -30
-KPX K Omacron -30
-KPX K Oslash -30
-KPX K Otilde -30
-KPX K e -15
-KPX K eacute -15
-KPX K ecaron -15
-KPX K ecircumflex -15
-KPX K edieresis -15
-KPX K edotaccent -15
-KPX K egrave -15
-KPX K emacron -15
-KPX K eogonek -15
-KPX K o -35
-KPX K oacute -35
-KPX K ocircumflex -35
-KPX K odieresis -35
-KPX K ograve -35
-KPX K ohungarumlaut -35
-KPX K omacron -35
-KPX K oslash -35
-KPX K otilde -35
-KPX K u -30
-KPX K uacute -30
-KPX K ucircumflex -30
-KPX K udieresis -30
-KPX K ugrave -30
-KPX K uhungarumlaut -30
-KPX K umacron -30
-KPX K uogonek -30
-KPX K uring -30
-KPX K y -40
-KPX K yacute -40
-KPX K ydieresis -40
-KPX Kcommaaccent O -30
-KPX Kcommaaccent Oacute -30
-KPX Kcommaaccent Ocircumflex -30
-KPX Kcommaaccent Odieresis -30
-KPX Kcommaaccent Ograve -30
-KPX Kcommaaccent Ohungarumlaut -30
-KPX Kcommaaccent Omacron -30
-KPX Kcommaaccent Oslash -30
-KPX Kcommaaccent Otilde -30
-KPX Kcommaaccent e -15
-KPX Kcommaaccent eacute -15
-KPX Kcommaaccent ecaron -15
-KPX Kcommaaccent ecircumflex -15
-KPX Kcommaaccent edieresis -15
-KPX Kcommaaccent edotaccent -15
-KPX Kcommaaccent egrave -15
-KPX Kcommaaccent emacron -15
-KPX Kcommaaccent eogonek -15
-KPX Kcommaaccent o -35
-KPX Kcommaaccent oacute -35
-KPX Kcommaaccent ocircumflex -35
-KPX Kcommaaccent odieresis -35
-KPX Kcommaaccent ograve -35
-KPX Kcommaaccent ohungarumlaut -35
-KPX Kcommaaccent omacron -35
-KPX Kcommaaccent oslash -35
-KPX Kcommaaccent otilde -35
-KPX Kcommaaccent u -30
-KPX Kcommaaccent uacute -30
-KPX Kcommaaccent ucircumflex -30
-KPX Kcommaaccent udieresis -30
-KPX Kcommaaccent ugrave -30
-KPX Kcommaaccent uhungarumlaut -30
-KPX Kcommaaccent umacron -30
-KPX Kcommaaccent uogonek -30
-KPX Kcommaaccent uring -30
-KPX Kcommaaccent y -40
-KPX Kcommaaccent yacute -40
-KPX Kcommaaccent ydieresis -40
-KPX L T -90
-KPX L Tcaron -90
-KPX L Tcommaaccent -90
-KPX L V -110
-KPX L W -80
-KPX L Y -120
-KPX L Yacute -120
-KPX L Ydieresis -120
-KPX L quotedblright -140
-KPX L quoteright -140
-KPX L y -30
-KPX L yacute -30
-KPX L ydieresis -30
-KPX Lacute T -90
-KPX Lacute Tcaron -90
-KPX Lacute Tcommaaccent -90
-KPX Lacute V -110
-KPX Lacute W -80
-KPX Lacute Y -120
-KPX Lacute Yacute -120
-KPX Lacute Ydieresis -120
-KPX Lacute quotedblright -140
-KPX Lacute quoteright -140
-KPX Lacute y -30
-KPX Lacute yacute -30
-KPX Lacute ydieresis -30
-KPX Lcommaaccent T -90
-KPX Lcommaaccent Tcaron -90
-KPX Lcommaaccent Tcommaaccent -90
-KPX Lcommaaccent V -110
-KPX Lcommaaccent W -80
-KPX Lcommaaccent Y -120
-KPX Lcommaaccent Yacute -120
-KPX Lcommaaccent Ydieresis -120
-KPX Lcommaaccent quotedblright -140
-KPX Lcommaaccent quoteright -140
-KPX Lcommaaccent y -30
-KPX Lcommaaccent yacute -30
-KPX Lcommaaccent ydieresis -30
-KPX Lslash T -90
-KPX Lslash Tcaron -90
-KPX Lslash Tcommaaccent -90
-KPX Lslash V -110
-KPX Lslash W -80
-KPX Lslash Y -120
-KPX Lslash Yacute -120
-KPX Lslash Ydieresis -120
-KPX Lslash quotedblright -140
-KPX Lslash quoteright -140
-KPX Lslash y -30
-KPX Lslash yacute -30
-KPX Lslash ydieresis -30
-KPX O A -50
-KPX O Aacute -50
-KPX O Abreve -50
-KPX O Acircumflex -50
-KPX O Adieresis -50
-KPX O Agrave -50
-KPX O Amacron -50
-KPX O Aogonek -50
-KPX O Aring -50
-KPX O Atilde -50
-KPX O T -40
-KPX O Tcaron -40
-KPX O Tcommaaccent -40
-KPX O V -50
-KPX O W -50
-KPX O X -50
-KPX O Y -70
-KPX O Yacute -70
-KPX O Ydieresis -70
-KPX O comma -40
-KPX O period -40
-KPX Oacute A -50
-KPX Oacute Aacute -50
-KPX Oacute Abreve -50
-KPX Oacute Acircumflex -50
-KPX Oacute Adieresis -50
-KPX Oacute Agrave -50
-KPX Oacute Amacron -50
-KPX Oacute Aogonek -50
-KPX Oacute Aring -50
-KPX Oacute Atilde -50
-KPX Oacute T -40
-KPX Oacute Tcaron -40
-KPX Oacute Tcommaaccent -40
-KPX Oacute V -50
-KPX Oacute W -50
-KPX Oacute X -50
-KPX Oacute Y -70
-KPX Oacute Yacute -70
-KPX Oacute Ydieresis -70
-KPX Oacute comma -40
-KPX Oacute period -40
-KPX Ocircumflex A -50
-KPX Ocircumflex Aacute -50
-KPX Ocircumflex Abreve -50
-KPX Ocircumflex Acircumflex -50
-KPX Ocircumflex Adieresis -50
-KPX Ocircumflex Agrave -50
-KPX Ocircumflex Amacron -50
-KPX Ocircumflex Aogonek -50
-KPX Ocircumflex Aring -50
-KPX Ocircumflex Atilde -50
-KPX Ocircumflex T -40
-KPX Ocircumflex Tcaron -40
-KPX Ocircumflex Tcommaaccent -40
-KPX Ocircumflex V -50
-KPX Ocircumflex W -50
-KPX Ocircumflex X -50
-KPX Ocircumflex Y -70
-KPX Ocircumflex Yacute -70
-KPX Ocircumflex Ydieresis -70
-KPX Ocircumflex comma -40
-KPX Ocircumflex period -40
-KPX Odieresis A -50
-KPX Odieresis Aacute -50
-KPX Odieresis Abreve -50
-KPX Odieresis Acircumflex -50
-KPX Odieresis Adieresis -50
-KPX Odieresis Agrave -50
-KPX Odieresis Amacron -50
-KPX Odieresis Aogonek -50
-KPX Odieresis Aring -50
-KPX Odieresis Atilde -50
-KPX Odieresis T -40
-KPX Odieresis Tcaron -40
-KPX Odieresis Tcommaaccent -40
-KPX Odieresis V -50
-KPX Odieresis W -50
-KPX Odieresis X -50
-KPX Odieresis Y -70
-KPX Odieresis Yacute -70
-KPX Odieresis Ydieresis -70
-KPX Odieresis comma -40
-KPX Odieresis period -40
-KPX Ograve A -50
-KPX Ograve Aacute -50
-KPX Ograve Abreve -50
-KPX Ograve Acircumflex -50
-KPX Ograve Adieresis -50
-KPX Ograve Agrave -50
-KPX Ograve Amacron -50
-KPX Ograve Aogonek -50
-KPX Ograve Aring -50
-KPX Ograve Atilde -50
-KPX Ograve T -40
-KPX Ograve Tcaron -40
-KPX Ograve Tcommaaccent -40
-KPX Ograve V -50
-KPX Ograve W -50
-KPX Ograve X -50
-KPX Ograve Y -70
-KPX Ograve Yacute -70
-KPX Ograve Ydieresis -70
-KPX Ograve comma -40
-KPX Ograve period -40
-KPX Ohungarumlaut A -50
-KPX Ohungarumlaut Aacute -50
-KPX Ohungarumlaut Abreve -50
-KPX Ohungarumlaut Acircumflex -50
-KPX Ohungarumlaut Adieresis -50
-KPX Ohungarumlaut Agrave -50
-KPX Ohungarumlaut Amacron -50
-KPX Ohungarumlaut Aogonek -50
-KPX Ohungarumlaut Aring -50
-KPX Ohungarumlaut Atilde -50
-KPX Ohungarumlaut T -40
-KPX Ohungarumlaut Tcaron -40
-KPX Ohungarumlaut Tcommaaccent -40
-KPX Ohungarumlaut V -50
-KPX Ohungarumlaut W -50
-KPX Ohungarumlaut X -50
-KPX Ohungarumlaut Y -70
-KPX Ohungarumlaut Yacute -70
-KPX Ohungarumlaut Ydieresis -70
-KPX Ohungarumlaut comma -40
-KPX Ohungarumlaut period -40
-KPX Omacron A -50
-KPX Omacron Aacute -50
-KPX Omacron Abreve -50
-KPX Omacron Acircumflex -50
-KPX Omacron Adieresis -50
-KPX Omacron Agrave -50
-KPX Omacron Amacron -50
-KPX Omacron Aogonek -50
-KPX Omacron Aring -50
-KPX Omacron Atilde -50
-KPX Omacron T -40
-KPX Omacron Tcaron -40
-KPX Omacron Tcommaaccent -40
-KPX Omacron V -50
-KPX Omacron W -50
-KPX Omacron X -50
-KPX Omacron Y -70
-KPX Omacron Yacute -70
-KPX Omacron Ydieresis -70
-KPX Omacron comma -40
-KPX Omacron period -40
-KPX Oslash A -50
-KPX Oslash Aacute -50
-KPX Oslash Abreve -50
-KPX Oslash Acircumflex -50
-KPX Oslash Adieresis -50
-KPX Oslash Agrave -50
-KPX Oslash Amacron -50
-KPX Oslash Aogonek -50
-KPX Oslash Aring -50
-KPX Oslash Atilde -50
-KPX Oslash T -40
-KPX Oslash Tcaron -40
-KPX Oslash Tcommaaccent -40
-KPX Oslash V -50
-KPX Oslash W -50
-KPX Oslash X -50
-KPX Oslash Y -70
-KPX Oslash Yacute -70
-KPX Oslash Ydieresis -70
-KPX Oslash comma -40
-KPX Oslash period -40
-KPX Otilde A -50
-KPX Otilde Aacute -50
-KPX Otilde Abreve -50
-KPX Otilde Acircumflex -50
-KPX Otilde Adieresis -50
-KPX Otilde Agrave -50
-KPX Otilde Amacron -50
-KPX Otilde Aogonek -50
-KPX Otilde Aring -50
-KPX Otilde Atilde -50
-KPX Otilde T -40
-KPX Otilde Tcaron -40
-KPX Otilde Tcommaaccent -40
-KPX Otilde V -50
-KPX Otilde W -50
-KPX Otilde X -50
-KPX Otilde Y -70
-KPX Otilde Yacute -70
-KPX Otilde Ydieresis -70
-KPX Otilde comma -40
-KPX Otilde period -40
-KPX P A -100
-KPX P Aacute -100
-KPX P Abreve -100
-KPX P Acircumflex -100
-KPX P Adieresis -100
-KPX P Agrave -100
-KPX P Amacron -100
-KPX P Aogonek -100
-KPX P Aring -100
-KPX P Atilde -100
-KPX P a -30
-KPX P aacute -30
-KPX P abreve -30
-KPX P acircumflex -30
-KPX P adieresis -30
-KPX P agrave -30
-KPX P amacron -30
-KPX P aogonek -30
-KPX P aring -30
-KPX P atilde -30
-KPX P comma -120
-KPX P e -30
-KPX P eacute -30
-KPX P ecaron -30
-KPX P ecircumflex -30
-KPX P edieresis -30
-KPX P edotaccent -30
-KPX P egrave -30
-KPX P emacron -30
-KPX P eogonek -30
-KPX P o -40
-KPX P oacute -40
-KPX P ocircumflex -40
-KPX P odieresis -40
-KPX P ograve -40
-KPX P ohungarumlaut -40
-KPX P omacron -40
-KPX P oslash -40
-KPX P otilde -40
-KPX P period -120
-KPX Q U -10
-KPX Q Uacute -10
-KPX Q Ucircumflex -10
-KPX Q Udieresis -10
-KPX Q Ugrave -10
-KPX Q Uhungarumlaut -10
-KPX Q Umacron -10
-KPX Q Uogonek -10
-KPX Q Uring -10
-KPX Q comma 20
-KPX Q period 20
-KPX R O -20
-KPX R Oacute -20
-KPX R Ocircumflex -20
-KPX R Odieresis -20
-KPX R Ograve -20
-KPX R Ohungarumlaut -20
-KPX R Omacron -20
-KPX R Oslash -20
-KPX R Otilde -20
-KPX R T -20
-KPX R Tcaron -20
-KPX R Tcommaaccent -20
-KPX R U -20
-KPX R Uacute -20
-KPX R Ucircumflex -20
-KPX R Udieresis -20
-KPX R Ugrave -20
-KPX R Uhungarumlaut -20
-KPX R Umacron -20
-KPX R Uogonek -20
-KPX R Uring -20
-KPX R V -50
-KPX R W -40
-KPX R Y -50
-KPX R Yacute -50
-KPX R Ydieresis -50
-KPX Racute O -20
-KPX Racute Oacute -20
-KPX Racute Ocircumflex -20
-KPX Racute Odieresis -20
-KPX Racute Ograve -20
-KPX Racute Ohungarumlaut -20
-KPX Racute Omacron -20
-KPX Racute Oslash -20
-KPX Racute Otilde -20
-KPX Racute T -20
-KPX Racute Tcaron -20
-KPX Racute Tcommaaccent -20
-KPX Racute U -20
-KPX Racute Uacute -20
-KPX Racute Ucircumflex -20
-KPX Racute Udieresis -20
-KPX Racute Ugrave -20
-KPX Racute Uhungarumlaut -20
-KPX Racute Umacron -20
-KPX Racute Uogonek -20
-KPX Racute Uring -20
-KPX Racute V -50
-KPX Racute W -40
-KPX Racute Y -50
-KPX Racute Yacute -50
-KPX Racute Ydieresis -50
-KPX Rcaron O -20
-KPX Rcaron Oacute -20
-KPX Rcaron Ocircumflex -20
-KPX Rcaron Odieresis -20
-KPX Rcaron Ograve -20
-KPX Rcaron Ohungarumlaut -20
-KPX Rcaron Omacron -20
-KPX Rcaron Oslash -20
-KPX Rcaron Otilde -20
-KPX Rcaron T -20
-KPX Rcaron Tcaron -20
-KPX Rcaron Tcommaaccent -20
-KPX Rcaron U -20
-KPX Rcaron Uacute -20
-KPX Rcaron Ucircumflex -20
-KPX Rcaron Udieresis -20
-KPX Rcaron Ugrave -20
-KPX Rcaron Uhungarumlaut -20
-KPX Rcaron Umacron -20
-KPX Rcaron Uogonek -20
-KPX Rcaron Uring -20
-KPX Rcaron V -50
-KPX Rcaron W -40
-KPX Rcaron Y -50
-KPX Rcaron Yacute -50
-KPX Rcaron Ydieresis -50
-KPX Rcommaaccent O -20
-KPX Rcommaaccent Oacute -20
-KPX Rcommaaccent Ocircumflex -20
-KPX Rcommaaccent Odieresis -20
-KPX Rcommaaccent Ograve -20
-KPX Rcommaaccent Ohungarumlaut -20
-KPX Rcommaaccent Omacron -20
-KPX Rcommaaccent Oslash -20
-KPX Rcommaaccent Otilde -20
-KPX Rcommaaccent T -20
-KPX Rcommaaccent Tcaron -20
-KPX Rcommaaccent Tcommaaccent -20
-KPX Rcommaaccent U -20
-KPX Rcommaaccent Uacute -20
-KPX Rcommaaccent Ucircumflex -20
-KPX Rcommaaccent Udieresis -20
-KPX Rcommaaccent Ugrave -20
-KPX Rcommaaccent Uhungarumlaut -20
-KPX Rcommaaccent Umacron -20
-KPX Rcommaaccent Uogonek -20
-KPX Rcommaaccent Uring -20
-KPX Rcommaaccent V -50
-KPX Rcommaaccent W -40
-KPX Rcommaaccent Y -50
-KPX Rcommaaccent Yacute -50
-KPX Rcommaaccent Ydieresis -50
-KPX T A -90
-KPX T Aacute -90
-KPX T Abreve -90
-KPX T Acircumflex -90
-KPX T Adieresis -90
-KPX T Agrave -90
-KPX T Amacron -90
-KPX T Aogonek -90
-KPX T Aring -90
-KPX T Atilde -90
-KPX T O -40
-KPX T Oacute -40
-KPX T Ocircumflex -40
-KPX T Odieresis -40
-KPX T Ograve -40
-KPX T Ohungarumlaut -40
-KPX T Omacron -40
-KPX T Oslash -40
-KPX T Otilde -40
-KPX T a -80
-KPX T aacute -80
-KPX T abreve -80
-KPX T acircumflex -80
-KPX T adieresis -80
-KPX T agrave -80
-KPX T amacron -80
-KPX T aogonek -80
-KPX T aring -80
-KPX T atilde -80
-KPX T colon -40
-KPX T comma -80
-KPX T e -60
-KPX T eacute -60
-KPX T ecaron -60
-KPX T ecircumflex -60
-KPX T edieresis -60
-KPX T edotaccent -60
-KPX T egrave -60
-KPX T emacron -60
-KPX T eogonek -60
-KPX T hyphen -120
-KPX T o -80
-KPX T oacute -80
-KPX T ocircumflex -80
-KPX T odieresis -80
-KPX T ograve -80
-KPX T ohungarumlaut -80
-KPX T omacron -80
-KPX T oslash -80
-KPX T otilde -80
-KPX T period -80
-KPX T r -80
-KPX T racute -80
-KPX T rcommaaccent -80
-KPX T semicolon -40
-KPX T u -90
-KPX T uacute -90
-KPX T ucircumflex -90
-KPX T udieresis -90
-KPX T ugrave -90
-KPX T uhungarumlaut -90
-KPX T umacron -90
-KPX T uogonek -90
-KPX T uring -90
-KPX T w -60
-KPX T y -60
-KPX T yacute -60
-KPX T ydieresis -60
-KPX Tcaron A -90
-KPX Tcaron Aacute -90
-KPX Tcaron Abreve -90
-KPX Tcaron Acircumflex -90
-KPX Tcaron Adieresis -90
-KPX Tcaron Agrave -90
-KPX Tcaron Amacron -90
-KPX Tcaron Aogonek -90
-KPX Tcaron Aring -90
-KPX Tcaron Atilde -90
-KPX Tcaron O -40
-KPX Tcaron Oacute -40
-KPX Tcaron Ocircumflex -40
-KPX Tcaron Odieresis -40
-KPX Tcaron Ograve -40
-KPX Tcaron Ohungarumlaut -40
-KPX Tcaron Omacron -40
-KPX Tcaron Oslash -40
-KPX Tcaron Otilde -40
-KPX Tcaron a -80
-KPX Tcaron aacute -80
-KPX Tcaron abreve -80
-KPX Tcaron acircumflex -80
-KPX Tcaron adieresis -80
-KPX Tcaron agrave -80
-KPX Tcaron amacron -80
-KPX Tcaron aogonek -80
-KPX Tcaron aring -80
-KPX Tcaron atilde -80
-KPX Tcaron colon -40
-KPX Tcaron comma -80
-KPX Tcaron e -60
-KPX Tcaron eacute -60
-KPX Tcaron ecaron -60
-KPX Tcaron ecircumflex -60
-KPX Tcaron edieresis -60
-KPX Tcaron edotaccent -60
-KPX Tcaron egrave -60
-KPX Tcaron emacron -60
-KPX Tcaron eogonek -60
-KPX Tcaron hyphen -120
-KPX Tcaron o -80
-KPX Tcaron oacute -80
-KPX Tcaron ocircumflex -80
-KPX Tcaron odieresis -80
-KPX Tcaron ograve -80
-KPX Tcaron ohungarumlaut -80
-KPX Tcaron omacron -80
-KPX Tcaron oslash -80
-KPX Tcaron otilde -80
-KPX Tcaron period -80
-KPX Tcaron r -80
-KPX Tcaron racute -80
-KPX Tcaron rcommaaccent -80
-KPX Tcaron semicolon -40
-KPX Tcaron u -90
-KPX Tcaron uacute -90
-KPX Tcaron ucircumflex -90
-KPX Tcaron udieresis -90
-KPX Tcaron ugrave -90
-KPX Tcaron uhungarumlaut -90
-KPX Tcaron umacron -90
-KPX Tcaron uogonek -90
-KPX Tcaron uring -90
-KPX Tcaron w -60
-KPX Tcaron y -60
-KPX Tcaron yacute -60
-KPX Tcaron ydieresis -60
-KPX Tcommaaccent A -90
-KPX Tcommaaccent Aacute -90
-KPX Tcommaaccent Abreve -90
-KPX Tcommaaccent Acircumflex -90
-KPX Tcommaaccent Adieresis -90
-KPX Tcommaaccent Agrave -90
-KPX Tcommaaccent Amacron -90
-KPX Tcommaaccent Aogonek -90
-KPX Tcommaaccent Aring -90
-KPX Tcommaaccent Atilde -90
-KPX Tcommaaccent O -40
-KPX Tcommaaccent Oacute -40
-KPX Tcommaaccent Ocircumflex -40
-KPX Tcommaaccent Odieresis -40
-KPX Tcommaaccent Ograve -40
-KPX Tcommaaccent Ohungarumlaut -40
-KPX Tcommaaccent Omacron -40
-KPX Tcommaaccent Oslash -40
-KPX Tcommaaccent Otilde -40
-KPX Tcommaaccent a -80
-KPX Tcommaaccent aacute -80
-KPX Tcommaaccent abreve -80
-KPX Tcommaaccent acircumflex -80
-KPX Tcommaaccent adieresis -80
-KPX Tcommaaccent agrave -80
-KPX Tcommaaccent amacron -80
-KPX Tcommaaccent aogonek -80
-KPX Tcommaaccent aring -80
-KPX Tcommaaccent atilde -80
-KPX Tcommaaccent colon -40
-KPX Tcommaaccent comma -80
-KPX Tcommaaccent e -60
-KPX Tcommaaccent eacute -60
-KPX Tcommaaccent ecaron -60
-KPX Tcommaaccent ecircumflex -60
-KPX Tcommaaccent edieresis -60
-KPX Tcommaaccent edotaccent -60
-KPX Tcommaaccent egrave -60
-KPX Tcommaaccent emacron -60
-KPX Tcommaaccent eogonek -60
-KPX Tcommaaccent hyphen -120
-KPX Tcommaaccent o -80
-KPX Tcommaaccent oacute -80
-KPX Tcommaaccent ocircumflex -80
-KPX Tcommaaccent odieresis -80
-KPX Tcommaaccent ograve -80
-KPX Tcommaaccent ohungarumlaut -80
-KPX Tcommaaccent omacron -80
-KPX Tcommaaccent oslash -80
-KPX Tcommaaccent otilde -80
-KPX Tcommaaccent period -80
-KPX Tcommaaccent r -80
-KPX Tcommaaccent racute -80
-KPX Tcommaaccent rcommaaccent -80
-KPX Tcommaaccent semicolon -40
-KPX Tcommaaccent u -90
-KPX Tcommaaccent uacute -90
-KPX Tcommaaccent ucircumflex -90
-KPX Tcommaaccent udieresis -90
-KPX Tcommaaccent ugrave -90
-KPX Tcommaaccent uhungarumlaut -90
-KPX Tcommaaccent umacron -90
-KPX Tcommaaccent uogonek -90
-KPX Tcommaaccent uring -90
-KPX Tcommaaccent w -60
-KPX Tcommaaccent y -60
-KPX Tcommaaccent yacute -60
-KPX Tcommaaccent ydieresis -60
-KPX U A -50
-KPX U Aacute -50
-KPX U Abreve -50
-KPX U Acircumflex -50
-KPX U Adieresis -50
-KPX U Agrave -50
-KPX U Amacron -50
-KPX U Aogonek -50
-KPX U Aring -50
-KPX U Atilde -50
-KPX U comma -30
-KPX U period -30
-KPX Uacute A -50
-KPX Uacute Aacute -50
-KPX Uacute Abreve -50
-KPX Uacute Acircumflex -50
-KPX Uacute Adieresis -50
-KPX Uacute Agrave -50
-KPX Uacute Amacron -50
-KPX Uacute Aogonek -50
-KPX Uacute Aring -50
-KPX Uacute Atilde -50
-KPX Uacute comma -30
-KPX Uacute period -30
-KPX Ucircumflex A -50
-KPX Ucircumflex Aacute -50
-KPX Ucircumflex Abreve -50
-KPX Ucircumflex Acircumflex -50
-KPX Ucircumflex Adieresis -50
-KPX Ucircumflex Agrave -50
-KPX Ucircumflex Amacron -50
-KPX Ucircumflex Aogonek -50
-KPX Ucircumflex Aring -50
-KPX Ucircumflex Atilde -50
-KPX Ucircumflex comma -30
-KPX Ucircumflex period -30
-KPX Udieresis A -50
-KPX Udieresis Aacute -50
-KPX Udieresis Abreve -50
-KPX Udieresis Acircumflex -50
-KPX Udieresis Adieresis -50
-KPX Udieresis Agrave -50
-KPX Udieresis Amacron -50
-KPX Udieresis Aogonek -50
-KPX Udieresis Aring -50
-KPX Udieresis Atilde -50
-KPX Udieresis comma -30
-KPX Udieresis period -30
-KPX Ugrave A -50
-KPX Ugrave Aacute -50
-KPX Ugrave Abreve -50
-KPX Ugrave Acircumflex -50
-KPX Ugrave Adieresis -50
-KPX Ugrave Agrave -50
-KPX Ugrave Amacron -50
-KPX Ugrave Aogonek -50
-KPX Ugrave Aring -50
-KPX Ugrave Atilde -50
-KPX Ugrave comma -30
-KPX Ugrave period -30
-KPX Uhungarumlaut A -50
-KPX Uhungarumlaut Aacute -50
-KPX Uhungarumlaut Abreve -50
-KPX Uhungarumlaut Acircumflex -50
-KPX Uhungarumlaut Adieresis -50
-KPX Uhungarumlaut Agrave -50
-KPX Uhungarumlaut Amacron -50
-KPX Uhungarumlaut Aogonek -50
-KPX Uhungarumlaut Aring -50
-KPX Uhungarumlaut Atilde -50
-KPX Uhungarumlaut comma -30
-KPX Uhungarumlaut period -30
-KPX Umacron A -50
-KPX Umacron Aacute -50
-KPX Umacron Abreve -50
-KPX Umacron Acircumflex -50
-KPX Umacron Adieresis -50
-KPX Umacron Agrave -50
-KPX Umacron Amacron -50
-KPX Umacron Aogonek -50
-KPX Umacron Aring -50
-KPX Umacron Atilde -50
-KPX Umacron comma -30
-KPX Umacron period -30
-KPX Uogonek A -50
-KPX Uogonek Aacute -50
-KPX Uogonek Abreve -50
-KPX Uogonek Acircumflex -50
-KPX Uogonek Adieresis -50
-KPX Uogonek Agrave -50
-KPX Uogonek Amacron -50
-KPX Uogonek Aogonek -50
-KPX Uogonek Aring -50
-KPX Uogonek Atilde -50
-KPX Uogonek comma -30
-KPX Uogonek period -30
-KPX Uring A -50
-KPX Uring Aacute -50
-KPX Uring Abreve -50
-KPX Uring Acircumflex -50
-KPX Uring Adieresis -50
-KPX Uring Agrave -50
-KPX Uring Amacron -50
-KPX Uring Aogonek -50
-KPX Uring Aring -50
-KPX Uring Atilde -50
-KPX Uring comma -30
-KPX Uring period -30
-KPX V A -80
-KPX V Aacute -80
-KPX V Abreve -80
-KPX V Acircumflex -80
-KPX V Adieresis -80
-KPX V Agrave -80
-KPX V Amacron -80
-KPX V Aogonek -80
-KPX V Aring -80
-KPX V Atilde -80
-KPX V G -50
-KPX V Gbreve -50
-KPX V Gcommaaccent -50
-KPX V O -50
-KPX V Oacute -50
-KPX V Ocircumflex -50
-KPX V Odieresis -50
-KPX V Ograve -50
-KPX V Ohungarumlaut -50
-KPX V Omacron -50
-KPX V Oslash -50
-KPX V Otilde -50
-KPX V a -60
-KPX V aacute -60
-KPX V abreve -60
-KPX V acircumflex -60
-KPX V adieresis -60
-KPX V agrave -60
-KPX V amacron -60
-KPX V aogonek -60
-KPX V aring -60
-KPX V atilde -60
-KPX V colon -40
-KPX V comma -120
-KPX V e -50
-KPX V eacute -50
-KPX V ecaron -50
-KPX V ecircumflex -50
-KPX V edieresis -50
-KPX V edotaccent -50
-KPX V egrave -50
-KPX V emacron -50
-KPX V eogonek -50
-KPX V hyphen -80
-KPX V o -90
-KPX V oacute -90
-KPX V ocircumflex -90
-KPX V odieresis -90
-KPX V ograve -90
-KPX V ohungarumlaut -90
-KPX V omacron -90
-KPX V oslash -90
-KPX V otilde -90
-KPX V period -120
-KPX V semicolon -40
-KPX V u -60
-KPX V uacute -60
-KPX V ucircumflex -60
-KPX V udieresis -60
-KPX V ugrave -60
-KPX V uhungarumlaut -60
-KPX V umacron -60
-KPX V uogonek -60
-KPX V uring -60
-KPX W A -60
-KPX W Aacute -60
-KPX W Abreve -60
-KPX W Acircumflex -60
-KPX W Adieresis -60
-KPX W Agrave -60
-KPX W Amacron -60
-KPX W Aogonek -60
-KPX W Aring -60
-KPX W Atilde -60
-KPX W O -20
-KPX W Oacute -20
-KPX W Ocircumflex -20
-KPX W Odieresis -20
-KPX W Ograve -20
-KPX W Ohungarumlaut -20
-KPX W Omacron -20
-KPX W Oslash -20
-KPX W Otilde -20
-KPX W a -40
-KPX W aacute -40
-KPX W abreve -40
-KPX W acircumflex -40
-KPX W adieresis -40
-KPX W agrave -40
-KPX W amacron -40
-KPX W aogonek -40
-KPX W aring -40
-KPX W atilde -40
-KPX W colon -10
-KPX W comma -80
-KPX W e -35
-KPX W eacute -35
-KPX W ecaron -35
-KPX W ecircumflex -35
-KPX W edieresis -35
-KPX W edotaccent -35
-KPX W egrave -35
-KPX W emacron -35
-KPX W eogonek -35
-KPX W hyphen -40
-KPX W o -60
-KPX W oacute -60
-KPX W ocircumflex -60
-KPX W odieresis -60
-KPX W ograve -60
-KPX W ohungarumlaut -60
-KPX W omacron -60
-KPX W oslash -60
-KPX W otilde -60
-KPX W period -80
-KPX W semicolon -10
-KPX W u -45
-KPX W uacute -45
-KPX W ucircumflex -45
-KPX W udieresis -45
-KPX W ugrave -45
-KPX W uhungarumlaut -45
-KPX W umacron -45
-KPX W uogonek -45
-KPX W uring -45
-KPX W y -20
-KPX W yacute -20
-KPX W ydieresis -20
-KPX Y A -110
-KPX Y Aacute -110
-KPX Y Abreve -110
-KPX Y Acircumflex -110
-KPX Y Adieresis -110
-KPX Y Agrave -110
-KPX Y Amacron -110
-KPX Y Aogonek -110
-KPX Y Aring -110
-KPX Y Atilde -110
-KPX Y O -70
-KPX Y Oacute -70
-KPX Y Ocircumflex -70
-KPX Y Odieresis -70
-KPX Y Ograve -70
-KPX Y Ohungarumlaut -70
-KPX Y Omacron -70
-KPX Y Oslash -70
-KPX Y Otilde -70
-KPX Y a -90
-KPX Y aacute -90
-KPX Y abreve -90
-KPX Y acircumflex -90
-KPX Y adieresis -90
-KPX Y agrave -90
-KPX Y amacron -90
-KPX Y aogonek -90
-KPX Y aring -90
-KPX Y atilde -90
-KPX Y colon -50
-KPX Y comma -100
-KPX Y e -80
-KPX Y eacute -80
-KPX Y ecaron -80
-KPX Y ecircumflex -80
-KPX Y edieresis -80
-KPX Y edotaccent -80
-KPX Y egrave -80
-KPX Y emacron -80
-KPX Y eogonek -80
-KPX Y o -100
-KPX Y oacute -100
-KPX Y ocircumflex -100
-KPX Y odieresis -100
-KPX Y ograve -100
-KPX Y ohungarumlaut -100
-KPX Y omacron -100
-KPX Y oslash -100
-KPX Y otilde -100
-KPX Y period -100
-KPX Y semicolon -50
-KPX Y u -100
-KPX Y uacute -100
-KPX Y ucircumflex -100
-KPX Y udieresis -100
-KPX Y ugrave -100
-KPX Y uhungarumlaut -100
-KPX Y umacron -100
-KPX Y uogonek -100
-KPX Y uring -100
-KPX Yacute A -110
-KPX Yacute Aacute -110
-KPX Yacute Abreve -110
-KPX Yacute Acircumflex -110
-KPX Yacute Adieresis -110
-KPX Yacute Agrave -110
-KPX Yacute Amacron -110
-KPX Yacute Aogonek -110
-KPX Yacute Aring -110
-KPX Yacute Atilde -110
-KPX Yacute O -70
-KPX Yacute Oacute -70
-KPX Yacute Ocircumflex -70
-KPX Yacute Odieresis -70
-KPX Yacute Ograve -70
-KPX Yacute Ohungarumlaut -70
-KPX Yacute Omacron -70
-KPX Yacute Oslash -70
-KPX Yacute Otilde -70
-KPX Yacute a -90
-KPX Yacute aacute -90
-KPX Yacute abreve -90
-KPX Yacute acircumflex -90
-KPX Yacute adieresis -90
-KPX Yacute agrave -90
-KPX Yacute amacron -90
-KPX Yacute aogonek -90
-KPX Yacute aring -90
-KPX Yacute atilde -90
-KPX Yacute colon -50
-KPX Yacute comma -100
-KPX Yacute e -80
-KPX Yacute eacute -80
-KPX Yacute ecaron -80
-KPX Yacute ecircumflex -80
-KPX Yacute edieresis -80
-KPX Yacute edotaccent -80
-KPX Yacute egrave -80
-KPX Yacute emacron -80
-KPX Yacute eogonek -80
-KPX Yacute o -100
-KPX Yacute oacute -100
-KPX Yacute ocircumflex -100
-KPX Yacute odieresis -100
-KPX Yacute ograve -100
-KPX Yacute ohungarumlaut -100
-KPX Yacute omacron -100
-KPX Yacute oslash -100
-KPX Yacute otilde -100
-KPX Yacute period -100
-KPX Yacute semicolon -50
-KPX Yacute u -100
-KPX Yacute uacute -100
-KPX Yacute ucircumflex -100
-KPX Yacute udieresis -100
-KPX Yacute ugrave -100
-KPX Yacute uhungarumlaut -100
-KPX Yacute umacron -100
-KPX Yacute uogonek -100
-KPX Yacute uring -100
-KPX Ydieresis A -110
-KPX Ydieresis Aacute -110
-KPX Ydieresis Abreve -110
-KPX Ydieresis Acircumflex -110
-KPX Ydieresis Adieresis -110
-KPX Ydieresis Agrave -110
-KPX Ydieresis Amacron -110
-KPX Ydieresis Aogonek -110
-KPX Ydieresis Aring -110
-KPX Ydieresis Atilde -110
-KPX Ydieresis O -70
-KPX Ydieresis Oacute -70
-KPX Ydieresis Ocircumflex -70
-KPX Ydieresis Odieresis -70
-KPX Ydieresis Ograve -70
-KPX Ydieresis Ohungarumlaut -70
-KPX Ydieresis Omacron -70
-KPX Ydieresis Oslash -70
-KPX Ydieresis Otilde -70
-KPX Ydieresis a -90
-KPX Ydieresis aacute -90
-KPX Ydieresis abreve -90
-KPX Ydieresis acircumflex -90
-KPX Ydieresis adieresis -90
-KPX Ydieresis agrave -90
-KPX Ydieresis amacron -90
-KPX Ydieresis aogonek -90
-KPX Ydieresis aring -90
-KPX Ydieresis atilde -90
-KPX Ydieresis colon -50
-KPX Ydieresis comma -100
-KPX Ydieresis e -80
-KPX Ydieresis eacute -80
-KPX Ydieresis ecaron -80
-KPX Ydieresis ecircumflex -80
-KPX Ydieresis edieresis -80
-KPX Ydieresis edotaccent -80
-KPX Ydieresis egrave -80
-KPX Ydieresis emacron -80
-KPX Ydieresis eogonek -80
-KPX Ydieresis o -100
-KPX Ydieresis oacute -100
-KPX Ydieresis ocircumflex -100
-KPX Ydieresis odieresis -100
-KPX Ydieresis ograve -100
-KPX Ydieresis ohungarumlaut -100
-KPX Ydieresis omacron -100
-KPX Ydieresis oslash -100
-KPX Ydieresis otilde -100
-KPX Ydieresis period -100
-KPX Ydieresis semicolon -50
-KPX Ydieresis u -100
-KPX Ydieresis uacute -100
-KPX Ydieresis ucircumflex -100
-KPX Ydieresis udieresis -100
-KPX Ydieresis ugrave -100
-KPX Ydieresis uhungarumlaut -100
-KPX Ydieresis umacron -100
-KPX Ydieresis uogonek -100
-KPX Ydieresis uring -100
-KPX a g -10
-KPX a gbreve -10
-KPX a gcommaaccent -10
-KPX a v -15
-KPX a w -15
-KPX a y -20
-KPX a yacute -20
-KPX a ydieresis -20
-KPX aacute g -10
-KPX aacute gbreve -10
-KPX aacute gcommaaccent -10
-KPX aacute v -15
-KPX aacute w -15
-KPX aacute y -20
-KPX aacute yacute -20
-KPX aacute ydieresis -20
-KPX abreve g -10
-KPX abreve gbreve -10
-KPX abreve gcommaaccent -10
-KPX abreve v -15
-KPX abreve w -15
-KPX abreve y -20
-KPX abreve yacute -20
-KPX abreve ydieresis -20
-KPX acircumflex g -10
-KPX acircumflex gbreve -10
-KPX acircumflex gcommaaccent -10
-KPX acircumflex v -15
-KPX acircumflex w -15
-KPX acircumflex y -20
-KPX acircumflex yacute -20
-KPX acircumflex ydieresis -20
-KPX adieresis g -10
-KPX adieresis gbreve -10
-KPX adieresis gcommaaccent -10
-KPX adieresis v -15
-KPX adieresis w -15
-KPX adieresis y -20
-KPX adieresis yacute -20
-KPX adieresis ydieresis -20
-KPX agrave g -10
-KPX agrave gbreve -10
-KPX agrave gcommaaccent -10
-KPX agrave v -15
-KPX agrave w -15
-KPX agrave y -20
-KPX agrave yacute -20
-KPX agrave ydieresis -20
-KPX amacron g -10
-KPX amacron gbreve -10
-KPX amacron gcommaaccent -10
-KPX amacron v -15
-KPX amacron w -15
-KPX amacron y -20
-KPX amacron yacute -20
-KPX amacron ydieresis -20
-KPX aogonek g -10
-KPX aogonek gbreve -10
-KPX aogonek gcommaaccent -10
-KPX aogonek v -15
-KPX aogonek w -15
-KPX aogonek y -20
-KPX aogonek yacute -20
-KPX aogonek ydieresis -20
-KPX aring g -10
-KPX aring gbreve -10
-KPX aring gcommaaccent -10
-KPX aring v -15
-KPX aring w -15
-KPX aring y -20
-KPX aring yacute -20
-KPX aring ydieresis -20
-KPX atilde g -10
-KPX atilde gbreve -10
-KPX atilde gcommaaccent -10
-KPX atilde v -15
-KPX atilde w -15
-KPX atilde y -20
-KPX atilde yacute -20
-KPX atilde ydieresis -20
-KPX b l -10
-KPX b lacute -10
-KPX b lcommaaccent -10
-KPX b lslash -10
-KPX b u -20
-KPX b uacute -20
-KPX b ucircumflex -20
-KPX b udieresis -20
-KPX b ugrave -20
-KPX b uhungarumlaut -20
-KPX b umacron -20
-KPX b uogonek -20
-KPX b uring -20
-KPX b v -20
-KPX b y -20
-KPX b yacute -20
-KPX b ydieresis -20
-KPX c h -10
-KPX c k -20
-KPX c kcommaaccent -20
-KPX c l -20
-KPX c lacute -20
-KPX c lcommaaccent -20
-KPX c lslash -20
-KPX c y -10
-KPX c yacute -10
-KPX c ydieresis -10
-KPX cacute h -10
-KPX cacute k -20
-KPX cacute kcommaaccent -20
-KPX cacute l -20
-KPX cacute lacute -20
-KPX cacute lcommaaccent -20
-KPX cacute lslash -20
-KPX cacute y -10
-KPX cacute yacute -10
-KPX cacute ydieresis -10
-KPX ccaron h -10
-KPX ccaron k -20
-KPX ccaron kcommaaccent -20
-KPX ccaron l -20
-KPX ccaron lacute -20
-KPX ccaron lcommaaccent -20
-KPX ccaron lslash -20
-KPX ccaron y -10
-KPX ccaron yacute -10
-KPX ccaron ydieresis -10
-KPX ccedilla h -10
-KPX ccedilla k -20
-KPX ccedilla kcommaaccent -20
-KPX ccedilla l -20
-KPX ccedilla lacute -20
-KPX ccedilla lcommaaccent -20
-KPX ccedilla lslash -20
-KPX ccedilla y -10
-KPX ccedilla yacute -10
-KPX ccedilla ydieresis -10
-KPX colon space -40
-KPX comma quotedblright -120
-KPX comma quoteright -120
-KPX comma space -40
-KPX d d -10
-KPX d dcroat -10
-KPX d v -15
-KPX d w -15
-KPX d y -15
-KPX d yacute -15
-KPX d ydieresis -15
-KPX dcroat d -10
-KPX dcroat dcroat -10
-KPX dcroat v -15
-KPX dcroat w -15
-KPX dcroat y -15
-KPX dcroat yacute -15
-KPX dcroat ydieresis -15
-KPX e comma 10
-KPX e period 20
-KPX e v -15
-KPX e w -15
-KPX e x -15
-KPX e y -15
-KPX e yacute -15
-KPX e ydieresis -15
-KPX eacute comma 10
-KPX eacute period 20
-KPX eacute v -15
-KPX eacute w -15
-KPX eacute x -15
-KPX eacute y -15
-KPX eacute yacute -15
-KPX eacute ydieresis -15
-KPX ecaron comma 10
-KPX ecaron period 20
-KPX ecaron v -15
-KPX ecaron w -15
-KPX ecaron x -15
-KPX ecaron y -15
-KPX ecaron yacute -15
-KPX ecaron ydieresis -15
-KPX ecircumflex comma 10
-KPX ecircumflex period 20
-KPX ecircumflex v -15
-KPX ecircumflex w -15
-KPX ecircumflex x -15
-KPX ecircumflex y -15
-KPX ecircumflex yacute -15
-KPX ecircumflex ydieresis -15
-KPX edieresis comma 10
-KPX edieresis period 20
-KPX edieresis v -15
-KPX edieresis w -15
-KPX edieresis x -15
-KPX edieresis y -15
-KPX edieresis yacute -15
-KPX edieresis ydieresis -15
-KPX edotaccent comma 10
-KPX edotaccent period 20
-KPX edotaccent v -15
-KPX edotaccent w -15
-KPX edotaccent x -15
-KPX edotaccent y -15
-KPX edotaccent yacute -15
-KPX edotaccent ydieresis -15
-KPX egrave comma 10
-KPX egrave period 20
-KPX egrave v -15
-KPX egrave w -15
-KPX egrave x -15
-KPX egrave y -15
-KPX egrave yacute -15
-KPX egrave ydieresis -15
-KPX emacron comma 10
-KPX emacron period 20
-KPX emacron v -15
-KPX emacron w -15
-KPX emacron x -15
-KPX emacron y -15
-KPX emacron yacute -15
-KPX emacron ydieresis -15
-KPX eogonek comma 10
-KPX eogonek period 20
-KPX eogonek v -15
-KPX eogonek w -15
-KPX eogonek x -15
-KPX eogonek y -15
-KPX eogonek yacute -15
-KPX eogonek ydieresis -15
-KPX f comma -10
-KPX f e -10
-KPX f eacute -10
-KPX f ecaron -10
-KPX f ecircumflex -10
-KPX f edieresis -10
-KPX f edotaccent -10
-KPX f egrave -10
-KPX f emacron -10
-KPX f eogonek -10
-KPX f o -20
-KPX f oacute -20
-KPX f ocircumflex -20
-KPX f odieresis -20
-KPX f ograve -20
-KPX f ohungarumlaut -20
-KPX f omacron -20
-KPX f oslash -20
-KPX f otilde -20
-KPX f period -10
-KPX f quotedblright 30
-KPX f quoteright 30
-KPX g e 10
-KPX g eacute 10
-KPX g ecaron 10
-KPX g ecircumflex 10
-KPX g edieresis 10
-KPX g edotaccent 10
-KPX g egrave 10
-KPX g emacron 10
-KPX g eogonek 10
-KPX g g -10
-KPX g gbreve -10
-KPX g gcommaaccent -10
-KPX gbreve e 10
-KPX gbreve eacute 10
-KPX gbreve ecaron 10
-KPX gbreve ecircumflex 10
-KPX gbreve edieresis 10
-KPX gbreve edotaccent 10
-KPX gbreve egrave 10
-KPX gbreve emacron 10
-KPX gbreve eogonek 10
-KPX gbreve g -10
-KPX gbreve gbreve -10
-KPX gbreve gcommaaccent -10
-KPX gcommaaccent e 10
-KPX gcommaaccent eacute 10
-KPX gcommaaccent ecaron 10
-KPX gcommaaccent ecircumflex 10
-KPX gcommaaccent edieresis 10
-KPX gcommaaccent edotaccent 10
-KPX gcommaaccent egrave 10
-KPX gcommaaccent emacron 10
-KPX gcommaaccent eogonek 10
-KPX gcommaaccent g -10
-KPX gcommaaccent gbreve -10
-KPX gcommaaccent gcommaaccent -10
-KPX h y -20
-KPX h yacute -20
-KPX h ydieresis -20
-KPX k o -15
-KPX k oacute -15
-KPX k ocircumflex -15
-KPX k odieresis -15
-KPX k ograve -15
-KPX k ohungarumlaut -15
-KPX k omacron -15
-KPX k oslash -15
-KPX k otilde -15
-KPX kcommaaccent o -15
-KPX kcommaaccent oacute -15
-KPX kcommaaccent ocircumflex -15
-KPX kcommaaccent odieresis -15
-KPX kcommaaccent ograve -15
-KPX kcommaaccent ohungarumlaut -15
-KPX kcommaaccent omacron -15
-KPX kcommaaccent oslash -15
-KPX kcommaaccent otilde -15
-KPX l w -15
-KPX l y -15
-KPX l yacute -15
-KPX l ydieresis -15
-KPX lacute w -15
-KPX lacute y -15
-KPX lacute yacute -15
-KPX lacute ydieresis -15
-KPX lcommaaccent w -15
-KPX lcommaaccent y -15
-KPX lcommaaccent yacute -15
-KPX lcommaaccent ydieresis -15
-KPX lslash w -15
-KPX lslash y -15
-KPX lslash yacute -15
-KPX lslash ydieresis -15
-KPX m u -20
-KPX m uacute -20
-KPX m ucircumflex -20
-KPX m udieresis -20
-KPX m ugrave -20
-KPX m uhungarumlaut -20
-KPX m umacron -20
-KPX m uogonek -20
-KPX m uring -20
-KPX m y -30
-KPX m yacute -30
-KPX m ydieresis -30
-KPX n u -10
-KPX n uacute -10
-KPX n ucircumflex -10
-KPX n udieresis -10
-KPX n ugrave -10
-KPX n uhungarumlaut -10
-KPX n umacron -10
-KPX n uogonek -10
-KPX n uring -10
-KPX n v -40
-KPX n y -20
-KPX n yacute -20
-KPX n ydieresis -20
-KPX nacute u -10
-KPX nacute uacute -10
-KPX nacute ucircumflex -10
-KPX nacute udieresis -10
-KPX nacute ugrave -10
-KPX nacute uhungarumlaut -10
-KPX nacute umacron -10
-KPX nacute uogonek -10
-KPX nacute uring -10
-KPX nacute v -40
-KPX nacute y -20
-KPX nacute yacute -20
-KPX nacute ydieresis -20
-KPX ncaron u -10
-KPX ncaron uacute -10
-KPX ncaron ucircumflex -10
-KPX ncaron udieresis -10
-KPX ncaron ugrave -10
-KPX ncaron uhungarumlaut -10
-KPX ncaron umacron -10
-KPX ncaron uogonek -10
-KPX ncaron uring -10
-KPX ncaron v -40
-KPX ncaron y -20
-KPX ncaron yacute -20
-KPX ncaron ydieresis -20
-KPX ncommaaccent u -10
-KPX ncommaaccent uacute -10
-KPX ncommaaccent ucircumflex -10
-KPX ncommaaccent udieresis -10
-KPX ncommaaccent ugrave -10
-KPX ncommaaccent uhungarumlaut -10
-KPX ncommaaccent umacron -10
-KPX ncommaaccent uogonek -10
-KPX ncommaaccent uring -10
-KPX ncommaaccent v -40
-KPX ncommaaccent y -20
-KPX ncommaaccent yacute -20
-KPX ncommaaccent ydieresis -20
-KPX ntilde u -10
-KPX ntilde uacute -10
-KPX ntilde ucircumflex -10
-KPX ntilde udieresis -10
-KPX ntilde ugrave -10
-KPX ntilde uhungarumlaut -10
-KPX ntilde umacron -10
-KPX ntilde uogonek -10
-KPX ntilde uring -10
-KPX ntilde v -40
-KPX ntilde y -20
-KPX ntilde yacute -20
-KPX ntilde ydieresis -20
-KPX o v -20
-KPX o w -15
-KPX o x -30
-KPX o y -20
-KPX o yacute -20
-KPX o ydieresis -20
-KPX oacute v -20
-KPX oacute w -15
-KPX oacute x -30
-KPX oacute y -20
-KPX oacute yacute -20
-KPX oacute ydieresis -20
-KPX ocircumflex v -20
-KPX ocircumflex w -15
-KPX ocircumflex x -30
-KPX ocircumflex y -20
-KPX ocircumflex yacute -20
-KPX ocircumflex ydieresis -20
-KPX odieresis v -20
-KPX odieresis w -15
-KPX odieresis x -30
-KPX odieresis y -20
-KPX odieresis yacute -20
-KPX odieresis ydieresis -20
-KPX ograve v -20
-KPX ograve w -15
-KPX ograve x -30
-KPX ograve y -20
-KPX ograve yacute -20
-KPX ograve ydieresis -20
-KPX ohungarumlaut v -20
-KPX ohungarumlaut w -15
-KPX ohungarumlaut x -30
-KPX ohungarumlaut y -20
-KPX ohungarumlaut yacute -20
-KPX ohungarumlaut ydieresis -20
-KPX omacron v -20
-KPX omacron w -15
-KPX omacron x -30
-KPX omacron y -20
-KPX omacron yacute -20
-KPX omacron ydieresis -20
-KPX oslash v -20
-KPX oslash w -15
-KPX oslash x -30
-KPX oslash y -20
-KPX oslash yacute -20
-KPX oslash ydieresis -20
-KPX otilde v -20
-KPX otilde w -15
-KPX otilde x -30
-KPX otilde y -20
-KPX otilde yacute -20
-KPX otilde ydieresis -20
-KPX p y -15
-KPX p yacute -15
-KPX p ydieresis -15
-KPX period quotedblright -120
-KPX period quoteright -120
-KPX period space -40
-KPX quotedblright space -80
-KPX quoteleft quoteleft -46
-KPX quoteright d -80
-KPX quoteright dcroat -80
-KPX quoteright l -20
-KPX quoteright lacute -20
-KPX quoteright lcommaaccent -20
-KPX quoteright lslash -20
-KPX quoteright quoteright -46
-KPX quoteright r -40
-KPX quoteright racute -40
-KPX quoteright rcaron -40
-KPX quoteright rcommaaccent -40
-KPX quoteright s -60
-KPX quoteright sacute -60
-KPX quoteright scaron -60
-KPX quoteright scedilla -60
-KPX quoteright scommaaccent -60
-KPX quoteright space -80
-KPX quoteright v -20
-KPX r c -20
-KPX r cacute -20
-KPX r ccaron -20
-KPX r ccedilla -20
-KPX r comma -60
-KPX r d -20
-KPX r dcroat -20
-KPX r g -15
-KPX r gbreve -15
-KPX r gcommaaccent -15
-KPX r hyphen -20
-KPX r o -20
-KPX r oacute -20
-KPX r ocircumflex -20
-KPX r odieresis -20
-KPX r ograve -20
-KPX r ohungarumlaut -20
-KPX r omacron -20
-KPX r oslash -20
-KPX r otilde -20
-KPX r period -60
-KPX r q -20
-KPX r s -15
-KPX r sacute -15
-KPX r scaron -15
-KPX r scedilla -15
-KPX r scommaaccent -15
-KPX r t 20
-KPX r tcommaaccent 20
-KPX r v 10
-KPX r y 10
-KPX r yacute 10
-KPX r ydieresis 10
-KPX racute c -20
-KPX racute cacute -20
-KPX racute ccaron -20
-KPX racute ccedilla -20
-KPX racute comma -60
-KPX racute d -20
-KPX racute dcroat -20
-KPX racute g -15
-KPX racute gbreve -15
-KPX racute gcommaaccent -15
-KPX racute hyphen -20
-KPX racute o -20
-KPX racute oacute -20
-KPX racute ocircumflex -20
-KPX racute odieresis -20
-KPX racute ograve -20
-KPX racute ohungarumlaut -20
-KPX racute omacron -20
-KPX racute oslash -20
-KPX racute otilde -20
-KPX racute period -60
-KPX racute q -20
-KPX racute s -15
-KPX racute sacute -15
-KPX racute scaron -15
-KPX racute scedilla -15
-KPX racute scommaaccent -15
-KPX racute t 20
-KPX racute tcommaaccent 20
-KPX racute v 10
-KPX racute y 10
-KPX racute yacute 10
-KPX racute ydieresis 10
-KPX rcaron c -20
-KPX rcaron cacute -20
-KPX rcaron ccaron -20
-KPX rcaron ccedilla -20
-KPX rcaron comma -60
-KPX rcaron d -20
-KPX rcaron dcroat -20
-KPX rcaron g -15
-KPX rcaron gbreve -15
-KPX rcaron gcommaaccent -15
-KPX rcaron hyphen -20
-KPX rcaron o -20
-KPX rcaron oacute -20
-KPX rcaron ocircumflex -20
-KPX rcaron odieresis -20
-KPX rcaron ograve -20
-KPX rcaron ohungarumlaut -20
-KPX rcaron omacron -20
-KPX rcaron oslash -20
-KPX rcaron otilde -20
-KPX rcaron period -60
-KPX rcaron q -20
-KPX rcaron s -15
-KPX rcaron sacute -15
-KPX rcaron scaron -15
-KPX rcaron scedilla -15
-KPX rcaron scommaaccent -15
-KPX rcaron t 20
-KPX rcaron tcommaaccent 20
-KPX rcaron v 10
-KPX rcaron y 10
-KPX rcaron yacute 10
-KPX rcaron ydieresis 10
-KPX rcommaaccent c -20
-KPX rcommaaccent cacute -20
-KPX rcommaaccent ccaron -20
-KPX rcommaaccent ccedilla -20
-KPX rcommaaccent comma -60
-KPX rcommaaccent d -20
-KPX rcommaaccent dcroat -20
-KPX rcommaaccent g -15
-KPX rcommaaccent gbreve -15
-KPX rcommaaccent gcommaaccent -15
-KPX rcommaaccent hyphen -20
-KPX rcommaaccent o -20
-KPX rcommaaccent oacute -20
-KPX rcommaaccent ocircumflex -20
-KPX rcommaaccent odieresis -20
-KPX rcommaaccent ograve -20
-KPX rcommaaccent ohungarumlaut -20
-KPX rcommaaccent omacron -20
-KPX rcommaaccent oslash -20
-KPX rcommaaccent otilde -20
-KPX rcommaaccent period -60
-KPX rcommaaccent q -20
-KPX rcommaaccent s -15
-KPX rcommaaccent sacute -15
-KPX rcommaaccent scaron -15
-KPX rcommaaccent scedilla -15
-KPX rcommaaccent scommaaccent -15
-KPX rcommaaccent t 20
-KPX rcommaaccent tcommaaccent 20
-KPX rcommaaccent v 10
-KPX rcommaaccent y 10
-KPX rcommaaccent yacute 10
-KPX rcommaaccent ydieresis 10
-KPX s w -15
-KPX sacute w -15
-KPX scaron w -15
-KPX scedilla w -15
-KPX scommaaccent w -15
-KPX semicolon space -40
-KPX space T -100
-KPX space Tcaron -100
-KPX space Tcommaaccent -100
-KPX space V -80
-KPX space W -80
-KPX space Y -120
-KPX space Yacute -120
-KPX space Ydieresis -120
-KPX space quotedblleft -80
-KPX space quoteleft -60
-KPX v a -20
-KPX v aacute -20
-KPX v abreve -20
-KPX v acircumflex -20
-KPX v adieresis -20
-KPX v agrave -20
-KPX v amacron -20
-KPX v aogonek -20
-KPX v aring -20
-KPX v atilde -20
-KPX v comma -80
-KPX v o -30
-KPX v oacute -30
-KPX v ocircumflex -30
-KPX v odieresis -30
-KPX v ograve -30
-KPX v ohungarumlaut -30
-KPX v omacron -30
-KPX v oslash -30
-KPX v otilde -30
-KPX v period -80
-KPX w comma -40
-KPX w o -20
-KPX w oacute -20
-KPX w ocircumflex -20
-KPX w odieresis -20
-KPX w ograve -20
-KPX w ohungarumlaut -20
-KPX w omacron -20
-KPX w oslash -20
-KPX w otilde -20
-KPX w period -40
-KPX x e -10
-KPX x eacute -10
-KPX x ecaron -10
-KPX x ecircumflex -10
-KPX x edieresis -10
-KPX x edotaccent -10
-KPX x egrave -10
-KPX x emacron -10
-KPX x eogonek -10
-KPX y a -30
-KPX y aacute -30
-KPX y abreve -30
-KPX y acircumflex -30
-KPX y adieresis -30
-KPX y agrave -30
-KPX y amacron -30
-KPX y aogonek -30
-KPX y aring -30
-KPX y atilde -30
-KPX y comma -80
-KPX y e -10
-KPX y eacute -10
-KPX y ecaron -10
-KPX y ecircumflex -10
-KPX y edieresis -10
-KPX y edotaccent -10
-KPX y egrave -10
-KPX y emacron -10
-KPX y eogonek -10
-KPX y o -25
-KPX y oacute -25
-KPX y ocircumflex -25
-KPX y odieresis -25
-KPX y ograve -25
-KPX y ohungarumlaut -25
-KPX y omacron -25
-KPX y oslash -25
-KPX y otilde -25
-KPX y period -80
-KPX yacute a -30
-KPX yacute aacute -30
-KPX yacute abreve -30
-KPX yacute acircumflex -30
-KPX yacute adieresis -30
-KPX yacute agrave -30
-KPX yacute amacron -30
-KPX yacute aogonek -30
-KPX yacute aring -30
-KPX yacute atilde -30
-KPX yacute comma -80
-KPX yacute e -10
-KPX yacute eacute -10
-KPX yacute ecaron -10
-KPX yacute ecircumflex -10
-KPX yacute edieresis -10
-KPX yacute edotaccent -10
-KPX yacute egrave -10
-KPX yacute emacron -10
-KPX yacute eogonek -10
-KPX yacute o -25
-KPX yacute oacute -25
-KPX yacute ocircumflex -25
-KPX yacute odieresis -25
-KPX yacute ograve -25
-KPX yacute ohungarumlaut -25
-KPX yacute omacron -25
-KPX yacute oslash -25
-KPX yacute otilde -25
-KPX yacute period -80
-KPX ydieresis a -30
-KPX ydieresis aacute -30
-KPX ydieresis abreve -30
-KPX ydieresis acircumflex -30
-KPX ydieresis adieresis -30
-KPX ydieresis agrave -30
-KPX ydieresis amacron -30
-KPX ydieresis aogonek -30
-KPX ydieresis aring -30
-KPX ydieresis atilde -30
-KPX ydieresis comma -80
-KPX ydieresis e -10
-KPX ydieresis eacute -10
-KPX ydieresis ecaron -10
-KPX ydieresis ecircumflex -10
-KPX ydieresis edieresis -10
-KPX ydieresis edotaccent -10
-KPX ydieresis egrave -10
-KPX ydieresis emacron -10
-KPX ydieresis eogonek -10
-KPX ydieresis o -25
-KPX ydieresis oacute -25
-KPX ydieresis ocircumflex -25
-KPX ydieresis odieresis -25
-KPX ydieresis ograve -25
-KPX ydieresis ohungarumlaut -25
-KPX ydieresis omacron -25
-KPX ydieresis oslash -25
-KPX ydieresis otilde -25
-KPX ydieresis period -80
-KPX z e 10
-KPX z eacute 10
-KPX z ecaron 10
-KPX z ecircumflex 10
-KPX z edieresis 10
-KPX z edotaccent 10
-KPX z egrave 10
-KPX z emacron 10
-KPX z eogonek 10
-KPX zacute e 10
-KPX zacute eacute 10
-KPX zacute ecaron 10
-KPX zacute ecircumflex 10
-KPX zacute edieresis 10
-KPX zacute edotaccent 10
-KPX zacute egrave 10
-KPX zacute emacron 10
-KPX zacute eogonek 10
-KPX zcaron e 10
-KPX zcaron eacute 10
-KPX zcaron ecaron 10
-KPX zcaron ecircumflex 10
-KPX zcaron edieresis 10
-KPX zcaron edotaccent 10
-KPX zcaron egrave 10
-KPX zcaron emacron 10
-KPX zcaron eogonek 10
-KPX zdotaccent e 10
-KPX zdotaccent eacute 10
-KPX zdotaccent ecaron 10
-KPX zdotaccent ecircumflex 10
-KPX zdotaccent edieresis 10
-KPX zdotaccent edotaccent 10
-KPX zdotaccent egrave 10
-KPX zdotaccent emacron 10
-KPX zdotaccent eogonek 10
-EndKernPairs
-EndKernData
-EndFontMetrics
-
diff --git a/LibrarySource/com/lowagie/text/pdf/fonts/Helvetica-BoldOblique.afm b/LibrarySource/com/lowagie/text/pdf/fonts/Helvetica-BoldOblique.afm
deleted file mode 100644
index b11f6c3..0000000
--- a/LibrarySource/com/lowagie/text/pdf/fonts/Helvetica-BoldOblique.afm
+++ /dev/null
@@ -1,2828 +0,0 @@
-StartFontMetrics 4.1
-Comment Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved.
-Comment Creation Date: Thu May 1 12:45:12 1997
-Comment UniqueID 43053
-Comment VMusage 14482 68586
-FontName Helvetica-BoldOblique
-FullName Helvetica Bold Oblique
-FamilyName Helvetica
-Weight Bold
-ItalicAngle -12
-IsFixedPitch false
-CharacterSet ExtendedRoman
-FontBBox -174 -228 1114 962
-UnderlinePosition -100
-UnderlineThickness 50
-Version 002.000
-Notice Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved.Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries.
-EncodingScheme AdobeStandardEncoding
-CapHeight 718
-XHeight 532
-Ascender 718
-Descender -207
-StdHW 118
-StdVW 140
-StartCharMetrics 315
-C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
-C 33 ; WX 333 ; N exclam ; B 94 0 397 718 ;
-C 34 ; WX 474 ; N quotedbl ; B 193 447 529 718 ;
-C 35 ; WX 556 ; N numbersign ; B 60 0 644 698 ;
-C 36 ; WX 556 ; N dollar ; B 67 -115 622 775 ;
-C 37 ; WX 889 ; N percent ; B 136 -19 901 710 ;
-C 38 ; WX 722 ; N ampersand ; B 89 -19 732 718 ;
-C 39 ; WX 278 ; N quoteright ; B 167 445 362 718 ;
-C 40 ; WX 333 ; N parenleft ; B 76 -208 470 734 ;
-C 41 ; WX 333 ; N parenright ; B -25 -208 369 734 ;
-C 42 ; WX 389 ; N asterisk ; B 146 387 481 718 ;
-C 43 ; WX 584 ; N plus ; B 82 0 610 506 ;
-C 44 ; WX 278 ; N comma ; B 28 -168 245 146 ;
-C 45 ; WX 333 ; N hyphen ; B 73 215 379 345 ;
-C 46 ; WX 278 ; N period ; B 64 0 245 146 ;
-C 47 ; WX 278 ; N slash ; B -37 -19 468 737 ;
-C 48 ; WX 556 ; N zero ; B 86 -19 617 710 ;
-C 49 ; WX 556 ; N one ; B 173 0 529 710 ;
-C 50 ; WX 556 ; N two ; B 26 0 619 710 ;
-C 51 ; WX 556 ; N three ; B 65 -19 608 710 ;
-C 52 ; WX 556 ; N four ; B 60 0 598 710 ;
-C 53 ; WX 556 ; N five ; B 64 -19 636 698 ;
-C 54 ; WX 556 ; N six ; B 85 -19 619 710 ;
-C 55 ; WX 556 ; N seven ; B 125 0 676 698 ;
-C 56 ; WX 556 ; N eight ; B 69 -19 616 710 ;
-C 57 ; WX 556 ; N nine ; B 78 -19 615 710 ;
-C 58 ; WX 333 ; N colon ; B 92 0 351 512 ;
-C 59 ; WX 333 ; N semicolon ; B 56 -168 351 512 ;
-C 60 ; WX 584 ; N less ; B 82 -8 655 514 ;
-C 61 ; WX 584 ; N equal ; B 58 87 633 419 ;
-C 62 ; WX 584 ; N greater ; B 36 -8 609 514 ;
-C 63 ; WX 611 ; N question ; B 165 0 671 727 ;
-C 64 ; WX 975 ; N at ; B 186 -19 954 737 ;
-C 65 ; WX 722 ; N A ; B 20 0 702 718 ;
-C 66 ; WX 722 ; N B ; B 76 0 764 718 ;
-C 67 ; WX 722 ; N C ; B 107 -19 789 737 ;
-C 68 ; WX 722 ; N D ; B 76 0 777 718 ;
-C 69 ; WX 667 ; N E ; B 76 0 757 718 ;
-C 70 ; WX 611 ; N F ; B 76 0 740 718 ;
-C 71 ; WX 778 ; N G ; B 108 -19 817 737 ;
-C 72 ; WX 722 ; N H ; B 71 0 804 718 ;
-C 73 ; WX 278 ; N I ; B 64 0 367 718 ;
-C 74 ; WX 556 ; N J ; B 60 -18 637 718 ;
-C 75 ; WX 722 ; N K ; B 87 0 858 718 ;
-C 76 ; WX 611 ; N L ; B 76 0 611 718 ;
-C 77 ; WX 833 ; N M ; B 69 0 918 718 ;
-C 78 ; WX 722 ; N N ; B 69 0 807 718 ;
-C 79 ; WX 778 ; N O ; B 107 -19 823 737 ;
-C 80 ; WX 667 ; N P ; B 76 0 738 718 ;
-C 81 ; WX 778 ; N Q ; B 107 -52 823 737 ;
-C 82 ; WX 722 ; N R ; B 76 0 778 718 ;
-C 83 ; WX 667 ; N S ; B 81 -19 718 737 ;
-C 84 ; WX 611 ; N T ; B 140 0 751 718 ;
-C 85 ; WX 722 ; N U ; B 116 -19 804 718 ;
-C 86 ; WX 667 ; N V ; B 172 0 801 718 ;
-C 87 ; WX 944 ; N W ; B 169 0 1082 718 ;
-C 88 ; WX 667 ; N X ; B 14 0 791 718 ;
-C 89 ; WX 667 ; N Y ; B 168 0 806 718 ;
-C 90 ; WX 611 ; N Z ; B 25 0 737 718 ;
-C 91 ; WX 333 ; N bracketleft ; B 21 -196 462 722 ;
-C 92 ; WX 278 ; N backslash ; B 124 -19 307 737 ;
-C 93 ; WX 333 ; N bracketright ; B -18 -196 423 722 ;
-C 94 ; WX 584 ; N asciicircum ; B 131 323 591 698 ;
-C 95 ; WX 556 ; N underscore ; B -27 -125 540 -75 ;
-C 96 ; WX 278 ; N quoteleft ; B 165 454 361 727 ;
-C 97 ; WX 556 ; N a ; B 55 -14 583 546 ;
-C 98 ; WX 611 ; N b ; B 61 -14 645 718 ;
-C 99 ; WX 556 ; N c ; B 79 -14 599 546 ;
-C 100 ; WX 611 ; N d ; B 82 -14 704 718 ;
-C 101 ; WX 556 ; N e ; B 70 -14 593 546 ;
-C 102 ; WX 333 ; N f ; B 87 0 469 727 ; L i fi ; L l fl ;
-C 103 ; WX 611 ; N g ; B 38 -217 666 546 ;
-C 104 ; WX 611 ; N h ; B 65 0 629 718 ;
-C 105 ; WX 278 ; N i ; B 69 0 363 725 ;
-C 106 ; WX 278 ; N j ; B -42 -214 363 725 ;
-C 107 ; WX 556 ; N k ; B 69 0 670 718 ;
-C 108 ; WX 278 ; N l ; B 69 0 362 718 ;
-C 109 ; WX 889 ; N m ; B 64 0 909 546 ;
-C 110 ; WX 611 ; N n ; B 65 0 629 546 ;
-C 111 ; WX 611 ; N o ; B 82 -14 643 546 ;
-C 112 ; WX 611 ; N p ; B 18 -207 645 546 ;
-C 113 ; WX 611 ; N q ; B 80 -207 665 546 ;
-C 114 ; WX 389 ; N r ; B 64 0 489 546 ;
-C 115 ; WX 556 ; N s ; B 63 -14 584 546 ;
-C 116 ; WX 333 ; N t ; B 100 -6 422 676 ;
-C 117 ; WX 611 ; N u ; B 98 -14 658 532 ;
-C 118 ; WX 556 ; N v ; B 126 0 656 532 ;
-C 119 ; WX 778 ; N w ; B 123 0 882 532 ;
-C 120 ; WX 556 ; N x ; B 15 0 648 532 ;
-C 121 ; WX 556 ; N y ; B 42 -214 652 532 ;
-C 122 ; WX 500 ; N z ; B 20 0 583 532 ;
-C 123 ; WX 389 ; N braceleft ; B 94 -196 518 722 ;
-C 124 ; WX 280 ; N bar ; B 36 -225 361 775 ;
-C 125 ; WX 389 ; N braceright ; B -18 -196 407 722 ;
-C 126 ; WX 584 ; N asciitilde ; B 115 163 577 343 ;
-C 161 ; WX 333 ; N exclamdown ; B 50 -186 353 532 ;
-C 162 ; WX 556 ; N cent ; B 79 -118 599 628 ;
-C 163 ; WX 556 ; N sterling ; B 50 -16 635 718 ;
-C 164 ; WX 167 ; N fraction ; B -174 -19 487 710 ;
-C 165 ; WX 556 ; N yen ; B 60 0 713 698 ;
-C 166 ; WX 556 ; N florin ; B -50 -210 669 737 ;
-C 167 ; WX 556 ; N section ; B 61 -184 598 727 ;
-C 168 ; WX 556 ; N currency ; B 27 76 680 636 ;
-C 169 ; WX 238 ; N quotesingle ; B 165 447 321 718 ;
-C 170 ; WX 500 ; N quotedblleft ; B 160 454 588 727 ;
-C 171 ; WX 556 ; N guillemotleft ; B 135 76 571 484 ;
-C 172 ; WX 333 ; N guilsinglleft ; B 130 76 353 484 ;
-C 173 ; WX 333 ; N guilsinglright ; B 99 76 322 484 ;
-C 174 ; WX 611 ; N fi ; B 87 0 696 727 ;
-C 175 ; WX 611 ; N fl ; B 87 0 695 727 ;
-C 177 ; WX 556 ; N endash ; B 48 227 627 333 ;
-C 178 ; WX 556 ; N dagger ; B 118 -171 626 718 ;
-C 179 ; WX 556 ; N daggerdbl ; B 46 -171 628 718 ;
-C 180 ; WX 278 ; N periodcentered ; B 110 172 276 334 ;
-C 182 ; WX 556 ; N paragraph ; B 98 -191 688 700 ;
-C 183 ; WX 350 ; N bullet ; B 83 194 420 524 ;
-C 184 ; WX 278 ; N quotesinglbase ; B 41 -146 236 127 ;
-C 185 ; WX 500 ; N quotedblbase ; B 36 -146 463 127 ;
-C 186 ; WX 500 ; N quotedblright ; B 162 445 589 718 ;
-C 187 ; WX 556 ; N guillemotright ; B 104 76 540 484 ;
-C 188 ; WX 1000 ; N ellipsis ; B 92 0 939 146 ;
-C 189 ; WX 1000 ; N perthousand ; B 76 -19 1038 710 ;
-C 191 ; WX 611 ; N questiondown ; B 53 -195 559 532 ;
-C 193 ; WX 333 ; N grave ; B 136 604 353 750 ;
-C 194 ; WX 333 ; N acute ; B 236 604 515 750 ;
-C 195 ; WX 333 ; N circumflex ; B 118 604 471 750 ;
-C 196 ; WX 333 ; N tilde ; B 113 610 507 737 ;
-C 197 ; WX 333 ; N macron ; B 122 604 483 678 ;
-C 198 ; WX 333 ; N breve ; B 156 604 494 750 ;
-C 199 ; WX 333 ; N dotaccent ; B 235 614 385 729 ;
-C 200 ; WX 333 ; N dieresis ; B 137 614 482 729 ;
-C 202 ; WX 333 ; N ring ; B 200 568 420 776 ;
-C 203 ; WX 333 ; N cedilla ; B -37 -228 220 0 ;
-C 205 ; WX 333 ; N hungarumlaut ; B 137 604 645 750 ;
-C 206 ; WX 333 ; N ogonek ; B 41 -228 264 0 ;
-C 207 ; WX 333 ; N caron ; B 149 604 502 750 ;
-C 208 ; WX 1000 ; N emdash ; B 48 227 1071 333 ;
-C 225 ; WX 1000 ; N AE ; B 5 0 1100 718 ;
-C 227 ; WX 370 ; N ordfeminine ; B 125 401 465 737 ;
-C 232 ; WX 611 ; N Lslash ; B 34 0 611 718 ;
-C 233 ; WX 778 ; N Oslash ; B 35 -27 894 745 ;
-C 234 ; WX 1000 ; N OE ; B 99 -19 1114 737 ;
-C 235 ; WX 365 ; N ordmasculine ; B 123 401 485 737 ;
-C 241 ; WX 889 ; N ae ; B 56 -14 923 546 ;
-C 245 ; WX 278 ; N dotlessi ; B 69 0 322 532 ;
-C 248 ; WX 278 ; N lslash ; B 40 0 407 718 ;
-C 249 ; WX 611 ; N oslash ; B 22 -29 701 560 ;
-C 250 ; WX 944 ; N oe ; B 82 -14 977 546 ;
-C 251 ; WX 611 ; N germandbls ; B 69 -14 657 731 ;
-C -1 ; WX 278 ; N Idieresis ; B 64 0 494 915 ;
-C -1 ; WX 556 ; N eacute ; B 70 -14 627 750 ;
-C -1 ; WX 556 ; N abreve ; B 55 -14 606 750 ;
-C -1 ; WX 611 ; N uhungarumlaut ; B 98 -14 784 750 ;
-C -1 ; WX 556 ; N ecaron ; B 70 -14 614 750 ;
-C -1 ; WX 667 ; N Ydieresis ; B 168 0 806 915 ;
-C -1 ; WX 584 ; N divide ; B 82 -42 610 548 ;
-C -1 ; WX 667 ; N Yacute ; B 168 0 806 936 ;
-C -1 ; WX 722 ; N Acircumflex ; B 20 0 706 936 ;
-C -1 ; WX 556 ; N aacute ; B 55 -14 627 750 ;
-C -1 ; WX 722 ; N Ucircumflex ; B 116 -19 804 936 ;
-C -1 ; WX 556 ; N yacute ; B 42 -214 652 750 ;
-C -1 ; WX 556 ; N scommaaccent ; B 63 -228 584 546 ;
-C -1 ; WX 556 ; N ecircumflex ; B 70 -14 593 750 ;
-C -1 ; WX 722 ; N Uring ; B 116 -19 804 962 ;
-C -1 ; WX 722 ; N Udieresis ; B 116 -19 804 915 ;
-C -1 ; WX 556 ; N aogonek ; B 55 -224 583 546 ;
-C -1 ; WX 722 ; N Uacute ; B 116 -19 804 936 ;
-C -1 ; WX 611 ; N uogonek ; B 98 -228 658 532 ;
-C -1 ; WX 667 ; N Edieresis ; B 76 0 757 915 ;
-C -1 ; WX 722 ; N Dcroat ; B 62 0 777 718 ;
-C -1 ; WX 250 ; N commaaccent ; B 16 -228 188 -50 ;
-C -1 ; WX 737 ; N copyright ; B 56 -19 835 737 ;
-C -1 ; WX 667 ; N Emacron ; B 76 0 757 864 ;
-C -1 ; WX 556 ; N ccaron ; B 79 -14 614 750 ;
-C -1 ; WX 556 ; N aring ; B 55 -14 583 776 ;
-C -1 ; WX 722 ; N Ncommaaccent ; B 69 -228 807 718 ;
-C -1 ; WX 278 ; N lacute ; B 69 0 528 936 ;
-C -1 ; WX 556 ; N agrave ; B 55 -14 583 750 ;
-C -1 ; WX 611 ; N Tcommaaccent ; B 140 -228 751 718 ;
-C -1 ; WX 722 ; N Cacute ; B 107 -19 789 936 ;
-C -1 ; WX 556 ; N atilde ; B 55 -14 619 737 ;
-C -1 ; WX 667 ; N Edotaccent ; B 76 0 757 915 ;
-C -1 ; WX 556 ; N scaron ; B 63 -14 614 750 ;
-C -1 ; WX 556 ; N scedilla ; B 63 -228 584 546 ;
-C -1 ; WX 278 ; N iacute ; B 69 0 488 750 ;
-C -1 ; WX 494 ; N lozenge ; B 90 0 564 745 ;
-C -1 ; WX 722 ; N Rcaron ; B 76 0 778 936 ;
-C -1 ; WX 778 ; N Gcommaaccent ; B 108 -228 817 737 ;
-C -1 ; WX 611 ; N ucircumflex ; B 98 -14 658 750 ;
-C -1 ; WX 556 ; N acircumflex ; B 55 -14 583 750 ;
-C -1 ; WX 722 ; N Amacron ; B 20 0 718 864 ;
-C -1 ; WX 389 ; N rcaron ; B 64 0 530 750 ;
-C -1 ; WX 556 ; N ccedilla ; B 79 -228 599 546 ;
-C -1 ; WX 611 ; N Zdotaccent ; B 25 0 737 915 ;
-C -1 ; WX 667 ; N Thorn ; B 76 0 716 718 ;
-C -1 ; WX 778 ; N Omacron ; B 107 -19 823 864 ;
-C -1 ; WX 722 ; N Racute ; B 76 0 778 936 ;
-C -1 ; WX 667 ; N Sacute ; B 81 -19 722 936 ;
-C -1 ; WX 743 ; N dcaron ; B 82 -14 903 718 ;
-C -1 ; WX 722 ; N Umacron ; B 116 -19 804 864 ;
-C -1 ; WX 611 ; N uring ; B 98 -14 658 776 ;
-C -1 ; WX 333 ; N threesuperior ; B 91 271 441 710 ;
-C -1 ; WX 778 ; N Ograve ; B 107 -19 823 936 ;
-C -1 ; WX 722 ; N Agrave ; B 20 0 702 936 ;
-C -1 ; WX 722 ; N Abreve ; B 20 0 729 936 ;
-C -1 ; WX 584 ; N multiply ; B 57 1 635 505 ;
-C -1 ; WX 611 ; N uacute ; B 98 -14 658 750 ;
-C -1 ; WX 611 ; N Tcaron ; B 140 0 751 936 ;
-C -1 ; WX 494 ; N partialdiff ; B 43 -21 585 750 ;
-C -1 ; WX 556 ; N ydieresis ; B 42 -214 652 729 ;
-C -1 ; WX 722 ; N Nacute ; B 69 0 807 936 ;
-C -1 ; WX 278 ; N icircumflex ; B 69 0 444 750 ;
-C -1 ; WX 667 ; N Ecircumflex ; B 76 0 757 936 ;
-C -1 ; WX 556 ; N adieresis ; B 55 -14 594 729 ;
-C -1 ; WX 556 ; N edieresis ; B 70 -14 594 729 ;
-C -1 ; WX 556 ; N cacute ; B 79 -14 627 750 ;
-C -1 ; WX 611 ; N nacute ; B 65 0 654 750 ;
-C -1 ; WX 611 ; N umacron ; B 98 -14 658 678 ;
-C -1 ; WX 722 ; N Ncaron ; B 69 0 807 936 ;
-C -1 ; WX 278 ; N Iacute ; B 64 0 528 936 ;
-C -1 ; WX 584 ; N plusminus ; B 40 0 625 506 ;
-C -1 ; WX 280 ; N brokenbar ; B 52 -150 345 700 ;
-C -1 ; WX 737 ; N registered ; B 55 -19 834 737 ;
-C -1 ; WX 778 ; N Gbreve ; B 108 -19 817 936 ;
-C -1 ; WX 278 ; N Idotaccent ; B 64 0 397 915 ;
-C -1 ; WX 600 ; N summation ; B 14 -10 670 706 ;
-C -1 ; WX 667 ; N Egrave ; B 76 0 757 936 ;
-C -1 ; WX 389 ; N racute ; B 64 0 543 750 ;
-C -1 ; WX 611 ; N omacron ; B 82 -14 643 678 ;
-C -1 ; WX 611 ; N Zacute ; B 25 0 737 936 ;
-C -1 ; WX 611 ; N Zcaron ; B 25 0 737 936 ;
-C -1 ; WX 549 ; N greaterequal ; B 26 0 629 704 ;
-C -1 ; WX 722 ; N Eth ; B 62 0 777 718 ;
-C -1 ; WX 722 ; N Ccedilla ; B 107 -228 789 737 ;
-C -1 ; WX 278 ; N lcommaaccent ; B 30 -228 362 718 ;
-C -1 ; WX 389 ; N tcaron ; B 100 -6 608 878 ;
-C -1 ; WX 556 ; N eogonek ; B 70 -228 593 546 ;
-C -1 ; WX 722 ; N Uogonek ; B 116 -228 804 718 ;
-C -1 ; WX 722 ; N Aacute ; B 20 0 750 936 ;
-C -1 ; WX 722 ; N Adieresis ; B 20 0 716 915 ;
-C -1 ; WX 556 ; N egrave ; B 70 -14 593 750 ;
-C -1 ; WX 500 ; N zacute ; B 20 0 599 750 ;
-C -1 ; WX 278 ; N iogonek ; B -14 -224 363 725 ;
-C -1 ; WX 778 ; N Oacute ; B 107 -19 823 936 ;
-C -1 ; WX 611 ; N oacute ; B 82 -14 654 750 ;
-C -1 ; WX 556 ; N amacron ; B 55 -14 595 678 ;
-C -1 ; WX 556 ; N sacute ; B 63 -14 627 750 ;
-C -1 ; WX 278 ; N idieresis ; B 69 0 455 729 ;
-C -1 ; WX 778 ; N Ocircumflex ; B 107 -19 823 936 ;
-C -1 ; WX 722 ; N Ugrave ; B 116 -19 804 936 ;
-C -1 ; WX 612 ; N Delta ; B 6 0 608 688 ;
-C -1 ; WX 611 ; N thorn ; B 18 -208 645 718 ;
-C -1 ; WX 333 ; N twosuperior ; B 69 283 449 710 ;
-C -1 ; WX 778 ; N Odieresis ; B 107 -19 823 915 ;
-C -1 ; WX 611 ; N mu ; B 22 -207 658 532 ;
-C -1 ; WX 278 ; N igrave ; B 69 0 326 750 ;
-C -1 ; WX 611 ; N ohungarumlaut ; B 82 -14 784 750 ;
-C -1 ; WX 667 ; N Eogonek ; B 76 -224 757 718 ;
-C -1 ; WX 611 ; N dcroat ; B 82 -14 789 718 ;
-C -1 ; WX 834 ; N threequarters ; B 99 -19 839 710 ;
-C -1 ; WX 667 ; N Scedilla ; B 81 -228 718 737 ;
-C -1 ; WX 400 ; N lcaron ; B 69 0 561 718 ;
-C -1 ; WX 722 ; N Kcommaaccent ; B 87 -228 858 718 ;
-C -1 ; WX 611 ; N Lacute ; B 76 0 611 936 ;
-C -1 ; WX 1000 ; N trademark ; B 179 306 1109 718 ;
-C -1 ; WX 556 ; N edotaccent ; B 70 -14 593 729 ;
-C -1 ; WX 278 ; N Igrave ; B 64 0 367 936 ;
-C -1 ; WX 278 ; N Imacron ; B 64 0 496 864 ;
-C -1 ; WX 611 ; N Lcaron ; B 76 0 643 718 ;
-C -1 ; WX 834 ; N onehalf ; B 132 -19 858 710 ;
-C -1 ; WX 549 ; N lessequal ; B 29 0 676 704 ;
-C -1 ; WX 611 ; N ocircumflex ; B 82 -14 643 750 ;
-C -1 ; WX 611 ; N ntilde ; B 65 0 646 737 ;
-C -1 ; WX 722 ; N Uhungarumlaut ; B 116 -19 880 936 ;
-C -1 ; WX 667 ; N Eacute ; B 76 0 757 936 ;
-C -1 ; WX 556 ; N emacron ; B 70 -14 595 678 ;
-C -1 ; WX 611 ; N gbreve ; B 38 -217 666 750 ;
-C -1 ; WX 834 ; N onequarter ; B 132 -19 806 710 ;
-C -1 ; WX 667 ; N Scaron ; B 81 -19 718 936 ;
-C -1 ; WX 667 ; N Scommaaccent ; B 81 -228 718 737 ;
-C -1 ; WX 778 ; N Ohungarumlaut ; B 107 -19 908 936 ;
-C -1 ; WX 400 ; N degree ; B 175 426 467 712 ;
-C -1 ; WX 611 ; N ograve ; B 82 -14 643 750 ;
-C -1 ; WX 722 ; N Ccaron ; B 107 -19 789 936 ;
-C -1 ; WX 611 ; N ugrave ; B 98 -14 658 750 ;
-C -1 ; WX 549 ; N radical ; B 112 -46 689 850 ;
-C -1 ; WX 722 ; N Dcaron ; B 76 0 777 936 ;
-C -1 ; WX 389 ; N rcommaaccent ; B 26 -228 489 546 ;
-C -1 ; WX 722 ; N Ntilde ; B 69 0 807 923 ;
-C -1 ; WX 611 ; N otilde ; B 82 -14 646 737 ;
-C -1 ; WX 722 ; N Rcommaaccent ; B 76 -228 778 718 ;
-C -1 ; WX 611 ; N Lcommaaccent ; B 76 -228 611 718 ;
-C -1 ; WX 722 ; N Atilde ; B 20 0 741 923 ;
-C -1 ; WX 722 ; N Aogonek ; B 20 -224 702 718 ;
-C -1 ; WX 722 ; N Aring ; B 20 0 702 962 ;
-C -1 ; WX 778 ; N Otilde ; B 107 -19 823 923 ;
-C -1 ; WX 500 ; N zdotaccent ; B 20 0 583 729 ;
-C -1 ; WX 667 ; N Ecaron ; B 76 0 757 936 ;
-C -1 ; WX 278 ; N Iogonek ; B -41 -228 367 718 ;
-C -1 ; WX 556 ; N kcommaaccent ; B 69 -228 670 718 ;
-C -1 ; WX 584 ; N minus ; B 82 197 610 309 ;
-C -1 ; WX 278 ; N Icircumflex ; B 64 0 484 936 ;
-C -1 ; WX 611 ; N ncaron ; B 65 0 641 750 ;
-C -1 ; WX 333 ; N tcommaaccent ; B 58 -228 422 676 ;
-C -1 ; WX 584 ; N logicalnot ; B 105 108 633 419 ;
-C -1 ; WX 611 ; N odieresis ; B 82 -14 643 729 ;
-C -1 ; WX 611 ; N udieresis ; B 98 -14 658 729 ;
-C -1 ; WX 549 ; N notequal ; B 32 -49 630 570 ;
-C -1 ; WX 611 ; N gcommaaccent ; B 38 -217 666 850 ;
-C -1 ; WX 611 ; N eth ; B 82 -14 670 737 ;
-C -1 ; WX 500 ; N zcaron ; B 20 0 586 750 ;
-C -1 ; WX 611 ; N ncommaaccent ; B 65 -228 629 546 ;
-C -1 ; WX 333 ; N onesuperior ; B 148 283 388 710 ;
-C -1 ; WX 278 ; N imacron ; B 69 0 429 678 ;
-C -1 ; WX 556 ; N Euro ; B 0 0 0 0 ;
-EndCharMetrics
-StartKernData
-StartKernPairs 2481
-KPX A C -40
-KPX A Cacute -40
-KPX A Ccaron -40
-KPX A Ccedilla -40
-KPX A G -50
-KPX A Gbreve -50
-KPX A Gcommaaccent -50
-KPX A O -40
-KPX A Oacute -40
-KPX A Ocircumflex -40
-KPX A Odieresis -40
-KPX A Ograve -40
-KPX A Ohungarumlaut -40
-KPX A Omacron -40
-KPX A Oslash -40
-KPX A Otilde -40
-KPX A Q -40
-KPX A T -90
-KPX A Tcaron -90
-KPX A Tcommaaccent -90
-KPX A U -50
-KPX A Uacute -50
-KPX A Ucircumflex -50
-KPX A Udieresis -50
-KPX A Ugrave -50
-KPX A Uhungarumlaut -50
-KPX A Umacron -50
-KPX A Uogonek -50
-KPX A Uring -50
-KPX A V -80
-KPX A W -60
-KPX A Y -110
-KPX A Yacute -110
-KPX A Ydieresis -110
-KPX A u -30
-KPX A uacute -30
-KPX A ucircumflex -30
-KPX A udieresis -30
-KPX A ugrave -30
-KPX A uhungarumlaut -30
-KPX A umacron -30
-KPX A uogonek -30
-KPX A uring -30
-KPX A v -40
-KPX A w -30
-KPX A y -30
-KPX A yacute -30
-KPX A ydieresis -30
-KPX Aacute C -40
-KPX Aacute Cacute -40
-KPX Aacute Ccaron -40
-KPX Aacute Ccedilla -40
-KPX Aacute G -50
-KPX Aacute Gbreve -50
-KPX Aacute Gcommaaccent -50
-KPX Aacute O -40
-KPX Aacute Oacute -40
-KPX Aacute Ocircumflex -40
-KPX Aacute Odieresis -40
-KPX Aacute Ograve -40
-KPX Aacute Ohungarumlaut -40
-KPX Aacute Omacron -40
-KPX Aacute Oslash -40
-KPX Aacute Otilde -40
-KPX Aacute Q -40
-KPX Aacute T -90
-KPX Aacute Tcaron -90
-KPX Aacute Tcommaaccent -90
-KPX Aacute U -50
-KPX Aacute Uacute -50
-KPX Aacute Ucircumflex -50
-KPX Aacute Udieresis -50
-KPX Aacute Ugrave -50
-KPX Aacute Uhungarumlaut -50
-KPX Aacute Umacron -50
-KPX Aacute Uogonek -50
-KPX Aacute Uring -50
-KPX Aacute V -80
-KPX Aacute W -60
-KPX Aacute Y -110
-KPX Aacute Yacute -110
-KPX Aacute Ydieresis -110
-KPX Aacute u -30
-KPX Aacute uacute -30
-KPX Aacute ucircumflex -30
-KPX Aacute udieresis -30
-KPX Aacute ugrave -30
-KPX Aacute uhungarumlaut -30
-KPX Aacute umacron -30
-KPX Aacute uogonek -30
-KPX Aacute uring -30
-KPX Aacute v -40
-KPX Aacute w -30
-KPX Aacute y -30
-KPX Aacute yacute -30
-KPX Aacute ydieresis -30
-KPX Abreve C -40
-KPX Abreve Cacute -40
-KPX Abreve Ccaron -40
-KPX Abreve Ccedilla -40
-KPX Abreve G -50
-KPX Abreve Gbreve -50
-KPX Abreve Gcommaaccent -50
-KPX Abreve O -40
-KPX Abreve Oacute -40
-KPX Abreve Ocircumflex -40
-KPX Abreve Odieresis -40
-KPX Abreve Ograve -40
-KPX Abreve Ohungarumlaut -40
-KPX Abreve Omacron -40
-KPX Abreve Oslash -40
-KPX Abreve Otilde -40
-KPX Abreve Q -40
-KPX Abreve T -90
-KPX Abreve Tcaron -90
-KPX Abreve Tcommaaccent -90
-KPX Abreve U -50
-KPX Abreve Uacute -50
-KPX Abreve Ucircumflex -50
-KPX Abreve Udieresis -50
-KPX Abreve Ugrave -50
-KPX Abreve Uhungarumlaut -50
-KPX Abreve Umacron -50
-KPX Abreve Uogonek -50
-KPX Abreve Uring -50
-KPX Abreve V -80
-KPX Abreve W -60
-KPX Abreve Y -110
-KPX Abreve Yacute -110
-KPX Abreve Ydieresis -110
-KPX Abreve u -30
-KPX Abreve uacute -30
-KPX Abreve ucircumflex -30
-KPX Abreve udieresis -30
-KPX Abreve ugrave -30
-KPX Abreve uhungarumlaut -30
-KPX Abreve umacron -30
-KPX Abreve uogonek -30
-KPX Abreve uring -30
-KPX Abreve v -40
-KPX Abreve w -30
-KPX Abreve y -30
-KPX Abreve yacute -30
-KPX Abreve ydieresis -30
-KPX Acircumflex C -40
-KPX Acircumflex Cacute -40
-KPX Acircumflex Ccaron -40
-KPX Acircumflex Ccedilla -40
-KPX Acircumflex G -50
-KPX Acircumflex Gbreve -50
-KPX Acircumflex Gcommaaccent -50
-KPX Acircumflex O -40
-KPX Acircumflex Oacute -40
-KPX Acircumflex Ocircumflex -40
-KPX Acircumflex Odieresis -40
-KPX Acircumflex Ograve -40
-KPX Acircumflex Ohungarumlaut -40
-KPX Acircumflex Omacron -40
-KPX Acircumflex Oslash -40
-KPX Acircumflex Otilde -40
-KPX Acircumflex Q -40
-KPX Acircumflex T -90
-KPX Acircumflex Tcaron -90
-KPX Acircumflex Tcommaaccent -90
-KPX Acircumflex U -50
-KPX Acircumflex Uacute -50
-KPX Acircumflex Ucircumflex -50
-KPX Acircumflex Udieresis -50
-KPX Acircumflex Ugrave -50
-KPX Acircumflex Uhungarumlaut -50
-KPX Acircumflex Umacron -50
-KPX Acircumflex Uogonek -50
-KPX Acircumflex Uring -50
-KPX Acircumflex V -80
-KPX Acircumflex W -60
-KPX Acircumflex Y -110
-KPX Acircumflex Yacute -110
-KPX Acircumflex Ydieresis -110
-KPX Acircumflex u -30
-KPX Acircumflex uacute -30
-KPX Acircumflex ucircumflex -30
-KPX Acircumflex udieresis -30
-KPX Acircumflex ugrave -30
-KPX Acircumflex uhungarumlaut -30
-KPX Acircumflex umacron -30
-KPX Acircumflex uogonek -30
-KPX Acircumflex uring -30
-KPX Acircumflex v -40
-KPX Acircumflex w -30
-KPX Acircumflex y -30
-KPX Acircumflex yacute -30
-KPX Acircumflex ydieresis -30
-KPX Adieresis C -40
-KPX Adieresis Cacute -40
-KPX Adieresis Ccaron -40
-KPX Adieresis Ccedilla -40
-KPX Adieresis G -50
-KPX Adieresis Gbreve -50
-KPX Adieresis Gcommaaccent -50
-KPX Adieresis O -40
-KPX Adieresis Oacute -40
-KPX Adieresis Ocircumflex -40
-KPX Adieresis Odieresis -40
-KPX Adieresis Ograve -40
-KPX Adieresis Ohungarumlaut -40
-KPX Adieresis Omacron -40
-KPX Adieresis Oslash -40
-KPX Adieresis Otilde -40
-KPX Adieresis Q -40
-KPX Adieresis T -90
-KPX Adieresis Tcaron -90
-KPX Adieresis Tcommaaccent -90
-KPX Adieresis U -50
-KPX Adieresis Uacute -50
-KPX Adieresis Ucircumflex -50
-KPX Adieresis Udieresis -50
-KPX Adieresis Ugrave -50
-KPX Adieresis Uhungarumlaut -50
-KPX Adieresis Umacron -50
-KPX Adieresis Uogonek -50
-KPX Adieresis Uring -50
-KPX Adieresis V -80
-KPX Adieresis W -60
-KPX Adieresis Y -110
-KPX Adieresis Yacute -110
-KPX Adieresis Ydieresis -110
-KPX Adieresis u -30
-KPX Adieresis uacute -30
-KPX Adieresis ucircumflex -30
-KPX Adieresis udieresis -30
-KPX Adieresis ugrave -30
-KPX Adieresis uhungarumlaut -30
-KPX Adieresis umacron -30
-KPX Adieresis uogonek -30
-KPX Adieresis uring -30
-KPX Adieresis v -40
-KPX Adieresis w -30
-KPX Adieresis y -30
-KPX Adieresis yacute -30
-KPX Adieresis ydieresis -30
-KPX Agrave C -40
-KPX Agrave Cacute -40
-KPX Agrave Ccaron -40
-KPX Agrave Ccedilla -40
-KPX Agrave G -50
-KPX Agrave Gbreve -50
-KPX Agrave Gcommaaccent -50
-KPX Agrave O -40
-KPX Agrave Oacute -40
-KPX Agrave Ocircumflex -40
-KPX Agrave Odieresis -40
-KPX Agrave Ograve -40
-KPX Agrave Ohungarumlaut -40
-KPX Agrave Omacron -40
-KPX Agrave Oslash -40
-KPX Agrave Otilde -40
-KPX Agrave Q -40
-KPX Agrave T -90
-KPX Agrave Tcaron -90
-KPX Agrave Tcommaaccent -90
-KPX Agrave U -50
-KPX Agrave Uacute -50
-KPX Agrave Ucircumflex -50
-KPX Agrave Udieresis -50
-KPX Agrave Ugrave -50
-KPX Agrave Uhungarumlaut -50
-KPX Agrave Umacron -50
-KPX Agrave Uogonek -50
-KPX Agrave Uring -50
-KPX Agrave V -80
-KPX Agrave W -60
-KPX Agrave Y -110
-KPX Agrave Yacute -110
-KPX Agrave Ydieresis -110
-KPX Agrave u -30
-KPX Agrave uacute -30
-KPX Agrave ucircumflex -30
-KPX Agrave udieresis -30
-KPX Agrave ugrave -30
-KPX Agrave uhungarumlaut -30
-KPX Agrave umacron -30
-KPX Agrave uogonek -30
-KPX Agrave uring -30
-KPX Agrave v -40
-KPX Agrave w -30
-KPX Agrave y -30
-KPX Agrave yacute -30
-KPX Agrave ydieresis -30
-KPX Amacron C -40
-KPX Amacron Cacute -40
-KPX Amacron Ccaron -40
-KPX Amacron Ccedilla -40
-KPX Amacron G -50
-KPX Amacron Gbreve -50
-KPX Amacron Gcommaaccent -50
-KPX Amacron O -40
-KPX Amacron Oacute -40
-KPX Amacron Ocircumflex -40
-KPX Amacron Odieresis -40
-KPX Amacron Ograve -40
-KPX Amacron Ohungarumlaut -40
-KPX Amacron Omacron -40
-KPX Amacron Oslash -40
-KPX Amacron Otilde -40
-KPX Amacron Q -40
-KPX Amacron T -90
-KPX Amacron Tcaron -90
-KPX Amacron Tcommaaccent -90
-KPX Amacron U -50
-KPX Amacron Uacute -50
-KPX Amacron Ucircumflex -50
-KPX Amacron Udieresis -50
-KPX Amacron Ugrave -50
-KPX Amacron Uhungarumlaut -50
-KPX Amacron Umacron -50
-KPX Amacron Uogonek -50
-KPX Amacron Uring -50
-KPX Amacron V -80
-KPX Amacron W -60
-KPX Amacron Y -110
-KPX Amacron Yacute -110
-KPX Amacron Ydieresis -110
-KPX Amacron u -30
-KPX Amacron uacute -30
-KPX Amacron ucircumflex -30
-KPX Amacron udieresis -30
-KPX Amacron ugrave -30
-KPX Amacron uhungarumlaut -30
-KPX Amacron umacron -30
-KPX Amacron uogonek -30
-KPX Amacron uring -30
-KPX Amacron v -40
-KPX Amacron w -30
-KPX Amacron y -30
-KPX Amacron yacute -30
-KPX Amacron ydieresis -30
-KPX Aogonek C -40
-KPX Aogonek Cacute -40
-KPX Aogonek Ccaron -40
-KPX Aogonek Ccedilla -40
-KPX Aogonek G -50
-KPX Aogonek Gbreve -50
-KPX Aogonek Gcommaaccent -50
-KPX Aogonek O -40
-KPX Aogonek Oacute -40
-KPX Aogonek Ocircumflex -40
-KPX Aogonek Odieresis -40
-KPX Aogonek Ograve -40
-KPX Aogonek Ohungarumlaut -40
-KPX Aogonek Omacron -40
-KPX Aogonek Oslash -40
-KPX Aogonek Otilde -40
-KPX Aogonek Q -40
-KPX Aogonek T -90
-KPX Aogonek Tcaron -90
-KPX Aogonek Tcommaaccent -90
-KPX Aogonek U -50
-KPX Aogonek Uacute -50
-KPX Aogonek Ucircumflex -50
-KPX Aogonek Udieresis -50
-KPX Aogonek Ugrave -50
-KPX Aogonek Uhungarumlaut -50
-KPX Aogonek Umacron -50
-KPX Aogonek Uogonek -50
-KPX Aogonek Uring -50
-KPX Aogonek V -80
-KPX Aogonek W -60
-KPX Aogonek Y -110
-KPX Aogonek Yacute -110
-KPX Aogonek Ydieresis -110
-KPX Aogonek u -30
-KPX Aogonek uacute -30
-KPX Aogonek ucircumflex -30
-KPX Aogonek udieresis -30
-KPX Aogonek ugrave -30
-KPX Aogonek uhungarumlaut -30
-KPX Aogonek umacron -30
-KPX Aogonek uogonek -30
-KPX Aogonek uring -30
-KPX Aogonek v -40
-KPX Aogonek w -30
-KPX Aogonek y -30
-KPX Aogonek yacute -30
-KPX Aogonek ydieresis -30
-KPX Aring C -40
-KPX Aring Cacute -40
-KPX Aring Ccaron -40
-KPX Aring Ccedilla -40
-KPX Aring G -50
-KPX Aring Gbreve -50
-KPX Aring Gcommaaccent -50
-KPX Aring O -40
-KPX Aring Oacute -40
-KPX Aring Ocircumflex -40
-KPX Aring Odieresis -40
-KPX Aring Ograve -40
-KPX Aring Ohungarumlaut -40
-KPX Aring Omacron -40
-KPX Aring Oslash -40
-KPX Aring Otilde -40
-KPX Aring Q -40
-KPX Aring T -90
-KPX Aring Tcaron -90
-KPX Aring Tcommaaccent -90
-KPX Aring U -50
-KPX Aring Uacute -50
-KPX Aring Ucircumflex -50
-KPX Aring Udieresis -50
-KPX Aring Ugrave -50
-KPX Aring Uhungarumlaut -50
-KPX Aring Umacron -50
-KPX Aring Uogonek -50
-KPX Aring Uring -50
-KPX Aring V -80
-KPX Aring W -60
-KPX Aring Y -110
-KPX Aring Yacute -110
-KPX Aring Ydieresis -110
-KPX Aring u -30
-KPX Aring uacute -30
-KPX Aring ucircumflex -30
-KPX Aring udieresis -30
-KPX Aring ugrave -30
-KPX Aring uhungarumlaut -30
-KPX Aring umacron -30
-KPX Aring uogonek -30
-KPX Aring uring -30
-KPX Aring v -40
-KPX Aring w -30
-KPX Aring y -30
-KPX Aring yacute -30
-KPX Aring ydieresis -30
-KPX Atilde C -40
-KPX Atilde Cacute -40
-KPX Atilde Ccaron -40
-KPX Atilde Ccedilla -40
-KPX Atilde G -50
-KPX Atilde Gbreve -50
-KPX Atilde Gcommaaccent -50
-KPX Atilde O -40
-KPX Atilde Oacute -40
-KPX Atilde Ocircumflex -40
-KPX Atilde Odieresis -40
-KPX Atilde Ograve -40
-KPX Atilde Ohungarumlaut -40
-KPX Atilde Omacron -40
-KPX Atilde Oslash -40
-KPX Atilde Otilde -40
-KPX Atilde Q -40
-KPX Atilde T -90
-KPX Atilde Tcaron -90
-KPX Atilde Tcommaaccent -90
-KPX Atilde U -50
-KPX Atilde Uacute -50
-KPX Atilde Ucircumflex -50
-KPX Atilde Udieresis -50
-KPX Atilde Ugrave -50
-KPX Atilde Uhungarumlaut -50
-KPX Atilde Umacron -50
-KPX Atilde Uogonek -50
-KPX Atilde Uring -50
-KPX Atilde V -80
-KPX Atilde W -60
-KPX Atilde Y -110
-KPX Atilde Yacute -110
-KPX Atilde Ydieresis -110
-KPX Atilde u -30
-KPX Atilde uacute -30
-KPX Atilde ucircumflex -30
-KPX Atilde udieresis -30
-KPX Atilde ugrave -30
-KPX Atilde uhungarumlaut -30
-KPX Atilde umacron -30
-KPX Atilde uogonek -30
-KPX Atilde uring -30
-KPX Atilde v -40
-KPX Atilde w -30
-KPX Atilde y -30
-KPX Atilde yacute -30
-KPX Atilde ydieresis -30
-KPX B A -30
-KPX B Aacute -30
-KPX B Abreve -30
-KPX B Acircumflex -30
-KPX B Adieresis -30
-KPX B Agrave -30
-KPX B Amacron -30
-KPX B Aogonek -30
-KPX B Aring -30
-KPX B Atilde -30
-KPX B U -10
-KPX B Uacute -10
-KPX B Ucircumflex -10
-KPX B Udieresis -10
-KPX B Ugrave -10
-KPX B Uhungarumlaut -10
-KPX B Umacron -10
-KPX B Uogonek -10
-KPX B Uring -10
-KPX D A -40
-KPX D Aacute -40
-KPX D Abreve -40
-KPX D Acircumflex -40
-KPX D Adieresis -40
-KPX D Agrave -40
-KPX D Amacron -40
-KPX D Aogonek -40
-KPX D Aring -40
-KPX D Atilde -40
-KPX D V -40
-KPX D W -40
-KPX D Y -70
-KPX D Yacute -70
-KPX D Ydieresis -70
-KPX D comma -30
-KPX D period -30
-KPX Dcaron A -40
-KPX Dcaron Aacute -40
-KPX Dcaron Abreve -40
-KPX Dcaron Acircumflex -40
-KPX Dcaron Adieresis -40
-KPX Dcaron Agrave -40
-KPX Dcaron Amacron -40
-KPX Dcaron Aogonek -40
-KPX Dcaron Aring -40
-KPX Dcaron Atilde -40
-KPX Dcaron V -40
-KPX Dcaron W -40
-KPX Dcaron Y -70
-KPX Dcaron Yacute -70
-KPX Dcaron Ydieresis -70
-KPX Dcaron comma -30
-KPX Dcaron period -30
-KPX Dcroat A -40
-KPX Dcroat Aacute -40
-KPX Dcroat Abreve -40
-KPX Dcroat Acircumflex -40
-KPX Dcroat Adieresis -40
-KPX Dcroat Agrave -40
-KPX Dcroat Amacron -40
-KPX Dcroat Aogonek -40
-KPX Dcroat Aring -40
-KPX Dcroat Atilde -40
-KPX Dcroat V -40
-KPX Dcroat W -40
-KPX Dcroat Y -70
-KPX Dcroat Yacute -70
-KPX Dcroat Ydieresis -70
-KPX Dcroat comma -30
-KPX Dcroat period -30
-KPX F A -80
-KPX F Aacute -80
-KPX F Abreve -80
-KPX F Acircumflex -80
-KPX F Adieresis -80
-KPX F Agrave -80
-KPX F Amacron -80
-KPX F Aogonek -80
-KPX F Aring -80
-KPX F Atilde -80
-KPX F a -20
-KPX F aacute -20
-KPX F abreve -20
-KPX F acircumflex -20
-KPX F adieresis -20
-KPX F agrave -20
-KPX F amacron -20
-KPX F aogonek -20
-KPX F aring -20
-KPX F atilde -20
-KPX F comma -100
-KPX F period -100
-KPX J A -20
-KPX J Aacute -20
-KPX J Abreve -20
-KPX J Acircumflex -20
-KPX J Adieresis -20
-KPX J Agrave -20
-KPX J Amacron -20
-KPX J Aogonek -20
-KPX J Aring -20
-KPX J Atilde -20
-KPX J comma -20
-KPX J period -20
-KPX J u -20
-KPX J uacute -20
-KPX J ucircumflex -20
-KPX J udieresis -20
-KPX J ugrave -20
-KPX J uhungarumlaut -20
-KPX J umacron -20
-KPX J uogonek -20
-KPX J uring -20
-KPX K O -30
-KPX K Oacute -30
-KPX K Ocircumflex -30
-KPX K Odieresis -30
-KPX K Ograve -30
-KPX K Ohungarumlaut -30
-KPX K Omacron -30
-KPX K Oslash -30
-KPX K Otilde -30
-KPX K e -15
-KPX K eacute -15
-KPX K ecaron -15
-KPX K ecircumflex -15
-KPX K edieresis -15
-KPX K edotaccent -15
-KPX K egrave -15
-KPX K emacron -15
-KPX K eogonek -15
-KPX K o -35
-KPX K oacute -35
-KPX K ocircumflex -35
-KPX K odieresis -35
-KPX K ograve -35
-KPX K ohungarumlaut -35
-KPX K omacron -35
-KPX K oslash -35
-KPX K otilde -35
-KPX K u -30
-KPX K uacute -30
-KPX K ucircumflex -30
-KPX K udieresis -30
-KPX K ugrave -30
-KPX K uhungarumlaut -30
-KPX K umacron -30
-KPX K uogonek -30
-KPX K uring -30
-KPX K y -40
-KPX K yacute -40
-KPX K ydieresis -40
-KPX Kcommaaccent O -30
-KPX Kcommaaccent Oacute -30
-KPX Kcommaaccent Ocircumflex -30
-KPX Kcommaaccent Odieresis -30
-KPX Kcommaaccent Ograve -30
-KPX Kcommaaccent Ohungarumlaut -30
-KPX Kcommaaccent Omacron -30
-KPX Kcommaaccent Oslash -30
-KPX Kcommaaccent Otilde -30
-KPX Kcommaaccent e -15
-KPX Kcommaaccent eacute -15
-KPX Kcommaaccent ecaron -15
-KPX Kcommaaccent ecircumflex -15
-KPX Kcommaaccent edieresis -15
-KPX Kcommaaccent edotaccent -15
-KPX Kcommaaccent egrave -15
-KPX Kcommaaccent emacron -15
-KPX Kcommaaccent eogonek -15
-KPX Kcommaaccent o -35
-KPX Kcommaaccent oacute -35
-KPX Kcommaaccent ocircumflex -35
-KPX Kcommaaccent odieresis -35
-KPX Kcommaaccent ograve -35
-KPX Kcommaaccent ohungarumlaut -35
-KPX Kcommaaccent omacron -35
-KPX Kcommaaccent oslash -35
-KPX Kcommaaccent otilde -35
-KPX Kcommaaccent u -30
-KPX Kcommaaccent uacute -30
-KPX Kcommaaccent ucircumflex -30
-KPX Kcommaaccent udieresis -30
-KPX Kcommaaccent ugrave -30
-KPX Kcommaaccent uhungarumlaut -30
-KPX Kcommaaccent umacron -30
-KPX Kcommaaccent uogonek -30
-KPX Kcommaaccent uring -30
-KPX Kcommaaccent y -40
-KPX Kcommaaccent yacute -40
-KPX Kcommaaccent ydieresis -40
-KPX L T -90
-KPX L Tcaron -90
-KPX L Tcommaaccent -90
-KPX L V -110
-KPX L W -80
-KPX L Y -120
-KPX L Yacute -120
-KPX L Ydieresis -120
-KPX L quotedblright -140
-KPX L quoteright -140
-KPX L y -30
-KPX L yacute -30
-KPX L ydieresis -30
-KPX Lacute T -90
-KPX Lacute Tcaron -90
-KPX Lacute Tcommaaccent -90
-KPX Lacute V -110
-KPX Lacute W -80
-KPX Lacute Y -120
-KPX Lacute Yacute -120
-KPX Lacute Ydieresis -120
-KPX Lacute quotedblright -140
-KPX Lacute quoteright -140
-KPX Lacute y -30
-KPX Lacute yacute -30
-KPX Lacute ydieresis -30
-KPX Lcommaaccent T -90
-KPX Lcommaaccent Tcaron -90
-KPX Lcommaaccent Tcommaaccent -90
-KPX Lcommaaccent V -110
-KPX Lcommaaccent W -80
-KPX Lcommaaccent Y -120
-KPX Lcommaaccent Yacute -120
-KPX Lcommaaccent Ydieresis -120
-KPX Lcommaaccent quotedblright -140
-KPX Lcommaaccent quoteright -140
-KPX Lcommaaccent y -30
-KPX Lcommaaccent yacute -30
-KPX Lcommaaccent ydieresis -30
-KPX Lslash T -90
-KPX Lslash Tcaron -90
-KPX Lslash Tcommaaccent -90
-KPX Lslash V -110
-KPX Lslash W -80
-KPX Lslash Y -120
-KPX Lslash Yacute -120
-KPX Lslash Ydieresis -120
-KPX Lslash quotedblright -140
-KPX Lslash quoteright -140
-KPX Lslash y -30
-KPX Lslash yacute -30
-KPX Lslash ydieresis -30
-KPX O A -50
-KPX O Aacute -50
-KPX O Abreve -50
-KPX O Acircumflex -50
-KPX O Adieresis -50
-KPX O Agrave -50
-KPX O Amacron -50
-KPX O Aogonek -50
-KPX O Aring -50
-KPX O Atilde -50
-KPX O T -40
-KPX O Tcaron -40
-KPX O Tcommaaccent -40
-KPX O V -50
-KPX O W -50
-KPX O X -50
-KPX O Y -70
-KPX O Yacute -70
-KPX O Ydieresis -70
-KPX O comma -40
-KPX O period -40
-KPX Oacute A -50
-KPX Oacute Aacute -50
-KPX Oacute Abreve -50
-KPX Oacute Acircumflex -50
-KPX Oacute Adieresis -50
-KPX Oacute Agrave -50
-KPX Oacute Amacron -50
-KPX Oacute Aogonek -50
-KPX Oacute Aring -50
-KPX Oacute Atilde -50
-KPX Oacute T -40
-KPX Oacute Tcaron -40
-KPX Oacute Tcommaaccent -40
-KPX Oacute V -50
-KPX Oacute W -50
-KPX Oacute X -50
-KPX Oacute Y -70
-KPX Oacute Yacute -70
-KPX Oacute Ydieresis -70
-KPX Oacute comma -40
-KPX Oacute period -40
-KPX Ocircumflex A -50
-KPX Ocircumflex Aacute -50
-KPX Ocircumflex Abreve -50
-KPX Ocircumflex Acircumflex -50
-KPX Ocircumflex Adieresis -50
-KPX Ocircumflex Agrave -50
-KPX Ocircumflex Amacron -50
-KPX Ocircumflex Aogonek -50
-KPX Ocircumflex Aring -50
-KPX Ocircumflex Atilde -50
-KPX Ocircumflex T -40
-KPX Ocircumflex Tcaron -40
-KPX Ocircumflex Tcommaaccent -40
-KPX Ocircumflex V -50
-KPX Ocircumflex W -50
-KPX Ocircumflex X -50
-KPX Ocircumflex Y -70
-KPX Ocircumflex Yacute -70
-KPX Ocircumflex Ydieresis -70
-KPX Ocircumflex comma -40
-KPX Ocircumflex period -40
-KPX Odieresis A -50
-KPX Odieresis Aacute -50
-KPX Odieresis Abreve -50
-KPX Odieresis Acircumflex -50
-KPX Odieresis Adieresis -50
-KPX Odieresis Agrave -50
-KPX Odieresis Amacron -50
-KPX Odieresis Aogonek -50
-KPX Odieresis Aring -50
-KPX Odieresis Atilde -50
-KPX Odieresis T -40
-KPX Odieresis Tcaron -40
-KPX Odieresis Tcommaaccent -40
-KPX Odieresis V -50
-KPX Odieresis W -50
-KPX Odieresis X -50
-KPX Odieresis Y -70
-KPX Odieresis Yacute -70
-KPX Odieresis Ydieresis -70
-KPX Odieresis comma -40
-KPX Odieresis period -40
-KPX Ograve A -50
-KPX Ograve Aacute -50
-KPX Ograve Abreve -50
-KPX Ograve Acircumflex -50
-KPX Ograve Adieresis -50
-KPX Ograve Agrave -50
-KPX Ograve Amacron -50
-KPX Ograve Aogonek -50
-KPX Ograve Aring -50
-KPX Ograve Atilde -50
-KPX Ograve T -40
-KPX Ograve Tcaron -40
-KPX Ograve Tcommaaccent -40
-KPX Ograve V -50
-KPX Ograve W -50
-KPX Ograve X -50
-KPX Ograve Y -70
-KPX Ograve Yacute -70
-KPX Ograve Ydieresis -70
-KPX Ograve comma -40
-KPX Ograve period -40
-KPX Ohungarumlaut A -50
-KPX Ohungarumlaut Aacute -50
-KPX Ohungarumlaut Abreve -50
-KPX Ohungarumlaut Acircumflex -50
-KPX Ohungarumlaut Adieresis -50
-KPX Ohungarumlaut Agrave -50
-KPX Ohungarumlaut Amacron -50
-KPX Ohungarumlaut Aogonek -50
-KPX Ohungarumlaut Aring -50
-KPX Ohungarumlaut Atilde -50
-KPX Ohungarumlaut T -40
-KPX Ohungarumlaut Tcaron -40
-KPX Ohungarumlaut Tcommaaccent -40
-KPX Ohungarumlaut V -50
-KPX Ohungarumlaut W -50
-KPX Ohungarumlaut X -50
-KPX Ohungarumlaut Y -70
-KPX Ohungarumlaut Yacute -70
-KPX Ohungarumlaut Ydieresis -70
-KPX Ohungarumlaut comma -40
-KPX Ohungarumlaut period -40
-KPX Omacron A -50
-KPX Omacron Aacute -50
-KPX Omacron Abreve -50
-KPX Omacron Acircumflex -50
-KPX Omacron Adieresis -50
-KPX Omacron Agrave -50
-KPX Omacron Amacron -50
-KPX Omacron Aogonek -50
-KPX Omacron Aring -50
-KPX Omacron Atilde -50
-KPX Omacron T -40
-KPX Omacron Tcaron -40
-KPX Omacron Tcommaaccent -40
-KPX Omacron V -50
-KPX Omacron W -50
-KPX Omacron X -50
-KPX Omacron Y -70
-KPX Omacron Yacute -70
-KPX Omacron Ydieresis -70
-KPX Omacron comma -40
-KPX Omacron period -40
-KPX Oslash A -50
-KPX Oslash Aacute -50
-KPX Oslash Abreve -50
-KPX Oslash Acircumflex -50
-KPX Oslash Adieresis -50
-KPX Oslash Agrave -50
-KPX Oslash Amacron -50
-KPX Oslash Aogonek -50
-KPX Oslash Aring -50
-KPX Oslash Atilde -50
-KPX Oslash T -40
-KPX Oslash Tcaron -40
-KPX Oslash Tcommaaccent -40
-KPX Oslash V -50
-KPX Oslash W -50
-KPX Oslash X -50
-KPX Oslash Y -70
-KPX Oslash Yacute -70
-KPX Oslash Ydieresis -70
-KPX Oslash comma -40
-KPX Oslash period -40
-KPX Otilde A -50
-KPX Otilde Aacute -50
-KPX Otilde Abreve -50
-KPX Otilde Acircumflex -50
-KPX Otilde Adieresis -50
-KPX Otilde Agrave -50
-KPX Otilde Amacron -50
-KPX Otilde Aogonek -50
-KPX Otilde Aring -50
-KPX Otilde Atilde -50
-KPX Otilde T -40
-KPX Otilde Tcaron -40
-KPX Otilde Tcommaaccent -40
-KPX Otilde V -50
-KPX Otilde W -50
-KPX Otilde X -50
-KPX Otilde Y -70
-KPX Otilde Yacute -70
-KPX Otilde Ydieresis -70
-KPX Otilde comma -40
-KPX Otilde period -40
-KPX P A -100
-KPX P Aacute -100
-KPX P Abreve -100
-KPX P Acircumflex -100
-KPX P Adieresis -100
-KPX P Agrave -100
-KPX P Amacron -100
-KPX P Aogonek -100
-KPX P Aring -100
-KPX P Atilde -100
-KPX P a -30
-KPX P aacute -30
-KPX P abreve -30
-KPX P acircumflex -30
-KPX P adieresis -30
-KPX P agrave -30
-KPX P amacron -30
-KPX P aogonek -30
-KPX P aring -30
-KPX P atilde -30
-KPX P comma -120
-KPX P e -30
-KPX P eacute -30
-KPX P ecaron -30
-KPX P ecircumflex -30
-KPX P edieresis -30
-KPX P edotaccent -30
-KPX P egrave -30
-KPX P emacron -30
-KPX P eogonek -30
-KPX P o -40
-KPX P oacute -40
-KPX P ocircumflex -40
-KPX P odieresis -40
-KPX P ograve -40
-KPX P ohungarumlaut -40
-KPX P omacron -40
-KPX P oslash -40
-KPX P otilde -40
-KPX P period -120
-KPX Q U -10
-KPX Q Uacute -10
-KPX Q Ucircumflex -10
-KPX Q Udieresis -10
-KPX Q Ugrave -10
-KPX Q Uhungarumlaut -10
-KPX Q Umacron -10
-KPX Q Uogonek -10
-KPX Q Uring -10
-KPX Q comma 20
-KPX Q period 20
-KPX R O -20
-KPX R Oacute -20
-KPX R Ocircumflex -20
-KPX R Odieresis -20
-KPX R Ograve -20
-KPX R Ohungarumlaut -20
-KPX R Omacron -20
-KPX R Oslash -20
-KPX R Otilde -20
-KPX R T -20
-KPX R Tcaron -20
-KPX R Tcommaaccent -20
-KPX R U -20
-KPX R Uacute -20
-KPX R Ucircumflex -20
-KPX R Udieresis -20
-KPX R Ugrave -20
-KPX R Uhungarumlaut -20
-KPX R Umacron -20
-KPX R Uogonek -20
-KPX R Uring -20
-KPX R V -50
-KPX R W -40
-KPX R Y -50
-KPX R Yacute -50
-KPX R Ydieresis -50
-KPX Racute O -20
-KPX Racute Oacute -20
-KPX Racute Ocircumflex -20
-KPX Racute Odieresis -20
-KPX Racute Ograve -20
-KPX Racute Ohungarumlaut -20
-KPX Racute Omacron -20
-KPX Racute Oslash -20
-KPX Racute Otilde -20
-KPX Racute T -20
-KPX Racute Tcaron -20
-KPX Racute Tcommaaccent -20
-KPX Racute U -20
-KPX Racute Uacute -20
-KPX Racute Ucircumflex -20
-KPX Racute Udieresis -20
-KPX Racute Ugrave -20
-KPX Racute Uhungarumlaut -20
-KPX Racute Umacron -20
-KPX Racute Uogonek -20
-KPX Racute Uring -20
-KPX Racute V -50
-KPX Racute W -40
-KPX Racute Y -50
-KPX Racute Yacute -50
-KPX Racute Ydieresis -50
-KPX Rcaron O -20
-KPX Rcaron Oacute -20
-KPX Rcaron Ocircumflex -20
-KPX Rcaron Odieresis -20
-KPX Rcaron Ograve -20
-KPX Rcaron Ohungarumlaut -20
-KPX Rcaron Omacron -20
-KPX Rcaron Oslash -20
-KPX Rcaron Otilde -20
-KPX Rcaron T -20
-KPX Rcaron Tcaron -20
-KPX Rcaron Tcommaaccent -20
-KPX Rcaron U -20
-KPX Rcaron Uacute -20
-KPX Rcaron Ucircumflex -20
-KPX Rcaron Udieresis -20
-KPX Rcaron Ugrave -20
-KPX Rcaron Uhungarumlaut -20
-KPX Rcaron Umacron -20
-KPX Rcaron Uogonek -20
-KPX Rcaron Uring -20
-KPX Rcaron V -50
-KPX Rcaron W -40
-KPX Rcaron Y -50
-KPX Rcaron Yacute -50
-KPX Rcaron Ydieresis -50
-KPX Rcommaaccent O -20
-KPX Rcommaaccent Oacute -20
-KPX Rcommaaccent Ocircumflex -20
-KPX Rcommaaccent Odieresis -20
-KPX Rcommaaccent Ograve -20
-KPX Rcommaaccent Ohungarumlaut -20
-KPX Rcommaaccent Omacron -20
-KPX Rcommaaccent Oslash -20
-KPX Rcommaaccent Otilde -20
-KPX Rcommaaccent T -20
-KPX Rcommaaccent Tcaron -20
-KPX Rcommaaccent Tcommaaccent -20
-KPX Rcommaaccent U -20
-KPX Rcommaaccent Uacute -20
-KPX Rcommaaccent Ucircumflex -20
-KPX Rcommaaccent Udieresis -20
-KPX Rcommaaccent Ugrave -20
-KPX Rcommaaccent Uhungarumlaut -20
-KPX Rcommaaccent Umacron -20
-KPX Rcommaaccent Uogonek -20
-KPX Rcommaaccent Uring -20
-KPX Rcommaaccent V -50
-KPX Rcommaaccent W -40
-KPX Rcommaaccent Y -50
-KPX Rcommaaccent Yacute -50
-KPX Rcommaaccent Ydieresis -50
-KPX T A -90
-KPX T Aacute -90
-KPX T Abreve -90
-KPX T Acircumflex -90
-KPX T Adieresis -90
-KPX T Agrave -90
-KPX T Amacron -90
-KPX T Aogonek -90
-KPX T Aring -90
-KPX T Atilde -90
-KPX T O -40
-KPX T Oacute -40
-KPX T Ocircumflex -40
-KPX T Odieresis -40
-KPX T Ograve -40
-KPX T Ohungarumlaut -40
-KPX T Omacron -40
-KPX T Oslash -40
-KPX T Otilde -40
-KPX T a -80
-KPX T aacute -80
-KPX T abreve -80
-KPX T acircumflex -80
-KPX T adieresis -80
-KPX T agrave -80
-KPX T amacron -80
-KPX T aogonek -80
-KPX T aring -80
-KPX T atilde -80
-KPX T colon -40
-KPX T comma -80
-KPX T e -60
-KPX T eacute -60
-KPX T ecaron -60
-KPX T ecircumflex -60
-KPX T edieresis -60
-KPX T edotaccent -60
-KPX T egrave -60
-KPX T emacron -60
-KPX T eogonek -60
-KPX T hyphen -120
-KPX T o -80
-KPX T oacute -80
-KPX T ocircumflex -80
-KPX T odieresis -80
-KPX T ograve -80
-KPX T ohungarumlaut -80
-KPX T omacron -80
-KPX T oslash -80
-KPX T otilde -80
-KPX T period -80
-KPX T r -80
-KPX T racute -80
-KPX T rcommaaccent -80
-KPX T semicolon -40
-KPX T u -90
-KPX T uacute -90
-KPX T ucircumflex -90
-KPX T udieresis -90
-KPX T ugrave -90
-KPX T uhungarumlaut -90
-KPX T umacron -90
-KPX T uogonek -90
-KPX T uring -90
-KPX T w -60
-KPX T y -60
-KPX T yacute -60
-KPX T ydieresis -60
-KPX Tcaron A -90
-KPX Tcaron Aacute -90
-KPX Tcaron Abreve -90
-KPX Tcaron Acircumflex -90
-KPX Tcaron Adieresis -90
-KPX Tcaron Agrave -90
-KPX Tcaron Amacron -90
-KPX Tcaron Aogonek -90
-KPX Tcaron Aring -90
-KPX Tcaron Atilde -90
-KPX Tcaron O -40
-KPX Tcaron Oacute -40
-KPX Tcaron Ocircumflex -40
-KPX Tcaron Odieresis -40
-KPX Tcaron Ograve -40
-KPX Tcaron Ohungarumlaut -40
-KPX Tcaron Omacron -40
-KPX Tcaron Oslash -40
-KPX Tcaron Otilde -40
-KPX Tcaron a -80
-KPX Tcaron aacute -80
-KPX Tcaron abreve -80
-KPX Tcaron acircumflex -80
-KPX Tcaron adieresis -80
-KPX Tcaron agrave -80
-KPX Tcaron amacron -80
-KPX Tcaron aogonek -80
-KPX Tcaron aring -80
-KPX Tcaron atilde -80
-KPX Tcaron colon -40
-KPX Tcaron comma -80
-KPX Tcaron e -60
-KPX Tcaron eacute -60
-KPX Tcaron ecaron -60
-KPX Tcaron ecircumflex -60
-KPX Tcaron edieresis -60
-KPX Tcaron edotaccent -60
-KPX Tcaron egrave -60
-KPX Tcaron emacron -60
-KPX Tcaron eogonek -60
-KPX Tcaron hyphen -120
-KPX Tcaron o -80
-KPX Tcaron oacute -80
-KPX Tcaron ocircumflex -80
-KPX Tcaron odieresis -80
-KPX Tcaron ograve -80
-KPX Tcaron ohungarumlaut -80
-KPX Tcaron omacron -80
-KPX Tcaron oslash -80
-KPX Tcaron otilde -80
-KPX Tcaron period -80
-KPX Tcaron r -80
-KPX Tcaron racute -80
-KPX Tcaron rcommaaccent -80
-KPX Tcaron semicolon -40
-KPX Tcaron u -90
-KPX Tcaron uacute -90
-KPX Tcaron ucircumflex -90
-KPX Tcaron udieresis -90
-KPX Tcaron ugrave -90
-KPX Tcaron uhungarumlaut -90
-KPX Tcaron umacron -90
-KPX Tcaron uogonek -90
-KPX Tcaron uring -90
-KPX Tcaron w -60
-KPX Tcaron y -60
-KPX Tcaron yacute -60
-KPX Tcaron ydieresis -60
-KPX Tcommaaccent A -90
-KPX Tcommaaccent Aacute -90
-KPX Tcommaaccent Abreve -90
-KPX Tcommaaccent Acircumflex -90
-KPX Tcommaaccent Adieresis -90
-KPX Tcommaaccent Agrave -90
-KPX Tcommaaccent Amacron -90
-KPX Tcommaaccent Aogonek -90
-KPX Tcommaaccent Aring -90
-KPX Tcommaaccent Atilde -90
-KPX Tcommaaccent O -40
-KPX Tcommaaccent Oacute -40
-KPX Tcommaaccent Ocircumflex -40
-KPX Tcommaaccent Odieresis -40
-KPX Tcommaaccent Ograve -40
-KPX Tcommaaccent Ohungarumlaut -40
-KPX Tcommaaccent Omacron -40
-KPX Tcommaaccent Oslash -40
-KPX Tcommaaccent Otilde -40
-KPX Tcommaaccent a -80
-KPX Tcommaaccent aacute -80
-KPX Tcommaaccent abreve -80
-KPX Tcommaaccent acircumflex -80
-KPX Tcommaaccent adieresis -80
-KPX Tcommaaccent agrave -80
-KPX Tcommaaccent amacron -80
-KPX Tcommaaccent aogonek -80
-KPX Tcommaaccent aring -80
-KPX Tcommaaccent atilde -80
-KPX Tcommaaccent colon -40
-KPX Tcommaaccent comma -80
-KPX Tcommaaccent e -60
-KPX Tcommaaccent eacute -60
-KPX Tcommaaccent ecaron -60
-KPX Tcommaaccent ecircumflex -60
-KPX Tcommaaccent edieresis -60
-KPX Tcommaaccent edotaccent -60
-KPX Tcommaaccent egrave -60
-KPX Tcommaaccent emacron -60
-KPX Tcommaaccent eogonek -60
-KPX Tcommaaccent hyphen -120
-KPX Tcommaaccent o -80
-KPX Tcommaaccent oacute -80
-KPX Tcommaaccent ocircumflex -80
-KPX Tcommaaccent odieresis -80
-KPX Tcommaaccent ograve -80
-KPX Tcommaaccent ohungarumlaut -80
-KPX Tcommaaccent omacron -80
-KPX Tcommaaccent oslash -80
-KPX Tcommaaccent otilde -80
-KPX Tcommaaccent period -80
-KPX Tcommaaccent r -80
-KPX Tcommaaccent racute -80
-KPX Tcommaaccent rcommaaccent -80
-KPX Tcommaaccent semicolon -40
-KPX Tcommaaccent u -90
-KPX Tcommaaccent uacute -90
-KPX Tcommaaccent ucircumflex -90
-KPX Tcommaaccent udieresis -90
-KPX Tcommaaccent ugrave -90
-KPX Tcommaaccent uhungarumlaut -90
-KPX Tcommaaccent umacron -90
-KPX Tcommaaccent uogonek -90
-KPX Tcommaaccent uring -90
-KPX Tcommaaccent w -60
-KPX Tcommaaccent y -60
-KPX Tcommaaccent yacute -60
-KPX Tcommaaccent ydieresis -60
-KPX U A -50
-KPX U Aacute -50
-KPX U Abreve -50
-KPX U Acircumflex -50
-KPX U Adieresis -50
-KPX U Agrave -50
-KPX U Amacron -50
-KPX U Aogonek -50
-KPX U Aring -50
-KPX U Atilde -50
-KPX U comma -30
-KPX U period -30
-KPX Uacute A -50
-KPX Uacute Aacute -50
-KPX Uacute Abreve -50
-KPX Uacute Acircumflex -50
-KPX Uacute Adieresis -50
-KPX Uacute Agrave -50
-KPX Uacute Amacron -50
-KPX Uacute Aogonek -50
-KPX Uacute Aring -50
-KPX Uacute Atilde -50
-KPX Uacute comma -30
-KPX Uacute period -30
-KPX Ucircumflex A -50
-KPX Ucircumflex Aacute -50
-KPX Ucircumflex Abreve -50
-KPX Ucircumflex Acircumflex -50
-KPX Ucircumflex Adieresis -50
-KPX Ucircumflex Agrave -50
-KPX Ucircumflex Amacron -50
-KPX Ucircumflex Aogonek -50
-KPX Ucircumflex Aring -50
-KPX Ucircumflex Atilde -50
-KPX Ucircumflex comma -30
-KPX Ucircumflex period -30
-KPX Udieresis A -50
-KPX Udieresis Aacute -50
-KPX Udieresis Abreve -50
-KPX Udieresis Acircumflex -50
-KPX Udieresis Adieresis -50
-KPX Udieresis Agrave -50
-KPX Udieresis Amacron -50
-KPX Udieresis Aogonek -50
-KPX Udieresis Aring -50
-KPX Udieresis Atilde -50
-KPX Udieresis comma -30
-KPX Udieresis period -30
-KPX Ugrave A -50
-KPX Ugrave Aacute -50
-KPX Ugrave Abreve -50
-KPX Ugrave Acircumflex -50
-KPX Ugrave Adieresis -50
-KPX Ugrave Agrave -50
-KPX Ugrave Amacron -50
-KPX Ugrave Aogonek -50
-KPX Ugrave Aring -50
-KPX Ugrave Atilde -50
-KPX Ugrave comma -30
-KPX Ugrave period -30
-KPX Uhungarumlaut A -50
-KPX Uhungarumlaut Aacute -50
-KPX Uhungarumlaut Abreve -50
-KPX Uhungarumlaut Acircumflex -50
-KPX Uhungarumlaut Adieresis -50
-KPX Uhungarumlaut Agrave -50
-KPX Uhungarumlaut Amacron -50
-KPX Uhungarumlaut Aogonek -50
-KPX Uhungarumlaut Aring -50
-KPX Uhungarumlaut Atilde -50
-KPX Uhungarumlaut comma -30
-KPX Uhungarumlaut period -30
-KPX Umacron A -50
-KPX Umacron Aacute -50
-KPX Umacron Abreve -50
-KPX Umacron Acircumflex -50
-KPX Umacron Adieresis -50
-KPX Umacron Agrave -50
-KPX Umacron Amacron -50
-KPX Umacron Aogonek -50
-KPX Umacron Aring -50
-KPX Umacron Atilde -50
-KPX Umacron comma -30
-KPX Umacron period -30
-KPX Uogonek A -50
-KPX Uogonek Aacute -50
-KPX Uogonek Abreve -50
-KPX Uogonek Acircumflex -50
-KPX Uogonek Adieresis -50
-KPX Uogonek Agrave -50
-KPX Uogonek Amacron -50
-KPX Uogonek Aogonek -50
-KPX Uogonek Aring -50
-KPX Uogonek Atilde -50
-KPX Uogonek comma -30
-KPX Uogonek period -30
-KPX Uring A -50
-KPX Uring Aacute -50
-KPX Uring Abreve -50
-KPX Uring Acircumflex -50
-KPX Uring Adieresis -50
-KPX Uring Agrave -50
-KPX Uring Amacron -50
-KPX Uring Aogonek -50
-KPX Uring Aring -50
-KPX Uring Atilde -50
-KPX Uring comma -30
-KPX Uring period -30
-KPX V A -80
-KPX V Aacute -80
-KPX V Abreve -80
-KPX V Acircumflex -80
-KPX V Adieresis -80
-KPX V Agrave -80
-KPX V Amacron -80
-KPX V Aogonek -80
-KPX V Aring -80
-KPX V Atilde -80
-KPX V G -50
-KPX V Gbreve -50
-KPX V Gcommaaccent -50
-KPX V O -50
-KPX V Oacute -50
-KPX V Ocircumflex -50
-KPX V Odieresis -50
-KPX V Ograve -50
-KPX V Ohungarumlaut -50
-KPX V Omacron -50
-KPX V Oslash -50
-KPX V Otilde -50
-KPX V a -60
-KPX V aacute -60
-KPX V abreve -60
-KPX V acircumflex -60
-KPX V adieresis -60
-KPX V agrave -60
-KPX V amacron -60
-KPX V aogonek -60
-KPX V aring -60
-KPX V atilde -60
-KPX V colon -40
-KPX V comma -120
-KPX V e -50
-KPX V eacute -50
-KPX V ecaron -50
-KPX V ecircumflex -50
-KPX V edieresis -50
-KPX V edotaccent -50
-KPX V egrave -50
-KPX V emacron -50
-KPX V eogonek -50
-KPX V hyphen -80
-KPX V o -90
-KPX V oacute -90
-KPX V ocircumflex -90
-KPX V odieresis -90
-KPX V ograve -90
-KPX V ohungarumlaut -90
-KPX V omacron -90
-KPX V oslash -90
-KPX V otilde -90
-KPX V period -120
-KPX V semicolon -40
-KPX V u -60
-KPX V uacute -60
-KPX V ucircumflex -60
-KPX V udieresis -60
-KPX V ugrave -60
-KPX V uhungarumlaut -60
-KPX V umacron -60
-KPX V uogonek -60
-KPX V uring -60
-KPX W A -60
-KPX W Aacute -60
-KPX W Abreve -60
-KPX W Acircumflex -60
-KPX W Adieresis -60
-KPX W Agrave -60
-KPX W Amacron -60
-KPX W Aogonek -60
-KPX W Aring -60
-KPX W Atilde -60
-KPX W O -20
-KPX W Oacute -20
-KPX W Ocircumflex -20
-KPX W Odieresis -20
-KPX W Ograve -20
-KPX W Ohungarumlaut -20
-KPX W Omacron -20
-KPX W Oslash -20
-KPX W Otilde -20
-KPX W a -40
-KPX W aacute -40
-KPX W abreve -40
-KPX W acircumflex -40
-KPX W adieresis -40
-KPX W agrave -40
-KPX W amacron -40
-KPX W aogonek -40
-KPX W aring -40
-KPX W atilde -40
-KPX W colon -10
-KPX W comma -80
-KPX W e -35
-KPX W eacute -35
-KPX W ecaron -35
-KPX W ecircumflex -35
-KPX W edieresis -35
-KPX W edotaccent -35
-KPX W egrave -35
-KPX W emacron -35
-KPX W eogonek -35
-KPX W hyphen -40
-KPX W o -60
-KPX W oacute -60
-KPX W ocircumflex -60
-KPX W odieresis -60
-KPX W ograve -60
-KPX W ohungarumlaut -60
-KPX W omacron -60
-KPX W oslash -60
-KPX W otilde -60
-KPX W period -80
-KPX W semicolon -10
-KPX W u -45
-KPX W uacute -45
-KPX W ucircumflex -45
-KPX W udieresis -45
-KPX W ugrave -45
-KPX W uhungarumlaut -45
-KPX W umacron -45
-KPX W uogonek -45
-KPX W uring -45
-KPX W y -20
-KPX W yacute -20
-KPX W ydieresis -20
-KPX Y A -110
-KPX Y Aacute -110
-KPX Y Abreve -110
-KPX Y Acircumflex -110
-KPX Y Adieresis -110
-KPX Y Agrave -110
-KPX Y Amacron -110
-KPX Y Aogonek -110
-KPX Y Aring -110
-KPX Y Atilde -110
-KPX Y O -70
-KPX Y Oacute -70
-KPX Y Ocircumflex -70
-KPX Y Odieresis -70
-KPX Y Ograve -70
-KPX Y Ohungarumlaut -70
-KPX Y Omacron -70
-KPX Y Oslash -70
-KPX Y Otilde -70
-KPX Y a -90
-KPX Y aacute -90
-KPX Y abreve -90
-KPX Y acircumflex -90
-KPX Y adieresis -90
-KPX Y agrave -90
-KPX Y amacron -90
-KPX Y aogonek -90
-KPX Y aring -90
-KPX Y atilde -90
-KPX Y colon -50
-KPX Y comma -100
-KPX Y e -80
-KPX Y eacute -80
-KPX Y ecaron -80
-KPX Y ecircumflex -80
-KPX Y edieresis -80
-KPX Y edotaccent -80
-KPX Y egrave -80
-KPX Y emacron -80
-KPX Y eogonek -80
-KPX Y o -100
-KPX Y oacute -100
-KPX Y ocircumflex -100
-KPX Y odieresis -100
-KPX Y ograve -100
-KPX Y ohungarumlaut -100
-KPX Y omacron -100
-KPX Y oslash -100
-KPX Y otilde -100
-KPX Y period -100
-KPX Y semicolon -50
-KPX Y u -100
-KPX Y uacute -100
-KPX Y ucircumflex -100
-KPX Y udieresis -100
-KPX Y ugrave -100
-KPX Y uhungarumlaut -100
-KPX Y umacron -100
-KPX Y uogonek -100
-KPX Y uring -100
-KPX Yacute A -110
-KPX Yacute Aacute -110
-KPX Yacute Abreve -110
-KPX Yacute Acircumflex -110
-KPX Yacute Adieresis -110
-KPX Yacute Agrave -110
-KPX Yacute Amacron -110
-KPX Yacute Aogonek -110
-KPX Yacute Aring -110
-KPX Yacute Atilde -110
-KPX Yacute O -70
-KPX Yacute Oacute -70
-KPX Yacute Ocircumflex -70
-KPX Yacute Odieresis -70
-KPX Yacute Ograve -70
-KPX Yacute Ohungarumlaut -70
-KPX Yacute Omacron -70
-KPX Yacute Oslash -70
-KPX Yacute Otilde -70
-KPX Yacute a -90
-KPX Yacute aacute -90
-KPX Yacute abreve -90
-KPX Yacute acircumflex -90
-KPX Yacute adieresis -90
-KPX Yacute agrave -90
-KPX Yacute amacron -90
-KPX Yacute aogonek -90
-KPX Yacute aring -90
-KPX Yacute atilde -90
-KPX Yacute colon -50
-KPX Yacute comma -100
-KPX Yacute e -80
-KPX Yacute eacute -80
-KPX Yacute ecaron -80
-KPX Yacute ecircumflex -80
-KPX Yacute edieresis -80
-KPX Yacute edotaccent -80
-KPX Yacute egrave -80
-KPX Yacute emacron -80
-KPX Yacute eogonek -80
-KPX Yacute o -100
-KPX Yacute oacute -100
-KPX Yacute ocircumflex -100
-KPX Yacute odieresis -100
-KPX Yacute ograve -100
-KPX Yacute ohungarumlaut -100
-KPX Yacute omacron -100
-KPX Yacute oslash -100
-KPX Yacute otilde -100
-KPX Yacute period -100
-KPX Yacute semicolon -50
-KPX Yacute u -100
-KPX Yacute uacute -100
-KPX Yacute ucircumflex -100
-KPX Yacute udieresis -100
-KPX Yacute ugrave -100
-KPX Yacute uhungarumlaut -100
-KPX Yacute umacron -100
-KPX Yacute uogonek -100
-KPX Yacute uring -100
-KPX Ydieresis A -110
-KPX Ydieresis Aacute -110
-KPX Ydieresis Abreve -110
-KPX Ydieresis Acircumflex -110
-KPX Ydieresis Adieresis -110
-KPX Ydieresis Agrave -110
-KPX Ydieresis Amacron -110
-KPX Ydieresis Aogonek -110
-KPX Ydieresis Aring -110
-KPX Ydieresis Atilde -110
-KPX Ydieresis O -70
-KPX Ydieresis Oacute -70
-KPX Ydieresis Ocircumflex -70
-KPX Ydieresis Odieresis -70
-KPX Ydieresis Ograve -70
-KPX Ydieresis Ohungarumlaut -70
-KPX Ydieresis Omacron -70
-KPX Ydieresis Oslash -70
-KPX Ydieresis Otilde -70
-KPX Ydieresis a -90
-KPX Ydieresis aacute -90
-KPX Ydieresis abreve -90
-KPX Ydieresis acircumflex -90
-KPX Ydieresis adieresis -90
-KPX Ydieresis agrave -90
-KPX Ydieresis amacron -90
-KPX Ydieresis aogonek -90
-KPX Ydieresis aring -90
-KPX Ydieresis atilde -90
-KPX Ydieresis colon -50
-KPX Ydieresis comma -100
-KPX Ydieresis e -80
-KPX Ydieresis eacute -80
-KPX Ydieresis ecaron -80
-KPX Ydieresis ecircumflex -80
-KPX Ydieresis edieresis -80
-KPX Ydieresis edotaccent -80
-KPX Ydieresis egrave -80
-KPX Ydieresis emacron -80
-KPX Ydieresis eogonek -80
-KPX Ydieresis o -100
-KPX Ydieresis oacute -100
-KPX Ydieresis ocircumflex -100
-KPX Ydieresis odieresis -100
-KPX Ydieresis ograve -100
-KPX Ydieresis ohungarumlaut -100
-KPX Ydieresis omacron -100
-KPX Ydieresis oslash -100
-KPX Ydieresis otilde -100
-KPX Ydieresis period -100
-KPX Ydieresis semicolon -50
-KPX Ydieresis u -100
-KPX Ydieresis uacute -100
-KPX Ydieresis ucircumflex -100
-KPX Ydieresis udieresis -100
-KPX Ydieresis ugrave -100
-KPX Ydieresis uhungarumlaut -100
-KPX Ydieresis umacron -100
-KPX Ydieresis uogonek -100
-KPX Ydieresis uring -100
-KPX a g -10
-KPX a gbreve -10
-KPX a gcommaaccent -10
-KPX a v -15
-KPX a w -15
-KPX a y -20
-KPX a yacute -20
-KPX a ydieresis -20
-KPX aacute g -10
-KPX aacute gbreve -10
-KPX aacute gcommaaccent -10
-KPX aacute v -15
-KPX aacute w -15
-KPX aacute y -20
-KPX aacute yacute -20
-KPX aacute ydieresis -20
-KPX abreve g -10
-KPX abreve gbreve -10
-KPX abreve gcommaaccent -10
-KPX abreve v -15
-KPX abreve w -15
-KPX abreve y -20
-KPX abreve yacute -20
-KPX abreve ydieresis -20
-KPX acircumflex g -10
-KPX acircumflex gbreve -10
-KPX acircumflex gcommaaccent -10
-KPX acircumflex v -15
-KPX acircumflex w -15
-KPX acircumflex y -20
-KPX acircumflex yacute -20
-KPX acircumflex ydieresis -20
-KPX adieresis g -10
-KPX adieresis gbreve -10
-KPX adieresis gcommaaccent -10
-KPX adieresis v -15
-KPX adieresis w -15
-KPX adieresis y -20
-KPX adieresis yacute -20
-KPX adieresis ydieresis -20
-KPX agrave g -10
-KPX agrave gbreve -10
-KPX agrave gcommaaccent -10
-KPX agrave v -15
-KPX agrave w -15
-KPX agrave y -20
-KPX agrave yacute -20
-KPX agrave ydieresis -20
-KPX amacron g -10
-KPX amacron gbreve -10
-KPX amacron gcommaaccent -10
-KPX amacron v -15
-KPX amacron w -15
-KPX amacron y -20
-KPX amacron yacute -20
-KPX amacron ydieresis -20
-KPX aogonek g -10
-KPX aogonek gbreve -10
-KPX aogonek gcommaaccent -10
-KPX aogonek v -15
-KPX aogonek w -15
-KPX aogonek y -20
-KPX aogonek yacute -20
-KPX aogonek ydieresis -20
-KPX aring g -10
-KPX aring gbreve -10
-KPX aring gcommaaccent -10
-KPX aring v -15
-KPX aring w -15
-KPX aring y -20
-KPX aring yacute -20
-KPX aring ydieresis -20
-KPX atilde g -10
-KPX atilde gbreve -10
-KPX atilde gcommaaccent -10
-KPX atilde v -15
-KPX atilde w -15
-KPX atilde y -20
-KPX atilde yacute -20
-KPX atilde ydieresis -20
-KPX b l -10
-KPX b lacute -10
-KPX b lcommaaccent -10
-KPX b lslash -10
-KPX b u -20
-KPX b uacute -20
-KPX b ucircumflex -20
-KPX b udieresis -20
-KPX b ugrave -20
-KPX b uhungarumlaut -20
-KPX b umacron -20
-KPX b uogonek -20
-KPX b uring -20
-KPX b v -20
-KPX b y -20
-KPX b yacute -20
-KPX b ydieresis -20
-KPX c h -10
-KPX c k -20
-KPX c kcommaaccent -20
-KPX c l -20
-KPX c lacute -20
-KPX c lcommaaccent -20
-KPX c lslash -20
-KPX c y -10
-KPX c yacute -10
-KPX c ydieresis -10
-KPX cacute h -10
-KPX cacute k -20
-KPX cacute kcommaaccent -20
-KPX cacute l -20
-KPX cacute lacute -20
-KPX cacute lcommaaccent -20
-KPX cacute lslash -20
-KPX cacute y -10
-KPX cacute yacute -10
-KPX cacute ydieresis -10
-KPX ccaron h -10
-KPX ccaron k -20
-KPX ccaron kcommaaccent -20
-KPX ccaron l -20
-KPX ccaron lacute -20
-KPX ccaron lcommaaccent -20
-KPX ccaron lslash -20
-KPX ccaron y -10
-KPX ccaron yacute -10
-KPX ccaron ydieresis -10
-KPX ccedilla h -10
-KPX ccedilla k -20
-KPX ccedilla kcommaaccent -20
-KPX ccedilla l -20
-KPX ccedilla lacute -20
-KPX ccedilla lcommaaccent -20
-KPX ccedilla lslash -20
-KPX ccedilla y -10
-KPX ccedilla yacute -10
-KPX ccedilla ydieresis -10
-KPX colon space -40
-KPX comma quotedblright -120
-KPX comma quoteright -120
-KPX comma space -40
-KPX d d -10
-KPX d dcroat -10
-KPX d v -15
-KPX d w -15
-KPX d y -15
-KPX d yacute -15
-KPX d ydieresis -15
-KPX dcroat d -10
-KPX dcroat dcroat -10
-KPX dcroat v -15
-KPX dcroat w -15
-KPX dcroat y -15
-KPX dcroat yacute -15
-KPX dcroat ydieresis -15
-KPX e comma 10
-KPX e period 20
-KPX e v -15
-KPX e w -15
-KPX e x -15
-KPX e y -15
-KPX e yacute -15
-KPX e ydieresis -15
-KPX eacute comma 10
-KPX eacute period 20
-KPX eacute v -15
-KPX eacute w -15
-KPX eacute x -15
-KPX eacute y -15
-KPX eacute yacute -15
-KPX eacute ydieresis -15
-KPX ecaron comma 10
-KPX ecaron period 20
-KPX ecaron v -15
-KPX ecaron w -15
-KPX ecaron x -15
-KPX ecaron y -15
-KPX ecaron yacute -15
-KPX ecaron ydieresis -15
-KPX ecircumflex comma 10
-KPX ecircumflex period 20
-KPX ecircumflex v -15
-KPX ecircumflex w -15
-KPX ecircumflex x -15
-KPX ecircumflex y -15
-KPX ecircumflex yacute -15
-KPX ecircumflex ydieresis -15
-KPX edieresis comma 10
-KPX edieresis period 20
-KPX edieresis v -15
-KPX edieresis w -15
-KPX edieresis x -15
-KPX edieresis y -15
-KPX edieresis yacute -15
-KPX edieresis ydieresis -15
-KPX edotaccent comma 10
-KPX edotaccent period 20
-KPX edotaccent v -15
-KPX edotaccent w -15
-KPX edotaccent x -15
-KPX edotaccent y -15
-KPX edotaccent yacute -15
-KPX edotaccent ydieresis -15
-KPX egrave comma 10
-KPX egrave period 20
-KPX egrave v -15
-KPX egrave w -15
-KPX egrave x -15
-KPX egrave y -15
-KPX egrave yacute -15
-KPX egrave ydieresis -15
-KPX emacron comma 10
-KPX emacron period 20
-KPX emacron v -15
-KPX emacron w -15
-KPX emacron x -15
-KPX emacron y -15
-KPX emacron yacute -15
-KPX emacron ydieresis -15
-KPX eogonek comma 10
-KPX eogonek period 20
-KPX eogonek v -15
-KPX eogonek w -15
-KPX eogonek x -15
-KPX eogonek y -15
-KPX eogonek yacute -15
-KPX eogonek ydieresis -15
-KPX f comma -10
-KPX f e -10
-KPX f eacute -10
-KPX f ecaron -10
-KPX f ecircumflex -10
-KPX f edieresis -10
-KPX f edotaccent -10
-KPX f egrave -10
-KPX f emacron -10
-KPX f eogonek -10
-KPX f o -20
-KPX f oacute -20
-KPX f ocircumflex -20
-KPX f odieresis -20
-KPX f ograve -20
-KPX f ohungarumlaut -20
-KPX f omacron -20
-KPX f oslash -20
-KPX f otilde -20
-KPX f period -10
-KPX f quotedblright 30
-KPX f quoteright 30
-KPX g e 10
-KPX g eacute 10
-KPX g ecaron 10
-KPX g ecircumflex 10
-KPX g edieresis 10
-KPX g edotaccent 10
-KPX g egrave 10
-KPX g emacron 10
-KPX g eogonek 10
-KPX g g -10
-KPX g gbreve -10
-KPX g gcommaaccent -10
-KPX gbreve e 10
-KPX gbreve eacute 10
-KPX gbreve ecaron 10
-KPX gbreve ecircumflex 10
-KPX gbreve edieresis 10
-KPX gbreve edotaccent 10
-KPX gbreve egrave 10
-KPX gbreve emacron 10
-KPX gbreve eogonek 10
-KPX gbreve g -10
-KPX gbreve gbreve -10
-KPX gbreve gcommaaccent -10
-KPX gcommaaccent e 10
-KPX gcommaaccent eacute 10
-KPX gcommaaccent ecaron 10
-KPX gcommaaccent ecircumflex 10
-KPX gcommaaccent edieresis 10
-KPX gcommaaccent edotaccent 10
-KPX gcommaaccent egrave 10
-KPX gcommaaccent emacron 10
-KPX gcommaaccent eogonek 10
-KPX gcommaaccent g -10
-KPX gcommaaccent gbreve -10
-KPX gcommaaccent gcommaaccent -10
-KPX h y -20
-KPX h yacute -20
-KPX h ydieresis -20
-KPX k o -15
-KPX k oacute -15
-KPX k ocircumflex -15
-KPX k odieresis -15
-KPX k ograve -15
-KPX k ohungarumlaut -15
-KPX k omacron -15
-KPX k oslash -15
-KPX k otilde -15
-KPX kcommaaccent o -15
-KPX kcommaaccent oacute -15
-KPX kcommaaccent ocircumflex -15
-KPX kcommaaccent odieresis -15
-KPX kcommaaccent ograve -15
-KPX kcommaaccent ohungarumlaut -15
-KPX kcommaaccent omacron -15
-KPX kcommaaccent oslash -15
-KPX kcommaaccent otilde -15
-KPX l w -15
-KPX l y -15
-KPX l yacute -15
-KPX l ydieresis -15
-KPX lacute w -15
-KPX lacute y -15
-KPX lacute yacute -15
-KPX lacute ydieresis -15
-KPX lcommaaccent w -15
-KPX lcommaaccent y -15
-KPX lcommaaccent yacute -15
-KPX lcommaaccent ydieresis -15
-KPX lslash w -15
-KPX lslash y -15
-KPX lslash yacute -15
-KPX lslash ydieresis -15
-KPX m u -20
-KPX m uacute -20
-KPX m ucircumflex -20
-KPX m udieresis -20
-KPX m ugrave -20
-KPX m uhungarumlaut -20
-KPX m umacron -20
-KPX m uogonek -20
-KPX m uring -20
-KPX m y -30
-KPX m yacute -30
-KPX m ydieresis -30
-KPX n u -10
-KPX n uacute -10
-KPX n ucircumflex -10
-KPX n udieresis -10
-KPX n ugrave -10
-KPX n uhungarumlaut -10
-KPX n umacron -10
-KPX n uogonek -10
-KPX n uring -10
-KPX n v -40
-KPX n y -20
-KPX n yacute -20
-KPX n ydieresis -20
-KPX nacute u -10
-KPX nacute uacute -10
-KPX nacute ucircumflex -10
-KPX nacute udieresis -10
-KPX nacute ugrave -10
-KPX nacute uhungarumlaut -10
-KPX nacute umacron -10
-KPX nacute uogonek -10
-KPX nacute uring -10
-KPX nacute v -40
-KPX nacute y -20
-KPX nacute yacute -20
-KPX nacute ydieresis -20
-KPX ncaron u -10
-KPX ncaron uacute -10
-KPX ncaron ucircumflex -10
-KPX ncaron udieresis -10
-KPX ncaron ugrave -10
-KPX ncaron uhungarumlaut -10
-KPX ncaron umacron -10
-KPX ncaron uogonek -10
-KPX ncaron uring -10
-KPX ncaron v -40
-KPX ncaron y -20
-KPX ncaron yacute -20
-KPX ncaron ydieresis -20
-KPX ncommaaccent u -10
-KPX ncommaaccent uacute -10
-KPX ncommaaccent ucircumflex -10
-KPX ncommaaccent udieresis -10
-KPX ncommaaccent ugrave -10
-KPX ncommaaccent uhungarumlaut -10
-KPX ncommaaccent umacron -10
-KPX ncommaaccent uogonek -10
-KPX ncommaaccent uring -10
-KPX ncommaaccent v -40
-KPX ncommaaccent y -20
-KPX ncommaaccent yacute -20
-KPX ncommaaccent ydieresis -20
-KPX ntilde u -10
-KPX ntilde uacute -10
-KPX ntilde ucircumflex -10
-KPX ntilde udieresis -10
-KPX ntilde ugrave -10
-KPX ntilde uhungarumlaut -10
-KPX ntilde umacron -10
-KPX ntilde uogonek -10
-KPX ntilde uring -10
-KPX ntilde v -40
-KPX ntilde y -20
-KPX ntilde yacute -20
-KPX ntilde ydieresis -20
-KPX o v -20
-KPX o w -15
-KPX o x -30
-KPX o y -20
-KPX o yacute -20
-KPX o ydieresis -20
-KPX oacute v -20
-KPX oacute w -15
-KPX oacute x -30
-KPX oacute y -20
-KPX oacute yacute -20
-KPX oacute ydieresis -20
-KPX ocircumflex v -20
-KPX ocircumflex w -15
-KPX ocircumflex x -30
-KPX ocircumflex y -20
-KPX ocircumflex yacute -20
-KPX ocircumflex ydieresis -20
-KPX odieresis v -20
-KPX odieresis w -15
-KPX odieresis x -30
-KPX odieresis y -20
-KPX odieresis yacute -20
-KPX odieresis ydieresis -20
-KPX ograve v -20
-KPX ograve w -15
-KPX ograve x -30
-KPX ograve y -20
-KPX ograve yacute -20
-KPX ograve ydieresis -20
-KPX ohungarumlaut v -20
-KPX ohungarumlaut w -15
-KPX ohungarumlaut x -30
-KPX ohungarumlaut y -20
-KPX ohungarumlaut yacute -20
-KPX ohungarumlaut ydieresis -20
-KPX omacron v -20
-KPX omacron w -15
-KPX omacron x -30
-KPX omacron y -20
-KPX omacron yacute -20
-KPX omacron ydieresis -20
-KPX oslash v -20
-KPX oslash w -15
-KPX oslash x -30
-KPX oslash y -20
-KPX oslash yacute -20
-KPX oslash ydieresis -20
-KPX otilde v -20
-KPX otilde w -15
-KPX otilde x -30
-KPX otilde y -20
-KPX otilde yacute -20
-KPX otilde ydieresis -20
-KPX p y -15
-KPX p yacute -15
-KPX p ydieresis -15
-KPX period quotedblright -120
-KPX period quoteright -120
-KPX period space -40
-KPX quotedblright space -80
-KPX quoteleft quoteleft -46
-KPX quoteright d -80
-KPX quoteright dcroat -80
-KPX quoteright l -20
-KPX quoteright lacute -20
-KPX quoteright lcommaaccent -20
-KPX quoteright lslash -20
-KPX quoteright quoteright -46
-KPX quoteright r -40
-KPX quoteright racute -40
-KPX quoteright rcaron -40
-KPX quoteright rcommaaccent -40
-KPX quoteright s -60
-KPX quoteright sacute -60
-KPX quoteright scaron -60
-KPX quoteright scedilla -60
-KPX quoteright scommaaccent -60
-KPX quoteright space -80
-KPX quoteright v -20
-KPX r c -20
-KPX r cacute -20
-KPX r ccaron -20
-KPX r ccedilla -20
-KPX r comma -60
-KPX r d -20
-KPX r dcroat -20
-KPX r g -15
-KPX r gbreve -15
-KPX r gcommaaccent -15
-KPX r hyphen -20
-KPX r o -20
-KPX r oacute -20
-KPX r ocircumflex -20
-KPX r odieresis -20
-KPX r ograve -20
-KPX r ohungarumlaut -20
-KPX r omacron -20
-KPX r oslash -20
-KPX r otilde -20
-KPX r period -60
-KPX r q -20
-KPX r s -15
-KPX r sacute -15
-KPX r scaron -15
-KPX r scedilla -15
-KPX r scommaaccent -15
-KPX r t 20
-KPX r tcommaaccent 20
-KPX r v 10
-KPX r y 10
-KPX r yacute 10
-KPX r ydieresis 10
-KPX racute c -20
-KPX racute cacute -20
-KPX racute ccaron -20
-KPX racute ccedilla -20
-KPX racute comma -60
-KPX racute d -20
-KPX racute dcroat -20
-KPX racute g -15
-KPX racute gbreve -15
-KPX racute gcommaaccent -15
-KPX racute hyphen -20
-KPX racute o -20
-KPX racute oacute -20
-KPX racute ocircumflex -20
-KPX racute odieresis -20
-KPX racute ograve -20
-KPX racute ohungarumlaut -20
-KPX racute omacron -20
-KPX racute oslash -20
-KPX racute otilde -20
-KPX racute period -60
-KPX racute q -20
-KPX racute s -15
-KPX racute sacute -15
-KPX racute scaron -15
-KPX racute scedilla -15
-KPX racute scommaaccent -15
-KPX racute t 20
-KPX racute tcommaaccent 20
-KPX racute v 10
-KPX racute y 10
-KPX racute yacute 10
-KPX racute ydieresis 10
-KPX rcaron c -20
-KPX rcaron cacute -20
-KPX rcaron ccaron -20
-KPX rcaron ccedilla -20
-KPX rcaron comma -60
-KPX rcaron d -20
-KPX rcaron dcroat -20
-KPX rcaron g -15
-KPX rcaron gbreve -15
-KPX rcaron gcommaaccent -15
-KPX rcaron hyphen -20
-KPX rcaron o -20
-KPX rcaron oacute -20
-KPX rcaron ocircumflex -20
-KPX rcaron odieresis -20
-KPX rcaron ograve -20
-KPX rcaron ohungarumlaut -20
-KPX rcaron omacron -20
-KPX rcaron oslash -20
-KPX rcaron otilde -20
-KPX rcaron period -60
-KPX rcaron q -20
-KPX rcaron s -15
-KPX rcaron sacute -15
-KPX rcaron scaron -15
-KPX rcaron scedilla -15
-KPX rcaron scommaaccent -15
-KPX rcaron t 20
-KPX rcaron tcommaaccent 20
-KPX rcaron v 10
-KPX rcaron y 10
-KPX rcaron yacute 10
-KPX rcaron ydieresis 10
-KPX rcommaaccent c -20
-KPX rcommaaccent cacute -20
-KPX rcommaaccent ccaron -20
-KPX rcommaaccent ccedilla -20
-KPX rcommaaccent comma -60
-KPX rcommaaccent d -20
-KPX rcommaaccent dcroat -20
-KPX rcommaaccent g -15
-KPX rcommaaccent gbreve -15
-KPX rcommaaccent gcommaaccent -15
-KPX rcommaaccent hyphen -20
-KPX rcommaaccent o -20
-KPX rcommaaccent oacute -20
-KPX rcommaaccent ocircumflex -20
-KPX rcommaaccent odieresis -20
-KPX rcommaaccent ograve -20
-KPX rcommaaccent ohungarumlaut -20
-KPX rcommaaccent omacron -20
-KPX rcommaaccent oslash -20
-KPX rcommaaccent otilde -20
-KPX rcommaaccent period -60
-KPX rcommaaccent q -20
-KPX rcommaaccent s -15
-KPX rcommaaccent sacute -15
-KPX rcommaaccent scaron -15
-KPX rcommaaccent scedilla -15
-KPX rcommaaccent scommaaccent -15
-KPX rcommaaccent t 20
-KPX rcommaaccent tcommaaccent 20
-KPX rcommaaccent v 10
-KPX rcommaaccent y 10
-KPX rcommaaccent yacute 10
-KPX rcommaaccent ydieresis 10
-KPX s w -15
-KPX sacute w -15
-KPX scaron w -15
-KPX scedilla w -15
-KPX scommaaccent w -15
-KPX semicolon space -40
-KPX space T -100
-KPX space Tcaron -100
-KPX space Tcommaaccent -100
-KPX space V -80
-KPX space W -80
-KPX space Y -120
-KPX space Yacute -120
-KPX space Ydieresis -120
-KPX space quotedblleft -80
-KPX space quoteleft -60
-KPX v a -20
-KPX v aacute -20
-KPX v abreve -20
-KPX v acircumflex -20
-KPX v adieresis -20
-KPX v agrave -20
-KPX v amacron -20
-KPX v aogonek -20
-KPX v aring -20
-KPX v atilde -20
-KPX v comma -80
-KPX v o -30
-KPX v oacute -30
-KPX v ocircumflex -30
-KPX v odieresis -30
-KPX v ograve -30
-KPX v ohungarumlaut -30
-KPX v omacron -30
-KPX v oslash -30
-KPX v otilde -30
-KPX v period -80
-KPX w comma -40
-KPX w o -20
-KPX w oacute -20
-KPX w ocircumflex -20
-KPX w odieresis -20
-KPX w ograve -20
-KPX w ohungarumlaut -20
-KPX w omacron -20
-KPX w oslash -20
-KPX w otilde -20
-KPX w period -40
-KPX x e -10
-KPX x eacute -10
-KPX x ecaron -10
-KPX x ecircumflex -10
-KPX x edieresis -10
-KPX x edotaccent -10
-KPX x egrave -10
-KPX x emacron -10
-KPX x eogonek -10
-KPX y a -30
-KPX y aacute -30
-KPX y abreve -30
-KPX y acircumflex -30
-KPX y adieresis -30
-KPX y agrave -30
-KPX y amacron -30
-KPX y aogonek -30
-KPX y aring -30
-KPX y atilde -30
-KPX y comma -80
-KPX y e -10
-KPX y eacute -10
-KPX y ecaron -10
-KPX y ecircumflex -10
-KPX y edieresis -10
-KPX y edotaccent -10
-KPX y egrave -10
-KPX y emacron -10
-KPX y eogonek -10
-KPX y o -25
-KPX y oacute -25
-KPX y ocircumflex -25
-KPX y odieresis -25
-KPX y ograve -25
-KPX y ohungarumlaut -25
-KPX y omacron -25
-KPX y oslash -25
-KPX y otilde -25
-KPX y period -80
-KPX yacute a -30
-KPX yacute aacute -30
-KPX yacute abreve -30
-KPX yacute acircumflex -30
-KPX yacute adieresis -30
-KPX yacute agrave -30
-KPX yacute amacron -30
-KPX yacute aogonek -30
-KPX yacute aring -30
-KPX yacute atilde -30
-KPX yacute comma -80
-KPX yacute e -10
-KPX yacute eacute -10
-KPX yacute ecaron -10
-KPX yacute ecircumflex -10
-KPX yacute edieresis -10
-KPX yacute edotaccent -10
-KPX yacute egrave -10
-KPX yacute emacron -10
-KPX yacute eogonek -10
-KPX yacute o -25
-KPX yacute oacute -25
-KPX yacute ocircumflex -25
-KPX yacute odieresis -25
-KPX yacute ograve -25
-KPX yacute ohungarumlaut -25
-KPX yacute omacron -25
-KPX yacute oslash -25
-KPX yacute otilde -25
-KPX yacute period -80
-KPX ydieresis a -30
-KPX ydieresis aacute -30
-KPX ydieresis abreve -30
-KPX ydieresis acircumflex -30
-KPX ydieresis adieresis -30
-KPX ydieresis agrave -30
-KPX ydieresis amacron -30
-KPX ydieresis aogonek -30
-KPX ydieresis aring -30
-KPX ydieresis atilde -30
-KPX ydieresis comma -80
-KPX ydieresis e -10
-KPX ydieresis eacute -10
-KPX ydieresis ecaron -10
-KPX ydieresis ecircumflex -10
-KPX ydieresis edieresis -10
-KPX ydieresis edotaccent -10
-KPX ydieresis egrave -10
-KPX ydieresis emacron -10
-KPX ydieresis eogonek -10
-KPX ydieresis o -25
-KPX ydieresis oacute -25
-KPX ydieresis ocircumflex -25
-KPX ydieresis odieresis -25
-KPX ydieresis ograve -25
-KPX ydieresis ohungarumlaut -25
-KPX ydieresis omacron -25
-KPX ydieresis oslash -25
-KPX ydieresis otilde -25
-KPX ydieresis period -80
-KPX z e 10
-KPX z eacute 10
-KPX z ecaron 10
-KPX z ecircumflex 10
-KPX z edieresis 10
-KPX z edotaccent 10
-KPX z egrave 10
-KPX z emacron 10
-KPX z eogonek 10
-KPX zacute e 10
-KPX zacute eacute 10
-KPX zacute ecaron 10
-KPX zacute ecircumflex 10
-KPX zacute edieresis 10
-KPX zacute edotaccent 10
-KPX zacute egrave 10
-KPX zacute emacron 10
-KPX zacute eogonek 10
-KPX zcaron e 10
-KPX zcaron eacute 10
-KPX zcaron ecaron 10
-KPX zcaron ecircumflex 10
-KPX zcaron edieresis 10
-KPX zcaron edotaccent 10
-KPX zcaron egrave 10
-KPX zcaron emacron 10
-KPX zcaron eogonek 10
-KPX zdotaccent e 10
-KPX zdotaccent eacute 10
-KPX zdotaccent ecaron 10
-KPX zdotaccent ecircumflex 10
-KPX zdotaccent edieresis 10
-KPX zdotaccent edotaccent 10
-KPX zdotaccent egrave 10
-KPX zdotaccent emacron 10
-KPX zdotaccent eogonek 10
-EndKernPairs
-EndKernData
-EndFontMetrics
-
diff --git a/LibrarySource/com/lowagie/text/pdf/fonts/Helvetica-Oblique.afm b/LibrarySource/com/lowagie/text/pdf/fonts/Helvetica-Oblique.afm
deleted file mode 100644
index 9ea431a..0000000
--- a/LibrarySource/com/lowagie/text/pdf/fonts/Helvetica-Oblique.afm
+++ /dev/null
@@ -1,3052 +0,0 @@
-StartFontMetrics 4.1
-Comment Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved.
-Comment Creation Date: Thu May 1 12:44:31 1997
-Comment UniqueID 43055
-Comment VMusage 14960 69346
-FontName Helvetica-Oblique
-FullName Helvetica Oblique
-FamilyName Helvetica
-Weight Medium
-ItalicAngle -12
-IsFixedPitch false
-CharacterSet ExtendedRoman
-FontBBox -170 -225 1116 931
-UnderlinePosition -100
-UnderlineThickness 50
-Version 002.000
-Notice Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved.Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries.
-EncodingScheme AdobeStandardEncoding
-CapHeight 718
-XHeight 523
-Ascender 718
-Descender -207
-StdHW 76
-StdVW 88
-StartCharMetrics 315
-C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
-C 33 ; WX 278 ; N exclam ; B 90 0 340 718 ;
-C 34 ; WX 355 ; N quotedbl ; B 168 463 438 718 ;
-C 35 ; WX 556 ; N numbersign ; B 73 0 631 688 ;
-C 36 ; WX 556 ; N dollar ; B 69 -115 617 775 ;
-C 37 ; WX 889 ; N percent ; B 147 -19 889 703 ;
-C 38 ; WX 667 ; N ampersand ; B 77 -15 647 718 ;
-C 39 ; WX 222 ; N quoteright ; B 151 463 310 718 ;
-C 40 ; WX 333 ; N parenleft ; B 108 -207 454 733 ;
-C 41 ; WX 333 ; N parenright ; B -9 -207 337 733 ;
-C 42 ; WX 389 ; N asterisk ; B 165 431 475 718 ;
-C 43 ; WX 584 ; N plus ; B 85 0 606 505 ;
-C 44 ; WX 278 ; N comma ; B 56 -147 214 106 ;
-C 45 ; WX 333 ; N hyphen ; B 93 232 357 322 ;
-C 46 ; WX 278 ; N period ; B 87 0 214 106 ;
-C 47 ; WX 278 ; N slash ; B -21 -19 452 737 ;
-C 48 ; WX 556 ; N zero ; B 93 -19 608 703 ;
-C 49 ; WX 556 ; N one ; B 207 0 508 703 ;
-C 50 ; WX 556 ; N two ; B 26 0 617 703 ;
-C 51 ; WX 556 ; N three ; B 75 -19 610 703 ;
-C 52 ; WX 556 ; N four ; B 61 0 576 703 ;
-C 53 ; WX 556 ; N five ; B 68 -19 621 688 ;
-C 54 ; WX 556 ; N six ; B 91 -19 615 703 ;
-C 55 ; WX 556 ; N seven ; B 137 0 669 688 ;
-C 56 ; WX 556 ; N eight ; B 74 -19 607 703 ;
-C 57 ; WX 556 ; N nine ; B 82 -19 609 703 ;
-C 58 ; WX 278 ; N colon ; B 87 0 301 516 ;
-C 59 ; WX 278 ; N semicolon ; B 56 -147 301 516 ;
-C 60 ; WX 584 ; N less ; B 94 11 641 495 ;
-C 61 ; WX 584 ; N equal ; B 63 115 628 390 ;
-C 62 ; WX 584 ; N greater ; B 50 11 597 495 ;
-C 63 ; WX 556 ; N question ; B 161 0 610 727 ;
-C 64 ; WX 1015 ; N at ; B 215 -19 965 737 ;
-C 65 ; WX 667 ; N A ; B 14 0 654 718 ;
-C 66 ; WX 667 ; N B ; B 74 0 712 718 ;
-C 67 ; WX 722 ; N C ; B 108 -19 782 737 ;
-C 68 ; WX 722 ; N D ; B 81 0 764 718 ;
-C 69 ; WX 667 ; N E ; B 86 0 762 718 ;
-C 70 ; WX 611 ; N F ; B 86 0 736 718 ;
-C 71 ; WX 778 ; N G ; B 111 -19 799 737 ;
-C 72 ; WX 722 ; N H ; B 77 0 799 718 ;
-C 73 ; WX 278 ; N I ; B 91 0 341 718 ;
-C 74 ; WX 500 ; N J ; B 47 -19 581 718 ;
-C 75 ; WX 667 ; N K ; B 76 0 808 718 ;
-C 76 ; WX 556 ; N L ; B 76 0 555 718 ;
-C 77 ; WX 833 ; N M ; B 73 0 914 718 ;
-C 78 ; WX 722 ; N N ; B 76 0 799 718 ;
-C 79 ; WX 778 ; N O ; B 105 -19 826 737 ;
-C 80 ; WX 667 ; N P ; B 86 0 737 718 ;
-C 81 ; WX 778 ; N Q ; B 105 -56 826 737 ;
-C 82 ; WX 722 ; N R ; B 88 0 773 718 ;
-C 83 ; WX 667 ; N S ; B 90 -19 713 737 ;
-C 84 ; WX 611 ; N T ; B 148 0 750 718 ;
-C 85 ; WX 722 ; N U ; B 123 -19 797 718 ;
-C 86 ; WX 667 ; N V ; B 173 0 800 718 ;
-C 87 ; WX 944 ; N W ; B 169 0 1081 718 ;
-C 88 ; WX 667 ; N X ; B 19 0 790 718 ;
-C 89 ; WX 667 ; N Y ; B 167 0 806 718 ;
-C 90 ; WX 611 ; N Z ; B 23 0 741 718 ;
-C 91 ; WX 278 ; N bracketleft ; B 21 -196 403 722 ;
-C 92 ; WX 278 ; N backslash ; B 140 -19 291 737 ;
-C 93 ; WX 278 ; N bracketright ; B -14 -196 368 722 ;
-C 94 ; WX 469 ; N asciicircum ; B 42 264 539 688 ;
-C 95 ; WX 556 ; N underscore ; B -27 -125 540 -75 ;
-C 96 ; WX 222 ; N quoteleft ; B 165 470 323 725 ;
-C 97 ; WX 556 ; N a ; B 61 -15 559 538 ;
-C 98 ; WX 556 ; N b ; B 58 -15 584 718 ;
-C 99 ; WX 500 ; N c ; B 74 -15 553 538 ;
-C 100 ; WX 556 ; N d ; B 84 -15 652 718 ;
-C 101 ; WX 556 ; N e ; B 84 -15 578 538 ;
-C 102 ; WX 278 ; N f ; B 86 0 416 728 ; L i fi ; L l fl ;
-C 103 ; WX 556 ; N g ; B 42 -220 610 538 ;
-C 104 ; WX 556 ; N h ; B 65 0 573 718 ;
-C 105 ; WX 222 ; N i ; B 67 0 308 718 ;
-C 106 ; WX 222 ; N j ; B -60 -210 308 718 ;
-C 107 ; WX 500 ; N k ; B 67 0 600 718 ;
-C 108 ; WX 222 ; N l ; B 67 0 308 718 ;
-C 109 ; WX 833 ; N m ; B 65 0 852 538 ;
-C 110 ; WX 556 ; N n ; B 65 0 573 538 ;
-C 111 ; WX 556 ; N o ; B 83 -14 585 538 ;
-C 112 ; WX 556 ; N p ; B 14 -207 584 538 ;
-C 113 ; WX 556 ; N q ; B 84 -207 605 538 ;
-C 114 ; WX 333 ; N r ; B 77 0 446 538 ;
-C 115 ; WX 500 ; N s ; B 63 -15 529 538 ;
-C 116 ; WX 278 ; N t ; B 102 -7 368 669 ;
-C 117 ; WX 556 ; N u ; B 94 -15 600 523 ;
-C 118 ; WX 500 ; N v ; B 119 0 603 523 ;
-C 119 ; WX 722 ; N w ; B 125 0 820 523 ;
-C 120 ; WX 500 ; N x ; B 11 0 594 523 ;
-C 121 ; WX 500 ; N y ; B 15 -214 600 523 ;
-C 122 ; WX 500 ; N z ; B 31 0 571 523 ;
-C 123 ; WX 334 ; N braceleft ; B 92 -196 445 722 ;
-C 124 ; WX 260 ; N bar ; B 46 -225 332 775 ;
-C 125 ; WX 334 ; N braceright ; B 0 -196 354 722 ;
-C 126 ; WX 584 ; N asciitilde ; B 111 180 580 326 ;
-C 161 ; WX 333 ; N exclamdown ; B 77 -195 326 523 ;
-C 162 ; WX 556 ; N cent ; B 95 -115 584 623 ;
-C 163 ; WX 556 ; N sterling ; B 49 -16 634 718 ;
-C 164 ; WX 167 ; N fraction ; B -170 -19 482 703 ;
-C 165 ; WX 556 ; N yen ; B 81 0 699 688 ;
-C 166 ; WX 556 ; N florin ; B -52 -207 654 737 ;
-C 167 ; WX 556 ; N section ; B 76 -191 584 737 ;
-C 168 ; WX 556 ; N currency ; B 60 99 646 603 ;
-C 169 ; WX 191 ; N quotesingle ; B 157 463 285 718 ;
-C 170 ; WX 333 ; N quotedblleft ; B 138 470 461 725 ;
-C 171 ; WX 556 ; N guillemotleft ; B 146 108 554 446 ;
-C 172 ; WX 333 ; N guilsinglleft ; B 137 108 340 446 ;
-C 173 ; WX 333 ; N guilsinglright ; B 111 108 314 446 ;
-C 174 ; WX 500 ; N fi ; B 86 0 587 728 ;
-C 175 ; WX 500 ; N fl ; B 86 0 585 728 ;
-C 177 ; WX 556 ; N endash ; B 51 240 623 313 ;
-C 178 ; WX 556 ; N dagger ; B 135 -159 622 718 ;
-C 179 ; WX 556 ; N daggerdbl ; B 52 -159 623 718 ;
-C 180 ; WX 278 ; N periodcentered ; B 129 190 257 315 ;
-C 182 ; WX 537 ; N paragraph ; B 126 -173 650 718 ;
-C 183 ; WX 350 ; N bullet ; B 91 202 413 517 ;
-C 184 ; WX 222 ; N quotesinglbase ; B 21 -149 180 106 ;
-C 185 ; WX 333 ; N quotedblbase ; B -6 -149 318 106 ;
-C 186 ; WX 333 ; N quotedblright ; B 124 463 448 718 ;
-C 187 ; WX 556 ; N guillemotright ; B 120 108 528 446 ;
-C 188 ; WX 1000 ; N ellipsis ; B 115 0 908 106 ;
-C 189 ; WX 1000 ; N perthousand ; B 88 -19 1029 703 ;
-C 191 ; WX 611 ; N questiondown ; B 85 -201 534 525 ;
-C 193 ; WX 333 ; N grave ; B 170 593 337 734 ;
-C 194 ; WX 333 ; N acute ; B 248 593 475 734 ;
-C 195 ; WX 333 ; N circumflex ; B 147 593 438 734 ;
-C 196 ; WX 333 ; N tilde ; B 125 606 490 722 ;
-C 197 ; WX 333 ; N macron ; B 143 627 468 684 ;
-C 198 ; WX 333 ; N breve ; B 167 595 476 731 ;
-C 199 ; WX 333 ; N dotaccent ; B 249 604 362 706 ;
-C 200 ; WX 333 ; N dieresis ; B 168 604 443 706 ;
-C 202 ; WX 333 ; N ring ; B 214 572 402 756 ;
-C 203 ; WX 333 ; N cedilla ; B 2 -225 232 0 ;
-C 205 ; WX 333 ; N hungarumlaut ; B 157 593 565 734 ;
-C 206 ; WX 333 ; N ogonek ; B 43 -225 249 0 ;
-C 207 ; WX 333 ; N caron ; B 177 593 468 734 ;
-C 208 ; WX 1000 ; N emdash ; B 51 240 1067 313 ;
-C 225 ; WX 1000 ; N AE ; B 8 0 1097 718 ;
-C 227 ; WX 370 ; N ordfeminine ; B 127 405 449 737 ;
-C 232 ; WX 556 ; N Lslash ; B 41 0 555 718 ;
-C 233 ; WX 778 ; N Oslash ; B 43 -19 890 737 ;
-C 234 ; WX 1000 ; N OE ; B 98 -19 1116 737 ;
-C 235 ; WX 365 ; N ordmasculine ; B 141 405 468 737 ;
-C 241 ; WX 889 ; N ae ; B 61 -15 909 538 ;
-C 245 ; WX 278 ; N dotlessi ; B 95 0 294 523 ;
-C 248 ; WX 222 ; N lslash ; B 41 0 347 718 ;
-C 249 ; WX 611 ; N oslash ; B 29 -22 647 545 ;
-C 250 ; WX 944 ; N oe ; B 83 -15 964 538 ;
-C 251 ; WX 611 ; N germandbls ; B 67 -15 658 728 ;
-C -1 ; WX 278 ; N Idieresis ; B 91 0 458 901 ;
-C -1 ; WX 556 ; N eacute ; B 84 -15 587 734 ;
-C -1 ; WX 556 ; N abreve ; B 61 -15 578 731 ;
-C -1 ; WX 556 ; N uhungarumlaut ; B 94 -15 677 734 ;
-C -1 ; WX 556 ; N ecaron ; B 84 -15 580 734 ;
-C -1 ; WX 667 ; N Ydieresis ; B 167 0 806 901 ;
-C -1 ; WX 584 ; N divide ; B 85 -19 606 524 ;
-C -1 ; WX 667 ; N Yacute ; B 167 0 806 929 ;
-C -1 ; WX 667 ; N Acircumflex ; B 14 0 654 929 ;
-C -1 ; WX 556 ; N aacute ; B 61 -15 587 734 ;
-C -1 ; WX 722 ; N Ucircumflex ; B 123 -19 797 929 ;
-C -1 ; WX 500 ; N yacute ; B 15 -214 600 734 ;
-C -1 ; WX 500 ; N scommaaccent ; B 63 -225 529 538 ;
-C -1 ; WX 556 ; N ecircumflex ; B 84 -15 578 734 ;
-C -1 ; WX 722 ; N Uring ; B 123 -19 797 931 ;
-C -1 ; WX 722 ; N Udieresis ; B 123 -19 797 901 ;
-C -1 ; WX 556 ; N aogonek ; B 61 -220 559 538 ;
-C -1 ; WX 722 ; N Uacute ; B 123 -19 797 929 ;
-C -1 ; WX 556 ; N uogonek ; B 94 -225 600 523 ;
-C -1 ; WX 667 ; N Edieresis ; B 86 0 762 901 ;
-C -1 ; WX 722 ; N Dcroat ; B 69 0 764 718 ;
-C -1 ; WX 250 ; N commaaccent ; B 39 -225 172 -40 ;
-C -1 ; WX 737 ; N copyright ; B 54 -19 837 737 ;
-C -1 ; WX 667 ; N Emacron ; B 86 0 762 879 ;
-C -1 ; WX 500 ; N ccaron ; B 74 -15 553 734 ;
-C -1 ; WX 556 ; N aring ; B 61 -15 559 756 ;
-C -1 ; WX 722 ; N Ncommaaccent ; B 76 -225 799 718 ;
-C -1 ; WX 222 ; N lacute ; B 67 0 461 929 ;
-C -1 ; WX 556 ; N agrave ; B 61 -15 559 734 ;
-C -1 ; WX 611 ; N Tcommaaccent ; B 148 -225 750 718 ;
-C -1 ; WX 722 ; N Cacute ; B 108 -19 782 929 ;
-C -1 ; WX 556 ; N atilde ; B 61 -15 592 722 ;
-C -1 ; WX 667 ; N Edotaccent ; B 86 0 762 901 ;
-C -1 ; WX 500 ; N scaron ; B 63 -15 552 734 ;
-C -1 ; WX 500 ; N scedilla ; B 63 -225 529 538 ;
-C -1 ; WX 278 ; N iacute ; B 95 0 448 734 ;
-C -1 ; WX 471 ; N lozenge ; B 88 0 540 728 ;
-C -1 ; WX 722 ; N Rcaron ; B 88 0 773 929 ;
-C -1 ; WX 778 ; N Gcommaaccent ; B 111 -225 799 737 ;
-C -1 ; WX 556 ; N ucircumflex ; B 94 -15 600 734 ;
-C -1 ; WX 556 ; N acircumflex ; B 61 -15 559 734 ;
-C -1 ; WX 667 ; N Amacron ; B 14 0 677 879 ;
-C -1 ; WX 333 ; N rcaron ; B 77 0 508 734 ;
-C -1 ; WX 500 ; N ccedilla ; B 74 -225 553 538 ;
-C -1 ; WX 611 ; N Zdotaccent ; B 23 0 741 901 ;
-C -1 ; WX 667 ; N Thorn ; B 86 0 712 718 ;
-C -1 ; WX 778 ; N Omacron ; B 105 -19 826 879 ;
-C -1 ; WX 722 ; N Racute ; B 88 0 773 929 ;
-C -1 ; WX 667 ; N Sacute ; B 90 -19 713 929 ;
-C -1 ; WX 643 ; N dcaron ; B 84 -15 808 718 ;
-C -1 ; WX 722 ; N Umacron ; B 123 -19 797 879 ;
-C -1 ; WX 556 ; N uring ; B 94 -15 600 756 ;
-C -1 ; WX 333 ; N threesuperior ; B 90 270 436 703 ;
-C -1 ; WX 778 ; N Ograve ; B 105 -19 826 929 ;
-C -1 ; WX 667 ; N Agrave ; B 14 0 654 929 ;
-C -1 ; WX 667 ; N Abreve ; B 14 0 685 926 ;
-C -1 ; WX 584 ; N multiply ; B 50 0 642 506 ;
-C -1 ; WX 556 ; N uacute ; B 94 -15 600 734 ;
-C -1 ; WX 611 ; N Tcaron ; B 148 0 750 929 ;
-C -1 ; WX 476 ; N partialdiff ; B 41 -38 550 714 ;
-C -1 ; WX 500 ; N ydieresis ; B 15 -214 600 706 ;
-C -1 ; WX 722 ; N Nacute ; B 76 0 799 929 ;
-C -1 ; WX 278 ; N icircumflex ; B 95 0 411 734 ;
-C -1 ; WX 667 ; N Ecircumflex ; B 86 0 762 929 ;
-C -1 ; WX 556 ; N adieresis ; B 61 -15 559 706 ;
-C -1 ; WX 556 ; N edieresis ; B 84 -15 578 706 ;
-C -1 ; WX 500 ; N cacute ; B 74 -15 559 734 ;
-C -1 ; WX 556 ; N nacute ; B 65 0 587 734 ;
-C -1 ; WX 556 ; N umacron ; B 94 -15 600 684 ;
-C -1 ; WX 722 ; N Ncaron ; B 76 0 799 929 ;
-C -1 ; WX 278 ; N Iacute ; B 91 0 489 929 ;
-C -1 ; WX 584 ; N plusminus ; B 39 0 618 506 ;
-C -1 ; WX 260 ; N brokenbar ; B 62 -150 316 700 ;
-C -1 ; WX 737 ; N registered ; B 54 -19 837 737 ;
-C -1 ; WX 778 ; N Gbreve ; B 111 -19 799 926 ;
-C -1 ; WX 278 ; N Idotaccent ; B 91 0 377 901 ;
-C -1 ; WX 600 ; N summation ; B 15 -10 671 706 ;
-C -1 ; WX 667 ; N Egrave ; B 86 0 762 929 ;
-C -1 ; WX 333 ; N racute ; B 77 0 475 734 ;
-C -1 ; WX 556 ; N omacron ; B 83 -14 585 684 ;
-C -1 ; WX 611 ; N Zacute ; B 23 0 741 929 ;
-C -1 ; WX 611 ; N Zcaron ; B 23 0 741 929 ;
-C -1 ; WX 549 ; N greaterequal ; B 26 0 620 674 ;
-C -1 ; WX 722 ; N Eth ; B 69 0 764 718 ;
-C -1 ; WX 722 ; N Ccedilla ; B 108 -225 782 737 ;
-C -1 ; WX 222 ; N lcommaaccent ; B 25 -225 308 718 ;
-C -1 ; WX 317 ; N tcaron ; B 102 -7 501 808 ;
-C -1 ; WX 556 ; N eogonek ; B 84 -225 578 538 ;
-C -1 ; WX 722 ; N Uogonek ; B 123 -225 797 718 ;
-C -1 ; WX 667 ; N Aacute ; B 14 0 683 929 ;
-C -1 ; WX 667 ; N Adieresis ; B 14 0 654 901 ;
-C -1 ; WX 556 ; N egrave ; B 84 -15 578 734 ;
-C -1 ; WX 500 ; N zacute ; B 31 0 571 734 ;
-C -1 ; WX 222 ; N iogonek ; B -61 -225 308 718 ;
-C -1 ; WX 778 ; N Oacute ; B 105 -19 826 929 ;
-C -1 ; WX 556 ; N oacute ; B 83 -14 587 734 ;
-C -1 ; WX 556 ; N amacron ; B 61 -15 580 684 ;
-C -1 ; WX 500 ; N sacute ; B 63 -15 559 734 ;
-C -1 ; WX 278 ; N idieresis ; B 95 0 416 706 ;
-C -1 ; WX 778 ; N Ocircumflex ; B 105 -19 826 929 ;
-C -1 ; WX 722 ; N Ugrave ; B 123 -19 797 929 ;
-C -1 ; WX 612 ; N Delta ; B 6 0 608 688 ;
-C -1 ; WX 556 ; N thorn ; B 14 -207 584 718 ;
-C -1 ; WX 333 ; N twosuperior ; B 64 281 449 703 ;
-C -1 ; WX 778 ; N Odieresis ; B 105 -19 826 901 ;
-C -1 ; WX 556 ; N mu ; B 24 -207 600 523 ;
-C -1 ; WX 278 ; N igrave ; B 95 0 310 734 ;
-C -1 ; WX 556 ; N ohungarumlaut ; B 83 -14 677 734 ;
-C -1 ; WX 667 ; N Eogonek ; B 86 -220 762 718 ;
-C -1 ; WX 556 ; N dcroat ; B 84 -15 689 718 ;
-C -1 ; WX 834 ; N threequarters ; B 130 -19 861 703 ;
-C -1 ; WX 667 ; N Scedilla ; B 90 -225 713 737 ;
-C -1 ; WX 299 ; N lcaron ; B 67 0 464 718 ;
-C -1 ; WX 667 ; N Kcommaaccent ; B 76 -225 808 718 ;
-C -1 ; WX 556 ; N Lacute ; B 76 0 555 929 ;
-C -1 ; WX 1000 ; N trademark ; B 186 306 1056 718 ;
-C -1 ; WX 556 ; N edotaccent ; B 84 -15 578 706 ;
-C -1 ; WX 278 ; N Igrave ; B 91 0 351 929 ;
-C -1 ; WX 278 ; N Imacron ; B 91 0 483 879 ;
-C -1 ; WX 556 ; N Lcaron ; B 76 0 570 718 ;
-C -1 ; WX 834 ; N onehalf ; B 114 -19 839 703 ;
-C -1 ; WX 549 ; N lessequal ; B 26 0 666 674 ;
-C -1 ; WX 556 ; N ocircumflex ; B 83 -14 585 734 ;
-C -1 ; WX 556 ; N ntilde ; B 65 0 592 722 ;
-C -1 ; WX 722 ; N Uhungarumlaut ; B 123 -19 801 929 ;
-C -1 ; WX 667 ; N Eacute ; B 86 0 762 929 ;
-C -1 ; WX 556 ; N emacron ; B 84 -15 580 684 ;
-C -1 ; WX 556 ; N gbreve ; B 42 -220 610 731 ;
-C -1 ; WX 834 ; N onequarter ; B 150 -19 802 703 ;
-C -1 ; WX 667 ; N Scaron ; B 90 -19 713 929 ;
-C -1 ; WX 667 ; N Scommaaccent ; B 90 -225 713 737 ;
-C -1 ; WX 778 ; N Ohungarumlaut ; B 105 -19 829 929 ;
-C -1 ; WX 400 ; N degree ; B 169 411 468 703 ;
-C -1 ; WX 556 ; N ograve ; B 83 -14 585 734 ;
-C -1 ; WX 722 ; N Ccaron ; B 108 -19 782 929 ;
-C -1 ; WX 556 ; N ugrave ; B 94 -15 600 734 ;
-C -1 ; WX 453 ; N radical ; B 79 -80 617 762 ;
-C -1 ; WX 722 ; N Dcaron ; B 81 0 764 929 ;
-C -1 ; WX 333 ; N rcommaaccent ; B 30 -225 446 538 ;
-C -1 ; WX 722 ; N Ntilde ; B 76 0 799 917 ;
-C -1 ; WX 556 ; N otilde ; B 83 -14 602 722 ;
-C -1 ; WX 722 ; N Rcommaaccent ; B 88 -225 773 718 ;
-C -1 ; WX 556 ; N Lcommaaccent ; B 76 -225 555 718 ;
-C -1 ; WX 667 ; N Atilde ; B 14 0 699 917 ;
-C -1 ; WX 667 ; N Aogonek ; B 14 -225 654 718 ;
-C -1 ; WX 667 ; N Aring ; B 14 0 654 931 ;
-C -1 ; WX 778 ; N Otilde ; B 105 -19 826 917 ;
-C -1 ; WX 500 ; N zdotaccent ; B 31 0 571 706 ;
-C -1 ; WX 667 ; N Ecaron ; B 86 0 762 929 ;
-C -1 ; WX 278 ; N Iogonek ; B -33 -225 341 718 ;
-C -1 ; WX 500 ; N kcommaaccent ; B 67 -225 600 718 ;
-C -1 ; WX 584 ; N minus ; B 85 216 606 289 ;
-C -1 ; WX 278 ; N Icircumflex ; B 91 0 452 929 ;
-C -1 ; WX 556 ; N ncaron ; B 65 0 580 734 ;
-C -1 ; WX 278 ; N tcommaaccent ; B 63 -225 368 669 ;
-C -1 ; WX 584 ; N logicalnot ; B 106 108 628 390 ;
-C -1 ; WX 556 ; N odieresis ; B 83 -14 585 706 ;
-C -1 ; WX 556 ; N udieresis ; B 94 -15 600 706 ;
-C -1 ; WX 549 ; N notequal ; B 34 -35 623 551 ;
-C -1 ; WX 556 ; N gcommaaccent ; B 42 -220 610 822 ;
-C -1 ; WX 556 ; N eth ; B 81 -15 617 737 ;
-C -1 ; WX 500 ; N zcaron ; B 31 0 571 734 ;
-C -1 ; WX 556 ; N ncommaaccent ; B 65 -225 573 538 ;
-C -1 ; WX 333 ; N onesuperior ; B 166 281 371 703 ;
-C -1 ; WX 278 ; N imacron ; B 95 0 417 684 ;
-C -1 ; WX 556 ; N Euro ; B 0 0 0 0 ;
-EndCharMetrics
-StartKernData
-StartKernPairs 2705
-KPX A C -30
-KPX A Cacute -30
-KPX A Ccaron -30
-KPX A Ccedilla -30
-KPX A G -30
-KPX A Gbreve -30
-KPX A Gcommaaccent -30
-KPX A O -30
-KPX A Oacute -30
-KPX A Ocircumflex -30
-KPX A Odieresis -30
-KPX A Ograve -30
-KPX A Ohungarumlaut -30
-KPX A Omacron -30
-KPX A Oslash -30
-KPX A Otilde -30
-KPX A Q -30
-KPX A T -120
-KPX A Tcaron -120
-KPX A Tcommaaccent -120
-KPX A U -50
-KPX A Uacute -50
-KPX A Ucircumflex -50
-KPX A Udieresis -50
-KPX A Ugrave -50
-KPX A Uhungarumlaut -50
-KPX A Umacron -50
-KPX A Uogonek -50
-KPX A Uring -50
-KPX A V -70
-KPX A W -50
-KPX A Y -100
-KPX A Yacute -100
-KPX A Ydieresis -100
-KPX A u -30
-KPX A uacute -30
-KPX A ucircumflex -30
-KPX A udieresis -30
-KPX A ugrave -30
-KPX A uhungarumlaut -30
-KPX A umacron -30
-KPX A uogonek -30
-KPX A uring -30
-KPX A v -40
-KPX A w -40
-KPX A y -40
-KPX A yacute -40
-KPX A ydieresis -40
-KPX Aacute C -30
-KPX Aacute Cacute -30
-KPX Aacute Ccaron -30
-KPX Aacute Ccedilla -30
-KPX Aacute G -30
-KPX Aacute Gbreve -30
-KPX Aacute Gcommaaccent -30
-KPX Aacute O -30
-KPX Aacute Oacute -30
-KPX Aacute Ocircumflex -30
-KPX Aacute Odieresis -30
-KPX Aacute Ograve -30
-KPX Aacute Ohungarumlaut -30
-KPX Aacute Omacron -30
-KPX Aacute Oslash -30
-KPX Aacute Otilde -30
-KPX Aacute Q -30
-KPX Aacute T -120
-KPX Aacute Tcaron -120
-KPX Aacute Tcommaaccent -120
-KPX Aacute U -50
-KPX Aacute Uacute -50
-KPX Aacute Ucircumflex -50
-KPX Aacute Udieresis -50
-KPX Aacute Ugrave -50
-KPX Aacute Uhungarumlaut -50
-KPX Aacute Umacron -50
-KPX Aacute Uogonek -50
-KPX Aacute Uring -50
-KPX Aacute V -70
-KPX Aacute W -50
-KPX Aacute Y -100
-KPX Aacute Yacute -100
-KPX Aacute Ydieresis -100
-KPX Aacute u -30
-KPX Aacute uacute -30
-KPX Aacute ucircumflex -30
-KPX Aacute udieresis -30
-KPX Aacute ugrave -30
-KPX Aacute uhungarumlaut -30
-KPX Aacute umacron -30
-KPX Aacute uogonek -30
-KPX Aacute uring -30
-KPX Aacute v -40
-KPX Aacute w -40
-KPX Aacute y -40
-KPX Aacute yacute -40
-KPX Aacute ydieresis -40
-KPX Abreve C -30
-KPX Abreve Cacute -30
-KPX Abreve Ccaron -30
-KPX Abreve Ccedilla -30
-KPX Abreve G -30
-KPX Abreve Gbreve -30
-KPX Abreve Gcommaaccent -30
-KPX Abreve O -30
-KPX Abreve Oacute -30
-KPX Abreve Ocircumflex -30
-KPX Abreve Odieresis -30
-KPX Abreve Ograve -30
-KPX Abreve Ohungarumlaut -30
-KPX Abreve Omacron -30
-KPX Abreve Oslash -30
-KPX Abreve Otilde -30
-KPX Abreve Q -30
-KPX Abreve T -120
-KPX Abreve Tcaron -120
-KPX Abreve Tcommaaccent -120
-KPX Abreve U -50
-KPX Abreve Uacute -50
-KPX Abreve Ucircumflex -50
-KPX Abreve Udieresis -50
-KPX Abreve Ugrave -50
-KPX Abreve Uhungarumlaut -50
-KPX Abreve Umacron -50
-KPX Abreve Uogonek -50
-KPX Abreve Uring -50
-KPX Abreve V -70
-KPX Abreve W -50
-KPX Abreve Y -100
-KPX Abreve Yacute -100
-KPX Abreve Ydieresis -100
-KPX Abreve u -30
-KPX Abreve uacute -30
-KPX Abreve ucircumflex -30
-KPX Abreve udieresis -30
-KPX Abreve ugrave -30
-KPX Abreve uhungarumlaut -30
-KPX Abreve umacron -30
-KPX Abreve uogonek -30
-KPX Abreve uring -30
-KPX Abreve v -40
-KPX Abreve w -40
-KPX Abreve y -40
-KPX Abreve yacute -40
-KPX Abreve ydieresis -40
-KPX Acircumflex C -30
-KPX Acircumflex Cacute -30
-KPX Acircumflex Ccaron -30
-KPX Acircumflex Ccedilla -30
-KPX Acircumflex G -30
-KPX Acircumflex Gbreve -30
-KPX Acircumflex Gcommaaccent -30
-KPX Acircumflex O -30
-KPX Acircumflex Oacute -30
-KPX Acircumflex Ocircumflex -30
-KPX Acircumflex Odieresis -30
-KPX Acircumflex Ograve -30
-KPX Acircumflex Ohungarumlaut -30
-KPX Acircumflex Omacron -30
-KPX Acircumflex Oslash -30
-KPX Acircumflex Otilde -30
-KPX Acircumflex Q -30
-KPX Acircumflex T -120
-KPX Acircumflex Tcaron -120
-KPX Acircumflex Tcommaaccent -120
-KPX Acircumflex U -50
-KPX Acircumflex Uacute -50
-KPX Acircumflex Ucircumflex -50
-KPX Acircumflex Udieresis -50
-KPX Acircumflex Ugrave -50
-KPX Acircumflex Uhungarumlaut -50
-KPX Acircumflex Umacron -50
-KPX Acircumflex Uogonek -50
-KPX Acircumflex Uring -50
-KPX Acircumflex V -70
-KPX Acircumflex W -50
-KPX Acircumflex Y -100
-KPX Acircumflex Yacute -100
-KPX Acircumflex Ydieresis -100
-KPX Acircumflex u -30
-KPX Acircumflex uacute -30
-KPX Acircumflex ucircumflex -30
-KPX Acircumflex udieresis -30
-KPX Acircumflex ugrave -30
-KPX Acircumflex uhungarumlaut -30
-KPX Acircumflex umacron -30
-KPX Acircumflex uogonek -30
-KPX Acircumflex uring -30
-KPX Acircumflex v -40
-KPX Acircumflex w -40
-KPX Acircumflex y -40
-KPX Acircumflex yacute -40
-KPX Acircumflex ydieresis -40
-KPX Adieresis C -30
-KPX Adieresis Cacute -30
-KPX Adieresis Ccaron -30
-KPX Adieresis Ccedilla -30
-KPX Adieresis G -30
-KPX Adieresis Gbreve -30
-KPX Adieresis Gcommaaccent -30
-KPX Adieresis O -30
-KPX Adieresis Oacute -30
-KPX Adieresis Ocircumflex -30
-KPX Adieresis Odieresis -30
-KPX Adieresis Ograve -30
-KPX Adieresis Ohungarumlaut -30
-KPX Adieresis Omacron -30
-KPX Adieresis Oslash -30
-KPX Adieresis Otilde -30
-KPX Adieresis Q -30
-KPX Adieresis T -120
-KPX Adieresis Tcaron -120
-KPX Adieresis Tcommaaccent -120
-KPX Adieresis U -50
-KPX Adieresis Uacute -50
-KPX Adieresis Ucircumflex -50
-KPX Adieresis Udieresis -50
-KPX Adieresis Ugrave -50
-KPX Adieresis Uhungarumlaut -50
-KPX Adieresis Umacron -50
-KPX Adieresis Uogonek -50
-KPX Adieresis Uring -50
-KPX Adieresis V -70
-KPX Adieresis W -50
-KPX Adieresis Y -100
-KPX Adieresis Yacute -100
-KPX Adieresis Ydieresis -100
-KPX Adieresis u -30
-KPX Adieresis uacute -30
-KPX Adieresis ucircumflex -30
-KPX Adieresis udieresis -30
-KPX Adieresis ugrave -30
-KPX Adieresis uhungarumlaut -30
-KPX Adieresis umacron -30
-KPX Adieresis uogonek -30
-KPX Adieresis uring -30
-KPX Adieresis v -40
-KPX Adieresis w -40
-KPX Adieresis y -40
-KPX Adieresis yacute -40
-KPX Adieresis ydieresis -40
-KPX Agrave C -30
-KPX Agrave Cacute -30
-KPX Agrave Ccaron -30
-KPX Agrave Ccedilla -30
-KPX Agrave G -30
-KPX Agrave Gbreve -30
-KPX Agrave Gcommaaccent -30
-KPX Agrave O -30
-KPX Agrave Oacute -30
-KPX Agrave Ocircumflex -30
-KPX Agrave Odieresis -30
-KPX Agrave Ograve -30
-KPX Agrave Ohungarumlaut -30
-KPX Agrave Omacron -30
-KPX Agrave Oslash -30
-KPX Agrave Otilde -30
-KPX Agrave Q -30
-KPX Agrave T -120
-KPX Agrave Tcaron -120
-KPX Agrave Tcommaaccent -120
-KPX Agrave U -50
-KPX Agrave Uacute -50
-KPX Agrave Ucircumflex -50
-KPX Agrave Udieresis -50
-KPX Agrave Ugrave -50
-KPX Agrave Uhungarumlaut -50
-KPX Agrave Umacron -50
-KPX Agrave Uogonek -50
-KPX Agrave Uring -50
-KPX Agrave V -70
-KPX Agrave W -50
-KPX Agrave Y -100
-KPX Agrave Yacute -100
-KPX Agrave Ydieresis -100
-KPX Agrave u -30
-KPX Agrave uacute -30
-KPX Agrave ucircumflex -30
-KPX Agrave udieresis -30
-KPX Agrave ugrave -30
-KPX Agrave uhungarumlaut -30
-KPX Agrave umacron -30
-KPX Agrave uogonek -30
-KPX Agrave uring -30
-KPX Agrave v -40
-KPX Agrave w -40
-KPX Agrave y -40
-KPX Agrave yacute -40
-KPX Agrave ydieresis -40
-KPX Amacron C -30
-KPX Amacron Cacute -30
-KPX Amacron Ccaron -30
-KPX Amacron Ccedilla -30
-KPX Amacron G -30
-KPX Amacron Gbreve -30
-KPX Amacron Gcommaaccent -30
-KPX Amacron O -30
-KPX Amacron Oacute -30
-KPX Amacron Ocircumflex -30
-KPX Amacron Odieresis -30
-KPX Amacron Ograve -30
-KPX Amacron Ohungarumlaut -30
-KPX Amacron Omacron -30
-KPX Amacron Oslash -30
-KPX Amacron Otilde -30
-KPX Amacron Q -30
-KPX Amacron T -120
-KPX Amacron Tcaron -120
-KPX Amacron Tcommaaccent -120
-KPX Amacron U -50
-KPX Amacron Uacute -50
-KPX Amacron Ucircumflex -50
-KPX Amacron Udieresis -50
-KPX Amacron Ugrave -50
-KPX Amacron Uhungarumlaut -50
-KPX Amacron Umacron -50
-KPX Amacron Uogonek -50
-KPX Amacron Uring -50
-KPX Amacron V -70
-KPX Amacron W -50
-KPX Amacron Y -100
-KPX Amacron Yacute -100
-KPX Amacron Ydieresis -100
-KPX Amacron u -30
-KPX Amacron uacute -30
-KPX Amacron ucircumflex -30
-KPX Amacron udieresis -30
-KPX Amacron ugrave -30
-KPX Amacron uhungarumlaut -30
-KPX Amacron umacron -30
-KPX Amacron uogonek -30
-KPX Amacron uring -30
-KPX Amacron v -40
-KPX Amacron w -40
-KPX Amacron y -40
-KPX Amacron yacute -40
-KPX Amacron ydieresis -40
-KPX Aogonek C -30
-KPX Aogonek Cacute -30
-KPX Aogonek Ccaron -30
-KPX Aogonek Ccedilla -30
-KPX Aogonek G -30
-KPX Aogonek Gbreve -30
-KPX Aogonek Gcommaaccent -30
-KPX Aogonek O -30
-KPX Aogonek Oacute -30
-KPX Aogonek Ocircumflex -30
-KPX Aogonek Odieresis -30
-KPX Aogonek Ograve -30
-KPX Aogonek Ohungarumlaut -30
-KPX Aogonek Omacron -30
-KPX Aogonek Oslash -30
-KPX Aogonek Otilde -30
-KPX Aogonek Q -30
-KPX Aogonek T -120
-KPX Aogonek Tcaron -120
-KPX Aogonek Tcommaaccent -120
-KPX Aogonek U -50
-KPX Aogonek Uacute -50
-KPX Aogonek Ucircumflex -50
-KPX Aogonek Udieresis -50
-KPX Aogonek Ugrave -50
-KPX Aogonek Uhungarumlaut -50
-KPX Aogonek Umacron -50
-KPX Aogonek Uogonek -50
-KPX Aogonek Uring -50
-KPX Aogonek V -70
-KPX Aogonek W -50
-KPX Aogonek Y -100
-KPX Aogonek Yacute -100
-KPX Aogonek Ydieresis -100
-KPX Aogonek u -30
-KPX Aogonek uacute -30
-KPX Aogonek ucircumflex -30
-KPX Aogonek udieresis -30
-KPX Aogonek ugrave -30
-KPX Aogonek uhungarumlaut -30
-KPX Aogonek umacron -30
-KPX Aogonek uogonek -30
-KPX Aogonek uring -30
-KPX Aogonek v -40
-KPX Aogonek w -40
-KPX Aogonek y -40
-KPX Aogonek yacute -40
-KPX Aogonek ydieresis -40
-KPX Aring C -30
-KPX Aring Cacute -30
-KPX Aring Ccaron -30
-KPX Aring Ccedilla -30
-KPX Aring G -30
-KPX Aring Gbreve -30
-KPX Aring Gcommaaccent -30
-KPX Aring O -30
-KPX Aring Oacute -30
-KPX Aring Ocircumflex -30
-KPX Aring Odieresis -30
-KPX Aring Ograve -30
-KPX Aring Ohungarumlaut -30
-KPX Aring Omacron -30
-KPX Aring Oslash -30
-KPX Aring Otilde -30
-KPX Aring Q -30
-KPX Aring T -120
-KPX Aring Tcaron -120
-KPX Aring Tcommaaccent -120
-KPX Aring U -50
-KPX Aring Uacute -50
-KPX Aring Ucircumflex -50
-KPX Aring Udieresis -50
-KPX Aring Ugrave -50
-KPX Aring Uhungarumlaut -50
-KPX Aring Umacron -50
-KPX Aring Uogonek -50
-KPX Aring Uring -50
-KPX Aring V -70
-KPX Aring W -50
-KPX Aring Y -100
-KPX Aring Yacute -100
-KPX Aring Ydieresis -100
-KPX Aring u -30
-KPX Aring uacute -30
-KPX Aring ucircumflex -30
-KPX Aring udieresis -30
-KPX Aring ugrave -30
-KPX Aring uhungarumlaut -30
-KPX Aring umacron -30
-KPX Aring uogonek -30
-KPX Aring uring -30
-KPX Aring v -40
-KPX Aring w -40
-KPX Aring y -40
-KPX Aring yacute -40
-KPX Aring ydieresis -40
-KPX Atilde C -30
-KPX Atilde Cacute -30
-KPX Atilde Ccaron -30
-KPX Atilde Ccedilla -30
-KPX Atilde G -30
-KPX Atilde Gbreve -30
-KPX Atilde Gcommaaccent -30
-KPX Atilde O -30
-KPX Atilde Oacute -30
-KPX Atilde Ocircumflex -30
-KPX Atilde Odieresis -30
-KPX Atilde Ograve -30
-KPX Atilde Ohungarumlaut -30
-KPX Atilde Omacron -30
-KPX Atilde Oslash -30
-KPX Atilde Otilde -30
-KPX Atilde Q -30
-KPX Atilde T -120
-KPX Atilde Tcaron -120
-KPX Atilde Tcommaaccent -120
-KPX Atilde U -50
-KPX Atilde Uacute -50
-KPX Atilde Ucircumflex -50
-KPX Atilde Udieresis -50
-KPX Atilde Ugrave -50
-KPX Atilde Uhungarumlaut -50
-KPX Atilde Umacron -50
-KPX Atilde Uogonek -50
-KPX Atilde Uring -50
-KPX Atilde V -70
-KPX Atilde W -50
-KPX Atilde Y -100
-KPX Atilde Yacute -100
-KPX Atilde Ydieresis -100
-KPX Atilde u -30
-KPX Atilde uacute -30
-KPX Atilde ucircumflex -30
-KPX Atilde udieresis -30
-KPX Atilde ugrave -30
-KPX Atilde uhungarumlaut -30
-KPX Atilde umacron -30
-KPX Atilde uogonek -30
-KPX Atilde uring -30
-KPX Atilde v -40
-KPX Atilde w -40
-KPX Atilde y -40
-KPX Atilde yacute -40
-KPX Atilde ydieresis -40
-KPX B U -10
-KPX B Uacute -10
-KPX B Ucircumflex -10
-KPX B Udieresis -10
-KPX B Ugrave -10
-KPX B Uhungarumlaut -10
-KPX B Umacron -10
-KPX B Uogonek -10
-KPX B Uring -10
-KPX B comma -20
-KPX B period -20
-KPX C comma -30
-KPX C period -30
-KPX Cacute comma -30
-KPX Cacute period -30
-KPX Ccaron comma -30
-KPX Ccaron period -30
-KPX Ccedilla comma -30
-KPX Ccedilla period -30
-KPX D A -40
-KPX D Aacute -40
-KPX D Abreve -40
-KPX D Acircumflex -40
-KPX D Adieresis -40
-KPX D Agrave -40
-KPX D Amacron -40
-KPX D Aogonek -40
-KPX D Aring -40
-KPX D Atilde -40
-KPX D V -70
-KPX D W -40
-KPX D Y -90
-KPX D Yacute -90
-KPX D Ydieresis -90
-KPX D comma -70
-KPX D period -70
-KPX Dcaron A -40
-KPX Dcaron Aacute -40
-KPX Dcaron Abreve -40
-KPX Dcaron Acircumflex -40
-KPX Dcaron Adieresis -40
-KPX Dcaron Agrave -40
-KPX Dcaron Amacron -40
-KPX Dcaron Aogonek -40
-KPX Dcaron Aring -40
-KPX Dcaron Atilde -40
-KPX Dcaron V -70
-KPX Dcaron W -40
-KPX Dcaron Y -90
-KPX Dcaron Yacute -90
-KPX Dcaron Ydieresis -90
-KPX Dcaron comma -70
-KPX Dcaron period -70
-KPX Dcroat A -40
-KPX Dcroat Aacute -40
-KPX Dcroat Abreve -40
-KPX Dcroat Acircumflex -40
-KPX Dcroat Adieresis -40
-KPX Dcroat Agrave -40
-KPX Dcroat Amacron -40
-KPX Dcroat Aogonek -40
-KPX Dcroat Aring -40
-KPX Dcroat Atilde -40
-KPX Dcroat V -70
-KPX Dcroat W -40
-KPX Dcroat Y -90
-KPX Dcroat Yacute -90
-KPX Dcroat Ydieresis -90
-KPX Dcroat comma -70
-KPX Dcroat period -70
-KPX F A -80
-KPX F Aacute -80
-KPX F Abreve -80
-KPX F Acircumflex -80
-KPX F Adieresis -80
-KPX F Agrave -80
-KPX F Amacron -80
-KPX F Aogonek -80
-KPX F Aring -80
-KPX F Atilde -80
-KPX F a -50
-KPX F aacute -50
-KPX F abreve -50
-KPX F acircumflex -50
-KPX F adieresis -50
-KPX F agrave -50
-KPX F amacron -50
-KPX F aogonek -50
-KPX F aring -50
-KPX F atilde -50
-KPX F comma -150
-KPX F e -30
-KPX F eacute -30
-KPX F ecaron -30
-KPX F ecircumflex -30
-KPX F edieresis -30
-KPX F edotaccent -30
-KPX F egrave -30
-KPX F emacron -30
-KPX F eogonek -30
-KPX F o -30
-KPX F oacute -30
-KPX F ocircumflex -30
-KPX F odieresis -30
-KPX F ograve -30
-KPX F ohungarumlaut -30
-KPX F omacron -30
-KPX F oslash -30
-KPX F otilde -30
-KPX F period -150
-KPX F r -45
-KPX F racute -45
-KPX F rcaron -45
-KPX F rcommaaccent -45
-KPX J A -20
-KPX J Aacute -20
-KPX J Abreve -20
-KPX J Acircumflex -20
-KPX J Adieresis -20
-KPX J Agrave -20
-KPX J Amacron -20
-KPX J Aogonek -20
-KPX J Aring -20
-KPX J Atilde -20
-KPX J a -20
-KPX J aacute -20
-KPX J abreve -20
-KPX J acircumflex -20
-KPX J adieresis -20
-KPX J agrave -20
-KPX J amacron -20
-KPX J aogonek -20
-KPX J aring -20
-KPX J atilde -20
-KPX J comma -30
-KPX J period -30
-KPX J u -20
-KPX J uacute -20
-KPX J ucircumflex -20
-KPX J udieresis -20
-KPX J ugrave -20
-KPX J uhungarumlaut -20
-KPX J umacron -20
-KPX J uogonek -20
-KPX J uring -20
-KPX K O -50
-KPX K Oacute -50
-KPX K Ocircumflex -50
-KPX K Odieresis -50
-KPX K Ograve -50
-KPX K Ohungarumlaut -50
-KPX K Omacron -50
-KPX K Oslash -50
-KPX K Otilde -50
-KPX K e -40
-KPX K eacute -40
-KPX K ecaron -40
-KPX K ecircumflex -40
-KPX K edieresis -40
-KPX K edotaccent -40
-KPX K egrave -40
-KPX K emacron -40
-KPX K eogonek -40
-KPX K o -40
-KPX K oacute -40
-KPX K ocircumflex -40
-KPX K odieresis -40
-KPX K ograve -40
-KPX K ohungarumlaut -40
-KPX K omacron -40
-KPX K oslash -40
-KPX K otilde -40
-KPX K u -30
-KPX K uacute -30
-KPX K ucircumflex -30
-KPX K udieresis -30
-KPX K ugrave -30
-KPX K uhungarumlaut -30
-KPX K umacron -30
-KPX K uogonek -30
-KPX K uring -30
-KPX K y -50
-KPX K yacute -50
-KPX K ydieresis -50
-KPX Kcommaaccent O -50
-KPX Kcommaaccent Oacute -50
-KPX Kcommaaccent Ocircumflex -50
-KPX Kcommaaccent Odieresis -50
-KPX Kcommaaccent Ograve -50
-KPX Kcommaaccent Ohungarumlaut -50
-KPX Kcommaaccent Omacron -50
-KPX Kcommaaccent Oslash -50
-KPX Kcommaaccent Otilde -50
-KPX Kcommaaccent e -40
-KPX Kcommaaccent eacute -40
-KPX Kcommaaccent ecaron -40
-KPX Kcommaaccent ecircumflex -40
-KPX Kcommaaccent edieresis -40
-KPX Kcommaaccent edotaccent -40
-KPX Kcommaaccent egrave -40
-KPX Kcommaaccent emacron -40
-KPX Kcommaaccent eogonek -40
-KPX Kcommaaccent o -40
-KPX Kcommaaccent oacute -40
-KPX Kcommaaccent ocircumflex -40
-KPX Kcommaaccent odieresis -40
-KPX Kcommaaccent ograve -40
-KPX Kcommaaccent ohungarumlaut -40
-KPX Kcommaaccent omacron -40
-KPX Kcommaaccent oslash -40
-KPX Kcommaaccent otilde -40
-KPX Kcommaaccent u -30
-KPX Kcommaaccent uacute -30
-KPX Kcommaaccent ucircumflex -30
-KPX Kcommaaccent udieresis -30
-KPX Kcommaaccent ugrave -30
-KPX Kcommaaccent uhungarumlaut -30
-KPX Kcommaaccent umacron -30
-KPX Kcommaaccent uogonek -30
-KPX Kcommaaccent uring -30
-KPX Kcommaaccent y -50
-KPX Kcommaaccent yacute -50
-KPX Kcommaaccent ydieresis -50
-KPX L T -110
-KPX L Tcaron -110
-KPX L Tcommaaccent -110
-KPX L V -110
-KPX L W -70
-KPX L Y -140
-KPX L Yacute -140
-KPX L Ydieresis -140
-KPX L quotedblright -140
-KPX L quoteright -160
-KPX L y -30
-KPX L yacute -30
-KPX L ydieresis -30
-KPX Lacute T -110
-KPX Lacute Tcaron -110
-KPX Lacute Tcommaaccent -110
-KPX Lacute V -110
-KPX Lacute W -70
-KPX Lacute Y -140
-KPX Lacute Yacute -140
-KPX Lacute Ydieresis -140
-KPX Lacute quotedblright -140
-KPX Lacute quoteright -160
-KPX Lacute y -30
-KPX Lacute yacute -30
-KPX Lacute ydieresis -30
-KPX Lcaron T -110
-KPX Lcaron Tcaron -110
-KPX Lcaron Tcommaaccent -110
-KPX Lcaron V -110
-KPX Lcaron W -70
-KPX Lcaron Y -140
-KPX Lcaron Yacute -140
-KPX Lcaron Ydieresis -140
-KPX Lcaron quotedblright -140
-KPX Lcaron quoteright -160
-KPX Lcaron y -30
-KPX Lcaron yacute -30
-KPX Lcaron ydieresis -30
-KPX Lcommaaccent T -110
-KPX Lcommaaccent Tcaron -110
-KPX Lcommaaccent Tcommaaccent -110
-KPX Lcommaaccent V -110
-KPX Lcommaaccent W -70
-KPX Lcommaaccent Y -140
-KPX Lcommaaccent Yacute -140
-KPX Lcommaaccent Ydieresis -140
-KPX Lcommaaccent quotedblright -140
-KPX Lcommaaccent quoteright -160
-KPX Lcommaaccent y -30
-KPX Lcommaaccent yacute -30
-KPX Lcommaaccent ydieresis -30
-KPX Lslash T -110
-KPX Lslash Tcaron -110
-KPX Lslash Tcommaaccent -110
-KPX Lslash V -110
-KPX Lslash W -70
-KPX Lslash Y -140
-KPX Lslash Yacute -140
-KPX Lslash Ydieresis -140
-KPX Lslash quotedblright -140
-KPX Lslash quoteright -160
-KPX Lslash y -30
-KPX Lslash yacute -30
-KPX Lslash ydieresis -30
-KPX O A -20
-KPX O Aacute -20
-KPX O Abreve -20
-KPX O Acircumflex -20
-KPX O Adieresis -20
-KPX O Agrave -20
-KPX O Amacron -20
-KPX O Aogonek -20
-KPX O Aring -20
-KPX O Atilde -20
-KPX O T -40
-KPX O Tcaron -40
-KPX O Tcommaaccent -40
-KPX O V -50
-KPX O W -30
-KPX O X -60
-KPX O Y -70
-KPX O Yacute -70
-KPX O Ydieresis -70
-KPX O comma -40
-KPX O period -40
-KPX Oacute A -20
-KPX Oacute Aacute -20
-KPX Oacute Abreve -20
-KPX Oacute Acircumflex -20
-KPX Oacute Adieresis -20
-KPX Oacute Agrave -20
-KPX Oacute Amacron -20
-KPX Oacute Aogonek -20
-KPX Oacute Aring -20
-KPX Oacute Atilde -20
-KPX Oacute T -40
-KPX Oacute Tcaron -40
-KPX Oacute Tcommaaccent -40
-KPX Oacute V -50
-KPX Oacute W -30
-KPX Oacute X -60
-KPX Oacute Y -70
-KPX Oacute Yacute -70
-KPX Oacute Ydieresis -70
-KPX Oacute comma -40
-KPX Oacute period -40
-KPX Ocircumflex A -20
-KPX Ocircumflex Aacute -20
-KPX Ocircumflex Abreve -20
-KPX Ocircumflex Acircumflex -20
-KPX Ocircumflex Adieresis -20
-KPX Ocircumflex Agrave -20
-KPX Ocircumflex Amacron -20
-KPX Ocircumflex Aogonek -20
-KPX Ocircumflex Aring -20
-KPX Ocircumflex Atilde -20
-KPX Ocircumflex T -40
-KPX Ocircumflex Tcaron -40
-KPX Ocircumflex Tcommaaccent -40
-KPX Ocircumflex V -50
-KPX Ocircumflex W -30
-KPX Ocircumflex X -60
-KPX Ocircumflex Y -70
-KPX Ocircumflex Yacute -70
-KPX Ocircumflex Ydieresis -70
-KPX Ocircumflex comma -40
-KPX Ocircumflex period -40
-KPX Odieresis A -20
-KPX Odieresis Aacute -20
-KPX Odieresis Abreve -20
-KPX Odieresis Acircumflex -20
-KPX Odieresis Adieresis -20
-KPX Odieresis Agrave -20
-KPX Odieresis Amacron -20
-KPX Odieresis Aogonek -20
-KPX Odieresis Aring -20
-KPX Odieresis Atilde -20
-KPX Odieresis T -40
-KPX Odieresis Tcaron -40
-KPX Odieresis Tcommaaccent -40
-KPX Odieresis V -50
-KPX Odieresis W -30
-KPX Odieresis X -60
-KPX Odieresis Y -70
-KPX Odieresis Yacute -70
-KPX Odieresis Ydieresis -70
-KPX Odieresis comma -40
-KPX Odieresis period -40
-KPX Ograve A -20
-KPX Ograve Aacute -20
-KPX Ograve Abreve -20
-KPX Ograve Acircumflex -20
-KPX Ograve Adieresis -20
-KPX Ograve Agrave -20
-KPX Ograve Amacron -20
-KPX Ograve Aogonek -20
-KPX Ograve Aring -20
-KPX Ograve Atilde -20
-KPX Ograve T -40
-KPX Ograve Tcaron -40
-KPX Ograve Tcommaaccent -40
-KPX Ograve V -50
-KPX Ograve W -30
-KPX Ograve X -60
-KPX Ograve Y -70
-KPX Ograve Yacute -70
-KPX Ograve Ydieresis -70
-KPX Ograve comma -40
-KPX Ograve period -40
-KPX Ohungarumlaut A -20
-KPX Ohungarumlaut Aacute -20
-KPX Ohungarumlaut Abreve -20
-KPX Ohungarumlaut Acircumflex -20
-KPX Ohungarumlaut Adieresis -20
-KPX Ohungarumlaut Agrave -20
-KPX Ohungarumlaut Amacron -20
-KPX Ohungarumlaut Aogonek -20
-KPX Ohungarumlaut Aring -20
-KPX Ohungarumlaut Atilde -20
-KPX Ohungarumlaut T -40
-KPX Ohungarumlaut Tcaron -40
-KPX Ohungarumlaut Tcommaaccent -40
-KPX Ohungarumlaut V -50
-KPX Ohungarumlaut W -30
-KPX Ohungarumlaut X -60
-KPX Ohungarumlaut Y -70
-KPX Ohungarumlaut Yacute -70
-KPX Ohungarumlaut Ydieresis -70
-KPX Ohungarumlaut comma -40
-KPX Ohungarumlaut period -40
-KPX Omacron A -20
-KPX Omacron Aacute -20
-KPX Omacron Abreve -20
-KPX Omacron Acircumflex -20
-KPX Omacron Adieresis -20
-KPX Omacron Agrave -20
-KPX Omacron Amacron -20
-KPX Omacron Aogonek -20
-KPX Omacron Aring -20
-KPX Omacron Atilde -20
-KPX Omacron T -40
-KPX Omacron Tcaron -40
-KPX Omacron Tcommaaccent -40
-KPX Omacron V -50
-KPX Omacron W -30
-KPX Omacron X -60
-KPX Omacron Y -70
-KPX Omacron Yacute -70
-KPX Omacron Ydieresis -70
-KPX Omacron comma -40
-KPX Omacron period -40
-KPX Oslash A -20
-KPX Oslash Aacute -20
-KPX Oslash Abreve -20
-KPX Oslash Acircumflex -20
-KPX Oslash Adieresis -20
-KPX Oslash Agrave -20
-KPX Oslash Amacron -20
-KPX Oslash Aogonek -20
-KPX Oslash Aring -20
-KPX Oslash Atilde -20
-KPX Oslash T -40
-KPX Oslash Tcaron -40
-KPX Oslash Tcommaaccent -40
-KPX Oslash V -50
-KPX Oslash W -30
-KPX Oslash X -60
-KPX Oslash Y -70
-KPX Oslash Yacute -70
-KPX Oslash Ydieresis -70
-KPX Oslash comma -40
-KPX Oslash period -40
-KPX Otilde A -20
-KPX Otilde Aacute -20
-KPX Otilde Abreve -20
-KPX Otilde Acircumflex -20
-KPX Otilde Adieresis -20
-KPX Otilde Agrave -20
-KPX Otilde Amacron -20
-KPX Otilde Aogonek -20
-KPX Otilde Aring -20
-KPX Otilde Atilde -20
-KPX Otilde T -40
-KPX Otilde Tcaron -40
-KPX Otilde Tcommaaccent -40
-KPX Otilde V -50
-KPX Otilde W -30
-KPX Otilde X -60
-KPX Otilde Y -70
-KPX Otilde Yacute -70
-KPX Otilde Ydieresis -70
-KPX Otilde comma -40
-KPX Otilde period -40
-KPX P A -120
-KPX P Aacute -120
-KPX P Abreve -120
-KPX P Acircumflex -120
-KPX P Adieresis -120
-KPX P Agrave -120
-KPX P Amacron -120
-KPX P Aogonek -120
-KPX P Aring -120
-KPX P Atilde -120
-KPX P a -40
-KPX P aacute -40
-KPX P abreve -40
-KPX P acircumflex -40
-KPX P adieresis -40
-KPX P agrave -40
-KPX P amacron -40
-KPX P aogonek -40
-KPX P aring -40
-KPX P atilde -40
-KPX P comma -180
-KPX P e -50
-KPX P eacute -50
-KPX P ecaron -50
-KPX P ecircumflex -50
-KPX P edieresis -50
-KPX P edotaccent -50
-KPX P egrave -50
-KPX P emacron -50
-KPX P eogonek -50
-KPX P o -50
-KPX P oacute -50
-KPX P ocircumflex -50
-KPX P odieresis -50
-KPX P ograve -50
-KPX P ohungarumlaut -50
-KPX P omacron -50
-KPX P oslash -50
-KPX P otilde -50
-KPX P period -180
-KPX Q U -10
-KPX Q Uacute -10
-KPX Q Ucircumflex -10
-KPX Q Udieresis -10
-KPX Q Ugrave -10
-KPX Q Uhungarumlaut -10
-KPX Q Umacron -10
-KPX Q Uogonek -10
-KPX Q Uring -10
-KPX R O -20
-KPX R Oacute -20
-KPX R Ocircumflex -20
-KPX R Odieresis -20
-KPX R Ograve -20
-KPX R Ohungarumlaut -20
-KPX R Omacron -20
-KPX R Oslash -20
-KPX R Otilde -20
-KPX R T -30
-KPX R Tcaron -30
-KPX R Tcommaaccent -30
-KPX R U -40
-KPX R Uacute -40
-KPX R Ucircumflex -40
-KPX R Udieresis -40
-KPX R Ugrave -40
-KPX R Uhungarumlaut -40
-KPX R Umacron -40
-KPX R Uogonek -40
-KPX R Uring -40
-KPX R V -50
-KPX R W -30
-KPX R Y -50
-KPX R Yacute -50
-KPX R Ydieresis -50
-KPX Racute O -20
-KPX Racute Oacute -20
-KPX Racute Ocircumflex -20
-KPX Racute Odieresis -20
-KPX Racute Ograve -20
-KPX Racute Ohungarumlaut -20
-KPX Racute Omacron -20
-KPX Racute Oslash -20
-KPX Racute Otilde -20
-KPX Racute T -30
-KPX Racute Tcaron -30
-KPX Racute Tcommaaccent -30
-KPX Racute U -40
-KPX Racute Uacute -40
-KPX Racute Ucircumflex -40
-KPX Racute Udieresis -40
-KPX Racute Ugrave -40
-KPX Racute Uhungarumlaut -40
-KPX Racute Umacron -40
-KPX Racute Uogonek -40
-KPX Racute Uring -40
-KPX Racute V -50
-KPX Racute W -30
-KPX Racute Y -50
-KPX Racute Yacute -50
-KPX Racute Ydieresis -50
-KPX Rcaron O -20
-KPX Rcaron Oacute -20
-KPX Rcaron Ocircumflex -20
-KPX Rcaron Odieresis -20
-KPX Rcaron Ograve -20
-KPX Rcaron Ohungarumlaut -20
-KPX Rcaron Omacron -20
-KPX Rcaron Oslash -20
-KPX Rcaron Otilde -20
-KPX Rcaron T -30
-KPX Rcaron Tcaron -30
-KPX Rcaron Tcommaaccent -30
-KPX Rcaron U -40
-KPX Rcaron Uacute -40
-KPX Rcaron Ucircumflex -40
-KPX Rcaron Udieresis -40
-KPX Rcaron Ugrave -40
-KPX Rcaron Uhungarumlaut -40
-KPX Rcaron Umacron -40
-KPX Rcaron Uogonek -40
-KPX Rcaron Uring -40
-KPX Rcaron V -50
-KPX Rcaron W -30
-KPX Rcaron Y -50
-KPX Rcaron Yacute -50
-KPX Rcaron Ydieresis -50
-KPX Rcommaaccent O -20
-KPX Rcommaaccent Oacute -20
-KPX Rcommaaccent Ocircumflex -20
-KPX Rcommaaccent Odieresis -20
-KPX Rcommaaccent Ograve -20
-KPX Rcommaaccent Ohungarumlaut -20
-KPX Rcommaaccent Omacron -20
-KPX Rcommaaccent Oslash -20
-KPX Rcommaaccent Otilde -20
-KPX Rcommaaccent T -30
-KPX Rcommaaccent Tcaron -30
-KPX Rcommaaccent Tcommaaccent -30
-KPX Rcommaaccent U -40
-KPX Rcommaaccent Uacute -40
-KPX Rcommaaccent Ucircumflex -40
-KPX Rcommaaccent Udieresis -40
-KPX Rcommaaccent Ugrave -40
-KPX Rcommaaccent Uhungarumlaut -40
-KPX Rcommaaccent Umacron -40
-KPX Rcommaaccent Uogonek -40
-KPX Rcommaaccent Uring -40
-KPX Rcommaaccent V -50
-KPX Rcommaaccent W -30
-KPX Rcommaaccent Y -50
-KPX Rcommaaccent Yacute -50
-KPX Rcommaaccent Ydieresis -50
-KPX S comma -20
-KPX S period -20
-KPX Sacute comma -20
-KPX Sacute period -20
-KPX Scaron comma -20
-KPX Scaron period -20
-KPX Scedilla comma -20
-KPX Scedilla period -20
-KPX Scommaaccent comma -20
-KPX Scommaaccent period -20
-KPX T A -120
-KPX T Aacute -120
-KPX T Abreve -120
-KPX T Acircumflex -120
-KPX T Adieresis -120
-KPX T Agrave -120
-KPX T Amacron -120
-KPX T Aogonek -120
-KPX T Aring -120
-KPX T Atilde -120
-KPX T O -40
-KPX T Oacute -40
-KPX T Ocircumflex -40
-KPX T Odieresis -40
-KPX T Ograve -40
-KPX T Ohungarumlaut -40
-KPX T Omacron -40
-KPX T Oslash -40
-KPX T Otilde -40
-KPX T a -120
-KPX T aacute -120
-KPX T abreve -60
-KPX T acircumflex -120
-KPX T adieresis -120
-KPX T agrave -120
-KPX T amacron -60
-KPX T aogonek -120
-KPX T aring -120
-KPX T atilde -60
-KPX T colon -20
-KPX T comma -120
-KPX T e -120
-KPX T eacute -120
-KPX T ecaron -120
-KPX T ecircumflex -120
-KPX T edieresis -120
-KPX T edotaccent -120
-KPX T egrave -60
-KPX T emacron -60
-KPX T eogonek -120
-KPX T hyphen -140
-KPX T o -120
-KPX T oacute -120
-KPX T ocircumflex -120
-KPX T odieresis -120
-KPX T ograve -120
-KPX T ohungarumlaut -120
-KPX T omacron -60
-KPX T oslash -120
-KPX T otilde -60
-KPX T period -120
-KPX T r -120
-KPX T racute -120
-KPX T rcaron -120
-KPX T rcommaaccent -120
-KPX T semicolon -20
-KPX T u -120
-KPX T uacute -120
-KPX T ucircumflex -120
-KPX T udieresis -120
-KPX T ugrave -120
-KPX T uhungarumlaut -120
-KPX T umacron -60
-KPX T uogonek -120
-KPX T uring -120
-KPX T w -120
-KPX T y -120
-KPX T yacute -120
-KPX T ydieresis -60
-KPX Tcaron A -120
-KPX Tcaron Aacute -120
-KPX Tcaron Abreve -120
-KPX Tcaron Acircumflex -120
-KPX Tcaron Adieresis -120
-KPX Tcaron Agrave -120
-KPX Tcaron Amacron -120
-KPX Tcaron Aogonek -120
-KPX Tcaron Aring -120
-KPX Tcaron Atilde -120
-KPX Tcaron O -40
-KPX Tcaron Oacute -40
-KPX Tcaron Ocircumflex -40
-KPX Tcaron Odieresis -40
-KPX Tcaron Ograve -40
-KPX Tcaron Ohungarumlaut -40
-KPX Tcaron Omacron -40
-KPX Tcaron Oslash -40
-KPX Tcaron Otilde -40
-KPX Tcaron a -120
-KPX Tcaron aacute -120
-KPX Tcaron abreve -60
-KPX Tcaron acircumflex -120
-KPX Tcaron adieresis -120
-KPX Tcaron agrave -120
-KPX Tcaron amacron -60
-KPX Tcaron aogonek -120
-KPX Tcaron aring -120
-KPX Tcaron atilde -60
-KPX Tcaron colon -20
-KPX Tcaron comma -120
-KPX Tcaron e -120
-KPX Tcaron eacute -120
-KPX Tcaron ecaron -120
-KPX Tcaron ecircumflex -120
-KPX Tcaron edieresis -120
-KPX Tcaron edotaccent -120
-KPX Tcaron egrave -60
-KPX Tcaron emacron -60
-KPX Tcaron eogonek -120
-KPX Tcaron hyphen -140
-KPX Tcaron o -120
-KPX Tcaron oacute -120
-KPX Tcaron ocircumflex -120
-KPX Tcaron odieresis -120
-KPX Tcaron ograve -120
-KPX Tcaron ohungarumlaut -120
-KPX Tcaron omacron -60
-KPX Tcaron oslash -120
-KPX Tcaron otilde -60
-KPX Tcaron period -120
-KPX Tcaron r -120
-KPX Tcaron racute -120
-KPX Tcaron rcaron -120
-KPX Tcaron rcommaaccent -120
-KPX Tcaron semicolon -20
-KPX Tcaron u -120
-KPX Tcaron uacute -120
-KPX Tcaron ucircumflex -120
-KPX Tcaron udieresis -120
-KPX Tcaron ugrave -120
-KPX Tcaron uhungarumlaut -120
-KPX Tcaron umacron -60
-KPX Tcaron uogonek -120
-KPX Tcaron uring -120
-KPX Tcaron w -120
-KPX Tcaron y -120
-KPX Tcaron yacute -120
-KPX Tcaron ydieresis -60
-KPX Tcommaaccent A -120
-KPX Tcommaaccent Aacute -120
-KPX Tcommaaccent Abreve -120
-KPX Tcommaaccent Acircumflex -120
-KPX Tcommaaccent Adieresis -120
-KPX Tcommaaccent Agrave -120
-KPX Tcommaaccent Amacron -120
-KPX Tcommaaccent Aogonek -120
-KPX Tcommaaccent Aring -120
-KPX Tcommaaccent Atilde -120
-KPX Tcommaaccent O -40
-KPX Tcommaaccent Oacute -40
-KPX Tcommaaccent Ocircumflex -40
-KPX Tcommaaccent Odieresis -40
-KPX Tcommaaccent Ograve -40
-KPX Tcommaaccent Ohungarumlaut -40
-KPX Tcommaaccent Omacron -40
-KPX Tcommaaccent Oslash -40
-KPX Tcommaaccent Otilde -40
-KPX Tcommaaccent a -120
-KPX Tcommaaccent aacute -120
-KPX Tcommaaccent abreve -60
-KPX Tcommaaccent acircumflex -120
-KPX Tcommaaccent adieresis -120
-KPX Tcommaaccent agrave -120
-KPX Tcommaaccent amacron -60
-KPX Tcommaaccent aogonek -120
-KPX Tcommaaccent aring -120
-KPX Tcommaaccent atilde -60
-KPX Tcommaaccent colon -20
-KPX Tcommaaccent comma -120
-KPX Tcommaaccent e -120
-KPX Tcommaaccent eacute -120
-KPX Tcommaaccent ecaron -120
-KPX Tcommaaccent ecircumflex -120
-KPX Tcommaaccent edieresis -120
-KPX Tcommaaccent edotaccent -120
-KPX Tcommaaccent egrave -60
-KPX Tcommaaccent emacron -60
-KPX Tcommaaccent eogonek -120
-KPX Tcommaaccent hyphen -140
-KPX Tcommaaccent o -120
-KPX Tcommaaccent oacute -120
-KPX Tcommaaccent ocircumflex -120
-KPX Tcommaaccent odieresis -120
-KPX Tcommaaccent ograve -120
-KPX Tcommaaccent ohungarumlaut -120
-KPX Tcommaaccent omacron -60
-KPX Tcommaaccent oslash -120
-KPX Tcommaaccent otilde -60
-KPX Tcommaaccent period -120
-KPX Tcommaaccent r -120
-KPX Tcommaaccent racute -120
-KPX Tcommaaccent rcaron -120
-KPX Tcommaaccent rcommaaccent -120
-KPX Tcommaaccent semicolon -20
-KPX Tcommaaccent u -120
-KPX Tcommaaccent uacute -120
-KPX Tcommaaccent ucircumflex -120
-KPX Tcommaaccent udieresis -120
-KPX Tcommaaccent ugrave -120
-KPX Tcommaaccent uhungarumlaut -120
-KPX Tcommaaccent umacron -60
-KPX Tcommaaccent uogonek -120
-KPX Tcommaaccent uring -120
-KPX Tcommaaccent w -120
-KPX Tcommaaccent y -120
-KPX Tcommaaccent yacute -120
-KPX Tcommaaccent ydieresis -60
-KPX U A -40
-KPX U Aacute -40
-KPX U Abreve -40
-KPX U Acircumflex -40
-KPX U Adieresis -40
-KPX U Agrave -40
-KPX U Amacron -40
-KPX U Aogonek -40
-KPX U Aring -40
-KPX U Atilde -40
-KPX U comma -40
-KPX U period -40
-KPX Uacute A -40
-KPX Uacute Aacute -40
-KPX Uacute Abreve -40
-KPX Uacute Acircumflex -40
-KPX Uacute Adieresis -40
-KPX Uacute Agrave -40
-KPX Uacute Amacron -40
-KPX Uacute Aogonek -40
-KPX Uacute Aring -40
-KPX Uacute Atilde -40
-KPX Uacute comma -40
-KPX Uacute period -40
-KPX Ucircumflex A -40
-KPX Ucircumflex Aacute -40
-KPX Ucircumflex Abreve -40
-KPX Ucircumflex Acircumflex -40
-KPX Ucircumflex Adieresis -40
-KPX Ucircumflex Agrave -40
-KPX Ucircumflex Amacron -40
-KPX Ucircumflex Aogonek -40
-KPX Ucircumflex Aring -40
-KPX Ucircumflex Atilde -40
-KPX Ucircumflex comma -40
-KPX Ucircumflex period -40
-KPX Udieresis A -40
-KPX Udieresis Aacute -40
-KPX Udieresis Abreve -40
-KPX Udieresis Acircumflex -40
-KPX Udieresis Adieresis -40
-KPX Udieresis Agrave -40
-KPX Udieresis Amacron -40
-KPX Udieresis Aogonek -40
-KPX Udieresis Aring -40
-KPX Udieresis Atilde -40
-KPX Udieresis comma -40
-KPX Udieresis period -40
-KPX Ugrave A -40
-KPX Ugrave Aacute -40
-KPX Ugrave Abreve -40
-KPX Ugrave Acircumflex -40
-KPX Ugrave Adieresis -40
-KPX Ugrave Agrave -40
-KPX Ugrave Amacron -40
-KPX Ugrave Aogonek -40
-KPX Ugrave Aring -40
-KPX Ugrave Atilde -40
-KPX Ugrave comma -40
-KPX Ugrave period -40
-KPX Uhungarumlaut A -40
-KPX Uhungarumlaut Aacute -40
-KPX Uhungarumlaut Abreve -40
-KPX Uhungarumlaut Acircumflex -40
-KPX Uhungarumlaut Adieresis -40
-KPX Uhungarumlaut Agrave -40
-KPX Uhungarumlaut Amacron -40
-KPX Uhungarumlaut Aogonek -40
-KPX Uhungarumlaut Aring -40
-KPX Uhungarumlaut Atilde -40
-KPX Uhungarumlaut comma -40
-KPX Uhungarumlaut period -40
-KPX Umacron A -40
-KPX Umacron Aacute -40
-KPX Umacron Abreve -40
-KPX Umacron Acircumflex -40
-KPX Umacron Adieresis -40
-KPX Umacron Agrave -40
-KPX Umacron Amacron -40
-KPX Umacron Aogonek -40
-KPX Umacron Aring -40
-KPX Umacron Atilde -40
-KPX Umacron comma -40
-KPX Umacron period -40
-KPX Uogonek A -40
-KPX Uogonek Aacute -40
-KPX Uogonek Abreve -40
-KPX Uogonek Acircumflex -40
-KPX Uogonek Adieresis -40
-KPX Uogonek Agrave -40
-KPX Uogonek Amacron -40
-KPX Uogonek Aogonek -40
-KPX Uogonek Aring -40
-KPX Uogonek Atilde -40
-KPX Uogonek comma -40
-KPX Uogonek period -40
-KPX Uring A -40
-KPX Uring Aacute -40
-KPX Uring Abreve -40
-KPX Uring Acircumflex -40
-KPX Uring Adieresis -40
-KPX Uring Agrave -40
-KPX Uring Amacron -40
-KPX Uring Aogonek -40
-KPX Uring Aring -40
-KPX Uring Atilde -40
-KPX Uring comma -40
-KPX Uring period -40
-KPX V A -80
-KPX V Aacute -80
-KPX V Abreve -80
-KPX V Acircumflex -80
-KPX V Adieresis -80
-KPX V Agrave -80
-KPX V Amacron -80
-KPX V Aogonek -80
-KPX V Aring -80
-KPX V Atilde -80
-KPX V G -40
-KPX V Gbreve -40
-KPX V Gcommaaccent -40
-KPX V O -40
-KPX V Oacute -40
-KPX V Ocircumflex -40
-KPX V Odieresis -40
-KPX V Ograve -40
-KPX V Ohungarumlaut -40
-KPX V Omacron -40
-KPX V Oslash -40
-KPX V Otilde -40
-KPX V a -70
-KPX V aacute -70
-KPX V abreve -70
-KPX V acircumflex -70
-KPX V adieresis -70
-KPX V agrave -70
-KPX V amacron -70
-KPX V aogonek -70
-KPX V aring -70
-KPX V atilde -70
-KPX V colon -40
-KPX V comma -125
-KPX V e -80
-KPX V eacute -80
-KPX V ecaron -80
-KPX V ecircumflex -80
-KPX V edieresis -80
-KPX V edotaccent -80
-KPX V egrave -80
-KPX V emacron -80
-KPX V eogonek -80
-KPX V hyphen -80
-KPX V o -80
-KPX V oacute -80
-KPX V ocircumflex -80
-KPX V odieresis -80
-KPX V ograve -80
-KPX V ohungarumlaut -80
-KPX V omacron -80
-KPX V oslash -80
-KPX V otilde -80
-KPX V period -125
-KPX V semicolon -40
-KPX V u -70
-KPX V uacute -70
-KPX V ucircumflex -70
-KPX V udieresis -70
-KPX V ugrave -70
-KPX V uhungarumlaut -70
-KPX V umacron -70
-KPX V uogonek -70
-KPX V uring -70
-KPX W A -50
-KPX W Aacute -50
-KPX W Abreve -50
-KPX W Acircumflex -50
-KPX W Adieresis -50
-KPX W Agrave -50
-KPX W Amacron -50
-KPX W Aogonek -50
-KPX W Aring -50
-KPX W Atilde -50
-KPX W O -20
-KPX W Oacute -20
-KPX W Ocircumflex -20
-KPX W Odieresis -20
-KPX W Ograve -20
-KPX W Ohungarumlaut -20
-KPX W Omacron -20
-KPX W Oslash -20
-KPX W Otilde -20
-KPX W a -40
-KPX W aacute -40
-KPX W abreve -40
-KPX W acircumflex -40
-KPX W adieresis -40
-KPX W agrave -40
-KPX W amacron -40
-KPX W aogonek -40
-KPX W aring -40
-KPX W atilde -40
-KPX W comma -80
-KPX W e -30
-KPX W eacute -30
-KPX W ecaron -30
-KPX W ecircumflex -30
-KPX W edieresis -30
-KPX W edotaccent -30
-KPX W egrave -30
-KPX W emacron -30
-KPX W eogonek -30
-KPX W hyphen -40
-KPX W o -30
-KPX W oacute -30
-KPX W ocircumflex -30
-KPX W odieresis -30
-KPX W ograve -30
-KPX W ohungarumlaut -30
-KPX W omacron -30
-KPX W oslash -30
-KPX W otilde -30
-KPX W period -80
-KPX W u -30
-KPX W uacute -30
-KPX W ucircumflex -30
-KPX W udieresis -30
-KPX W ugrave -30
-KPX W uhungarumlaut -30
-KPX W umacron -30
-KPX W uogonek -30
-KPX W uring -30
-KPX W y -20
-KPX W yacute -20
-KPX W ydieresis -20
-KPX Y A -110
-KPX Y Aacute -110
-KPX Y Abreve -110
-KPX Y Acircumflex -110
-KPX Y Adieresis -110
-KPX Y Agrave -110
-KPX Y Amacron -110
-KPX Y Aogonek -110
-KPX Y Aring -110
-KPX Y Atilde -110
-KPX Y O -85
-KPX Y Oacute -85
-KPX Y Ocircumflex -85
-KPX Y Odieresis -85
-KPX Y Ograve -85
-KPX Y Ohungarumlaut -85
-KPX Y Omacron -85
-KPX Y Oslash -85
-KPX Y Otilde -85
-KPX Y a -140
-KPX Y aacute -140
-KPX Y abreve -70
-KPX Y acircumflex -140
-KPX Y adieresis -140
-KPX Y agrave -140
-KPX Y amacron -70
-KPX Y aogonek -140
-KPX Y aring -140
-KPX Y atilde -140
-KPX Y colon -60
-KPX Y comma -140
-KPX Y e -140
-KPX Y eacute -140
-KPX Y ecaron -140
-KPX Y ecircumflex -140
-KPX Y edieresis -140
-KPX Y edotaccent -140
-KPX Y egrave -140
-KPX Y emacron -70
-KPX Y eogonek -140
-KPX Y hyphen -140
-KPX Y i -20
-KPX Y iacute -20
-KPX Y iogonek -20
-KPX Y o -140
-KPX Y oacute -140
-KPX Y ocircumflex -140
-KPX Y odieresis -140
-KPX Y ograve -140
-KPX Y ohungarumlaut -140
-KPX Y omacron -140
-KPX Y oslash -140
-KPX Y otilde -140
-KPX Y period -140
-KPX Y semicolon -60
-KPX Y u -110
-KPX Y uacute -110
-KPX Y ucircumflex -110
-KPX Y udieresis -110
-KPX Y ugrave -110
-KPX Y uhungarumlaut -110
-KPX Y umacron -110
-KPX Y uogonek -110
-KPX Y uring -110
-KPX Yacute A -110
-KPX Yacute Aacute -110
-KPX Yacute Abreve -110
-KPX Yacute Acircumflex -110
-KPX Yacute Adieresis -110
-KPX Yacute Agrave -110
-KPX Yacute Amacron -110
-KPX Yacute Aogonek -110
-KPX Yacute Aring -110
-KPX Yacute Atilde -110
-KPX Yacute O -85
-KPX Yacute Oacute -85
-KPX Yacute Ocircumflex -85
-KPX Yacute Odieresis -85
-KPX Yacute Ograve -85
-KPX Yacute Ohungarumlaut -85
-KPX Yacute Omacron -85
-KPX Yacute Oslash -85
-KPX Yacute Otilde -85
-KPX Yacute a -140
-KPX Yacute aacute -140
-KPX Yacute abreve -70
-KPX Yacute acircumflex -140
-KPX Yacute adieresis -140
-KPX Yacute agrave -140
-KPX Yacute amacron -70
-KPX Yacute aogonek -140
-KPX Yacute aring -140
-KPX Yacute atilde -70
-KPX Yacute colon -60
-KPX Yacute comma -140
-KPX Yacute e -140
-KPX Yacute eacute -140
-KPX Yacute ecaron -140
-KPX Yacute ecircumflex -140
-KPX Yacute edieresis -140
-KPX Yacute edotaccent -140
-KPX Yacute egrave -140
-KPX Yacute emacron -70
-KPX Yacute eogonek -140
-KPX Yacute hyphen -140
-KPX Yacute i -20
-KPX Yacute iacute -20
-KPX Yacute iogonek -20
-KPX Yacute o -140
-KPX Yacute oacute -140
-KPX Yacute ocircumflex -140
-KPX Yacute odieresis -140
-KPX Yacute ograve -140
-KPX Yacute ohungarumlaut -140
-KPX Yacute omacron -70
-KPX Yacute oslash -140
-KPX Yacute otilde -140
-KPX Yacute period -140
-KPX Yacute semicolon -60
-KPX Yacute u -110
-KPX Yacute uacute -110
-KPX Yacute ucircumflex -110
-KPX Yacute udieresis -110
-KPX Yacute ugrave -110
-KPX Yacute uhungarumlaut -110
-KPX Yacute umacron -110
-KPX Yacute uogonek -110
-KPX Yacute uring -110
-KPX Ydieresis A -110
-KPX Ydieresis Aacute -110
-KPX Ydieresis Abreve -110
-KPX Ydieresis Acircumflex -110
-KPX Ydieresis Adieresis -110
-KPX Ydieresis Agrave -110
-KPX Ydieresis Amacron -110
-KPX Ydieresis Aogonek -110
-KPX Ydieresis Aring -110
-KPX Ydieresis Atilde -110
-KPX Ydieresis O -85
-KPX Ydieresis Oacute -85
-KPX Ydieresis Ocircumflex -85
-KPX Ydieresis Odieresis -85
-KPX Ydieresis Ograve -85
-KPX Ydieresis Ohungarumlaut -85
-KPX Ydieresis Omacron -85
-KPX Ydieresis Oslash -85
-KPX Ydieresis Otilde -85
-KPX Ydieresis a -140
-KPX Ydieresis aacute -140
-KPX Ydieresis abreve -70
-KPX Ydieresis acircumflex -140
-KPX Ydieresis adieresis -140
-KPX Ydieresis agrave -140
-KPX Ydieresis amacron -70
-KPX Ydieresis aogonek -140
-KPX Ydieresis aring -140
-KPX Ydieresis atilde -70
-KPX Ydieresis colon -60
-KPX Ydieresis comma -140
-KPX Ydieresis e -140
-KPX Ydieresis eacute -140
-KPX Ydieresis ecaron -140
-KPX Ydieresis ecircumflex -140
-KPX Ydieresis edieresis -140
-KPX Ydieresis edotaccent -140
-KPX Ydieresis egrave -140
-KPX Ydieresis emacron -70
-KPX Ydieresis eogonek -140
-KPX Ydieresis hyphen -140
-KPX Ydieresis i -20
-KPX Ydieresis iacute -20
-KPX Ydieresis iogonek -20
-KPX Ydieresis o -140
-KPX Ydieresis oacute -140
-KPX Ydieresis ocircumflex -140
-KPX Ydieresis odieresis -140
-KPX Ydieresis ograve -140
-KPX Ydieresis ohungarumlaut -140
-KPX Ydieresis omacron -140
-KPX Ydieresis oslash -140
-KPX Ydieresis otilde -140
-KPX Ydieresis period -140
-KPX Ydieresis semicolon -60
-KPX Ydieresis u -110
-KPX Ydieresis uacute -110
-KPX Ydieresis ucircumflex -110
-KPX Ydieresis udieresis -110
-KPX Ydieresis ugrave -110
-KPX Ydieresis uhungarumlaut -110
-KPX Ydieresis umacron -110
-KPX Ydieresis uogonek -110
-KPX Ydieresis uring -110
-KPX a v -20
-KPX a w -20
-KPX a y -30
-KPX a yacute -30
-KPX a ydieresis -30
-KPX aacute v -20
-KPX aacute w -20
-KPX aacute y -30
-KPX aacute yacute -30
-KPX aacute ydieresis -30
-KPX abreve v -20
-KPX abreve w -20
-KPX abreve y -30
-KPX abreve yacute -30
-KPX abreve ydieresis -30
-KPX acircumflex v -20
-KPX acircumflex w -20
-KPX acircumflex y -30
-KPX acircumflex yacute -30
-KPX acircumflex ydieresis -30
-KPX adieresis v -20
-KPX adieresis w -20
-KPX adieresis y -30
-KPX adieresis yacute -30
-KPX adieresis ydieresis -30
-KPX agrave v -20
-KPX agrave w -20
-KPX agrave y -30
-KPX agrave yacute -30
-KPX agrave ydieresis -30
-KPX amacron v -20
-KPX amacron w -20
-KPX amacron y -30
-KPX amacron yacute -30
-KPX amacron ydieresis -30
-KPX aogonek v -20
-KPX aogonek w -20
-KPX aogonek y -30
-KPX aogonek yacute -30
-KPX aogonek ydieresis -30
-KPX aring v -20
-KPX aring w -20
-KPX aring y -30
-KPX aring yacute -30
-KPX aring ydieresis -30
-KPX atilde v -20
-KPX atilde w -20
-KPX atilde y -30
-KPX atilde yacute -30
-KPX atilde ydieresis -30
-KPX b b -10
-KPX b comma -40
-KPX b l -20
-KPX b lacute -20
-KPX b lcommaaccent -20
-KPX b lslash -20
-KPX b period -40
-KPX b u -20
-KPX b uacute -20
-KPX b ucircumflex -20
-KPX b udieresis -20
-KPX b ugrave -20
-KPX b uhungarumlaut -20
-KPX b umacron -20
-KPX b uogonek -20
-KPX b uring -20
-KPX b v -20
-KPX b y -20
-KPX b yacute -20
-KPX b ydieresis -20
-KPX c comma -15
-KPX c k -20
-KPX c kcommaaccent -20
-KPX cacute comma -15
-KPX cacute k -20
-KPX cacute kcommaaccent -20
-KPX ccaron comma -15
-KPX ccaron k -20
-KPX ccaron kcommaaccent -20
-KPX ccedilla comma -15
-KPX ccedilla k -20
-KPX ccedilla kcommaaccent -20
-KPX colon space -50
-KPX comma quotedblright -100
-KPX comma quoteright -100
-KPX e comma -15
-KPX e period -15
-KPX e v -30
-KPX e w -20
-KPX e x -30
-KPX e y -20
-KPX e yacute -20
-KPX e ydieresis -20
-KPX eacute comma -15
-KPX eacute period -15
-KPX eacute v -30
-KPX eacute w -20
-KPX eacute x -30
-KPX eacute y -20
-KPX eacute yacute -20
-KPX eacute ydieresis -20
-KPX ecaron comma -15
-KPX ecaron period -15
-KPX ecaron v -30
-KPX ecaron w -20
-KPX ecaron x -30
-KPX ecaron y -20
-KPX ecaron yacute -20
-KPX ecaron ydieresis -20
-KPX ecircumflex comma -15
-KPX ecircumflex period -15
-KPX ecircumflex v -30
-KPX ecircumflex w -20
-KPX ecircumflex x -30
-KPX ecircumflex y -20
-KPX ecircumflex yacute -20
-KPX ecircumflex ydieresis -20
-KPX edieresis comma -15
-KPX edieresis period -15
-KPX edieresis v -30
-KPX edieresis w -20
-KPX edieresis x -30
-KPX edieresis y -20
-KPX edieresis yacute -20
-KPX edieresis ydieresis -20
-KPX edotaccent comma -15
-KPX edotaccent period -15
-KPX edotaccent v -30
-KPX edotaccent w -20
-KPX edotaccent x -30
-KPX edotaccent y -20
-KPX edotaccent yacute -20
-KPX edotaccent ydieresis -20
-KPX egrave comma -15
-KPX egrave period -15
-KPX egrave v -30
-KPX egrave w -20
-KPX egrave x -30
-KPX egrave y -20
-KPX egrave yacute -20
-KPX egrave ydieresis -20
-KPX emacron comma -15
-KPX emacron period -15
-KPX emacron v -30
-KPX emacron w -20
-KPX emacron x -30
-KPX emacron y -20
-KPX emacron yacute -20
-KPX emacron ydieresis -20
-KPX eogonek comma -15
-KPX eogonek period -15
-KPX eogonek v -30
-KPX eogonek w -20
-KPX eogonek x -30
-KPX eogonek y -20
-KPX eogonek yacute -20
-KPX eogonek ydieresis -20
-KPX f a -30
-KPX f aacute -30
-KPX f abreve -30
-KPX f acircumflex -30
-KPX f adieresis -30
-KPX f agrave -30
-KPX f amacron -30
-KPX f aogonek -30
-KPX f aring -30
-KPX f atilde -30
-KPX f comma -30
-KPX f dotlessi -28
-KPX f e -30
-KPX f eacute -30
-KPX f ecaron -30
-KPX f ecircumflex -30
-KPX f edieresis -30
-KPX f edotaccent -30
-KPX f egrave -30
-KPX f emacron -30
-KPX f eogonek -30
-KPX f o -30
-KPX f oacute -30
-KPX f ocircumflex -30
-KPX f odieresis -30
-KPX f ograve -30
-KPX f ohungarumlaut -30
-KPX f omacron -30
-KPX f oslash -30
-KPX f otilde -30
-KPX f period -30
-KPX f quotedblright 60
-KPX f quoteright 50
-KPX g r -10
-KPX g racute -10
-KPX g rcaron -10
-KPX g rcommaaccent -10
-KPX gbreve r -10
-KPX gbreve racute -10
-KPX gbreve rcaron -10
-KPX gbreve rcommaaccent -10
-KPX gcommaaccent r -10
-KPX gcommaaccent racute -10
-KPX gcommaaccent rcaron -10
-KPX gcommaaccent rcommaaccent -10
-KPX h y -30
-KPX h yacute -30
-KPX h ydieresis -30
-KPX k e -20
-KPX k eacute -20
-KPX k ecaron -20
-KPX k ecircumflex -20
-KPX k edieresis -20
-KPX k edotaccent -20
-KPX k egrave -20
-KPX k emacron -20
-KPX k eogonek -20
-KPX k o -20
-KPX k oacute -20
-KPX k ocircumflex -20
-KPX k odieresis -20
-KPX k ograve -20
-KPX k ohungarumlaut -20
-KPX k omacron -20
-KPX k oslash -20
-KPX k otilde -20
-KPX kcommaaccent e -20
-KPX kcommaaccent eacute -20
-KPX kcommaaccent ecaron -20
-KPX kcommaaccent ecircumflex -20
-KPX kcommaaccent edieresis -20
-KPX kcommaaccent edotaccent -20
-KPX kcommaaccent egrave -20
-KPX kcommaaccent emacron -20
-KPX kcommaaccent eogonek -20
-KPX kcommaaccent o -20
-KPX kcommaaccent oacute -20
-KPX kcommaaccent ocircumflex -20
-KPX kcommaaccent odieresis -20
-KPX kcommaaccent ograve -20
-KPX kcommaaccent ohungarumlaut -20
-KPX kcommaaccent omacron -20
-KPX kcommaaccent oslash -20
-KPX kcommaaccent otilde -20
-KPX m u -10
-KPX m uacute -10
-KPX m ucircumflex -10
-KPX m udieresis -10
-KPX m ugrave -10
-KPX m uhungarumlaut -10
-KPX m umacron -10
-KPX m uogonek -10
-KPX m uring -10
-KPX m y -15
-KPX m yacute -15
-KPX m ydieresis -15
-KPX n u -10
-KPX n uacute -10
-KPX n ucircumflex -10
-KPX n udieresis -10
-KPX n ugrave -10
-KPX n uhungarumlaut -10
-KPX n umacron -10
-KPX n uogonek -10
-KPX n uring -10
-KPX n v -20
-KPX n y -15
-KPX n yacute -15
-KPX n ydieresis -15
-KPX nacute u -10
-KPX nacute uacute -10
-KPX nacute ucircumflex -10
-KPX nacute udieresis -10
-KPX nacute ugrave -10
-KPX nacute uhungarumlaut -10
-KPX nacute umacron -10
-KPX nacute uogonek -10
-KPX nacute uring -10
-KPX nacute v -20
-KPX nacute y -15
-KPX nacute yacute -15
-KPX nacute ydieresis -15
-KPX ncaron u -10
-KPX ncaron uacute -10
-KPX ncaron ucircumflex -10
-KPX ncaron udieresis -10
-KPX ncaron ugrave -10
-KPX ncaron uhungarumlaut -10
-KPX ncaron umacron -10
-KPX ncaron uogonek -10
-KPX ncaron uring -10
-KPX ncaron v -20
-KPX ncaron y -15
-KPX ncaron yacute -15
-KPX ncaron ydieresis -15
-KPX ncommaaccent u -10
-KPX ncommaaccent uacute -10
-KPX ncommaaccent ucircumflex -10
-KPX ncommaaccent udieresis -10
-KPX ncommaaccent ugrave -10
-KPX ncommaaccent uhungarumlaut -10
-KPX ncommaaccent umacron -10
-KPX ncommaaccent uogonek -10
-KPX ncommaaccent uring -10
-KPX ncommaaccent v -20
-KPX ncommaaccent y -15
-KPX ncommaaccent yacute -15
-KPX ncommaaccent ydieresis -15
-KPX ntilde u -10
-KPX ntilde uacute -10
-KPX ntilde ucircumflex -10
-KPX ntilde udieresis -10
-KPX ntilde ugrave -10
-KPX ntilde uhungarumlaut -10
-KPX ntilde umacron -10
-KPX ntilde uogonek -10
-KPX ntilde uring -10
-KPX ntilde v -20
-KPX ntilde y -15
-KPX ntilde yacute -15
-KPX ntilde ydieresis -15
-KPX o comma -40
-KPX o period -40
-KPX o v -15
-KPX o w -15
-KPX o x -30
-KPX o y -30
-KPX o yacute -30
-KPX o ydieresis -30
-KPX oacute comma -40
-KPX oacute period -40
-KPX oacute v -15
-KPX oacute w -15
-KPX oacute x -30
-KPX oacute y -30
-KPX oacute yacute -30
-KPX oacute ydieresis -30
-KPX ocircumflex comma -40
-KPX ocircumflex period -40
-KPX ocircumflex v -15
-KPX ocircumflex w -15
-KPX ocircumflex x -30
-KPX ocircumflex y -30
-KPX ocircumflex yacute -30
-KPX ocircumflex ydieresis -30
-KPX odieresis comma -40
-KPX odieresis period -40
-KPX odieresis v -15
-KPX odieresis w -15
-KPX odieresis x -30
-KPX odieresis y -30
-KPX odieresis yacute -30
-KPX odieresis ydieresis -30
-KPX ograve comma -40
-KPX ograve period -40
-KPX ograve v -15
-KPX ograve w -15
-KPX ograve x -30
-KPX ograve y -30
-KPX ograve yacute -30
-KPX ograve ydieresis -30
-KPX ohungarumlaut comma -40
-KPX ohungarumlaut period -40
-KPX ohungarumlaut v -15
-KPX ohungarumlaut w -15
-KPX ohungarumlaut x -30
-KPX ohungarumlaut y -30
-KPX ohungarumlaut yacute -30
-KPX ohungarumlaut ydieresis -30
-KPX omacron comma -40
-KPX omacron period -40
-KPX omacron v -15
-KPX omacron w -15
-KPX omacron x -30
-KPX omacron y -30
-KPX omacron yacute -30
-KPX omacron ydieresis -30
-KPX oslash a -55
-KPX oslash aacute -55
-KPX oslash abreve -55
-KPX oslash acircumflex -55
-KPX oslash adieresis -55
-KPX oslash agrave -55
-KPX oslash amacron -55
-KPX oslash aogonek -55
-KPX oslash aring -55
-KPX oslash atilde -55
-KPX oslash b -55
-KPX oslash c -55
-KPX oslash cacute -55
-KPX oslash ccaron -55
-KPX oslash ccedilla -55
-KPX oslash comma -95
-KPX oslash d -55
-KPX oslash dcroat -55
-KPX oslash e -55
-KPX oslash eacute -55
-KPX oslash ecaron -55
-KPX oslash ecircumflex -55
-KPX oslash edieresis -55
-KPX oslash edotaccent -55
-KPX oslash egrave -55
-KPX oslash emacron -55
-KPX oslash eogonek -55
-KPX oslash f -55
-KPX oslash g -55
-KPX oslash gbreve -55
-KPX oslash gcommaaccent -55
-KPX oslash h -55
-KPX oslash i -55
-KPX oslash iacute -55
-KPX oslash icircumflex -55
-KPX oslash idieresis -55
-KPX oslash igrave -55
-KPX oslash imacron -55
-KPX oslash iogonek -55
-KPX oslash j -55
-KPX oslash k -55
-KPX oslash kcommaaccent -55
-KPX oslash l -55
-KPX oslash lacute -55
-KPX oslash lcommaaccent -55
-KPX oslash lslash -55
-KPX oslash m -55
-KPX oslash n -55
-KPX oslash nacute -55
-KPX oslash ncaron -55
-KPX oslash ncommaaccent -55
-KPX oslash ntilde -55
-KPX oslash o -55
-KPX oslash oacute -55
-KPX oslash ocircumflex -55
-KPX oslash odieresis -55
-KPX oslash ograve -55
-KPX oslash ohungarumlaut -55
-KPX oslash omacron -55
-KPX oslash oslash -55
-KPX oslash otilde -55
-KPX oslash p -55
-KPX oslash period -95
-KPX oslash q -55
-KPX oslash r -55
-KPX oslash racute -55
-KPX oslash rcaron -55
-KPX oslash rcommaaccent -55
-KPX oslash s -55
-KPX oslash sacute -55
-KPX oslash scaron -55
-KPX oslash scedilla -55
-KPX oslash scommaaccent -55
-KPX oslash t -55
-KPX oslash tcommaaccent -55
-KPX oslash u -55
-KPX oslash uacute -55
-KPX oslash ucircumflex -55
-KPX oslash udieresis -55
-KPX oslash ugrave -55
-KPX oslash uhungarumlaut -55
-KPX oslash umacron -55
-KPX oslash uogonek -55
-KPX oslash uring -55
-KPX oslash v -70
-KPX oslash w -70
-KPX oslash x -85
-KPX oslash y -70
-KPX oslash yacute -70
-KPX oslash ydieresis -70
-KPX oslash z -55
-KPX oslash zacute -55
-KPX oslash zcaron -55
-KPX oslash zdotaccent -55
-KPX otilde comma -40
-KPX otilde period -40
-KPX otilde v -15
-KPX otilde w -15
-KPX otilde x -30
-KPX otilde y -30
-KPX otilde yacute -30
-KPX otilde ydieresis -30
-KPX p comma -35
-KPX p period -35
-KPX p y -30
-KPX p yacute -30
-KPX p ydieresis -30
-KPX period quotedblright -100
-KPX period quoteright -100
-KPX period space -60
-KPX quotedblright space -40
-KPX quoteleft quoteleft -57
-KPX quoteright d -50
-KPX quoteright dcroat -50
-KPX quoteright quoteright -57
-KPX quoteright r -50
-KPX quoteright racute -50
-KPX quoteright rcaron -50
-KPX quoteright rcommaaccent -50
-KPX quoteright s -50
-KPX quoteright sacute -50
-KPX quoteright scaron -50
-KPX quoteright scedilla -50
-KPX quoteright scommaaccent -50
-KPX quoteright space -70
-KPX r a -10
-KPX r aacute -10
-KPX r abreve -10
-KPX r acircumflex -10
-KPX r adieresis -10
-KPX r agrave -10
-KPX r amacron -10
-KPX r aogonek -10
-KPX r aring -10
-KPX r atilde -10
-KPX r colon 30
-KPX r comma -50
-KPX r i 15
-KPX r iacute 15
-KPX r icircumflex 15
-KPX r idieresis 15
-KPX r igrave 15
-KPX r imacron 15
-KPX r iogonek 15
-KPX r k 15
-KPX r kcommaaccent 15
-KPX r l 15
-KPX r lacute 15
-KPX r lcommaaccent 15
-KPX r lslash 15
-KPX r m 25
-KPX r n 25
-KPX r nacute 25
-KPX r ncaron 25
-KPX r ncommaaccent 25
-KPX r ntilde 25
-KPX r p 30
-KPX r period -50
-KPX r semicolon 30
-KPX r t 40
-KPX r tcommaaccent 40
-KPX r u 15
-KPX r uacute 15
-KPX r ucircumflex 15
-KPX r udieresis 15
-KPX r ugrave 15
-KPX r uhungarumlaut 15
-KPX r umacron 15
-KPX r uogonek 15
-KPX r uring 15
-KPX r v 30
-KPX r y 30
-KPX r yacute 30
-KPX r ydieresis 30
-KPX racute a -10
-KPX racute aacute -10
-KPX racute abreve -10
-KPX racute acircumflex -10
-KPX racute adieresis -10
-KPX racute agrave -10
-KPX racute amacron -10
-KPX racute aogonek -10
-KPX racute aring -10
-KPX racute atilde -10
-KPX racute colon 30
-KPX racute comma -50
-KPX racute i 15
-KPX racute iacute 15
-KPX racute icircumflex 15
-KPX racute idieresis 15
-KPX racute igrave 15
-KPX racute imacron 15
-KPX racute iogonek 15
-KPX racute k 15
-KPX racute kcommaaccent 15
-KPX racute l 15
-KPX racute lacute 15
-KPX racute lcommaaccent 15
-KPX racute lslash 15
-KPX racute m 25
-KPX racute n 25
-KPX racute nacute 25
-KPX racute ncaron 25
-KPX racute ncommaaccent 25
-KPX racute ntilde 25
-KPX racute p 30
-KPX racute period -50
-KPX racute semicolon 30
-KPX racute t 40
-KPX racute tcommaaccent 40
-KPX racute u 15
-KPX racute uacute 15
-KPX racute ucircumflex 15
-KPX racute udieresis 15
-KPX racute ugrave 15
-KPX racute uhungarumlaut 15
-KPX racute umacron 15
-KPX racute uogonek 15
-KPX racute uring 15
-KPX racute v 30
-KPX racute y 30
-KPX racute yacute 30
-KPX racute ydieresis 30
-KPX rcaron a -10
-KPX rcaron aacute -10
-KPX rcaron abreve -10
-KPX rcaron acircumflex -10
-KPX rcaron adieresis -10
-KPX rcaron agrave -10
-KPX rcaron amacron -10
-KPX rcaron aogonek -10
-KPX rcaron aring -10
-KPX rcaron atilde -10
-KPX rcaron colon 30
-KPX rcaron comma -50
-KPX rcaron i 15
-KPX rcaron iacute 15
-KPX rcaron icircumflex 15
-KPX rcaron idieresis 15
-KPX rcaron igrave 15
-KPX rcaron imacron 15
-KPX rcaron iogonek 15
-KPX rcaron k 15
-KPX rcaron kcommaaccent 15
-KPX rcaron l 15
-KPX rcaron lacute 15
-KPX rcaron lcommaaccent 15
-KPX rcaron lslash 15
-KPX rcaron m 25
-KPX rcaron n 25
-KPX rcaron nacute 25
-KPX rcaron ncaron 25
-KPX rcaron ncommaaccent 25
-KPX rcaron ntilde 25
-KPX rcaron p 30
-KPX rcaron period -50
-KPX rcaron semicolon 30
-KPX rcaron t 40
-KPX rcaron tcommaaccent 40
-KPX rcaron u 15
-KPX rcaron uacute 15
-KPX rcaron ucircumflex 15
-KPX rcaron udieresis 15
-KPX rcaron ugrave 15
-KPX rcaron uhungarumlaut 15
-KPX rcaron umacron 15
-KPX rcaron uogonek 15
-KPX rcaron uring 15
-KPX rcaron v 30
-KPX rcaron y 30
-KPX rcaron yacute 30
-KPX rcaron ydieresis 30
-KPX rcommaaccent a -10
-KPX rcommaaccent aacute -10
-KPX rcommaaccent abreve -10
-KPX rcommaaccent acircumflex -10
-KPX rcommaaccent adieresis -10
-KPX rcommaaccent agrave -10
-KPX rcommaaccent amacron -10
-KPX rcommaaccent aogonek -10
-KPX rcommaaccent aring -10
-KPX rcommaaccent atilde -10
-KPX rcommaaccent colon 30
-KPX rcommaaccent comma -50
-KPX rcommaaccent i 15
-KPX rcommaaccent iacute 15
-KPX rcommaaccent icircumflex 15
-KPX rcommaaccent idieresis 15
-KPX rcommaaccent igrave 15
-KPX rcommaaccent imacron 15
-KPX rcommaaccent iogonek 15
-KPX rcommaaccent k 15
-KPX rcommaaccent kcommaaccent 15
-KPX rcommaaccent l 15
-KPX rcommaaccent lacute 15
-KPX rcommaaccent lcommaaccent 15
-KPX rcommaaccent lslash 15
-KPX rcommaaccent m 25
-KPX rcommaaccent n 25
-KPX rcommaaccent nacute 25
-KPX rcommaaccent ncaron 25
-KPX rcommaaccent ncommaaccent 25
-KPX rcommaaccent ntilde 25
-KPX rcommaaccent p 30
-KPX rcommaaccent period -50
-KPX rcommaaccent semicolon 30
-KPX rcommaaccent t 40
-KPX rcommaaccent tcommaaccent 40
-KPX rcommaaccent u 15
-KPX rcommaaccent uacute 15
-KPX rcommaaccent ucircumflex 15
-KPX rcommaaccent udieresis 15
-KPX rcommaaccent ugrave 15
-KPX rcommaaccent uhungarumlaut 15
-KPX rcommaaccent umacron 15
-KPX rcommaaccent uogonek 15
-KPX rcommaaccent uring 15
-KPX rcommaaccent v 30
-KPX rcommaaccent y 30
-KPX rcommaaccent yacute 30
-KPX rcommaaccent ydieresis 30
-KPX s comma -15
-KPX s period -15
-KPX s w -30
-KPX sacute comma -15
-KPX sacute period -15
-KPX sacute w -30
-KPX scaron comma -15
-KPX scaron period -15
-KPX scaron w -30
-KPX scedilla comma -15
-KPX scedilla period -15
-KPX scedilla w -30
-KPX scommaaccent comma -15
-KPX scommaaccent period -15
-KPX scommaaccent w -30
-KPX semicolon space -50
-KPX space T -50
-KPX space Tcaron -50
-KPX space Tcommaaccent -50
-KPX space V -50
-KPX space W -40
-KPX space Y -90
-KPX space Yacute -90
-KPX space Ydieresis -90
-KPX space quotedblleft -30
-KPX space quoteleft -60
-KPX v a -25
-KPX v aacute -25
-KPX v abreve -25
-KPX v acircumflex -25
-KPX v adieresis -25
-KPX v agrave -25
-KPX v amacron -25
-KPX v aogonek -25
-KPX v aring -25
-KPX v atilde -25
-KPX v comma -80
-KPX v e -25
-KPX v eacute -25
-KPX v ecaron -25
-KPX v ecircumflex -25
-KPX v edieresis -25
-KPX v edotaccent -25
-KPX v egrave -25
-KPX v emacron -25
-KPX v eogonek -25
-KPX v o -25
-KPX v oacute -25
-KPX v ocircumflex -25
-KPX v odieresis -25
-KPX v ograve -25
-KPX v ohungarumlaut -25
-KPX v omacron -25
-KPX v oslash -25
-KPX v otilde -25
-KPX v period -80
-KPX w a -15
-KPX w aacute -15
-KPX w abreve -15
-KPX w acircumflex -15
-KPX w adieresis -15
-KPX w agrave -15
-KPX w amacron -15
-KPX w aogonek -15
-KPX w aring -15
-KPX w atilde -15
-KPX w comma -60
-KPX w e -10
-KPX w eacute -10
-KPX w ecaron -10
-KPX w ecircumflex -10
-KPX w edieresis -10
-KPX w edotaccent -10
-KPX w egrave -10
-KPX w emacron -10
-KPX w eogonek -10
-KPX w o -10
-KPX w oacute -10
-KPX w ocircumflex -10
-KPX w odieresis -10
-KPX w ograve -10
-KPX w ohungarumlaut -10
-KPX w omacron -10
-KPX w oslash -10
-KPX w otilde -10
-KPX w period -60
-KPX x e -30
-KPX x eacute -30
-KPX x ecaron -30
-KPX x ecircumflex -30
-KPX x edieresis -30
-KPX x edotaccent -30
-KPX x egrave -30
-KPX x emacron -30
-KPX x eogonek -30
-KPX y a -20
-KPX y aacute -20
-KPX y abreve -20
-KPX y acircumflex -20
-KPX y adieresis -20
-KPX y agrave -20
-KPX y amacron -20
-KPX y aogonek -20
-KPX y aring -20
-KPX y atilde -20
-KPX y comma -100
-KPX y e -20
-KPX y eacute -20
-KPX y ecaron -20
-KPX y ecircumflex -20
-KPX y edieresis -20
-KPX y edotaccent -20
-KPX y egrave -20
-KPX y emacron -20
-KPX y eogonek -20
-KPX y o -20
-KPX y oacute -20
-KPX y ocircumflex -20
-KPX y odieresis -20
-KPX y ograve -20
-KPX y ohungarumlaut -20
-KPX y omacron -20
-KPX y oslash -20
-KPX y otilde -20
-KPX y period -100
-KPX yacute a -20
-KPX yacute aacute -20
-KPX yacute abreve -20
-KPX yacute acircumflex -20
-KPX yacute adieresis -20
-KPX yacute agrave -20
-KPX yacute amacron -20
-KPX yacute aogonek -20
-KPX yacute aring -20
-KPX yacute atilde -20
-KPX yacute comma -100
-KPX yacute e -20
-KPX yacute eacute -20
-KPX yacute ecaron -20
-KPX yacute ecircumflex -20
-KPX yacute edieresis -20
-KPX yacute edotaccent -20
-KPX yacute egrave -20
-KPX yacute emacron -20
-KPX yacute eogonek -20
-KPX yacute o -20
-KPX yacute oacute -20
-KPX yacute ocircumflex -20
-KPX yacute odieresis -20
-KPX yacute ograve -20
-KPX yacute ohungarumlaut -20
-KPX yacute omacron -20
-KPX yacute oslash -20
-KPX yacute otilde -20
-KPX yacute period -100
-KPX ydieresis a -20
-KPX ydieresis aacute -20
-KPX ydieresis abreve -20
-KPX ydieresis acircumflex -20
-KPX ydieresis adieresis -20
-KPX ydieresis agrave -20
-KPX ydieresis amacron -20
-KPX ydieresis aogonek -20
-KPX ydieresis aring -20
-KPX ydieresis atilde -20
-KPX ydieresis comma -100
-KPX ydieresis e -20
-KPX ydieresis eacute -20
-KPX ydieresis ecaron -20
-KPX ydieresis ecircumflex -20
-KPX ydieresis edieresis -20
-KPX ydieresis edotaccent -20
-KPX ydieresis egrave -20
-KPX ydieresis emacron -20
-KPX ydieresis eogonek -20
-KPX ydieresis o -20
-KPX ydieresis oacute -20
-KPX ydieresis ocircumflex -20
-KPX ydieresis odieresis -20
-KPX ydieresis ograve -20
-KPX ydieresis ohungarumlaut -20
-KPX ydieresis omacron -20
-KPX ydieresis oslash -20
-KPX ydieresis otilde -20
-KPX ydieresis period -100
-KPX z e -15
-KPX z eacute -15
-KPX z ecaron -15
-KPX z ecircumflex -15
-KPX z edieresis -15
-KPX z edotaccent -15
-KPX z egrave -15
-KPX z emacron -15
-KPX z eogonek -15
-KPX z o -15
-KPX z oacute -15
-KPX z ocircumflex -15
-KPX z odieresis -15
-KPX z ograve -15
-KPX z ohungarumlaut -15
-KPX z omacron -15
-KPX z oslash -15
-KPX z otilde -15
-KPX zacute e -15
-KPX zacute eacute -15
-KPX zacute ecaron -15
-KPX zacute ecircumflex -15
-KPX zacute edieresis -15
-KPX zacute edotaccent -15
-KPX zacute egrave -15
-KPX zacute emacron -15
-KPX zacute eogonek -15
-KPX zacute o -15
-KPX zacute oacute -15
-KPX zacute ocircumflex -15
-KPX zacute odieresis -15
-KPX zacute ograve -15
-KPX zacute ohungarumlaut -15
-KPX zacute omacron -15
-KPX zacute oslash -15
-KPX zacute otilde -15
-KPX zcaron e -15
-KPX zcaron eacute -15
-KPX zcaron ecaron -15
-KPX zcaron ecircumflex -15
-KPX zcaron edieresis -15
-KPX zcaron edotaccent -15
-KPX zcaron egrave -15
-KPX zcaron emacron -15
-KPX zcaron eogonek -15
-KPX zcaron o -15
-KPX zcaron oacute -15
-KPX zcaron ocircumflex -15
-KPX zcaron odieresis -15
-KPX zcaron ograve -15
-KPX zcaron ohungarumlaut -15
-KPX zcaron omacron -15
-KPX zcaron oslash -15
-KPX zcaron otilde -15
-KPX zdotaccent e -15
-KPX zdotaccent eacute -15
-KPX zdotaccent ecaron -15
-KPX zdotaccent ecircumflex -15
-KPX zdotaccent edieresis -15
-KPX zdotaccent edotaccent -15
-KPX zdotaccent egrave -15
-KPX zdotaccent emacron -15
-KPX zdotaccent eogonek -15
-KPX zdotaccent o -15
-KPX zdotaccent oacute -15
-KPX zdotaccent ocircumflex -15
-KPX zdotaccent odieresis -15
-KPX zdotaccent ograve -15
-KPX zdotaccent ohungarumlaut -15
-KPX zdotaccent omacron -15
-KPX zdotaccent oslash -15
-KPX zdotaccent otilde -15
-EndKernPairs
-EndKernData
-EndFontMetrics
-
diff --git a/LibrarySource/com/lowagie/text/pdf/fonts/Helvetica.afm b/LibrarySource/com/lowagie/text/pdf/fonts/Helvetica.afm
deleted file mode 100644
index d39cea0..0000000
--- a/LibrarySource/com/lowagie/text/pdf/fonts/Helvetica.afm
+++ /dev/null
@@ -1,3052 +0,0 @@
-StartFontMetrics 4.1
-Comment Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved.
-Comment Creation Date: Thu May 1 12:38:23 1997
-Comment UniqueID 43054
-Comment VMusage 37069 48094
-FontName Helvetica
-FullName Helvetica
-FamilyName Helvetica
-Weight Medium
-ItalicAngle 0
-IsFixedPitch false
-CharacterSet ExtendedRoman
-FontBBox -166 -225 1000 931
-UnderlinePosition -100
-UnderlineThickness 50
-Version 002.000
-Notice Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All Rights Reserved.Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries.
-EncodingScheme AdobeStandardEncoding
-CapHeight 718
-XHeight 523
-Ascender 718
-Descender -207
-StdHW 76
-StdVW 88
-StartCharMetrics 315
-C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
-C 33 ; WX 278 ; N exclam ; B 90 0 187 718 ;
-C 34 ; WX 355 ; N quotedbl ; B 70 463 285 718 ;
-C 35 ; WX 556 ; N numbersign ; B 28 0 529 688 ;
-C 36 ; WX 556 ; N dollar ; B 32 -115 520 775 ;
-C 37 ; WX 889 ; N percent ; B 39 -19 850 703 ;
-C 38 ; WX 667 ; N ampersand ; B 44 -15 645 718 ;
-C 39 ; WX 222 ; N quoteright ; B 53 463 157 718 ;
-C 40 ; WX 333 ; N parenleft ; B 68 -207 299 733 ;
-C 41 ; WX 333 ; N parenright ; B 34 -207 265 733 ;
-C 42 ; WX 389 ; N asterisk ; B 39 431 349 718 ;
-C 43 ; WX 584 ; N plus ; B 39 0 545 505 ;
-C 44 ; WX 278 ; N comma ; B 87 -147 191 106 ;
-C 45 ; WX 333 ; N hyphen ; B 44 232 289 322 ;
-C 46 ; WX 278 ; N period ; B 87 0 191 106 ;
-C 47 ; WX 278 ; N slash ; B -17 -19 295 737 ;
-C 48 ; WX 556 ; N zero ; B 37 -19 519 703 ;
-C 49 ; WX 556 ; N one ; B 101 0 359 703 ;
-C 50 ; WX 556 ; N two ; B 26 0 507 703 ;
-C 51 ; WX 556 ; N three ; B 34 -19 522 703 ;
-C 52 ; WX 556 ; N four ; B 25 0 523 703 ;
-C 53 ; WX 556 ; N five ; B 32 -19 514 688 ;
-C 54 ; WX 556 ; N six ; B 38 -19 518 703 ;
-C 55 ; WX 556 ; N seven ; B 37 0 523 688 ;
-C 56 ; WX 556 ; N eight ; B 38 -19 517 703 ;
-C 57 ; WX 556 ; N nine ; B 42 -19 514 703 ;
-C 58 ; WX 278 ; N colon ; B 87 0 191 516 ;
-C 59 ; WX 278 ; N semicolon ; B 87 -147 191 516 ;
-C 60 ; WX 584 ; N less ; B 48 11 536 495 ;
-C 61 ; WX 584 ; N equal ; B 39 115 545 390 ;
-C 62 ; WX 584 ; N greater ; B 48 11 536 495 ;
-C 63 ; WX 556 ; N question ; B 56 0 492 727 ;
-C 64 ; WX 1015 ; N at ; B 147 -19 868 737 ;
-C 65 ; WX 667 ; N A ; B 14 0 654 718 ;
-C 66 ; WX 667 ; N B ; B 74 0 627 718 ;
-C 67 ; WX 722 ; N C ; B 44 -19 681 737 ;
-C 68 ; WX 722 ; N D ; B 81 0 674 718 ;
-C 69 ; WX 667 ; N E ; B 86 0 616 718 ;
-C 70 ; WX 611 ; N F ; B 86 0 583 718 ;
-C 71 ; WX 778 ; N G ; B 48 -19 704 737 ;
-C 72 ; WX 722 ; N H ; B 77 0 646 718 ;
-C 73 ; WX 278 ; N I ; B 91 0 188 718 ;
-C 74 ; WX 500 ; N J ; B 17 -19 428 718 ;
-C 75 ; WX 667 ; N K ; B 76 0 663 718 ;
-C 76 ; WX 556 ; N L ; B 76 0 537 718 ;
-C 77 ; WX 833 ; N M ; B 73 0 761 718 ;
-C 78 ; WX 722 ; N N ; B 76 0 646 718 ;
-C 79 ; WX 778 ; N O ; B 39 -19 739 737 ;
-C 80 ; WX 667 ; N P ; B 86 0 622 718 ;
-C 81 ; WX 778 ; N Q ; B 39 -56 739 737 ;
-C 82 ; WX 722 ; N R ; B 88 0 684 718 ;
-C 83 ; WX 667 ; N S ; B 49 -19 620 737 ;
-C 84 ; WX 611 ; N T ; B 14 0 597 718 ;
-C 85 ; WX 722 ; N U ; B 79 -19 644 718 ;
-C 86 ; WX 667 ; N V ; B 20 0 647 718 ;
-C 87 ; WX 944 ; N W ; B 16 0 928 718 ;
-C 88 ; WX 667 ; N X ; B 19 0 648 718 ;
-C 89 ; WX 667 ; N Y ; B 14 0 653 718 ;
-C 90 ; WX 611 ; N Z ; B 23 0 588 718 ;
-C 91 ; WX 278 ; N bracketleft ; B 63 -196 250 722 ;
-C 92 ; WX 278 ; N backslash ; B -17 -19 295 737 ;
-C 93 ; WX 278 ; N bracketright ; B 28 -196 215 722 ;
-C 94 ; WX 469 ; N asciicircum ; B -14 264 483 688 ;
-C 95 ; WX 556 ; N underscore ; B 0 -125 556 -75 ;
-C 96 ; WX 222 ; N quoteleft ; B 65 470 169 725 ;
-C 97 ; WX 556 ; N a ; B 36 -15 530 538 ;
-C 98 ; WX 556 ; N b ; B 58 -15 517 718 ;
-C 99 ; WX 500 ; N c ; B 30 -15 477 538 ;
-C 100 ; WX 556 ; N d ; B 35 -15 499 718 ;
-C 101 ; WX 556 ; N e ; B 40 -15 516 538 ;
-C 102 ; WX 278 ; N f ; B 14 0 262 728 ; L i fi ; L l fl ;
-C 103 ; WX 556 ; N g ; B 40 -220 499 538 ;
-C 104 ; WX 556 ; N h ; B 65 0 491 718 ;
-C 105 ; WX 222 ; N i ; B 67 0 155 718 ;
-C 106 ; WX 222 ; N j ; B -16 -210 155 718 ;
-C 107 ; WX 500 ; N k ; B 67 0 501 718 ;
-C 108 ; WX 222 ; N l ; B 67 0 155 718 ;
-C 109 ; WX 833 ; N m ; B 65 0 769 538 ;
-C 110 ; WX 556 ; N n ; B 65 0 491 538 ;
-C 111 ; WX 556 ; N o ; B 35 -14 521 538 ;
-C 112 ; WX 556 ; N p ; B 58 -207 517 538 ;
-C 113 ; WX 556 ; N q ; B 35 -207 494 538 ;
-C 114 ; WX 333 ; N r ; B 77 0 332 538 ;
-C 115 ; WX 500 ; N s ; B 32 -15 464 538 ;
-C 116 ; WX 278 ; N t ; B 14 -7 257 669 ;
-C 117 ; WX 556 ; N u ; B 68 -15 489 523 ;
-C 118 ; WX 500 ; N v ; B 8 0 492 523 ;
-C 119 ; WX 722 ; N w ; B 14 0 709 523 ;
-C 120 ; WX 500 ; N x ; B 11 0 490 523 ;
-C 121 ; WX 500 ; N y ; B 11 -214 489 523 ;
-C 122 ; WX 500 ; N z ; B 31 0 469 523 ;
-C 123 ; WX 334 ; N braceleft ; B 42 -196 292 722 ;
-C 124 ; WX 260 ; N bar ; B 94 -225 167 775 ;
-C 125 ; WX 334 ; N braceright ; B 42 -196 292 722 ;
-C 126 ; WX 584 ; N asciitilde ; B 61 180 523 326 ;
-C 161 ; WX 333 ; N exclamdown ; B 118 -195 215 523 ;
-C 162 ; WX 556 ; N cent ; B 51 -115 513 623 ;
-C 163 ; WX 556 ; N sterling ; B 33 -16 539 718 ;
-C 164 ; WX 167 ; N fraction ; B -166 -19 333 703 ;
-C 165 ; WX 556 ; N yen ; B 3 0 553 688 ;
-C 166 ; WX 556 ; N florin ; B -11 -207 501 737 ;
-C 167 ; WX 556 ; N section ; B 43 -191 512 737 ;
-C 168 ; WX 556 ; N currency ; B 28 99 528 603 ;
-C 169 ; WX 191 ; N quotesingle ; B 59 463 132 718 ;
-C 170 ; WX 333 ; N quotedblleft ; B 38 470 307 725 ;
-C 171 ; WX 556 ; N guillemotleft ; B 97 108 459 446 ;
-C 172 ; WX 333 ; N guilsinglleft ; B 88 108 245 446 ;
-C 173 ; WX 333 ; N guilsinglright ; B 88 108 245 446 ;
-C 174 ; WX 500 ; N fi ; B 14 0 434 728 ;
-C 175 ; WX 500 ; N fl ; B 14 0 432 728 ;
-C 177 ; WX 556 ; N endash ; B 0 240 556 313 ;
-C 178 ; WX 556 ; N dagger ; B 43 -159 514 718 ;
-C 179 ; WX 556 ; N daggerdbl ; B 43 -159 514 718 ;
-C 180 ; WX 278 ; N periodcentered ; B 77 190 202 315 ;
-C 182 ; WX 537 ; N paragraph ; B 18 -173 497 718 ;
-C 183 ; WX 350 ; N bullet ; B 18 202 333 517 ;
-C 184 ; WX 222 ; N quotesinglbase ; B 53 -149 157 106 ;
-C 185 ; WX 333 ; N quotedblbase ; B 26 -149 295 106 ;
-C 186 ; WX 333 ; N quotedblright ; B 26 463 295 718 ;
-C 187 ; WX 556 ; N guillemotright ; B 97 108 459 446 ;
-C 188 ; WX 1000 ; N ellipsis ; B 115 0 885 106 ;
-C 189 ; WX 1000 ; N perthousand ; B 7 -19 994 703 ;
-C 191 ; WX 611 ; N questiondown ; B 91 -201 527 525 ;
-C 193 ; WX 333 ; N grave ; B 14 593 211 734 ;
-C 194 ; WX 333 ; N acute ; B 122 593 319 734 ;
-C 195 ; WX 333 ; N circumflex ; B 21 593 312 734 ;
-C 196 ; WX 333 ; N tilde ; B -4 606 337 722 ;
-C 197 ; WX 333 ; N macron ; B 10 627 323 684 ;
-C 198 ; WX 333 ; N breve ; B 13 595 321 731 ;
-C 199 ; WX 333 ; N dotaccent ; B 121 604 212 706 ;
-C 200 ; WX 333 ; N dieresis ; B 40 604 293 706 ;
-C 202 ; WX 333 ; N ring ; B 75 572 259 756 ;
-C 203 ; WX 333 ; N cedilla ; B 45 -225 259 0 ;
-C 205 ; WX 333 ; N hungarumlaut ; B 31 593 409 734 ;
-C 206 ; WX 333 ; N ogonek ; B 73 -225 287 0 ;
-C 207 ; WX 333 ; N caron ; B 21 593 312 734 ;
-C 208 ; WX 1000 ; N emdash ; B 0 240 1000 313 ;
-C 225 ; WX 1000 ; N AE ; B 8 0 951 718 ;
-C 227 ; WX 370 ; N ordfeminine ; B 24 405 346 737 ;
-C 232 ; WX 556 ; N Lslash ; B -20 0 537 718 ;
-C 233 ; WX 778 ; N Oslash ; B 39 -19 740 737 ;
-C 234 ; WX 1000 ; N OE ; B 36 -19 965 737 ;
-C 235 ; WX 365 ; N ordmasculine ; B 25 405 341 737 ;
-C 241 ; WX 889 ; N ae ; B 36 -15 847 538 ;
-C 245 ; WX 278 ; N dotlessi ; B 95 0 183 523 ;
-C 248 ; WX 222 ; N lslash ; B -20 0 242 718 ;
-C 249 ; WX 611 ; N oslash ; B 28 -22 537 545 ;
-C 250 ; WX 944 ; N oe ; B 35 -15 902 538 ;
-C 251 ; WX 611 ; N germandbls ; B 67 -15 571 728 ;
-C -1 ; WX 278 ; N Idieresis ; B 13 0 266 901 ;
-C -1 ; WX 556 ; N eacute ; B 40 -15 516 734 ;
-C -1 ; WX 556 ; N abreve ; B 36 -15 530 731 ;
-C -1 ; WX 556 ; N uhungarumlaut ; B 68 -15 521 734 ;
-C -1 ; WX 556 ; N ecaron ; B 40 -15 516 734 ;
-C -1 ; WX 667 ; N Ydieresis ; B 14 0 653 901 ;
-C -1 ; WX 584 ; N divide ; B 39 -19 545 524 ;
-C -1 ; WX 667 ; N Yacute ; B 14 0 653 929 ;
-C -1 ; WX 667 ; N Acircumflex ; B 14 0 654 929 ;
-C -1 ; WX 556 ; N aacute ; B 36 -15 530 734 ;
-C -1 ; WX 722 ; N Ucircumflex ; B 79 -19 644 929 ;
-C -1 ; WX 500 ; N yacute ; B 11 -214 489 734 ;
-C -1 ; WX 500 ; N scommaaccent ; B 32 -225 464 538 ;
-C -1 ; WX 556 ; N ecircumflex ; B 40 -15 516 734 ;
-C -1 ; WX 722 ; N Uring ; B 79 -19 644 931 ;
-C -1 ; WX 722 ; N Udieresis ; B 79 -19 644 901 ;
-C -1 ; WX 556 ; N aogonek ; B 36 -220 547 538 ;
-C -1 ; WX 722 ; N Uacute ; B 79 -19 644 929 ;
-C -1 ; WX 556 ; N uogonek ; B 68 -225 519 523 ;
-C -1 ; WX 667 ; N Edieresis ; B 86 0 616 901 ;
-C -1 ; WX 722 ; N Dcroat ; B 0 0 674 718 ;
-C -1 ; WX 250 ; N commaaccent ; B 87 -225 181 -40 ;
-C -1 ; WX 737 ; N copyright ; B -14 -19 752 737 ;
-C -1 ; WX 667 ; N Emacron ; B 86 0 616 879 ;
-C -1 ; WX 500 ; N ccaron ; B 30 -15 477 734 ;
-C -1 ; WX 556 ; N aring ; B 36 -15 530 756 ;
-C -1 ; WX 722 ; N Ncommaaccent ; B 76 -225 646 718 ;
-C -1 ; WX 222 ; N lacute ; B 67 0 264 929 ;
-C -1 ; WX 556 ; N agrave ; B 36 -15 530 734 ;
-C -1 ; WX 611 ; N Tcommaaccent ; B 14 -225 597 718 ;
-C -1 ; WX 722 ; N Cacute ; B 44 -19 681 929 ;
-C -1 ; WX 556 ; N atilde ; B 36 -15 530 722 ;
-C -1 ; WX 667 ; N Edotaccent ; B 86 0 616 901 ;
-C -1 ; WX 500 ; N scaron ; B 32 -15 464 734 ;
-C -1 ; WX 500 ; N scedilla ; B 32 -225 464 538 ;
-C -1 ; WX 278 ; N iacute ; B 95 0 292 734 ;
-C -1 ; WX 471 ; N lozenge ; B 10 0 462 728 ;
-C -1 ; WX 722 ; N Rcaron ; B 88 0 684 929 ;
-C -1 ; WX 778 ; N Gcommaaccent ; B 48 -225 704 737 ;
-C -1 ; WX 556 ; N ucircumflex ; B 68 -15 489 734 ;
-C -1 ; WX 556 ; N acircumflex ; B 36 -15 530 734 ;
-C -1 ; WX 667 ; N Amacron ; B 14 0 654 879 ;
-C -1 ; WX 333 ; N rcaron ; B 61 0 352 734 ;
-C -1 ; WX 500 ; N ccedilla ; B 30 -225 477 538 ;
-C -1 ; WX 611 ; N Zdotaccent ; B 23 0 588 901 ;
-C -1 ; WX 667 ; N Thorn ; B 86 0 622 718 ;
-C -1 ; WX 778 ; N Omacron ; B 39 -19 739 879 ;
-C -1 ; WX 722 ; N Racute ; B 88 0 684 929 ;
-C -1 ; WX 667 ; N Sacute ; B 49 -19 620 929 ;
-C -1 ; WX 643 ; N dcaron ; B 35 -15 655 718 ;
-C -1 ; WX 722 ; N Umacron ; B 79 -19 644 879 ;
-C -1 ; WX 556 ; N uring ; B 68 -15 489 756 ;
-C -1 ; WX 333 ; N threesuperior ; B 5 270 325 703 ;
-C -1 ; WX 778 ; N Ograve ; B 39 -19 739 929 ;
-C -1 ; WX 667 ; N Agrave ; B 14 0 654 929 ;
-C -1 ; WX 667 ; N Abreve ; B 14 0 654 926 ;
-C -1 ; WX 584 ; N multiply ; B 39 0 545 506 ;
-C -1 ; WX 556 ; N uacute ; B 68 -15 489 734 ;
-C -1 ; WX 611 ; N Tcaron ; B 14 0 597 929 ;
-C -1 ; WX 476 ; N partialdiff ; B 13 -38 463 714 ;
-C -1 ; WX 500 ; N ydieresis ; B 11 -214 489 706 ;
-C -1 ; WX 722 ; N Nacute ; B 76 0 646 929 ;
-C -1 ; WX 278 ; N icircumflex ; B -6 0 285 734 ;
-C -1 ; WX 667 ; N Ecircumflex ; B 86 0 616 929 ;
-C -1 ; WX 556 ; N adieresis ; B 36 -15 530 706 ;
-C -1 ; WX 556 ; N edieresis ; B 40 -15 516 706 ;
-C -1 ; WX 500 ; N cacute ; B 30 -15 477 734 ;
-C -1 ; WX 556 ; N nacute ; B 65 0 491 734 ;
-C -1 ; WX 556 ; N umacron ; B 68 -15 489 684 ;
-C -1 ; WX 722 ; N Ncaron ; B 76 0 646 929 ;
-C -1 ; WX 278 ; N Iacute ; B 91 0 292 929 ;
-C -1 ; WX 584 ; N plusminus ; B 39 0 545 506 ;
-C -1 ; WX 260 ; N brokenbar ; B 94 -150 167 700 ;
-C -1 ; WX 737 ; N registered ; B -14 -19 752 737 ;
-C -1 ; WX 778 ; N Gbreve ; B 48 -19 704 926 ;
-C -1 ; WX 278 ; N Idotaccent ; B 91 0 188 901 ;
-C -1 ; WX 600 ; N summation ; B 15 -10 586 706 ;
-C -1 ; WX 667 ; N Egrave ; B 86 0 616 929 ;
-C -1 ; WX 333 ; N racute ; B 77 0 332 734 ;
-C -1 ; WX 556 ; N omacron ; B 35 -14 521 684 ;
-C -1 ; WX 611 ; N Zacute ; B 23 0 588 929 ;
-C -1 ; WX 611 ; N Zcaron ; B 23 0 588 929 ;
-C -1 ; WX 549 ; N greaterequal ; B 26 0 523 674 ;
-C -1 ; WX 722 ; N Eth ; B 0 0 674 718 ;
-C -1 ; WX 722 ; N Ccedilla ; B 44 -225 681 737 ;
-C -1 ; WX 222 ; N lcommaaccent ; B 67 -225 167 718 ;
-C -1 ; WX 317 ; N tcaron ; B 14 -7 329 808 ;
-C -1 ; WX 556 ; N eogonek ; B 40 -225 516 538 ;
-C -1 ; WX 722 ; N Uogonek ; B 79 -225 644 718 ;
-C -1 ; WX 667 ; N Aacute ; B 14 0 654 929 ;
-C -1 ; WX 667 ; N Adieresis ; B 14 0 654 901 ;
-C -1 ; WX 556 ; N egrave ; B 40 -15 516 734 ;
-C -1 ; WX 500 ; N zacute ; B 31 0 469 734 ;
-C -1 ; WX 222 ; N iogonek ; B -31 -225 183 718 ;
-C -1 ; WX 778 ; N Oacute ; B 39 -19 739 929 ;
-C -1 ; WX 556 ; N oacute ; B 35 -14 521 734 ;
-C -1 ; WX 556 ; N amacron ; B 36 -15 530 684 ;
-C -1 ; WX 500 ; N sacute ; B 32 -15 464 734 ;
-C -1 ; WX 278 ; N idieresis ; B 13 0 266 706 ;
-C -1 ; WX 778 ; N Ocircumflex ; B 39 -19 739 929 ;
-C -1 ; WX 722 ; N Ugrave ; B 79 -19 644 929 ;
-C -1 ; WX 612 ; N Delta ; B 6 0 608 688 ;
-C -1 ; WX 556 ; N thorn ; B 58 -207 517 718 ;
-C -1 ; WX 333 ; N twosuperior ; B 4 281 323 703 ;
-C -1 ; WX 778 ; N Odieresis ; B 39 -19 739 901 ;
-C -1 ; WX 556 ; N mu ; B 68 -207 489 523 ;
-C -1 ; WX 278 ; N igrave ; B -13 0 184 734 ;
-C -1 ; WX 556 ; N ohungarumlaut ; B 35 -14 521 734 ;
-C -1 ; WX 667 ; N Eogonek ; B 86 -220 633 718 ;
-C -1 ; WX 556 ; N dcroat ; B 35 -15 550 718 ;
-C -1 ; WX 834 ; N threequarters ; B 45 -19 810 703 ;
-C -1 ; WX 667 ; N Scedilla ; B 49 -225 620 737 ;
-C -1 ; WX 299 ; N lcaron ; B 67 0 311 718 ;
-C -1 ; WX 667 ; N Kcommaaccent ; B 76 -225 663 718 ;
-C -1 ; WX 556 ; N Lacute ; B 76 0 537 929 ;
-C -1 ; WX 1000 ; N trademark ; B 46 306 903 718 ;
-C -1 ; WX 556 ; N edotaccent ; B 40 -15 516 706 ;
-C -1 ; WX 278 ; N Igrave ; B -13 0 188 929 ;
-C -1 ; WX 278 ; N Imacron ; B -17 0 296 879 ;
-C -1 ; WX 556 ; N Lcaron ; B 76 0 537 718 ;
-C -1 ; WX 834 ; N onehalf ; B 43 -19 773 703 ;
-C -1 ; WX 549 ; N lessequal ; B 26 0 523 674 ;
-C -1 ; WX 556 ; N ocircumflex ; B 35 -14 521 734 ;
-C -1 ; WX 556 ; N ntilde ; B 65 0 491 722 ;
-C -1 ; WX 722 ; N Uhungarumlaut ; B 79 -19 644 929 ;
-C -1 ; WX 667 ; N Eacute ; B 86 0 616 929 ;
-C -1 ; WX 556 ; N emacron ; B 40 -15 516 684 ;
-C -1 ; WX 556 ; N gbreve ; B 40 -220 499 731 ;
-C -1 ; WX 834 ; N onequarter ; B 73 -19 756 703 ;
-C -1 ; WX 667 ; N Scaron ; B 49 -19 620 929 ;
-C -1 ; WX 667 ; N Scommaaccent ; B 49 -225 620 737 ;
-C -1 ; WX 778 ; N Ohungarumlaut ; B 39 -19 739 929 ;
-C -1 ; WX 400 ; N degree ; B 54 411 346 703 ;
-C -1 ; WX 556 ; N ograve ; B 35 -14 521 734 ;
-C -1 ; WX 722 ; N Ccaron ; B 44 -19 681 929 ;
-C -1 ; WX 556 ; N ugrave ; B 68 -15 489 734 ;
-C -1 ; WX 453 ; N radical ; B -4 -80 458 762 ;
-C -1 ; WX 722 ; N Dcaron ; B 81 0 674 929 ;
-C -1 ; WX 333 ; N rcommaaccent ; B 77 -225 332 538 ;
-C -1 ; WX 722 ; N Ntilde ; B 76 0 646 917 ;
-C -1 ; WX 556 ; N otilde ; B 35 -14 521 722 ;
-C -1 ; WX 722 ; N Rcommaaccent ; B 88 -225 684 718 ;
-C -1 ; WX 556 ; N Lcommaaccent ; B 76 -225 537 718 ;
-C -1 ; WX 667 ; N Atilde ; B 14 0 654 917 ;
-C -1 ; WX 667 ; N Aogonek ; B 14 -225 654 718 ;
-C -1 ; WX 667 ; N Aring ; B 14 0 654 931 ;
-C -1 ; WX 778 ; N Otilde ; B 39 -19 739 917 ;
-C -1 ; WX 500 ; N zdotaccent ; B 31 0 469 706 ;
-C -1 ; WX 667 ; N Ecaron ; B 86 0 616 929 ;
-C -1 ; WX 278 ; N Iogonek ; B -3 -225 211 718 ;
-C -1 ; WX 500 ; N kcommaaccent ; B 67 -225 501 718 ;
-C -1 ; WX 584 ; N minus ; B 39 216 545 289 ;
-C -1 ; WX 278 ; N Icircumflex ; B -6 0 285 929 ;
-C -1 ; WX 556 ; N ncaron ; B 65 0 491 734 ;
-C -1 ; WX 278 ; N tcommaaccent ; B 14 -225 257 669 ;
-C -1 ; WX 584 ; N logicalnot ; B 39 108 545 390 ;
-C -1 ; WX 556 ; N odieresis ; B 35 -14 521 706 ;
-C -1 ; WX 556 ; N udieresis ; B 68 -15 489 706 ;
-C -1 ; WX 549 ; N notequal ; B 12 -35 537 551 ;
-C -1 ; WX 556 ; N gcommaaccent ; B 40 -220 499 822 ;
-C -1 ; WX 556 ; N eth ; B 35 -15 522 737 ;
-C -1 ; WX 500 ; N zcaron ; B 31 0 469 734 ;
-C -1 ; WX 556 ; N ncommaaccent ; B 65 -225 491 538 ;
-C -1 ; WX 333 ; N onesuperior ; B 43 281 222 703 ;
-C -1 ; WX 278 ; N imacron ; B 5 0 272 684 ;
-C -1 ; WX 556 ; N Euro ; B 0 0 0 0 ;
-EndCharMetrics
-StartKernData
-StartKernPairs 2705
-KPX A C -30
-KPX A Cacute -30
-KPX A Ccaron -30
-KPX A Ccedilla -30
-KPX A G -30
-KPX A Gbreve -30
-KPX A Gcommaaccent -30
-KPX A O -30
-KPX A Oacute -30
-KPX A Ocircumflex -30
-KPX A Odieresis -30
-KPX A Ograve -30
-KPX A Ohungarumlaut -30
-KPX A Omacron -30
-KPX A Oslash -30
-KPX A Otilde -30
-KPX A Q -30
-KPX A T -120
-KPX A Tcaron -120
-KPX A Tcommaaccent -120
-KPX A U -50
-KPX A Uacute -50
-KPX A Ucircumflex -50
-KPX A Udieresis -50
-KPX A Ugrave -50
-KPX A Uhungarumlaut -50
-KPX A Umacron -50
-KPX A Uogonek -50
-KPX A Uring -50
-KPX A V -70
-KPX A W -50
-KPX A Y -100
-KPX A Yacute -100
-KPX A Ydieresis -100
-KPX A u -30
-KPX A uacute -30
-KPX A ucircumflex -30
-KPX A udieresis -30
-KPX A ugrave -30
-KPX A uhungarumlaut -30
-KPX A umacron -30
-KPX A uogonek -30
-KPX A uring -30
-KPX A v -40
-KPX A w -40
-KPX A y -40
-KPX A yacute -40
-KPX A ydieresis -40
-KPX Aacute C -30
-KPX Aacute Cacute -30
-KPX Aacute Ccaron -30
-KPX Aacute Ccedilla -30
-KPX Aacute G -30
-KPX Aacute Gbreve -30
-KPX Aacute Gcommaaccent -30
-KPX Aacute O -30
-KPX Aacute Oacute -30
-KPX Aacute Ocircumflex -30
-KPX Aacute Odieresis -30
-KPX Aacute Ograve -30
-KPX Aacute Ohungarumlaut -30
-KPX Aacute Omacron -30
-KPX Aacute Oslash -30
-KPX Aacute Otilde -30
-KPX Aacute Q -30
-KPX Aacute T -120
-KPX Aacute Tcaron -120
-KPX Aacute Tcommaaccent -120
-KPX Aacute U -50
-KPX Aacute Uacute -50
-KPX Aacute Ucircumflex -50
-KPX Aacute Udieresis -50
-KPX Aacute Ugrave -50
-KPX Aacute Uhungarumlaut -50
-KPX Aacute Umacron -50
-KPX Aacute Uogonek -50
-KPX Aacute Uring -50
-KPX Aacute V -70
-KPX Aacute W -50
-KPX Aacute Y -100
-KPX Aacute Yacute -100
-KPX Aacute Ydieresis -100
-KPX Aacute u -30
-KPX Aacute uacute -30
-KPX Aacute ucircumflex -30
-KPX Aacute udieresis -30
-KPX Aacute ugrave -30
-KPX Aacute uhungarumlaut -30
-KPX Aacute umacron -30
-KPX Aacute uogonek -30
-KPX Aacute uring -30
-KPX Aacute v -40
-KPX Aacute w -40
-KPX Aacute y -40
-KPX Aacute yacute -40
-KPX Aacute ydieresis -40
-KPX Abreve C -30
-KPX Abreve Cacute -30
-KPX Abreve Ccaron -30
-KPX Abreve Ccedilla -30
-KPX Abreve G -30
-KPX Abreve Gbreve -30
-KPX Abreve Gcommaaccent -30
-KPX Abreve O -30
-KPX Abreve Oacute -30
-KPX Abreve Ocircumflex -30
-KPX Abreve Odieresis -30
-KPX Abreve Ograve -30
-KPX Abreve Ohungarumlaut -30
-KPX Abreve Omacron -30
-KPX Abreve Oslash -30
-KPX Abreve Otilde -30
-KPX Abreve Q -30
-KPX Abreve T -120
-KPX Abreve Tcaron -120
-KPX Abreve Tcommaaccent -120
-KPX Abreve U -50
-KPX Abreve Uacute -50
-KPX Abreve Ucircumflex -50
-KPX Abreve Udieresis -50
-KPX Abreve Ugrave -50
-KPX Abreve Uhungarumlaut -50
-KPX Abreve Umacron -50
-KPX Abreve Uogonek -50
-KPX Abreve Uring -50
-KPX Abreve V -70
-KPX Abreve W -50
-KPX Abreve Y -100
-KPX Abreve Yacute -100
-KPX Abreve Ydieresis -100
-KPX Abreve u -30
-KPX Abreve uacute -30
-KPX Abreve ucircumflex -30
-KPX Abreve udieresis -30
-KPX Abreve ugrave -30
-KPX Abreve uhungarumlaut -30
-KPX Abreve umacron -30
-KPX Abreve uogonek -30
-KPX Abreve uring -30
-KPX Abreve v -40
-KPX Abreve w -40
-KPX Abreve y -40
-KPX Abreve yacute -40
-KPX Abreve ydieresis -40
-KPX Acircumflex C -30
-KPX Acircumflex Cacute -30
-KPX Acircumflex Ccaron -30
-KPX Acircumflex Ccedilla -30
-KPX Acircumflex G -30
-KPX Acircumflex Gbreve -30
-KPX Acircumflex Gcommaaccent -30
-KPX Acircumflex O -30
-KPX Acircumflex Oacute -30
-KPX Acircumflex Ocircumflex -30
-KPX Acircumflex Odieresis -30
-KPX Acircumflex Ograve -30
-KPX Acircumflex Ohungarumlaut -30
-KPX Acircumflex Omacron -30
-KPX Acircumflex Oslash -30
-KPX Acircumflex Otilde -30
-KPX Acircumflex Q -30
-KPX Acircumflex T -120
-KPX Acircumflex Tcaron -120
-KPX Acircumflex Tcommaaccent -120
-KPX Acircumflex U -50
-KPX Acircumflex Uacute -50
-KPX Acircumflex Ucircumflex -50
-KPX Acircumflex Udieresis -50
-KPX Acircumflex Ugrave -50
-KPX Acircumflex Uhungarumlaut -50
-KPX Acircumflex Umacron -50
-KPX Acircumflex Uogonek -50
-KPX Acircumflex Uring -50
-KPX Acircumflex V -70
-KPX Acircumflex W -50
-KPX Acircumflex Y -100
-KPX Acircumflex Yacute -100
-KPX Acircumflex Ydieresis -100
-KPX Acircumflex u -30
-KPX Acircumflex uacute -30
-KPX Acircumflex ucircumflex -30
-KPX Acircumflex udieresis -30
-KPX Acircumflex ugrave -30
-KPX Acircumflex uhungarumlaut -30
-KPX Acircumflex umacron -30
-KPX Acircumflex uogonek -30
-KPX Acircumflex uring -30
-KPX Acircumflex v -40
-KPX Acircumflex w -40
-KPX Acircumflex y -40
-KPX Acircumflex yacute -40
-KPX Acircumflex ydieresis -40
-KPX Adieresis C -30
-KPX Adieresis Cacute -30
-KPX Adieresis Ccaron -30
-KPX Adieresis Ccedilla -30
-KPX Adieresis G -30
-KPX Adieresis Gbreve -30
-KPX Adieresis Gcommaaccent -30
-KPX Adieresis O -30
-KPX Adieresis Oacute -30
-KPX Adieresis Ocircumflex -30
-KPX Adieresis Odieresis -30
-KPX Adieresis Ograve -30
-KPX Adieresis Ohungarumlaut -30
-KPX Adieresis Omacron -30
-KPX Adieresis Oslash -30
-KPX Adieresis Otilde -30
-KPX Adieresis Q -30
-KPX Adieresis T -120
-KPX Adieresis Tcaron -120
-KPX Adieresis Tcommaaccent -120
-KPX Adieresis U -50
-KPX Adieresis Uacute -50
-KPX Adieresis Ucircumflex -50
-KPX Adieresis Udieresis -50
-KPX Adieresis Ugrave -50
-KPX Adieresis Uhungarumlaut -50
-KPX Adieresis Umacron -50
-KPX Adieresis Uogonek -50
-KPX Adieresis Uring -50
-KPX Adieresis V -70
-KPX Adieresis W -50
-KPX Adieresis Y -100
-KPX Adieresis Yacute -100
-KPX Adieresis Ydieresis -100
-KPX Adieresis u -30
-KPX Adieresis uacute -30
-KPX Adieresis ucircumflex -30
-KPX Adieresis udieresis -30
-KPX Adieresis ugrave -30
-KPX Adieresis uhungarumlaut -30
-KPX Adieresis umacron -30
-KPX Adieresis uogonek -30
-KPX Adieresis uring -30
-KPX Adieresis v -40
-KPX Adieresis w -40
-KPX Adieresis y -40
-KPX Adieresis yacute -40
-KPX Adieresis ydieresis -40
-KPX Agrave C -30
-KPX Agrave Cacute -30
-KPX Agrave Ccaron -30
-KPX Agrave Ccedilla -30
-KPX Agrave G -30
-KPX Agrave Gbreve -30
-KPX Agrave Gcommaaccent -30
-KPX Agrave O -30
-KPX Agrave Oacute -30
-KPX Agrave Ocircumflex -30
-KPX Agrave Odieresis -30
-KPX Agrave Ograve -30
-KPX Agrave Ohungarumlaut -30
-KPX Agrave Omacron -30
-KPX Agrave Oslash -30
-KPX Agrave Otilde -30
-KPX Agrave Q -30
-KPX Agrave T -120
-KPX Agrave Tcaron -120
-KPX Agrave Tcommaaccent -120
-KPX Agrave U -50
-KPX Agrave Uacute -50
-KPX Agrave Ucircumflex -50
-KPX Agrave Udieresis -50
-KPX Agrave Ugrave -50
-KPX Agrave Uhungarumlaut -50
-KPX Agrave Umacron -50
-KPX Agrave Uogonek -50
-KPX Agrave Uring -50
-KPX Agrave V -70
-KPX Agrave W -50
-KPX Agrave Y -100
-KPX Agrave Yacute -100
-KPX Agrave Ydieresis -100
-KPX Agrave u -30
-KPX Agrave uacute -30
-KPX Agrave ucircumflex -30
-KPX Agrave udieresis -30
-KPX Agrave ugrave -30
-KPX Agrave uhungarumlaut -30
-KPX Agrave umacron -30
-KPX Agrave uogonek -30
-KPX Agrave uring -30
-KPX Agrave v -40
-KPX Agrave w -40
-KPX Agrave y -40
-KPX Agrave yacute -40
-KPX Agrave ydieresis -40
-KPX Amacron C -30
-KPX Amacron Cacute -30
-KPX Amacron Ccaron -30
-KPX Amacron Ccedilla -30
-KPX Amacron G -30
-KPX Amacron Gbreve -30
-KPX Amacron Gcommaaccent -30
-KPX Amacron O -30
-KPX Amacron Oacute -30
-KPX Amacron Ocircumflex -30
-KPX Amacron Odieresis -30
-KPX Amacron Ograve -30
-KPX Amacron Ohungarumlaut -30
-KPX Amacron Omacron -30
-KPX Amacron Oslash -30
-KPX Amacron Otilde -30
-KPX Amacron Q -30
-KPX Amacron T -120
-KPX Amacron Tcaron -120
-KPX Amacron Tcommaaccent -120
-KPX Amacron U -50
-KPX Amacron Uacute -50
-KPX Amacron Ucircumflex -50
-KPX Amacron Udieresis -50
-KPX Amacron Ugrave -50
-KPX Amacron Uhungarumlaut -50
-KPX Amacron Umacron -50
-KPX Amacron Uogonek -50
-KPX Amacron Uring -50
-KPX Amacron V -70
-KPX Amacron W -50
-KPX Amacron Y -100
-KPX Amacron Yacute -100
-KPX Amacron Ydieresis -100
-KPX Amacron u -30
-KPX Amacron uacute -30
-KPX Amacron ucircumflex -30
-KPX Amacron udieresis -30
-KPX Amacron ugrave -30
-KPX Amacron uhungarumlaut -30
-KPX Amacron umacron -30
-KPX Amacron uogonek -30
-KPX Amacron uring -30
-KPX Amacron v -40
-KPX Amacron w -40
-KPX Amacron y -40
-KPX Amacron yacute -40
-KPX Amacron ydieresis -40
-KPX Aogonek C -30
-KPX Aogonek Cacute -30
-KPX Aogonek Ccaron -30
-KPX Aogonek Ccedilla -30
-KPX Aogonek G -30
-KPX Aogonek Gbreve -30
-KPX Aogonek Gcommaaccent -30
-KPX Aogonek O -30
-KPX Aogonek Oacute -30
-KPX Aogonek Ocircumflex -30
-KPX Aogonek Odieresis -30
-KPX Aogonek Ograve -30
-KPX Aogonek Ohungarumlaut -30
-KPX Aogonek Omacron -30
-KPX Aogonek Oslash -30
-KPX Aogonek Otilde -30
-KPX Aogonek Q -30
-KPX Aogonek T -120
-KPX Aogonek Tcaron -120
-KPX Aogonek Tcommaaccent -120
-KPX Aogonek U -50
-KPX Aogonek Uacute -50
-KPX Aogonek Ucircumflex -50
-KPX Aogonek Udieresis -50
-KPX Aogonek Ugrave -50
-KPX Aogonek Uhungarumlaut -50
-KPX Aogonek Umacron -50
-KPX Aogonek Uogonek -50
-KPX Aogonek Uring -50
-KPX Aogonek V -70
-KPX Aogonek W -50
-KPX Aogonek Y -100
-KPX Aogonek Yacute -100
-KPX Aogonek Ydieresis -100
-KPX Aogonek u -30
-KPX Aogonek uacute -30
-KPX Aogonek ucircumflex -30
-KPX Aogonek udieresis -30
-KPX Aogonek ugrave -30
-KPX Aogonek uhungarumlaut -30
-KPX Aogonek umacron -30
-KPX Aogonek uogonek -30
-KPX Aogonek uring -30
-KPX Aogonek v -40
-KPX Aogonek w -40
-KPX Aogonek y -40
-KPX Aogonek yacute -40
-KPX Aogonek ydieresis -40
-KPX Aring C -30
-KPX Aring Cacute -30
-KPX Aring Ccaron -30
-KPX Aring Ccedilla -30
-KPX Aring G -30
-KPX Aring Gbreve -30
-KPX Aring Gcommaaccent -30
-KPX Aring O -30
-KPX Aring Oacute -30
-KPX Aring Ocircumflex -30
-KPX Aring Odieresis -30
-KPX Aring Ograve -30
-KPX Aring Ohungarumlaut -30
-KPX Aring Omacron -30
-KPX Aring Oslash -30
-KPX Aring Otilde -30
-KPX Aring Q -30
-KPX Aring T -120
-KPX Aring Tcaron -120
-KPX Aring Tcommaaccent -120
-KPX Aring U -50
-KPX Aring Uacute -50
-KPX Aring Ucircumflex -50
-KPX Aring Udieresis -50
-KPX Aring Ugrave -50
-KPX Aring Uhungarumlaut -50
-KPX Aring Umacron -50
-KPX Aring Uogonek -50
-KPX Aring Uring -50
-KPX Aring V -70
-KPX Aring W -50
-KPX Aring Y -100
-KPX Aring Yacute -100
-KPX Aring Ydieresis -100
-KPX Aring u -30
-KPX Aring uacute -30
-KPX Aring ucircumflex -30
-KPX Aring udieresis -30
-KPX Aring ugrave -30
-KPX Aring uhungarumlaut -30
-KPX Aring umacron -30
-KPX Aring uogonek -30
-KPX Aring uring -30
-KPX Aring v -40
-KPX Aring w -40
-KPX Aring y -40
-KPX Aring yacute -40
-KPX Aring ydieresis -40
-KPX Atilde C -30
-KPX Atilde Cacute -30
-KPX Atilde Ccaron -30
-KPX Atilde Ccedilla -30
-KPX Atilde G -30
-KPX Atilde Gbreve -30
-KPX Atilde Gcommaaccent -30
-KPX Atilde O -30
-KPX Atilde Oacute -30
-KPX Atilde Ocircumflex -30
-KPX Atilde Odieresis -30
-KPX Atilde Ograve -30
-KPX Atilde Ohungarumlaut -30
-KPX Atilde Omacron -30
-KPX Atilde Oslash -30
-KPX Atilde Otilde -30
-KPX Atilde Q -30
-KPX Atilde T -120
-KPX Atilde Tcaron -120
-KPX Atilde Tcommaaccent -120
-KPX Atilde U -50
-KPX Atilde Uacute -50
-KPX Atilde Ucircumflex -50
-KPX Atilde Udieresis -50
-KPX Atilde Ugrave -50
-KPX Atilde Uhungarumlaut -50
-KPX Atilde Umacron -50
-KPX Atilde Uogonek -50
-KPX Atilde Uring -50
-KPX Atilde V -70
-KPX Atilde W -50
-KPX Atilde Y -100
-KPX Atilde Yacute -100
-KPX Atilde Ydieresis -100
-KPX Atilde u -30
-KPX Atilde uacute -30
-KPX Atilde ucircumflex -30
-KPX Atilde udieresis -30
-KPX Atilde ugrave -30
-KPX Atilde uhungarumlaut -30
-KPX Atilde umacron -30
-KPX Atilde uogonek -30
-KPX Atilde uring -30
-KPX Atilde v -40
-KPX Atilde w -40
-KPX Atilde y -40
-KPX Atilde yacute -40
-KPX Atilde ydieresis -40
-KPX B U -10
-KPX B Uacute -10
-KPX B Ucircumflex -10
-KPX B Udieresis -10
-KPX B Ugrave -10
-KPX B Uhungarumlaut -10
-KPX B Umacron -10
-KPX B Uogonek -10
-KPX B Uring -10
-KPX B comma -20
-KPX B period -20
-KPX C comma -30
-KPX C period -30
-KPX Cacute comma -30
-KPX Cacute period -30
-KPX Ccaron comma -30
-KPX Ccaron period -30
-KPX Ccedilla comma -30
-KPX Ccedilla period -30
-KPX D A -40
-KPX D Aacute -40
-KPX D Abreve -40
-KPX D Acircumflex -40
-KPX D Adieresis -40
-KPX D Agrave -40
-KPX D Amacron -40
-KPX D Aogonek -40
-KPX D Aring -40
-KPX D Atilde -40
-KPX D V -70
-KPX D W -40
-KPX D Y -90
-KPX D Yacute -90
-KPX D Ydieresis -90
-KPX D comma -70
-KPX D period -70
-KPX Dcaron A -40
-KPX Dcaron Aacute -40
-KPX Dcaron Abreve -40
-KPX Dcaron Acircumflex -40
-KPX Dcaron Adieresis -40
-KPX Dcaron Agrave -40
-KPX Dcaron Amacron -40
-KPX Dcaron Aogonek -40
-KPX Dcaron Aring -40
-KPX Dcaron Atilde -40
-KPX Dcaron V -70
-KPX Dcaron W -40
-KPX Dcaron Y -90
-KPX Dcaron Yacute -90
-KPX Dcaron Ydieresis -90
-KPX Dcaron comma -70
-KPX Dcaron period -70
-KPX Dcroat A -40
-KPX Dcroat Aacute -40
-KPX Dcroat Abreve -40
-KPX Dcroat Acircumflex -40
-KPX Dcroat Adieresis -40
-KPX Dcroat Agrave -40
-KPX Dcroat Amacron -40
-KPX Dcroat Aogonek -40
-KPX Dcroat Aring -40
-KPX Dcroat Atilde -40
-KPX Dcroat V -70
-KPX Dcroat W -40
-KPX Dcroat Y -90
-KPX Dcroat Yacute -90
-KPX Dcroat Ydieresis -90
-KPX Dcroat comma -70
-KPX Dcroat period -70
-KPX F A -80
-KPX F Aacute -80
-KPX F Abreve -80
-KPX F Acircumflex -80
-KPX F Adieresis -80
-KPX F Agrave -80
-KPX F Amacron -80
-KPX F Aogonek -80
-KPX F Aring -80
-KPX F Atilde -80
-KPX F a -50
-KPX F aacute -50
-KPX F abreve -50
-KPX F acircumflex -50
-KPX F adieresis -50
-KPX F agrave -50
-KPX F amacron -50
-KPX F aogonek -50
-KPX F aring -50
-KPX F atilde -50
-KPX F comma -150
-KPX F e -30
-KPX F eacute -30
-KPX F ecaron -30
-KPX F ecircumflex -30
-KPX F edieresis -30
-KPX F edotaccent -30
-KPX F egrave -30
-KPX F emacron -30
-KPX F eogonek -30
-KPX F o -30
-KPX F oacute -30
-KPX F ocircumflex -30
-KPX F odieresis -30
-KPX F ograve -30
-KPX F ohungarumlaut -30
-KPX F omacron -30
-KPX F oslash -30
-KPX F otilde -30
-KPX F period -150
-KPX F r -45
-KPX F racute -45
-KPX F rcaron -45
-KPX F rcommaaccent -45
-KPX J A -20
-KPX J Aacute -20
-KPX J Abreve -20
-KPX J Acircumflex -20
-KPX J Adieresis -20
-KPX J Agrave -20
-KPX J Amacron -20
-KPX J Aogonek -20
-KPX J Aring -20
-KPX J Atilde -20
-KPX J a -20
-KPX J aacute -20
-KPX J abreve -20
-KPX J acircumflex -20
-KPX J adieresis -20
-KPX J agrave -20
-KPX J amacron -20
-KPX J aogonek -20
-KPX J aring -20
-KPX J atilde -20
-KPX J comma -30
-KPX J period -30
-KPX J u -20
-KPX J uacute -20
-KPX J ucircumflex -20
-KPX J udieresis -20
-KPX J ugrave -20
-KPX J uhungarumlaut -20
-KPX J umacron -20
-KPX J uogonek -20
-KPX J uring -20
-KPX K O -50
-KPX K Oacute -50
-KPX K Ocircumflex -50
-KPX K Odieresis -50
-KPX K Ograve -50
-KPX K Ohungarumlaut -50
-KPX K Omacron -50
-KPX K Oslash -50
-KPX K Otilde -50
-KPX K e -40
-KPX K eacute -40
-KPX K ecaron -40
-KPX K ecircumflex -40
-KPX K edieresis -40
-KPX K edotaccent -40
-KPX K egrave -40
-KPX K emacron -40
-KPX K eogonek -40
-KPX K o -40
-KPX K oacute -40
-KPX K ocircumflex -40
-KPX K odieresis -40
-KPX K ograve -40
-KPX K ohungarumlaut -40
-KPX K omacron -40
-KPX K oslash -40
-KPX K otilde -40
-KPX K u -30
-KPX K uacute -30
-KPX K ucircumflex -30
-KPX K udieresis -30
-KPX K ugrave -30
-KPX K uhungarumlaut -30
-KPX K umacron -30
-KPX K uogonek -30
-KPX K uring -30
-KPX K y -50
-KPX K yacute -50
-KPX K ydieresis -50
-KPX Kcommaaccent O -50
-KPX Kcommaaccent Oacute -50
-KPX Kcommaaccent Ocircumflex -50
-KPX Kcommaaccent Odieresis -50
-KPX Kcommaaccent Ograve -50
-KPX Kcommaaccent Ohungarumlaut -50
-KPX Kcommaaccent Omacron -50
-KPX Kcommaaccent Oslash -50
-KPX Kcommaaccent Otilde -50
-KPX Kcommaaccent e -40
-KPX Kcommaaccent eacute -40
-KPX Kcommaaccent ecaron -40
-KPX Kcommaaccent ecircumflex -40
-KPX Kcommaaccent edieresis -40
-KPX Kcommaaccent edotaccent -40
-KPX Kcommaaccent egrave -40
-KPX Kcommaaccent emacron -40
-KPX Kcommaaccent eogonek -40
-KPX Kcommaaccent o -40
-KPX Kcommaaccent oacute -40
-KPX Kcommaaccent ocircumflex -40
-KPX Kcommaaccent odieresis -40
-KPX Kcommaaccent ograve -40
-KPX Kcommaaccent ohungarumlaut -40
-KPX Kcommaaccent omacron -40
-KPX Kcommaaccent oslash -40
-KPX Kcommaaccent otilde -40
-KPX Kcommaaccent u -30
-KPX Kcommaaccent uacute -30
-KPX Kcommaaccent ucircumflex -30
-KPX Kcommaaccent udieresis -30
-KPX Kcommaaccent ugrave -30
-KPX Kcommaaccent uhungarumlaut -30
-KPX Kcommaaccent umacron -30
-KPX Kcommaaccent uogonek -30
-KPX Kcommaaccent uring -30
-KPX Kcommaaccent y -50
-KPX Kcommaaccent yacute -50
-KPX Kcommaaccent ydieresis -50
-KPX L T -110
-KPX L Tcaron -110
-KPX L Tcommaaccent -110
-KPX L V -110
-KPX L W -70
-KPX L Y -140
-KPX L Yacute -140
-KPX L Ydieresis -140
-KPX L quotedblright -140
-KPX L quoteright -160
-KPX L y -30
-KPX L yacute -30
-KPX L ydieresis -30
-KPX Lacute T -110
-KPX Lacute Tcaron -110
-KPX Lacute Tcommaaccent -110
-KPX Lacute V -110
-KPX Lacute W -70
-KPX Lacute Y -140
-KPX Lacute Yacute -140
-KPX Lacute Ydieresis -140
-KPX Lacute quotedblright -140
-KPX Lacute quoteright -160
-KPX Lacute y -30
-KPX Lacute yacute -30
-KPX Lacute ydieresis -30
-KPX Lcaron T -110
-KPX Lcaron Tcaron -110
-KPX Lcaron Tcommaaccent -110
-KPX Lcaron V -110
-KPX Lcaron W -70
-KPX Lcaron Y -140
-KPX Lcaron Yacute -140
-KPX Lcaron Ydieresis -140
-KPX Lcaron quotedblright -140
-KPX Lcaron quoteright -160
-KPX Lcaron y -30
-KPX Lcaron yacute -30
-KPX Lcaron ydieresis -30
-KPX Lcommaaccent T -110
-KPX Lcommaaccent Tcaron -110
-KPX Lcommaaccent Tcommaaccent -110
-KPX Lcommaaccent V -110
-KPX Lcommaaccent W -70
-KPX Lcommaaccent Y -140
-KPX Lcommaaccent Yacute -140
-KPX Lcommaaccent Ydieresis -140
-KPX Lcommaaccent quotedblright -140
-KPX Lcommaaccent quoteright -160
-KPX Lcommaaccent y -30
-KPX Lcommaaccent yacute -30
-KPX Lcommaaccent ydieresis -30
-KPX Lslash T -110
-KPX Lslash Tcaron -110
-KPX Lslash Tcommaaccent -110
-KPX Lslash V -110
-KPX Lslash W -70
-KPX Lslash Y -140
-KPX Lslash Yacute -140
-KPX Lslash Ydieresis -140
-KPX Lslash quotedblright -140
-KPX Lslash quoteright -160
-KPX Lslash y -30
-KPX Lslash yacute -30
-KPX Lslash ydieresis -30
-KPX O A -20
-KPX O Aacute -20
-KPX O Abreve -20
-KPX O Acircumflex -20
-KPX O Adieresis -20
-KPX O Agrave -20
-KPX O Amacron -20
-KPX O Aogonek -20
-KPX O Aring -20
-KPX O Atilde -20
-KPX O T -40
-KPX O Tcaron -40
-KPX O Tcommaaccent -40
-KPX O V -50
-KPX O W -30
-KPX O X -60
-KPX O Y -70
-KPX O Yacute -70
-KPX O Ydieresis -70
-KPX O comma -40
-KPX O period -40
-KPX Oacute A -20
-KPX Oacute Aacute -20
-KPX Oacute Abreve -20
-KPX Oacute Acircumflex -20
-KPX Oacute Adieresis -20
-KPX Oacute Agrave -20
-KPX Oacute Amacron -20
-KPX Oacute Aogonek -20
-KPX Oacute Aring -20
-KPX Oacute Atilde -20
-KPX Oacute T -40
-KPX Oacute Tcaron -40
-KPX Oacute Tcommaaccent -40
-KPX Oacute V -50
-KPX Oacute W -30
-KPX Oacute X -60
-KPX Oacute Y -70
-KPX Oacute Yacute -70
-KPX Oacute Ydieresis -70
-KPX Oacute comma -40
-KPX Oacute period -40
-KPX Ocircumflex A -20
-KPX Ocircumflex Aacute -20
-KPX Ocircumflex Abreve -20
-KPX Ocircumflex Acircumflex -20
-KPX Ocircumflex Adieresis -20
-KPX Ocircumflex Agrave -20
-KPX Ocircumflex Amacron -20
-KPX Ocircumflex Aogonek -20
-KPX Ocircumflex Aring -20
-KPX Ocircumflex Atilde -20
-KPX Ocircumflex T -40
-KPX Ocircumflex Tcaron -40
-KPX Ocircumflex Tcommaaccent -40
-KPX Ocircumflex V -50
-KPX Ocircumflex W -30
-KPX Ocircumflex X -60
-KPX Ocircumflex Y -70
-KPX Ocircumflex Yacute -70
-KPX Ocircumflex Ydieresis -70
-KPX Ocircumflex comma -40
-KPX Ocircumflex period -40
-KPX Odieresis A -20
-KPX Odieresis Aacute -20
-KPX Odieresis Abreve -20
-KPX Odieresis Acircumflex -20
-KPX Odieresis Adieresis -20
-KPX Odieresis Agrave -20
-KPX Odieresis Amacron -20
-KPX Odieresis Aogonek -20
-KPX Odieresis Aring -20
-KPX Odieresis Atilde -20
-KPX Odieresis T -40
-KPX Odieresis Tcaron -40
-KPX Odieresis Tcommaaccent -40
-KPX Odieresis V -50
-KPX Odieresis W -30
-KPX Odieresis X -60
-KPX Odieresis Y -70
-KPX Odieresis Yacute -70
-KPX Odieresis Ydieresis -70
-KPX Odieresis comma -40
-KPX Odieresis period -40
-KPX Ograve A -20
-KPX Ograve Aacute -20
-KPX Ograve Abreve -20
-KPX Ograve Acircumflex -20
-KPX Ograve Adieresis -20
-KPX Ograve Agrave -20
-KPX Ograve Amacron -20
-KPX Ograve Aogonek -20
-KPX Ograve Aring -20
-KPX Ograve Atilde -20
-KPX Ograve T -40
-KPX Ograve Tcaron -40
-KPX Ograve Tcommaaccent -40
-KPX Ograve V -50
-KPX Ograve W -30
-KPX Ograve X -60
-KPX Ograve Y -70
-KPX Ograve Yacute -70
-KPX Ograve Ydieresis -70
-KPX Ograve comma -40
-KPX Ograve period -40
-KPX Ohungarumlaut A -20
-KPX Ohungarumlaut Aacute -20
-KPX Ohungarumlaut Abreve -20
-KPX Ohungarumlaut Acircumflex -20
-KPX Ohungarumlaut Adieresis -20
-KPX Ohungarumlaut Agrave -20
-KPX Ohungarumlaut Amacron -20
-KPX Ohungarumlaut Aogonek -20
-KPX Ohungarumlaut Aring -20
-KPX Ohungarumlaut Atilde -20
-KPX Ohungarumlaut T -40
-KPX Ohungarumlaut Tcaron -40
-KPX Ohungarumlaut Tcommaaccent -40
-KPX Ohungarumlaut V -50
-KPX Ohungarumlaut W -30
-KPX Ohungarumlaut X -60
-KPX Ohungarumlaut Y -70
-KPX Ohungarumlaut Yacute -70
-KPX Ohungarumlaut Ydieresis -70
-KPX Ohungarumlaut comma -40
-KPX Ohungarumlaut period -40
-KPX Omacron A -20
-KPX Omacron Aacute -20
-KPX Omacron Abreve -20
-KPX Omacron Acircumflex -20
-KPX Omacron Adieresis -20
-KPX Omacron Agrave -20
-KPX Omacron Amacron -20
-KPX Omacron Aogonek -20
-KPX Omacron Aring -20
-KPX Omacron Atilde -20
-KPX Omacron T -40
-KPX Omacron Tcaron -40
-KPX Omacron Tcommaaccent -40
-KPX Omacron V -50
-KPX Omacron W -30
-KPX Omacron X -60
-KPX Omacron Y -70
-KPX Omacron Yacute -70
-KPX Omacron Ydieresis -70
-KPX Omacron comma -40
-KPX Omacron period -40
-KPX Oslash A -20
-KPX Oslash Aacute -20
-KPX Oslash Abreve -20
-KPX Oslash Acircumflex -20
-KPX Oslash Adieresis -20
-KPX Oslash Agrave -20
-KPX Oslash Amacron -20
-KPX Oslash Aogonek -20
-KPX Oslash Aring -20
-KPX Oslash Atilde -20
-KPX Oslash T -40
-KPX Oslash Tcaron -40
-KPX Oslash Tcommaaccent -40
-KPX Oslash V -50
-KPX Oslash W -30
-KPX Oslash X -60
-KPX Oslash Y -70
-KPX Oslash Yacute -70
-KPX Oslash Ydieresis -70
-KPX Oslash comma -40
-KPX Oslash period -40
-KPX Otilde A -20
-KPX Otilde Aacute -20
-KPX Otilde Abreve -20
-KPX Otilde Acircumflex -20
-KPX Otilde Adieresis -20
-KPX Otilde Agrave -20
-KPX Otilde Amacron -20
-KPX Otilde Aogonek -20
-KPX Otilde Aring -20
-KPX Otilde Atilde -20
-KPX Otilde T -40
-KPX Otilde Tcaron -40
-KPX Otilde Tcommaaccent -40
-KPX Otilde V -50
-KPX Otilde W -30
-KPX Otilde X -60
-KPX Otilde Y -70
-KPX Otilde Yacute -70
-KPX Otilde Ydieresis -70
-KPX Otilde comma -40
-KPX Otilde period -40
-KPX P A -120
-KPX P Aacute -120
-KPX P Abreve -120
-KPX P Acircumflex -120
-KPX P Adieresis -120
-KPX P Agrave -120
-KPX P Amacron -120
-KPX P Aogonek -120
-KPX P Aring -120
-KPX P Atilde -120
-KPX P a -40
-KPX P aacute -40
-KPX P abreve -40
-KPX P acircumflex -40
-KPX P adieresis -40
-KPX P agrave -40
-KPX P amacron -40
-KPX P aogonek -40
-KPX P aring -40
-KPX P atilde -40
-KPX P comma -180
-KPX P e -50
-KPX P eacute -50
-KPX P ecaron -50
-KPX P ecircumflex -50
-KPX P edieresis -50
-KPX P edotaccent -50
-KPX P egrave -50
-KPX P emacron -50
-KPX P eogonek -50
-KPX P o -50
-KPX P oacute -50
-KPX P ocircumflex -50
-KPX P odieresis -50
-KPX P ograve -50
-KPX P ohungarumlaut -50
-KPX P omacron -50
-KPX P oslash -50
-KPX P otilde -50
-KPX P period -180
-KPX Q U -10
-KPX Q Uacute -10
-KPX Q Ucircumflex -10
-KPX Q Udieresis -10
-KPX Q Ugrave -10
-KPX Q Uhungarumlaut -10
-KPX Q Umacron -10
-KPX Q Uogonek -10
-KPX Q Uring -10
-KPX R O -20
-KPX R Oacute -20
-KPX R Ocircumflex -20
-KPX R Odieresis -20
-KPX R Ograve -20
-KPX R Ohungarumlaut -20
-KPX R Omacron -20
-KPX R Oslash -20
-KPX R Otilde -20
-KPX R T -30
-KPX R Tcaron -30
-KPX R Tcommaaccent -30
-KPX R U -40
-KPX R Uacute -40
-KPX R Ucircumflex -40
-KPX R Udieresis -40
-KPX R Ugrave -40
-KPX R Uhungarumlaut -40
-KPX R Umacron -40
-KPX R Uogonek -40
-KPX R Uring -40
-KPX R V -50
-KPX R W -30
-KPX R Y -50
-KPX R Yacute -50
-KPX R Ydieresis -50
-KPX Racute O -20
-KPX Racute Oacute -20
-KPX Racute Ocircumflex -20
-KPX Racute Odieresis -20
-KPX Racute Ograve -20
-KPX Racute Ohungarumlaut -20
-KPX Racute Omacron -20
-KPX Racute Oslash -20
-KPX Racute Otilde -20
-KPX Racute T -30
-KPX Racute Tcaron -30
-KPX Racute Tcommaaccent -30
-KPX Racute U -40
-KPX Racute Uacute -40
-KPX Racute Ucircumflex -40
-KPX Racute Udieresis -40
-KPX Racute Ugrave -40
-KPX Racute Uhungarumlaut -40
-KPX Racute Umacron -40
-KPX Racute Uogonek -40
-KPX Racute Uring -40
-KPX Racute V -50
-KPX Racute W -30
-KPX Racute Y -50
-KPX Racute Yacute -50
-KPX Racute Ydieresis -50
-KPX Rcaron O -20
-KPX Rcaron Oacute -20
-KPX Rcaron Ocircumflex -20
-KPX Rcaron Odieresis -20
-KPX Rcaron Ograve -20
-KPX Rcaron Ohungarumlaut -20
-KPX Rcaron Omacron -20
-KPX Rcaron Oslash -20
-KPX Rcaron Otilde -20
-KPX Rcaron T -30
-KPX Rcaron Tcaron -30
-KPX Rcaron Tcommaaccent -30
-KPX Rcaron U -40
-KPX Rcaron Uacute -40
-KPX Rcaron Ucircumflex -40
-KPX Rcaron Udieresis -40
-KPX Rcaron Ugrave -40
-KPX Rcaron Uhungarumlaut -40
-KPX Rcaron Umacron -40
-KPX Rcaron Uogonek -40
-KPX Rcaron Uring -40
-KPX Rcaron V -50
-KPX Rcaron W -30
-KPX Rcaron Y -50
-KPX Rcaron Yacute -50
-KPX Rcaron Ydieresis -50
-KPX Rcommaaccent O -20
-KPX Rcommaaccent Oacute -20
-KPX Rcommaaccent Ocircumflex -20
-KPX Rcommaaccent Odieresis -20
-KPX Rcommaaccent Ograve -20
-KPX Rcommaaccent Ohungarumlaut -20
-KPX Rcommaaccent Omacron -20
-KPX Rcommaaccent Oslash -20
-KPX Rcommaaccent Otilde -20
-KPX Rcommaaccent T -30
-KPX Rcommaaccent Tcaron -30
-KPX Rcommaaccent Tcommaaccent -30
-KPX Rcommaaccent U -40
-KPX Rcommaaccent Uacute -40
-KPX Rcommaaccent Ucircumflex -40
-KPX Rcommaaccent Udieresis -40
-KPX Rcommaaccent Ugrave -40
-KPX Rcommaaccent Uhungarumlaut -40
-KPX Rcommaaccent Umacron -40
-KPX Rcommaaccent Uogonek -40
-KPX Rcommaaccent Uring -40
-KPX Rcommaaccent V -50
-KPX Rcommaaccent W -30
-KPX Rcommaaccent Y -50
-KPX Rcommaaccent Yacute -50
-KPX Rcommaaccent Ydieresis -50
-KPX S comma -20
-KPX S period -20
-KPX Sacute comma -20
-KPX Sacute period -20
-KPX Scaron comma -20
-KPX Scaron period -20
-KPX Scedilla comma -20
-KPX Scedilla period -20
-KPX Scommaaccent comma -20
-KPX Scommaaccent period -20
-KPX T A -120
-KPX T Aacute -120
-KPX T Abreve -120
-KPX T Acircumflex -120
-KPX T Adieresis -120
-KPX T Agrave -120
-KPX T Amacron -120
-KPX T Aogonek -120
-KPX T Aring -120
-KPX T Atilde -120
-KPX T O -40
-KPX T Oacute -40
-KPX T Ocircumflex -40
-KPX T Odieresis -40
-KPX T Ograve -40
-KPX T Ohungarumlaut -40
-KPX T Omacron -40
-KPX T Oslash -40
-KPX T Otilde -40
-KPX T a -120
-KPX T aacute -120
-KPX T abreve -60
-KPX T acircumflex -120
-KPX T adieresis -120
-KPX T agrave -120
-KPX T amacron -60
-KPX T aogonek -120
-KPX T aring -120
-KPX T atilde -60
-KPX T colon -20
-KPX T comma -120
-KPX T e -120
-KPX T eacute -120
-KPX T ecaron -120
-KPX T ecircumflex -120
-KPX T edieresis -120
-KPX T edotaccent -120
-KPX T egrave -60
-KPX T emacron -60
-KPX T eogonek -120
-KPX T hyphen -140
-KPX T o -120
-KPX T oacute -120
-KPX T ocircumflex -120
-KPX T odieresis -120
-KPX T ograve -120
-KPX T ohungarumlaut -120
-KPX T omacron -60
-KPX T oslash -120
-KPX T otilde -60
-KPX T period -120
-KPX T r -120
-KPX T racute -120
-KPX T rcaron -120
-KPX T rcommaaccent -120
-KPX T semicolon -20
-KPX T u -120
-KPX T uacute -120
-KPX T ucircumflex -120
-KPX T udieresis -120
-KPX T ugrave -120
-KPX T uhungarumlaut -120
-KPX T umacron -60
-KPX T uogonek -120
-KPX T uring -120
-KPX T w -120
-KPX T y -120
-KPX T yacute -120
-KPX T ydieresis -60
-KPX Tcaron A -120
-KPX Tcaron Aacute -120
-KPX Tcaron Abreve -120
-KPX Tcaron Acircumflex -120
-KPX Tcaron Adieresis -120
-KPX Tcaron Agrave -120
-KPX Tcaron Amacron -120
-KPX Tcaron Aogonek -120
-KPX Tcaron Aring -120
-KPX Tcaron Atilde -120
-KPX Tcaron O -40
-KPX Tcaron Oacute -40
-KPX Tcaron Ocircumflex -40
-KPX Tcaron Odieresis -40
-KPX Tcaron Ograve -40
-KPX Tcaron Ohungarumlaut -40
-KPX Tcaron Omacron -40
-KPX Tcaron Oslash -40
-KPX Tcaron Otilde -40
-KPX Tcaron a -120
-KPX Tcaron aacute -120
-KPX Tcaron abreve -60
-KPX Tcaron acircumflex -120
-KPX Tcaron adieresis -120
-KPX Tcaron agrave -120
-KPX Tcaron amacron -60
-KPX Tcaron aogonek -120
-KPX Tcaron aring -120
-KPX Tcaron atilde -60
-KPX Tcaron colon -20
-KPX Tcaron comma -120
-KPX Tcaron e -120
-KPX Tcaron eacute -120
-KPX Tcaron ecaron -120
-KPX Tcaron ecircumflex -120
-KPX Tcaron edieresis -120
-KPX Tcaron edotaccent -120
-KPX Tcaron egrave -60
-KPX Tcaron emacron -60
-KPX Tcaron eogonek -120
-KPX Tcaron hyphen -140
-KPX Tcaron o -120
-KPX Tcaron oacute -120
-KPX Tcaron ocircumflex -120
-KPX Tcaron odieresis -120
-KPX Tcaron ograve -120
-KPX Tcaron ohungarumlaut -120
-KPX Tcaron omacron -60
-KPX Tcaron oslash -120
-KPX Tcaron otilde -60
-KPX Tcaron period -120
-KPX Tcaron r -120
-KPX Tcaron racute -120
-KPX Tcaron rcaron -120
-KPX Tcaron rcommaaccent -120
-KPX Tcaron semicolon -20
-KPX Tcaron u -120
-KPX Tcaron uacute -120
-KPX Tcaron ucircumflex -120
-KPX Tcaron udieresis -120
-KPX Tcaron ugrave -120
-KPX Tcaron uhungarumlaut -120
-KPX Tcaron umacron -60
-KPX Tcaron uogonek -120
-KPX Tcaron uring -120
-KPX Tcaron w -120
-KPX Tcaron y -120
-KPX Tcaron yacute -120
-KPX Tcaron ydieresis -60
-KPX Tcommaaccent A -120
-KPX Tcommaaccent Aacute -120
-KPX Tcommaaccent Abreve -120
-KPX Tcommaaccent Acircumflex -120
-KPX Tcommaaccent Adieresis -120
-KPX Tcommaaccent Agrave -120
-KPX Tcommaaccent Amacron -120
-KPX Tcommaaccent Aogonek -120
-KPX Tcommaaccent Aring -120
-KPX Tcommaaccent Atilde -120
-KPX Tcommaaccent O -40
-KPX Tcommaaccent Oacute -40
-KPX Tcommaaccent Ocircumflex -40
-KPX Tcommaaccent Odieresis -40
-KPX Tcommaaccent Ograve -40
-KPX Tcommaaccent Ohungarumlaut -40
-KPX Tcommaaccent Omacron -40
-KPX Tcommaaccent Oslash -40
-KPX Tcommaaccent Otilde -40
-KPX Tcommaaccent a -120
-KPX Tcommaaccent aacute -120
-KPX Tcommaaccent abreve -60
-KPX Tcommaaccent acircumflex -120
-KPX Tcommaaccent adieresis -120
-KPX Tcommaaccent agrave -120
-KPX Tcommaaccent amacron -60
-KPX Tcommaaccent aogonek -120
-KPX Tcommaaccent aring -120
-KPX Tcommaaccent atilde -60
-KPX Tcommaaccent colon -20
-KPX Tcommaaccent comma -120
-KPX Tcommaaccent e -120
-KPX Tcommaaccent eacute -120
-KPX Tcommaaccent ecaron -120
-KPX Tcommaaccent ecircumflex -120
-KPX Tcommaaccent edieresis -120
-KPX Tcommaaccent edotaccent -120
-KPX Tcommaaccent egrave -60
-KPX Tcommaaccent emacron -60
-KPX Tcommaaccent eogonek -120
-KPX Tcommaaccent hyphen -140
-KPX Tcommaaccent o -120
-KPX Tcommaaccent oacute -120
-KPX Tcommaaccent ocircumflex -120
-KPX Tcommaaccent odieresis -120
-KPX Tcommaaccent ograve -120
-KPX Tcommaaccent ohungarumlaut -120
-KPX Tcommaaccent omacron -60
-KPX Tcommaaccent oslash -120
-KPX Tcommaaccent otilde -60
-KPX Tcommaaccent period -120
-KPX Tcommaaccent r -120
-KPX Tcommaaccent racute -120
-KPX Tcommaaccent rcaron -120
-KPX Tcommaaccent rcommaaccent -120
-KPX Tcommaaccent semicolon -20
-KPX Tcommaaccent u -120
-KPX Tcommaaccent uacute -120
-KPX Tcommaaccent ucircumflex -120
-KPX Tcommaaccent udieresis -120
-KPX Tcommaaccent ugrave -120
-KPX Tcommaaccent uhungarumlaut -120
-KPX Tcommaaccent umacron -60
-KPX Tcommaaccent uogonek -120
-KPX Tcommaaccent uring -120
-KPX Tcommaaccent w -120
-KPX Tcommaaccent y -120
-KPX Tcommaaccent yacute -120
-KPX Tcommaaccent ydieresis -60
-KPX U A -40
-KPX U Aacute -40
-KPX U Abreve -40
-KPX U Acircumflex -40
-KPX U Adieresis -40
-KPX U Agrave -40
-KPX U Amacron -40
-KPX U Aogonek -40
-KPX U Aring -40
-KPX U Atilde -40
-KPX U comma -40
-KPX U period -40
-KPX Uacute A -40
-KPX Uacute Aacute -40
-KPX Uacute Abreve -40
-KPX Uacute Acircumflex -40
-KPX Uacute Adieresis -40
-KPX Uacute Agrave -40
-KPX Uacute Amacron -40
-KPX Uacute Aogonek -40
-KPX Uacute Aring -40
-KPX Uacute Atilde -40
-KPX Uacute comma -40
-KPX Uacute period -40
-KPX Ucircumflex A -40
-KPX Ucircumflex Aacute -40
-KPX Ucircumflex Abreve -40
-KPX Ucircumflex Acircumflex -40
-KPX Ucircumflex Adieresis -40
-KPX Ucircumflex Agrave -40
-KPX Ucircumflex Amacron -40
-KPX Ucircumflex Aogonek -40
-KPX Ucircumflex Aring -40
-KPX Ucircumflex Atilde -40
-KPX Ucircumflex comma -40
-KPX Ucircumflex period -40
-KPX Udieresis A -40
-KPX Udieresis Aacute -40
-KPX Udieresis Abreve -40
-KPX Udieresis Acircumflex -40
-KPX Udieresis Adieresis -40
-KPX Udieresis Agrave -40
-KPX Udieresis Amacron -40
-KPX Udieresis Aogonek -40
-KPX Udieresis Aring -40
-KPX Udieresis Atilde -40
-KPX Udieresis comma -40
-KPX Udieresis period -40
-KPX Ugrave A -40
-KPX Ugrave Aacute -40
-KPX Ugrave Abreve -40
-KPX Ugrave Acircumflex -40
-KPX Ugrave Adieresis -40
-KPX Ugrave Agrave -40
-KPX Ugrave Amacron -40
-KPX Ugrave Aogonek -40
-KPX Ugrave Aring -40
-KPX Ugrave Atilde -40
-KPX Ugrave comma -40
-KPX Ugrave period -40
-KPX Uhungarumlaut A -40
-KPX Uhungarumlaut Aacute -40
-KPX Uhungarumlaut Abreve -40
-KPX Uhungarumlaut Acircumflex -40
-KPX Uhungarumlaut Adieresis -40
-KPX Uhungarumlaut Agrave -40
-KPX Uhungarumlaut Amacron -40
-KPX Uhungarumlaut Aogonek -40
-KPX Uhungarumlaut Aring -40
-KPX Uhungarumlaut Atilde -40
-KPX Uhungarumlaut comma -40
-KPX Uhungarumlaut period -40
-KPX Umacron A -40
-KPX Umacron Aacute -40
-KPX Umacron Abreve -40
-KPX Umacron Acircumflex -40
-KPX Umacron Adieresis -40
-KPX Umacron Agrave -40
-KPX Umacron Amacron -40
-KPX Umacron Aogonek -40
-KPX Umacron Aring -40
-KPX Umacron Atilde -40
-KPX Umacron comma -40
-KPX Umacron period -40
-KPX Uogonek A -40
-KPX Uogonek Aacute -40
-KPX Uogonek Abreve -40
-KPX Uogonek Acircumflex -40
-KPX Uogonek Adieresis -40
-KPX Uogonek Agrave -40
-KPX Uogonek Amacron -40
-KPX Uogonek Aogonek -40
-KPX Uogonek Aring -40
-KPX Uogonek Atilde -40
-KPX Uogonek comma -40
-KPX Uogonek period -40
-KPX Uring A -40
-KPX Uring Aacute -40
-KPX Uring Abreve -40
-KPX Uring Acircumflex -40
-KPX Uring Adieresis -40
-KPX Uring Agrave -40
-KPX Uring Amacron -40
-KPX Uring Aogonek -40
-KPX Uring Aring -40
-KPX Uring Atilde -40
-KPX Uring comma -40
-KPX Uring period -40
-KPX V A -80
-KPX V Aacute -80
-KPX V Abreve -80
-KPX V Acircumflex -80
-KPX V Adieresis -80
-KPX V Agrave -80
-KPX V Amacron -80
-KPX V Aogonek -80
-KPX V Aring -80
-KPX V Atilde -80
-KPX V G -40
-KPX V Gbreve -40
-KPX V Gcommaaccent -40
-KPX V O -40
-KPX V Oacute -40
-KPX V Ocircumflex -40
-KPX V Odieresis -40
-KPX V Ograve -40
-KPX V Ohungarumlaut -40
-KPX V Omacron -40
-KPX V Oslash -40
-KPX V Otilde -40
-KPX V a -70
-KPX V aacute -70
-KPX V abreve -70
-KPX V acircumflex -70
-KPX V adieresis -70
-KPX V agrave -70
-KPX V amacron -70
-KPX V aogonek -70
-KPX V aring -70
-KPX V atilde -70
-KPX V colon -40
-KPX V comma -125
-KPX V e -80
-KPX V eacute -80
-KPX V ecaron -80
-KPX V ecircumflex -80
-KPX V edieresis -80
-KPX V edotaccent -80
-KPX V egrave -80
-KPX V emacron -80
-KPX V eogonek -80
-KPX V hyphen -80
-KPX V o -80
-KPX V oacute -80
-KPX V ocircumflex -80
-KPX V odieresis -80
-KPX V ograve -80
-KPX V ohungarumlaut -80
-KPX V omacron -80
-KPX V oslash -80
-KPX V otilde -80
-KPX V period -125
-KPX V semicolon -40
-KPX V u -70
-KPX V uacute -70
-KPX V ucircumflex -70
-KPX V udieresis -70
-KPX V ugrave -70
-KPX V uhungarumlaut -70
-KPX V umacron -70
-KPX V uogonek -70
-KPX V uring -70
-KPX W A -50
-KPX W Aacute -50
-KPX W Abreve -50
-KPX W Acircumflex -50
-KPX W Adieresis -50
-KPX W Agrave -50
-KPX W Amacron -50
-KPX W Aogonek -50
-KPX W Aring -50
-KPX W Atilde -50
-KPX W O -20
-KPX W Oacute -20
-KPX W Ocircumflex -20
-KPX W Odieresis -20
-KPX W Ograve -20
-KPX W Ohungarumlaut -20
-KPX W Omacron -20
-KPX W Oslash -20
-KPX W Otilde -20
-KPX W a -40
-KPX W aacute -40
-KPX W abreve -40
-KPX W acircumflex -40
-KPX W adieresis -40
-KPX W agrave -40
-KPX W amacron -40
-KPX W aogonek -40
-KPX W aring -40
-KPX W atilde -40
-KPX W comma -80
-KPX W e -30
-KPX W eacute -30
-KPX W ecaron -30
-KPX W ecircumflex -30
-KPX W edieresis -30
-KPX W edotaccent -30
-KPX W egrave -30
-KPX W emacron -30
-KPX W eogonek -30
-KPX W hyphen -40
-KPX W o -30
-KPX W oacute -30
-KPX W ocircumflex -30
-KPX W odieresis -30
-KPX W ograve -30
-KPX W ohungarumlaut -30
-KPX W omacron -30
-KPX W oslash -30
-KPX W otilde -30
-KPX W period -80
-KPX W u -30
-KPX W uacute -30
-KPX W ucircumflex -30
-KPX W udieresis -30
-KPX W ugrave -30
-KPX W uhungarumlaut -30
-KPX W umacron -30
-KPX W uogonek -30
-KPX W uring -30
-KPX W y -20
-KPX W yacute -20
-KPX W ydieresis -20
-KPX Y A -110
-KPX Y Aacute -110
-KPX Y Abreve -110
-KPX Y Acircumflex -110
-KPX Y Adieresis -110
-KPX Y Agrave -110
-KPX Y Amacron -110
-KPX Y Aogonek -110
-KPX Y Aring -110
-KPX Y Atilde -110
-KPX Y O -85
-KPX Y Oacute -85
-KPX Y Ocircumflex -85
-KPX Y Odieresis -85
-KPX Y Ograve -85
-KPX Y Ohungarumlaut -85
-KPX Y Omacron -85
-KPX Y Oslash -85
-KPX Y Otilde -85
-KPX Y a -140
-KPX Y aacute -140
-KPX Y abreve -70
-KPX Y acircumflex -140
-KPX Y adieresis -140
-KPX Y agrave -140
-KPX Y amacron -70
-KPX Y aogonek -140
-KPX Y aring -140
-KPX Y atilde -140
-KPX Y colon -60
-KPX Y comma -140
-KPX Y e -140
-KPX Y eacute -140
-KPX Y ecaron -140
-KPX Y ecircumflex -140
-KPX Y edieresis -140
-KPX Y edotaccent -140
-KPX Y egrave -140
-KPX Y emacron -70
-KPX Y eogonek -140
-KPX Y hyphen -140
-KPX Y i -20
-KPX Y iacute -20
-KPX Y iogonek -20
-KPX Y o -140
-KPX Y oacute -140
-KPX Y ocircumflex -140
-KPX Y odieresis -140
-KPX Y ograve -140
-KPX Y ohungarumlaut -140
-KPX Y omacron -140
-KPX Y oslash -140
-KPX Y otilde -140
-KPX Y period -140
-KPX Y semicolon -60
-KPX Y u -110
-KPX Y uacute -110
-KPX Y ucircumflex -110
-KPX Y udieresis -110
-KPX Y ugrave -110
-KPX Y uhungarumlaut -110
-KPX Y umacron -110
-KPX Y uogonek -110
-KPX Y uring -110
-KPX Yacute A -110
-KPX Yacute Aacute -110
-KPX Yacute Abreve -110
-KPX Yacute Acircumflex -110
-KPX Yacute Adieresis -110
-KPX Yacute Agrave -110
-KPX Yacute Amacron -110
-KPX Yacute Aogonek -110
-KPX Yacute Aring -110
-KPX Yacute Atilde -110
-KPX Yacute O -85
-KPX Yacute Oacute -85
-KPX Yacute Ocircumflex -85
-KPX Yacute Odieresis -85
-KPX Yacute Ograve -85
-KPX Yacute Ohungarumlaut -85
-KPX Yacute Omacron -85
-KPX Yacute Oslash -85
-KPX Yacute Otilde -85
-KPX Yacute a -140
-KPX Yacute aacute -140
-KPX Yacute abreve -70
-KPX Yacute acircumflex -140
-KPX Yacute adieresis -140
-KPX Yacute agrave -140
-KPX Yacute amacron -70
-KPX Yacute aogonek -140
-KPX Yacute aring -140
-KPX Yacute atilde -70
-KPX Yacute colon -60
-KPX Yacute comma -140
-KPX Yacute e -140
-KPX Yacute eacute -140
-KPX Yacute ecaron -140
-KPX Yacute ecircumflex -140
-KPX Yacute edieresis -140
-KPX Yacute edotaccent -140
-KPX Yacute egrave -140
-KPX Yacute emacron -70
-KPX Yacute eogonek -140
-KPX Yacute hyphen -140
-KPX Yacute i -20
-KPX Yacute iacute -20
-KPX Yacute iogonek -20
-KPX Yacute o -140
-KPX Yacute oacute -140
-KPX Yacute ocircumflex -140
-KPX Yacute odieresis -140
-KPX Yacute ograve -140
-KPX Yacute ohungarumlaut -140
-KPX Yacute omacron -70
-KPX Yacute oslash -140
-KPX Yacute otilde -140
-KPX Yacute period -140
-KPX Yacute semicolon -60
-KPX Yacute u -110
-KPX Yacute uacute -110
-KPX Yacute ucircumflex -110
-KPX Yacute udieresis -110
-KPX Yacute ugrave -110
-KPX Yacute uhungarumlaut -110
-KPX Yacute umacron -110
-KPX Yacute uogonek -110
-KPX Yacute uring -110
-KPX Ydieresis A -110
-KPX Ydieresis Aacute -110
-KPX Ydieresis Abreve -110
-KPX Ydieresis Acircumflex -110
-KPX Ydieresis Adieresis -110
-KPX Ydieresis Agrave -110
-KPX Ydieresis Amacron -110
-KPX Ydieresis Aogonek -110
-KPX Ydieresis Aring -110
-KPX Ydieresis Atilde -110
-KPX Ydieresis O -85
-KPX Ydieresis Oacute -85
-KPX Ydieresis Ocircumflex -85
-KPX Ydieresis Odieresis -85
-KPX Ydieresis Ograve -85
-KPX Ydieresis Ohungarumlaut -85
-KPX Ydieresis Omacron -85
-KPX Ydieresis Oslash -85
-KPX Ydieresis Otilde -85
-KPX Ydieresis a -140
-KPX Ydieresis aacute -140
-KPX Ydieresis abreve -70
-KPX Ydieresis acircumflex -140
-KPX Ydieresis adieresis -140
-KPX Ydieresis agrave -140
-KPX Ydieresis amacron -70
-KPX Ydieresis aogonek -140
-KPX Ydieresis aring -140
-KPX Ydieresis atilde -70
-KPX Ydieresis colon -60
-KPX Ydieresis comma -140
-KPX Ydieresis e -140
-KPX Ydieresis eacute -140
-KPX Ydieresis ecaron -140
-KPX Ydieresis ecircumflex -140
-KPX Ydieresis edieresis -140
-KPX Ydieresis edotaccent -140
-KPX Ydieresis egrave -140
-KPX Ydieresis emacron -70
-KPX Ydieresis eogonek -140
-KPX Ydieresis hyphen -140
-KPX Ydieresis i -20
-KPX Ydieresis iacute -20
-KPX Ydieresis iogonek -20
-KPX Ydieresis o -140
-KPX Ydieresis oacute -140
-KPX Ydieresis ocircumflex -140
-KPX Ydieresis odieresis -140
-KPX Ydieresis ograve -140
-KPX Ydieresis ohungarumlaut -140
-KPX Ydieresis omacron -140
-KPX Ydieresis oslash -140
-KPX Ydieresis otilde -140
-KPX Ydieresis period -140
-KPX Ydieresis semicolon -60
-KPX Ydieresis u -110
-KPX Ydieresis uacute -110
-KPX Ydieresis ucircumflex -110
-KPX Ydieresis udieresis -110
-KPX Ydieresis ugrave -110
-KPX Ydieresis uhungarumlaut -110
-KPX Ydieresis umacron -110
-KPX Ydieresis uogonek -110
-KPX Ydieresis uring -110
-KPX a v -20
-KPX a w -20
-KPX a y -30
-KPX a yacute -30
-KPX a ydieresis -30
-KPX aacute v -20
-KPX aacute w -20
-KPX aacute y -30
-KPX aacute yacute -30
-KPX aacute ydieresis -30
-KPX abreve v -20
-KPX abreve w -20
-KPX abreve y -30
-KPX abreve yacute -30
-KPX abreve ydieresis -30
-KPX acircumflex v -20
-KPX acircumflex w -20
-KPX acircumflex y -30
-KPX acircumflex yacute -30
-KPX acircumflex ydieresis -30
-KPX adieresis v -20
-KPX adieresis w -20
-KPX adieresis y -30
-KPX adieresis yacute -30
-KPX adieresis ydieresis -30
-KPX agrave v -20
-KPX agrave w -20
-KPX agrave y -30
-KPX agrave yacute -30
-KPX agrave ydieresis -30
-KPX amacron v -20
-KPX amacron w -20
-KPX amacron y -30
-KPX amacron yacute -30
-KPX amacron ydieresis -30
-KPX aogonek v -20
-KPX aogonek w -20
-KPX aogonek y -30
-KPX aogonek yacute -30
-KPX aogonek ydieresis -30
-KPX aring v -20
-KPX aring w -20
-KPX aring y -30
-KPX aring yacute -30
-KPX aring ydieresis -30
-KPX atilde v -20
-KPX atilde w -20
-KPX atilde y -30
-KPX atilde yacute -30
-KPX atilde ydieresis -30
-KPX b b -10
-KPX b comma -40
-KPX b l -20
-KPX b lacute -20
-KPX b lcommaaccent -20
-KPX b lslash -20
-KPX b period -40
-KPX b u -20
-KPX b uacute -20
-KPX b ucircumflex -20
-KPX b udieresis -20
-KPX b ugrave -20
-KPX b uhungarumlaut -20
-KPX b umacron -20
-KPX b uogonek -20
-KPX b uring -20
-KPX b v -20
-KPX b y -20
-KPX b yacute -20
-KPX b ydieresis -20
-KPX c comma -15
-KPX c k -20
-KPX c kcommaaccent -20
-KPX cacute comma -15
-KPX cacute k -20
-KPX cacute kcommaaccent -20
-KPX ccaron comma -15
-KPX ccaron k -20
-KPX ccaron kcommaaccent -20
-KPX ccedilla comma -15
-KPX ccedilla k -20
-KPX ccedilla kcommaaccent -20
-KPX colon space -50
-KPX comma quotedblright -100
-KPX comma quoteright -100
-KPX e comma -15
-KPX e period -15
-KPX e v -30
-KPX e w -20
-KPX e x -30
-KPX e y -20
-KPX e yacute -20
-KPX e ydieresis -20
-KPX eacute comma -15
-KPX eacute period -15
-KPX eacute v -30
-KPX eacute w -20
-KPX eacute x -30
-KPX eacute y -20
-KPX eacute yacute -20
-KPX eacute ydieresis -20
-KPX ecaron comma -15
-KPX ecaron period -15
-KPX ecaron v -30
-KPX ecaron w -20
-KPX ecaron x -30
-KPX ecaron y -20
-KPX ecaron yacute -20
-KPX ecaron ydieresis -20
-KPX ecircumflex comma -15
-KPX ecircumflex period -15
-KPX ecircumflex v -30
-KPX ecircumflex w -20
-KPX ecircumflex x -30
-KPX ecircumflex y -20
-KPX ecircumflex yacute -20
-KPX ecircumflex ydieresis -20
-KPX edieresis comma -15
-KPX edieresis period -15
-KPX edieresis v -30
-KPX edieresis w -20
-KPX edieresis x -30
-KPX edieresis y -20
-KPX edieresis yacute -20
-KPX edieresis ydieresis -20
-KPX edotaccent comma -15
-KPX edotaccent period -15
-KPX edotaccent v -30
-KPX edotaccent w -20
-KPX edotaccent x -30
-KPX edotaccent y -20
-KPX edotaccent yacute -20
-KPX edotaccent ydieresis -20
-KPX egrave comma -15
-KPX egrave period -15
-KPX egrave v -30
-KPX egrave w -20
-KPX egrave x -30
-KPX egrave y -20
-KPX egrave yacute -20
-KPX egrave ydieresis -20
-KPX emacron comma -15
-KPX emacron period -15
-KPX emacron v -30
-KPX emacron w -20
-KPX emacron x -30
-KPX emacron y -20
-KPX emacron yacute -20
-KPX emacron ydieresis -20
-KPX eogonek comma -15
-KPX eogonek period -15
-KPX eogonek v -30
-KPX eogonek w -20
-KPX eogonek x -30
-KPX eogonek y -20
-KPX eogonek yacute -20
-KPX eogonek ydieresis -20
-KPX f a -30
-KPX f aacute -30
-KPX f abreve -30
-KPX f acircumflex -30
-KPX f adieresis -30
-KPX f agrave -30
-KPX f amacron -30
-KPX f aogonek -30
-KPX f aring -30
-KPX f atilde -30
-KPX f comma -30
-KPX f dotlessi -28
-KPX f e -30
-KPX f eacute -30
-KPX f ecaron -30
-KPX f ecircumflex -30
-KPX f edieresis -30
-KPX f edotaccent -30
-KPX f egrave -30
-KPX f emacron -30
-KPX f eogonek -30
-KPX f o -30
-KPX f oacute -30
-KPX f ocircumflex -30
-KPX f odieresis -30
-KPX f ograve -30
-KPX f ohungarumlaut -30
-KPX f omacron -30
-KPX f oslash -30
-KPX f otilde -30
-KPX f period -30
-KPX f quotedblright 60
-KPX f quoteright 50
-KPX g r -10
-KPX g racute -10
-KPX g rcaron -10
-KPX g rcommaaccent -10
-KPX gbreve r -10
-KPX gbreve racute -10
-KPX gbreve rcaron -10
-KPX gbreve rcommaaccent -10
-KPX gcommaaccent r -10
-KPX gcommaaccent racute -10
-KPX gcommaaccent rcaron -10
-KPX gcommaaccent rcommaaccent -10
-KPX h y -30
-KPX h yacute -30
-KPX h ydieresis -30
-KPX k e -20
-KPX k eacute -20
-KPX k ecaron -20
-KPX k ecircumflex -20
-KPX k edieresis -20
-KPX k edotaccent -20
-KPX k egrave -20
-KPX k emacron -20
-KPX k eogonek -20
-KPX k o -20
-KPX k oacute -20
-KPX k ocircumflex -20
-KPX k odieresis -20
-KPX k ograve -20
-KPX k ohungarumlaut -20
-KPX k omacron -20
-KPX k oslash -20
-KPX k otilde -20
-KPX kcommaaccent e -20
-KPX kcommaaccent eacute -20
-KPX kcommaaccent ecaron -20
-KPX kcommaaccent ecircumflex -20
-KPX kcommaaccent edieresis -20
-KPX kcommaaccent edotaccent -20
-KPX kcommaaccent egrave -20
-KPX kcommaaccent emacron -20
-KPX kcommaaccent eogonek -20
-KPX kcommaaccent o -20
-KPX kcommaaccent oacute -20
-KPX kcommaaccent ocircumflex -20
-KPX kcommaaccent odieresis -20
-KPX kcommaaccent ograve -20
-KPX kcommaaccent ohungarumlaut -20
-KPX kcommaaccent omacron -20
-KPX kcommaaccent oslash -20
-KPX kcommaaccent otilde -20
-KPX m u -10
-KPX m uacute -10
-KPX m ucircumflex -10
-KPX m udieresis -10
-KPX m ugrave -10
-KPX m uhungarumlaut -10
-KPX m umacron -10
-KPX m uogonek -10
-KPX m uring -10
-KPX m y -15
-KPX m yacute -15
-KPX m ydieresis -15
-KPX n u -10
-KPX n uacute -10
-KPX n ucircumflex -10
-KPX n udieresis -10
-KPX n ugrave -10
-KPX n uhungarumlaut -10
-KPX n umacron -10
-KPX n uogonek -10
-KPX n uring -10
-KPX n v -20
-KPX n y -15
-KPX n yacute -15
-KPX n ydieresis -15
-KPX nacute u -10
-KPX nacute uacute -10
-KPX nacute ucircumflex -10
-KPX nacute udieresis -10
-KPX nacute ugrave -10
-KPX nacute uhungarumlaut -10
-KPX nacute umacron -10
-KPX nacute uogonek -10
-KPX nacute uring -10
-KPX nacute v -20
-KPX nacute y -15
-KPX nacute yacute -15
-KPX nacute ydieresis -15
-KPX ncaron u -10
-KPX ncaron uacute -10
-KPX ncaron ucircumflex -10
-KPX ncaron udieresis -10
-KPX ncaron ugrave -10
-KPX ncaron uhungarumlaut -10
-KPX ncaron umacron -10
-KPX ncaron uogonek -10
-KPX ncaron uring -10
-KPX ncaron v -20
-KPX ncaron y -15
-KPX ncaron yacute -15
-KPX ncaron ydieresis -15
-KPX ncommaaccent u -10
-KPX ncommaaccent uacute -10
-KPX ncommaaccent ucircumflex -10
-KPX ncommaaccent udieresis -10
-KPX ncommaaccent ugrave -10
-KPX ncommaaccent uhungarumlaut -10
-KPX ncommaaccent umacron -10
-KPX ncommaaccent uogonek -10
-KPX ncommaaccent uring -10
-KPX ncommaaccent v -20
-KPX ncommaaccent y -15
-KPX ncommaaccent yacute -15
-KPX ncommaaccent ydieresis -15
-KPX ntilde u -10
-KPX ntilde uacute -10
-KPX ntilde ucircumflex -10
-KPX ntilde udieresis -10
-KPX ntilde ugrave -10
-KPX ntilde uhungarumlaut -10
-KPX ntilde umacron -10
-KPX ntilde uogonek -10
-KPX ntilde uring -10
-KPX ntilde v -20
-KPX ntilde y -15
-KPX ntilde yacute -15
-KPX ntilde ydieresis -15
-KPX o comma -40
-KPX o period -40
-KPX o v -15
-KPX o w -15
-KPX o x -30
-KPX o y -30
-KPX o yacute -30
-KPX o ydieresis -30
-KPX oacute comma -40
-KPX oacute period -40
-KPX oacute v -15
-KPX oacute w -15
-KPX oacute x -30
-KPX oacute y -30
-KPX oacute yacute -30
-KPX oacute ydieresis -30
-KPX ocircumflex comma -40
-KPX ocircumflex period -40
-KPX ocircumflex v -15
-KPX ocircumflex w -15
-KPX ocircumflex x -30
-KPX ocircumflex y -30
-KPX ocircumflex yacute -30
-KPX ocircumflex ydieresis -30
-KPX odieresis comma -40
-KPX odieresis period -40
-KPX odieresis v -15
-KPX odieresis w -15
-KPX odieresis x -30
-KPX odieresis y -30
-KPX odieresis yacute -30
-KPX odieresis ydieresis -30
-KPX ograve comma -40
-KPX ograve period -40
-KPX ograve v -15
-KPX ograve w -15
-KPX ograve x -30
-KPX ograve y -30
-KPX ograve yacute -30
-KPX ograve ydieresis -30
-KPX ohungarumlaut comma -40
-KPX ohungarumlaut period -40
-KPX ohungarumlaut v -15
-KPX ohungarumlaut w -15
-KPX ohungarumlaut x -30
-KPX ohungarumlaut y -30
-KPX ohungarumlaut yacute -30
-KPX ohungarumlaut ydieresis -30
-KPX omacron comma -40
-KPX omacron period -40
-KPX omacron v -15
-KPX omacron w -15
-KPX omacron x -30
-KPX omacron y -30
-KPX omacron yacute -30
-KPX omacron ydieresis -30
-KPX oslash a -55
-KPX oslash aacute -55
-KPX oslash abreve -55
-KPX oslash acircumflex -55
-KPX oslash adieresis -55
-KPX oslash agrave -55
-KPX oslash amacron -55
-KPX oslash aogonek -55
-KPX oslash aring -55
-KPX oslash atilde -55
-KPX oslash b -55
-KPX oslash c -55
-KPX oslash cacute -55
-KPX oslash ccaron -55
-KPX oslash ccedilla -55
-KPX oslash comma -95
-KPX oslash d -55
-KPX oslash dcroat -55
-KPX oslash e -55
-KPX oslash eacute -55
-KPX oslash ecaron -55
-KPX oslash ecircumflex -55
-KPX oslash edieresis -55
-KPX oslash edotaccent -55
-KPX oslash egrave -55
-KPX oslash emacron -55
-KPX oslash eogonek -55
-KPX oslash f -55
-KPX oslash g -55
-KPX oslash gbreve -55
-KPX oslash gcommaaccent -55
-KPX oslash h -55
-KPX oslash i -55
-KPX oslash iacute -55
-KPX oslash icircumflex -55
-KPX oslash idieresis -55
-KPX oslash igrave -55
-KPX oslash imacron -55
-KPX oslash iogonek -55
-KPX oslash j -55
-KPX oslash k -55
-KPX oslash kcommaaccent -55
-KPX oslash l -55
-KPX oslash lacute -55
-KPX oslash lcommaaccent -55
-KPX oslash lslash -55
-KPX oslash m -55
-KPX oslash n -55
-KPX oslash nacute -55
-KPX oslash ncaron -55
-KPX oslash ncommaaccent -55
-KPX oslash ntilde -55
-KPX oslash o -55
-KPX oslash oacute -55
-KPX oslash ocircumflex -55
-KPX oslash odieresis -55
-KPX oslash ograve -55
-KPX oslash ohungarumlaut -55
-KPX oslash omacron -55
-KPX oslash oslash -55
-KPX oslash otilde -55
-KPX oslash p -55
-KPX oslash period -95
-KPX oslash q -55
-KPX oslash r -55
-KPX oslash racute -55
-KPX oslash rcaron -55
-KPX oslash rcommaaccent -55
-KPX oslash s -55
-KPX oslash sacute -55
-KPX oslash scaron -55
-KPX oslash scedilla -55
-KPX oslash scommaaccent -55
-KPX oslash t -55
-KPX oslash tcommaaccent -55
-KPX oslash u -55
-KPX oslash uacute -55
-KPX oslash ucircumflex -55
-KPX oslash udieresis -55
-KPX oslash ugrave -55
-KPX oslash uhungarumlaut -55
-KPX oslash umacron -55
-KPX oslash uogonek -55
-KPX oslash uring -55
-KPX oslash v -70
-KPX oslash w -70
-KPX oslash x -85
-KPX oslash y -70
-KPX oslash yacute -70
-KPX oslash ydieresis -70
-KPX oslash z -55
-KPX oslash zacute -55
-KPX oslash zcaron -55
-KPX oslash zdotaccent -55
-KPX otilde comma -40
-KPX otilde period -40
-KPX otilde v -15
-KPX otilde w -15
-KPX otilde x -30
-KPX otilde y -30
-KPX otilde yacute -30
-KPX otilde ydieresis -30
-KPX p comma -35
-KPX p period -35
-KPX p y -30
-KPX p yacute -30
-KPX p ydieresis -30
-KPX period quotedblright -100
-KPX period quoteright -100
-KPX period space -60
-KPX quotedblright space -40
-KPX quoteleft quoteleft -57
-KPX quoteright d -50
-KPX quoteright dcroat -50
-KPX quoteright quoteright -57
-KPX quoteright r -50
-KPX quoteright racute -50
-KPX quoteright rcaron -50
-KPX quoteright rcommaaccent -50
-KPX quoteright s -50
-KPX quoteright sacute -50
-KPX quoteright scaron -50
-KPX quoteright scedilla -50
-KPX quoteright scommaaccent -50
-KPX quoteright space -70
-KPX r a -10
-KPX r aacute -10
-KPX r abreve -10
-KPX r acircumflex -10
-KPX r adieresis -10
-KPX r agrave -10
-KPX r amacron -10
-KPX r aogonek -10
-KPX r aring -10
-KPX r atilde -10
-KPX r colon 30
-KPX r comma -50
-KPX r i 15
-KPX r iacute 15
-KPX r icircumflex 15
-KPX r idieresis 15
-KPX r igrave 15
-KPX r imacron 15
-KPX r iogonek 15
-KPX r k 15
-KPX r kcommaaccent 15
-KPX r l 15
-KPX r lacute 15
-KPX r lcommaaccent 15
-KPX r lslash 15
-KPX r m 25
-KPX r n 25
-KPX r nacute 25
-KPX r ncaron 25
-KPX r ncommaaccent 25
-KPX r ntilde 25
-KPX r p 30
-KPX r period -50
-KPX r semicolon 30
-KPX r t 40
-KPX r tcommaaccent 40
-KPX r u 15
-KPX r uacute 15
-KPX r ucircumflex 15
-KPX r udieresis 15
-KPX r ugrave 15
-KPX r uhungarumlaut 15
-KPX r umacron 15
-KPX r uogonek 15
-KPX r uring 15
-KPX r v 30
-KPX r y 30
-KPX r yacute 30
-KPX r ydieresis 30
-KPX racute a -10
-KPX racute aacute -10
-KPX racute abreve -10
-KPX racute acircumflex -10
-KPX racute adieresis -10
-KPX racute agrave -10
-KPX racute amacron -10
-KPX racute aogonek -10
-KPX racute aring -10
-KPX racute atilde -10
-KPX racute colon 30
-KPX racute comma -50
-KPX racute i 15
-KPX racute iacute 15
-KPX racute icircumflex 15
-KPX racute idieresis 15
-KPX racute igrave 15
-KPX racute imacron 15
-KPX racute iogonek 15
-KPX racute k 15
-KPX racute kcommaaccent 15
-KPX racute l 15
-KPX racute lacute 15
-KPX racute lcommaaccent 15
-KPX racute lslash 15
-KPX racute m 25
-KPX racute n 25
-KPX racute nacute 25
-KPX racute ncaron 25
-KPX racute ncommaaccent 25
-KPX racute ntilde 25
-KPX racute p 30
-KPX racute period -50
-KPX racute semicolon 30
-KPX racute t 40
-KPX racute tcommaaccent 40
-KPX racute u 15
-KPX racute uacute 15
-KPX racute ucircumflex 15
-KPX racute udieresis 15
-KPX racute ugrave 15
-KPX racute uhungarumlaut 15
-KPX racute umacron 15
-KPX racute uogonek 15
-KPX racute uring 15
-KPX racute v 30
-KPX racute y 30
-KPX racute yacute 30
-KPX racute ydieresis 30
-KPX rcaron a -10
-KPX rcaron aacute -10
-KPX rcaron abreve -10
-KPX rcaron acircumflex -10
-KPX rcaron adieresis -10
-KPX rcaron agrave -10
-KPX rcaron amacron -10
-KPX rcaron aogonek -10
-KPX rcaron aring -10
-KPX rcaron atilde -10
-KPX rcaron colon 30
-KPX rcaron comma -50
-KPX rcaron i 15
-KPX rcaron iacute 15
-KPX rcaron icircumflex 15
-KPX rcaron idieresis 15
-KPX rcaron igrave 15
-KPX rcaron imacron 15
-KPX rcaron iogonek 15
-KPX rcaron k 15
-KPX rcaron kcommaaccent 15
-KPX rcaron l 15
-KPX rcaron lacute 15
-KPX rcaron lcommaaccent 15
-KPX rcaron lslash 15
-KPX rcaron m 25
-KPX rcaron n 25
-KPX rcaron nacute 25
-KPX rcaron ncaron 25
-KPX rcaron ncommaaccent 25
-KPX rcaron ntilde 25
-KPX rcaron p 30
-KPX rcaron period -50
-KPX rcaron semicolon 30
-KPX rcaron t 40
-KPX rcaron tcommaaccent 40
-KPX rcaron u 15
-KPX rcaron uacute 15
-KPX rcaron ucircumflex 15
-KPX rcaron udieresis 15
-KPX rcaron ugrave 15
-KPX rcaron uhungarumlaut 15
-KPX rcaron umacron 15
-KPX rcaron uogonek 15
-KPX rcaron uring 15
-KPX rcaron v 30
-KPX rcaron y 30
-KPX rcaron yacute 30
-KPX rcaron ydieresis 30
-KPX rcommaaccent a -10
-KPX rcommaaccent aacute -10
-KPX rcommaaccent abreve -10
-KPX rcommaaccent acircumflex -10
-KPX rcommaaccent adieresis -10
-KPX rcommaaccent agrave -10
-KPX rcommaaccent amacron -10
-KPX rcommaaccent aogonek -10
-KPX rcommaaccent aring -10
-KPX rcommaaccent atilde -10
-KPX rcommaaccent colon 30
-KPX rcommaaccent comma -50
-KPX rcommaaccent i 15
-KPX rcommaaccent iacute 15
-KPX rcommaaccent icircumflex 15
-KPX rcommaaccent idieresis 15
-KPX rcommaaccent igrave 15
-KPX rcommaaccent imacron 15
-KPX rcommaaccent iogonek 15
-KPX rcommaaccent k 15
-KPX rcommaaccent kcommaaccent 15
-KPX rcommaaccent l 15
-KPX rcommaaccent lacute 15
-KPX rcommaaccent lcommaaccent 15
-KPX rcommaaccent lslash 15
-KPX rcommaaccent m 25
-KPX rcommaaccent n 25
-KPX rcommaaccent nacute 25
-KPX rcommaaccent ncaron 25
-KPX rcommaaccent ncommaaccent 25
-KPX rcommaaccent ntilde 25
-KPX rcommaaccent p 30
-KPX rcommaaccent period -50
-KPX rcommaaccent semicolon 30
-KPX rcommaaccent t 40
-KPX rcommaaccent tcommaaccent 40
-KPX rcommaaccent u 15
-KPX rcommaaccent uacute 15
-KPX rcommaaccent ucircumflex 15
-KPX rcommaaccent udieresis 15
-KPX rcommaaccent ugrave 15
-KPX rcommaaccent uhungarumlaut 15
-KPX rcommaaccent umacron 15
-KPX rcommaaccent uogonek 15
-KPX rcommaaccent uring 15
-KPX rcommaaccent v 30
-KPX rcommaaccent y 30
-KPX rcommaaccent yacute 30
-KPX rcommaaccent ydieresis 30
-KPX s comma -15
-KPX s period -15
-KPX s w -30
-KPX sacute comma -15
-KPX sacute period -15
-KPX sacute w -30
-KPX scaron comma -15
-KPX scaron period -15
-KPX scaron w -30
-KPX scedilla comma -15
-KPX scedilla period -15
-KPX scedilla w -30
-KPX scommaaccent comma -15
-KPX scommaaccent period -15
-KPX scommaaccent w -30
-KPX semicolon space -50
-KPX space T -50
-KPX space Tcaron -50
-KPX space Tcommaaccent -50
-KPX space V -50
-KPX space W -40
-KPX space Y -90
-KPX space Yacute -90
-KPX space Ydieresis -90
-KPX space quotedblleft -30
-KPX space quoteleft -60
-KPX v a -25
-KPX v aacute -25
-KPX v abreve -25
-KPX v acircumflex -25
-KPX v adieresis -25
-KPX v agrave -25
-KPX v amacron -25
-KPX v aogonek -25
-KPX v aring -25
-KPX v atilde -25
-KPX v comma -80
-KPX v e -25
-KPX v eacute -25
-KPX v ecaron -25
-KPX v ecircumflex -25
-KPX v edieresis -25
-KPX v edotaccent -25
-KPX v egrave -25
-KPX v emacron -25
-KPX v eogonek -25
-KPX v o -25
-KPX v oacute -25
-KPX v ocircumflex -25
-KPX v odieresis -25
-KPX v ograve -25
-KPX v ohungarumlaut -25
-KPX v omacron -25
-KPX v oslash -25
-KPX v otilde -25
-KPX v period -80
-KPX w a -15
-KPX w aacute -15
-KPX w abreve -15
-KPX w acircumflex -15
-KPX w adieresis -15
-KPX w agrave -15
-KPX w amacron -15
-KPX w aogonek -15
-KPX w aring -15
-KPX w atilde -15
-KPX w comma -60
-KPX w e -10
-KPX w eacute -10
-KPX w ecaron -10
-KPX w ecircumflex -10
-KPX w edieresis -10
-KPX w edotaccent -10
-KPX w egrave -10
-KPX w emacron -10
-KPX w eogonek -10
-KPX w o -10
-KPX w oacute -10
-KPX w ocircumflex -10
-KPX w odieresis -10
-KPX w ograve -10
-KPX w ohungarumlaut -10
-KPX w omacron -10
-KPX w oslash -10
-KPX w otilde -10
-KPX w period -60
-KPX x e -30
-KPX x eacute -30
-KPX x ecaron -30
-KPX x ecircumflex -30
-KPX x edieresis -30
-KPX x edotaccent -30
-KPX x egrave -30
-KPX x emacron -30
-KPX x eogonek -30
-KPX y a -20
-KPX y aacute -20
-KPX y abreve -20
-KPX y acircumflex -20
-KPX y adieresis -20
-KPX y agrave -20
-KPX y amacron -20
-KPX y aogonek -20
-KPX y aring -20
-KPX y atilde -20
-KPX y comma -100
-KPX y e -20
-KPX y eacute -20
-KPX y ecaron -20
-KPX y ecircumflex -20
-KPX y edieresis -20
-KPX y edotaccent -20
-KPX y egrave -20
-KPX y emacron -20
-KPX y eogonek -20
-KPX y o -20
-KPX y oacute -20
-KPX y ocircumflex -20
-KPX y odieresis -20
-KPX y ograve -20
-KPX y ohungarumlaut -20
-KPX y omacron -20
-KPX y oslash -20
-KPX y otilde -20
-KPX y period -100
-KPX yacute a -20
-KPX yacute aacute -20
-KPX yacute abreve -20
-KPX yacute acircumflex -20
-KPX yacute adieresis -20
-KPX yacute agrave -20
-KPX yacute amacron -20
-KPX yacute aogonek -20
-KPX yacute aring -20
-KPX yacute atilde -20
-KPX yacute comma -100
-KPX yacute e -20
-KPX yacute eacute -20
-KPX yacute ecaron -20
-KPX yacute ecircumflex -20
-KPX yacute edieresis -20
-KPX yacute edotaccent -20
-KPX yacute egrave -20
-KPX yacute emacron -20
-KPX yacute eogonek -20
-KPX yacute o -20
-KPX yacute oacute -20
-KPX yacute ocircumflex -20
-KPX yacute odieresis -20
-KPX yacute ograve -20
-KPX yacute ohungarumlaut -20
-KPX yacute omacron -20
-KPX yacute oslash -20
-KPX yacute otilde -20
-KPX yacute period -100
-KPX ydieresis a -20
-KPX ydieresis aacute -20
-KPX ydieresis abreve -20
-KPX ydieresis acircumflex -20
-KPX ydieresis adieresis -20
-KPX ydieresis agrave -20
-KPX ydieresis amacron -20
-KPX ydieresis aogonek -20
-KPX ydieresis aring -20
-KPX ydieresis atilde -20
-KPX ydieresis comma -100
-KPX ydieresis e -20
-KPX ydieresis eacute -20
-KPX ydieresis ecaron -20
-KPX ydieresis ecircumflex -20
-KPX ydieresis edieresis -20
-KPX ydieresis edotaccent -20
-KPX ydieresis egrave -20
-KPX ydieresis emacron -20
-KPX ydieresis eogonek -20
-KPX ydieresis o -20
-KPX ydieresis oacute -20
-KPX ydieresis ocircumflex -20
-KPX ydieresis odieresis -20
-KPX ydieresis ograve -20
-KPX ydieresis ohungarumlaut -20
-KPX ydieresis omacron -20
-KPX ydieresis oslash -20
-KPX ydieresis otilde -20
-KPX ydieresis period -100
-KPX z e -15
-KPX z eacute -15
-KPX z ecaron -15
-KPX z ecircumflex -15
-KPX z edieresis -15
-KPX z edotaccent -15
-KPX z egrave -15
-KPX z emacron -15
-KPX z eogonek -15
-KPX z o -15
-KPX z oacute -15
-KPX z ocircumflex -15
-KPX z odieresis -15
-KPX z ograve -15
-KPX z ohungarumlaut -15
-KPX z omacron -15
-KPX z oslash -15
-KPX z otilde -15
-KPX zacute e -15
-KPX zacute eacute -15
-KPX zacute ecaron -15
-KPX zacute ecircumflex -15
-KPX zacute edieresis -15
-KPX zacute edotaccent -15
-KPX zacute egrave -15
-KPX zacute emacron -15
-KPX zacute eogonek -15
-KPX zacute o -15
-KPX zacute oacute -15
-KPX zacute ocircumflex -15
-KPX zacute odieresis -15
-KPX zacute ograve -15
-KPX zacute ohungarumlaut -15
-KPX zacute omacron -15
-KPX zacute oslash -15
-KPX zacute otilde -15
-KPX zcaron e -15
-KPX zcaron eacute -15
-KPX zcaron ecaron -15
-KPX zcaron ecircumflex -15
-KPX zcaron edieresis -15
-KPX zcaron edotaccent -15
-KPX zcaron egrave -15
-KPX zcaron emacron -15
-KPX zcaron eogonek -15
-KPX zcaron o -15
-KPX zcaron oacute -15
-KPX zcaron ocircumflex -15
-KPX zcaron odieresis -15
-KPX zcaron ograve -15
-KPX zcaron ohungarumlaut -15
-KPX zcaron omacron -15
-KPX zcaron oslash -15
-KPX zcaron otilde -15
-KPX zdotaccent e -15
-KPX zdotaccent eacute -15
-KPX zdotaccent ecaron -15
-KPX zdotaccent ecircumflex -15
-KPX zdotaccent edieresis -15
-KPX zdotaccent edotaccent -15
-KPX zdotaccent egrave -15
-KPX zdotaccent emacron -15
-KPX zdotaccent eogonek -15
-KPX zdotaccent o -15
-KPX zdotaccent oacute -15
-KPX zdotaccent ocircumflex -15
-KPX zdotaccent odieresis -15
-KPX zdotaccent ograve -15
-KPX zdotaccent ohungarumlaut -15
-KPX zdotaccent omacron -15
-KPX zdotaccent oslash -15
-KPX zdotaccent otilde -15
-EndKernPairs
-EndKernData
-EndFontMetrics
-
diff --git a/LibrarySource/com/lowagie/text/pdf/fonts/Symbol.afm b/LibrarySource/com/lowagie/text/pdf/fonts/Symbol.afm
deleted file mode 100644
index 51c39f5..0000000
--- a/LibrarySource/com/lowagie/text/pdf/fonts/Symbol.afm
+++ /dev/null
@@ -1,214 +0,0 @@
-StartFontMetrics 4.1
-Comment Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All rights reserved.
-Comment Creation Date: Thu May 1 15:12:25 1997
-Comment UniqueID 43064
-Comment VMusage 30820 39997
-FontName Symbol
-FullName Symbol
-FamilyName Symbol
-Weight Medium
-ItalicAngle 0
-IsFixedPitch false
-CharacterSet Special
-FontBBox -180 -293 1090 1010
-UnderlinePosition -100
-UnderlineThickness 50
-Version 001.008
-Notice Copyright (c) 1985, 1987, 1989, 1990, 1997 Adobe Systems Incorporated. All rights reserved.
-EncodingScheme FontSpecific
-StdHW 92
-StdVW 85
-StartCharMetrics 190
-C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
-C 33 ; WX 333 ; N exclam ; B 128 -17 240 672 ;
-C 34 ; WX 713 ; N universal ; B 31 0 681 705 ;
-C 35 ; WX 500 ; N numbersign ; B 20 -16 481 673 ;
-C 36 ; WX 549 ; N existential ; B 25 0 478 707 ;
-C 37 ; WX 833 ; N percent ; B 63 -36 771 655 ;
-C 38 ; WX 778 ; N ampersand ; B 41 -18 750 661 ;
-C 39 ; WX 439 ; N suchthat ; B 48 -17 414 500 ;
-C 40 ; WX 333 ; N parenleft ; B 53 -191 300 673 ;
-C 41 ; WX 333 ; N parenright ; B 30 -191 277 673 ;
-C 42 ; WX 500 ; N asteriskmath ; B 65 134 427 551 ;
-C 43 ; WX 549 ; N plus ; B 10 0 539 533 ;
-C 44 ; WX 250 ; N comma ; B 56 -152 194 104 ;
-C 45 ; WX 549 ; N minus ; B 11 233 535 288 ;
-C 46 ; WX 250 ; N period ; B 69 -17 181 95 ;
-C 47 ; WX 278 ; N slash ; B 0 -18 254 646 ;
-C 48 ; WX 500 ; N zero ; B 24 -14 476 685 ;
-C 49 ; WX 500 ; N one ; B 117 0 390 673 ;
-C 50 ; WX 500 ; N two ; B 25 0 475 685 ;
-C 51 ; WX 500 ; N three ; B 43 -14 435 685 ;
-C 52 ; WX 500 ; N four ; B 15 0 469 685 ;
-C 53 ; WX 500 ; N five ; B 32 -14 445 690 ;
-C 54 ; WX 500 ; N six ; B 34 -14 468 685 ;
-C 55 ; WX 500 ; N seven ; B 24 -16 448 673 ;
-C 56 ; WX 500 ; N eight ; B 56 -14 445 685 ;
-C 57 ; WX 500 ; N nine ; B 30 -18 459 685 ;
-C 58 ; WX 278 ; N colon ; B 81 -17 193 460 ;
-C 59 ; WX 278 ; N semicolon ; B 83 -152 221 460 ;
-C 60 ; WX 549 ; N less ; B 26 0 523 522 ;
-C 61 ; WX 549 ; N equal ; B 11 141 537 390 ;
-C 62 ; WX 549 ; N greater ; B 26 0 523 522 ;
-C 63 ; WX 444 ; N question ; B 70 -17 412 686 ;
-C 64 ; WX 549 ; N congruent ; B 11 0 537 475 ;
-C 65 ; WX 722 ; N Alpha ; B 4 0 684 673 ;
-C 66 ; WX 667 ; N Beta ; B 29 0 592 673 ;
-C 67 ; WX 722 ; N Chi ; B -9 0 704 673 ;
-C 68 ; WX 612 ; N Delta ; B 6 0 608 688 ;
-C 69 ; WX 611 ; N Epsilon ; B 32 0 617 673 ;
-C 70 ; WX 763 ; N Phi ; B 26 0 741 673 ;
-C 71 ; WX 603 ; N Gamma ; B 24 0 609 673 ;
-C 72 ; WX 722 ; N Eta ; B 39 0 729 673 ;
-C 73 ; WX 333 ; N Iota ; B 32 0 316 673 ;
-C 74 ; WX 631 ; N theta1 ; B 18 -18 623 689 ;
-C 75 ; WX 722 ; N Kappa ; B 35 0 722 673 ;
-C 76 ; WX 686 ; N Lambda ; B 6 0 680 688 ;
-C 77 ; WX 889 ; N Mu ; B 28 0 887 673 ;
-C 78 ; WX 722 ; N Nu ; B 29 -8 720 673 ;
-C 79 ; WX 722 ; N Omicron ; B 41 -17 715 685 ;
-C 80 ; WX 768 ; N Pi ; B 25 0 745 673 ;
-C 81 ; WX 741 ; N Theta ; B 41 -17 715 685 ;
-C 82 ; WX 556 ; N Rho ; B 28 0 563 673 ;
-C 83 ; WX 592 ; N Sigma ; B 5 0 589 673 ;
-C 84 ; WX 611 ; N Tau ; B 33 0 607 673 ;
-C 85 ; WX 690 ; N Upsilon ; B -8 0 694 673 ;
-C 86 ; WX 439 ; N sigma1 ; B 40 -233 436 500 ;
-C 87 ; WX 768 ; N Omega ; B 34 0 736 688 ;
-C 88 ; WX 645 ; N Xi ; B 40 0 599 673 ;
-C 89 ; WX 795 ; N Psi ; B 15 0 781 684 ;
-C 90 ; WX 611 ; N Zeta ; B 44 0 636 673 ;
-C 91 ; WX 333 ; N bracketleft ; B 86 -155 299 674 ;
-C 92 ; WX 863 ; N therefore ; B 163 0 701 487 ;
-C 93 ; WX 333 ; N bracketright ; B 33 -155 246 674 ;
-C 94 ; WX 658 ; N perpendicular ; B 15 0 652 674 ;
-C 95 ; WX 500 ; N underscore ; B -2 -125 502 -75 ;
-C 96 ; WX 500 ; N radicalex ; B 480 881 1090 917 ;
-C 97 ; WX 631 ; N alpha ; B 41 -18 622 500 ;
-C 98 ; WX 549 ; N beta ; B 61 -223 515 741 ;
-C 99 ; WX 549 ; N chi ; B 12 -231 522 499 ;
-C 100 ; WX 494 ; N delta ; B 40 -19 481 740 ;
-C 101 ; WX 439 ; N epsilon ; B 22 -19 427 502 ;
-C 102 ; WX 521 ; N phi ; B 28 -224 492 673 ;
-C 103 ; WX 411 ; N gamma ; B 5 -225 484 499 ;
-C 104 ; WX 603 ; N eta ; B 0 -202 527 514 ;
-C 105 ; WX 329 ; N iota ; B 0 -17 301 503 ;
-C 106 ; WX 603 ; N phi1 ; B 36 -224 587 499 ;
-C 107 ; WX 549 ; N kappa ; B 33 0 558 501 ;
-C 108 ; WX 549 ; N lambda ; B 24 -17 548 739 ;
-C 109 ; WX 576 ; N mu ; B 33 -223 567 500 ;
-C 110 ; WX 521 ; N nu ; B -9 -16 475 507 ;
-C 111 ; WX 549 ; N omicron ; B 35 -19 501 499 ;
-C 112 ; WX 549 ; N pi ; B 10 -19 530 487 ;
-C 113 ; WX 521 ; N theta ; B 43 -17 485 690 ;
-C 114 ; WX 549 ; N rho ; B 50 -230 490 499 ;
-C 115 ; WX 603 ; N sigma ; B 30 -21 588 500 ;
-C 116 ; WX 439 ; N tau ; B 10 -19 418 500 ;
-C 117 ; WX 576 ; N upsilon ; B 7 -18 535 507 ;
-C 118 ; WX 713 ; N omega1 ; B 12 -18 671 583 ;
-C 119 ; WX 686 ; N omega ; B 42 -17 684 500 ;
-C 120 ; WX 493 ; N xi ; B 27 -224 469 766 ;
-C 121 ; WX 686 ; N psi ; B 12 -228 701 500 ;
-C 122 ; WX 494 ; N zeta ; B 60 -225 467 756 ;
-C 123 ; WX 480 ; N braceleft ; B 58 -183 397 673 ;
-C 124 ; WX 200 ; N bar ; B 65 -293 135 707 ;
-C 125 ; WX 480 ; N braceright ; B 79 -183 418 673 ;
-C 126 ; WX 549 ; N similar ; B 17 203 529 307 ;
-C 160 ; WX 750 ; N Euro ; B 20 -12 714 685 ;
-C 161 ; WX 620 ; N Upsilon1 ; B -2 0 610 685 ;
-C 162 ; WX 247 ; N minute ; B 27 459 228 735 ;
-C 163 ; WX 549 ; N lessequal ; B 29 0 526 639 ;
-C 164 ; WX 167 ; N fraction ; B -180 -12 340 677 ;
-C 165 ; WX 713 ; N infinity ; B 26 124 688 404 ;
-C 166 ; WX 500 ; N florin ; B 2 -193 494 686 ;
-C 167 ; WX 753 ; N club ; B 86 -26 660 533 ;
-C 168 ; WX 753 ; N diamond ; B 142 -36 600 550 ;
-C 169 ; WX 753 ; N heart ; B 117 -33 631 532 ;
-C 170 ; WX 753 ; N spade ; B 113 -36 629 548 ;
-C 171 ; WX 1042 ; N arrowboth ; B 24 -15 1024 511 ;
-C 172 ; WX 987 ; N arrowleft ; B 32 -15 942 511 ;
-C 173 ; WX 603 ; N arrowup ; B 45 0 571 910 ;
-C 174 ; WX 987 ; N arrowright ; B 49 -15 959 511 ;
-C 175 ; WX 603 ; N arrowdown ; B 45 -22 571 888 ;
-C 176 ; WX 400 ; N degree ; B 50 385 350 685 ;
-C 177 ; WX 549 ; N plusminus ; B 10 0 539 645 ;
-C 178 ; WX 411 ; N second ; B 20 459 413 737 ;
-C 179 ; WX 549 ; N greaterequal ; B 29 0 526 639 ;
-C 180 ; WX 549 ; N multiply ; B 17 8 533 524 ;
-C 181 ; WX 713 ; N proportional ; B 27 123 639 404 ;
-C 182 ; WX 494 ; N partialdiff ; B 26 -20 462 746 ;
-C 183 ; WX 460 ; N bullet ; B 50 113 410 473 ;
-C 184 ; WX 549 ; N divide ; B 10 71 536 456 ;
-C 185 ; WX 549 ; N notequal ; B 15 -25 540 549 ;
-C 186 ; WX 549 ; N equivalence ; B 14 82 538 443 ;
-C 187 ; WX 549 ; N approxequal ; B 14 135 527 394 ;
-C 188 ; WX 1000 ; N ellipsis ; B 111 -17 889 95 ;
-C 189 ; WX 603 ; N arrowvertex ; B 280 -120 336 1010 ;
-C 190 ; WX 1000 ; N arrowhorizex ; B -60 220 1050 276 ;
-C 191 ; WX 658 ; N carriagereturn ; B 15 -16 602 629 ;
-C 192 ; WX 823 ; N aleph ; B 175 -18 661 658 ;
-C 193 ; WX 686 ; N Ifraktur ; B 10 -53 578 740 ;
-C 194 ; WX 795 ; N Rfraktur ; B 26 -15 759 734 ;
-C 195 ; WX 987 ; N weierstrass ; B 159 -211 870 573 ;
-C 196 ; WX 768 ; N circlemultiply ; B 43 -17 733 673 ;
-C 197 ; WX 768 ; N circleplus ; B 43 -15 733 675 ;
-C 198 ; WX 823 ; N emptyset ; B 39 -24 781 719 ;
-C 199 ; WX 768 ; N intersection ; B 40 0 732 509 ;
-C 200 ; WX 768 ; N union ; B 40 -17 732 492 ;
-C 201 ; WX 713 ; N propersuperset ; B 20 0 673 470 ;
-C 202 ; WX 713 ; N reflexsuperset ; B 20 -125 673 470 ;
-C 203 ; WX 713 ; N notsubset ; B 36 -70 690 540 ;
-C 204 ; WX 713 ; N propersubset ; B 37 0 690 470 ;
-C 205 ; WX 713 ; N reflexsubset ; B 37 -125 690 470 ;
-C 206 ; WX 713 ; N element ; B 45 0 505 468 ;
-C 207 ; WX 713 ; N notelement ; B 45 -58 505 555 ;
-C 208 ; WX 768 ; N angle ; B 26 0 738 673 ;
-C 209 ; WX 713 ; N gradient ; B 36 -19 681 718 ;
-C 210 ; WX 790 ; N registerserif ; B 50 -17 740 673 ;
-C 211 ; WX 790 ; N copyrightserif ; B 51 -15 741 675 ;
-C 212 ; WX 890 ; N trademarkserif ; B 18 293 855 673 ;
-C 213 ; WX 823 ; N product ; B 25 -101 803 751 ;
-C 214 ; WX 549 ; N radical ; B 10 -38 515 917 ;
-C 215 ; WX 250 ; N dotmath ; B 69 210 169 310 ;
-C 216 ; WX 713 ; N logicalnot ; B 15 0 680 288 ;
-C 217 ; WX 603 ; N logicaland ; B 23 0 583 454 ;
-C 218 ; WX 603 ; N logicalor ; B 30 0 578 477 ;
-C 219 ; WX 1042 ; N arrowdblboth ; B 27 -20 1023 510 ;
-C 220 ; WX 987 ; N arrowdblleft ; B 30 -15 939 513 ;
-C 221 ; WX 603 ; N arrowdblup ; B 39 2 567 911 ;
-C 222 ; WX 987 ; N arrowdblright ; B 45 -20 954 508 ;
-C 223 ; WX 603 ; N arrowdbldown ; B 44 -19 572 890 ;
-C 224 ; WX 494 ; N lozenge ; B 18 0 466 745 ;
-C 225 ; WX 329 ; N angleleft ; B 25 -198 306 746 ;
-C 226 ; WX 790 ; N registersans ; B 50 -20 740 670 ;
-C 227 ; WX 790 ; N copyrightsans ; B 49 -15 739 675 ;
-C 228 ; WX 786 ; N trademarksans ; B 5 293 725 673 ;
-C 229 ; WX 713 ; N summation ; B 14 -108 695 752 ;
-C 230 ; WX 384 ; N parenlefttp ; B 24 -293 436 926 ;
-C 231 ; WX 384 ; N parenleftex ; B 24 -85 108 925 ;
-C 232 ; WX 384 ; N parenleftbt ; B 24 -293 436 926 ;
-C 233 ; WX 384 ; N bracketlefttp ; B 0 -80 349 926 ;
-C 234 ; WX 384 ; N bracketleftex ; B 0 -79 77 925 ;
-C 235 ; WX 384 ; N bracketleftbt ; B 0 -80 349 926 ;
-C 236 ; WX 494 ; N bracelefttp ; B 209 -85 445 925 ;
-C 237 ; WX 494 ; N braceleftmid ; B 20 -85 284 935 ;
-C 238 ; WX 494 ; N braceleftbt ; B 209 -75 445 935 ;
-C 239 ; WX 494 ; N braceex ; B 209 -85 284 935 ;
-C 241 ; WX 329 ; N angleright ; B 21 -198 302 746 ;
-C 242 ; WX 274 ; N integral ; B 2 -107 291 916 ;
-C 243 ; WX 686 ; N integraltp ; B 308 -88 675 920 ;
-C 244 ; WX 686 ; N integralex ; B 308 -88 378 975 ;
-C 245 ; WX 686 ; N integralbt ; B 11 -87 378 921 ;
-C 246 ; WX 384 ; N parenrighttp ; B 54 -293 466 926 ;
-C 247 ; WX 384 ; N parenrightex ; B 382 -85 466 925 ;
-C 248 ; WX 384 ; N parenrightbt ; B 54 -293 466 926 ;
-C 249 ; WX 384 ; N bracketrighttp ; B 22 -80 371 926 ;
-C 250 ; WX 384 ; N bracketrightex ; B 294 -79 371 925 ;
-C 251 ; WX 384 ; N bracketrightbt ; B 22 -80 371 926 ;
-C 252 ; WX 494 ; N bracerighttp ; B 48 -85 284 925 ;
-C 253 ; WX 494 ; N bracerightmid ; B 209 -85 473 935 ;
-C 254 ; WX 494 ; N bracerightbt ; B 48 -75 284 935 ;
-C -1 ; WX 790 ; N apple ; B 56 -3 733 808 ;
-EndCharMetrics
-EndFontMetrics
-
diff --git a/LibrarySource/com/lowagie/text/pdf/fonts/Times-Bold.afm b/LibrarySource/com/lowagie/text/pdf/fonts/Times-Bold.afm
deleted file mode 100644
index 188f56e..0000000
--- a/LibrarySource/com/lowagie/text/pdf/fonts/Times-Bold.afm
+++ /dev/null
@@ -1,2589 +0,0 @@
-StartFontMetrics 4.1
-Comment Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
-Comment Creation Date: Thu May 1 12:52:56 1997
-Comment UniqueID 43065
-Comment VMusage 41636 52661
-FontName Times-Bold
-FullName Times Bold
-FamilyName Times
-Weight Bold
-ItalicAngle 0
-IsFixedPitch false
-CharacterSet ExtendedRoman
-FontBBox -168 -218 1000 935
-UnderlinePosition -100
-UnderlineThickness 50
-Version 002.000
-Notice Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.Times is a trademark of Linotype-Hell AG and/or its subsidiaries.
-EncodingScheme AdobeStandardEncoding
-CapHeight 676
-XHeight 461
-Ascender 683
-Descender -217
-StdHW 44
-StdVW 139
-StartCharMetrics 315
-C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
-C 33 ; WX 333 ; N exclam ; B 81 -13 251 691 ;
-C 34 ; WX 555 ; N quotedbl ; B 83 404 472 691 ;
-C 35 ; WX 500 ; N numbersign ; B 4 0 496 700 ;
-C 36 ; WX 500 ; N dollar ; B 29 -99 472 750 ;
-C 37 ; WX 1000 ; N percent ; B 124 -14 877 692 ;
-C 38 ; WX 833 ; N ampersand ; B 62 -16 787 691 ;
-C 39 ; WX 333 ; N quoteright ; B 79 356 263 691 ;
-C 40 ; WX 333 ; N parenleft ; B 46 -168 306 694 ;
-C 41 ; WX 333 ; N parenright ; B 27 -168 287 694 ;
-C 42 ; WX 500 ; N asterisk ; B 56 255 447 691 ;
-C 43 ; WX 570 ; N plus ; B 33 0 537 506 ;
-C 44 ; WX 250 ; N comma ; B 39 -180 223 155 ;
-C 45 ; WX 333 ; N hyphen ; B 44 171 287 287 ;
-C 46 ; WX 250 ; N period ; B 41 -13 210 156 ;
-C 47 ; WX 278 ; N slash ; B -24 -19 302 691 ;
-C 48 ; WX 500 ; N zero ; B 24 -13 476 688 ;
-C 49 ; WX 500 ; N one ; B 65 0 442 688 ;
-C 50 ; WX 500 ; N two ; B 17 0 478 688 ;
-C 51 ; WX 500 ; N three ; B 16 -14 468 688 ;
-C 52 ; WX 500 ; N four ; B 19 0 475 688 ;
-C 53 ; WX 500 ; N five ; B 22 -8 470 676 ;
-C 54 ; WX 500 ; N six ; B 28 -13 475 688 ;
-C 55 ; WX 500 ; N seven ; B 17 0 477 676 ;
-C 56 ; WX 500 ; N eight ; B 28 -13 472 688 ;
-C 57 ; WX 500 ; N nine ; B 26 -13 473 688 ;
-C 58 ; WX 333 ; N colon ; B 82 -13 251 472 ;
-C 59 ; WX 333 ; N semicolon ; B 82 -180 266 472 ;
-C 60 ; WX 570 ; N less ; B 31 -8 539 514 ;
-C 61 ; WX 570 ; N equal ; B 33 107 537 399 ;
-C 62 ; WX 570 ; N greater ; B 31 -8 539 514 ;
-C 63 ; WX 500 ; N question ; B 57 -13 445 689 ;
-C 64 ; WX 930 ; N at ; B 108 -19 822 691 ;
-C 65 ; WX 722 ; N A ; B 9 0 689 690 ;
-C 66 ; WX 667 ; N B ; B 16 0 619 676 ;
-C 67 ; WX 722 ; N C ; B 49 -19 687 691 ;
-C 68 ; WX 722 ; N D ; B 14 0 690 676 ;
-C 69 ; WX 667 ; N E ; B 16 0 641 676 ;
-C 70 ; WX 611 ; N F ; B 16 0 583 676 ;
-C 71 ; WX 778 ; N G ; B 37 -19 755 691 ;
-C 72 ; WX 778 ; N H ; B 21 0 759 676 ;
-C 73 ; WX 389 ; N I ; B 20 0 370 676 ;
-C 74 ; WX 500 ; N J ; B 3 -96 479 676 ;
-C 75 ; WX 778 ; N K ; B 30 0 769 676 ;
-C 76 ; WX 667 ; N L ; B 19 0 638 676 ;
-C 77 ; WX 944 ; N M ; B 14 0 921 676 ;
-C 78 ; WX 722 ; N N ; B 16 -18 701 676 ;
-C 79 ; WX 778 ; N O ; B 35 -19 743 691 ;
-C 80 ; WX 611 ; N P ; B 16 0 600 676 ;
-C 81 ; WX 778 ; N Q ; B 35 -176 743 691 ;
-C 82 ; WX 722 ; N R ; B 26 0 715 676 ;
-C 83 ; WX 556 ; N S ; B 35 -19 513 692 ;
-C 84 ; WX 667 ; N T ; B 31 0 636 676 ;
-C 85 ; WX 722 ; N U ; B 16 -19 701 676 ;
-C 86 ; WX 722 ; N V ; B 16 -18 701 676 ;
-C 87 ; WX 1000 ; N W ; B 19 -15 981 676 ;
-C 88 ; WX 722 ; N X ; B 16 0 699 676 ;
-C 89 ; WX 722 ; N Y ; B 15 0 699 676 ;
-C 90 ; WX 667 ; N Z ; B 28 0 634 676 ;
-C 91 ; WX 333 ; N bracketleft ; B 67 -149 301 678 ;
-C 92 ; WX 278 ; N backslash ; B -25 -19 303 691 ;
-C 93 ; WX 333 ; N bracketright ; B 32 -149 266 678 ;
-C 94 ; WX 581 ; N asciicircum ; B 73 311 509 676 ;
-C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
-C 96 ; WX 333 ; N quoteleft ; B 70 356 254 691 ;
-C 97 ; WX 500 ; N a ; B 25 -14 488 473 ;
-C 98 ; WX 556 ; N b ; B 17 -14 521 676 ;
-C 99 ; WX 444 ; N c ; B 25 -14 430 473 ;
-C 100 ; WX 556 ; N d ; B 25 -14 534 676 ;
-C 101 ; WX 444 ; N e ; B 25 -14 426 473 ;
-C 102 ; WX 333 ; N f ; B 14 0 389 691 ; L i fi ; L l fl ;
-C 103 ; WX 500 ; N g ; B 28 -206 483 473 ;
-C 104 ; WX 556 ; N h ; B 16 0 534 676 ;
-C 105 ; WX 278 ; N i ; B 16 0 255 691 ;
-C 106 ; WX 333 ; N j ; B -57 -203 263 691 ;
-C 107 ; WX 556 ; N k ; B 22 0 543 676 ;
-C 108 ; WX 278 ; N l ; B 16 0 255 676 ;
-C 109 ; WX 833 ; N m ; B 16 0 814 473 ;
-C 110 ; WX 556 ; N n ; B 21 0 539 473 ;
-C 111 ; WX 500 ; N o ; B 25 -14 476 473 ;
-C 112 ; WX 556 ; N p ; B 19 -205 524 473 ;
-C 113 ; WX 556 ; N q ; B 34 -205 536 473 ;
-C 114 ; WX 444 ; N r ; B 29 0 434 473 ;
-C 115 ; WX 389 ; N s ; B 25 -14 361 473 ;
-C 116 ; WX 333 ; N t ; B 20 -12 332 630 ;
-C 117 ; WX 556 ; N u ; B 16 -14 537 461 ;
-C 118 ; WX 500 ; N v ; B 21 -14 485 461 ;
-C 119 ; WX 722 ; N w ; B 23 -14 707 461 ;
-C 120 ; WX 500 ; N x ; B 12 0 484 461 ;
-C 121 ; WX 500 ; N y ; B 16 -205 480 461 ;
-C 122 ; WX 444 ; N z ; B 21 0 420 461 ;
-C 123 ; WX 394 ; N braceleft ; B 22 -175 340 698 ;
-C 124 ; WX 220 ; N bar ; B 66 -218 154 782 ;
-C 125 ; WX 394 ; N braceright ; B 54 -175 372 698 ;
-C 126 ; WX 520 ; N asciitilde ; B 29 173 491 333 ;
-C 161 ; WX 333 ; N exclamdown ; B 82 -203 252 501 ;
-C 162 ; WX 500 ; N cent ; B 53 -140 458 588 ;
-C 163 ; WX 500 ; N sterling ; B 21 -14 477 684 ;
-C 164 ; WX 167 ; N fraction ; B -168 -12 329 688 ;
-C 165 ; WX 500 ; N yen ; B -64 0 547 676 ;
-C 166 ; WX 500 ; N florin ; B 0 -155 498 706 ;
-C 167 ; WX 500 ; N section ; B 57 -132 443 691 ;
-C 168 ; WX 500 ; N currency ; B -26 61 526 613 ;
-C 169 ; WX 278 ; N quotesingle ; B 75 404 204 691 ;
-C 170 ; WX 500 ; N quotedblleft ; B 32 356 486 691 ;
-C 171 ; WX 500 ; N guillemotleft ; B 23 36 473 415 ;
-C 172 ; WX 333 ; N guilsinglleft ; B 51 36 305 415 ;
-C 173 ; WX 333 ; N guilsinglright ; B 28 36 282 415 ;
-C 174 ; WX 556 ; N fi ; B 14 0 536 691 ;
-C 175 ; WX 556 ; N fl ; B 14 0 536 691 ;
-C 177 ; WX 500 ; N endash ; B 0 181 500 271 ;
-C 178 ; WX 500 ; N dagger ; B 47 -134 453 691 ;
-C 179 ; WX 500 ; N daggerdbl ; B 45 -132 456 691 ;
-C 180 ; WX 250 ; N periodcentered ; B 41 248 210 417 ;
-C 182 ; WX 540 ; N paragraph ; B 0 -186 519 676 ;
-C 183 ; WX 350 ; N bullet ; B 35 198 315 478 ;
-C 184 ; WX 333 ; N quotesinglbase ; B 79 -180 263 155 ;
-C 185 ; WX 500 ; N quotedblbase ; B 14 -180 468 155 ;
-C 186 ; WX 500 ; N quotedblright ; B 14 356 468 691 ;
-C 187 ; WX 500 ; N guillemotright ; B 27 36 477 415 ;
-C 188 ; WX 1000 ; N ellipsis ; B 82 -13 917 156 ;
-C 189 ; WX 1000 ; N perthousand ; B 7 -29 995 706 ;
-C 191 ; WX 500 ; N questiondown ; B 55 -201 443 501 ;
-C 193 ; WX 333 ; N grave ; B 8 528 246 713 ;
-C 194 ; WX 333 ; N acute ; B 86 528 324 713 ;
-C 195 ; WX 333 ; N circumflex ; B -2 528 335 704 ;
-C 196 ; WX 333 ; N tilde ; B -16 547 349 674 ;
-C 197 ; WX 333 ; N macron ; B 1 565 331 637 ;
-C 198 ; WX 333 ; N breve ; B 15 528 318 691 ;
-C 199 ; WX 333 ; N dotaccent ; B 103 536 258 691 ;
-C 200 ; WX 333 ; N dieresis ; B -2 537 335 667 ;
-C 202 ; WX 333 ; N ring ; B 60 527 273 740 ;
-C 203 ; WX 333 ; N cedilla ; B 68 -218 294 0 ;
-C 205 ; WX 333 ; N hungarumlaut ; B -13 528 425 713 ;
-C 206 ; WX 333 ; N ogonek ; B 90 -193 319 24 ;
-C 207 ; WX 333 ; N caron ; B -2 528 335 704 ;
-C 208 ; WX 1000 ; N emdash ; B 0 181 1000 271 ;
-C 225 ; WX 1000 ; N AE ; B 4 0 951 676 ;
-C 227 ; WX 300 ; N ordfeminine ; B -1 397 301 688 ;
-C 232 ; WX 667 ; N Lslash ; B 19 0 638 676 ;
-C 233 ; WX 778 ; N Oslash ; B 35 -74 743 737 ;
-C 234 ; WX 1000 ; N OE ; B 22 -5 981 684 ;
-C 235 ; WX 330 ; N ordmasculine ; B 18 397 312 688 ;
-C 241 ; WX 722 ; N ae ; B 33 -14 693 473 ;
-C 245 ; WX 278 ; N dotlessi ; B 16 0 255 461 ;
-C 248 ; WX 278 ; N lslash ; B -22 0 303 676 ;
-C 249 ; WX 500 ; N oslash ; B 25 -92 476 549 ;
-C 250 ; WX 722 ; N oe ; B 22 -14 696 473 ;
-C 251 ; WX 556 ; N germandbls ; B 19 -12 517 691 ;
-C -1 ; WX 389 ; N Idieresis ; B 20 0 370 877 ;
-C -1 ; WX 444 ; N eacute ; B 25 -14 426 713 ;
-C -1 ; WX 500 ; N abreve ; B 25 -14 488 691 ;
-C -1 ; WX 556 ; N uhungarumlaut ; B 16 -14 557 713 ;
-C -1 ; WX 444 ; N ecaron ; B 25 -14 426 704 ;
-C -1 ; WX 722 ; N Ydieresis ; B 15 0 699 877 ;
-C -1 ; WX 570 ; N divide ; B 33 -31 537 537 ;
-C -1 ; WX 722 ; N Yacute ; B 15 0 699 923 ;
-C -1 ; WX 722 ; N Acircumflex ; B 9 0 689 914 ;
-C -1 ; WX 500 ; N aacute ; B 25 -14 488 713 ;
-C -1 ; WX 722 ; N Ucircumflex ; B 16 -19 701 914 ;
-C -1 ; WX 500 ; N yacute ; B 16 -205 480 713 ;
-C -1 ; WX 389 ; N scommaaccent ; B 25 -218 361 473 ;
-C -1 ; WX 444 ; N ecircumflex ; B 25 -14 426 704 ;
-C -1 ; WX 722 ; N Uring ; B 16 -19 701 935 ;
-C -1 ; WX 722 ; N Udieresis ; B 16 -19 701 877 ;
-C -1 ; WX 500 ; N aogonek ; B 25 -193 504 473 ;
-C -1 ; WX 722 ; N Uacute ; B 16 -19 701 923 ;
-C -1 ; WX 556 ; N uogonek ; B 16 -193 539 461 ;
-C -1 ; WX 667 ; N Edieresis ; B 16 0 641 877 ;
-C -1 ; WX 722 ; N Dcroat ; B 6 0 690 676 ;
-C -1 ; WX 250 ; N commaaccent ; B 47 -218 203 -50 ;
-C -1 ; WX 747 ; N copyright ; B 26 -19 721 691 ;
-C -1 ; WX 667 ; N Emacron ; B 16 0 641 847 ;
-C -1 ; WX 444 ; N ccaron ; B 25 -14 430 704 ;
-C -1 ; WX 500 ; N aring ; B 25 -14 488 740 ;
-C -1 ; WX 722 ; N Ncommaaccent ; B 16 -188 701 676 ;
-C -1 ; WX 278 ; N lacute ; B 16 0 297 923 ;
-C -1 ; WX 500 ; N agrave ; B 25 -14 488 713 ;
-C -1 ; WX 667 ; N Tcommaaccent ; B 31 -218 636 676 ;
-C -1 ; WX 722 ; N Cacute ; B 49 -19 687 923 ;
-C -1 ; WX 500 ; N atilde ; B 25 -14 488 674 ;
-C -1 ; WX 667 ; N Edotaccent ; B 16 0 641 901 ;
-C -1 ; WX 389 ; N scaron ; B 25 -14 363 704 ;
-C -1 ; WX 389 ; N scedilla ; B 25 -218 361 473 ;
-C -1 ; WX 278 ; N iacute ; B 16 0 289 713 ;
-C -1 ; WX 494 ; N lozenge ; B 10 0 484 745 ;
-C -1 ; WX 722 ; N Rcaron ; B 26 0 715 914 ;
-C -1 ; WX 778 ; N Gcommaaccent ; B 37 -218 755 691 ;
-C -1 ; WX 556 ; N ucircumflex ; B 16 -14 537 704 ;
-C -1 ; WX 500 ; N acircumflex ; B 25 -14 488 704 ;
-C -1 ; WX 722 ; N Amacron ; B 9 0 689 847 ;
-C -1 ; WX 444 ; N rcaron ; B 29 0 434 704 ;
-C -1 ; WX 444 ; N ccedilla ; B 25 -218 430 473 ;
-C -1 ; WX 667 ; N Zdotaccent ; B 28 0 634 901 ;
-C -1 ; WX 611 ; N Thorn ; B 16 0 600 676 ;
-C -1 ; WX 778 ; N Omacron ; B 35 -19 743 847 ;
-C -1 ; WX 722 ; N Racute ; B 26 0 715 923 ;
-C -1 ; WX 556 ; N Sacute ; B 35 -19 513 923 ;
-C -1 ; WX 672 ; N dcaron ; B 25 -14 681 682 ;
-C -1 ; WX 722 ; N Umacron ; B 16 -19 701 847 ;
-C -1 ; WX 556 ; N uring ; B 16 -14 537 740 ;
-C -1 ; WX 300 ; N threesuperior ; B 3 268 297 688 ;
-C -1 ; WX 778 ; N Ograve ; B 35 -19 743 923 ;
-C -1 ; WX 722 ; N Agrave ; B 9 0 689 923 ;
-C -1 ; WX 722 ; N Abreve ; B 9 0 689 901 ;
-C -1 ; WX 570 ; N multiply ; B 48 16 522 490 ;
-C -1 ; WX 556 ; N uacute ; B 16 -14 537 713 ;
-C -1 ; WX 667 ; N Tcaron ; B 31 0 636 914 ;
-C -1 ; WX 494 ; N partialdiff ; B 11 -21 494 750 ;
-C -1 ; WX 500 ; N ydieresis ; B 16 -205 480 667 ;
-C -1 ; WX 722 ; N Nacute ; B 16 -18 701 923 ;
-C -1 ; WX 278 ; N icircumflex ; B -37 0 300 704 ;
-C -1 ; WX 667 ; N Ecircumflex ; B 16 0 641 914 ;
-C -1 ; WX 500 ; N adieresis ; B 25 -14 488 667 ;
-C -1 ; WX 444 ; N edieresis ; B 25 -14 426 667 ;
-C -1 ; WX 444 ; N cacute ; B 25 -14 430 713 ;
-C -1 ; WX 556 ; N nacute ; B 21 0 539 713 ;
-C -1 ; WX 556 ; N umacron ; B 16 -14 537 637 ;
-C -1 ; WX 722 ; N Ncaron ; B 16 -18 701 914 ;
-C -1 ; WX 389 ; N Iacute ; B 20 0 370 923 ;
-C -1 ; WX 570 ; N plusminus ; B 33 0 537 506 ;
-C -1 ; WX 220 ; N brokenbar ; B 66 -143 154 707 ;
-C -1 ; WX 747 ; N registered ; B 26 -19 721 691 ;
-C -1 ; WX 778 ; N Gbreve ; B 37 -19 755 901 ;
-C -1 ; WX 389 ; N Idotaccent ; B 20 0 370 901 ;
-C -1 ; WX 600 ; N summation ; B 14 -10 585 706 ;
-C -1 ; WX 667 ; N Egrave ; B 16 0 641 923 ;
-C -1 ; WX 444 ; N racute ; B 29 0 434 713 ;
-C -1 ; WX 500 ; N omacron ; B 25 -14 476 637 ;
-C -1 ; WX 667 ; N Zacute ; B 28 0 634 923 ;
-C -1 ; WX 667 ; N Zcaron ; B 28 0 634 914 ;
-C -1 ; WX 549 ; N greaterequal ; B 26 0 523 704 ;
-C -1 ; WX 722 ; N Eth ; B 6 0 690 676 ;
-C -1 ; WX 722 ; N Ccedilla ; B 49 -218 687 691 ;
-C -1 ; WX 278 ; N lcommaaccent ; B 16 -218 255 676 ;
-C -1 ; WX 416 ; N tcaron ; B 20 -12 425 815 ;
-C -1 ; WX 444 ; N eogonek ; B 25 -193 426 473 ;
-C -1 ; WX 722 ; N Uogonek ; B 16 -193 701 676 ;
-C -1 ; WX 722 ; N Aacute ; B 9 0 689 923 ;
-C -1 ; WX 722 ; N Adieresis ; B 9 0 689 877 ;
-C -1 ; WX 444 ; N egrave ; B 25 -14 426 713 ;
-C -1 ; WX 444 ; N zacute ; B 21 0 420 713 ;
-C -1 ; WX 278 ; N iogonek ; B 16 -193 274 691 ;
-C -1 ; WX 778 ; N Oacute ; B 35 -19 743 923 ;
-C -1 ; WX 500 ; N oacute ; B 25 -14 476 713 ;
-C -1 ; WX 500 ; N amacron ; B 25 -14 488 637 ;
-C -1 ; WX 389 ; N sacute ; B 25 -14 361 713 ;
-C -1 ; WX 278 ; N idieresis ; B -37 0 300 667 ;
-C -1 ; WX 778 ; N Ocircumflex ; B 35 -19 743 914 ;
-C -1 ; WX 722 ; N Ugrave ; B 16 -19 701 923 ;
-C -1 ; WX 612 ; N Delta ; B 6 0 608 688 ;
-C -1 ; WX 556 ; N thorn ; B 19 -205 524 676 ;
-C -1 ; WX 300 ; N twosuperior ; B 0 275 300 688 ;
-C -1 ; WX 778 ; N Odieresis ; B 35 -19 743 877 ;
-C -1 ; WX 556 ; N mu ; B 33 -206 536 461 ;
-C -1 ; WX 278 ; N igrave ; B -27 0 255 713 ;
-C -1 ; WX 500 ; N ohungarumlaut ; B 25 -14 529 713 ;
-C -1 ; WX 667 ; N Eogonek ; B 16 -193 644 676 ;
-C -1 ; WX 556 ; N dcroat ; B 25 -14 534 676 ;
-C -1 ; WX 750 ; N threequarters ; B 23 -12 733 688 ;
-C -1 ; WX 556 ; N Scedilla ; B 35 -218 513 692 ;
-C -1 ; WX 394 ; N lcaron ; B 16 0 412 682 ;
-C -1 ; WX 778 ; N Kcommaaccent ; B 30 -218 769 676 ;
-C -1 ; WX 667 ; N Lacute ; B 19 0 638 923 ;
-C -1 ; WX 1000 ; N trademark ; B 24 271 977 676 ;
-C -1 ; WX 444 ; N edotaccent ; B 25 -14 426 691 ;
-C -1 ; WX 389 ; N Igrave ; B 20 0 370 923 ;
-C -1 ; WX 389 ; N Imacron ; B 20 0 370 847 ;
-C -1 ; WX 667 ; N Lcaron ; B 19 0 652 682 ;
-C -1 ; WX 750 ; N onehalf ; B -7 -12 775 688 ;
-C -1 ; WX 549 ; N lessequal ; B 29 0 526 704 ;
-C -1 ; WX 500 ; N ocircumflex ; B 25 -14 476 704 ;
-C -1 ; WX 556 ; N ntilde ; B 21 0 539 674 ;
-C -1 ; WX 722 ; N Uhungarumlaut ; B 16 -19 701 923 ;
-C -1 ; WX 667 ; N Eacute ; B 16 0 641 923 ;
-C -1 ; WX 444 ; N emacron ; B 25 -14 426 637 ;
-C -1 ; WX 500 ; N gbreve ; B 28 -206 483 691 ;
-C -1 ; WX 750 ; N onequarter ; B 28 -12 743 688 ;
-C -1 ; WX 556 ; N Scaron ; B 35 -19 513 914 ;
-C -1 ; WX 556 ; N Scommaaccent ; B 35 -218 513 692 ;
-C -1 ; WX 778 ; N Ohungarumlaut ; B 35 -19 743 923 ;
-C -1 ; WX 400 ; N degree ; B 57 402 343 688 ;
-C -1 ; WX 500 ; N ograve ; B 25 -14 476 713 ;
-C -1 ; WX 722 ; N Ccaron ; B 49 -19 687 914 ;
-C -1 ; WX 556 ; N ugrave ; B 16 -14 537 713 ;
-C -1 ; WX 549 ; N radical ; B 10 -46 512 850 ;
-C -1 ; WX 722 ; N Dcaron ; B 14 0 690 914 ;
-C -1 ; WX 444 ; N rcommaaccent ; B 29 -218 434 473 ;
-C -1 ; WX 722 ; N Ntilde ; B 16 -18 701 884 ;
-C -1 ; WX 500 ; N otilde ; B 25 -14 476 674 ;
-C -1 ; WX 722 ; N Rcommaaccent ; B 26 -218 715 676 ;
-C -1 ; WX 667 ; N Lcommaaccent ; B 19 -218 638 676 ;
-C -1 ; WX 722 ; N Atilde ; B 9 0 689 884 ;
-C -1 ; WX 722 ; N Aogonek ; B 9 -193 699 690 ;
-C -1 ; WX 722 ; N Aring ; B 9 0 689 935 ;
-C -1 ; WX 778 ; N Otilde ; B 35 -19 743 884 ;
-C -1 ; WX 444 ; N zdotaccent ; B 21 0 420 691 ;
-C -1 ; WX 667 ; N Ecaron ; B 16 0 641 914 ;
-C -1 ; WX 389 ; N Iogonek ; B 20 -193 370 676 ;
-C -1 ; WX 556 ; N kcommaaccent ; B 22 -218 543 676 ;
-C -1 ; WX 570 ; N minus ; B 33 209 537 297 ;
-C -1 ; WX 389 ; N Icircumflex ; B 20 0 370 914 ;
-C -1 ; WX 556 ; N ncaron ; B 21 0 539 704 ;
-C -1 ; WX 333 ; N tcommaaccent ; B 20 -218 332 630 ;
-C -1 ; WX 570 ; N logicalnot ; B 33 108 537 399 ;
-C -1 ; WX 500 ; N odieresis ; B 25 -14 476 667 ;
-C -1 ; WX 556 ; N udieresis ; B 16 -14 537 667 ;
-C -1 ; WX 549 ; N notequal ; B 15 -49 540 570 ;
-C -1 ; WX 500 ; N gcommaaccent ; B 28 -206 483 829 ;
-C -1 ; WX 500 ; N eth ; B 25 -14 476 691 ;
-C -1 ; WX 444 ; N zcaron ; B 21 0 420 704 ;
-C -1 ; WX 556 ; N ncommaaccent ; B 21 -218 539 473 ;
-C -1 ; WX 300 ; N onesuperior ; B 28 275 273 688 ;
-C -1 ; WX 278 ; N imacron ; B -8 0 272 637 ;
-C -1 ; WX 500 ; N Euro ; B 0 0 0 0 ;
-EndCharMetrics
-StartKernData
-StartKernPairs 2242
-KPX A C -55
-KPX A Cacute -55
-KPX A Ccaron -55
-KPX A Ccedilla -55
-KPX A G -55
-KPX A Gbreve -55
-KPX A Gcommaaccent -55
-KPX A O -45
-KPX A Oacute -45
-KPX A Ocircumflex -45
-KPX A Odieresis -45
-KPX A Ograve -45
-KPX A Ohungarumlaut -45
-KPX A Omacron -45
-KPX A Oslash -45
-KPX A Otilde -45
-KPX A Q -45
-KPX A T -95
-KPX A Tcaron -95
-KPX A Tcommaaccent -95
-KPX A U -50
-KPX A Uacute -50
-KPX A Ucircumflex -50
-KPX A Udieresis -50
-KPX A Ugrave -50
-KPX A Uhungarumlaut -50
-KPX A Umacron -50
-KPX A Uogonek -50
-KPX A Uring -50
-KPX A V -145
-KPX A W -130
-KPX A Y -100
-KPX A Yacute -100
-KPX A Ydieresis -100
-KPX A p -25
-KPX A quoteright -74
-KPX A u -50
-KPX A uacute -50
-KPX A ucircumflex -50
-KPX A udieresis -50
-KPX A ugrave -50
-KPX A uhungarumlaut -50
-KPX A umacron -50
-KPX A uogonek -50
-KPX A uring -50
-KPX A v -100
-KPX A w -90
-KPX A y -74
-KPX A yacute -74
-KPX A ydieresis -74
-KPX Aacute C -55
-KPX Aacute Cacute -55
-KPX Aacute Ccaron -55
-KPX Aacute Ccedilla -55
-KPX Aacute G -55
-KPX Aacute Gbreve -55
-KPX Aacute Gcommaaccent -55
-KPX Aacute O -45
-KPX Aacute Oacute -45
-KPX Aacute Ocircumflex -45
-KPX Aacute Odieresis -45
-KPX Aacute Ograve -45
-KPX Aacute Ohungarumlaut -45
-KPX Aacute Omacron -45
-KPX Aacute Oslash -45
-KPX Aacute Otilde -45
-KPX Aacute Q -45
-KPX Aacute T -95
-KPX Aacute Tcaron -95
-KPX Aacute Tcommaaccent -95
-KPX Aacute U -50
-KPX Aacute Uacute -50
-KPX Aacute Ucircumflex -50
-KPX Aacute Udieresis -50
-KPX Aacute Ugrave -50
-KPX Aacute Uhungarumlaut -50
-KPX Aacute Umacron -50
-KPX Aacute Uogonek -50
-KPX Aacute Uring -50
-KPX Aacute V -145
-KPX Aacute W -130
-KPX Aacute Y -100
-KPX Aacute Yacute -100
-KPX Aacute Ydieresis -100
-KPX Aacute p -25
-KPX Aacute quoteright -74
-KPX Aacute u -50
-KPX Aacute uacute -50
-KPX Aacute ucircumflex -50
-KPX Aacute udieresis -50
-KPX Aacute ugrave -50
-KPX Aacute uhungarumlaut -50
-KPX Aacute umacron -50
-KPX Aacute uogonek -50
-KPX Aacute uring -50
-KPX Aacute v -100
-KPX Aacute w -90
-KPX Aacute y -74
-KPX Aacute yacute -74
-KPX Aacute ydieresis -74
-KPX Abreve C -55
-KPX Abreve Cacute -55
-KPX Abreve Ccaron -55
-KPX Abreve Ccedilla -55
-KPX Abreve G -55
-KPX Abreve Gbreve -55
-KPX Abreve Gcommaaccent -55
-KPX Abreve O -45
-KPX Abreve Oacute -45
-KPX Abreve Ocircumflex -45
-KPX Abreve Odieresis -45
-KPX Abreve Ograve -45
-KPX Abreve Ohungarumlaut -45
-KPX Abreve Omacron -45
-KPX Abreve Oslash -45
-KPX Abreve Otilde -45
-KPX Abreve Q -45
-KPX Abreve T -95
-KPX Abreve Tcaron -95
-KPX Abreve Tcommaaccent -95
-KPX Abreve U -50
-KPX Abreve Uacute -50
-KPX Abreve Ucircumflex -50
-KPX Abreve Udieresis -50
-KPX Abreve Ugrave -50
-KPX Abreve Uhungarumlaut -50
-KPX Abreve Umacron -50
-KPX Abreve Uogonek -50
-KPX Abreve Uring -50
-KPX Abreve V -145
-KPX Abreve W -130
-KPX Abreve Y -100
-KPX Abreve Yacute -100
-KPX Abreve Ydieresis -100
-KPX Abreve p -25
-KPX Abreve quoteright -74
-KPX Abreve u -50
-KPX Abreve uacute -50
-KPX Abreve ucircumflex -50
-KPX Abreve udieresis -50
-KPX Abreve ugrave -50
-KPX Abreve uhungarumlaut -50
-KPX Abreve umacron -50
-KPX Abreve uogonek -50
-KPX Abreve uring -50
-KPX Abreve v -100
-KPX Abreve w -90
-KPX Abreve y -74
-KPX Abreve yacute -74
-KPX Abreve ydieresis -74
-KPX Acircumflex C -55
-KPX Acircumflex Cacute -55
-KPX Acircumflex Ccaron -55
-KPX Acircumflex Ccedilla -55
-KPX Acircumflex G -55
-KPX Acircumflex Gbreve -55
-KPX Acircumflex Gcommaaccent -55
-KPX Acircumflex O -45
-KPX Acircumflex Oacute -45
-KPX Acircumflex Ocircumflex -45
-KPX Acircumflex Odieresis -45
-KPX Acircumflex Ograve -45
-KPX Acircumflex Ohungarumlaut -45
-KPX Acircumflex Omacron -45
-KPX Acircumflex Oslash -45
-KPX Acircumflex Otilde -45
-KPX Acircumflex Q -45
-KPX Acircumflex T -95
-KPX Acircumflex Tcaron -95
-KPX Acircumflex Tcommaaccent -95
-KPX Acircumflex U -50
-KPX Acircumflex Uacute -50
-KPX Acircumflex Ucircumflex -50
-KPX Acircumflex Udieresis -50
-KPX Acircumflex Ugrave -50
-KPX Acircumflex Uhungarumlaut -50
-KPX Acircumflex Umacron -50
-KPX Acircumflex Uogonek -50
-KPX Acircumflex Uring -50
-KPX Acircumflex V -145
-KPX Acircumflex W -130
-KPX Acircumflex Y -100
-KPX Acircumflex Yacute -100
-KPX Acircumflex Ydieresis -100
-KPX Acircumflex p -25
-KPX Acircumflex quoteright -74
-KPX Acircumflex u -50
-KPX Acircumflex uacute -50
-KPX Acircumflex ucircumflex -50
-KPX Acircumflex udieresis -50
-KPX Acircumflex ugrave -50
-KPX Acircumflex uhungarumlaut -50
-KPX Acircumflex umacron -50
-KPX Acircumflex uogonek -50
-KPX Acircumflex uring -50
-KPX Acircumflex v -100
-KPX Acircumflex w -90
-KPX Acircumflex y -74
-KPX Acircumflex yacute -74
-KPX Acircumflex ydieresis -74
-KPX Adieresis C -55
-KPX Adieresis Cacute -55
-KPX Adieresis Ccaron -55
-KPX Adieresis Ccedilla -55
-KPX Adieresis G -55
-KPX Adieresis Gbreve -55
-KPX Adieresis Gcommaaccent -55
-KPX Adieresis O -45
-KPX Adieresis Oacute -45
-KPX Adieresis Ocircumflex -45
-KPX Adieresis Odieresis -45
-KPX Adieresis Ograve -45
-KPX Adieresis Ohungarumlaut -45
-KPX Adieresis Omacron -45
-KPX Adieresis Oslash -45
-KPX Adieresis Otilde -45
-KPX Adieresis Q -45
-KPX Adieresis T -95
-KPX Adieresis Tcaron -95
-KPX Adieresis Tcommaaccent -95
-KPX Adieresis U -50
-KPX Adieresis Uacute -50
-KPX Adieresis Ucircumflex -50
-KPX Adieresis Udieresis -50
-KPX Adieresis Ugrave -50
-KPX Adieresis Uhungarumlaut -50
-KPX Adieresis Umacron -50
-KPX Adieresis Uogonek -50
-KPX Adieresis Uring -50
-KPX Adieresis V -145
-KPX Adieresis W -130
-KPX Adieresis Y -100
-KPX Adieresis Yacute -100
-KPX Adieresis Ydieresis -100
-KPX Adieresis p -25
-KPX Adieresis quoteright -74
-KPX Adieresis u -50
-KPX Adieresis uacute -50
-KPX Adieresis ucircumflex -50
-KPX Adieresis udieresis -50
-KPX Adieresis ugrave -50
-KPX Adieresis uhungarumlaut -50
-KPX Adieresis umacron -50
-KPX Adieresis uogonek -50
-KPX Adieresis uring -50
-KPX Adieresis v -100
-KPX Adieresis w -90
-KPX Adieresis y -74
-KPX Adieresis yacute -74
-KPX Adieresis ydieresis -74
-KPX Agrave C -55
-KPX Agrave Cacute -55
-KPX Agrave Ccaron -55
-KPX Agrave Ccedilla -55
-KPX Agrave G -55
-KPX Agrave Gbreve -55
-KPX Agrave Gcommaaccent -55
-KPX Agrave O -45
-KPX Agrave Oacute -45
-KPX Agrave Ocircumflex -45
-KPX Agrave Odieresis -45
-KPX Agrave Ograve -45
-KPX Agrave Ohungarumlaut -45
-KPX Agrave Omacron -45
-KPX Agrave Oslash -45
-KPX Agrave Otilde -45
-KPX Agrave Q -45
-KPX Agrave T -95
-KPX Agrave Tcaron -95
-KPX Agrave Tcommaaccent -95
-KPX Agrave U -50
-KPX Agrave Uacute -50
-KPX Agrave Ucircumflex -50
-KPX Agrave Udieresis -50
-KPX Agrave Ugrave -50
-KPX Agrave Uhungarumlaut -50
-KPX Agrave Umacron -50
-KPX Agrave Uogonek -50
-KPX Agrave Uring -50
-KPX Agrave V -145
-KPX Agrave W -130
-KPX Agrave Y -100
-KPX Agrave Yacute -100
-KPX Agrave Ydieresis -100
-KPX Agrave p -25
-KPX Agrave quoteright -74
-KPX Agrave u -50
-KPX Agrave uacute -50
-KPX Agrave ucircumflex -50
-KPX Agrave udieresis -50
-KPX Agrave ugrave -50
-KPX Agrave uhungarumlaut -50
-KPX Agrave umacron -50
-KPX Agrave uogonek -50
-KPX Agrave uring -50
-KPX Agrave v -100
-KPX Agrave w -90
-KPX Agrave y -74
-KPX Agrave yacute -74
-KPX Agrave ydieresis -74
-KPX Amacron C -55
-KPX Amacron Cacute -55
-KPX Amacron Ccaron -55
-KPX Amacron Ccedilla -55
-KPX Amacron G -55
-KPX Amacron Gbreve -55
-KPX Amacron Gcommaaccent -55
-KPX Amacron O -45
-KPX Amacron Oacute -45
-KPX Amacron Ocircumflex -45
-KPX Amacron Odieresis -45
-KPX Amacron Ograve -45
-KPX Amacron Ohungarumlaut -45
-KPX Amacron Omacron -45
-KPX Amacron Oslash -45
-KPX Amacron Otilde -45
-KPX Amacron Q -45
-KPX Amacron T -95
-KPX Amacron Tcaron -95
-KPX Amacron Tcommaaccent -95
-KPX Amacron U -50
-KPX Amacron Uacute -50
-KPX Amacron Ucircumflex -50
-KPX Amacron Udieresis -50
-KPX Amacron Ugrave -50
-KPX Amacron Uhungarumlaut -50
-KPX Amacron Umacron -50
-KPX Amacron Uogonek -50
-KPX Amacron Uring -50
-KPX Amacron V -145
-KPX Amacron W -130
-KPX Amacron Y -100
-KPX Amacron Yacute -100
-KPX Amacron Ydieresis -100
-KPX Amacron p -25
-KPX Amacron quoteright -74
-KPX Amacron u -50
-KPX Amacron uacute -50
-KPX Amacron ucircumflex -50
-KPX Amacron udieresis -50
-KPX Amacron ugrave -50
-KPX Amacron uhungarumlaut -50
-KPX Amacron umacron -50
-KPX Amacron uogonek -50
-KPX Amacron uring -50
-KPX Amacron v -100
-KPX Amacron w -90
-KPX Amacron y -74
-KPX Amacron yacute -74
-KPX Amacron ydieresis -74
-KPX Aogonek C -55
-KPX Aogonek Cacute -55
-KPX Aogonek Ccaron -55
-KPX Aogonek Ccedilla -55
-KPX Aogonek G -55
-KPX Aogonek Gbreve -55
-KPX Aogonek Gcommaaccent -55
-KPX Aogonek O -45
-KPX Aogonek Oacute -45
-KPX Aogonek Ocircumflex -45
-KPX Aogonek Odieresis -45
-KPX Aogonek Ograve -45
-KPX Aogonek Ohungarumlaut -45
-KPX Aogonek Omacron -45
-KPX Aogonek Oslash -45
-KPX Aogonek Otilde -45
-KPX Aogonek Q -45
-KPX Aogonek T -95
-KPX Aogonek Tcaron -95
-KPX Aogonek Tcommaaccent -95
-KPX Aogonek U -50
-KPX Aogonek Uacute -50
-KPX Aogonek Ucircumflex -50
-KPX Aogonek Udieresis -50
-KPX Aogonek Ugrave -50
-KPX Aogonek Uhungarumlaut -50
-KPX Aogonek Umacron -50
-KPX Aogonek Uogonek -50
-KPX Aogonek Uring -50
-KPX Aogonek V -145
-KPX Aogonek W -130
-KPX Aogonek Y -100
-KPX Aogonek Yacute -100
-KPX Aogonek Ydieresis -100
-KPX Aogonek p -25
-KPX Aogonek quoteright -74
-KPX Aogonek u -50
-KPX Aogonek uacute -50
-KPX Aogonek ucircumflex -50
-KPX Aogonek udieresis -50
-KPX Aogonek ugrave -50
-KPX Aogonek uhungarumlaut -50
-KPX Aogonek umacron -50
-KPX Aogonek uogonek -50
-KPX Aogonek uring -50
-KPX Aogonek v -100
-KPX Aogonek w -90
-KPX Aogonek y -34
-KPX Aogonek yacute -34
-KPX Aogonek ydieresis -34
-KPX Aring C -55
-KPX Aring Cacute -55
-KPX Aring Ccaron -55
-KPX Aring Ccedilla -55
-KPX Aring G -55
-KPX Aring Gbreve -55
-KPX Aring Gcommaaccent -55
-KPX Aring O -45
-KPX Aring Oacute -45
-KPX Aring Ocircumflex -45
-KPX Aring Odieresis -45
-KPX Aring Ograve -45
-KPX Aring Ohungarumlaut -45
-KPX Aring Omacron -45
-KPX Aring Oslash -45
-KPX Aring Otilde -45
-KPX Aring Q -45
-KPX Aring T -95
-KPX Aring Tcaron -95
-KPX Aring Tcommaaccent -95
-KPX Aring U -50
-KPX Aring Uacute -50
-KPX Aring Ucircumflex -50
-KPX Aring Udieresis -50
-KPX Aring Ugrave -50
-KPX Aring Uhungarumlaut -50
-KPX Aring Umacron -50
-KPX Aring Uogonek -50
-KPX Aring Uring -50
-KPX Aring V -145
-KPX Aring W -130
-KPX Aring Y -100
-KPX Aring Yacute -100
-KPX Aring Ydieresis -100
-KPX Aring p -25
-KPX Aring quoteright -74
-KPX Aring u -50
-KPX Aring uacute -50
-KPX Aring ucircumflex -50
-KPX Aring udieresis -50
-KPX Aring ugrave -50
-KPX Aring uhungarumlaut -50
-KPX Aring umacron -50
-KPX Aring uogonek -50
-KPX Aring uring -50
-KPX Aring v -100
-KPX Aring w -90
-KPX Aring y -74
-KPX Aring yacute -74
-KPX Aring ydieresis -74
-KPX Atilde C -55
-KPX Atilde Cacute -55
-KPX Atilde Ccaron -55
-KPX Atilde Ccedilla -55
-KPX Atilde G -55
-KPX Atilde Gbreve -55
-KPX Atilde Gcommaaccent -55
-KPX Atilde O -45
-KPX Atilde Oacute -45
-KPX Atilde Ocircumflex -45
-KPX Atilde Odieresis -45
-KPX Atilde Ograve -45
-KPX Atilde Ohungarumlaut -45
-KPX Atilde Omacron -45
-KPX Atilde Oslash -45
-KPX Atilde Otilde -45
-KPX Atilde Q -45
-KPX Atilde T -95
-KPX Atilde Tcaron -95
-KPX Atilde Tcommaaccent -95
-KPX Atilde U -50
-KPX Atilde Uacute -50
-KPX Atilde Ucircumflex -50
-KPX Atilde Udieresis -50
-KPX Atilde Ugrave -50
-KPX Atilde Uhungarumlaut -50
-KPX Atilde Umacron -50
-KPX Atilde Uogonek -50
-KPX Atilde Uring -50
-KPX Atilde V -145
-KPX Atilde W -130
-KPX Atilde Y -100
-KPX Atilde Yacute -100
-KPX Atilde Ydieresis -100
-KPX Atilde p -25
-KPX Atilde quoteright -74
-KPX Atilde u -50
-KPX Atilde uacute -50
-KPX Atilde ucircumflex -50
-KPX Atilde udieresis -50
-KPX Atilde ugrave -50
-KPX Atilde uhungarumlaut -50
-KPX Atilde umacron -50
-KPX Atilde uogonek -50
-KPX Atilde uring -50
-KPX Atilde v -100
-KPX Atilde w -90
-KPX Atilde y -74
-KPX Atilde yacute -74
-KPX Atilde ydieresis -74
-KPX B A -30
-KPX B Aacute -30
-KPX B Abreve -30
-KPX B Acircumflex -30
-KPX B Adieresis -30
-KPX B Agrave -30
-KPX B Amacron -30
-KPX B Aogonek -30
-KPX B Aring -30
-KPX B Atilde -30
-KPX B U -10
-KPX B Uacute -10
-KPX B Ucircumflex -10
-KPX B Udieresis -10
-KPX B Ugrave -10
-KPX B Uhungarumlaut -10
-KPX B Umacron -10
-KPX B Uogonek -10
-KPX B Uring -10
-KPX D A -35
-KPX D Aacute -35
-KPX D Abreve -35
-KPX D Acircumflex -35
-KPX D Adieresis -35
-KPX D Agrave -35
-KPX D Amacron -35
-KPX D Aogonek -35
-KPX D Aring -35
-KPX D Atilde -35
-KPX D V -40
-KPX D W -40
-KPX D Y -40
-KPX D Yacute -40
-KPX D Ydieresis -40
-KPX D period -20
-KPX Dcaron A -35
-KPX Dcaron Aacute -35
-KPX Dcaron Abreve -35
-KPX Dcaron Acircumflex -35
-KPX Dcaron Adieresis -35
-KPX Dcaron Agrave -35
-KPX Dcaron Amacron -35
-KPX Dcaron Aogonek -35
-KPX Dcaron Aring -35
-KPX Dcaron Atilde -35
-KPX Dcaron V -40
-KPX Dcaron W -40
-KPX Dcaron Y -40
-KPX Dcaron Yacute -40
-KPX Dcaron Ydieresis -40
-KPX Dcaron period -20
-KPX Dcroat A -35
-KPX Dcroat Aacute -35
-KPX Dcroat Abreve -35
-KPX Dcroat Acircumflex -35
-KPX Dcroat Adieresis -35
-KPX Dcroat Agrave -35
-KPX Dcroat Amacron -35
-KPX Dcroat Aogonek -35
-KPX Dcroat Aring -35
-KPX Dcroat Atilde -35
-KPX Dcroat V -40
-KPX Dcroat W -40
-KPX Dcroat Y -40
-KPX Dcroat Yacute -40
-KPX Dcroat Ydieresis -40
-KPX Dcroat period -20
-KPX F A -90
-KPX F Aacute -90
-KPX F Abreve -90
-KPX F Acircumflex -90
-KPX F Adieresis -90
-KPX F Agrave -90
-KPX F Amacron -90
-KPX F Aogonek -90
-KPX F Aring -90
-KPX F Atilde -90
-KPX F a -25
-KPX F aacute -25
-KPX F abreve -25
-KPX F acircumflex -25
-KPX F adieresis -25
-KPX F agrave -25
-KPX F amacron -25
-KPX F aogonek -25
-KPX F aring -25
-KPX F atilde -25
-KPX F comma -92
-KPX F e -25
-KPX F eacute -25
-KPX F ecaron -25
-KPX F ecircumflex -25
-KPX F edieresis -25
-KPX F edotaccent -25
-KPX F egrave -25
-KPX F emacron -25
-KPX F eogonek -25
-KPX F o -25
-KPX F oacute -25
-KPX F ocircumflex -25
-KPX F odieresis -25
-KPX F ograve -25
-KPX F ohungarumlaut -25
-KPX F omacron -25
-KPX F oslash -25
-KPX F otilde -25
-KPX F period -110
-KPX J A -30
-KPX J Aacute -30
-KPX J Abreve -30
-KPX J Acircumflex -30
-KPX J Adieresis -30
-KPX J Agrave -30
-KPX J Amacron -30
-KPX J Aogonek -30
-KPX J Aring -30
-KPX J Atilde -30
-KPX J a -15
-KPX J aacute -15
-KPX J abreve -15
-KPX J acircumflex -15
-KPX J adieresis -15
-KPX J agrave -15
-KPX J amacron -15
-KPX J aogonek -15
-KPX J aring -15
-KPX J atilde -15
-KPX J e -15
-KPX J eacute -15
-KPX J ecaron -15
-KPX J ecircumflex -15
-KPX J edieresis -15
-KPX J edotaccent -15
-KPX J egrave -15
-KPX J emacron -15
-KPX J eogonek -15
-KPX J o -15
-KPX J oacute -15
-KPX J ocircumflex -15
-KPX J odieresis -15
-KPX J ograve -15
-KPX J ohungarumlaut -15
-KPX J omacron -15
-KPX J oslash -15
-KPX J otilde -15
-KPX J period -20
-KPX J u -15
-KPX J uacute -15
-KPX J ucircumflex -15
-KPX J udieresis -15
-KPX J ugrave -15
-KPX J uhungarumlaut -15
-KPX J umacron -15
-KPX J uogonek -15
-KPX J uring -15
-KPX K O -30
-KPX K Oacute -30
-KPX K Ocircumflex -30
-KPX K Odieresis -30
-KPX K Ograve -30
-KPX K Ohungarumlaut -30
-KPX K Omacron -30
-KPX K Oslash -30
-KPX K Otilde -30
-KPX K e -25
-KPX K eacute -25
-KPX K ecaron -25
-KPX K ecircumflex -25
-KPX K edieresis -25
-KPX K edotaccent -25
-KPX K egrave -25
-KPX K emacron -25
-KPX K eogonek -25
-KPX K o -25
-KPX K oacute -25
-KPX K ocircumflex -25
-KPX K odieresis -25
-KPX K ograve -25
-KPX K ohungarumlaut -25
-KPX K omacron -25
-KPX K oslash -25
-KPX K otilde -25
-KPX K u -15
-KPX K uacute -15
-KPX K ucircumflex -15
-KPX K udieresis -15
-KPX K ugrave -15
-KPX K uhungarumlaut -15
-KPX K umacron -15
-KPX K uogonek -15
-KPX K uring -15
-KPX K y -45
-KPX K yacute -45
-KPX K ydieresis -45
-KPX Kcommaaccent O -30
-KPX Kcommaaccent Oacute -30
-KPX Kcommaaccent Ocircumflex -30
-KPX Kcommaaccent Odieresis -30
-KPX Kcommaaccent Ograve -30
-KPX Kcommaaccent Ohungarumlaut -30
-KPX Kcommaaccent Omacron -30
-KPX Kcommaaccent Oslash -30
-KPX Kcommaaccent Otilde -30
-KPX Kcommaaccent e -25
-KPX Kcommaaccent eacute -25
-KPX Kcommaaccent ecaron -25
-KPX Kcommaaccent ecircumflex -25
-KPX Kcommaaccent edieresis -25
-KPX Kcommaaccent edotaccent -25
-KPX Kcommaaccent egrave -25
-KPX Kcommaaccent emacron -25
-KPX Kcommaaccent eogonek -25
-KPX Kcommaaccent o -25
-KPX Kcommaaccent oacute -25
-KPX Kcommaaccent ocircumflex -25
-KPX Kcommaaccent odieresis -25
-KPX Kcommaaccent ograve -25
-KPX Kcommaaccent ohungarumlaut -25
-KPX Kcommaaccent omacron -25
-KPX Kcommaaccent oslash -25
-KPX Kcommaaccent otilde -25
-KPX Kcommaaccent u -15
-KPX Kcommaaccent uacute -15
-KPX Kcommaaccent ucircumflex -15
-KPX Kcommaaccent udieresis -15
-KPX Kcommaaccent ugrave -15
-KPX Kcommaaccent uhungarumlaut -15
-KPX Kcommaaccent umacron -15
-KPX Kcommaaccent uogonek -15
-KPX Kcommaaccent uring -15
-KPX Kcommaaccent y -45
-KPX Kcommaaccent yacute -45
-KPX Kcommaaccent ydieresis -45
-KPX L T -92
-KPX L Tcaron -92
-KPX L Tcommaaccent -92
-KPX L V -92
-KPX L W -92
-KPX L Y -92
-KPX L Yacute -92
-KPX L Ydieresis -92
-KPX L quotedblright -20
-KPX L quoteright -110
-KPX L y -55
-KPX L yacute -55
-KPX L ydieresis -55
-KPX Lacute T -92
-KPX Lacute Tcaron -92
-KPX Lacute Tcommaaccent -92
-KPX Lacute V -92
-KPX Lacute W -92
-KPX Lacute Y -92
-KPX Lacute Yacute -92
-KPX Lacute Ydieresis -92
-KPX Lacute quotedblright -20
-KPX Lacute quoteright -110
-KPX Lacute y -55
-KPX Lacute yacute -55
-KPX Lacute ydieresis -55
-KPX Lcommaaccent T -92
-KPX Lcommaaccent Tcaron -92
-KPX Lcommaaccent Tcommaaccent -92
-KPX Lcommaaccent V -92
-KPX Lcommaaccent W -92
-KPX Lcommaaccent Y -92
-KPX Lcommaaccent Yacute -92
-KPX Lcommaaccent Ydieresis -92
-KPX Lcommaaccent quotedblright -20
-KPX Lcommaaccent quoteright -110
-KPX Lcommaaccent y -55
-KPX Lcommaaccent yacute -55
-KPX Lcommaaccent ydieresis -55
-KPX Lslash T -92
-KPX Lslash Tcaron -92
-KPX Lslash Tcommaaccent -92
-KPX Lslash V -92
-KPX Lslash W -92
-KPX Lslash Y -92
-KPX Lslash Yacute -92
-KPX Lslash Ydieresis -92
-KPX Lslash quotedblright -20
-KPX Lslash quoteright -110
-KPX Lslash y -55
-KPX Lslash yacute -55
-KPX Lslash ydieresis -55
-KPX N A -20
-KPX N Aacute -20
-KPX N Abreve -20
-KPX N Acircumflex -20
-KPX N Adieresis -20
-KPX N Agrave -20
-KPX N Amacron -20
-KPX N Aogonek -20
-KPX N Aring -20
-KPX N Atilde -20
-KPX Nacute A -20
-KPX Nacute Aacute -20
-KPX Nacute Abreve -20
-KPX Nacute Acircumflex -20
-KPX Nacute Adieresis -20
-KPX Nacute Agrave -20
-KPX Nacute Amacron -20
-KPX Nacute Aogonek -20
-KPX Nacute Aring -20
-KPX Nacute Atilde -20
-KPX Ncaron A -20
-KPX Ncaron Aacute -20
-KPX Ncaron Abreve -20
-KPX Ncaron Acircumflex -20
-KPX Ncaron Adieresis -20
-KPX Ncaron Agrave -20
-KPX Ncaron Amacron -20
-KPX Ncaron Aogonek -20
-KPX Ncaron Aring -20
-KPX Ncaron Atilde -20
-KPX Ncommaaccent A -20
-KPX Ncommaaccent Aacute -20
-KPX Ncommaaccent Abreve -20
-KPX Ncommaaccent Acircumflex -20
-KPX Ncommaaccent Adieresis -20
-KPX Ncommaaccent Agrave -20
-KPX Ncommaaccent Amacron -20
-KPX Ncommaaccent Aogonek -20
-KPX Ncommaaccent Aring -20
-KPX Ncommaaccent Atilde -20
-KPX Ntilde A -20
-KPX Ntilde Aacute -20
-KPX Ntilde Abreve -20
-KPX Ntilde Acircumflex -20
-KPX Ntilde Adieresis -20
-KPX Ntilde Agrave -20
-KPX Ntilde Amacron -20
-KPX Ntilde Aogonek -20
-KPX Ntilde Aring -20
-KPX Ntilde Atilde -20
-KPX O A -40
-KPX O Aacute -40
-KPX O Abreve -40
-KPX O Acircumflex -40
-KPX O Adieresis -40
-KPX O Agrave -40
-KPX O Amacron -40
-KPX O Aogonek -40
-KPX O Aring -40
-KPX O Atilde -40
-KPX O T -40
-KPX O Tcaron -40
-KPX O Tcommaaccent -40
-KPX O V -50
-KPX O W -50
-KPX O X -40
-KPX O Y -50
-KPX O Yacute -50
-KPX O Ydieresis -50
-KPX Oacute A -40
-KPX Oacute Aacute -40
-KPX Oacute Abreve -40
-KPX Oacute Acircumflex -40
-KPX Oacute Adieresis -40
-KPX Oacute Agrave -40
-KPX Oacute Amacron -40
-KPX Oacute Aogonek -40
-KPX Oacute Aring -40
-KPX Oacute Atilde -40
-KPX Oacute T -40
-KPX Oacute Tcaron -40
-KPX Oacute Tcommaaccent -40
-KPX Oacute V -50
-KPX Oacute W -50
-KPX Oacute X -40
-KPX Oacute Y -50
-KPX Oacute Yacute -50
-KPX Oacute Ydieresis -50
-KPX Ocircumflex A -40
-KPX Ocircumflex Aacute -40
-KPX Ocircumflex Abreve -40
-KPX Ocircumflex Acircumflex -40
-KPX Ocircumflex Adieresis -40
-KPX Ocircumflex Agrave -40
-KPX Ocircumflex Amacron -40
-KPX Ocircumflex Aogonek -40
-KPX Ocircumflex Aring -40
-KPX Ocircumflex Atilde -40
-KPX Ocircumflex T -40
-KPX Ocircumflex Tcaron -40
-KPX Ocircumflex Tcommaaccent -40
-KPX Ocircumflex V -50
-KPX Ocircumflex W -50
-KPX Ocircumflex X -40
-KPX Ocircumflex Y -50
-KPX Ocircumflex Yacute -50
-KPX Ocircumflex Ydieresis -50
-KPX Odieresis A -40
-KPX Odieresis Aacute -40
-KPX Odieresis Abreve -40
-KPX Odieresis Acircumflex -40
-KPX Odieresis Adieresis -40
-KPX Odieresis Agrave -40
-KPX Odieresis Amacron -40
-KPX Odieresis Aogonek -40
-KPX Odieresis Aring -40
-KPX Odieresis Atilde -40
-KPX Odieresis T -40
-KPX Odieresis Tcaron -40
-KPX Odieresis Tcommaaccent -40
-KPX Odieresis V -50
-KPX Odieresis W -50
-KPX Odieresis X -40
-KPX Odieresis Y -50
-KPX Odieresis Yacute -50
-KPX Odieresis Ydieresis -50
-KPX Ograve A -40
-KPX Ograve Aacute -40
-KPX Ograve Abreve -40
-KPX Ograve Acircumflex -40
-KPX Ograve Adieresis -40
-KPX Ograve Agrave -40
-KPX Ograve Amacron -40
-KPX Ograve Aogonek -40
-KPX Ograve Aring -40
-KPX Ograve Atilde -40
-KPX Ograve T -40
-KPX Ograve Tcaron -40
-KPX Ograve Tcommaaccent -40
-KPX Ograve V -50
-KPX Ograve W -50
-KPX Ograve X -40
-KPX Ograve Y -50
-KPX Ograve Yacute -50
-KPX Ograve Ydieresis -50
-KPX Ohungarumlaut A -40
-KPX Ohungarumlaut Aacute -40
-KPX Ohungarumlaut Abreve -40
-KPX Ohungarumlaut Acircumflex -40
-KPX Ohungarumlaut Adieresis -40
-KPX Ohungarumlaut Agrave -40
-KPX Ohungarumlaut Amacron -40
-KPX Ohungarumlaut Aogonek -40
-KPX Ohungarumlaut Aring -40
-KPX Ohungarumlaut Atilde -40
-KPX Ohungarumlaut T -40
-KPX Ohungarumlaut Tcaron -40
-KPX Ohungarumlaut Tcommaaccent -40
-KPX Ohungarumlaut V -50
-KPX Ohungarumlaut W -50
-KPX Ohungarumlaut X -40
-KPX Ohungarumlaut Y -50
-KPX Ohungarumlaut Yacute -50
-KPX Ohungarumlaut Ydieresis -50
-KPX Omacron A -40
-KPX Omacron Aacute -40
-KPX Omacron Abreve -40
-KPX Omacron Acircumflex -40
-KPX Omacron Adieresis -40
-KPX Omacron Agrave -40
-KPX Omacron Amacron -40
-KPX Omacron Aogonek -40
-KPX Omacron Aring -40
-KPX Omacron Atilde -40
-KPX Omacron T -40
-KPX Omacron Tcaron -40
-KPX Omacron Tcommaaccent -40
-KPX Omacron V -50
-KPX Omacron W -50
-KPX Omacron X -40
-KPX Omacron Y -50
-KPX Omacron Yacute -50
-KPX Omacron Ydieresis -50
-KPX Oslash A -40
-KPX Oslash Aacute -40
-KPX Oslash Abreve -40
-KPX Oslash Acircumflex -40
-KPX Oslash Adieresis -40
-KPX Oslash Agrave -40
-KPX Oslash Amacron -40
-KPX Oslash Aogonek -40
-KPX Oslash Aring -40
-KPX Oslash Atilde -40
-KPX Oslash T -40
-KPX Oslash Tcaron -40
-KPX Oslash Tcommaaccent -40
-KPX Oslash V -50
-KPX Oslash W -50
-KPX Oslash X -40
-KPX Oslash Y -50
-KPX Oslash Yacute -50
-KPX Oslash Ydieresis -50
-KPX Otilde A -40
-KPX Otilde Aacute -40
-KPX Otilde Abreve -40
-KPX Otilde Acircumflex -40
-KPX Otilde Adieresis -40
-KPX Otilde Agrave -40
-KPX Otilde Amacron -40
-KPX Otilde Aogonek -40
-KPX Otilde Aring -40
-KPX Otilde Atilde -40
-KPX Otilde T -40
-KPX Otilde Tcaron -40
-KPX Otilde Tcommaaccent -40
-KPX Otilde V -50
-KPX Otilde W -50
-KPX Otilde X -40
-KPX Otilde Y -50
-KPX Otilde Yacute -50
-KPX Otilde Ydieresis -50
-KPX P A -74
-KPX P Aacute -74
-KPX P Abreve -74
-KPX P Acircumflex -74
-KPX P Adieresis -74
-KPX P Agrave -74
-KPX P Amacron -74
-KPX P Aogonek -74
-KPX P Aring -74
-KPX P Atilde -74
-KPX P a -10
-KPX P aacute -10
-KPX P abreve -10
-KPX P acircumflex -10
-KPX P adieresis -10
-KPX P agrave -10
-KPX P amacron -10
-KPX P aogonek -10
-KPX P aring -10
-KPX P atilde -10
-KPX P comma -92
-KPX P e -20
-KPX P eacute -20
-KPX P ecaron -20
-KPX P ecircumflex -20
-KPX P edieresis -20
-KPX P edotaccent -20
-KPX P egrave -20
-KPX P emacron -20
-KPX P eogonek -20
-KPX P o -20
-KPX P oacute -20
-KPX P ocircumflex -20
-KPX P odieresis -20
-KPX P ograve -20
-KPX P ohungarumlaut -20
-KPX P omacron -20
-KPX P oslash -20
-KPX P otilde -20
-KPX P period -110
-KPX Q U -10
-KPX Q Uacute -10
-KPX Q Ucircumflex -10
-KPX Q Udieresis -10
-KPX Q Ugrave -10
-KPX Q Uhungarumlaut -10
-KPX Q Umacron -10
-KPX Q Uogonek -10
-KPX Q Uring -10
-KPX Q period -20
-KPX R O -30
-KPX R Oacute -30
-KPX R Ocircumflex -30
-KPX R Odieresis -30
-KPX R Ograve -30
-KPX R Ohungarumlaut -30
-KPX R Omacron -30
-KPX R Oslash -30
-KPX R Otilde -30
-KPX R T -40
-KPX R Tcaron -40
-KPX R Tcommaaccent -40
-KPX R U -30
-KPX R Uacute -30
-KPX R Ucircumflex -30
-KPX R Udieresis -30
-KPX R Ugrave -30
-KPX R Uhungarumlaut -30
-KPX R Umacron -30
-KPX R Uogonek -30
-KPX R Uring -30
-KPX R V -55
-KPX R W -35
-KPX R Y -35
-KPX R Yacute -35
-KPX R Ydieresis -35
-KPX Racute O -30
-KPX Racute Oacute -30
-KPX Racute Ocircumflex -30
-KPX Racute Odieresis -30
-KPX Racute Ograve -30
-KPX Racute Ohungarumlaut -30
-KPX Racute Omacron -30
-KPX Racute Oslash -30
-KPX Racute Otilde -30
-KPX Racute T -40
-KPX Racute Tcaron -40
-KPX Racute Tcommaaccent -40
-KPX Racute U -30
-KPX Racute Uacute -30
-KPX Racute Ucircumflex -30
-KPX Racute Udieresis -30
-KPX Racute Ugrave -30
-KPX Racute Uhungarumlaut -30
-KPX Racute Umacron -30
-KPX Racute Uogonek -30
-KPX Racute Uring -30
-KPX Racute V -55
-KPX Racute W -35
-KPX Racute Y -35
-KPX Racute Yacute -35
-KPX Racute Ydieresis -35
-KPX Rcaron O -30
-KPX Rcaron Oacute -30
-KPX Rcaron Ocircumflex -30
-KPX Rcaron Odieresis -30
-KPX Rcaron Ograve -30
-KPX Rcaron Ohungarumlaut -30
-KPX Rcaron Omacron -30
-KPX Rcaron Oslash -30
-KPX Rcaron Otilde -30
-KPX Rcaron T -40
-KPX Rcaron Tcaron -40
-KPX Rcaron Tcommaaccent -40
-KPX Rcaron U -30
-KPX Rcaron Uacute -30
-KPX Rcaron Ucircumflex -30
-KPX Rcaron Udieresis -30
-KPX Rcaron Ugrave -30
-KPX Rcaron Uhungarumlaut -30
-KPX Rcaron Umacron -30
-KPX Rcaron Uogonek -30
-KPX Rcaron Uring -30
-KPX Rcaron V -55
-KPX Rcaron W -35
-KPX Rcaron Y -35
-KPX Rcaron Yacute -35
-KPX Rcaron Ydieresis -35
-KPX Rcommaaccent O -30
-KPX Rcommaaccent Oacute -30
-KPX Rcommaaccent Ocircumflex -30
-KPX Rcommaaccent Odieresis -30
-KPX Rcommaaccent Ograve -30
-KPX Rcommaaccent Ohungarumlaut -30
-KPX Rcommaaccent Omacron -30
-KPX Rcommaaccent Oslash -30
-KPX Rcommaaccent Otilde -30
-KPX Rcommaaccent T -40
-KPX Rcommaaccent Tcaron -40
-KPX Rcommaaccent Tcommaaccent -40
-KPX Rcommaaccent U -30
-KPX Rcommaaccent Uacute -30
-KPX Rcommaaccent Ucircumflex -30
-KPX Rcommaaccent Udieresis -30
-KPX Rcommaaccent Ugrave -30
-KPX Rcommaaccent Uhungarumlaut -30
-KPX Rcommaaccent Umacron -30
-KPX Rcommaaccent Uogonek -30
-KPX Rcommaaccent Uring -30
-KPX Rcommaaccent V -55
-KPX Rcommaaccent W -35
-KPX Rcommaaccent Y -35
-KPX Rcommaaccent Yacute -35
-KPX Rcommaaccent Ydieresis -35
-KPX T A -90
-KPX T Aacute -90
-KPX T Abreve -90
-KPX T Acircumflex -90
-KPX T Adieresis -90
-KPX T Agrave -90
-KPX T Amacron -90
-KPX T Aogonek -90
-KPX T Aring -90
-KPX T Atilde -90
-KPX T O -18
-KPX T Oacute -18
-KPX T Ocircumflex -18
-KPX T Odieresis -18
-KPX T Ograve -18
-KPX T Ohungarumlaut -18
-KPX T Omacron -18
-KPX T Oslash -18
-KPX T Otilde -18
-KPX T a -92
-KPX T aacute -92
-KPX T abreve -52
-KPX T acircumflex -52
-KPX T adieresis -52
-KPX T agrave -52
-KPX T amacron -52
-KPX T aogonek -92
-KPX T aring -92
-KPX T atilde -52
-KPX T colon -74
-KPX T comma -74
-KPX T e -92
-KPX T eacute -92
-KPX T ecaron -92
-KPX T ecircumflex -92
-KPX T edieresis -52
-KPX T edotaccent -92
-KPX T egrave -52
-KPX T emacron -52
-KPX T eogonek -92
-KPX T hyphen -92
-KPX T i -18
-KPX T iacute -18
-KPX T iogonek -18
-KPX T o -92
-KPX T oacute -92
-KPX T ocircumflex -92
-KPX T odieresis -92
-KPX T ograve -92
-KPX T ohungarumlaut -92
-KPX T omacron -92
-KPX T oslash -92
-KPX T otilde -92
-KPX T period -90
-KPX T r -74
-KPX T racute -74
-KPX T rcaron -74
-KPX T rcommaaccent -74
-KPX T semicolon -74
-KPX T u -92
-KPX T uacute -92
-KPX T ucircumflex -92
-KPX T udieresis -92
-KPX T ugrave -92
-KPX T uhungarumlaut -92
-KPX T umacron -92
-KPX T uogonek -92
-KPX T uring -92
-KPX T w -74
-KPX T y -34
-KPX T yacute -34
-KPX T ydieresis -34
-KPX Tcaron A -90
-KPX Tcaron Aacute -90
-KPX Tcaron Abreve -90
-KPX Tcaron Acircumflex -90
-KPX Tcaron Adieresis -90
-KPX Tcaron Agrave -90
-KPX Tcaron Amacron -90
-KPX Tcaron Aogonek -90
-KPX Tcaron Aring -90
-KPX Tcaron Atilde -90
-KPX Tcaron O -18
-KPX Tcaron Oacute -18
-KPX Tcaron Ocircumflex -18
-KPX Tcaron Odieresis -18
-KPX Tcaron Ograve -18
-KPX Tcaron Ohungarumlaut -18
-KPX Tcaron Omacron -18
-KPX Tcaron Oslash -18
-KPX Tcaron Otilde -18
-KPX Tcaron a -92
-KPX Tcaron aacute -92
-KPX Tcaron abreve -52
-KPX Tcaron acircumflex -52
-KPX Tcaron adieresis -52
-KPX Tcaron agrave -52
-KPX Tcaron amacron -52
-KPX Tcaron aogonek -92
-KPX Tcaron aring -92
-KPX Tcaron atilde -52
-KPX Tcaron colon -74
-KPX Tcaron comma -74
-KPX Tcaron e -92
-KPX Tcaron eacute -92
-KPX Tcaron ecaron -92
-KPX Tcaron ecircumflex -92
-KPX Tcaron edieresis -52
-KPX Tcaron edotaccent -92
-KPX Tcaron egrave -52
-KPX Tcaron emacron -52
-KPX Tcaron eogonek -92
-KPX Tcaron hyphen -92
-KPX Tcaron i -18
-KPX Tcaron iacute -18
-KPX Tcaron iogonek -18
-KPX Tcaron o -92
-KPX Tcaron oacute -92
-KPX Tcaron ocircumflex -92
-KPX Tcaron odieresis -92
-KPX Tcaron ograve -92
-KPX Tcaron ohungarumlaut -92
-KPX Tcaron omacron -92
-KPX Tcaron oslash -92
-KPX Tcaron otilde -92
-KPX Tcaron period -90
-KPX Tcaron r -74
-KPX Tcaron racute -74
-KPX Tcaron rcaron -74
-KPX Tcaron rcommaaccent -74
-KPX Tcaron semicolon -74
-KPX Tcaron u -92
-KPX Tcaron uacute -92
-KPX Tcaron ucircumflex -92
-KPX Tcaron udieresis -92
-KPX Tcaron ugrave -92
-KPX Tcaron uhungarumlaut -92
-KPX Tcaron umacron -92
-KPX Tcaron uogonek -92
-KPX Tcaron uring -92
-KPX Tcaron w -74
-KPX Tcaron y -34
-KPX Tcaron yacute -34
-KPX Tcaron ydieresis -34
-KPX Tcommaaccent A -90
-KPX Tcommaaccent Aacute -90
-KPX Tcommaaccent Abreve -90
-KPX Tcommaaccent Acircumflex -90
-KPX Tcommaaccent Adieresis -90
-KPX Tcommaaccent Agrave -90
-KPX Tcommaaccent Amacron -90
-KPX Tcommaaccent Aogonek -90
-KPX Tcommaaccent Aring -90
-KPX Tcommaaccent Atilde -90
-KPX Tcommaaccent O -18
-KPX Tcommaaccent Oacute -18
-KPX Tcommaaccent Ocircumflex -18
-KPX Tcommaaccent Odieresis -18
-KPX Tcommaaccent Ograve -18
-KPX Tcommaaccent Ohungarumlaut -18
-KPX Tcommaaccent Omacron -18
-KPX Tcommaaccent Oslash -18
-KPX Tcommaaccent Otilde -18
-KPX Tcommaaccent a -92
-KPX Tcommaaccent aacute -92
-KPX Tcommaaccent abreve -52
-KPX Tcommaaccent acircumflex -52
-KPX Tcommaaccent adieresis -52
-KPX Tcommaaccent agrave -52
-KPX Tcommaaccent amacron -52
-KPX Tcommaaccent aogonek -92
-KPX Tcommaaccent aring -92
-KPX Tcommaaccent atilde -52
-KPX Tcommaaccent colon -74
-KPX Tcommaaccent comma -74
-KPX Tcommaaccent e -92
-KPX Tcommaaccent eacute -92
-KPX Tcommaaccent ecaron -92
-KPX Tcommaaccent ecircumflex -92
-KPX Tcommaaccent edieresis -52
-KPX Tcommaaccent edotaccent -92
-KPX Tcommaaccent egrave -52
-KPX Tcommaaccent emacron -52
-KPX Tcommaaccent eogonek -92
-KPX Tcommaaccent hyphen -92
-KPX Tcommaaccent i -18
-KPX Tcommaaccent iacute -18
-KPX Tcommaaccent iogonek -18
-KPX Tcommaaccent o -92
-KPX Tcommaaccent oacute -92
-KPX Tcommaaccent ocircumflex -92
-KPX Tcommaaccent odieresis -92
-KPX Tcommaaccent ograve -92
-KPX Tcommaaccent ohungarumlaut -92
-KPX Tcommaaccent omacron -92
-KPX Tcommaaccent oslash -92
-KPX Tcommaaccent otilde -92
-KPX Tcommaaccent period -90
-KPX Tcommaaccent r -74
-KPX Tcommaaccent racute -74
-KPX Tcommaaccent rcaron -74
-KPX Tcommaaccent rcommaaccent -74
-KPX Tcommaaccent semicolon -74
-KPX Tcommaaccent u -92
-KPX Tcommaaccent uacute -92
-KPX Tcommaaccent ucircumflex -92
-KPX Tcommaaccent udieresis -92
-KPX Tcommaaccent ugrave -92
-KPX Tcommaaccent uhungarumlaut -92
-KPX Tcommaaccent umacron -92
-KPX Tcommaaccent uogonek -92
-KPX Tcommaaccent uring -92
-KPX Tcommaaccent w -74
-KPX Tcommaaccent y -34
-KPX Tcommaaccent yacute -34
-KPX Tcommaaccent ydieresis -34
-KPX U A -60
-KPX U Aacute -60
-KPX U Abreve -60
-KPX U Acircumflex -60
-KPX U Adieresis -60
-KPX U Agrave -60
-KPX U Amacron -60
-KPX U Aogonek -60
-KPX U Aring -60
-KPX U Atilde -60
-KPX U comma -50
-KPX U period -50
-KPX Uacute A -60
-KPX Uacute Aacute -60
-KPX Uacute Abreve -60
-KPX Uacute Acircumflex -60
-KPX Uacute Adieresis -60
-KPX Uacute Agrave -60
-KPX Uacute Amacron -60
-KPX Uacute Aogonek -60
-KPX Uacute Aring -60
-KPX Uacute Atilde -60
-KPX Uacute comma -50
-KPX Uacute period -50
-KPX Ucircumflex A -60
-KPX Ucircumflex Aacute -60
-KPX Ucircumflex Abreve -60
-KPX Ucircumflex Acircumflex -60
-KPX Ucircumflex Adieresis -60
-KPX Ucircumflex Agrave -60
-KPX Ucircumflex Amacron -60
-KPX Ucircumflex Aogonek -60
-KPX Ucircumflex Aring -60
-KPX Ucircumflex Atilde -60
-KPX Ucircumflex comma -50
-KPX Ucircumflex period -50
-KPX Udieresis A -60
-KPX Udieresis Aacute -60
-KPX Udieresis Abreve -60
-KPX Udieresis Acircumflex -60
-KPX Udieresis Adieresis -60
-KPX Udieresis Agrave -60
-KPX Udieresis Amacron -60
-KPX Udieresis Aogonek -60
-KPX Udieresis Aring -60
-KPX Udieresis Atilde -60
-KPX Udieresis comma -50
-KPX Udieresis period -50
-KPX Ugrave A -60
-KPX Ugrave Aacute -60
-KPX Ugrave Abreve -60
-KPX Ugrave Acircumflex -60
-KPX Ugrave Adieresis -60
-KPX Ugrave Agrave -60
-KPX Ugrave Amacron -60
-KPX Ugrave Aogonek -60
-KPX Ugrave Aring -60
-KPX Ugrave Atilde -60
-KPX Ugrave comma -50
-KPX Ugrave period -50
-KPX Uhungarumlaut A -60
-KPX Uhungarumlaut Aacute -60
-KPX Uhungarumlaut Abreve -60
-KPX Uhungarumlaut Acircumflex -60
-KPX Uhungarumlaut Adieresis -60
-KPX Uhungarumlaut Agrave -60
-KPX Uhungarumlaut Amacron -60
-KPX Uhungarumlaut Aogonek -60
-KPX Uhungarumlaut Aring -60
-KPX Uhungarumlaut Atilde -60
-KPX Uhungarumlaut comma -50
-KPX Uhungarumlaut period -50
-KPX Umacron A -60
-KPX Umacron Aacute -60
-KPX Umacron Abreve -60
-KPX Umacron Acircumflex -60
-KPX Umacron Adieresis -60
-KPX Umacron Agrave -60
-KPX Umacron Amacron -60
-KPX Umacron Aogonek -60
-KPX Umacron Aring -60
-KPX Umacron Atilde -60
-KPX Umacron comma -50
-KPX Umacron period -50
-KPX Uogonek A -60
-KPX Uogonek Aacute -60
-KPX Uogonek Abreve -60
-KPX Uogonek Acircumflex -60
-KPX Uogonek Adieresis -60
-KPX Uogonek Agrave -60
-KPX Uogonek Amacron -60
-KPX Uogonek Aogonek -60
-KPX Uogonek Aring -60
-KPX Uogonek Atilde -60
-KPX Uogonek comma -50
-KPX Uogonek period -50
-KPX Uring A -60
-KPX Uring Aacute -60
-KPX Uring Abreve -60
-KPX Uring Acircumflex -60
-KPX Uring Adieresis -60
-KPX Uring Agrave -60
-KPX Uring Amacron -60
-KPX Uring Aogonek -60
-KPX Uring Aring -60
-KPX Uring Atilde -60
-KPX Uring comma -50
-KPX Uring period -50
-KPX V A -135
-KPX V Aacute -135
-KPX V Abreve -135
-KPX V Acircumflex -135
-KPX V Adieresis -135
-KPX V Agrave -135
-KPX V Amacron -135
-KPX V Aogonek -135
-KPX V Aring -135
-KPX V Atilde -135
-KPX V G -30
-KPX V Gbreve -30
-KPX V Gcommaaccent -30
-KPX V O -45
-KPX V Oacute -45
-KPX V Ocircumflex -45
-KPX V Odieresis -45
-KPX V Ograve -45
-KPX V Ohungarumlaut -45
-KPX V Omacron -45
-KPX V Oslash -45
-KPX V Otilde -45
-KPX V a -92
-KPX V aacute -92
-KPX V abreve -92
-KPX V acircumflex -92
-KPX V adieresis -92
-KPX V agrave -92
-KPX V amacron -92
-KPX V aogonek -92
-KPX V aring -92
-KPX V atilde -92
-KPX V colon -92
-KPX V comma -129
-KPX V e -100
-KPX V eacute -100
-KPX V ecaron -100
-KPX V ecircumflex -100
-KPX V edieresis -100
-KPX V edotaccent -100
-KPX V egrave -100
-KPX V emacron -100
-KPX V eogonek -100
-KPX V hyphen -74
-KPX V i -37
-KPX V iacute -37
-KPX V icircumflex -37
-KPX V idieresis -37
-KPX V igrave -37
-KPX V imacron -37
-KPX V iogonek -37
-KPX V o -100
-KPX V oacute -100
-KPX V ocircumflex -100
-KPX V odieresis -100
-KPX V ograve -100
-KPX V ohungarumlaut -100
-KPX V omacron -100
-KPX V oslash -100
-KPX V otilde -100
-KPX V period -145
-KPX V semicolon -92
-KPX V u -92
-KPX V uacute -92
-KPX V ucircumflex -92
-KPX V udieresis -92
-KPX V ugrave -92
-KPX V uhungarumlaut -92
-KPX V umacron -92
-KPX V uogonek -92
-KPX V uring -92
-KPX W A -120
-KPX W Aacute -120
-KPX W Abreve -120
-KPX W Acircumflex -120
-KPX W Adieresis -120
-KPX W Agrave -120
-KPX W Amacron -120
-KPX W Aogonek -120
-KPX W Aring -120
-KPX W Atilde -120
-KPX W O -10
-KPX W Oacute -10
-KPX W Ocircumflex -10
-KPX W Odieresis -10
-KPX W Ograve -10
-KPX W Ohungarumlaut -10
-KPX W Omacron -10
-KPX W Oslash -10
-KPX W Otilde -10
-KPX W a -65
-KPX W aacute -65
-KPX W abreve -65
-KPX W acircumflex -65
-KPX W adieresis -65
-KPX W agrave -65
-KPX W amacron -65
-KPX W aogonek -65
-KPX W aring -65
-KPX W atilde -65
-KPX W colon -55
-KPX W comma -92
-KPX W e -65
-KPX W eacute -65
-KPX W ecaron -65
-KPX W ecircumflex -65
-KPX W edieresis -65
-KPX W edotaccent -65
-KPX W egrave -65
-KPX W emacron -65
-KPX W eogonek -65
-KPX W hyphen -37
-KPX W i -18
-KPX W iacute -18
-KPX W iogonek -18
-KPX W o -75
-KPX W oacute -75
-KPX W ocircumflex -75
-KPX W odieresis -75
-KPX W ograve -75
-KPX W ohungarumlaut -75
-KPX W omacron -75
-KPX W oslash -75
-KPX W otilde -75
-KPX W period -92
-KPX W semicolon -55
-KPX W u -50
-KPX W uacute -50
-KPX W ucircumflex -50
-KPX W udieresis -50
-KPX W ugrave -50
-KPX W uhungarumlaut -50
-KPX W umacron -50
-KPX W uogonek -50
-KPX W uring -50
-KPX W y -60
-KPX W yacute -60
-KPX W ydieresis -60
-KPX Y A -110
-KPX Y Aacute -110
-KPX Y Abreve -110
-KPX Y Acircumflex -110
-KPX Y Adieresis -110
-KPX Y Agrave -110
-KPX Y Amacron -110
-KPX Y Aogonek -110
-KPX Y Aring -110
-KPX Y Atilde -110
-KPX Y O -35
-KPX Y Oacute -35
-KPX Y Ocircumflex -35
-KPX Y Odieresis -35
-KPX Y Ograve -35
-KPX Y Ohungarumlaut -35
-KPX Y Omacron -35
-KPX Y Oslash -35
-KPX Y Otilde -35
-KPX Y a -85
-KPX Y aacute -85
-KPX Y abreve -85
-KPX Y acircumflex -85
-KPX Y adieresis -85
-KPX Y agrave -85
-KPX Y amacron -85
-KPX Y aogonek -85
-KPX Y aring -85
-KPX Y atilde -85
-KPX Y colon -92
-KPX Y comma -92
-KPX Y e -111
-KPX Y eacute -111
-KPX Y ecaron -111
-KPX Y ecircumflex -111
-KPX Y edieresis -71
-KPX Y edotaccent -111
-KPX Y egrave -71
-KPX Y emacron -71
-KPX Y eogonek -111
-KPX Y hyphen -92
-KPX Y i -37
-KPX Y iacute -37
-KPX Y iogonek -37
-KPX Y o -111
-KPX Y oacute -111
-KPX Y ocircumflex -111
-KPX Y odieresis -111
-KPX Y ograve -111
-KPX Y ohungarumlaut -111
-KPX Y omacron -111
-KPX Y oslash -111
-KPX Y otilde -111
-KPX Y period -92
-KPX Y semicolon -92
-KPX Y u -92
-KPX Y uacute -92
-KPX Y ucircumflex -92
-KPX Y udieresis -92
-KPX Y ugrave -92
-KPX Y uhungarumlaut -92
-KPX Y umacron -92
-KPX Y uogonek -92
-KPX Y uring -92
-KPX Yacute A -110
-KPX Yacute Aacute -110
-KPX Yacute Abreve -110
-KPX Yacute Acircumflex -110
-KPX Yacute Adieresis -110
-KPX Yacute Agrave -110
-KPX Yacute Amacron -110
-KPX Yacute Aogonek -110
-KPX Yacute Aring -110
-KPX Yacute Atilde -110
-KPX Yacute O -35
-KPX Yacute Oacute -35
-KPX Yacute Ocircumflex -35
-KPX Yacute Odieresis -35
-KPX Yacute Ograve -35
-KPX Yacute Ohungarumlaut -35
-KPX Yacute Omacron -35
-KPX Yacute Oslash -35
-KPX Yacute Otilde -35
-KPX Yacute a -85
-KPX Yacute aacute -85
-KPX Yacute abreve -85
-KPX Yacute acircumflex -85
-KPX Yacute adieresis -85
-KPX Yacute agrave -85
-KPX Yacute amacron -85
-KPX Yacute aogonek -85
-KPX Yacute aring -85
-KPX Yacute atilde -85
-KPX Yacute colon -92
-KPX Yacute comma -92
-KPX Yacute e -111
-KPX Yacute eacute -111
-KPX Yacute ecaron -111
-KPX Yacute ecircumflex -111
-KPX Yacute edieresis -71
-KPX Yacute edotaccent -111
-KPX Yacute egrave -71
-KPX Yacute emacron -71
-KPX Yacute eogonek -111
-KPX Yacute hyphen -92
-KPX Yacute i -37
-KPX Yacute iacute -37
-KPX Yacute iogonek -37
-KPX Yacute o -111
-KPX Yacute oacute -111
-KPX Yacute ocircumflex -111
-KPX Yacute odieresis -111
-KPX Yacute ograve -111
-KPX Yacute ohungarumlaut -111
-KPX Yacute omacron -111
-KPX Yacute oslash -111
-KPX Yacute otilde -111
-KPX Yacute period -92
-KPX Yacute semicolon -92
-KPX Yacute u -92
-KPX Yacute uacute -92
-KPX Yacute ucircumflex -92
-KPX Yacute udieresis -92
-KPX Yacute ugrave -92
-KPX Yacute uhungarumlaut -92
-KPX Yacute umacron -92
-KPX Yacute uogonek -92
-KPX Yacute uring -92
-KPX Ydieresis A -110
-KPX Ydieresis Aacute -110
-KPX Ydieresis Abreve -110
-KPX Ydieresis Acircumflex -110
-KPX Ydieresis Adieresis -110
-KPX Ydieresis Agrave -110
-KPX Ydieresis Amacron -110
-KPX Ydieresis Aogonek -110
-KPX Ydieresis Aring -110
-KPX Ydieresis Atilde -110
-KPX Ydieresis O -35
-KPX Ydieresis Oacute -35
-KPX Ydieresis Ocircumflex -35
-KPX Ydieresis Odieresis -35
-KPX Ydieresis Ograve -35
-KPX Ydieresis Ohungarumlaut -35
-KPX Ydieresis Omacron -35
-KPX Ydieresis Oslash -35
-KPX Ydieresis Otilde -35
-KPX Ydieresis a -85
-KPX Ydieresis aacute -85
-KPX Ydieresis abreve -85
-KPX Ydieresis acircumflex -85
-KPX Ydieresis adieresis -85
-KPX Ydieresis agrave -85
-KPX Ydieresis amacron -85
-KPX Ydieresis aogonek -85
-KPX Ydieresis aring -85
-KPX Ydieresis atilde -85
-KPX Ydieresis colon -92
-KPX Ydieresis comma -92
-KPX Ydieresis e -111
-KPX Ydieresis eacute -111
-KPX Ydieresis ecaron -111
-KPX Ydieresis ecircumflex -111
-KPX Ydieresis edieresis -71
-KPX Ydieresis edotaccent -111
-KPX Ydieresis egrave -71
-KPX Ydieresis emacron -71
-KPX Ydieresis eogonek -111
-KPX Ydieresis hyphen -92
-KPX Ydieresis i -37
-KPX Ydieresis iacute -37
-KPX Ydieresis iogonek -37
-KPX Ydieresis o -111
-KPX Ydieresis oacute -111
-KPX Ydieresis ocircumflex -111
-KPX Ydieresis odieresis -111
-KPX Ydieresis ograve -111
-KPX Ydieresis ohungarumlaut -111
-KPX Ydieresis omacron -111
-KPX Ydieresis oslash -111
-KPX Ydieresis otilde -111
-KPX Ydieresis period -92
-KPX Ydieresis semicolon -92
-KPX Ydieresis u -92
-KPX Ydieresis uacute -92
-KPX Ydieresis ucircumflex -92
-KPX Ydieresis udieresis -92
-KPX Ydieresis ugrave -92
-KPX Ydieresis uhungarumlaut -92
-KPX Ydieresis umacron -92
-KPX Ydieresis uogonek -92
-KPX Ydieresis uring -92
-KPX a v -25
-KPX aacute v -25
-KPX abreve v -25
-KPX acircumflex v -25
-KPX adieresis v -25
-KPX agrave v -25
-KPX amacron v -25
-KPX aogonek v -25
-KPX aring v -25
-KPX atilde v -25
-KPX b b -10
-KPX b period -40
-KPX b u -20
-KPX b uacute -20
-KPX b ucircumflex -20
-KPX b udieresis -20
-KPX b ugrave -20
-KPX b uhungarumlaut -20
-KPX b umacron -20
-KPX b uogonek -20
-KPX b uring -20
-KPX b v -15
-KPX comma quotedblright -45
-KPX comma quoteright -55
-KPX d w -15
-KPX dcroat w -15
-KPX e v -15
-KPX eacute v -15
-KPX ecaron v -15
-KPX ecircumflex v -15
-KPX edieresis v -15
-KPX edotaccent v -15
-KPX egrave v -15
-KPX emacron v -15
-KPX eogonek v -15
-KPX f comma -15
-KPX f dotlessi -35
-KPX f i -25
-KPX f o -25
-KPX f oacute -25
-KPX f ocircumflex -25
-KPX f odieresis -25
-KPX f ograve -25
-KPX f ohungarumlaut -25
-KPX f omacron -25
-KPX f oslash -25
-KPX f otilde -25
-KPX f period -15
-KPX f quotedblright 50
-KPX f quoteright 55
-KPX g period -15
-KPX gbreve period -15
-KPX gcommaaccent period -15
-KPX h y -15
-KPX h yacute -15
-KPX h ydieresis -15
-KPX i v -10
-KPX iacute v -10
-KPX icircumflex v -10
-KPX idieresis v -10
-KPX igrave v -10
-KPX imacron v -10
-KPX iogonek v -10
-KPX k e -10
-KPX k eacute -10
-KPX k ecaron -10
-KPX k ecircumflex -10
-KPX k edieresis -10
-KPX k edotaccent -10
-KPX k egrave -10
-KPX k emacron -10
-KPX k eogonek -10
-KPX k o -15
-KPX k oacute -15
-KPX k ocircumflex -15
-KPX k odieresis -15
-KPX k ograve -15
-KPX k ohungarumlaut -15
-KPX k omacron -15
-KPX k oslash -15
-KPX k otilde -15
-KPX k y -15
-KPX k yacute -15
-KPX k ydieresis -15
-KPX kcommaaccent e -10
-KPX kcommaaccent eacute -10
-KPX kcommaaccent ecaron -10
-KPX kcommaaccent ecircumflex -10
-KPX kcommaaccent edieresis -10
-KPX kcommaaccent edotaccent -10
-KPX kcommaaccent egrave -10
-KPX kcommaaccent emacron -10
-KPX kcommaaccent eogonek -10
-KPX kcommaaccent o -15
-KPX kcommaaccent oacute -15
-KPX kcommaaccent ocircumflex -15
-KPX kcommaaccent odieresis -15
-KPX kcommaaccent ograve -15
-KPX kcommaaccent ohungarumlaut -15
-KPX kcommaaccent omacron -15
-KPX kcommaaccent oslash -15
-KPX kcommaaccent otilde -15
-KPX kcommaaccent y -15
-KPX kcommaaccent yacute -15
-KPX kcommaaccent ydieresis -15
-KPX n v -40
-KPX nacute v -40
-KPX ncaron v -40
-KPX ncommaaccent v -40
-KPX ntilde v -40
-KPX o v -10
-KPX o w -10
-KPX oacute v -10
-KPX oacute w -10
-KPX ocircumflex v -10
-KPX ocircumflex w -10
-KPX odieresis v -10
-KPX odieresis w -10
-KPX ograve v -10
-KPX ograve w -10
-KPX ohungarumlaut v -10
-KPX ohungarumlaut w -10
-KPX omacron v -10
-KPX omacron w -10
-KPX oslash v -10
-KPX oslash w -10
-KPX otilde v -10
-KPX otilde w -10
-KPX period quotedblright -55
-KPX period quoteright -55
-KPX quotedblleft A -10
-KPX quotedblleft Aacute -10
-KPX quotedblleft Abreve -10
-KPX quotedblleft Acircumflex -10
-KPX quotedblleft Adieresis -10
-KPX quotedblleft Agrave -10
-KPX quotedblleft Amacron -10
-KPX quotedblleft Aogonek -10
-KPX quotedblleft Aring -10
-KPX quotedblleft Atilde -10
-KPX quoteleft A -10
-KPX quoteleft Aacute -10
-KPX quoteleft Abreve -10
-KPX quoteleft Acircumflex -10
-KPX quoteleft Adieresis -10
-KPX quoteleft Agrave -10
-KPX quoteleft Amacron -10
-KPX quoteleft Aogonek -10
-KPX quoteleft Aring -10
-KPX quoteleft Atilde -10
-KPX quoteleft quoteleft -63
-KPX quoteright d -20
-KPX quoteright dcroat -20
-KPX quoteright quoteright -63
-KPX quoteright r -20
-KPX quoteright racute -20
-KPX quoteright rcaron -20
-KPX quoteright rcommaaccent -20
-KPX quoteright s -37
-KPX quoteright sacute -37
-KPX quoteright scaron -37
-KPX quoteright scedilla -37
-KPX quoteright scommaaccent -37
-KPX quoteright space -74
-KPX quoteright v -20
-KPX r c -18
-KPX r cacute -18
-KPX r ccaron -18
-KPX r ccedilla -18
-KPX r comma -92
-KPX r e -18
-KPX r eacute -18
-KPX r ecaron -18
-KPX r ecircumflex -18
-KPX r edieresis -18
-KPX r edotaccent -18
-KPX r egrave -18
-KPX r emacron -18
-KPX r eogonek -18
-KPX r g -10
-KPX r gbreve -10
-KPX r gcommaaccent -10
-KPX r hyphen -37
-KPX r n -15
-KPX r nacute -15
-KPX r ncaron -15
-KPX r ncommaaccent -15
-KPX r ntilde -15
-KPX r o -18
-KPX r oacute -18
-KPX r ocircumflex -18
-KPX r odieresis -18
-KPX r ograve -18
-KPX r ohungarumlaut -18
-KPX r omacron -18
-KPX r oslash -18
-KPX r otilde -18
-KPX r p -10
-KPX r period -100
-KPX r q -18
-KPX r v -10
-KPX racute c -18
-KPX racute cacute -18
-KPX racute ccaron -18
-KPX racute ccedilla -18
-KPX racute comma -92
-KPX racute e -18
-KPX racute eacute -18
-KPX racute ecaron -18
-KPX racute ecircumflex -18
-KPX racute edieresis -18
-KPX racute edotaccent -18
-KPX racute egrave -18
-KPX racute emacron -18
-KPX racute eogonek -18
-KPX racute g -10
-KPX racute gbreve -10
-KPX racute gcommaaccent -10
-KPX racute hyphen -37
-KPX racute n -15
-KPX racute nacute -15
-KPX racute ncaron -15
-KPX racute ncommaaccent -15
-KPX racute ntilde -15
-KPX racute o -18
-KPX racute oacute -18
-KPX racute ocircumflex -18
-KPX racute odieresis -18
-KPX racute ograve -18
-KPX racute ohungarumlaut -18
-KPX racute omacron -18
-KPX racute oslash -18
-KPX racute otilde -18
-KPX racute p -10
-KPX racute period -100
-KPX racute q -18
-KPX racute v -10
-KPX rcaron c -18
-KPX rcaron cacute -18
-KPX rcaron ccaron -18
-KPX rcaron ccedilla -18
-KPX rcaron comma -92
-KPX rcaron e -18
-KPX rcaron eacute -18
-KPX rcaron ecaron -18
-KPX rcaron ecircumflex -18
-KPX rcaron edieresis -18
-KPX rcaron edotaccent -18
-KPX rcaron egrave -18
-KPX rcaron emacron -18
-KPX rcaron eogonek -18
-KPX rcaron g -10
-KPX rcaron gbreve -10
-KPX rcaron gcommaaccent -10
-KPX rcaron hyphen -37
-KPX rcaron n -15
-KPX rcaron nacute -15
-KPX rcaron ncaron -15
-KPX rcaron ncommaaccent -15
-KPX rcaron ntilde -15
-KPX rcaron o -18
-KPX rcaron oacute -18
-KPX rcaron ocircumflex -18
-KPX rcaron odieresis -18
-KPX rcaron ograve -18
-KPX rcaron ohungarumlaut -18
-KPX rcaron omacron -18
-KPX rcaron oslash -18
-KPX rcaron otilde -18
-KPX rcaron p -10
-KPX rcaron period -100
-KPX rcaron q -18
-KPX rcaron v -10
-KPX rcommaaccent c -18
-KPX rcommaaccent cacute -18
-KPX rcommaaccent ccaron -18
-KPX rcommaaccent ccedilla -18
-KPX rcommaaccent comma -92
-KPX rcommaaccent e -18
-KPX rcommaaccent eacute -18
-KPX rcommaaccent ecaron -18
-KPX rcommaaccent ecircumflex -18
-KPX rcommaaccent edieresis -18
-KPX rcommaaccent edotaccent -18
-KPX rcommaaccent egrave -18
-KPX rcommaaccent emacron -18
-KPX rcommaaccent eogonek -18
-KPX rcommaaccent g -10
-KPX rcommaaccent gbreve -10
-KPX rcommaaccent gcommaaccent -10
-KPX rcommaaccent hyphen -37
-KPX rcommaaccent n -15
-KPX rcommaaccent nacute -15
-KPX rcommaaccent ncaron -15
-KPX rcommaaccent ncommaaccent -15
-KPX rcommaaccent ntilde -15
-KPX rcommaaccent o -18
-KPX rcommaaccent oacute -18
-KPX rcommaaccent ocircumflex -18
-KPX rcommaaccent odieresis -18
-KPX rcommaaccent ograve -18
-KPX rcommaaccent ohungarumlaut -18
-KPX rcommaaccent omacron -18
-KPX rcommaaccent oslash -18
-KPX rcommaaccent otilde -18
-KPX rcommaaccent p -10
-KPX rcommaaccent period -100
-KPX rcommaaccent q -18
-KPX rcommaaccent v -10
-KPX space A -55
-KPX space Aacute -55
-KPX space Abreve -55
-KPX space Acircumflex -55
-KPX space Adieresis -55
-KPX space Agrave -55
-KPX space Amacron -55
-KPX space Aogonek -55
-KPX space Aring -55
-KPX space Atilde -55
-KPX space T -30
-KPX space Tcaron -30
-KPX space Tcommaaccent -30
-KPX space V -45
-KPX space W -30
-KPX space Y -55
-KPX space Yacute -55
-KPX space Ydieresis -55
-KPX v a -10
-KPX v aacute -10
-KPX v abreve -10
-KPX v acircumflex -10
-KPX v adieresis -10
-KPX v agrave -10
-KPX v amacron -10
-KPX v aogonek -10
-KPX v aring -10
-KPX v atilde -10
-KPX v comma -55
-KPX v e -10
-KPX v eacute -10
-KPX v ecaron -10
-KPX v ecircumflex -10
-KPX v edieresis -10
-KPX v edotaccent -10
-KPX v egrave -10
-KPX v emacron -10
-KPX v eogonek -10
-KPX v o -10
-KPX v oacute -10
-KPX v ocircumflex -10
-KPX v odieresis -10
-KPX v ograve -10
-KPX v ohungarumlaut -10
-KPX v omacron -10
-KPX v oslash -10
-KPX v otilde -10
-KPX v period -70
-KPX w comma -55
-KPX w o -10
-KPX w oacute -10
-KPX w ocircumflex -10
-KPX w odieresis -10
-KPX w ograve -10
-KPX w ohungarumlaut -10
-KPX w omacron -10
-KPX w oslash -10
-KPX w otilde -10
-KPX w period -70
-KPX y comma -55
-KPX y e -10
-KPX y eacute -10
-KPX y ecaron -10
-KPX y ecircumflex -10
-KPX y edieresis -10
-KPX y edotaccent -10
-KPX y egrave -10
-KPX y emacron -10
-KPX y eogonek -10
-KPX y o -25
-KPX y oacute -25
-KPX y ocircumflex -25
-KPX y odieresis -25
-KPX y ograve -25
-KPX y ohungarumlaut -25
-KPX y omacron -25
-KPX y oslash -25
-KPX y otilde -25
-KPX y period -70
-KPX yacute comma -55
-KPX yacute e -10
-KPX yacute eacute -10
-KPX yacute ecaron -10
-KPX yacute ecircumflex -10
-KPX yacute edieresis -10
-KPX yacute edotaccent -10
-KPX yacute egrave -10
-KPX yacute emacron -10
-KPX yacute eogonek -10
-KPX yacute o -25
-KPX yacute oacute -25
-KPX yacute ocircumflex -25
-KPX yacute odieresis -25
-KPX yacute ograve -25
-KPX yacute ohungarumlaut -25
-KPX yacute omacron -25
-KPX yacute oslash -25
-KPX yacute otilde -25
-KPX yacute period -70
-KPX ydieresis comma -55
-KPX ydieresis e -10
-KPX ydieresis eacute -10
-KPX ydieresis ecaron -10
-KPX ydieresis ecircumflex -10
-KPX ydieresis edieresis -10
-KPX ydieresis edotaccent -10
-KPX ydieresis egrave -10
-KPX ydieresis emacron -10
-KPX ydieresis eogonek -10
-KPX ydieresis o -25
-KPX ydieresis oacute -25
-KPX ydieresis ocircumflex -25
-KPX ydieresis odieresis -25
-KPX ydieresis ograve -25
-KPX ydieresis ohungarumlaut -25
-KPX ydieresis omacron -25
-KPX ydieresis oslash -25
-KPX ydieresis otilde -25
-KPX ydieresis period -70
-EndKernPairs
-EndKernData
-EndFontMetrics
-
diff --git a/LibrarySource/com/lowagie/text/pdf/fonts/Times-BoldItalic.afm b/LibrarySource/com/lowagie/text/pdf/fonts/Times-BoldItalic.afm
deleted file mode 100644
index 2e4adc8..0000000
--- a/LibrarySource/com/lowagie/text/pdf/fonts/Times-BoldItalic.afm
+++ /dev/null
@@ -1,2385 +0,0 @@
-StartFontMetrics 4.1
-Comment Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
-Comment Creation Date: Thu May 1 13:04:06 1997
-Comment UniqueID 43066
-Comment VMusage 45874 56899
-FontName Times-BoldItalic
-FullName Times Bold Italic
-FamilyName Times
-Weight Bold
-ItalicAngle -15
-IsFixedPitch false
-CharacterSet ExtendedRoman
-FontBBox -200 -218 996 921
-UnderlinePosition -100
-UnderlineThickness 50
-Version 002.000
-Notice Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.Times is a trademark of Linotype-Hell AG and/or its subsidiaries.
-EncodingScheme AdobeStandardEncoding
-CapHeight 669
-XHeight 462
-Ascender 683
-Descender -217
-StdHW 42
-StdVW 121
-StartCharMetrics 315
-C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
-C 33 ; WX 389 ; N exclam ; B 67 -13 370 684 ;
-C 34 ; WX 555 ; N quotedbl ; B 136 398 536 685 ;
-C 35 ; WX 500 ; N numbersign ; B -33 0 533 700 ;
-C 36 ; WX 500 ; N dollar ; B -20 -100 497 733 ;
-C 37 ; WX 833 ; N percent ; B 39 -10 793 692 ;
-C 38 ; WX 778 ; N ampersand ; B 5 -19 699 682 ;
-C 39 ; WX 333 ; N quoteright ; B 98 369 302 685 ;
-C 40 ; WX 333 ; N parenleft ; B 28 -179 344 685 ;
-C 41 ; WX 333 ; N parenright ; B -44 -179 271 685 ;
-C 42 ; WX 500 ; N asterisk ; B 65 249 456 685 ;
-C 43 ; WX 570 ; N plus ; B 33 0 537 506 ;
-C 44 ; WX 250 ; N comma ; B -60 -182 144 134 ;
-C 45 ; WX 333 ; N hyphen ; B 2 166 271 282 ;
-C 46 ; WX 250 ; N period ; B -9 -13 139 135 ;
-C 47 ; WX 278 ; N slash ; B -64 -18 342 685 ;
-C 48 ; WX 500 ; N zero ; B 17 -14 477 683 ;
-C 49 ; WX 500 ; N one ; B 5 0 419 683 ;
-C 50 ; WX 500 ; N two ; B -27 0 446 683 ;
-C 51 ; WX 500 ; N three ; B -15 -13 450 683 ;
-C 52 ; WX 500 ; N four ; B -15 0 503 683 ;
-C 53 ; WX 500 ; N five ; B -11 -13 487 669 ;
-C 54 ; WX 500 ; N six ; B 23 -15 509 679 ;
-C 55 ; WX 500 ; N seven ; B 52 0 525 669 ;
-C 56 ; WX 500 ; N eight ; B 3 -13 476 683 ;
-C 57 ; WX 500 ; N nine ; B -12 -10 475 683 ;
-C 58 ; WX 333 ; N colon ; B 23 -13 264 459 ;
-C 59 ; WX 333 ; N semicolon ; B -25 -183 264 459 ;
-C 60 ; WX 570 ; N less ; B 31 -8 539 514 ;
-C 61 ; WX 570 ; N equal ; B 33 107 537 399 ;
-C 62 ; WX 570 ; N greater ; B 31 -8 539 514 ;
-C 63 ; WX 500 ; N question ; B 79 -13 470 684 ;
-C 64 ; WX 832 ; N at ; B 63 -18 770 685 ;
-C 65 ; WX 667 ; N A ; B -67 0 593 683 ;
-C 66 ; WX 667 ; N B ; B -24 0 624 669 ;
-C 67 ; WX 667 ; N C ; B 32 -18 677 685 ;
-C 68 ; WX 722 ; N D ; B -46 0 685 669 ;
-C 69 ; WX 667 ; N E ; B -27 0 653 669 ;
-C 70 ; WX 667 ; N F ; B -13 0 660 669 ;
-C 71 ; WX 722 ; N G ; B 21 -18 706 685 ;
-C 72 ; WX 778 ; N H ; B -24 0 799 669 ;
-C 73 ; WX 389 ; N I ; B -32 0 406 669 ;
-C 74 ; WX 500 ; N J ; B -46 -99 524 669 ;
-C 75 ; WX 667 ; N K ; B -21 0 702 669 ;
-C 76 ; WX 611 ; N L ; B -22 0 590 669 ;
-C 77 ; WX 889 ; N M ; B -29 -12 917 669 ;
-C 78 ; WX 722 ; N N ; B -27 -15 748 669 ;
-C 79 ; WX 722 ; N O ; B 27 -18 691 685 ;
-C 80 ; WX 611 ; N P ; B -27 0 613 669 ;
-C 81 ; WX 722 ; N Q ; B 27 -208 691 685 ;
-C 82 ; WX 667 ; N R ; B -29 0 623 669 ;
-C 83 ; WX 556 ; N S ; B 2 -18 526 685 ;
-C 84 ; WX 611 ; N T ; B 50 0 650 669 ;
-C 85 ; WX 722 ; N U ; B 67 -18 744 669 ;
-C 86 ; WX 667 ; N V ; B 65 -18 715 669 ;
-C 87 ; WX 889 ; N W ; B 65 -18 940 669 ;
-C 88 ; WX 667 ; N X ; B -24 0 694 669 ;
-C 89 ; WX 611 ; N Y ; B 73 0 659 669 ;
-C 90 ; WX 611 ; N Z ; B -11 0 590 669 ;
-C 91 ; WX 333 ; N bracketleft ; B -37 -159 362 674 ;
-C 92 ; WX 278 ; N backslash ; B -1 -18 279 685 ;
-C 93 ; WX 333 ; N bracketright ; B -56 -157 343 674 ;
-C 94 ; WX 570 ; N asciicircum ; B 67 304 503 669 ;
-C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
-C 96 ; WX 333 ; N quoteleft ; B 128 369 332 685 ;
-C 97 ; WX 500 ; N a ; B -21 -14 455 462 ;
-C 98 ; WX 500 ; N b ; B -14 -13 444 699 ;
-C 99 ; WX 444 ; N c ; B -5 -13 392 462 ;
-C 100 ; WX 500 ; N d ; B -21 -13 517 699 ;
-C 101 ; WX 444 ; N e ; B 5 -13 398 462 ;
-C 102 ; WX 333 ; N f ; B -169 -205 446 698 ; L i fi ; L l fl ;
-C 103 ; WX 500 ; N g ; B -52 -203 478 462 ;
-C 104 ; WX 556 ; N h ; B -13 -9 498 699 ;
-C 105 ; WX 278 ; N i ; B 2 -9 263 684 ;
-C 106 ; WX 278 ; N j ; B -189 -207 279 684 ;
-C 107 ; WX 500 ; N k ; B -23 -8 483 699 ;
-C 108 ; WX 278 ; N l ; B 2 -9 290 699 ;
-C 109 ; WX 778 ; N m ; B -14 -9 722 462 ;
-C 110 ; WX 556 ; N n ; B -6 -9 493 462 ;
-C 111 ; WX 500 ; N o ; B -3 -13 441 462 ;
-C 112 ; WX 500 ; N p ; B -120 -205 446 462 ;
-C 113 ; WX 500 ; N q ; B 1 -205 471 462 ;
-C 114 ; WX 389 ; N r ; B -21 0 389 462 ;
-C 115 ; WX 389 ; N s ; B -19 -13 333 462 ;
-C 116 ; WX 278 ; N t ; B -11 -9 281 594 ;
-C 117 ; WX 556 ; N u ; B 15 -9 492 462 ;
-C 118 ; WX 444 ; N v ; B 16 -13 401 462 ;
-C 119 ; WX 667 ; N w ; B 16 -13 614 462 ;
-C 120 ; WX 500 ; N x ; B -46 -13 469 462 ;
-C 121 ; WX 444 ; N y ; B -94 -205 392 462 ;
-C 122 ; WX 389 ; N z ; B -43 -78 368 449 ;
-C 123 ; WX 348 ; N braceleft ; B 5 -187 436 686 ;
-C 124 ; WX 220 ; N bar ; B 66 -218 154 782 ;
-C 125 ; WX 348 ; N braceright ; B -129 -187 302 686 ;
-C 126 ; WX 570 ; N asciitilde ; B 54 173 516 333 ;
-C 161 ; WX 389 ; N exclamdown ; B 19 -205 322 492 ;
-C 162 ; WX 500 ; N cent ; B 42 -143 439 576 ;
-C 163 ; WX 500 ; N sterling ; B -32 -12 510 683 ;
-C 164 ; WX 167 ; N fraction ; B -169 -14 324 683 ;
-C 165 ; WX 500 ; N yen ; B 33 0 628 669 ;
-C 166 ; WX 500 ; N florin ; B -87 -156 537 707 ;
-C 167 ; WX 500 ; N section ; B 36 -143 459 685 ;
-C 168 ; WX 500 ; N currency ; B -26 34 526 586 ;
-C 169 ; WX 278 ; N quotesingle ; B 128 398 268 685 ;
-C 170 ; WX 500 ; N quotedblleft ; B 53 369 513 685 ;
-C 171 ; WX 500 ; N guillemotleft ; B 12 32 468 415 ;
-C 172 ; WX 333 ; N guilsinglleft ; B 32 32 303 415 ;
-C 173 ; WX 333 ; N guilsinglright ; B 10 32 281 415 ;
-C 174 ; WX 556 ; N fi ; B -188 -205 514 703 ;
-C 175 ; WX 556 ; N fl ; B -186 -205 553 704 ;
-C 177 ; WX 500 ; N endash ; B -40 178 477 269 ;
-C 178 ; WX 500 ; N dagger ; B 91 -145 494 685 ;
-C 179 ; WX 500 ; N daggerdbl ; B 10 -139 493 685 ;
-C 180 ; WX 250 ; N periodcentered ; B 51 257 199 405 ;
-C 182 ; WX 500 ; N paragraph ; B -57 -193 562 669 ;
-C 183 ; WX 350 ; N bullet ; B 0 175 350 525 ;
-C 184 ; WX 333 ; N quotesinglbase ; B -5 -182 199 134 ;
-C 185 ; WX 500 ; N quotedblbase ; B -57 -182 403 134 ;
-C 186 ; WX 500 ; N quotedblright ; B 53 369 513 685 ;
-C 187 ; WX 500 ; N guillemotright ; B 12 32 468 415 ;
-C 188 ; WX 1000 ; N ellipsis ; B 40 -13 852 135 ;
-C 189 ; WX 1000 ; N perthousand ; B 7 -29 996 706 ;
-C 191 ; WX 500 ; N questiondown ; B 30 -205 421 492 ;
-C 193 ; WX 333 ; N grave ; B 85 516 297 697 ;
-C 194 ; WX 333 ; N acute ; B 139 516 379 697 ;
-C 195 ; WX 333 ; N circumflex ; B 40 516 367 690 ;
-C 196 ; WX 333 ; N tilde ; B 48 536 407 655 ;
-C 197 ; WX 333 ; N macron ; B 51 553 393 623 ;
-C 198 ; WX 333 ; N breve ; B 71 516 387 678 ;
-C 199 ; WX 333 ; N dotaccent ; B 163 550 298 684 ;
-C 200 ; WX 333 ; N dieresis ; B 55 550 402 684 ;
-C 202 ; WX 333 ; N ring ; B 127 516 340 729 ;
-C 203 ; WX 333 ; N cedilla ; B -80 -218 156 5 ;
-C 205 ; WX 333 ; N hungarumlaut ; B 69 516 498 697 ;
-C 206 ; WX 333 ; N ogonek ; B 15 -183 244 34 ;
-C 207 ; WX 333 ; N caron ; B 79 516 411 690 ;
-C 208 ; WX 1000 ; N emdash ; B -40 178 977 269 ;
-C 225 ; WX 944 ; N AE ; B -64 0 918 669 ;
-C 227 ; WX 266 ; N ordfeminine ; B 16 399 330 685 ;
-C 232 ; WX 611 ; N Lslash ; B -22 0 590 669 ;
-C 233 ; WX 722 ; N Oslash ; B 27 -125 691 764 ;
-C 234 ; WX 944 ; N OE ; B 23 -8 946 677 ;
-C 235 ; WX 300 ; N ordmasculine ; B 56 400 347 685 ;
-C 241 ; WX 722 ; N ae ; B -5 -13 673 462 ;
-C 245 ; WX 278 ; N dotlessi ; B 2 -9 238 462 ;
-C 248 ; WX 278 ; N lslash ; B -7 -9 307 699 ;
-C 249 ; WX 500 ; N oslash ; B -3 -119 441 560 ;
-C 250 ; WX 722 ; N oe ; B 6 -13 674 462 ;
-C 251 ; WX 500 ; N germandbls ; B -200 -200 473 705 ;
-C -1 ; WX 389 ; N Idieresis ; B -32 0 450 862 ;
-C -1 ; WX 444 ; N eacute ; B 5 -13 435 697 ;
-C -1 ; WX 500 ; N abreve ; B -21 -14 471 678 ;
-C -1 ; WX 556 ; N uhungarumlaut ; B 15 -9 610 697 ;
-C -1 ; WX 444 ; N ecaron ; B 5 -13 467 690 ;
-C -1 ; WX 611 ; N Ydieresis ; B 73 0 659 862 ;
-C -1 ; WX 570 ; N divide ; B 33 -29 537 535 ;
-C -1 ; WX 611 ; N Yacute ; B 73 0 659 904 ;
-C -1 ; WX 667 ; N Acircumflex ; B -67 0 593 897 ;
-C -1 ; WX 500 ; N aacute ; B -21 -14 463 697 ;
-C -1 ; WX 722 ; N Ucircumflex ; B 67 -18 744 897 ;
-C -1 ; WX 444 ; N yacute ; B -94 -205 435 697 ;
-C -1 ; WX 389 ; N scommaaccent ; B -19 -218 333 462 ;
-C -1 ; WX 444 ; N ecircumflex ; B 5 -13 423 690 ;
-C -1 ; WX 722 ; N Uring ; B 67 -18 744 921 ;
-C -1 ; WX 722 ; N Udieresis ; B 67 -18 744 862 ;
-C -1 ; WX 500 ; N aogonek ; B -21 -183 455 462 ;
-C -1 ; WX 722 ; N Uacute ; B 67 -18 744 904 ;
-C -1 ; WX 556 ; N uogonek ; B 15 -183 492 462 ;
-C -1 ; WX 667 ; N Edieresis ; B -27 0 653 862 ;
-C -1 ; WX 722 ; N Dcroat ; B -31 0 700 669 ;
-C -1 ; WX 250 ; N commaaccent ; B -36 -218 131 -50 ;
-C -1 ; WX 747 ; N copyright ; B 30 -18 718 685 ;
-C -1 ; WX 667 ; N Emacron ; B -27 0 653 830 ;
-C -1 ; WX 444 ; N ccaron ; B -5 -13 467 690 ;
-C -1 ; WX 500 ; N aring ; B -21 -14 455 729 ;
-C -1 ; WX 722 ; N Ncommaaccent ; B -27 -218 748 669 ;
-C -1 ; WX 278 ; N lacute ; B 2 -9 392 904 ;
-C -1 ; WX 500 ; N agrave ; B -21 -14 455 697 ;
-C -1 ; WX 611 ; N Tcommaaccent ; B 50 -218 650 669 ;
-C -1 ; WX 667 ; N Cacute ; B 32 -18 677 904 ;
-C -1 ; WX 500 ; N atilde ; B -21 -14 491 655 ;
-C -1 ; WX 667 ; N Edotaccent ; B -27 0 653 862 ;
-C -1 ; WX 389 ; N scaron ; B -19 -13 424 690 ;
-C -1 ; WX 389 ; N scedilla ; B -19 -218 333 462 ;
-C -1 ; WX 278 ; N iacute ; B 2 -9 352 697 ;
-C -1 ; WX 494 ; N lozenge ; B 10 0 484 745 ;
-C -1 ; WX 667 ; N Rcaron ; B -29 0 623 897 ;
-C -1 ; WX 722 ; N Gcommaaccent ; B 21 -218 706 685 ;
-C -1 ; WX 556 ; N ucircumflex ; B 15 -9 492 690 ;
-C -1 ; WX 500 ; N acircumflex ; B -21 -14 455 690 ;
-C -1 ; WX 667 ; N Amacron ; B -67 0 593 830 ;
-C -1 ; WX 389 ; N rcaron ; B -21 0 424 690 ;
-C -1 ; WX 444 ; N ccedilla ; B -5 -218 392 462 ;
-C -1 ; WX 611 ; N Zdotaccent ; B -11 0 590 862 ;
-C -1 ; WX 611 ; N Thorn ; B -27 0 573 669 ;
-C -1 ; WX 722 ; N Omacron ; B 27 -18 691 830 ;
-C -1 ; WX 667 ; N Racute ; B -29 0 623 904 ;
-C -1 ; WX 556 ; N Sacute ; B 2 -18 531 904 ;
-C -1 ; WX 608 ; N dcaron ; B -21 -13 675 708 ;
-C -1 ; WX 722 ; N Umacron ; B 67 -18 744 830 ;
-C -1 ; WX 556 ; N uring ; B 15 -9 492 729 ;
-C -1 ; WX 300 ; N threesuperior ; B 17 265 321 683 ;
-C -1 ; WX 722 ; N Ograve ; B 27 -18 691 904 ;
-C -1 ; WX 667 ; N Agrave ; B -67 0 593 904 ;
-C -1 ; WX 667 ; N Abreve ; B -67 0 593 885 ;
-C -1 ; WX 570 ; N multiply ; B 48 16 522 490 ;
-C -1 ; WX 556 ; N uacute ; B 15 -9 492 697 ;
-C -1 ; WX 611 ; N Tcaron ; B 50 0 650 897 ;
-C -1 ; WX 494 ; N partialdiff ; B 11 -21 494 750 ;
-C -1 ; WX 444 ; N ydieresis ; B -94 -205 443 655 ;
-C -1 ; WX 722 ; N Nacute ; B -27 -15 748 904 ;
-C -1 ; WX 278 ; N icircumflex ; B -3 -9 324 690 ;
-C -1 ; WX 667 ; N Ecircumflex ; B -27 0 653 897 ;
-C -1 ; WX 500 ; N adieresis ; B -21 -14 476 655 ;
-C -1 ; WX 444 ; N edieresis ; B 5 -13 448 655 ;
-C -1 ; WX 444 ; N cacute ; B -5 -13 435 697 ;
-C -1 ; WX 556 ; N nacute ; B -6 -9 493 697 ;
-C -1 ; WX 556 ; N umacron ; B 15 -9 492 623 ;
-C -1 ; WX 722 ; N Ncaron ; B -27 -15 748 897 ;
-C -1 ; WX 389 ; N Iacute ; B -32 0 432 904 ;
-C -1 ; WX 570 ; N plusminus ; B 33 0 537 506 ;
-C -1 ; WX 220 ; N brokenbar ; B 66 -143 154 707 ;
-C -1 ; WX 747 ; N registered ; B 30 -18 718 685 ;
-C -1 ; WX 722 ; N Gbreve ; B 21 -18 706 885 ;
-C -1 ; WX 389 ; N Idotaccent ; B -32 0 406 862 ;
-C -1 ; WX 600 ; N summation ; B 14 -10 585 706 ;
-C -1 ; WX 667 ; N Egrave ; B -27 0 653 904 ;
-C -1 ; WX 389 ; N racute ; B -21 0 407 697 ;
-C -1 ; WX 500 ; N omacron ; B -3 -13 462 623 ;
-C -1 ; WX 611 ; N Zacute ; B -11 0 590 904 ;
-C -1 ; WX 611 ; N Zcaron ; B -11 0 590 897 ;
-C -1 ; WX 549 ; N greaterequal ; B 26 0 523 704 ;
-C -1 ; WX 722 ; N Eth ; B -31 0 700 669 ;
-C -1 ; WX 667 ; N Ccedilla ; B 32 -218 677 685 ;
-C -1 ; WX 278 ; N lcommaaccent ; B -42 -218 290 699 ;
-C -1 ; WX 366 ; N tcaron ; B -11 -9 434 754 ;
-C -1 ; WX 444 ; N eogonek ; B 5 -183 398 462 ;
-C -1 ; WX 722 ; N Uogonek ; B 67 -183 744 669 ;
-C -1 ; WX 667 ; N Aacute ; B -67 0 593 904 ;
-C -1 ; WX 667 ; N Adieresis ; B -67 0 593 862 ;
-C -1 ; WX 444 ; N egrave ; B 5 -13 398 697 ;
-C -1 ; WX 389 ; N zacute ; B -43 -78 407 697 ;
-C -1 ; WX 278 ; N iogonek ; B -20 -183 263 684 ;
-C -1 ; WX 722 ; N Oacute ; B 27 -18 691 904 ;
-C -1 ; WX 500 ; N oacute ; B -3 -13 463 697 ;
-C -1 ; WX 500 ; N amacron ; B -21 -14 467 623 ;
-C -1 ; WX 389 ; N sacute ; B -19 -13 407 697 ;
-C -1 ; WX 278 ; N idieresis ; B 2 -9 364 655 ;
-C -1 ; WX 722 ; N Ocircumflex ; B 27 -18 691 897 ;
-C -1 ; WX 722 ; N Ugrave ; B 67 -18 744 904 ;
-C -1 ; WX 612 ; N Delta ; B 6 0 608 688 ;
-C -1 ; WX 500 ; N thorn ; B -120 -205 446 699 ;
-C -1 ; WX 300 ; N twosuperior ; B 2 274 313 683 ;
-C -1 ; WX 722 ; N Odieresis ; B 27 -18 691 862 ;
-C -1 ; WX 576 ; N mu ; B -60 -207 516 449 ;
-C -1 ; WX 278 ; N igrave ; B 2 -9 259 697 ;
-C -1 ; WX 500 ; N ohungarumlaut ; B -3 -13 582 697 ;
-C -1 ; WX 667 ; N Eogonek ; B -27 -183 653 669 ;
-C -1 ; WX 500 ; N dcroat ; B -21 -13 552 699 ;
-C -1 ; WX 750 ; N threequarters ; B 7 -14 726 683 ;
-C -1 ; WX 556 ; N Scedilla ; B 2 -218 526 685 ;
-C -1 ; WX 382 ; N lcaron ; B 2 -9 448 708 ;
-C -1 ; WX 667 ; N Kcommaaccent ; B -21 -218 702 669 ;
-C -1 ; WX 611 ; N Lacute ; B -22 0 590 904 ;
-C -1 ; WX 1000 ; N trademark ; B 32 263 968 669 ;
-C -1 ; WX 444 ; N edotaccent ; B 5 -13 398 655 ;
-C -1 ; WX 389 ; N Igrave ; B -32 0 406 904 ;
-C -1 ; WX 389 ; N Imacron ; B -32 0 461 830 ;
-C -1 ; WX 611 ; N Lcaron ; B -22 0 671 718 ;
-C -1 ; WX 750 ; N onehalf ; B -9 -14 723 683 ;
-C -1 ; WX 549 ; N lessequal ; B 29 0 526 704 ;
-C -1 ; WX 500 ; N ocircumflex ; B -3 -13 451 690 ;
-C -1 ; WX 556 ; N ntilde ; B -6 -9 504 655 ;
-C -1 ; WX 722 ; N Uhungarumlaut ; B 67 -18 744 904 ;
-C -1 ; WX 667 ; N Eacute ; B -27 0 653 904 ;
-C -1 ; WX 444 ; N emacron ; B 5 -13 439 623 ;
-C -1 ; WX 500 ; N gbreve ; B -52 -203 478 678 ;
-C -1 ; WX 750 ; N onequarter ; B 7 -14 721 683 ;
-C -1 ; WX 556 ; N Scaron ; B 2 -18 553 897 ;
-C -1 ; WX 556 ; N Scommaaccent ; B 2 -218 526 685 ;
-C -1 ; WX 722 ; N Ohungarumlaut ; B 27 -18 723 904 ;
-C -1 ; WX 400 ; N degree ; B 83 397 369 683 ;
-C -1 ; WX 500 ; N ograve ; B -3 -13 441 697 ;
-C -1 ; WX 667 ; N Ccaron ; B 32 -18 677 897 ;
-C -1 ; WX 556 ; N ugrave ; B 15 -9 492 697 ;
-C -1 ; WX 549 ; N radical ; B 10 -46 512 850 ;
-C -1 ; WX 722 ; N Dcaron ; B -46 0 685 897 ;
-C -1 ; WX 389 ; N rcommaaccent ; B -67 -218 389 462 ;
-C -1 ; WX 722 ; N Ntilde ; B -27 -15 748 862 ;
-C -1 ; WX 500 ; N otilde ; B -3 -13 491 655 ;
-C -1 ; WX 667 ; N Rcommaaccent ; B -29 -218 623 669 ;
-C -1 ; WX 611 ; N Lcommaaccent ; B -22 -218 590 669 ;
-C -1 ; WX 667 ; N Atilde ; B -67 0 593 862 ;
-C -1 ; WX 667 ; N Aogonek ; B -67 -183 604 683 ;
-C -1 ; WX 667 ; N Aring ; B -67 0 593 921 ;
-C -1 ; WX 722 ; N Otilde ; B 27 -18 691 862 ;
-C -1 ; WX 389 ; N zdotaccent ; B -43 -78 368 655 ;
-C -1 ; WX 667 ; N Ecaron ; B -27 0 653 897 ;
-C -1 ; WX 389 ; N Iogonek ; B -32 -183 406 669 ;
-C -1 ; WX 500 ; N kcommaaccent ; B -23 -218 483 699 ;
-C -1 ; WX 606 ; N minus ; B 51 209 555 297 ;
-C -1 ; WX 389 ; N Icircumflex ; B -32 0 450 897 ;
-C -1 ; WX 556 ; N ncaron ; B -6 -9 523 690 ;
-C -1 ; WX 278 ; N tcommaaccent ; B -62 -218 281 594 ;
-C -1 ; WX 606 ; N logicalnot ; B 51 108 555 399 ;
-C -1 ; WX 500 ; N odieresis ; B -3 -13 471 655 ;
-C -1 ; WX 556 ; N udieresis ; B 15 -9 499 655 ;
-C -1 ; WX 549 ; N notequal ; B 15 -49 540 570 ;
-C -1 ; WX 500 ; N gcommaaccent ; B -52 -203 478 767 ;
-C -1 ; WX 500 ; N eth ; B -3 -13 454 699 ;
-C -1 ; WX 389 ; N zcaron ; B -43 -78 424 690 ;
-C -1 ; WX 556 ; N ncommaaccent ; B -6 -218 493 462 ;
-C -1 ; WX 300 ; N onesuperior ; B 30 274 301 683 ;
-C -1 ; WX 278 ; N imacron ; B 2 -9 294 623 ;
-C -1 ; WX 500 ; N Euro ; B 0 0 0 0 ;
-EndCharMetrics
-StartKernData
-StartKernPairs 2038
-KPX A C -65
-KPX A Cacute -65
-KPX A Ccaron -65
-KPX A Ccedilla -65
-KPX A G -60
-KPX A Gbreve -60
-KPX A Gcommaaccent -60
-KPX A O -50
-KPX A Oacute -50
-KPX A Ocircumflex -50
-KPX A Odieresis -50
-KPX A Ograve -50
-KPX A Ohungarumlaut -50
-KPX A Omacron -50
-KPX A Oslash -50
-KPX A Otilde -50
-KPX A Q -55
-KPX A T -55
-KPX A Tcaron -55
-KPX A Tcommaaccent -55
-KPX A U -50
-KPX A Uacute -50
-KPX A Ucircumflex -50
-KPX A Udieresis -50
-KPX A Ugrave -50
-KPX A Uhungarumlaut -50
-KPX A Umacron -50
-KPX A Uogonek -50
-KPX A Uring -50
-KPX A V -95
-KPX A W -100
-KPX A Y -70
-KPX A Yacute -70
-KPX A Ydieresis -70
-KPX A quoteright -74
-KPX A u -30
-KPX A uacute -30
-KPX A ucircumflex -30
-KPX A udieresis -30
-KPX A ugrave -30
-KPX A uhungarumlaut -30
-KPX A umacron -30
-KPX A uogonek -30
-KPX A uring -30
-KPX A v -74
-KPX A w -74
-KPX A y -74
-KPX A yacute -74
-KPX A ydieresis -74
-KPX Aacute C -65
-KPX Aacute Cacute -65
-KPX Aacute Ccaron -65
-KPX Aacute Ccedilla -65
-KPX Aacute G -60
-KPX Aacute Gbreve -60
-KPX Aacute Gcommaaccent -60
-KPX Aacute O -50
-KPX Aacute Oacute -50
-KPX Aacute Ocircumflex -50
-KPX Aacute Odieresis -50
-KPX Aacute Ograve -50
-KPX Aacute Ohungarumlaut -50
-KPX Aacute Omacron -50
-KPX Aacute Oslash -50
-KPX Aacute Otilde -50
-KPX Aacute Q -55
-KPX Aacute T -55
-KPX Aacute Tcaron -55
-KPX Aacute Tcommaaccent -55
-KPX Aacute U -50
-KPX Aacute Uacute -50
-KPX Aacute Ucircumflex -50
-KPX Aacute Udieresis -50
-KPX Aacute Ugrave -50
-KPX Aacute Uhungarumlaut -50
-KPX Aacute Umacron -50
-KPX Aacute Uogonek -50
-KPX Aacute Uring -50
-KPX Aacute V -95
-KPX Aacute W -100
-KPX Aacute Y -70
-KPX Aacute Yacute -70
-KPX Aacute Ydieresis -70
-KPX Aacute quoteright -74
-KPX Aacute u -30
-KPX Aacute uacute -30
-KPX Aacute ucircumflex -30
-KPX Aacute udieresis -30
-KPX Aacute ugrave -30
-KPX Aacute uhungarumlaut -30
-KPX Aacute umacron -30
-KPX Aacute uogonek -30
-KPX Aacute uring -30
-KPX Aacute v -74
-KPX Aacute w -74
-KPX Aacute y -74
-KPX Aacute yacute -74
-KPX Aacute ydieresis -74
-KPX Abreve C -65
-KPX Abreve Cacute -65
-KPX Abreve Ccaron -65
-KPX Abreve Ccedilla -65
-KPX Abreve G -60
-KPX Abreve Gbreve -60
-KPX Abreve Gcommaaccent -60
-KPX Abreve O -50
-KPX Abreve Oacute -50
-KPX Abreve Ocircumflex -50
-KPX Abreve Odieresis -50
-KPX Abreve Ograve -50
-KPX Abreve Ohungarumlaut -50
-KPX Abreve Omacron -50
-KPX Abreve Oslash -50
-KPX Abreve Otilde -50
-KPX Abreve Q -55
-KPX Abreve T -55
-KPX Abreve Tcaron -55
-KPX Abreve Tcommaaccent -55
-KPX Abreve U -50
-KPX Abreve Uacute -50
-KPX Abreve Ucircumflex -50
-KPX Abreve Udieresis -50
-KPX Abreve Ugrave -50
-KPX Abreve Uhungarumlaut -50
-KPX Abreve Umacron -50
-KPX Abreve Uogonek -50
-KPX Abreve Uring -50
-KPX Abreve V -95
-KPX Abreve W -100
-KPX Abreve Y -70
-KPX Abreve Yacute -70
-KPX Abreve Ydieresis -70
-KPX Abreve quoteright -74
-KPX Abreve u -30
-KPX Abreve uacute -30
-KPX Abreve ucircumflex -30
-KPX Abreve udieresis -30
-KPX Abreve ugrave -30
-KPX Abreve uhungarumlaut -30
-KPX Abreve umacron -30
-KPX Abreve uogonek -30
-KPX Abreve uring -30
-KPX Abreve v -74
-KPX Abreve w -74
-KPX Abreve y -74
-KPX Abreve yacute -74
-KPX Abreve ydieresis -74
-KPX Acircumflex C -65
-KPX Acircumflex Cacute -65
-KPX Acircumflex Ccaron -65
-KPX Acircumflex Ccedilla -65
-KPX Acircumflex G -60
-KPX Acircumflex Gbreve -60
-KPX Acircumflex Gcommaaccent -60
-KPX Acircumflex O -50
-KPX Acircumflex Oacute -50
-KPX Acircumflex Ocircumflex -50
-KPX Acircumflex Odieresis -50
-KPX Acircumflex Ograve -50
-KPX Acircumflex Ohungarumlaut -50
-KPX Acircumflex Omacron -50
-KPX Acircumflex Oslash -50
-KPX Acircumflex Otilde -50
-KPX Acircumflex Q -55
-KPX Acircumflex T -55
-KPX Acircumflex Tcaron -55
-KPX Acircumflex Tcommaaccent -55
-KPX Acircumflex U -50
-KPX Acircumflex Uacute -50
-KPX Acircumflex Ucircumflex -50
-KPX Acircumflex Udieresis -50
-KPX Acircumflex Ugrave -50
-KPX Acircumflex Uhungarumlaut -50
-KPX Acircumflex Umacron -50
-KPX Acircumflex Uogonek -50
-KPX Acircumflex Uring -50
-KPX Acircumflex V -95
-KPX Acircumflex W -100
-KPX Acircumflex Y -70
-KPX Acircumflex Yacute -70
-KPX Acircumflex Ydieresis -70
-KPX Acircumflex quoteright -74
-KPX Acircumflex u -30
-KPX Acircumflex uacute -30
-KPX Acircumflex ucircumflex -30
-KPX Acircumflex udieresis -30
-KPX Acircumflex ugrave -30
-KPX Acircumflex uhungarumlaut -30
-KPX Acircumflex umacron -30
-KPX Acircumflex uogonek -30
-KPX Acircumflex uring -30
-KPX Acircumflex v -74
-KPX Acircumflex w -74
-KPX Acircumflex y -74
-KPX Acircumflex yacute -74
-KPX Acircumflex ydieresis -74
-KPX Adieresis C -65
-KPX Adieresis Cacute -65
-KPX Adieresis Ccaron -65
-KPX Adieresis Ccedilla -65
-KPX Adieresis G -60
-KPX Adieresis Gbreve -60
-KPX Adieresis Gcommaaccent -60
-KPX Adieresis O -50
-KPX Adieresis Oacute -50
-KPX Adieresis Ocircumflex -50
-KPX Adieresis Odieresis -50
-KPX Adieresis Ograve -50
-KPX Adieresis Ohungarumlaut -50
-KPX Adieresis Omacron -50
-KPX Adieresis Oslash -50
-KPX Adieresis Otilde -50
-KPX Adieresis Q -55
-KPX Adieresis T -55
-KPX Adieresis Tcaron -55
-KPX Adieresis Tcommaaccent -55
-KPX Adieresis U -50
-KPX Adieresis Uacute -50
-KPX Adieresis Ucircumflex -50
-KPX Adieresis Udieresis -50
-KPX Adieresis Ugrave -50
-KPX Adieresis Uhungarumlaut -50
-KPX Adieresis Umacron -50
-KPX Adieresis Uogonek -50
-KPX Adieresis Uring -50
-KPX Adieresis V -95
-KPX Adieresis W -100
-KPX Adieresis Y -70
-KPX Adieresis Yacute -70
-KPX Adieresis Ydieresis -70
-KPX Adieresis quoteright -74
-KPX Adieresis u -30
-KPX Adieresis uacute -30
-KPX Adieresis ucircumflex -30
-KPX Adieresis udieresis -30
-KPX Adieresis ugrave -30
-KPX Adieresis uhungarumlaut -30
-KPX Adieresis umacron -30
-KPX Adieresis uogonek -30
-KPX Adieresis uring -30
-KPX Adieresis v -74
-KPX Adieresis w -74
-KPX Adieresis y -74
-KPX Adieresis yacute -74
-KPX Adieresis ydieresis -74
-KPX Agrave C -65
-KPX Agrave Cacute -65
-KPX Agrave Ccaron -65
-KPX Agrave Ccedilla -65
-KPX Agrave G -60
-KPX Agrave Gbreve -60
-KPX Agrave Gcommaaccent -60
-KPX Agrave O -50
-KPX Agrave Oacute -50
-KPX Agrave Ocircumflex -50
-KPX Agrave Odieresis -50
-KPX Agrave Ograve -50
-KPX Agrave Ohungarumlaut -50
-KPX Agrave Omacron -50
-KPX Agrave Oslash -50
-KPX Agrave Otilde -50
-KPX Agrave Q -55
-KPX Agrave T -55
-KPX Agrave Tcaron -55
-KPX Agrave Tcommaaccent -55
-KPX Agrave U -50
-KPX Agrave Uacute -50
-KPX Agrave Ucircumflex -50
-KPX Agrave Udieresis -50
-KPX Agrave Ugrave -50
-KPX Agrave Uhungarumlaut -50
-KPX Agrave Umacron -50
-KPX Agrave Uogonek -50
-KPX Agrave Uring -50
-KPX Agrave V -95
-KPX Agrave W -100
-KPX Agrave Y -70
-KPX Agrave Yacute -70
-KPX Agrave Ydieresis -70
-KPX Agrave quoteright -74
-KPX Agrave u -30
-KPX Agrave uacute -30
-KPX Agrave ucircumflex -30
-KPX Agrave udieresis -30
-KPX Agrave ugrave -30
-KPX Agrave uhungarumlaut -30
-KPX Agrave umacron -30
-KPX Agrave uogonek -30
-KPX Agrave uring -30
-KPX Agrave v -74
-KPX Agrave w -74
-KPX Agrave y -74
-KPX Agrave yacute -74
-KPX Agrave ydieresis -74
-KPX Amacron C -65
-KPX Amacron Cacute -65
-KPX Amacron Ccaron -65
-KPX Amacron Ccedilla -65
-KPX Amacron G -60
-KPX Amacron Gbreve -60
-KPX Amacron Gcommaaccent -60
-KPX Amacron O -50
-KPX Amacron Oacute -50
-KPX Amacron Ocircumflex -50
-KPX Amacron Odieresis -50
-KPX Amacron Ograve -50
-KPX Amacron Ohungarumlaut -50
-KPX Amacron Omacron -50
-KPX Amacron Oslash -50
-KPX Amacron Otilde -50
-KPX Amacron Q -55
-KPX Amacron T -55
-KPX Amacron Tcaron -55
-KPX Amacron Tcommaaccent -55
-KPX Amacron U -50
-KPX Amacron Uacute -50
-KPX Amacron Ucircumflex -50
-KPX Amacron Udieresis -50
-KPX Amacron Ugrave -50
-KPX Amacron Uhungarumlaut -50
-KPX Amacron Umacron -50
-KPX Amacron Uogonek -50
-KPX Amacron Uring -50
-KPX Amacron V -95
-KPX Amacron W -100
-KPX Amacron Y -70
-KPX Amacron Yacute -70
-KPX Amacron Ydieresis -70
-KPX Amacron quoteright -74
-KPX Amacron u -30
-KPX Amacron uacute -30
-KPX Amacron ucircumflex -30
-KPX Amacron udieresis -30
-KPX Amacron ugrave -30
-KPX Amacron uhungarumlaut -30
-KPX Amacron umacron -30
-KPX Amacron uogonek -30
-KPX Amacron uring -30
-KPX Amacron v -74
-KPX Amacron w -74
-KPX Amacron y -74
-KPX Amacron yacute -74
-KPX Amacron ydieresis -74
-KPX Aogonek C -65
-KPX Aogonek Cacute -65
-KPX Aogonek Ccaron -65
-KPX Aogonek Ccedilla -65
-KPX Aogonek G -60
-KPX Aogonek Gbreve -60
-KPX Aogonek Gcommaaccent -60
-KPX Aogonek O -50
-KPX Aogonek Oacute -50
-KPX Aogonek Ocircumflex -50
-KPX Aogonek Odieresis -50
-KPX Aogonek Ograve -50
-KPX Aogonek Ohungarumlaut -50
-KPX Aogonek Omacron -50
-KPX Aogonek Oslash -50
-KPX Aogonek Otilde -50
-KPX Aogonek Q -55
-KPX Aogonek T -55
-KPX Aogonek Tcaron -55
-KPX Aogonek Tcommaaccent -55
-KPX Aogonek U -50
-KPX Aogonek Uacute -50
-KPX Aogonek Ucircumflex -50
-KPX Aogonek Udieresis -50
-KPX Aogonek Ugrave -50
-KPX Aogonek Uhungarumlaut -50
-KPX Aogonek Umacron -50
-KPX Aogonek Uogonek -50
-KPX Aogonek Uring -50
-KPX Aogonek V -95
-KPX Aogonek W -100
-KPX Aogonek Y -70
-KPX Aogonek Yacute -70
-KPX Aogonek Ydieresis -70
-KPX Aogonek quoteright -74
-KPX Aogonek u -30
-KPX Aogonek uacute -30
-KPX Aogonek ucircumflex -30
-KPX Aogonek udieresis -30
-KPX Aogonek ugrave -30
-KPX Aogonek uhungarumlaut -30
-KPX Aogonek umacron -30
-KPX Aogonek uogonek -30
-KPX Aogonek uring -30
-KPX Aogonek v -74
-KPX Aogonek w -74
-KPX Aogonek y -34
-KPX Aogonek yacute -34
-KPX Aogonek ydieresis -34
-KPX Aring C -65
-KPX Aring Cacute -65
-KPX Aring Ccaron -65
-KPX Aring Ccedilla -65
-KPX Aring G -60
-KPX Aring Gbreve -60
-KPX Aring Gcommaaccent -60
-KPX Aring O -50
-KPX Aring Oacute -50
-KPX Aring Ocircumflex -50
-KPX Aring Odieresis -50
-KPX Aring Ograve -50
-KPX Aring Ohungarumlaut -50
-KPX Aring Omacron -50
-KPX Aring Oslash -50
-KPX Aring Otilde -50
-KPX Aring Q -55
-KPX Aring T -55
-KPX Aring Tcaron -55
-KPX Aring Tcommaaccent -55
-KPX Aring U -50
-KPX Aring Uacute -50
-KPX Aring Ucircumflex -50
-KPX Aring Udieresis -50
-KPX Aring Ugrave -50
-KPX Aring Uhungarumlaut -50
-KPX Aring Umacron -50
-KPX Aring Uogonek -50
-KPX Aring Uring -50
-KPX Aring V -95
-KPX Aring W -100
-KPX Aring Y -70
-KPX Aring Yacute -70
-KPX Aring Ydieresis -70
-KPX Aring quoteright -74
-KPX Aring u -30
-KPX Aring uacute -30
-KPX Aring ucircumflex -30
-KPX Aring udieresis -30
-KPX Aring ugrave -30
-KPX Aring uhungarumlaut -30
-KPX Aring umacron -30
-KPX Aring uogonek -30
-KPX Aring uring -30
-KPX Aring v -74
-KPX Aring w -74
-KPX Aring y -74
-KPX Aring yacute -74
-KPX Aring ydieresis -74
-KPX Atilde C -65
-KPX Atilde Cacute -65
-KPX Atilde Ccaron -65
-KPX Atilde Ccedilla -65
-KPX Atilde G -60
-KPX Atilde Gbreve -60
-KPX Atilde Gcommaaccent -60
-KPX Atilde O -50
-KPX Atilde Oacute -50
-KPX Atilde Ocircumflex -50
-KPX Atilde Odieresis -50
-KPX Atilde Ograve -50
-KPX Atilde Ohungarumlaut -50
-KPX Atilde Omacron -50
-KPX Atilde Oslash -50
-KPX Atilde Otilde -50
-KPX Atilde Q -55
-KPX Atilde T -55
-KPX Atilde Tcaron -55
-KPX Atilde Tcommaaccent -55
-KPX Atilde U -50
-KPX Atilde Uacute -50
-KPX Atilde Ucircumflex -50
-KPX Atilde Udieresis -50
-KPX Atilde Ugrave -50
-KPX Atilde Uhungarumlaut -50
-KPX Atilde Umacron -50
-KPX Atilde Uogonek -50
-KPX Atilde Uring -50
-KPX Atilde V -95
-KPX Atilde W -100
-KPX Atilde Y -70
-KPX Atilde Yacute -70
-KPX Atilde Ydieresis -70
-KPX Atilde quoteright -74
-KPX Atilde u -30
-KPX Atilde uacute -30
-KPX Atilde ucircumflex -30
-KPX Atilde udieresis -30
-KPX Atilde ugrave -30
-KPX Atilde uhungarumlaut -30
-KPX Atilde umacron -30
-KPX Atilde uogonek -30
-KPX Atilde uring -30
-KPX Atilde v -74
-KPX Atilde w -74
-KPX Atilde y -74
-KPX Atilde yacute -74
-KPX Atilde ydieresis -74
-KPX B A -25
-KPX B Aacute -25
-KPX B Abreve -25
-KPX B Acircumflex -25
-KPX B Adieresis -25
-KPX B Agrave -25
-KPX B Amacron -25
-KPX B Aogonek -25
-KPX B Aring -25
-KPX B Atilde -25
-KPX B U -10
-KPX B Uacute -10
-KPX B Ucircumflex -10
-KPX B Udieresis -10
-KPX B Ugrave -10
-KPX B Uhungarumlaut -10
-KPX B Umacron -10
-KPX B Uogonek -10
-KPX B Uring -10
-KPX D A -25
-KPX D Aacute -25
-KPX D Abreve -25
-KPX D Acircumflex -25
-KPX D Adieresis -25
-KPX D Agrave -25
-KPX D Amacron -25
-KPX D Aogonek -25
-KPX D Aring -25
-KPX D Atilde -25
-KPX D V -50
-KPX D W -40
-KPX D Y -50
-KPX D Yacute -50
-KPX D Ydieresis -50
-KPX Dcaron A -25
-KPX Dcaron Aacute -25
-KPX Dcaron Abreve -25
-KPX Dcaron Acircumflex -25
-KPX Dcaron Adieresis -25
-KPX Dcaron Agrave -25
-KPX Dcaron Amacron -25
-KPX Dcaron Aogonek -25
-KPX Dcaron Aring -25
-KPX Dcaron Atilde -25
-KPX Dcaron V -50
-KPX Dcaron W -40
-KPX Dcaron Y -50
-KPX Dcaron Yacute -50
-KPX Dcaron Ydieresis -50
-KPX Dcroat A -25
-KPX Dcroat Aacute -25
-KPX Dcroat Abreve -25
-KPX Dcroat Acircumflex -25
-KPX Dcroat Adieresis -25
-KPX Dcroat Agrave -25
-KPX Dcroat Amacron -25
-KPX Dcroat Aogonek -25
-KPX Dcroat Aring -25
-KPX Dcroat Atilde -25
-KPX Dcroat V -50
-KPX Dcroat W -40
-KPX Dcroat Y -50
-KPX Dcroat Yacute -50
-KPX Dcroat Ydieresis -50
-KPX F A -100
-KPX F Aacute -100
-KPX F Abreve -100
-KPX F Acircumflex -100
-KPX F Adieresis -100
-KPX F Agrave -100
-KPX F Amacron -100
-KPX F Aogonek -100
-KPX F Aring -100
-KPX F Atilde -100
-KPX F a -95
-KPX F aacute -95
-KPX F abreve -95
-KPX F acircumflex -95
-KPX F adieresis -95
-KPX F agrave -95
-KPX F amacron -95
-KPX F aogonek -95
-KPX F aring -95
-KPX F atilde -95
-KPX F comma -129
-KPX F e -100
-KPX F eacute -100
-KPX F ecaron -100
-KPX F ecircumflex -100
-KPX F edieresis -100
-KPX F edotaccent -100
-KPX F egrave -100
-KPX F emacron -100
-KPX F eogonek -100
-KPX F i -40
-KPX F iacute -40
-KPX F icircumflex -40
-KPX F idieresis -40
-KPX F igrave -40
-KPX F imacron -40
-KPX F iogonek -40
-KPX F o -70
-KPX F oacute -70
-KPX F ocircumflex -70
-KPX F odieresis -70
-KPX F ograve -70
-KPX F ohungarumlaut -70
-KPX F omacron -70
-KPX F oslash -70
-KPX F otilde -70
-KPX F period -129
-KPX F r -50
-KPX F racute -50
-KPX F rcaron -50
-KPX F rcommaaccent -50
-KPX J A -25
-KPX J Aacute -25
-KPX J Abreve -25
-KPX J Acircumflex -25
-KPX J Adieresis -25
-KPX J Agrave -25
-KPX J Amacron -25
-KPX J Aogonek -25
-KPX J Aring -25
-KPX J Atilde -25
-KPX J a -40
-KPX J aacute -40
-KPX J abreve -40
-KPX J acircumflex -40
-KPX J adieresis -40
-KPX J agrave -40
-KPX J amacron -40
-KPX J aogonek -40
-KPX J aring -40
-KPX J atilde -40
-KPX J comma -10
-KPX J e -40
-KPX J eacute -40
-KPX J ecaron -40
-KPX J ecircumflex -40
-KPX J edieresis -40
-KPX J edotaccent -40
-KPX J egrave -40
-KPX J emacron -40
-KPX J eogonek -40
-KPX J o -40
-KPX J oacute -40
-KPX J ocircumflex -40
-KPX J odieresis -40
-KPX J ograve -40
-KPX J ohungarumlaut -40
-KPX J omacron -40
-KPX J oslash -40
-KPX J otilde -40
-KPX J period -10
-KPX J u -40
-KPX J uacute -40
-KPX J ucircumflex -40
-KPX J udieresis -40
-KPX J ugrave -40
-KPX J uhungarumlaut -40
-KPX J umacron -40
-KPX J uogonek -40
-KPX J uring -40
-KPX K O -30
-KPX K Oacute -30
-KPX K Ocircumflex -30
-KPX K Odieresis -30
-KPX K Ograve -30
-KPX K Ohungarumlaut -30
-KPX K Omacron -30
-KPX K Oslash -30
-KPX K Otilde -30
-KPX K e -25
-KPX K eacute -25
-KPX K ecaron -25
-KPX K ecircumflex -25
-KPX K edieresis -25
-KPX K edotaccent -25
-KPX K egrave -25
-KPX K emacron -25
-KPX K eogonek -25
-KPX K o -25
-KPX K oacute -25
-KPX K ocircumflex -25
-KPX K odieresis -25
-KPX K ograve -25
-KPX K ohungarumlaut -25
-KPX K omacron -25
-KPX K oslash -25
-KPX K otilde -25
-KPX K u -20
-KPX K uacute -20
-KPX K ucircumflex -20
-KPX K udieresis -20
-KPX K ugrave -20
-KPX K uhungarumlaut -20
-KPX K umacron -20
-KPX K uogonek -20
-KPX K uring -20
-KPX K y -20
-KPX K yacute -20
-KPX K ydieresis -20
-KPX Kcommaaccent O -30
-KPX Kcommaaccent Oacute -30
-KPX Kcommaaccent Ocircumflex -30
-KPX Kcommaaccent Odieresis -30
-KPX Kcommaaccent Ograve -30
-KPX Kcommaaccent Ohungarumlaut -30
-KPX Kcommaaccent Omacron -30
-KPX Kcommaaccent Oslash -30
-KPX Kcommaaccent Otilde -30
-KPX Kcommaaccent e -25
-KPX Kcommaaccent eacute -25
-KPX Kcommaaccent ecaron -25
-KPX Kcommaaccent ecircumflex -25
-KPX Kcommaaccent edieresis -25
-KPX Kcommaaccent edotaccent -25
-KPX Kcommaaccent egrave -25
-KPX Kcommaaccent emacron -25
-KPX Kcommaaccent eogonek -25
-KPX Kcommaaccent o -25
-KPX Kcommaaccent oacute -25
-KPX Kcommaaccent ocircumflex -25
-KPX Kcommaaccent odieresis -25
-KPX Kcommaaccent ograve -25
-KPX Kcommaaccent ohungarumlaut -25
-KPX Kcommaaccent omacron -25
-KPX Kcommaaccent oslash -25
-KPX Kcommaaccent otilde -25
-KPX Kcommaaccent u -20
-KPX Kcommaaccent uacute -20
-KPX Kcommaaccent ucircumflex -20
-KPX Kcommaaccent udieresis -20
-KPX Kcommaaccent ugrave -20
-KPX Kcommaaccent uhungarumlaut -20
-KPX Kcommaaccent umacron -20
-KPX Kcommaaccent uogonek -20
-KPX Kcommaaccent uring -20
-KPX Kcommaaccent y -20
-KPX Kcommaaccent yacute -20
-KPX Kcommaaccent ydieresis -20
-KPX L T -18
-KPX L Tcaron -18
-KPX L Tcommaaccent -18
-KPX L V -37
-KPX L W -37
-KPX L Y -37
-KPX L Yacute -37
-KPX L Ydieresis -37
-KPX L quoteright -55
-KPX L y -37
-KPX L yacute -37
-KPX L ydieresis -37
-KPX Lacute T -18
-KPX Lacute Tcaron -18
-KPX Lacute Tcommaaccent -18
-KPX Lacute V -37
-KPX Lacute W -37
-KPX Lacute Y -37
-KPX Lacute Yacute -37
-KPX Lacute Ydieresis -37
-KPX Lacute quoteright -55
-KPX Lacute y -37
-KPX Lacute yacute -37
-KPX Lacute ydieresis -37
-KPX Lcommaaccent T -18
-KPX Lcommaaccent Tcaron -18
-KPX Lcommaaccent Tcommaaccent -18
-KPX Lcommaaccent V -37
-KPX Lcommaaccent W -37
-KPX Lcommaaccent Y -37
-KPX Lcommaaccent Yacute -37
-KPX Lcommaaccent Ydieresis -37
-KPX Lcommaaccent quoteright -55
-KPX Lcommaaccent y -37
-KPX Lcommaaccent yacute -37
-KPX Lcommaaccent ydieresis -37
-KPX Lslash T -18
-KPX Lslash Tcaron -18
-KPX Lslash Tcommaaccent -18
-KPX Lslash V -37
-KPX Lslash W -37
-KPX Lslash Y -37
-KPX Lslash Yacute -37
-KPX Lslash Ydieresis -37
-KPX Lslash quoteright -55
-KPX Lslash y -37
-KPX Lslash yacute -37
-KPX Lslash ydieresis -37
-KPX N A -30
-KPX N Aacute -30
-KPX N Abreve -30
-KPX N Acircumflex -30
-KPX N Adieresis -30
-KPX N Agrave -30
-KPX N Amacron -30
-KPX N Aogonek -30
-KPX N Aring -30
-KPX N Atilde -30
-KPX Nacute A -30
-KPX Nacute Aacute -30
-KPX Nacute Abreve -30
-KPX Nacute Acircumflex -30
-KPX Nacute Adieresis -30
-KPX Nacute Agrave -30
-KPX Nacute Amacron -30
-KPX Nacute Aogonek -30
-KPX Nacute Aring -30
-KPX Nacute Atilde -30
-KPX Ncaron A -30
-KPX Ncaron Aacute -30
-KPX Ncaron Abreve -30
-KPX Ncaron Acircumflex -30
-KPX Ncaron Adieresis -30
-KPX Ncaron Agrave -30
-KPX Ncaron Amacron -30
-KPX Ncaron Aogonek -30
-KPX Ncaron Aring -30
-KPX Ncaron Atilde -30
-KPX Ncommaaccent A -30
-KPX Ncommaaccent Aacute -30
-KPX Ncommaaccent Abreve -30
-KPX Ncommaaccent Acircumflex -30
-KPX Ncommaaccent Adieresis -30
-KPX Ncommaaccent Agrave -30
-KPX Ncommaaccent Amacron -30
-KPX Ncommaaccent Aogonek -30
-KPX Ncommaaccent Aring -30
-KPX Ncommaaccent Atilde -30
-KPX Ntilde A -30
-KPX Ntilde Aacute -30
-KPX Ntilde Abreve -30
-KPX Ntilde Acircumflex -30
-KPX Ntilde Adieresis -30
-KPX Ntilde Agrave -30
-KPX Ntilde Amacron -30
-KPX Ntilde Aogonek -30
-KPX Ntilde Aring -30
-KPX Ntilde Atilde -30
-KPX O A -40
-KPX O Aacute -40
-KPX O Abreve -40
-KPX O Acircumflex -40
-KPX O Adieresis -40
-KPX O Agrave -40
-KPX O Amacron -40
-KPX O Aogonek -40
-KPX O Aring -40
-KPX O Atilde -40
-KPX O T -40
-KPX O Tcaron -40
-KPX O Tcommaaccent -40
-KPX O V -50
-KPX O W -50
-KPX O X -40
-KPX O Y -50
-KPX O Yacute -50
-KPX O Ydieresis -50
-KPX Oacute A -40
-KPX Oacute Aacute -40
-KPX Oacute Abreve -40
-KPX Oacute Acircumflex -40
-KPX Oacute Adieresis -40
-KPX Oacute Agrave -40
-KPX Oacute Amacron -40
-KPX Oacute Aogonek -40
-KPX Oacute Aring -40
-KPX Oacute Atilde -40
-KPX Oacute T -40
-KPX Oacute Tcaron -40
-KPX Oacute Tcommaaccent -40
-KPX Oacute V -50
-KPX Oacute W -50
-KPX Oacute X -40
-KPX Oacute Y -50
-KPX Oacute Yacute -50
-KPX Oacute Ydieresis -50
-KPX Ocircumflex A -40
-KPX Ocircumflex Aacute -40
-KPX Ocircumflex Abreve -40
-KPX Ocircumflex Acircumflex -40
-KPX Ocircumflex Adieresis -40
-KPX Ocircumflex Agrave -40
-KPX Ocircumflex Amacron -40
-KPX Ocircumflex Aogonek -40
-KPX Ocircumflex Aring -40
-KPX Ocircumflex Atilde -40
-KPX Ocircumflex T -40
-KPX Ocircumflex Tcaron -40
-KPX Ocircumflex Tcommaaccent -40
-KPX Ocircumflex V -50
-KPX Ocircumflex W -50
-KPX Ocircumflex X -40
-KPX Ocircumflex Y -50
-KPX Ocircumflex Yacute -50
-KPX Ocircumflex Ydieresis -50
-KPX Odieresis A -40
-KPX Odieresis Aacute -40
-KPX Odieresis Abreve -40
-KPX Odieresis Acircumflex -40
-KPX Odieresis Adieresis -40
-KPX Odieresis Agrave -40
-KPX Odieresis Amacron -40
-KPX Odieresis Aogonek -40
-KPX Odieresis Aring -40
-KPX Odieresis Atilde -40
-KPX Odieresis T -40
-KPX Odieresis Tcaron -40
-KPX Odieresis Tcommaaccent -40
-KPX Odieresis V -50
-KPX Odieresis W -50
-KPX Odieresis X -40
-KPX Odieresis Y -50
-KPX Odieresis Yacute -50
-KPX Odieresis Ydieresis -50
-KPX Ograve A -40
-KPX Ograve Aacute -40
-KPX Ograve Abreve -40
-KPX Ograve Acircumflex -40
-KPX Ograve Adieresis -40
-KPX Ograve Agrave -40
-KPX Ograve Amacron -40
-KPX Ograve Aogonek -40
-KPX Ograve Aring -40
-KPX Ograve Atilde -40
-KPX Ograve T -40
-KPX Ograve Tcaron -40
-KPX Ograve Tcommaaccent -40
-KPX Ograve V -50
-KPX Ograve W -50
-KPX Ograve X -40
-KPX Ograve Y -50
-KPX Ograve Yacute -50
-KPX Ograve Ydieresis -50
-KPX Ohungarumlaut A -40
-KPX Ohungarumlaut Aacute -40
-KPX Ohungarumlaut Abreve -40
-KPX Ohungarumlaut Acircumflex -40
-KPX Ohungarumlaut Adieresis -40
-KPX Ohungarumlaut Agrave -40
-KPX Ohungarumlaut Amacron -40
-KPX Ohungarumlaut Aogonek -40
-KPX Ohungarumlaut Aring -40
-KPX Ohungarumlaut Atilde -40
-KPX Ohungarumlaut T -40
-KPX Ohungarumlaut Tcaron -40
-KPX Ohungarumlaut Tcommaaccent -40
-KPX Ohungarumlaut V -50
-KPX Ohungarumlaut W -50
-KPX Ohungarumlaut X -40
-KPX Ohungarumlaut Y -50
-KPX Ohungarumlaut Yacute -50
-KPX Ohungarumlaut Ydieresis -50
-KPX Omacron A -40
-KPX Omacron Aacute -40
-KPX Omacron Abreve -40
-KPX Omacron Acircumflex -40
-KPX Omacron Adieresis -40
-KPX Omacron Agrave -40
-KPX Omacron Amacron -40
-KPX Omacron Aogonek -40
-KPX Omacron Aring -40
-KPX Omacron Atilde -40
-KPX Omacron T -40
-KPX Omacron Tcaron -40
-KPX Omacron Tcommaaccent -40
-KPX Omacron V -50
-KPX Omacron W -50
-KPX Omacron X -40
-KPX Omacron Y -50
-KPX Omacron Yacute -50
-KPX Omacron Ydieresis -50
-KPX Oslash A -40
-KPX Oslash Aacute -40
-KPX Oslash Abreve -40
-KPX Oslash Acircumflex -40
-KPX Oslash Adieresis -40
-KPX Oslash Agrave -40
-KPX Oslash Amacron -40
-KPX Oslash Aogonek -40
-KPX Oslash Aring -40
-KPX Oslash Atilde -40
-KPX Oslash T -40
-KPX Oslash Tcaron -40
-KPX Oslash Tcommaaccent -40
-KPX Oslash V -50
-KPX Oslash W -50
-KPX Oslash X -40
-KPX Oslash Y -50
-KPX Oslash Yacute -50
-KPX Oslash Ydieresis -50
-KPX Otilde A -40
-KPX Otilde Aacute -40
-KPX Otilde Abreve -40
-KPX Otilde Acircumflex -40
-KPX Otilde Adieresis -40
-KPX Otilde Agrave -40
-KPX Otilde Amacron -40
-KPX Otilde Aogonek -40
-KPX Otilde Aring -40
-KPX Otilde Atilde -40
-KPX Otilde T -40
-KPX Otilde Tcaron -40
-KPX Otilde Tcommaaccent -40
-KPX Otilde V -50
-KPX Otilde W -50
-KPX Otilde X -40
-KPX Otilde Y -50
-KPX Otilde Yacute -50
-KPX Otilde Ydieresis -50
-KPX P A -85
-KPX P Aacute -85
-KPX P Abreve -85
-KPX P Acircumflex -85
-KPX P Adieresis -85
-KPX P Agrave -85
-KPX P Amacron -85
-KPX P Aogonek -85
-KPX P Aring -85
-KPX P Atilde -85
-KPX P a -40
-KPX P aacute -40
-KPX P abreve -40
-KPX P acircumflex -40
-KPX P adieresis -40
-KPX P agrave -40
-KPX P amacron -40
-KPX P aogonek -40
-KPX P aring -40
-KPX P atilde -40
-KPX P comma -129
-KPX P e -50
-KPX P eacute -50
-KPX P ecaron -50
-KPX P ecircumflex -50
-KPX P edieresis -50
-KPX P edotaccent -50
-KPX P egrave -50
-KPX P emacron -50
-KPX P eogonek -50
-KPX P o -55
-KPX P oacute -55
-KPX P ocircumflex -55
-KPX P odieresis -55
-KPX P ograve -55
-KPX P ohungarumlaut -55
-KPX P omacron -55
-KPX P oslash -55
-KPX P otilde -55
-KPX P period -129
-KPX Q U -10
-KPX Q Uacute -10
-KPX Q Ucircumflex -10
-KPX Q Udieresis -10
-KPX Q Ugrave -10
-KPX Q Uhungarumlaut -10
-KPX Q Umacron -10
-KPX Q Uogonek -10
-KPX Q Uring -10
-KPX R O -40
-KPX R Oacute -40
-KPX R Ocircumflex -40
-KPX R Odieresis -40
-KPX R Ograve -40
-KPX R Ohungarumlaut -40
-KPX R Omacron -40
-KPX R Oslash -40
-KPX R Otilde -40
-KPX R T -30
-KPX R Tcaron -30
-KPX R Tcommaaccent -30
-KPX R U -40
-KPX R Uacute -40
-KPX R Ucircumflex -40
-KPX R Udieresis -40
-KPX R Ugrave -40
-KPX R Uhungarumlaut -40
-KPX R Umacron -40
-KPX R Uogonek -40
-KPX R Uring -40
-KPX R V -18
-KPX R W -18
-KPX R Y -18
-KPX R Yacute -18
-KPX R Ydieresis -18
-KPX Racute O -40
-KPX Racute Oacute -40
-KPX Racute Ocircumflex -40
-KPX Racute Odieresis -40
-KPX Racute Ograve -40
-KPX Racute Ohungarumlaut -40
-KPX Racute Omacron -40
-KPX Racute Oslash -40
-KPX Racute Otilde -40
-KPX Racute T -30
-KPX Racute Tcaron -30
-KPX Racute Tcommaaccent -30
-KPX Racute U -40
-KPX Racute Uacute -40
-KPX Racute Ucircumflex -40
-KPX Racute Udieresis -40
-KPX Racute Ugrave -40
-KPX Racute Uhungarumlaut -40
-KPX Racute Umacron -40
-KPX Racute Uogonek -40
-KPX Racute Uring -40
-KPX Racute V -18
-KPX Racute W -18
-KPX Racute Y -18
-KPX Racute Yacute -18
-KPX Racute Ydieresis -18
-KPX Rcaron O -40
-KPX Rcaron Oacute -40
-KPX Rcaron Ocircumflex -40
-KPX Rcaron Odieresis -40
-KPX Rcaron Ograve -40
-KPX Rcaron Ohungarumlaut -40
-KPX Rcaron Omacron -40
-KPX Rcaron Oslash -40
-KPX Rcaron Otilde -40
-KPX Rcaron T -30
-KPX Rcaron Tcaron -30
-KPX Rcaron Tcommaaccent -30
-KPX Rcaron U -40
-KPX Rcaron Uacute -40
-KPX Rcaron Ucircumflex -40
-KPX Rcaron Udieresis -40
-KPX Rcaron Ugrave -40
-KPX Rcaron Uhungarumlaut -40
-KPX Rcaron Umacron -40
-KPX Rcaron Uogonek -40
-KPX Rcaron Uring -40
-KPX Rcaron V -18
-KPX Rcaron W -18
-KPX Rcaron Y -18
-KPX Rcaron Yacute -18
-KPX Rcaron Ydieresis -18
-KPX Rcommaaccent O -40
-KPX Rcommaaccent Oacute -40
-KPX Rcommaaccent Ocircumflex -40
-KPX Rcommaaccent Odieresis -40
-KPX Rcommaaccent Ograve -40
-KPX Rcommaaccent Ohungarumlaut -40
-KPX Rcommaaccent Omacron -40
-KPX Rcommaaccent Oslash -40
-KPX Rcommaaccent Otilde -40
-KPX Rcommaaccent T -30
-KPX Rcommaaccent Tcaron -30
-KPX Rcommaaccent Tcommaaccent -30
-KPX Rcommaaccent U -40
-KPX Rcommaaccent Uacute -40
-KPX Rcommaaccent Ucircumflex -40
-KPX Rcommaaccent Udieresis -40
-KPX Rcommaaccent Ugrave -40
-KPX Rcommaaccent Uhungarumlaut -40
-KPX Rcommaaccent Umacron -40
-KPX Rcommaaccent Uogonek -40
-KPX Rcommaaccent Uring -40
-KPX Rcommaaccent V -18
-KPX Rcommaaccent W -18
-KPX Rcommaaccent Y -18
-KPX Rcommaaccent Yacute -18
-KPX Rcommaaccent Ydieresis -18
-KPX T A -55
-KPX T Aacute -55
-KPX T Abreve -55
-KPX T Acircumflex -55
-KPX T Adieresis -55
-KPX T Agrave -55
-KPX T Amacron -55
-KPX T Aogonek -55
-KPX T Aring -55
-KPX T Atilde -55
-KPX T O -18
-KPX T Oacute -18
-KPX T Ocircumflex -18
-KPX T Odieresis -18
-KPX T Ograve -18
-KPX T Ohungarumlaut -18
-KPX T Omacron -18
-KPX T Oslash -18
-KPX T Otilde -18
-KPX T a -92
-KPX T aacute -92
-KPX T abreve -92
-KPX T acircumflex -92
-KPX T adieresis -92
-KPX T agrave -92
-KPX T amacron -92
-KPX T aogonek -92
-KPX T aring -92
-KPX T atilde -92
-KPX T colon -74
-KPX T comma -92
-KPX T e -92
-KPX T eacute -92
-KPX T ecaron -92
-KPX T ecircumflex -92
-KPX T edieresis -52
-KPX T edotaccent -92
-KPX T egrave -52
-KPX T emacron -52
-KPX T eogonek -92
-KPX T hyphen -92
-KPX T i -37
-KPX T iacute -37
-KPX T iogonek -37
-KPX T o -95
-KPX T oacute -95
-KPX T ocircumflex -95
-KPX T odieresis -95
-KPX T ograve -95
-KPX T ohungarumlaut -95
-KPX T omacron -95
-KPX T oslash -95
-KPX T otilde -95
-KPX T period -92
-KPX T r -37
-KPX T racute -37
-KPX T rcaron -37
-KPX T rcommaaccent -37
-KPX T semicolon -74
-KPX T u -37
-KPX T uacute -37
-KPX T ucircumflex -37
-KPX T udieresis -37
-KPX T ugrave -37
-KPX T uhungarumlaut -37
-KPX T umacron -37
-KPX T uogonek -37
-KPX T uring -37
-KPX T w -37
-KPX T y -37
-KPX T yacute -37
-KPX T ydieresis -37
-KPX Tcaron A -55
-KPX Tcaron Aacute -55
-KPX Tcaron Abreve -55
-KPX Tcaron Acircumflex -55
-KPX Tcaron Adieresis -55
-KPX Tcaron Agrave -55
-KPX Tcaron Amacron -55
-KPX Tcaron Aogonek -55
-KPX Tcaron Aring -55
-KPX Tcaron Atilde -55
-KPX Tcaron O -18
-KPX Tcaron Oacute -18
-KPX Tcaron Ocircumflex -18
-KPX Tcaron Odieresis -18
-KPX Tcaron Ograve -18
-KPX Tcaron Ohungarumlaut -18
-KPX Tcaron Omacron -18
-KPX Tcaron Oslash -18
-KPX Tcaron Otilde -18
-KPX Tcaron a -92
-KPX Tcaron aacute -92
-KPX Tcaron abreve -92
-KPX Tcaron acircumflex -92
-KPX Tcaron adieresis -92
-KPX Tcaron agrave -92
-KPX Tcaron amacron -92
-KPX Tcaron aogonek -92
-KPX Tcaron aring -92
-KPX Tcaron atilde -92
-KPX Tcaron colon -74
-KPX Tcaron comma -92
-KPX Tcaron e -92
-KPX Tcaron eacute -92
-KPX Tcaron ecaron -92
-KPX Tcaron ecircumflex -92
-KPX Tcaron edieresis -52
-KPX Tcaron edotaccent -92
-KPX Tcaron egrave -52
-KPX Tcaron emacron -52
-KPX Tcaron eogonek -92
-KPX Tcaron hyphen -92
-KPX Tcaron i -37
-KPX Tcaron iacute -37
-KPX Tcaron iogonek -37
-KPX Tcaron o -95
-KPX Tcaron oacute -95
-KPX Tcaron ocircumflex -95
-KPX Tcaron odieresis -95
-KPX Tcaron ograve -95
-KPX Tcaron ohungarumlaut -95
-KPX Tcaron omacron -95
-KPX Tcaron oslash -95
-KPX Tcaron otilde -95
-KPX Tcaron period -92
-KPX Tcaron r -37
-KPX Tcaron racute -37
-KPX Tcaron rcaron -37
-KPX Tcaron rcommaaccent -37
-KPX Tcaron semicolon -74
-KPX Tcaron u -37
-KPX Tcaron uacute -37
-KPX Tcaron ucircumflex -37
-KPX Tcaron udieresis -37
-KPX Tcaron ugrave -37
-KPX Tcaron uhungarumlaut -37
-KPX Tcaron umacron -37
-KPX Tcaron uogonek -37
-KPX Tcaron uring -37
-KPX Tcaron w -37
-KPX Tcaron y -37
-KPX Tcaron yacute -37
-KPX Tcaron ydieresis -37
-KPX Tcommaaccent A -55
-KPX Tcommaaccent Aacute -55
-KPX Tcommaaccent Abreve -55
-KPX Tcommaaccent Acircumflex -55
-KPX Tcommaaccent Adieresis -55
-KPX Tcommaaccent Agrave -55
-KPX Tcommaaccent Amacron -55
-KPX Tcommaaccent Aogonek -55
-KPX Tcommaaccent Aring -55
-KPX Tcommaaccent Atilde -55
-KPX Tcommaaccent O -18
-KPX Tcommaaccent Oacute -18
-KPX Tcommaaccent Ocircumflex -18
-KPX Tcommaaccent Odieresis -18
-KPX Tcommaaccent Ograve -18
-KPX Tcommaaccent Ohungarumlaut -18
-KPX Tcommaaccent Omacron -18
-KPX Tcommaaccent Oslash -18
-KPX Tcommaaccent Otilde -18
-KPX Tcommaaccent a -92
-KPX Tcommaaccent aacute -92
-KPX Tcommaaccent abreve -92
-KPX Tcommaaccent acircumflex -92
-KPX Tcommaaccent adieresis -92
-KPX Tcommaaccent agrave -92
-KPX Tcommaaccent amacron -92
-KPX Tcommaaccent aogonek -92
-KPX Tcommaaccent aring -92
-KPX Tcommaaccent atilde -92
-KPX Tcommaaccent colon -74
-KPX Tcommaaccent comma -92
-KPX Tcommaaccent e -92
-KPX Tcommaaccent eacute -92
-KPX Tcommaaccent ecaron -92
-KPX Tcommaaccent ecircumflex -92
-KPX Tcommaaccent edieresis -52
-KPX Tcommaaccent edotaccent -92
-KPX Tcommaaccent egrave -52
-KPX Tcommaaccent emacron -52
-KPX Tcommaaccent eogonek -92
-KPX Tcommaaccent hyphen -92
-KPX Tcommaaccent i -37
-KPX Tcommaaccent iacute -37
-KPX Tcommaaccent iogonek -37
-KPX Tcommaaccent o -95
-KPX Tcommaaccent oacute -95
-KPX Tcommaaccent ocircumflex -95
-KPX Tcommaaccent odieresis -95
-KPX Tcommaaccent ograve -95
-KPX Tcommaaccent ohungarumlaut -95
-KPX Tcommaaccent omacron -95
-KPX Tcommaaccent oslash -95
-KPX Tcommaaccent otilde -95
-KPX Tcommaaccent period -92
-KPX Tcommaaccent r -37
-KPX Tcommaaccent racute -37
-KPX Tcommaaccent rcaron -37
-KPX Tcommaaccent rcommaaccent -37
-KPX Tcommaaccent semicolon -74
-KPX Tcommaaccent u -37
-KPX Tcommaaccent uacute -37
-KPX Tcommaaccent ucircumflex -37
-KPX Tcommaaccent udieresis -37
-KPX Tcommaaccent ugrave -37
-KPX Tcommaaccent uhungarumlaut -37
-KPX Tcommaaccent umacron -37
-KPX Tcommaaccent uogonek -37
-KPX Tcommaaccent uring -37
-KPX Tcommaaccent w -37
-KPX Tcommaaccent y -37
-KPX Tcommaaccent yacute -37
-KPX Tcommaaccent ydieresis -37
-KPX U A -45
-KPX U Aacute -45
-KPX U Abreve -45
-KPX U Acircumflex -45
-KPX U Adieresis -45
-KPX U Agrave -45
-KPX U Amacron -45
-KPX U Aogonek -45
-KPX U Aring -45
-KPX U Atilde -45
-KPX Uacute A -45
-KPX Uacute Aacute -45
-KPX Uacute Abreve -45
-KPX Uacute Acircumflex -45
-KPX Uacute Adieresis -45
-KPX Uacute Agrave -45
-KPX Uacute Amacron -45
-KPX Uacute Aogonek -45
-KPX Uacute Aring -45
-KPX Uacute Atilde -45
-KPX Ucircumflex A -45
-KPX Ucircumflex Aacute -45
-KPX Ucircumflex Abreve -45
-KPX Ucircumflex Acircumflex -45
-KPX Ucircumflex Adieresis -45
-KPX Ucircumflex Agrave -45
-KPX Ucircumflex Amacron -45
-KPX Ucircumflex Aogonek -45
-KPX Ucircumflex Aring -45
-KPX Ucircumflex Atilde -45
-KPX Udieresis A -45
-KPX Udieresis Aacute -45
-KPX Udieresis Abreve -45
-KPX Udieresis Acircumflex -45
-KPX Udieresis Adieresis -45
-KPX Udieresis Agrave -45
-KPX Udieresis Amacron -45
-KPX Udieresis Aogonek -45
-KPX Udieresis Aring -45
-KPX Udieresis Atilde -45
-KPX Ugrave A -45
-KPX Ugrave Aacute -45
-KPX Ugrave Abreve -45
-KPX Ugrave Acircumflex -45
-KPX Ugrave Adieresis -45
-KPX Ugrave Agrave -45
-KPX Ugrave Amacron -45
-KPX Ugrave Aogonek -45
-KPX Ugrave Aring -45
-KPX Ugrave Atilde -45
-KPX Uhungarumlaut A -45
-KPX Uhungarumlaut Aacute -45
-KPX Uhungarumlaut Abreve -45
-KPX Uhungarumlaut Acircumflex -45
-KPX Uhungarumlaut Adieresis -45
-KPX Uhungarumlaut Agrave -45
-KPX Uhungarumlaut Amacron -45
-KPX Uhungarumlaut Aogonek -45
-KPX Uhungarumlaut Aring -45
-KPX Uhungarumlaut Atilde -45
-KPX Umacron A -45
-KPX Umacron Aacute -45
-KPX Umacron Abreve -45
-KPX Umacron Acircumflex -45
-KPX Umacron Adieresis -45
-KPX Umacron Agrave -45
-KPX Umacron Amacron -45
-KPX Umacron Aogonek -45
-KPX Umacron Aring -45
-KPX Umacron Atilde -45
-KPX Uogonek A -45
-KPX Uogonek Aacute -45
-KPX Uogonek Abreve -45
-KPX Uogonek Acircumflex -45
-KPX Uogonek Adieresis -45
-KPX Uogonek Agrave -45
-KPX Uogonek Amacron -45
-KPX Uogonek Aogonek -45
-KPX Uogonek Aring -45
-KPX Uogonek Atilde -45
-KPX Uring A -45
-KPX Uring Aacute -45
-KPX Uring Abreve -45
-KPX Uring Acircumflex -45
-KPX Uring Adieresis -45
-KPX Uring Agrave -45
-KPX Uring Amacron -45
-KPX Uring Aogonek -45
-KPX Uring Aring -45
-KPX Uring Atilde -45
-KPX V A -85
-KPX V Aacute -85
-KPX V Abreve -85
-KPX V Acircumflex -85
-KPX V Adieresis -85
-KPX V Agrave -85
-KPX V Amacron -85
-KPX V Aogonek -85
-KPX V Aring -85
-KPX V Atilde -85
-KPX V G -10
-KPX V Gbreve -10
-KPX V Gcommaaccent -10
-KPX V O -30
-KPX V Oacute -30
-KPX V Ocircumflex -30
-KPX V Odieresis -30
-KPX V Ograve -30
-KPX V Ohungarumlaut -30
-KPX V Omacron -30
-KPX V Oslash -30
-KPX V Otilde -30
-KPX V a -111
-KPX V aacute -111
-KPX V abreve -111
-KPX V acircumflex -111
-KPX V adieresis -111
-KPX V agrave -111
-KPX V amacron -111
-KPX V aogonek -111
-KPX V aring -111
-KPX V atilde -111
-KPX V colon -74
-KPX V comma -129
-KPX V e -111
-KPX V eacute -111
-KPX V ecaron -111
-KPX V ecircumflex -111
-KPX V edieresis -71
-KPX V edotaccent -111
-KPX V egrave -71
-KPX V emacron -71
-KPX V eogonek -111
-KPX V hyphen -70
-KPX V i -55
-KPX V iacute -55
-KPX V iogonek -55
-KPX V o -111
-KPX V oacute -111
-KPX V ocircumflex -111
-KPX V odieresis -111
-KPX V ograve -111
-KPX V ohungarumlaut -111
-KPX V omacron -111
-KPX V oslash -111
-KPX V otilde -111
-KPX V period -129
-KPX V semicolon -74
-KPX V u -55
-KPX V uacute -55
-KPX V ucircumflex -55
-KPX V udieresis -55
-KPX V ugrave -55
-KPX V uhungarumlaut -55
-KPX V umacron -55
-KPX V uogonek -55
-KPX V uring -55
-KPX W A -74
-KPX W Aacute -74
-KPX W Abreve -74
-KPX W Acircumflex -74
-KPX W Adieresis -74
-KPX W Agrave -74
-KPX W Amacron -74
-KPX W Aogonek -74
-KPX W Aring -74
-KPX W Atilde -74
-KPX W O -15
-KPX W Oacute -15
-KPX W Ocircumflex -15
-KPX W Odieresis -15
-KPX W Ograve -15
-KPX W Ohungarumlaut -15
-KPX W Omacron -15
-KPX W Oslash -15
-KPX W Otilde -15
-KPX W a -85
-KPX W aacute -85
-KPX W abreve -85
-KPX W acircumflex -85
-KPX W adieresis -85
-KPX W agrave -85
-KPX W amacron -85
-KPX W aogonek -85
-KPX W aring -85
-KPX W atilde -85
-KPX W colon -55
-KPX W comma -74
-KPX W e -90
-KPX W eacute -90
-KPX W ecaron -90
-KPX W ecircumflex -90
-KPX W edieresis -50
-KPX W edotaccent -90
-KPX W egrave -50
-KPX W emacron -50
-KPX W eogonek -90
-KPX W hyphen -50
-KPX W i -37
-KPX W iacute -37
-KPX W iogonek -37
-KPX W o -80
-KPX W oacute -80
-KPX W ocircumflex -80
-KPX W odieresis -80
-KPX W ograve -80
-KPX W ohungarumlaut -80
-KPX W omacron -80
-KPX W oslash -80
-KPX W otilde -80
-KPX W period -74
-KPX W semicolon -55
-KPX W u -55
-KPX W uacute -55
-KPX W ucircumflex -55
-KPX W udieresis -55
-KPX W ugrave -55
-KPX W uhungarumlaut -55
-KPX W umacron -55
-KPX W uogonek -55
-KPX W uring -55
-KPX W y -55
-KPX W yacute -55
-KPX W ydieresis -55
-KPX Y A -74
-KPX Y Aacute -74
-KPX Y Abreve -74
-KPX Y Acircumflex -74
-KPX Y Adieresis -74
-KPX Y Agrave -74
-KPX Y Amacron -74
-KPX Y Aogonek -74
-KPX Y Aring -74
-KPX Y Atilde -74
-KPX Y O -25
-KPX Y Oacute -25
-KPX Y Ocircumflex -25
-KPX Y Odieresis -25
-KPX Y Ograve -25
-KPX Y Ohungarumlaut -25
-KPX Y Omacron -25
-KPX Y Oslash -25
-KPX Y Otilde -25
-KPX Y a -92
-KPX Y aacute -92
-KPX Y abreve -92
-KPX Y acircumflex -92
-KPX Y adieresis -92
-KPX Y agrave -92
-KPX Y amacron -92
-KPX Y aogonek -92
-KPX Y aring -92
-KPX Y atilde -92
-KPX Y colon -92
-KPX Y comma -92
-KPX Y e -111
-KPX Y eacute -111
-KPX Y ecaron -111
-KPX Y ecircumflex -71
-KPX Y edieresis -71
-KPX Y edotaccent -111
-KPX Y egrave -71
-KPX Y emacron -71
-KPX Y eogonek -111
-KPX Y hyphen -92
-KPX Y i -55
-KPX Y iacute -55
-KPX Y iogonek -55
-KPX Y o -111
-KPX Y oacute -111
-KPX Y ocircumflex -111
-KPX Y odieresis -111
-KPX Y ograve -111
-KPX Y ohungarumlaut -111
-KPX Y omacron -111
-KPX Y oslash -111
-KPX Y otilde -111
-KPX Y period -74
-KPX Y semicolon -92
-KPX Y u -92
-KPX Y uacute -92
-KPX Y ucircumflex -92
-KPX Y udieresis -92
-KPX Y ugrave -92
-KPX Y uhungarumlaut -92
-KPX Y umacron -92
-KPX Y uogonek -92
-KPX Y uring -92
-KPX Yacute A -74
-KPX Yacute Aacute -74
-KPX Yacute Abreve -74
-KPX Yacute Acircumflex -74
-KPX Yacute Adieresis -74
-KPX Yacute Agrave -74
-KPX Yacute Amacron -74
-KPX Yacute Aogonek -74
-KPX Yacute Aring -74
-KPX Yacute Atilde -74
-KPX Yacute O -25
-KPX Yacute Oacute -25
-KPX Yacute Ocircumflex -25
-KPX Yacute Odieresis -25
-KPX Yacute Ograve -25
-KPX Yacute Ohungarumlaut -25
-KPX Yacute Omacron -25
-KPX Yacute Oslash -25
-KPX Yacute Otilde -25
-KPX Yacute a -92
-KPX Yacute aacute -92
-KPX Yacute abreve -92
-KPX Yacute acircumflex -92
-KPX Yacute adieresis -92
-KPX Yacute agrave -92
-KPX Yacute amacron -92
-KPX Yacute aogonek -92
-KPX Yacute aring -92
-KPX Yacute atilde -92
-KPX Yacute colon -92
-KPX Yacute comma -92
-KPX Yacute e -111
-KPX Yacute eacute -111
-KPX Yacute ecaron -111
-KPX Yacute ecircumflex -71
-KPX Yacute edieresis -71
-KPX Yacute edotaccent -111
-KPX Yacute egrave -71
-KPX Yacute emacron -71
-KPX Yacute eogonek -111
-KPX Yacute hyphen -92
-KPX Yacute i -55
-KPX Yacute iacute -55
-KPX Yacute iogonek -55
-KPX Yacute o -111
-KPX Yacute oacute -111
-KPX Yacute ocircumflex -111
-KPX Yacute odieresis -111
-KPX Yacute ograve -111
-KPX Yacute ohungarumlaut -111
-KPX Yacute omacron -111
-KPX Yacute oslash -111
-KPX Yacute otilde -111
-KPX Yacute period -74
-KPX Yacute semicolon -92
-KPX Yacute u -92
-KPX Yacute uacute -92
-KPX Yacute ucircumflex -92
-KPX Yacute udieresis -92
-KPX Yacute ugrave -92
-KPX Yacute uhungarumlaut -92
-KPX Yacute umacron -92
-KPX Yacute uogonek -92
-KPX Yacute uring -92
-KPX Ydieresis A -74
-KPX Ydieresis Aacute -74
-KPX Ydieresis Abreve -74
-KPX Ydieresis Acircumflex -74
-KPX Ydieresis Adieresis -74
-KPX Ydieresis Agrave -74
-KPX Ydieresis Amacron -74
-KPX Ydieresis Aogonek -74
-KPX Ydieresis Aring -74
-KPX Ydieresis Atilde -74
-KPX Ydieresis O -25
-KPX Ydieresis Oacute -25
-KPX Ydieresis Ocircumflex -25
-KPX Ydieresis Odieresis -25
-KPX Ydieresis Ograve -25
-KPX Ydieresis Ohungarumlaut -25
-KPX Ydieresis Omacron -25
-KPX Ydieresis Oslash -25
-KPX Ydieresis Otilde -25
-KPX Ydieresis a -92
-KPX Ydieresis aacute -92
-KPX Ydieresis abreve -92
-KPX Ydieresis acircumflex -92
-KPX Ydieresis adieresis -92
-KPX Ydieresis agrave -92
-KPX Ydieresis amacron -92
-KPX Ydieresis aogonek -92
-KPX Ydieresis aring -92
-KPX Ydieresis atilde -92
-KPX Ydieresis colon -92
-KPX Ydieresis comma -92
-KPX Ydieresis e -111
-KPX Ydieresis eacute -111
-KPX Ydieresis ecaron -111
-KPX Ydieresis ecircumflex -71
-KPX Ydieresis edieresis -71
-KPX Ydieresis edotaccent -111
-KPX Ydieresis egrave -71
-KPX Ydieresis emacron -71
-KPX Ydieresis eogonek -111
-KPX Ydieresis hyphen -92
-KPX Ydieresis i -55
-KPX Ydieresis iacute -55
-KPX Ydieresis iogonek -55
-KPX Ydieresis o -111
-KPX Ydieresis oacute -111
-KPX Ydieresis ocircumflex -111
-KPX Ydieresis odieresis -111
-KPX Ydieresis ograve -111
-KPX Ydieresis ohungarumlaut -111
-KPX Ydieresis omacron -111
-KPX Ydieresis oslash -111
-KPX Ydieresis otilde -111
-KPX Ydieresis period -74
-KPX Ydieresis semicolon -92
-KPX Ydieresis u -92
-KPX Ydieresis uacute -92
-KPX Ydieresis ucircumflex -92
-KPX Ydieresis udieresis -92
-KPX Ydieresis ugrave -92
-KPX Ydieresis uhungarumlaut -92
-KPX Ydieresis umacron -92
-KPX Ydieresis uogonek -92
-KPX Ydieresis uring -92
-KPX b b -10
-KPX b period -40
-KPX b u -20
-KPX b uacute -20
-KPX b ucircumflex -20
-KPX b udieresis -20
-KPX b ugrave -20
-KPX b uhungarumlaut -20
-KPX b umacron -20
-KPX b uogonek -20
-KPX b uring -20
-KPX c h -10
-KPX c k -10
-KPX c kcommaaccent -10
-KPX cacute h -10
-KPX cacute k -10
-KPX cacute kcommaaccent -10
-KPX ccaron h -10
-KPX ccaron k -10
-KPX ccaron kcommaaccent -10
-KPX ccedilla h -10
-KPX ccedilla k -10
-KPX ccedilla kcommaaccent -10
-KPX comma quotedblright -95
-KPX comma quoteright -95
-KPX e b -10
-KPX eacute b -10
-KPX ecaron b -10
-KPX ecircumflex b -10
-KPX edieresis b -10
-KPX edotaccent b -10
-KPX egrave b -10
-KPX emacron b -10
-KPX eogonek b -10
-KPX f comma -10
-KPX f dotlessi -30
-KPX f e -10
-KPX f eacute -10
-KPX f edotaccent -10
-KPX f eogonek -10
-KPX f f -18
-KPX f o -10
-KPX f oacute -10
-KPX f ocircumflex -10
-KPX f ograve -10
-KPX f ohungarumlaut -10
-KPX f oslash -10
-KPX f otilde -10
-KPX f period -10
-KPX f quoteright 55
-KPX k e -30
-KPX k eacute -30
-KPX k ecaron -30
-KPX k ecircumflex -30
-KPX k edieresis -30
-KPX k edotaccent -30
-KPX k egrave -30
-KPX k emacron -30
-KPX k eogonek -30
-KPX k o -10
-KPX k oacute -10
-KPX k ocircumflex -10
-KPX k odieresis -10
-KPX k ograve -10
-KPX k ohungarumlaut -10
-KPX k omacron -10
-KPX k oslash -10
-KPX k otilde -10
-KPX kcommaaccent e -30
-KPX kcommaaccent eacute -30
-KPX kcommaaccent ecaron -30
-KPX kcommaaccent ecircumflex -30
-KPX kcommaaccent edieresis -30
-KPX kcommaaccent edotaccent -30
-KPX kcommaaccent egrave -30
-KPX kcommaaccent emacron -30
-KPX kcommaaccent eogonek -30
-KPX kcommaaccent o -10
-KPX kcommaaccent oacute -10
-KPX kcommaaccent ocircumflex -10
-KPX kcommaaccent odieresis -10
-KPX kcommaaccent ograve -10
-KPX kcommaaccent ohungarumlaut -10
-KPX kcommaaccent omacron -10
-KPX kcommaaccent oslash -10
-KPX kcommaaccent otilde -10
-KPX n v -40
-KPX nacute v -40
-KPX ncaron v -40
-KPX ncommaaccent v -40
-KPX ntilde v -40
-KPX o v -15
-KPX o w -25
-KPX o x -10
-KPX o y -10
-KPX o yacute -10
-KPX o ydieresis -10
-KPX oacute v -15
-KPX oacute w -25
-KPX oacute x -10
-KPX oacute y -10
-KPX oacute yacute -10
-KPX oacute ydieresis -10
-KPX ocircumflex v -15
-KPX ocircumflex w -25
-KPX ocircumflex x -10
-KPX ocircumflex y -10
-KPX ocircumflex yacute -10
-KPX ocircumflex ydieresis -10
-KPX odieresis v -15
-KPX odieresis w -25
-KPX odieresis x -10
-KPX odieresis y -10
-KPX odieresis yacute -10
-KPX odieresis ydieresis -10
-KPX ograve v -15
-KPX ograve w -25
-KPX ograve x -10
-KPX ograve y -10
-KPX ograve yacute -10
-KPX ograve ydieresis -10
-KPX ohungarumlaut v -15
-KPX ohungarumlaut w -25
-KPX ohungarumlaut x -10
-KPX ohungarumlaut y -10
-KPX ohungarumlaut yacute -10
-KPX ohungarumlaut ydieresis -10
-KPX omacron v -15
-KPX omacron w -25
-KPX omacron x -10
-KPX omacron y -10
-KPX omacron yacute -10
-KPX omacron ydieresis -10
-KPX oslash v -15
-KPX oslash w -25
-KPX oslash x -10
-KPX oslash y -10
-KPX oslash yacute -10
-KPX oslash ydieresis -10
-KPX otilde v -15
-KPX otilde w -25
-KPX otilde x -10
-KPX otilde y -10
-KPX otilde yacute -10
-KPX otilde ydieresis -10
-KPX period quotedblright -95
-KPX period quoteright -95
-KPX quoteleft quoteleft -74
-KPX quoteright d -15
-KPX quoteright dcroat -15
-KPX quoteright quoteright -74
-KPX quoteright r -15
-KPX quoteright racute -15
-KPX quoteright rcaron -15
-KPX quoteright rcommaaccent -15
-KPX quoteright s -74
-KPX quoteright sacute -74
-KPX quoteright scaron -74
-KPX quoteright scedilla -74
-KPX quoteright scommaaccent -74
-KPX quoteright space -74
-KPX quoteright t -37
-KPX quoteright tcommaaccent -37
-KPX quoteright v -15
-KPX r comma -65
-KPX r period -65
-KPX racute comma -65
-KPX racute period -65
-KPX rcaron comma -65
-KPX rcaron period -65
-KPX rcommaaccent comma -65
-KPX rcommaaccent period -65
-KPX space A -37
-KPX space Aacute -37
-KPX space Abreve -37
-KPX space Acircumflex -37
-KPX space Adieresis -37
-KPX space Agrave -37
-KPX space Amacron -37
-KPX space Aogonek -37
-KPX space Aring -37
-KPX space Atilde -37
-KPX space V -70
-KPX space W -70
-KPX space Y -70
-KPX space Yacute -70
-KPX space Ydieresis -70
-KPX v comma -37
-KPX v e -15
-KPX v eacute -15
-KPX v ecaron -15
-KPX v ecircumflex -15
-KPX v edieresis -15
-KPX v edotaccent -15
-KPX v egrave -15
-KPX v emacron -15
-KPX v eogonek -15
-KPX v o -15
-KPX v oacute -15
-KPX v ocircumflex -15
-KPX v odieresis -15
-KPX v ograve -15
-KPX v ohungarumlaut -15
-KPX v omacron -15
-KPX v oslash -15
-KPX v otilde -15
-KPX v period -37
-KPX w a -10
-KPX w aacute -10
-KPX w abreve -10
-KPX w acircumflex -10
-KPX w adieresis -10
-KPX w agrave -10
-KPX w amacron -10
-KPX w aogonek -10
-KPX w aring -10
-KPX w atilde -10
-KPX w comma -37
-KPX w e -10
-KPX w eacute -10
-KPX w ecaron -10
-KPX w ecircumflex -10
-KPX w edieresis -10
-KPX w edotaccent -10
-KPX w egrave -10
-KPX w emacron -10
-KPX w eogonek -10
-KPX w o -15
-KPX w oacute -15
-KPX w ocircumflex -15
-KPX w odieresis -15
-KPX w ograve -15
-KPX w ohungarumlaut -15
-KPX w omacron -15
-KPX w oslash -15
-KPX w otilde -15
-KPX w period -37
-KPX x e -10
-KPX x eacute -10
-KPX x ecaron -10
-KPX x ecircumflex -10
-KPX x edieresis -10
-KPX x edotaccent -10
-KPX x egrave -10
-KPX x emacron -10
-KPX x eogonek -10
-KPX y comma -37
-KPX y period -37
-KPX yacute comma -37
-KPX yacute period -37
-KPX ydieresis comma -37
-KPX ydieresis period -37
-EndKernPairs
-EndKernData
-EndFontMetrics
-
diff --git a/LibrarySource/com/lowagie/text/pdf/fonts/Times-Italic.afm b/LibrarySource/com/lowagie/text/pdf/fonts/Times-Italic.afm
deleted file mode 100644
index e322120..0000000
--- a/LibrarySource/com/lowagie/text/pdf/fonts/Times-Italic.afm
+++ /dev/null
@@ -1,2668 +0,0 @@
-StartFontMetrics 4.1
-Comment Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
-Comment Creation Date: Thu May 1 12:56:55 1997
-Comment UniqueID 43067
-Comment VMusage 47727 58752
-FontName Times-Italic
-FullName Times Italic
-FamilyName Times
-Weight Medium
-ItalicAngle -15.5
-IsFixedPitch false
-CharacterSet ExtendedRoman
-FontBBox -169 -217 1010 883
-UnderlinePosition -100
-UnderlineThickness 50
-Version 002.000
-Notice Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.Times is a trademark of Linotype-Hell AG and/or its subsidiaries.
-EncodingScheme AdobeStandardEncoding
-CapHeight 653
-XHeight 441
-Ascender 683
-Descender -217
-StdHW 32
-StdVW 76
-StartCharMetrics 315
-C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
-C 33 ; WX 333 ; N exclam ; B 39 -11 302 667 ;
-C 34 ; WX 420 ; N quotedbl ; B 144 421 432 666 ;
-C 35 ; WX 500 ; N numbersign ; B 2 0 540 676 ;
-C 36 ; WX 500 ; N dollar ; B 31 -89 497 731 ;
-C 37 ; WX 833 ; N percent ; B 79 -13 790 676 ;
-C 38 ; WX 778 ; N ampersand ; B 76 -18 723 666 ;
-C 39 ; WX 333 ; N quoteright ; B 151 436 290 666 ;
-C 40 ; WX 333 ; N parenleft ; B 42 -181 315 669 ;
-C 41 ; WX 333 ; N parenright ; B 16 -180 289 669 ;
-C 42 ; WX 500 ; N asterisk ; B 128 255 492 666 ;
-C 43 ; WX 675 ; N plus ; B 86 0 590 506 ;
-C 44 ; WX 250 ; N comma ; B -4 -129 135 101 ;
-C 45 ; WX 333 ; N hyphen ; B 49 192 282 255 ;
-C 46 ; WX 250 ; N period ; B 27 -11 138 100 ;
-C 47 ; WX 278 ; N slash ; B -65 -18 386 666 ;
-C 48 ; WX 500 ; N zero ; B 32 -7 497 676 ;
-C 49 ; WX 500 ; N one ; B 49 0 409 676 ;
-C 50 ; WX 500 ; N two ; B 12 0 452 676 ;
-C 51 ; WX 500 ; N three ; B 15 -7 465 676 ;
-C 52 ; WX 500 ; N four ; B 1 0 479 676 ;
-C 53 ; WX 500 ; N five ; B 15 -7 491 666 ;
-C 54 ; WX 500 ; N six ; B 30 -7 521 686 ;
-C 55 ; WX 500 ; N seven ; B 75 -8 537 666 ;
-C 56 ; WX 500 ; N eight ; B 30 -7 493 676 ;
-C 57 ; WX 500 ; N nine ; B 23 -17 492 676 ;
-C 58 ; WX 333 ; N colon ; B 50 -11 261 441 ;
-C 59 ; WX 333 ; N semicolon ; B 27 -129 261 441 ;
-C 60 ; WX 675 ; N less ; B 84 -8 592 514 ;
-C 61 ; WX 675 ; N equal ; B 86 120 590 386 ;
-C 62 ; WX 675 ; N greater ; B 84 -8 592 514 ;
-C 63 ; WX 500 ; N question ; B 132 -12 472 664 ;
-C 64 ; WX 920 ; N at ; B 118 -18 806 666 ;
-C 65 ; WX 611 ; N A ; B -51 0 564 668 ;
-C 66 ; WX 611 ; N B ; B -8 0 588 653 ;
-C 67 ; WX 667 ; N C ; B 66 -18 689 666 ;
-C 68 ; WX 722 ; N D ; B -8 0 700 653 ;
-C 69 ; WX 611 ; N E ; B -1 0 634 653 ;
-C 70 ; WX 611 ; N F ; B 8 0 645 653 ;
-C 71 ; WX 722 ; N G ; B 52 -18 722 666 ;
-C 72 ; WX 722 ; N H ; B -8 0 767 653 ;
-C 73 ; WX 333 ; N I ; B -8 0 384 653 ;
-C 74 ; WX 444 ; N J ; B -6 -18 491 653 ;
-C 75 ; WX 667 ; N K ; B 7 0 722 653 ;
-C 76 ; WX 556 ; N L ; B -8 0 559 653 ;
-C 77 ; WX 833 ; N M ; B -18 0 873 653 ;
-C 78 ; WX 667 ; N N ; B -20 -15 727 653 ;
-C 79 ; WX 722 ; N O ; B 60 -18 699 666 ;
-C 80 ; WX 611 ; N P ; B 0 0 605 653 ;
-C 81 ; WX 722 ; N Q ; B 59 -182 699 666 ;
-C 82 ; WX 611 ; N R ; B -13 0 588 653 ;
-C 83 ; WX 500 ; N S ; B 17 -18 508 667 ;
-C 84 ; WX 556 ; N T ; B 59 0 633 653 ;
-C 85 ; WX 722 ; N U ; B 102 -18 765 653 ;
-C 86 ; WX 611 ; N V ; B 76 -18 688 653 ;
-C 87 ; WX 833 ; N W ; B 71 -18 906 653 ;
-C 88 ; WX 611 ; N X ; B -29 0 655 653 ;
-C 89 ; WX 556 ; N Y ; B 78 0 633 653 ;
-C 90 ; WX 556 ; N Z ; B -6 0 606 653 ;
-C 91 ; WX 389 ; N bracketleft ; B 21 -153 391 663 ;
-C 92 ; WX 278 ; N backslash ; B -41 -18 319 666 ;
-C 93 ; WX 389 ; N bracketright ; B 12 -153 382 663 ;
-C 94 ; WX 422 ; N asciicircum ; B 0 301 422 666 ;
-C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
-C 96 ; WX 333 ; N quoteleft ; B 171 436 310 666 ;
-C 97 ; WX 500 ; N a ; B 17 -11 476 441 ;
-C 98 ; WX 500 ; N b ; B 23 -11 473 683 ;
-C 99 ; WX 444 ; N c ; B 30 -11 425 441 ;
-C 100 ; WX 500 ; N d ; B 15 -13 527 683 ;
-C 101 ; WX 444 ; N e ; B 31 -11 412 441 ;
-C 102 ; WX 278 ; N f ; B -147 -207 424 678 ; L i fi ; L l fl ;
-C 103 ; WX 500 ; N g ; B 8 -206 472 441 ;
-C 104 ; WX 500 ; N h ; B 19 -9 478 683 ;
-C 105 ; WX 278 ; N i ; B 49 -11 264 654 ;
-C 106 ; WX 278 ; N j ; B -124 -207 276 654 ;
-C 107 ; WX 444 ; N k ; B 14 -11 461 683 ;
-C 108 ; WX 278 ; N l ; B 41 -11 279 683 ;
-C 109 ; WX 722 ; N m ; B 12 -9 704 441 ;
-C 110 ; WX 500 ; N n ; B 14 -9 474 441 ;
-C 111 ; WX 500 ; N o ; B 27 -11 468 441 ;
-C 112 ; WX 500 ; N p ; B -75 -205 469 441 ;
-C 113 ; WX 500 ; N q ; B 25 -209 483 441 ;
-C 114 ; WX 389 ; N r ; B 45 0 412 441 ;
-C 115 ; WX 389 ; N s ; B 16 -13 366 442 ;
-C 116 ; WX 278 ; N t ; B 37 -11 296 546 ;
-C 117 ; WX 500 ; N u ; B 42 -11 475 441 ;
-C 118 ; WX 444 ; N v ; B 21 -18 426 441 ;
-C 119 ; WX 667 ; N w ; B 16 -18 648 441 ;
-C 120 ; WX 444 ; N x ; B -27 -11 447 441 ;
-C 121 ; WX 444 ; N y ; B -24 -206 426 441 ;
-C 122 ; WX 389 ; N z ; B -2 -81 380 428 ;
-C 123 ; WX 400 ; N braceleft ; B 51 -177 407 687 ;
-C 124 ; WX 275 ; N bar ; B 105 -217 171 783 ;
-C 125 ; WX 400 ; N braceright ; B -7 -177 349 687 ;
-C 126 ; WX 541 ; N asciitilde ; B 40 183 502 323 ;
-C 161 ; WX 389 ; N exclamdown ; B 59 -205 322 473 ;
-C 162 ; WX 500 ; N cent ; B 77 -143 472 560 ;
-C 163 ; WX 500 ; N sterling ; B 10 -6 517 670 ;
-C 164 ; WX 167 ; N fraction ; B -169 -10 337 676 ;
-C 165 ; WX 500 ; N yen ; B 27 0 603 653 ;
-C 166 ; WX 500 ; N florin ; B 25 -182 507 682 ;
-C 167 ; WX 500 ; N section ; B 53 -162 461 666 ;
-C 168 ; WX 500 ; N currency ; B -22 53 522 597 ;
-C 169 ; WX 214 ; N quotesingle ; B 132 421 241 666 ;
-C 170 ; WX 556 ; N quotedblleft ; B 166 436 514 666 ;
-C 171 ; WX 500 ; N guillemotleft ; B 53 37 445 403 ;
-C 172 ; WX 333 ; N guilsinglleft ; B 51 37 281 403 ;
-C 173 ; WX 333 ; N guilsinglright ; B 52 37 282 403 ;
-C 174 ; WX 500 ; N fi ; B -141 -207 481 681 ;
-C 175 ; WX 500 ; N fl ; B -141 -204 518 682 ;
-C 177 ; WX 500 ; N endash ; B -6 197 505 243 ;
-C 178 ; WX 500 ; N dagger ; B 101 -159 488 666 ;
-C 179 ; WX 500 ; N daggerdbl ; B 22 -143 491 666 ;
-C 180 ; WX 250 ; N periodcentered ; B 70 199 181 310 ;
-C 182 ; WX 523 ; N paragraph ; B 55 -123 616 653 ;
-C 183 ; WX 350 ; N bullet ; B 40 191 310 461 ;
-C 184 ; WX 333 ; N quotesinglbase ; B 44 -129 183 101 ;
-C 185 ; WX 556 ; N quotedblbase ; B 57 -129 405 101 ;
-C 186 ; WX 556 ; N quotedblright ; B 151 436 499 666 ;
-C 187 ; WX 500 ; N guillemotright ; B 55 37 447 403 ;
-C 188 ; WX 889 ; N ellipsis ; B 57 -11 762 100 ;
-C 189 ; WX 1000 ; N perthousand ; B 25 -19 1010 706 ;
-C 191 ; WX 500 ; N questiondown ; B 28 -205 368 471 ;
-C 193 ; WX 333 ; N grave ; B 121 492 311 664 ;
-C 194 ; WX 333 ; N acute ; B 180 494 403 664 ;
-C 195 ; WX 333 ; N circumflex ; B 91 492 385 661 ;
-C 196 ; WX 333 ; N tilde ; B 100 517 427 624 ;
-C 197 ; WX 333 ; N macron ; B 99 532 411 583 ;
-C 198 ; WX 333 ; N breve ; B 117 492 418 650 ;
-C 199 ; WX 333 ; N dotaccent ; B 207 548 305 646 ;
-C 200 ; WX 333 ; N dieresis ; B 107 548 405 646 ;
-C 202 ; WX 333 ; N ring ; B 155 492 355 691 ;
-C 203 ; WX 333 ; N cedilla ; B -30 -217 182 0 ;
-C 205 ; WX 333 ; N hungarumlaut ; B 93 494 486 664 ;
-C 206 ; WX 333 ; N ogonek ; B 20 -169 203 40 ;
-C 207 ; WX 333 ; N caron ; B 121 492 426 661 ;
-C 208 ; WX 889 ; N emdash ; B -6 197 894 243 ;
-C 225 ; WX 889 ; N AE ; B -27 0 911 653 ;
-C 227 ; WX 276 ; N ordfeminine ; B 42 406 352 676 ;
-C 232 ; WX 556 ; N Lslash ; B -8 0 559 653 ;
-C 233 ; WX 722 ; N Oslash ; B 60 -105 699 722 ;
-C 234 ; WX 944 ; N OE ; B 49 -8 964 666 ;
-C 235 ; WX 310 ; N ordmasculine ; B 67 406 362 676 ;
-C 241 ; WX 667 ; N ae ; B 23 -11 640 441 ;
-C 245 ; WX 278 ; N dotlessi ; B 49 -11 235 441 ;
-C 248 ; WX 278 ; N lslash ; B 41 -11 312 683 ;
-C 249 ; WX 500 ; N oslash ; B 28 -135 469 554 ;
-C 250 ; WX 667 ; N oe ; B 20 -12 646 441 ;
-C 251 ; WX 500 ; N germandbls ; B -168 -207 493 679 ;
-C -1 ; WX 333 ; N Idieresis ; B -8 0 435 818 ;
-C -1 ; WX 444 ; N eacute ; B 31 -11 459 664 ;
-C -1 ; WX 500 ; N abreve ; B 17 -11 502 650 ;
-C -1 ; WX 500 ; N uhungarumlaut ; B 42 -11 580 664 ;
-C -1 ; WX 444 ; N ecaron ; B 31 -11 482 661 ;
-C -1 ; WX 556 ; N Ydieresis ; B 78 0 633 818 ;
-C -1 ; WX 675 ; N divide ; B 86 -11 590 517 ;
-C -1 ; WX 556 ; N Yacute ; B 78 0 633 876 ;
-C -1 ; WX 611 ; N Acircumflex ; B -51 0 564 873 ;
-C -1 ; WX 500 ; N aacute ; B 17 -11 487 664 ;
-C -1 ; WX 722 ; N Ucircumflex ; B 102 -18 765 873 ;
-C -1 ; WX 444 ; N yacute ; B -24 -206 459 664 ;
-C -1 ; WX 389 ; N scommaaccent ; B 16 -217 366 442 ;
-C -1 ; WX 444 ; N ecircumflex ; B 31 -11 441 661 ;
-C -1 ; WX 722 ; N Uring ; B 102 -18 765 883 ;
-C -1 ; WX 722 ; N Udieresis ; B 102 -18 765 818 ;
-C -1 ; WX 500 ; N aogonek ; B 17 -169 476 441 ;
-C -1 ; WX 722 ; N Uacute ; B 102 -18 765 876 ;
-C -1 ; WX 500 ; N uogonek ; B 42 -169 477 441 ;
-C -1 ; WX 611 ; N Edieresis ; B -1 0 634 818 ;
-C -1 ; WX 722 ; N Dcroat ; B -8 0 700 653 ;
-C -1 ; WX 250 ; N commaaccent ; B 8 -217 133 -50 ;
-C -1 ; WX 760 ; N copyright ; B 41 -18 719 666 ;
-C -1 ; WX 611 ; N Emacron ; B -1 0 634 795 ;
-C -1 ; WX 444 ; N ccaron ; B 30 -11 482 661 ;
-C -1 ; WX 500 ; N aring ; B 17 -11 476 691 ;
-C -1 ; WX 667 ; N Ncommaaccent ; B -20 -187 727 653 ;
-C -1 ; WX 278 ; N lacute ; B 41 -11 395 876 ;
-C -1 ; WX 500 ; N agrave ; B 17 -11 476 664 ;
-C -1 ; WX 556 ; N Tcommaaccent ; B 59 -217 633 653 ;
-C -1 ; WX 667 ; N Cacute ; B 66 -18 690 876 ;
-C -1 ; WX 500 ; N atilde ; B 17 -11 511 624 ;
-C -1 ; WX 611 ; N Edotaccent ; B -1 0 634 818 ;
-C -1 ; WX 389 ; N scaron ; B 16 -13 454 661 ;
-C -1 ; WX 389 ; N scedilla ; B 16 -217 366 442 ;
-C -1 ; WX 278 ; N iacute ; B 49 -11 355 664 ;
-C -1 ; WX 471 ; N lozenge ; B 13 0 459 724 ;
-C -1 ; WX 611 ; N Rcaron ; B -13 0 588 873 ;
-C -1 ; WX 722 ; N Gcommaaccent ; B 52 -217 722 666 ;
-C -1 ; WX 500 ; N ucircumflex ; B 42 -11 475 661 ;
-C -1 ; WX 500 ; N acircumflex ; B 17 -11 476 661 ;
-C -1 ; WX 611 ; N Amacron ; B -51 0 564 795 ;
-C -1 ; WX 389 ; N rcaron ; B 45 0 434 661 ;
-C -1 ; WX 444 ; N ccedilla ; B 30 -217 425 441 ;
-C -1 ; WX 556 ; N Zdotaccent ; B -6 0 606 818 ;
-C -1 ; WX 611 ; N Thorn ; B 0 0 569 653 ;
-C -1 ; WX 722 ; N Omacron ; B 60 -18 699 795 ;
-C -1 ; WX 611 ; N Racute ; B -13 0 588 876 ;
-C -1 ; WX 500 ; N Sacute ; B 17 -18 508 876 ;
-C -1 ; WX 544 ; N dcaron ; B 15 -13 658 683 ;
-C -1 ; WX 722 ; N Umacron ; B 102 -18 765 795 ;
-C -1 ; WX 500 ; N uring ; B 42 -11 475 691 ;
-C -1 ; WX 300 ; N threesuperior ; B 43 268 339 676 ;
-C -1 ; WX 722 ; N Ograve ; B 60 -18 699 876 ;
-C -1 ; WX 611 ; N Agrave ; B -51 0 564 876 ;
-C -1 ; WX 611 ; N Abreve ; B -51 0 564 862 ;
-C -1 ; WX 675 ; N multiply ; B 93 8 582 497 ;
-C -1 ; WX 500 ; N uacute ; B 42 -11 477 664 ;
-C -1 ; WX 556 ; N Tcaron ; B 59 0 633 873 ;
-C -1 ; WX 476 ; N partialdiff ; B 17 -38 459 710 ;
-C -1 ; WX 444 ; N ydieresis ; B -24 -206 441 606 ;
-C -1 ; WX 667 ; N Nacute ; B -20 -15 727 876 ;
-C -1 ; WX 278 ; N icircumflex ; B 33 -11 327 661 ;
-C -1 ; WX 611 ; N Ecircumflex ; B -1 0 634 873 ;
-C -1 ; WX 500 ; N adieresis ; B 17 -11 489 606 ;
-C -1 ; WX 444 ; N edieresis ; B 31 -11 451 606 ;
-C -1 ; WX 444 ; N cacute ; B 30 -11 459 664 ;
-C -1 ; WX 500 ; N nacute ; B 14 -9 477 664 ;
-C -1 ; WX 500 ; N umacron ; B 42 -11 485 583 ;
-C -1 ; WX 667 ; N Ncaron ; B -20 -15 727 873 ;
-C -1 ; WX 333 ; N Iacute ; B -8 0 433 876 ;
-C -1 ; WX 675 ; N plusminus ; B 86 0 590 506 ;
-C -1 ; WX 275 ; N brokenbar ; B 105 -142 171 708 ;
-C -1 ; WX 760 ; N registered ; B 41 -18 719 666 ;
-C -1 ; WX 722 ; N Gbreve ; B 52 -18 722 862 ;
-C -1 ; WX 333 ; N Idotaccent ; B -8 0 384 818 ;
-C -1 ; WX 600 ; N summation ; B 15 -10 585 706 ;
-C -1 ; WX 611 ; N Egrave ; B -1 0 634 876 ;
-C -1 ; WX 389 ; N racute ; B 45 0 431 664 ;
-C -1 ; WX 500 ; N omacron ; B 27 -11 495 583 ;
-C -1 ; WX 556 ; N Zacute ; B -6 0 606 876 ;
-C -1 ; WX 556 ; N Zcaron ; B -6 0 606 873 ;
-C -1 ; WX 549 ; N greaterequal ; B 26 0 523 658 ;
-C -1 ; WX 722 ; N Eth ; B -8 0 700 653 ;
-C -1 ; WX 667 ; N Ccedilla ; B 66 -217 689 666 ;
-C -1 ; WX 278 ; N lcommaaccent ; B 22 -217 279 683 ;
-C -1 ; WX 300 ; N tcaron ; B 37 -11 407 681 ;
-C -1 ; WX 444 ; N eogonek ; B 31 -169 412 441 ;
-C -1 ; WX 722 ; N Uogonek ; B 102 -184 765 653 ;
-C -1 ; WX 611 ; N Aacute ; B -51 0 564 876 ;
-C -1 ; WX 611 ; N Adieresis ; B -51 0 564 818 ;
-C -1 ; WX 444 ; N egrave ; B 31 -11 412 664 ;
-C -1 ; WX 389 ; N zacute ; B -2 -81 431 664 ;
-C -1 ; WX 278 ; N iogonek ; B 49 -169 264 654 ;
-C -1 ; WX 722 ; N Oacute ; B 60 -18 699 876 ;
-C -1 ; WX 500 ; N oacute ; B 27 -11 487 664 ;
-C -1 ; WX 500 ; N amacron ; B 17 -11 495 583 ;
-C -1 ; WX 389 ; N sacute ; B 16 -13 431 664 ;
-C -1 ; WX 278 ; N idieresis ; B 49 -11 352 606 ;
-C -1 ; WX 722 ; N Ocircumflex ; B 60 -18 699 873 ;
-C -1 ; WX 722 ; N Ugrave ; B 102 -18 765 876 ;
-C -1 ; WX 612 ; N Delta ; B 6 0 608 688 ;
-C -1 ; WX 500 ; N thorn ; B -75 -205 469 683 ;
-C -1 ; WX 300 ; N twosuperior ; B 33 271 324 676 ;
-C -1 ; WX 722 ; N Odieresis ; B 60 -18 699 818 ;
-C -1 ; WX 500 ; N mu ; B -30 -209 497 428 ;
-C -1 ; WX 278 ; N igrave ; B 49 -11 284 664 ;
-C -1 ; WX 500 ; N ohungarumlaut ; B 27 -11 590 664 ;
-C -1 ; WX 611 ; N Eogonek ; B -1 -169 634 653 ;
-C -1 ; WX 500 ; N dcroat ; B 15 -13 572 683 ;
-C -1 ; WX 750 ; N threequarters ; B 23 -10 736 676 ;
-C -1 ; WX 500 ; N Scedilla ; B 17 -217 508 667 ;
-C -1 ; WX 300 ; N lcaron ; B 41 -11 407 683 ;
-C -1 ; WX 667 ; N Kcommaaccent ; B 7 -217 722 653 ;
-C -1 ; WX 556 ; N Lacute ; B -8 0 559 876 ;
-C -1 ; WX 980 ; N trademark ; B 30 247 957 653 ;
-C -1 ; WX 444 ; N edotaccent ; B 31 -11 412 606 ;
-C -1 ; WX 333 ; N Igrave ; B -8 0 384 876 ;
-C -1 ; WX 333 ; N Imacron ; B -8 0 441 795 ;
-C -1 ; WX 611 ; N Lcaron ; B -8 0 586 653 ;
-C -1 ; WX 750 ; N onehalf ; B 34 -10 749 676 ;
-C -1 ; WX 549 ; N lessequal ; B 26 0 523 658 ;
-C -1 ; WX 500 ; N ocircumflex ; B 27 -11 468 661 ;
-C -1 ; WX 500 ; N ntilde ; B 14 -9 476 624 ;
-C -1 ; WX 722 ; N Uhungarumlaut ; B 102 -18 765 876 ;
-C -1 ; WX 611 ; N Eacute ; B -1 0 634 876 ;
-C -1 ; WX 444 ; N emacron ; B 31 -11 457 583 ;
-C -1 ; WX 500 ; N gbreve ; B 8 -206 487 650 ;
-C -1 ; WX 750 ; N onequarter ; B 33 -10 736 676 ;
-C -1 ; WX 500 ; N Scaron ; B 17 -18 520 873 ;
-C -1 ; WX 500 ; N Scommaaccent ; B 17 -217 508 667 ;
-C -1 ; WX 722 ; N Ohungarumlaut ; B 60 -18 699 876 ;
-C -1 ; WX 400 ; N degree ; B 101 390 387 676 ;
-C -1 ; WX 500 ; N ograve ; B 27 -11 468 664 ;
-C -1 ; WX 667 ; N Ccaron ; B 66 -18 689 873 ;
-C -1 ; WX 500 ; N ugrave ; B 42 -11 475 664 ;
-C -1 ; WX 453 ; N radical ; B 2 -60 452 768 ;
-C -1 ; WX 722 ; N Dcaron ; B -8 0 700 873 ;
-C -1 ; WX 389 ; N rcommaaccent ; B -3 -217 412 441 ;
-C -1 ; WX 667 ; N Ntilde ; B -20 -15 727 836 ;
-C -1 ; WX 500 ; N otilde ; B 27 -11 496 624 ;
-C -1 ; WX 611 ; N Rcommaaccent ; B -13 -187 588 653 ;
-C -1 ; WX 556 ; N Lcommaaccent ; B -8 -217 559 653 ;
-C -1 ; WX 611 ; N Atilde ; B -51 0 566 836 ;
-C -1 ; WX 611 ; N Aogonek ; B -51 -169 566 668 ;
-C -1 ; WX 611 ; N Aring ; B -51 0 564 883 ;
-C -1 ; WX 722 ; N Otilde ; B 60 -18 699 836 ;
-C -1 ; WX 389 ; N zdotaccent ; B -2 -81 380 606 ;
-C -1 ; WX 611 ; N Ecaron ; B -1 0 634 873 ;
-C -1 ; WX 333 ; N Iogonek ; B -8 -169 384 653 ;
-C -1 ; WX 444 ; N kcommaaccent ; B 14 -187 461 683 ;
-C -1 ; WX 675 ; N minus ; B 86 220 590 286 ;
-C -1 ; WX 333 ; N Icircumflex ; B -8 0 425 873 ;
-C -1 ; WX 500 ; N ncaron ; B 14 -9 510 661 ;
-C -1 ; WX 278 ; N tcommaaccent ; B 2 -217 296 546 ;
-C -1 ; WX 675 ; N logicalnot ; B 86 108 590 386 ;
-C -1 ; WX 500 ; N odieresis ; B 27 -11 489 606 ;
-C -1 ; WX 500 ; N udieresis ; B 42 -11 479 606 ;
-C -1 ; WX 549 ; N notequal ; B 12 -29 537 541 ;
-C -1 ; WX 500 ; N gcommaaccent ; B 8 -206 472 706 ;
-C -1 ; WX 500 ; N eth ; B 27 -11 482 683 ;
-C -1 ; WX 389 ; N zcaron ; B -2 -81 434 661 ;
-C -1 ; WX 500 ; N ncommaaccent ; B 14 -187 474 441 ;
-C -1 ; WX 300 ; N onesuperior ; B 43 271 284 676 ;
-C -1 ; WX 278 ; N imacron ; B 46 -11 311 583 ;
-C -1 ; WX 500 ; N Euro ; B 0 0 0 0 ;
-EndCharMetrics
-StartKernData
-StartKernPairs 2321
-KPX A C -30
-KPX A Cacute -30
-KPX A Ccaron -30
-KPX A Ccedilla -30
-KPX A G -35
-KPX A Gbreve -35
-KPX A Gcommaaccent -35
-KPX A O -40
-KPX A Oacute -40
-KPX A Ocircumflex -40
-KPX A Odieresis -40
-KPX A Ograve -40
-KPX A Ohungarumlaut -40
-KPX A Omacron -40
-KPX A Oslash -40
-KPX A Otilde -40
-KPX A Q -40
-KPX A T -37
-KPX A Tcaron -37
-KPX A Tcommaaccent -37
-KPX A U -50
-KPX A Uacute -50
-KPX A Ucircumflex -50
-KPX A Udieresis -50
-KPX A Ugrave -50
-KPX A Uhungarumlaut -50
-KPX A Umacron -50
-KPX A Uogonek -50
-KPX A Uring -50
-KPX A V -105
-KPX A W -95
-KPX A Y -55
-KPX A Yacute -55
-KPX A Ydieresis -55
-KPX A quoteright -37
-KPX A u -20
-KPX A uacute -20
-KPX A ucircumflex -20
-KPX A udieresis -20
-KPX A ugrave -20
-KPX A uhungarumlaut -20
-KPX A umacron -20
-KPX A uogonek -20
-KPX A uring -20
-KPX A v -55
-KPX A w -55
-KPX A y -55
-KPX A yacute -55
-KPX A ydieresis -55
-KPX Aacute C -30
-KPX Aacute Cacute -30
-KPX Aacute Ccaron -30
-KPX Aacute Ccedilla -30
-KPX Aacute G -35
-KPX Aacute Gbreve -35
-KPX Aacute Gcommaaccent -35
-KPX Aacute O -40
-KPX Aacute Oacute -40
-KPX Aacute Ocircumflex -40
-KPX Aacute Odieresis -40
-KPX Aacute Ograve -40
-KPX Aacute Ohungarumlaut -40
-KPX Aacute Omacron -40
-KPX Aacute Oslash -40
-KPX Aacute Otilde -40
-KPX Aacute Q -40
-KPX Aacute T -37
-KPX Aacute Tcaron -37
-KPX Aacute Tcommaaccent -37
-KPX Aacute U -50
-KPX Aacute Uacute -50
-KPX Aacute Ucircumflex -50
-KPX Aacute Udieresis -50
-KPX Aacute Ugrave -50
-KPX Aacute Uhungarumlaut -50
-KPX Aacute Umacron -50
-KPX Aacute Uogonek -50
-KPX Aacute Uring -50
-KPX Aacute V -105
-KPX Aacute W -95
-KPX Aacute Y -55
-KPX Aacute Yacute -55
-KPX Aacute Ydieresis -55
-KPX Aacute quoteright -37
-KPX Aacute u -20
-KPX Aacute uacute -20
-KPX Aacute ucircumflex -20
-KPX Aacute udieresis -20
-KPX Aacute ugrave -20
-KPX Aacute uhungarumlaut -20
-KPX Aacute umacron -20
-KPX Aacute uogonek -20
-KPX Aacute uring -20
-KPX Aacute v -55
-KPX Aacute w -55
-KPX Aacute y -55
-KPX Aacute yacute -55
-KPX Aacute ydieresis -55
-KPX Abreve C -30
-KPX Abreve Cacute -30
-KPX Abreve Ccaron -30
-KPX Abreve Ccedilla -30
-KPX Abreve G -35
-KPX Abreve Gbreve -35
-KPX Abreve Gcommaaccent -35
-KPX Abreve O -40
-KPX Abreve Oacute -40
-KPX Abreve Ocircumflex -40
-KPX Abreve Odieresis -40
-KPX Abreve Ograve -40
-KPX Abreve Ohungarumlaut -40
-KPX Abreve Omacron -40
-KPX Abreve Oslash -40
-KPX Abreve Otilde -40
-KPX Abreve Q -40
-KPX Abreve T -37
-KPX Abreve Tcaron -37
-KPX Abreve Tcommaaccent -37
-KPX Abreve U -50
-KPX Abreve Uacute -50
-KPX Abreve Ucircumflex -50
-KPX Abreve Udieresis -50
-KPX Abreve Ugrave -50
-KPX Abreve Uhungarumlaut -50
-KPX Abreve Umacron -50
-KPX Abreve Uogonek -50
-KPX Abreve Uring -50
-KPX Abreve V -105
-KPX Abreve W -95
-KPX Abreve Y -55
-KPX Abreve Yacute -55
-KPX Abreve Ydieresis -55
-KPX Abreve quoteright -37
-KPX Abreve u -20
-KPX Abreve uacute -20
-KPX Abreve ucircumflex -20
-KPX Abreve udieresis -20
-KPX Abreve ugrave -20
-KPX Abreve uhungarumlaut -20
-KPX Abreve umacron -20
-KPX Abreve uogonek -20
-KPX Abreve uring -20
-KPX Abreve v -55
-KPX Abreve w -55
-KPX Abreve y -55
-KPX Abreve yacute -55
-KPX Abreve ydieresis -55
-KPX Acircumflex C -30
-KPX Acircumflex Cacute -30
-KPX Acircumflex Ccaron -30
-KPX Acircumflex Ccedilla -30
-KPX Acircumflex G -35
-KPX Acircumflex Gbreve -35
-KPX Acircumflex Gcommaaccent -35
-KPX Acircumflex O -40
-KPX Acircumflex Oacute -40
-KPX Acircumflex Ocircumflex -40
-KPX Acircumflex Odieresis -40
-KPX Acircumflex Ograve -40
-KPX Acircumflex Ohungarumlaut -40
-KPX Acircumflex Omacron -40
-KPX Acircumflex Oslash -40
-KPX Acircumflex Otilde -40
-KPX Acircumflex Q -40
-KPX Acircumflex T -37
-KPX Acircumflex Tcaron -37
-KPX Acircumflex Tcommaaccent -37
-KPX Acircumflex U -50
-KPX Acircumflex Uacute -50
-KPX Acircumflex Ucircumflex -50
-KPX Acircumflex Udieresis -50
-KPX Acircumflex Ugrave -50
-KPX Acircumflex Uhungarumlaut -50
-KPX Acircumflex Umacron -50
-KPX Acircumflex Uogonek -50
-KPX Acircumflex Uring -50
-KPX Acircumflex V -105
-KPX Acircumflex W -95
-KPX Acircumflex Y -55
-KPX Acircumflex Yacute -55
-KPX Acircumflex Ydieresis -55
-KPX Acircumflex quoteright -37
-KPX Acircumflex u -20
-KPX Acircumflex uacute -20
-KPX Acircumflex ucircumflex -20
-KPX Acircumflex udieresis -20
-KPX Acircumflex ugrave -20
-KPX Acircumflex uhungarumlaut -20
-KPX Acircumflex umacron -20
-KPX Acircumflex uogonek -20
-KPX Acircumflex uring -20
-KPX Acircumflex v -55
-KPX Acircumflex w -55
-KPX Acircumflex y -55
-KPX Acircumflex yacute -55
-KPX Acircumflex ydieresis -55
-KPX Adieresis C -30
-KPX Adieresis Cacute -30
-KPX Adieresis Ccaron -30
-KPX Adieresis Ccedilla -30
-KPX Adieresis G -35
-KPX Adieresis Gbreve -35
-KPX Adieresis Gcommaaccent -35
-KPX Adieresis O -40
-KPX Adieresis Oacute -40
-KPX Adieresis Ocircumflex -40
-KPX Adieresis Odieresis -40
-KPX Adieresis Ograve -40
-KPX Adieresis Ohungarumlaut -40
-KPX Adieresis Omacron -40
-KPX Adieresis Oslash -40
-KPX Adieresis Otilde -40
-KPX Adieresis Q -40
-KPX Adieresis T -37
-KPX Adieresis Tcaron -37
-KPX Adieresis Tcommaaccent -37
-KPX Adieresis U -50
-KPX Adieresis Uacute -50
-KPX Adieresis Ucircumflex -50
-KPX Adieresis Udieresis -50
-KPX Adieresis Ugrave -50
-KPX Adieresis Uhungarumlaut -50
-KPX Adieresis Umacron -50
-KPX Adieresis Uogonek -50
-KPX Adieresis Uring -50
-KPX Adieresis V -105
-KPX Adieresis W -95
-KPX Adieresis Y -55
-KPX Adieresis Yacute -55
-KPX Adieresis Ydieresis -55
-KPX Adieresis quoteright -37
-KPX Adieresis u -20
-KPX Adieresis uacute -20
-KPX Adieresis ucircumflex -20
-KPX Adieresis udieresis -20
-KPX Adieresis ugrave -20
-KPX Adieresis uhungarumlaut -20
-KPX Adieresis umacron -20
-KPX Adieresis uogonek -20
-KPX Adieresis uring -20
-KPX Adieresis v -55
-KPX Adieresis w -55
-KPX Adieresis y -55
-KPX Adieresis yacute -55
-KPX Adieresis ydieresis -55
-KPX Agrave C -30
-KPX Agrave Cacute -30
-KPX Agrave Ccaron -30
-KPX Agrave Ccedilla -30
-KPX Agrave G -35
-KPX Agrave Gbreve -35
-KPX Agrave Gcommaaccent -35
-KPX Agrave O -40
-KPX Agrave Oacute -40
-KPX Agrave Ocircumflex -40
-KPX Agrave Odieresis -40
-KPX Agrave Ograve -40
-KPX Agrave Ohungarumlaut -40
-KPX Agrave Omacron -40
-KPX Agrave Oslash -40
-KPX Agrave Otilde -40
-KPX Agrave Q -40
-KPX Agrave T -37
-KPX Agrave Tcaron -37
-KPX Agrave Tcommaaccent -37
-KPX Agrave U -50
-KPX Agrave Uacute -50
-KPX Agrave Ucircumflex -50
-KPX Agrave Udieresis -50
-KPX Agrave Ugrave -50
-KPX Agrave Uhungarumlaut -50
-KPX Agrave Umacron -50
-KPX Agrave Uogonek -50
-KPX Agrave Uring -50
-KPX Agrave V -105
-KPX Agrave W -95
-KPX Agrave Y -55
-KPX Agrave Yacute -55
-KPX Agrave Ydieresis -55
-KPX Agrave quoteright -37
-KPX Agrave u -20
-KPX Agrave uacute -20
-KPX Agrave ucircumflex -20
-KPX Agrave udieresis -20
-KPX Agrave ugrave -20
-KPX Agrave uhungarumlaut -20
-KPX Agrave umacron -20
-KPX Agrave uogonek -20
-KPX Agrave uring -20
-KPX Agrave v -55
-KPX Agrave w -55
-KPX Agrave y -55
-KPX Agrave yacute -55
-KPX Agrave ydieresis -55
-KPX Amacron C -30
-KPX Amacron Cacute -30
-KPX Amacron Ccaron -30
-KPX Amacron Ccedilla -30
-KPX Amacron G -35
-KPX Amacron Gbreve -35
-KPX Amacron Gcommaaccent -35
-KPX Amacron O -40
-KPX Amacron Oacute -40
-KPX Amacron Ocircumflex -40
-KPX Amacron Odieresis -40
-KPX Amacron Ograve -40
-KPX Amacron Ohungarumlaut -40
-KPX Amacron Omacron -40
-KPX Amacron Oslash -40
-KPX Amacron Otilde -40
-KPX Amacron Q -40
-KPX Amacron T -37
-KPX Amacron Tcaron -37
-KPX Amacron Tcommaaccent -37
-KPX Amacron U -50
-KPX Amacron Uacute -50
-KPX Amacron Ucircumflex -50
-KPX Amacron Udieresis -50
-KPX Amacron Ugrave -50
-KPX Amacron Uhungarumlaut -50
-KPX Amacron Umacron -50
-KPX Amacron Uogonek -50
-KPX Amacron Uring -50
-KPX Amacron V -105
-KPX Amacron W -95
-KPX Amacron Y -55
-KPX Amacron Yacute -55
-KPX Amacron Ydieresis -55
-KPX Amacron quoteright -37
-KPX Amacron u -20
-KPX Amacron uacute -20
-KPX Amacron ucircumflex -20
-KPX Amacron udieresis -20
-KPX Amacron ugrave -20
-KPX Amacron uhungarumlaut -20
-KPX Amacron umacron -20
-KPX Amacron uogonek -20
-KPX Amacron uring -20
-KPX Amacron v -55
-KPX Amacron w -55
-KPX Amacron y -55
-KPX Amacron yacute -55
-KPX Amacron ydieresis -55
-KPX Aogonek C -30
-KPX Aogonek Cacute -30
-KPX Aogonek Ccaron -30
-KPX Aogonek Ccedilla -30
-KPX Aogonek G -35
-KPX Aogonek Gbreve -35
-KPX Aogonek Gcommaaccent -35
-KPX Aogonek O -40
-KPX Aogonek Oacute -40
-KPX Aogonek Ocircumflex -40
-KPX Aogonek Odieresis -40
-KPX Aogonek Ograve -40
-KPX Aogonek Ohungarumlaut -40
-KPX Aogonek Omacron -40
-KPX Aogonek Oslash -40
-KPX Aogonek Otilde -40
-KPX Aogonek Q -40
-KPX Aogonek T -37
-KPX Aogonek Tcaron -37
-KPX Aogonek Tcommaaccent -37
-KPX Aogonek U -50
-KPX Aogonek Uacute -50
-KPX Aogonek Ucircumflex -50
-KPX Aogonek Udieresis -50
-KPX Aogonek Ugrave -50
-KPX Aogonek Uhungarumlaut -50
-KPX Aogonek Umacron -50
-KPX Aogonek Uogonek -50
-KPX Aogonek Uring -50
-KPX Aogonek V -105
-KPX Aogonek W -95
-KPX Aogonek Y -55
-KPX Aogonek Yacute -55
-KPX Aogonek Ydieresis -55
-KPX Aogonek quoteright -37
-KPX Aogonek u -20
-KPX Aogonek uacute -20
-KPX Aogonek ucircumflex -20
-KPX Aogonek udieresis -20
-KPX Aogonek ugrave -20
-KPX Aogonek uhungarumlaut -20
-KPX Aogonek umacron -20
-KPX Aogonek uogonek -20
-KPX Aogonek uring -20
-KPX Aogonek v -55
-KPX Aogonek w -55
-KPX Aogonek y -55
-KPX Aogonek yacute -55
-KPX Aogonek ydieresis -55
-KPX Aring C -30
-KPX Aring Cacute -30
-KPX Aring Ccaron -30
-KPX Aring Ccedilla -30
-KPX Aring G -35
-KPX Aring Gbreve -35
-KPX Aring Gcommaaccent -35
-KPX Aring O -40
-KPX Aring Oacute -40
-KPX Aring Ocircumflex -40
-KPX Aring Odieresis -40
-KPX Aring Ograve -40
-KPX Aring Ohungarumlaut -40
-KPX Aring Omacron -40
-KPX Aring Oslash -40
-KPX Aring Otilde -40
-KPX Aring Q -40
-KPX Aring T -37
-KPX Aring Tcaron -37
-KPX Aring Tcommaaccent -37
-KPX Aring U -50
-KPX Aring Uacute -50
-KPX Aring Ucircumflex -50
-KPX Aring Udieresis -50
-KPX Aring Ugrave -50
-KPX Aring Uhungarumlaut -50
-KPX Aring Umacron -50
-KPX Aring Uogonek -50
-KPX Aring Uring -50
-KPX Aring V -105
-KPX Aring W -95
-KPX Aring Y -55
-KPX Aring Yacute -55
-KPX Aring Ydieresis -55
-KPX Aring quoteright -37
-KPX Aring u -20
-KPX Aring uacute -20
-KPX Aring ucircumflex -20
-KPX Aring udieresis -20
-KPX Aring ugrave -20
-KPX Aring uhungarumlaut -20
-KPX Aring umacron -20
-KPX Aring uogonek -20
-KPX Aring uring -20
-KPX Aring v -55
-KPX Aring w -55
-KPX Aring y -55
-KPX Aring yacute -55
-KPX Aring ydieresis -55
-KPX Atilde C -30
-KPX Atilde Cacute -30
-KPX Atilde Ccaron -30
-KPX Atilde Ccedilla -30
-KPX Atilde G -35
-KPX Atilde Gbreve -35
-KPX Atilde Gcommaaccent -35
-KPX Atilde O -40
-KPX Atilde Oacute -40
-KPX Atilde Ocircumflex -40
-KPX Atilde Odieresis -40
-KPX Atilde Ograve -40
-KPX Atilde Ohungarumlaut -40
-KPX Atilde Omacron -40
-KPX Atilde Oslash -40
-KPX Atilde Otilde -40
-KPX Atilde Q -40
-KPX Atilde T -37
-KPX Atilde Tcaron -37
-KPX Atilde Tcommaaccent -37
-KPX Atilde U -50
-KPX Atilde Uacute -50
-KPX Atilde Ucircumflex -50
-KPX Atilde Udieresis -50
-KPX Atilde Ugrave -50
-KPX Atilde Uhungarumlaut -50
-KPX Atilde Umacron -50
-KPX Atilde Uogonek -50
-KPX Atilde Uring -50
-KPX Atilde V -105
-KPX Atilde W -95
-KPX Atilde Y -55
-KPX Atilde Yacute -55
-KPX Atilde Ydieresis -55
-KPX Atilde quoteright -37
-KPX Atilde u -20
-KPX Atilde uacute -20
-KPX Atilde ucircumflex -20
-KPX Atilde udieresis -20
-KPX Atilde ugrave -20
-KPX Atilde uhungarumlaut -20
-KPX Atilde umacron -20
-KPX Atilde uogonek -20
-KPX Atilde uring -20
-KPX Atilde v -55
-KPX Atilde w -55
-KPX Atilde y -55
-KPX Atilde yacute -55
-KPX Atilde ydieresis -55
-KPX B A -25
-KPX B Aacute -25
-KPX B Abreve -25
-KPX B Acircumflex -25
-KPX B Adieresis -25
-KPX B Agrave -25
-KPX B Amacron -25
-KPX B Aogonek -25
-KPX B Aring -25
-KPX B Atilde -25
-KPX B U -10
-KPX B Uacute -10
-KPX B Ucircumflex -10
-KPX B Udieresis -10
-KPX B Ugrave -10
-KPX B Uhungarumlaut -10
-KPX B Umacron -10
-KPX B Uogonek -10
-KPX B Uring -10
-KPX D A -35
-KPX D Aacute -35
-KPX D Abreve -35
-KPX D Acircumflex -35
-KPX D Adieresis -35
-KPX D Agrave -35
-KPX D Amacron -35
-KPX D Aogonek -35
-KPX D Aring -35
-KPX D Atilde -35
-KPX D V -40
-KPX D W -40
-KPX D Y -40
-KPX D Yacute -40
-KPX D Ydieresis -40
-KPX Dcaron A -35
-KPX Dcaron Aacute -35
-KPX Dcaron Abreve -35
-KPX Dcaron Acircumflex -35
-KPX Dcaron Adieresis -35
-KPX Dcaron Agrave -35
-KPX Dcaron Amacron -35
-KPX Dcaron Aogonek -35
-KPX Dcaron Aring -35
-KPX Dcaron Atilde -35
-KPX Dcaron V -40
-KPX Dcaron W -40
-KPX Dcaron Y -40
-KPX Dcaron Yacute -40
-KPX Dcaron Ydieresis -40
-KPX Dcroat A -35
-KPX Dcroat Aacute -35
-KPX Dcroat Abreve -35
-KPX Dcroat Acircumflex -35
-KPX Dcroat Adieresis -35
-KPX Dcroat Agrave -35
-KPX Dcroat Amacron -35
-KPX Dcroat Aogonek -35
-KPX Dcroat Aring -35
-KPX Dcroat Atilde -35
-KPX Dcroat V -40
-KPX Dcroat W -40
-KPX Dcroat Y -40
-KPX Dcroat Yacute -40
-KPX Dcroat Ydieresis -40
-KPX F A -115
-KPX F Aacute -115
-KPX F Abreve -115
-KPX F Acircumflex -115
-KPX F Adieresis -115
-KPX F Agrave -115
-KPX F Amacron -115
-KPX F Aogonek -115
-KPX F Aring -115
-KPX F Atilde -115
-KPX F a -75
-KPX F aacute -75
-KPX F abreve -75
-KPX F acircumflex -75
-KPX F adieresis -75
-KPX F agrave -75
-KPX F amacron -75
-KPX F aogonek -75
-KPX F aring -75
-KPX F atilde -75
-KPX F comma -135
-KPX F e -75
-KPX F eacute -75
-KPX F ecaron -75
-KPX F ecircumflex -75
-KPX F edieresis -75
-KPX F edotaccent -75
-KPX F egrave -75
-KPX F emacron -75
-KPX F eogonek -75
-KPX F i -45
-KPX F iacute -45
-KPX F icircumflex -45
-KPX F idieresis -45
-KPX F igrave -45
-KPX F imacron -45
-KPX F iogonek -45
-KPX F o -105
-KPX F oacute -105
-KPX F ocircumflex -105
-KPX F odieresis -105
-KPX F ograve -105
-KPX F ohungarumlaut -105
-KPX F omacron -105
-KPX F oslash -105
-KPX F otilde -105
-KPX F period -135
-KPX F r -55
-KPX F racute -55
-KPX F rcaron -55
-KPX F rcommaaccent -55
-KPX J A -40
-KPX J Aacute -40
-KPX J Abreve -40
-KPX J Acircumflex -40
-KPX J Adieresis -40
-KPX J Agrave -40
-KPX J Amacron -40
-KPX J Aogonek -40
-KPX J Aring -40
-KPX J Atilde -40
-KPX J a -35
-KPX J aacute -35
-KPX J abreve -35
-KPX J acircumflex -35
-KPX J adieresis -35
-KPX J agrave -35
-KPX J amacron -35
-KPX J aogonek -35
-KPX J aring -35
-KPX J atilde -35
-KPX J comma -25
-KPX J e -25
-KPX J eacute -25
-KPX J ecaron -25
-KPX J ecircumflex -25
-KPX J edieresis -25
-KPX J edotaccent -25
-KPX J egrave -25
-KPX J emacron -25
-KPX J eogonek -25
-KPX J o -25
-KPX J oacute -25
-KPX J ocircumflex -25
-KPX J odieresis -25
-KPX J ograve -25
-KPX J ohungarumlaut -25
-KPX J omacron -25
-KPX J oslash -25
-KPX J otilde -25
-KPX J period -25
-KPX J u -35
-KPX J uacute -35
-KPX J ucircumflex -35
-KPX J udieresis -35
-KPX J ugrave -35
-KPX J uhungarumlaut -35
-KPX J umacron -35
-KPX J uogonek -35
-KPX J uring -35
-KPX K O -50
-KPX K Oacute -50
-KPX K Ocircumflex -50
-KPX K Odieresis -50
-KPX K Ograve -50
-KPX K Ohungarumlaut -50
-KPX K Omacron -50
-KPX K Oslash -50
-KPX K Otilde -50
-KPX K e -35
-KPX K eacute -35
-KPX K ecaron -35
-KPX K ecircumflex -35
-KPX K edieresis -35
-KPX K edotaccent -35
-KPX K egrave -35
-KPX K emacron -35
-KPX K eogonek -35
-KPX K o -40
-KPX K oacute -40
-KPX K ocircumflex -40
-KPX K odieresis -40
-KPX K ograve -40
-KPX K ohungarumlaut -40
-KPX K omacron -40
-KPX K oslash -40
-KPX K otilde -40
-KPX K u -40
-KPX K uacute -40
-KPX K ucircumflex -40
-KPX K udieresis -40
-KPX K ugrave -40
-KPX K uhungarumlaut -40
-KPX K umacron -40
-KPX K uogonek -40
-KPX K uring -40
-KPX K y -40
-KPX K yacute -40
-KPX K ydieresis -40
-KPX Kcommaaccent O -50
-KPX Kcommaaccent Oacute -50
-KPX Kcommaaccent Ocircumflex -50
-KPX Kcommaaccent Odieresis -50
-KPX Kcommaaccent Ograve -50
-KPX Kcommaaccent Ohungarumlaut -50
-KPX Kcommaaccent Omacron -50
-KPX Kcommaaccent Oslash -50
-KPX Kcommaaccent Otilde -50
-KPX Kcommaaccent e -35
-KPX Kcommaaccent eacute -35
-KPX Kcommaaccent ecaron -35
-KPX Kcommaaccent ecircumflex -35
-KPX Kcommaaccent edieresis -35
-KPX Kcommaaccent edotaccent -35
-KPX Kcommaaccent egrave -35
-KPX Kcommaaccent emacron -35
-KPX Kcommaaccent eogonek -35
-KPX Kcommaaccent o -40
-KPX Kcommaaccent oacute -40
-KPX Kcommaaccent ocircumflex -40
-KPX Kcommaaccent odieresis -40
-KPX Kcommaaccent ograve -40
-KPX Kcommaaccent ohungarumlaut -40
-KPX Kcommaaccent omacron -40
-KPX Kcommaaccent oslash -40
-KPX Kcommaaccent otilde -40
-KPX Kcommaaccent u -40
-KPX Kcommaaccent uacute -40
-KPX Kcommaaccent ucircumflex -40
-KPX Kcommaaccent udieresis -40
-KPX Kcommaaccent ugrave -40
-KPX Kcommaaccent uhungarumlaut -40
-KPX Kcommaaccent umacron -40
-KPX Kcommaaccent uogonek -40
-KPX Kcommaaccent uring -40
-KPX Kcommaaccent y -40
-KPX Kcommaaccent yacute -40
-KPX Kcommaaccent ydieresis -40
-KPX L T -20
-KPX L Tcaron -20
-KPX L Tcommaaccent -20
-KPX L V -55
-KPX L W -55
-KPX L Y -20
-KPX L Yacute -20
-KPX L Ydieresis -20
-KPX L quoteright -37
-KPX L y -30
-KPX L yacute -30
-KPX L ydieresis -30
-KPX Lacute T -20
-KPX Lacute Tcaron -20
-KPX Lacute Tcommaaccent -20
-KPX Lacute V -55
-KPX Lacute W -55
-KPX Lacute Y -20
-KPX Lacute Yacute -20
-KPX Lacute Ydieresis -20
-KPX Lacute quoteright -37
-KPX Lacute y -30
-KPX Lacute yacute -30
-KPX Lacute ydieresis -30
-KPX Lcommaaccent T -20
-KPX Lcommaaccent Tcaron -20
-KPX Lcommaaccent Tcommaaccent -20
-KPX Lcommaaccent V -55
-KPX Lcommaaccent W -55
-KPX Lcommaaccent Y -20
-KPX Lcommaaccent Yacute -20
-KPX Lcommaaccent Ydieresis -20
-KPX Lcommaaccent quoteright -37
-KPX Lcommaaccent y -30
-KPX Lcommaaccent yacute -30
-KPX Lcommaaccent ydieresis -30
-KPX Lslash T -20
-KPX Lslash Tcaron -20
-KPX Lslash Tcommaaccent -20
-KPX Lslash V -55
-KPX Lslash W -55
-KPX Lslash Y -20
-KPX Lslash Yacute -20
-KPX Lslash Ydieresis -20
-KPX Lslash quoteright -37
-KPX Lslash y -30
-KPX Lslash yacute -30
-KPX Lslash ydieresis -30
-KPX N A -27
-KPX N Aacute -27
-KPX N Abreve -27
-KPX N Acircumflex -27
-KPX N Adieresis -27
-KPX N Agrave -27
-KPX N Amacron -27
-KPX N Aogonek -27
-KPX N Aring -27
-KPX N Atilde -27
-KPX Nacute A -27
-KPX Nacute Aacute -27
-KPX Nacute Abreve -27
-KPX Nacute Acircumflex -27
-KPX Nacute Adieresis -27
-KPX Nacute Agrave -27
-KPX Nacute Amacron -27
-KPX Nacute Aogonek -27
-KPX Nacute Aring -27
-KPX Nacute Atilde -27
-KPX Ncaron A -27
-KPX Ncaron Aacute -27
-KPX Ncaron Abreve -27
-KPX Ncaron Acircumflex -27
-KPX Ncaron Adieresis -27
-KPX Ncaron Agrave -27
-KPX Ncaron Amacron -27
-KPX Ncaron Aogonek -27
-KPX Ncaron Aring -27
-KPX Ncaron Atilde -27
-KPX Ncommaaccent A -27
-KPX Ncommaaccent Aacute -27
-KPX Ncommaaccent Abreve -27
-KPX Ncommaaccent Acircumflex -27
-KPX Ncommaaccent Adieresis -27
-KPX Ncommaaccent Agrave -27
-KPX Ncommaaccent Amacron -27
-KPX Ncommaaccent Aogonek -27
-KPX Ncommaaccent Aring -27
-KPX Ncommaaccent Atilde -27
-KPX Ntilde A -27
-KPX Ntilde Aacute -27
-KPX Ntilde Abreve -27
-KPX Ntilde Acircumflex -27
-KPX Ntilde Adieresis -27
-KPX Ntilde Agrave -27
-KPX Ntilde Amacron -27
-KPX Ntilde Aogonek -27
-KPX Ntilde Aring -27
-KPX Ntilde Atilde -27
-KPX O A -55
-KPX O Aacute -55
-KPX O Abreve -55
-KPX O Acircumflex -55
-KPX O Adieresis -55
-KPX O Agrave -55
-KPX O Amacron -55
-KPX O Aogonek -55
-KPX O Aring -55
-KPX O Atilde -55
-KPX O T -40
-KPX O Tcaron -40
-KPX O Tcommaaccent -40
-KPX O V -50
-KPX O W -50
-KPX O X -40
-KPX O Y -50
-KPX O Yacute -50
-KPX O Ydieresis -50
-KPX Oacute A -55
-KPX Oacute Aacute -55
-KPX Oacute Abreve -55
-KPX Oacute Acircumflex -55
-KPX Oacute Adieresis -55
-KPX Oacute Agrave -55
-KPX Oacute Amacron -55
-KPX Oacute Aogonek -55
-KPX Oacute Aring -55
-KPX Oacute Atilde -55
-KPX Oacute T -40
-KPX Oacute Tcaron -40
-KPX Oacute Tcommaaccent -40
-KPX Oacute V -50
-KPX Oacute W -50
-KPX Oacute X -40
-KPX Oacute Y -50
-KPX Oacute Yacute -50
-KPX Oacute Ydieresis -50
-KPX Ocircumflex A -55
-KPX Ocircumflex Aacute -55
-KPX Ocircumflex Abreve -55
-KPX Ocircumflex Acircumflex -55
-KPX Ocircumflex Adieresis -55
-KPX Ocircumflex Agrave -55
-KPX Ocircumflex Amacron -55
-KPX Ocircumflex Aogonek -55
-KPX Ocircumflex Aring -55
-KPX Ocircumflex Atilde -55
-KPX Ocircumflex T -40
-KPX Ocircumflex Tcaron -40
-KPX Ocircumflex Tcommaaccent -40
-KPX Ocircumflex V -50
-KPX Ocircumflex W -50
-KPX Ocircumflex X -40
-KPX Ocircumflex Y -50
-KPX Ocircumflex Yacute -50
-KPX Ocircumflex Ydieresis -50
-KPX Odieresis A -55
-KPX Odieresis Aacute -55
-KPX Odieresis Abreve -55
-KPX Odieresis Acircumflex -55
-KPX Odieresis Adieresis -55
-KPX Odieresis Agrave -55
-KPX Odieresis Amacron -55
-KPX Odieresis Aogonek -55
-KPX Odieresis Aring -55
-KPX Odieresis Atilde -55
-KPX Odieresis T -40
-KPX Odieresis Tcaron -40
-KPX Odieresis Tcommaaccent -40
-KPX Odieresis V -50
-KPX Odieresis W -50
-KPX Odieresis X -40
-KPX Odieresis Y -50
-KPX Odieresis Yacute -50
-KPX Odieresis Ydieresis -50
-KPX Ograve A -55
-KPX Ograve Aacute -55
-KPX Ograve Abreve -55
-KPX Ograve Acircumflex -55
-KPX Ograve Adieresis -55
-KPX Ograve Agrave -55
-KPX Ograve Amacron -55
-KPX Ograve Aogonek -55
-KPX Ograve Aring -55
-KPX Ograve Atilde -55
-KPX Ograve T -40
-KPX Ograve Tcaron -40
-KPX Ograve Tcommaaccent -40
-KPX Ograve V -50
-KPX Ograve W -50
-KPX Ograve X -40
-KPX Ograve Y -50
-KPX Ograve Yacute -50
-KPX Ograve Ydieresis -50
-KPX Ohungarumlaut A -55
-KPX Ohungarumlaut Aacute -55
-KPX Ohungarumlaut Abreve -55
-KPX Ohungarumlaut Acircumflex -55
-KPX Ohungarumlaut Adieresis -55
-KPX Ohungarumlaut Agrave -55
-KPX Ohungarumlaut Amacron -55
-KPX Ohungarumlaut Aogonek -55
-KPX Ohungarumlaut Aring -55
-KPX Ohungarumlaut Atilde -55
-KPX Ohungarumlaut T -40
-KPX Ohungarumlaut Tcaron -40
-KPX Ohungarumlaut Tcommaaccent -40
-KPX Ohungarumlaut V -50
-KPX Ohungarumlaut W -50
-KPX Ohungarumlaut X -40
-KPX Ohungarumlaut Y -50
-KPX Ohungarumlaut Yacute -50
-KPX Ohungarumlaut Ydieresis -50
-KPX Omacron A -55
-KPX Omacron Aacute -55
-KPX Omacron Abreve -55
-KPX Omacron Acircumflex -55
-KPX Omacron Adieresis -55
-KPX Omacron Agrave -55
-KPX Omacron Amacron -55
-KPX Omacron Aogonek -55
-KPX Omacron Aring -55
-KPX Omacron Atilde -55
-KPX Omacron T -40
-KPX Omacron Tcaron -40
-KPX Omacron Tcommaaccent -40
-KPX Omacron V -50
-KPX Omacron W -50
-KPX Omacron X -40
-KPX Omacron Y -50
-KPX Omacron Yacute -50
-KPX Omacron Ydieresis -50
-KPX Oslash A -55
-KPX Oslash Aacute -55
-KPX Oslash Abreve -55
-KPX Oslash Acircumflex -55
-KPX Oslash Adieresis -55
-KPX Oslash Agrave -55
-KPX Oslash Amacron -55
-KPX Oslash Aogonek -55
-KPX Oslash Aring -55
-KPX Oslash Atilde -55
-KPX Oslash T -40
-KPX Oslash Tcaron -40
-KPX Oslash Tcommaaccent -40
-KPX Oslash V -50
-KPX Oslash W -50
-KPX Oslash X -40
-KPX Oslash Y -50
-KPX Oslash Yacute -50
-KPX Oslash Ydieresis -50
-KPX Otilde A -55
-KPX Otilde Aacute -55
-KPX Otilde Abreve -55
-KPX Otilde Acircumflex -55
-KPX Otilde Adieresis -55
-KPX Otilde Agrave -55
-KPX Otilde Amacron -55
-KPX Otilde Aogonek -55
-KPX Otilde Aring -55
-KPX Otilde Atilde -55
-KPX Otilde T -40
-KPX Otilde Tcaron -40
-KPX Otilde Tcommaaccent -40
-KPX Otilde V -50
-KPX Otilde W -50
-KPX Otilde X -40
-KPX Otilde Y -50
-KPX Otilde Yacute -50
-KPX Otilde Ydieresis -50
-KPX P A -90
-KPX P Aacute -90
-KPX P Abreve -90
-KPX P Acircumflex -90
-KPX P Adieresis -90
-KPX P Agrave -90
-KPX P Amacron -90
-KPX P Aogonek -90
-KPX P Aring -90
-KPX P Atilde -90
-KPX P a -80
-KPX P aacute -80
-KPX P abreve -80
-KPX P acircumflex -80
-KPX P adieresis -80
-KPX P agrave -80
-KPX P amacron -80
-KPX P aogonek -80
-KPX P aring -80
-KPX P atilde -80
-KPX P comma -135
-KPX P e -80
-KPX P eacute -80
-KPX P ecaron -80
-KPX P ecircumflex -80
-KPX P edieresis -80
-KPX P edotaccent -80
-KPX P egrave -80
-KPX P emacron -80
-KPX P eogonek -80
-KPX P o -80
-KPX P oacute -80
-KPX P ocircumflex -80
-KPX P odieresis -80
-KPX P ograve -80
-KPX P ohungarumlaut -80
-KPX P omacron -80
-KPX P oslash -80
-KPX P otilde -80
-KPX P period -135
-KPX Q U -10
-KPX Q Uacute -10
-KPX Q Ucircumflex -10
-KPX Q Udieresis -10
-KPX Q Ugrave -10
-KPX Q Uhungarumlaut -10
-KPX Q Umacron -10
-KPX Q Uogonek -10
-KPX Q Uring -10
-KPX R O -40
-KPX R Oacute -40
-KPX R Ocircumflex -40
-KPX R Odieresis -40
-KPX R Ograve -40
-KPX R Ohungarumlaut -40
-KPX R Omacron -40
-KPX R Oslash -40
-KPX R Otilde -40
-KPX R U -40
-KPX R Uacute -40
-KPX R Ucircumflex -40
-KPX R Udieresis -40
-KPX R Ugrave -40
-KPX R Uhungarumlaut -40
-KPX R Umacron -40
-KPX R Uogonek -40
-KPX R Uring -40
-KPX R V -18
-KPX R W -18
-KPX R Y -18
-KPX R Yacute -18
-KPX R Ydieresis -18
-KPX Racute O -40
-KPX Racute Oacute -40
-KPX Racute Ocircumflex -40
-KPX Racute Odieresis -40
-KPX Racute Ograve -40
-KPX Racute Ohungarumlaut -40
-KPX Racute Omacron -40
-KPX Racute Oslash -40
-KPX Racute Otilde -40
-KPX Racute U -40
-KPX Racute Uacute -40
-KPX Racute Ucircumflex -40
-KPX Racute Udieresis -40
-KPX Racute Ugrave -40
-KPX Racute Uhungarumlaut -40
-KPX Racute Umacron -40
-KPX Racute Uogonek -40
-KPX Racute Uring -40
-KPX Racute V -18
-KPX Racute W -18
-KPX Racute Y -18
-KPX Racute Yacute -18
-KPX Racute Ydieresis -18
-KPX Rcaron O -40
-KPX Rcaron Oacute -40
-KPX Rcaron Ocircumflex -40
-KPX Rcaron Odieresis -40
-KPX Rcaron Ograve -40
-KPX Rcaron Ohungarumlaut -40
-KPX Rcaron Omacron -40
-KPX Rcaron Oslash -40
-KPX Rcaron Otilde -40
-KPX Rcaron U -40
-KPX Rcaron Uacute -40
-KPX Rcaron Ucircumflex -40
-KPX Rcaron Udieresis -40
-KPX Rcaron Ugrave -40
-KPX Rcaron Uhungarumlaut -40
-KPX Rcaron Umacron -40
-KPX Rcaron Uogonek -40
-KPX Rcaron Uring -40
-KPX Rcaron V -18
-KPX Rcaron W -18
-KPX Rcaron Y -18
-KPX Rcaron Yacute -18
-KPX Rcaron Ydieresis -18
-KPX Rcommaaccent O -40
-KPX Rcommaaccent Oacute -40
-KPX Rcommaaccent Ocircumflex -40
-KPX Rcommaaccent Odieresis -40
-KPX Rcommaaccent Ograve -40
-KPX Rcommaaccent Ohungarumlaut -40
-KPX Rcommaaccent Omacron -40
-KPX Rcommaaccent Oslash -40
-KPX Rcommaaccent Otilde -40
-KPX Rcommaaccent U -40
-KPX Rcommaaccent Uacute -40
-KPX Rcommaaccent Ucircumflex -40
-KPX Rcommaaccent Udieresis -40
-KPX Rcommaaccent Ugrave -40
-KPX Rcommaaccent Uhungarumlaut -40
-KPX Rcommaaccent Umacron -40
-KPX Rcommaaccent Uogonek -40
-KPX Rcommaaccent Uring -40
-KPX Rcommaaccent V -18
-KPX Rcommaaccent W -18
-KPX Rcommaaccent Y -18
-KPX Rcommaaccent Yacute -18
-KPX Rcommaaccent Ydieresis -18
-KPX T A -50
-KPX T Aacute -50
-KPX T Abreve -50
-KPX T Acircumflex -50
-KPX T Adieresis -50
-KPX T Agrave -50
-KPX T Amacron -50
-KPX T Aogonek -50
-KPX T Aring -50
-KPX T Atilde -50
-KPX T O -18
-KPX T Oacute -18
-KPX T Ocircumflex -18
-KPX T Odieresis -18
-KPX T Ograve -18
-KPX T Ohungarumlaut -18
-KPX T Omacron -18
-KPX T Oslash -18
-KPX T Otilde -18
-KPX T a -92
-KPX T aacute -92
-KPX T abreve -92
-KPX T acircumflex -92
-KPX T adieresis -92
-KPX T agrave -92
-KPX T amacron -92
-KPX T aogonek -92
-KPX T aring -92
-KPX T atilde -92
-KPX T colon -55
-KPX T comma -74
-KPX T e -92
-KPX T eacute -92
-KPX T ecaron -92
-KPX T ecircumflex -52
-KPX T edieresis -52
-KPX T edotaccent -92
-KPX T egrave -52
-KPX T emacron -52
-KPX T eogonek -92
-KPX T hyphen -74
-KPX T i -55
-KPX T iacute -55
-KPX T iogonek -55
-KPX T o -92
-KPX T oacute -92
-KPX T ocircumflex -92
-KPX T odieresis -92
-KPX T ograve -92
-KPX T ohungarumlaut -92
-KPX T omacron -92
-KPX T oslash -92
-KPX T otilde -92
-KPX T period -74
-KPX T r -55
-KPX T racute -55
-KPX T rcaron -55
-KPX T rcommaaccent -55
-KPX T semicolon -65
-KPX T u -55
-KPX T uacute -55
-KPX T ucircumflex -55
-KPX T udieresis -55
-KPX T ugrave -55
-KPX T uhungarumlaut -55
-KPX T umacron -55
-KPX T uogonek -55
-KPX T uring -55
-KPX T w -74
-KPX T y -74
-KPX T yacute -74
-KPX T ydieresis -34
-KPX Tcaron A -50
-KPX Tcaron Aacute -50
-KPX Tcaron Abreve -50
-KPX Tcaron Acircumflex -50
-KPX Tcaron Adieresis -50
-KPX Tcaron Agrave -50
-KPX Tcaron Amacron -50
-KPX Tcaron Aogonek -50
-KPX Tcaron Aring -50
-KPX Tcaron Atilde -50
-KPX Tcaron O -18
-KPX Tcaron Oacute -18
-KPX Tcaron Ocircumflex -18
-KPX Tcaron Odieresis -18
-KPX Tcaron Ograve -18
-KPX Tcaron Ohungarumlaut -18
-KPX Tcaron Omacron -18
-KPX Tcaron Oslash -18
-KPX Tcaron Otilde -18
-KPX Tcaron a -92
-KPX Tcaron aacute -92
-KPX Tcaron abreve -92
-KPX Tcaron acircumflex -92
-KPX Tcaron adieresis -92
-KPX Tcaron agrave -92
-KPX Tcaron amacron -92
-KPX Tcaron aogonek -92
-KPX Tcaron aring -92
-KPX Tcaron atilde -92
-KPX Tcaron colon -55
-KPX Tcaron comma -74
-KPX Tcaron e -92
-KPX Tcaron eacute -92
-KPX Tcaron ecaron -92
-KPX Tcaron ecircumflex -52
-KPX Tcaron edieresis -52
-KPX Tcaron edotaccent -92
-KPX Tcaron egrave -52
-KPX Tcaron emacron -52
-KPX Tcaron eogonek -92
-KPX Tcaron hyphen -74
-KPX Tcaron i -55
-KPX Tcaron iacute -55
-KPX Tcaron iogonek -55
-KPX Tcaron o -92
-KPX Tcaron oacute -92
-KPX Tcaron ocircumflex -92
-KPX Tcaron odieresis -92
-KPX Tcaron ograve -92
-KPX Tcaron ohungarumlaut -92
-KPX Tcaron omacron -92
-KPX Tcaron oslash -92
-KPX Tcaron otilde -92
-KPX Tcaron period -74
-KPX Tcaron r -55
-KPX Tcaron racute -55
-KPX Tcaron rcaron -55
-KPX Tcaron rcommaaccent -55
-KPX Tcaron semicolon -65
-KPX Tcaron u -55
-KPX Tcaron uacute -55
-KPX Tcaron ucircumflex -55
-KPX Tcaron udieresis -55
-KPX Tcaron ugrave -55
-KPX Tcaron uhungarumlaut -55
-KPX Tcaron umacron -55
-KPX Tcaron uogonek -55
-KPX Tcaron uring -55
-KPX Tcaron w -74
-KPX Tcaron y -74
-KPX Tcaron yacute -74
-KPX Tcaron ydieresis -34
-KPX Tcommaaccent A -50
-KPX Tcommaaccent Aacute -50
-KPX Tcommaaccent Abreve -50
-KPX Tcommaaccent Acircumflex -50
-KPX Tcommaaccent Adieresis -50
-KPX Tcommaaccent Agrave -50
-KPX Tcommaaccent Amacron -50
-KPX Tcommaaccent Aogonek -50
-KPX Tcommaaccent Aring -50
-KPX Tcommaaccent Atilde -50
-KPX Tcommaaccent O -18
-KPX Tcommaaccent Oacute -18
-KPX Tcommaaccent Ocircumflex -18
-KPX Tcommaaccent Odieresis -18
-KPX Tcommaaccent Ograve -18
-KPX Tcommaaccent Ohungarumlaut -18
-KPX Tcommaaccent Omacron -18
-KPX Tcommaaccent Oslash -18
-KPX Tcommaaccent Otilde -18
-KPX Tcommaaccent a -92
-KPX Tcommaaccent aacute -92
-KPX Tcommaaccent abreve -92
-KPX Tcommaaccent acircumflex -92
-KPX Tcommaaccent adieresis -92
-KPX Tcommaaccent agrave -92
-KPX Tcommaaccent amacron -92
-KPX Tcommaaccent aogonek -92
-KPX Tcommaaccent aring -92
-KPX Tcommaaccent atilde -92
-KPX Tcommaaccent colon -55
-KPX Tcommaaccent comma -74
-KPX Tcommaaccent e -92
-KPX Tcommaaccent eacute -92
-KPX Tcommaaccent ecaron -92
-KPX Tcommaaccent ecircumflex -52
-KPX Tcommaaccent edieresis -52
-KPX Tcommaaccent edotaccent -92
-KPX Tcommaaccent egrave -52
-KPX Tcommaaccent emacron -52
-KPX Tcommaaccent eogonek -92
-KPX Tcommaaccent hyphen -74
-KPX Tcommaaccent i -55
-KPX Tcommaaccent iacute -55
-KPX Tcommaaccent iogonek -55
-KPX Tcommaaccent o -92
-KPX Tcommaaccent oacute -92
-KPX Tcommaaccent ocircumflex -92
-KPX Tcommaaccent odieresis -92
-KPX Tcommaaccent ograve -92
-KPX Tcommaaccent ohungarumlaut -92
-KPX Tcommaaccent omacron -92
-KPX Tcommaaccent oslash -92
-KPX Tcommaaccent otilde -92
-KPX Tcommaaccent period -74
-KPX Tcommaaccent r -55
-KPX Tcommaaccent racute -55
-KPX Tcommaaccent rcaron -55
-KPX Tcommaaccent rcommaaccent -55
-KPX Tcommaaccent semicolon -65
-KPX Tcommaaccent u -55
-KPX Tcommaaccent uacute -55
-KPX Tcommaaccent ucircumflex -55
-KPX Tcommaaccent udieresis -55
-KPX Tcommaaccent ugrave -55
-KPX Tcommaaccent uhungarumlaut -55
-KPX Tcommaaccent umacron -55
-KPX Tcommaaccent uogonek -55
-KPX Tcommaaccent uring -55
-KPX Tcommaaccent w -74
-KPX Tcommaaccent y -74
-KPX Tcommaaccent yacute -74
-KPX Tcommaaccent ydieresis -34
-KPX U A -40
-KPX U Aacute -40
-KPX U Abreve -40
-KPX U Acircumflex -40
-KPX U Adieresis -40
-KPX U Agrave -40
-KPX U Amacron -40
-KPX U Aogonek -40
-KPX U Aring -40
-KPX U Atilde -40
-KPX U comma -25
-KPX U period -25
-KPX Uacute A -40
-KPX Uacute Aacute -40
-KPX Uacute Abreve -40
-KPX Uacute Acircumflex -40
-KPX Uacute Adieresis -40
-KPX Uacute Agrave -40
-KPX Uacute Amacron -40
-KPX Uacute Aogonek -40
-KPX Uacute Aring -40
-KPX Uacute Atilde -40
-KPX Uacute comma -25
-KPX Uacute period -25
-KPX Ucircumflex A -40
-KPX Ucircumflex Aacute -40
-KPX Ucircumflex Abreve -40
-KPX Ucircumflex Acircumflex -40
-KPX Ucircumflex Adieresis -40
-KPX Ucircumflex Agrave -40
-KPX Ucircumflex Amacron -40
-KPX Ucircumflex Aogonek -40
-KPX Ucircumflex Aring -40
-KPX Ucircumflex Atilde -40
-KPX Ucircumflex comma -25
-KPX Ucircumflex period -25
-KPX Udieresis A -40
-KPX Udieresis Aacute -40
-KPX Udieresis Abreve -40
-KPX Udieresis Acircumflex -40
-KPX Udieresis Adieresis -40
-KPX Udieresis Agrave -40
-KPX Udieresis Amacron -40
-KPX Udieresis Aogonek -40
-KPX Udieresis Aring -40
-KPX Udieresis Atilde -40
-KPX Udieresis comma -25
-KPX Udieresis period -25
-KPX Ugrave A -40
-KPX Ugrave Aacute -40
-KPX Ugrave Abreve -40
-KPX Ugrave Acircumflex -40
-KPX Ugrave Adieresis -40
-KPX Ugrave Agrave -40
-KPX Ugrave Amacron -40
-KPX Ugrave Aogonek -40
-KPX Ugrave Aring -40
-KPX Ugrave Atilde -40
-KPX Ugrave comma -25
-KPX Ugrave period -25
-KPX Uhungarumlaut A -40
-KPX Uhungarumlaut Aacute -40
-KPX Uhungarumlaut Abreve -40
-KPX Uhungarumlaut Acircumflex -40
-KPX Uhungarumlaut Adieresis -40
-KPX Uhungarumlaut Agrave -40
-KPX Uhungarumlaut Amacron -40
-KPX Uhungarumlaut Aogonek -40
-KPX Uhungarumlaut Aring -40
-KPX Uhungarumlaut Atilde -40
-KPX Uhungarumlaut comma -25
-KPX Uhungarumlaut period -25
-KPX Umacron A -40
-KPX Umacron Aacute -40
-KPX Umacron Abreve -40
-KPX Umacron Acircumflex -40
-KPX Umacron Adieresis -40
-KPX Umacron Agrave -40
-KPX Umacron Amacron -40
-KPX Umacron Aogonek -40
-KPX Umacron Aring -40
-KPX Umacron Atilde -40
-KPX Umacron comma -25
-KPX Umacron period -25
-KPX Uogonek A -40
-KPX Uogonek Aacute -40
-KPX Uogonek Abreve -40
-KPX Uogonek Acircumflex -40
-KPX Uogonek Adieresis -40
-KPX Uogonek Agrave -40
-KPX Uogonek Amacron -40
-KPX Uogonek Aogonek -40
-KPX Uogonek Aring -40
-KPX Uogonek Atilde -40
-KPX Uogonek comma -25
-KPX Uogonek period -25
-KPX Uring A -40
-KPX Uring Aacute -40
-KPX Uring Abreve -40
-KPX Uring Acircumflex -40
-KPX Uring Adieresis -40
-KPX Uring Agrave -40
-KPX Uring Amacron -40
-KPX Uring Aogonek -40
-KPX Uring Aring -40
-KPX Uring Atilde -40
-KPX Uring comma -25
-KPX Uring period -25
-KPX V A -60
-KPX V Aacute -60
-KPX V Abreve -60
-KPX V Acircumflex -60
-KPX V Adieresis -60
-KPX V Agrave -60
-KPX V Amacron -60
-KPX V Aogonek -60
-KPX V Aring -60
-KPX V Atilde -60
-KPX V O -30
-KPX V Oacute -30
-KPX V Ocircumflex -30
-KPX V Odieresis -30
-KPX V Ograve -30
-KPX V Ohungarumlaut -30
-KPX V Omacron -30
-KPX V Oslash -30
-KPX V Otilde -30
-KPX V a -111
-KPX V aacute -111
-KPX V abreve -111
-KPX V acircumflex -111
-KPX V adieresis -111
-KPX V agrave -111
-KPX V amacron -111
-KPX V aogonek -111
-KPX V aring -111
-KPX V atilde -111
-KPX V colon -65
-KPX V comma -129
-KPX V e -111
-KPX V eacute -111
-KPX V ecaron -111
-KPX V ecircumflex -111
-KPX V edieresis -71
-KPX V edotaccent -111
-KPX V egrave -71
-KPX V emacron -71
-KPX V eogonek -111
-KPX V hyphen -55
-KPX V i -74
-KPX V iacute -74
-KPX V icircumflex -34
-KPX V idieresis -34
-KPX V igrave -34
-KPX V imacron -34
-KPX V iogonek -74
-KPX V o -111
-KPX V oacute -111
-KPX V ocircumflex -111
-KPX V odieresis -111
-KPX V ograve -111
-KPX V ohungarumlaut -111
-KPX V omacron -111
-KPX V oslash -111
-KPX V otilde -111
-KPX V period -129
-KPX V semicolon -74
-KPX V u -74
-KPX V uacute -74
-KPX V ucircumflex -74
-KPX V udieresis -74
-KPX V ugrave -74
-KPX V uhungarumlaut -74
-KPX V umacron -74
-KPX V uogonek -74
-KPX V uring -74
-KPX W A -60
-KPX W Aacute -60
-KPX W Abreve -60
-KPX W Acircumflex -60
-KPX W Adieresis -60
-KPX W Agrave -60
-KPX W Amacron -60
-KPX W Aogonek -60
-KPX W Aring -60
-KPX W Atilde -60
-KPX W O -25
-KPX W Oacute -25
-KPX W Ocircumflex -25
-KPX W Odieresis -25
-KPX W Ograve -25
-KPX W Ohungarumlaut -25
-KPX W Omacron -25
-KPX W Oslash -25
-KPX W Otilde -25
-KPX W a -92
-KPX W aacute -92
-KPX W abreve -92
-KPX W acircumflex -92
-KPX W adieresis -92
-KPX W agrave -92
-KPX W amacron -92
-KPX W aogonek -92
-KPX W aring -92
-KPX W atilde -92
-KPX W colon -65
-KPX W comma -92
-KPX W e -92
-KPX W eacute -92
-KPX W ecaron -92
-KPX W ecircumflex -92
-KPX W edieresis -52
-KPX W edotaccent -92
-KPX W egrave -52
-KPX W emacron -52
-KPX W eogonek -92
-KPX W hyphen -37
-KPX W i -55
-KPX W iacute -55
-KPX W iogonek -55
-KPX W o -92
-KPX W oacute -92
-KPX W ocircumflex -92
-KPX W odieresis -92
-KPX W ograve -92
-KPX W ohungarumlaut -92
-KPX W omacron -92
-KPX W oslash -92
-KPX W otilde -92
-KPX W period -92
-KPX W semicolon -65
-KPX W u -55
-KPX W uacute -55
-KPX W ucircumflex -55
-KPX W udieresis -55
-KPX W ugrave -55
-KPX W uhungarumlaut -55
-KPX W umacron -55
-KPX W uogonek -55
-KPX W uring -55
-KPX W y -70
-KPX W yacute -70
-KPX W ydieresis -70
-KPX Y A -50
-KPX Y Aacute -50
-KPX Y Abreve -50
-KPX Y Acircumflex -50
-KPX Y Adieresis -50
-KPX Y Agrave -50
-KPX Y Amacron -50
-KPX Y Aogonek -50
-KPX Y Aring -50
-KPX Y Atilde -50
-KPX Y O -15
-KPX Y Oacute -15
-KPX Y Ocircumflex -15
-KPX Y Odieresis -15
-KPX Y Ograve -15
-KPX Y Ohungarumlaut -15
-KPX Y Omacron -15
-KPX Y Oslash -15
-KPX Y Otilde -15
-KPX Y a -92
-KPX Y aacute -92
-KPX Y abreve -92
-KPX Y acircumflex -92
-KPX Y adieresis -92
-KPX Y agrave -92
-KPX Y amacron -92
-KPX Y aogonek -92
-KPX Y aring -92
-KPX Y atilde -92
-KPX Y colon -65
-KPX Y comma -92
-KPX Y e -92
-KPX Y eacute -92
-KPX Y ecaron -92
-KPX Y ecircumflex -92
-KPX Y edieresis -52
-KPX Y edotaccent -92
-KPX Y egrave -52
-KPX Y emacron -52
-KPX Y eogonek -92
-KPX Y hyphen -74
-KPX Y i -74
-KPX Y iacute -74
-KPX Y icircumflex -34
-KPX Y idieresis -34
-KPX Y igrave -34
-KPX Y imacron -34
-KPX Y iogonek -74
-KPX Y o -92
-KPX Y oacute -92
-KPX Y ocircumflex -92
-KPX Y odieresis -92
-KPX Y ograve -92
-KPX Y ohungarumlaut -92
-KPX Y omacron -92
-KPX Y oslash -92
-KPX Y otilde -92
-KPX Y period -92
-KPX Y semicolon -65
-KPX Y u -92
-KPX Y uacute -92
-KPX Y ucircumflex -92
-KPX Y udieresis -92
-KPX Y ugrave -92
-KPX Y uhungarumlaut -92
-KPX Y umacron -92
-KPX Y uogonek -92
-KPX Y uring -92
-KPX Yacute A -50
-KPX Yacute Aacute -50
-KPX Yacute Abreve -50
-KPX Yacute Acircumflex -50
-KPX Yacute Adieresis -50
-KPX Yacute Agrave -50
-KPX Yacute Amacron -50
-KPX Yacute Aogonek -50
-KPX Yacute Aring -50
-KPX Yacute Atilde -50
-KPX Yacute O -15
-KPX Yacute Oacute -15
-KPX Yacute Ocircumflex -15
-KPX Yacute Odieresis -15
-KPX Yacute Ograve -15
-KPX Yacute Ohungarumlaut -15
-KPX Yacute Omacron -15
-KPX Yacute Oslash -15
-KPX Yacute Otilde -15
-KPX Yacute a -92
-KPX Yacute aacute -92
-KPX Yacute abreve -92
-KPX Yacute acircumflex -92
-KPX Yacute adieresis -92
-KPX Yacute agrave -92
-KPX Yacute amacron -92
-KPX Yacute aogonek -92
-KPX Yacute aring -92
-KPX Yacute atilde -92
-KPX Yacute colon -65
-KPX Yacute comma -92
-KPX Yacute e -92
-KPX Yacute eacute -92
-KPX Yacute ecaron -92
-KPX Yacute ecircumflex -92
-KPX Yacute edieresis -52
-KPX Yacute edotaccent -92
-KPX Yacute egrave -52
-KPX Yacute emacron -52
-KPX Yacute eogonek -92
-KPX Yacute hyphen -74
-KPX Yacute i -74
-KPX Yacute iacute -74
-KPX Yacute icircumflex -34
-KPX Yacute idieresis -34
-KPX Yacute igrave -34
-KPX Yacute imacron -34
-KPX Yacute iogonek -74
-KPX Yacute o -92
-KPX Yacute oacute -92
-KPX Yacute ocircumflex -92
-KPX Yacute odieresis -92
-KPX Yacute ograve -92
-KPX Yacute ohungarumlaut -92
-KPX Yacute omacron -92
-KPX Yacute oslash -92
-KPX Yacute otilde -92
-KPX Yacute period -92
-KPX Yacute semicolon -65
-KPX Yacute u -92
-KPX Yacute uacute -92
-KPX Yacute ucircumflex -92
-KPX Yacute udieresis -92
-KPX Yacute ugrave -92
-KPX Yacute uhungarumlaut -92
-KPX Yacute umacron -92
-KPX Yacute uogonek -92
-KPX Yacute uring -92
-KPX Ydieresis A -50
-KPX Ydieresis Aacute -50
-KPX Ydieresis Abreve -50
-KPX Ydieresis Acircumflex -50
-KPX Ydieresis Adieresis -50
-KPX Ydieresis Agrave -50
-KPX Ydieresis Amacron -50
-KPX Ydieresis Aogonek -50
-KPX Ydieresis Aring -50
-KPX Ydieresis Atilde -50
-KPX Ydieresis O -15
-KPX Ydieresis Oacute -15
-KPX Ydieresis Ocircumflex -15
-KPX Ydieresis Odieresis -15
-KPX Ydieresis Ograve -15
-KPX Ydieresis Ohungarumlaut -15
-KPX Ydieresis Omacron -15
-KPX Ydieresis Oslash -15
-KPX Ydieresis Otilde -15
-KPX Ydieresis a -92
-KPX Ydieresis aacute -92
-KPX Ydieresis abreve -92
-KPX Ydieresis acircumflex -92
-KPX Ydieresis adieresis -92
-KPX Ydieresis agrave -92
-KPX Ydieresis amacron -92
-KPX Ydieresis aogonek -92
-KPX Ydieresis aring -92
-KPX Ydieresis atilde -92
-KPX Ydieresis colon -65
-KPX Ydieresis comma -92
-KPX Ydieresis e -92
-KPX Ydieresis eacute -92
-KPX Ydieresis ecaron -92
-KPX Ydieresis ecircumflex -92
-KPX Ydieresis edieresis -52
-KPX Ydieresis edotaccent -92
-KPX Ydieresis egrave -52
-KPX Ydieresis emacron -52
-KPX Ydieresis eogonek -92
-KPX Ydieresis hyphen -74
-KPX Ydieresis i -74
-KPX Ydieresis iacute -74
-KPX Ydieresis icircumflex -34
-KPX Ydieresis idieresis -34
-KPX Ydieresis igrave -34
-KPX Ydieresis imacron -34
-KPX Ydieresis iogonek -74
-KPX Ydieresis o -92
-KPX Ydieresis oacute -92
-KPX Ydieresis ocircumflex -92
-KPX Ydieresis odieresis -92
-KPX Ydieresis ograve -92
-KPX Ydieresis ohungarumlaut -92
-KPX Ydieresis omacron -92
-KPX Ydieresis oslash -92
-KPX Ydieresis otilde -92
-KPX Ydieresis period -92
-KPX Ydieresis semicolon -65
-KPX Ydieresis u -92
-KPX Ydieresis uacute -92
-KPX Ydieresis ucircumflex -92
-KPX Ydieresis udieresis -92
-KPX Ydieresis ugrave -92
-KPX Ydieresis uhungarumlaut -92
-KPX Ydieresis umacron -92
-KPX Ydieresis uogonek -92
-KPX Ydieresis uring -92
-KPX a g -10
-KPX a gbreve -10
-KPX a gcommaaccent -10
-KPX aacute g -10
-KPX aacute gbreve -10
-KPX aacute gcommaaccent -10
-KPX abreve g -10
-KPX abreve gbreve -10
-KPX abreve gcommaaccent -10
-KPX acircumflex g -10
-KPX acircumflex gbreve -10
-KPX acircumflex gcommaaccent -10
-KPX adieresis g -10
-KPX adieresis gbreve -10
-KPX adieresis gcommaaccent -10
-KPX agrave g -10
-KPX agrave gbreve -10
-KPX agrave gcommaaccent -10
-KPX amacron g -10
-KPX amacron gbreve -10
-KPX amacron gcommaaccent -10
-KPX aogonek g -10
-KPX aogonek gbreve -10
-KPX aogonek gcommaaccent -10
-KPX aring g -10
-KPX aring gbreve -10
-KPX aring gcommaaccent -10
-KPX atilde g -10
-KPX atilde gbreve -10
-KPX atilde gcommaaccent -10
-KPX b period -40
-KPX b u -20
-KPX b uacute -20
-KPX b ucircumflex -20
-KPX b udieresis -20
-KPX b ugrave -20
-KPX b uhungarumlaut -20
-KPX b umacron -20
-KPX b uogonek -20
-KPX b uring -20
-KPX c h -15
-KPX c k -20
-KPX c kcommaaccent -20
-KPX cacute h -15
-KPX cacute k -20
-KPX cacute kcommaaccent -20
-KPX ccaron h -15
-KPX ccaron k -20
-KPX ccaron kcommaaccent -20
-KPX ccedilla h -15
-KPX ccedilla k -20
-KPX ccedilla kcommaaccent -20
-KPX comma quotedblright -140
-KPX comma quoteright -140
-KPX e comma -10
-KPX e g -40
-KPX e gbreve -40
-KPX e gcommaaccent -40
-KPX e period -15
-KPX e v -15
-KPX e w -15
-KPX e x -20
-KPX e y -30
-KPX e yacute -30
-KPX e ydieresis -30
-KPX eacute comma -10
-KPX eacute g -40
-KPX eacute gbreve -40
-KPX eacute gcommaaccent -40
-KPX eacute period -15
-KPX eacute v -15
-KPX eacute w -15
-KPX eacute x -20
-KPX eacute y -30
-KPX eacute yacute -30
-KPX eacute ydieresis -30
-KPX ecaron comma -10
-KPX ecaron g -40
-KPX ecaron gbreve -40
-KPX ecaron gcommaaccent -40
-KPX ecaron period -15
-KPX ecaron v -15
-KPX ecaron w -15
-KPX ecaron x -20
-KPX ecaron y -30
-KPX ecaron yacute -30
-KPX ecaron ydieresis -30
-KPX ecircumflex comma -10
-KPX ecircumflex g -40
-KPX ecircumflex gbreve -40
-KPX ecircumflex gcommaaccent -40
-KPX ecircumflex period -15
-KPX ecircumflex v -15
-KPX ecircumflex w -15
-KPX ecircumflex x -20
-KPX ecircumflex y -30
-KPX ecircumflex yacute -30
-KPX ecircumflex ydieresis -30
-KPX edieresis comma -10
-KPX edieresis g -40
-KPX edieresis gbreve -40
-KPX edieresis gcommaaccent -40
-KPX edieresis period -15
-KPX edieresis v -15
-KPX edieresis w -15
-KPX edieresis x -20
-KPX edieresis y -30
-KPX edieresis yacute -30
-KPX edieresis ydieresis -30
-KPX edotaccent comma -10
-KPX edotaccent g -40
-KPX edotaccent gbreve -40
-KPX edotaccent gcommaaccent -40
-KPX edotaccent period -15
-KPX edotaccent v -15
-KPX edotaccent w -15
-KPX edotaccent x -20
-KPX edotaccent y -30
-KPX edotaccent yacute -30
-KPX edotaccent ydieresis -30
-KPX egrave comma -10
-KPX egrave g -40
-KPX egrave gbreve -40
-KPX egrave gcommaaccent -40
-KPX egrave period -15
-KPX egrave v -15
-KPX egrave w -15
-KPX egrave x -20
-KPX egrave y -30
-KPX egrave yacute -30
-KPX egrave ydieresis -30
-KPX emacron comma -10
-KPX emacron g -40
-KPX emacron gbreve -40
-KPX emacron gcommaaccent -40
-KPX emacron period -15
-KPX emacron v -15
-KPX emacron w -15
-KPX emacron x -20
-KPX emacron y -30
-KPX emacron yacute -30
-KPX emacron ydieresis -30
-KPX eogonek comma -10
-KPX eogonek g -40
-KPX eogonek gbreve -40
-KPX eogonek gcommaaccent -40
-KPX eogonek period -15
-KPX eogonek v -15
-KPX eogonek w -15
-KPX eogonek x -20
-KPX eogonek y -30
-KPX eogonek yacute -30
-KPX eogonek ydieresis -30
-KPX f comma -10
-KPX f dotlessi -60
-KPX f f -18
-KPX f i -20
-KPX f iogonek -20
-KPX f period -15
-KPX f quoteright 92
-KPX g comma -10
-KPX g e -10
-KPX g eacute -10
-KPX g ecaron -10
-KPX g ecircumflex -10
-KPX g edieresis -10
-KPX g edotaccent -10
-KPX g egrave -10
-KPX g emacron -10
-KPX g eogonek -10
-KPX g g -10
-KPX g gbreve -10
-KPX g gcommaaccent -10
-KPX g period -15
-KPX gbreve comma -10
-KPX gbreve e -10
-KPX gbreve eacute -10
-KPX gbreve ecaron -10
-KPX gbreve ecircumflex -10
-KPX gbreve edieresis -10
-KPX gbreve edotaccent -10
-KPX gbreve egrave -10
-KPX gbreve emacron -10
-KPX gbreve eogonek -10
-KPX gbreve g -10
-KPX gbreve gbreve -10
-KPX gbreve gcommaaccent -10
-KPX gbreve period -15
-KPX gcommaaccent comma -10
-KPX gcommaaccent e -10
-KPX gcommaaccent eacute -10
-KPX gcommaaccent ecaron -10
-KPX gcommaaccent ecircumflex -10
-KPX gcommaaccent edieresis -10
-KPX gcommaaccent edotaccent -10
-KPX gcommaaccent egrave -10
-KPX gcommaaccent emacron -10
-KPX gcommaaccent eogonek -10
-KPX gcommaaccent g -10
-KPX gcommaaccent gbreve -10
-KPX gcommaaccent gcommaaccent -10
-KPX gcommaaccent period -15
-KPX k e -10
-KPX k eacute -10
-KPX k ecaron -10
-KPX k ecircumflex -10
-KPX k edieresis -10
-KPX k edotaccent -10
-KPX k egrave -10
-KPX k emacron -10
-KPX k eogonek -10
-KPX k o -10
-KPX k oacute -10
-KPX k ocircumflex -10
-KPX k odieresis -10
-KPX k ograve -10
-KPX k ohungarumlaut -10
-KPX k omacron -10
-KPX k oslash -10
-KPX k otilde -10
-KPX k y -10
-KPX k yacute -10
-KPX k ydieresis -10
-KPX kcommaaccent e -10
-KPX kcommaaccent eacute -10
-KPX kcommaaccent ecaron -10
-KPX kcommaaccent ecircumflex -10
-KPX kcommaaccent edieresis -10
-KPX kcommaaccent edotaccent -10
-KPX kcommaaccent egrave -10
-KPX kcommaaccent emacron -10
-KPX kcommaaccent eogonek -10
-KPX kcommaaccent o -10
-KPX kcommaaccent oacute -10
-KPX kcommaaccent ocircumflex -10
-KPX kcommaaccent odieresis -10
-KPX kcommaaccent ograve -10
-KPX kcommaaccent ohungarumlaut -10
-KPX kcommaaccent omacron -10
-KPX kcommaaccent oslash -10
-KPX kcommaaccent otilde -10
-KPX kcommaaccent y -10
-KPX kcommaaccent yacute -10
-KPX kcommaaccent ydieresis -10
-KPX n v -40
-KPX nacute v -40
-KPX ncaron v -40
-KPX ncommaaccent v -40
-KPX ntilde v -40
-KPX o g -10
-KPX o gbreve -10
-KPX o gcommaaccent -10
-KPX o v -10
-KPX oacute g -10
-KPX oacute gbreve -10
-KPX oacute gcommaaccent -10
-KPX oacute v -10
-KPX ocircumflex g -10
-KPX ocircumflex gbreve -10
-KPX ocircumflex gcommaaccent -10
-KPX ocircumflex v -10
-KPX odieresis g -10
-KPX odieresis gbreve -10
-KPX odieresis gcommaaccent -10
-KPX odieresis v -10
-KPX ograve g -10
-KPX ograve gbreve -10
-KPX ograve gcommaaccent -10
-KPX ograve v -10
-KPX ohungarumlaut g -10
-KPX ohungarumlaut gbreve -10
-KPX ohungarumlaut gcommaaccent -10
-KPX ohungarumlaut v -10
-KPX omacron g -10
-KPX omacron gbreve -10
-KPX omacron gcommaaccent -10
-KPX omacron v -10
-KPX oslash g -10
-KPX oslash gbreve -10
-KPX oslash gcommaaccent -10
-KPX oslash v -10
-KPX otilde g -10
-KPX otilde gbreve -10
-KPX otilde gcommaaccent -10
-KPX otilde v -10
-KPX period quotedblright -140
-KPX period quoteright -140
-KPX quoteleft quoteleft -111
-KPX quoteright d -25
-KPX quoteright dcroat -25
-KPX quoteright quoteright -111
-KPX quoteright r -25
-KPX quoteright racute -25
-KPX quoteright rcaron -25
-KPX quoteright rcommaaccent -25
-KPX quoteright s -40
-KPX quoteright sacute -40
-KPX quoteright scaron -40
-KPX quoteright scedilla -40
-KPX quoteright scommaaccent -40
-KPX quoteright space -111
-KPX quoteright t -30
-KPX quoteright tcommaaccent -30
-KPX quoteright v -10
-KPX r a -15
-KPX r aacute -15
-KPX r abreve -15
-KPX r acircumflex -15
-KPX r adieresis -15
-KPX r agrave -15
-KPX r amacron -15
-KPX r aogonek -15
-KPX r aring -15
-KPX r atilde -15
-KPX r c -37
-KPX r cacute -37
-KPX r ccaron -37
-KPX r ccedilla -37
-KPX r comma -111
-KPX r d -37
-KPX r dcroat -37
-KPX r e -37
-KPX r eacute -37
-KPX r ecaron -37
-KPX r ecircumflex -37
-KPX r edieresis -37
-KPX r edotaccent -37
-KPX r egrave -37
-KPX r emacron -37
-KPX r eogonek -37
-KPX r g -37
-KPX r gbreve -37
-KPX r gcommaaccent -37
-KPX r hyphen -20
-KPX r o -45
-KPX r oacute -45
-KPX r ocircumflex -45
-KPX r odieresis -45
-KPX r ograve -45
-KPX r ohungarumlaut -45
-KPX r omacron -45
-KPX r oslash -45
-KPX r otilde -45
-KPX r period -111
-KPX r q -37
-KPX r s -10
-KPX r sacute -10
-KPX r scaron -10
-KPX r scedilla -10
-KPX r scommaaccent -10
-KPX racute a -15
-KPX racute aacute -15
-KPX racute abreve -15
-KPX racute acircumflex -15
-KPX racute adieresis -15
-KPX racute agrave -15
-KPX racute amacron -15
-KPX racute aogonek -15
-KPX racute aring -15
-KPX racute atilde -15
-KPX racute c -37
-KPX racute cacute -37
-KPX racute ccaron -37
-KPX racute ccedilla -37
-KPX racute comma -111
-KPX racute d -37
-KPX racute dcroat -37
-KPX racute e -37
-KPX racute eacute -37
-KPX racute ecaron -37
-KPX racute ecircumflex -37
-KPX racute edieresis -37
-KPX racute edotaccent -37
-KPX racute egrave -37
-KPX racute emacron -37
-KPX racute eogonek -37
-KPX racute g -37
-KPX racute gbreve -37
-KPX racute gcommaaccent -37
-KPX racute hyphen -20
-KPX racute o -45
-KPX racute oacute -45
-KPX racute ocircumflex -45
-KPX racute odieresis -45
-KPX racute ograve -45
-KPX racute ohungarumlaut -45
-KPX racute omacron -45
-KPX racute oslash -45
-KPX racute otilde -45
-KPX racute period -111
-KPX racute q -37
-KPX racute s -10
-KPX racute sacute -10
-KPX racute scaron -10
-KPX racute scedilla -10
-KPX racute scommaaccent -10
-KPX rcaron a -15
-KPX rcaron aacute -15
-KPX rcaron abreve -15
-KPX rcaron acircumflex -15
-KPX rcaron adieresis -15
-KPX rcaron agrave -15
-KPX rcaron amacron -15
-KPX rcaron aogonek -15
-KPX rcaron aring -15
-KPX rcaron atilde -15
-KPX rcaron c -37
-KPX rcaron cacute -37
-KPX rcaron ccaron -37
-KPX rcaron ccedilla -37
-KPX rcaron comma -111
-KPX rcaron d -37
-KPX rcaron dcroat -37
-KPX rcaron e -37
-KPX rcaron eacute -37
-KPX rcaron ecaron -37
-KPX rcaron ecircumflex -37
-KPX rcaron edieresis -37
-KPX rcaron edotaccent -37
-KPX rcaron egrave -37
-KPX rcaron emacron -37
-KPX rcaron eogonek -37
-KPX rcaron g -37
-KPX rcaron gbreve -37
-KPX rcaron gcommaaccent -37
-KPX rcaron hyphen -20
-KPX rcaron o -45
-KPX rcaron oacute -45
-KPX rcaron ocircumflex -45
-KPX rcaron odieresis -45
-KPX rcaron ograve -45
-KPX rcaron ohungarumlaut -45
-KPX rcaron omacron -45
-KPX rcaron oslash -45
-KPX rcaron otilde -45
-KPX rcaron period -111
-KPX rcaron q -37
-KPX rcaron s -10
-KPX rcaron sacute -10
-KPX rcaron scaron -10
-KPX rcaron scedilla -10
-KPX rcaron scommaaccent -10
-KPX rcommaaccent a -15
-KPX rcommaaccent aacute -15
-KPX rcommaaccent abreve -15
-KPX rcommaaccent acircumflex -15
-KPX rcommaaccent adieresis -15
-KPX rcommaaccent agrave -15
-KPX rcommaaccent amacron -15
-KPX rcommaaccent aogonek -15
-KPX rcommaaccent aring -15
-KPX rcommaaccent atilde -15
-KPX rcommaaccent c -37
-KPX rcommaaccent cacute -37
-KPX rcommaaccent ccaron -37
-KPX rcommaaccent ccedilla -37
-KPX rcommaaccent comma -111
-KPX rcommaaccent d -37
-KPX rcommaaccent dcroat -37
-KPX rcommaaccent e -37
-KPX rcommaaccent eacute -37
-KPX rcommaaccent ecaron -37
-KPX rcommaaccent ecircumflex -37
-KPX rcommaaccent edieresis -37
-KPX rcommaaccent edotaccent -37
-KPX rcommaaccent egrave -37
-KPX rcommaaccent emacron -37
-KPX rcommaaccent eogonek -37
-KPX rcommaaccent g -37
-KPX rcommaaccent gbreve -37
-KPX rcommaaccent gcommaaccent -37
-KPX rcommaaccent hyphen -20
-KPX rcommaaccent o -45
-KPX rcommaaccent oacute -45
-KPX rcommaaccent ocircumflex -45
-KPX rcommaaccent odieresis -45
-KPX rcommaaccent ograve -45
-KPX rcommaaccent ohungarumlaut -45
-KPX rcommaaccent omacron -45
-KPX rcommaaccent oslash -45
-KPX rcommaaccent otilde -45
-KPX rcommaaccent period -111
-KPX rcommaaccent q -37
-KPX rcommaaccent s -10
-KPX rcommaaccent sacute -10
-KPX rcommaaccent scaron -10
-KPX rcommaaccent scedilla -10
-KPX rcommaaccent scommaaccent -10
-KPX space A -18
-KPX space Aacute -18
-KPX space Abreve -18
-KPX space Acircumflex -18
-KPX space Adieresis -18
-KPX space Agrave -18
-KPX space Amacron -18
-KPX space Aogonek -18
-KPX space Aring -18
-KPX space Atilde -18
-KPX space T -18
-KPX space Tcaron -18
-KPX space Tcommaaccent -18
-KPX space V -35
-KPX space W -40
-KPX space Y -75
-KPX space Yacute -75
-KPX space Ydieresis -75
-KPX v comma -74
-KPX v period -74
-KPX w comma -74
-KPX w period -74
-KPX y comma -55
-KPX y period -55
-KPX yacute comma -55
-KPX yacute period -55
-KPX ydieresis comma -55
-KPX ydieresis period -55
-EndKernPairs
-EndKernData
-EndFontMetrics
-
diff --git a/LibrarySource/com/lowagie/text/pdf/fonts/Times-Roman.afm b/LibrarySource/com/lowagie/text/pdf/fonts/Times-Roman.afm
deleted file mode 100644
index 3e17e5e..0000000
--- a/LibrarySource/com/lowagie/text/pdf/fonts/Times-Roman.afm
+++ /dev/null
@@ -1,2420 +0,0 @@
-StartFontMetrics 4.1
-Comment Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.
-Comment Creation Date: Thu May 1 12:49:17 1997
-Comment UniqueID 43068
-Comment VMusage 43909 54934
-FontName Times-Roman
-FullName Times Roman
-FamilyName Times
-Weight Roman
-ItalicAngle 0
-IsFixedPitch false
-CharacterSet ExtendedRoman
-FontBBox -168 -218 1000 898
-UnderlinePosition -100
-UnderlineThickness 50
-Version 002.000
-Notice Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved.Times is a trademark of Linotype-Hell AG and/or its subsidiaries.
-EncodingScheme AdobeStandardEncoding
-CapHeight 662
-XHeight 450
-Ascender 683
-Descender -217
-StdHW 28
-StdVW 84
-StartCharMetrics 315
-C 32 ; WX 250 ; N space ; B 0 0 0 0 ;
-C 33 ; WX 333 ; N exclam ; B 130 -9 238 676 ;
-C 34 ; WX 408 ; N quotedbl ; B 77 431 331 676 ;
-C 35 ; WX 500 ; N numbersign ; B 5 0 496 662 ;
-C 36 ; WX 500 ; N dollar ; B 44 -87 457 727 ;
-C 37 ; WX 833 ; N percent ; B 61 -13 772 676 ;
-C 38 ; WX 778 ; N ampersand ; B 42 -13 750 676 ;
-C 39 ; WX 333 ; N quoteright ; B 79 433 218 676 ;
-C 40 ; WX 333 ; N parenleft ; B 48 -177 304 676 ;
-C 41 ; WX 333 ; N parenright ; B 29 -177 285 676 ;
-C 42 ; WX 500 ; N asterisk ; B 69 265 432 676 ;
-C 43 ; WX 564 ; N plus ; B 30 0 534 506 ;
-C 44 ; WX 250 ; N comma ; B 56 -141 195 102 ;
-C 45 ; WX 333 ; N hyphen ; B 39 194 285 257 ;
-C 46 ; WX 250 ; N period ; B 70 -11 181 100 ;
-C 47 ; WX 278 ; N slash ; B -9 -14 287 676 ;
-C 48 ; WX 500 ; N zero ; B 24 -14 476 676 ;
-C 49 ; WX 500 ; N one ; B 111 0 394 676 ;
-C 50 ; WX 500 ; N two ; B 30 0 475 676 ;
-C 51 ; WX 500 ; N three ; B 43 -14 431 676 ;
-C 52 ; WX 500 ; N four ; B 12 0 472 676 ;
-C 53 ; WX 500 ; N five ; B 32 -14 438 688 ;
-C 54 ; WX 500 ; N six ; B 34 -14 468 684 ;
-C 55 ; WX 500 ; N seven ; B 20 -8 449 662 ;
-C 56 ; WX 500 ; N eight ; B 56 -14 445 676 ;
-C 57 ; WX 500 ; N nine ; B 30 -22 459 676 ;
-C 58 ; WX 278 ; N colon ; B 81 -11 192 459 ;
-C 59 ; WX 278 ; N semicolon ; B 80 -141 219 459 ;
-C 60 ; WX 564 ; N less ; B 28 -8 536 514 ;
-C 61 ; WX 564 ; N equal ; B 30 120 534 386 ;
-C 62 ; WX 564 ; N greater ; B 28 -8 536 514 ;
-C 63 ; WX 444 ; N question ; B 68 -8 414 676 ;
-C 64 ; WX 921 ; N at ; B 116 -14 809 676 ;
-C 65 ; WX 722 ; N A ; B 15 0 706 674 ;
-C 66 ; WX 667 ; N B ; B 17 0 593 662 ;
-C 67 ; WX 667 ; N C ; B 28 -14 633 676 ;
-C 68 ; WX 722 ; N D ; B 16 0 685 662 ;
-C 69 ; WX 611 ; N E ; B 12 0 597 662 ;
-C 70 ; WX 556 ; N F ; B 12 0 546 662 ;
-C 71 ; WX 722 ; N G ; B 32 -14 709 676 ;
-C 72 ; WX 722 ; N H ; B 19 0 702 662 ;
-C 73 ; WX 333 ; N I ; B 18 0 315 662 ;
-C 74 ; WX 389 ; N J ; B 10 -14 370 662 ;
-C 75 ; WX 722 ; N K ; B 34 0 723 662 ;
-C 76 ; WX 611 ; N L ; B 12 0 598 662 ;
-C 77 ; WX 889 ; N M ; B 12 0 863 662 ;
-C 78 ; WX 722 ; N N ; B 12 -11 707 662 ;
-C 79 ; WX 722 ; N O ; B 34 -14 688 676 ;
-C 80 ; WX 556 ; N P ; B 16 0 542 662 ;
-C 81 ; WX 722 ; N Q ; B 34 -178 701 676 ;
-C 82 ; WX 667 ; N R ; B 17 0 659 662 ;
-C 83 ; WX 556 ; N S ; B 42 -14 491 676 ;
-C 84 ; WX 611 ; N T ; B 17 0 593 662 ;
-C 85 ; WX 722 ; N U ; B 14 -14 705 662 ;
-C 86 ; WX 722 ; N V ; B 16 -11 697 662 ;
-C 87 ; WX 944 ; N W ; B 5 -11 932 662 ;
-C 88 ; WX 722 ; N X ; B 10 0 704 662 ;
-C 89 ; WX 722 ; N Y ; B 22 0 703 662 ;
-C 90 ; WX 611 ; N Z ; B 9 0 597 662 ;
-C 91 ; WX 333 ; N bracketleft ; B 88 -156 299 662 ;
-C 92 ; WX 278 ; N backslash ; B -9 -14 287 676 ;
-C 93 ; WX 333 ; N bracketright ; B 34 -156 245 662 ;
-C 94 ; WX 469 ; N asciicircum ; B 24 297 446 662 ;
-C 95 ; WX 500 ; N underscore ; B 0 -125 500 -75 ;
-C 96 ; WX 333 ; N quoteleft ; B 115 433 254 676 ;
-C 97 ; WX 444 ; N a ; B 37 -10 442 460 ;
-C 98 ; WX 500 ; N b ; B 3 -10 468 683 ;
-C 99 ; WX 444 ; N c ; B 25 -10 412 460 ;
-C 100 ; WX 500 ; N d ; B 27 -10 491 683 ;
-C 101 ; WX 444 ; N e ; B 25 -10 424 460 ;
-C 102 ; WX 333 ; N f ; B 20 0 383 683 ; L i fi ; L l fl ;
-C 103 ; WX 500 ; N g ; B 28 -218 470 460 ;
-C 104 ; WX 500 ; N h ; B 9 0 487 683 ;
-C 105 ; WX 278 ; N i ; B 16 0 253 683 ;
-C 106 ; WX 278 ; N j ; B -70 -218 194 683 ;
-C 107 ; WX 500 ; N k ; B 7 0 505 683 ;
-C 108 ; WX 278 ; N l ; B 19 0 257 683 ;
-C 109 ; WX 778 ; N m ; B 16 0 775 460 ;
-C 110 ; WX 500 ; N n ; B 16 0 485 460 ;
-C 111 ; WX 500 ; N o ; B 29 -10 470 460 ;
-C 112 ; WX 500 ; N p ; B 5 -217 470 460 ;
-C 113 ; WX 500 ; N q ; B 24 -217 488 460 ;
-C 114 ; WX 333 ; N r ; B 5 0 335 460 ;
-C 115 ; WX 389 ; N s ; B 51 -10 348 460 ;
-C 116 ; WX 278 ; N t ; B 13 -10 279 579 ;
-C 117 ; WX 500 ; N u ; B 9 -10 479 450 ;
-C 118 ; WX 500 ; N v ; B 19 -14 477 450 ;
-C 119 ; WX 722 ; N w ; B 21 -14 694 450 ;
-C 120 ; WX 500 ; N x ; B 17 0 479 450 ;
-C 121 ; WX 500 ; N y ; B 14 -218 475 450 ;
-C 122 ; WX 444 ; N z ; B 27 0 418 450 ;
-C 123 ; WX 480 ; N braceleft ; B 100 -181 350 680 ;
-C 124 ; WX 200 ; N bar ; B 67 -218 133 782 ;
-C 125 ; WX 480 ; N braceright ; B 130 -181 380 680 ;
-C 126 ; WX 541 ; N asciitilde ; B 40 183 502 323 ;
-C 161 ; WX 333 ; N exclamdown ; B 97 -218 205 467 ;
-C 162 ; WX 500 ; N cent ; B 53 -138 448 579 ;
-C 163 ; WX 500 ; N sterling ; B 12 -8 490 676 ;
-C 164 ; WX 167 ; N fraction ; B -168 -14 331 676 ;
-C 165 ; WX 500 ; N yen ; B -53 0 512 662 ;
-C 166 ; WX 500 ; N florin ; B 7 -189 490 676 ;
-C 167 ; WX 500 ; N section ; B 70 -148 426 676 ;
-C 168 ; WX 500 ; N currency ; B -22 58 522 602 ;
-C 169 ; WX 180 ; N quotesingle ; B 48 431 133 676 ;
-C 170 ; WX 444 ; N quotedblleft ; B 43 433 414 676 ;
-C 171 ; WX 500 ; N guillemotleft ; B 42 33 456 416 ;
-C 172 ; WX 333 ; N guilsinglleft ; B 63 33 285 416 ;
-C 173 ; WX 333 ; N guilsinglright ; B 48 33 270 416 ;
-C 174 ; WX 556 ; N fi ; B 31 0 521 683 ;
-C 175 ; WX 556 ; N fl ; B 32 0 521 683 ;
-C 177 ; WX 500 ; N endash ; B 0 201 500 250 ;
-C 178 ; WX 500 ; N dagger ; B 59 -149 442 676 ;
-C 179 ; WX 500 ; N daggerdbl ; B 58 -153 442 676 ;
-C 180 ; WX 250 ; N periodcentered ; B 70 199 181 310 ;
-C 182 ; WX 453 ; N paragraph ; B -22 -154 450 662 ;
-C 183 ; WX 350 ; N bullet ; B 40 196 310 466 ;
-C 184 ; WX 333 ; N quotesinglbase ; B 79 -141 218 102 ;
-C 185 ; WX 444 ; N quotedblbase ; B 45 -141 416 102 ;
-C 186 ; WX 444 ; N quotedblright ; B 30 433 401 676 ;
-C 187 ; WX 500 ; N guillemotright ; B 44 33 458 416 ;
-C 188 ; WX 1000 ; N ellipsis ; B 111 -11 888 100 ;
-C 189 ; WX 1000 ; N perthousand ; B 7 -19 994 706 ;
-C 191 ; WX 444 ; N questiondown ; B 30 -218 376 466 ;
-C 193 ; WX 333 ; N grave ; B 19 507 242 678 ;
-C 194 ; WX 333 ; N acute ; B 93 507 317 678 ;
-C 195 ; WX 333 ; N circumflex ; B 11 507 322 674 ;
-C 196 ; WX 333 ; N tilde ; B 1 532 331 638 ;
-C 197 ; WX 333 ; N macron ; B 11 547 322 601 ;
-C 198 ; WX 333 ; N breve ; B 26 507 307 664 ;
-C 199 ; WX 333 ; N dotaccent ; B 118 581 216 681 ;
-C 200 ; WX 333 ; N dieresis ; B 18 581 315 681 ;
-C 202 ; WX 333 ; N ring ; B 67 512 266 711 ;
-C 203 ; WX 333 ; N cedilla ; B 52 -215 261 0 ;
-C 205 ; WX 333 ; N hungarumlaut ; B -3 507 377 678 ;
-C 206 ; WX 333 ; N ogonek ; B 62 -165 243 0 ;
-C 207 ; WX 333 ; N caron ; B 11 507 322 674 ;
-C 208 ; WX 1000 ; N emdash ; B 0 201 1000 250 ;
-C 225 ; WX 889 ; N AE ; B 0 0 863 662 ;
-C 227 ; WX 276 ; N ordfeminine ; B 4 394 270 676 ;
-C 232 ; WX 611 ; N Lslash ; B 12 0 598 662 ;
-C 233 ; WX 722 ; N Oslash ; B 34 -80 688 734 ;
-C 234 ; WX 889 ; N OE ; B 30 -6 885 668 ;
-C 235 ; WX 310 ; N ordmasculine ; B 6 394 304 676 ;
-C 241 ; WX 667 ; N ae ; B 38 -10 632 460 ;
-C 245 ; WX 278 ; N dotlessi ; B 16 0 253 460 ;
-C 248 ; WX 278 ; N lslash ; B 19 0 259 683 ;
-C 249 ; WX 500 ; N oslash ; B 29 -112 470 551 ;
-C 250 ; WX 722 ; N oe ; B 30 -10 690 460 ;
-C 251 ; WX 500 ; N germandbls ; B 12 -9 468 683 ;
-C -1 ; WX 333 ; N Idieresis ; B 18 0 315 835 ;
-C -1 ; WX 444 ; N eacute ; B 25 -10 424 678 ;
-C -1 ; WX 444 ; N abreve ; B 37 -10 442 664 ;
-C -1 ; WX 500 ; N uhungarumlaut ; B 9 -10 501 678 ;
-C -1 ; WX 444 ; N ecaron ; B 25 -10 424 674 ;
-C -1 ; WX 722 ; N Ydieresis ; B 22 0 703 835 ;
-C -1 ; WX 564 ; N divide ; B 30 -10 534 516 ;
-C -1 ; WX 722 ; N Yacute ; B 22 0 703 890 ;
-C -1 ; WX 722 ; N Acircumflex ; B 15 0 706 886 ;
-C -1 ; WX 444 ; N aacute ; B 37 -10 442 678 ;
-C -1 ; WX 722 ; N Ucircumflex ; B 14 -14 705 886 ;
-C -1 ; WX 500 ; N yacute ; B 14 -218 475 678 ;
-C -1 ; WX 389 ; N scommaaccent ; B 51 -218 348 460 ;
-C -1 ; WX 444 ; N ecircumflex ; B 25 -10 424 674 ;
-C -1 ; WX 722 ; N Uring ; B 14 -14 705 898 ;
-C -1 ; WX 722 ; N Udieresis ; B 14 -14 705 835 ;
-C -1 ; WX 444 ; N aogonek ; B 37 -165 469 460 ;
-C -1 ; WX 722 ; N Uacute ; B 14 -14 705 890 ;
-C -1 ; WX 500 ; N uogonek ; B 9 -155 487 450 ;
-C -1 ; WX 611 ; N Edieresis ; B 12 0 597 835 ;
-C -1 ; WX 722 ; N Dcroat ; B 16 0 685 662 ;
-C -1 ; WX 250 ; N commaaccent ; B 59 -218 184 -50 ;
-C -1 ; WX 760 ; N copyright ; B 38 -14 722 676 ;
-C -1 ; WX 611 ; N Emacron ; B 12 0 597 813 ;
-C -1 ; WX 444 ; N ccaron ; B 25 -10 412 674 ;
-C -1 ; WX 444 ; N aring ; B 37 -10 442 711 ;
-C -1 ; WX 722 ; N Ncommaaccent ; B 12 -198 707 662 ;
-C -1 ; WX 278 ; N lacute ; B 19 0 290 890 ;
-C -1 ; WX 444 ; N agrave ; B 37 -10 442 678 ;
-C -1 ; WX 611 ; N Tcommaaccent ; B 17 -218 593 662 ;
-C -1 ; WX 667 ; N Cacute ; B 28 -14 633 890 ;
-C -1 ; WX 444 ; N atilde ; B 37 -10 442 638 ;
-C -1 ; WX 611 ; N Edotaccent ; B 12 0 597 835 ;
-C -1 ; WX 389 ; N scaron ; B 39 -10 350 674 ;
-C -1 ; WX 389 ; N scedilla ; B 51 -215 348 460 ;
-C -1 ; WX 278 ; N iacute ; B 16 0 290 678 ;
-C -1 ; WX 471 ; N lozenge ; B 13 0 459 724 ;
-C -1 ; WX 667 ; N Rcaron ; B 17 0 659 886 ;
-C -1 ; WX 722 ; N Gcommaaccent ; B 32 -218 709 676 ;
-C -1 ; WX 500 ; N ucircumflex ; B 9 -10 479 674 ;
-C -1 ; WX 444 ; N acircumflex ; B 37 -10 442 674 ;
-C -1 ; WX 722 ; N Amacron ; B 15 0 706 813 ;
-C -1 ; WX 333 ; N rcaron ; B 5 0 335 674 ;
-C -1 ; WX 444 ; N ccedilla ; B 25 -215 412 460 ;
-C -1 ; WX 611 ; N Zdotaccent ; B 9 0 597 835 ;
-C -1 ; WX 556 ; N Thorn ; B 16 0 542 662 ;
-C -1 ; WX 722 ; N Omacron ; B 34 -14 688 813 ;
-C -1 ; WX 667 ; N Racute ; B 17 0 659 890 ;
-C -1 ; WX 556 ; N Sacute ; B 42 -14 491 890 ;
-C -1 ; WX 588 ; N dcaron ; B 27 -10 589 695 ;
-C -1 ; WX 722 ; N Umacron ; B 14 -14 705 813 ;
-C -1 ; WX 500 ; N uring ; B 9 -10 479 711 ;
-C -1 ; WX 300 ; N threesuperior ; B 15 262 291 676 ;
-C -1 ; WX 722 ; N Ograve ; B 34 -14 688 890 ;
-C -1 ; WX 722 ; N Agrave ; B 15 0 706 890 ;
-C -1 ; WX 722 ; N Abreve ; B 15 0 706 876 ;
-C -1 ; WX 564 ; N multiply ; B 38 8 527 497 ;
-C -1 ; WX 500 ; N uacute ; B 9 -10 479 678 ;
-C -1 ; WX 611 ; N Tcaron ; B 17 0 593 886 ;
-C -1 ; WX 476 ; N partialdiff ; B 17 -38 459 710 ;
-C -1 ; WX 500 ; N ydieresis ; B 14 -218 475 623 ;
-C -1 ; WX 722 ; N Nacute ; B 12 -11 707 890 ;
-C -1 ; WX 278 ; N icircumflex ; B -16 0 295 674 ;
-C -1 ; WX 611 ; N Ecircumflex ; B 12 0 597 886 ;
-C -1 ; WX 444 ; N adieresis ; B 37 -10 442 623 ;
-C -1 ; WX 444 ; N edieresis ; B 25 -10 424 623 ;
-C -1 ; WX 444 ; N cacute ; B 25 -10 413 678 ;
-C -1 ; WX 500 ; N nacute ; B 16 0 485 678 ;
-C -1 ; WX 500 ; N umacron ; B 9 -10 479 601 ;
-C -1 ; WX 722 ; N Ncaron ; B 12 -11 707 886 ;
-C -1 ; WX 333 ; N Iacute ; B 18 0 317 890 ;
-C -1 ; WX 564 ; N plusminus ; B 30 0 534 506 ;
-C -1 ; WX 200 ; N brokenbar ; B 67 -143 133 707 ;
-C -1 ; WX 760 ; N registered ; B 38 -14 722 676 ;
-C -1 ; WX 722 ; N Gbreve ; B 32 -14 709 876 ;
-C -1 ; WX 333 ; N Idotaccent ; B 18 0 315 835 ;
-C -1 ; WX 600 ; N summation ; B 15 -10 585 706 ;
-C -1 ; WX 611 ; N Egrave ; B 12 0 597 890 ;
-C -1 ; WX 333 ; N racute ; B 5 0 335 678 ;
-C -1 ; WX 500 ; N omacron ; B 29 -10 470 601 ;
-C -1 ; WX 611 ; N Zacute ; B 9 0 597 890 ;
-C -1 ; WX 611 ; N Zcaron ; B 9 0 597 886 ;
-C -1 ; WX 549 ; N greaterequal ; B 26 0 523 666 ;
-C -1 ; WX 722 ; N Eth ; B 16 0 685 662 ;
-C -1 ; WX 667 ; N Ccedilla ; B 28 -215 633 676 ;
-C -1 ; WX 278 ; N lcommaaccent ; B 19 -218 257 683 ;
-C -1 ; WX 326 ; N tcaron ; B 13 -10 318 722 ;
-C -1 ; WX 444 ; N eogonek ; B 25 -165 424 460 ;
-C -1 ; WX 722 ; N Uogonek ; B 14 -165 705 662 ;
-C -1 ; WX 722 ; N Aacute ; B 15 0 706 890 ;
-C -1 ; WX 722 ; N Adieresis ; B 15 0 706 835 ;
-C -1 ; WX 444 ; N egrave ; B 25 -10 424 678 ;
-C -1 ; WX 444 ; N zacute ; B 27 0 418 678 ;
-C -1 ; WX 278 ; N iogonek ; B 16 -165 265 683 ;
-C -1 ; WX 722 ; N Oacute ; B 34 -14 688 890 ;
-C -1 ; WX 500 ; N oacute ; B 29 -10 470 678 ;
-C -1 ; WX 444 ; N amacron ; B 37 -10 442 601 ;
-C -1 ; WX 389 ; N sacute ; B 51 -10 348 678 ;
-C -1 ; WX 278 ; N idieresis ; B -9 0 288 623 ;
-C -1 ; WX 722 ; N Ocircumflex ; B 34 -14 688 886 ;
-C -1 ; WX 722 ; N Ugrave ; B 14 -14 705 890 ;
-C -1 ; WX 612 ; N Delta ; B 6 0 608 688 ;
-C -1 ; WX 500 ; N thorn ; B 5 -217 470 683 ;
-C -1 ; WX 300 ; N twosuperior ; B 1 270 296 676 ;
-C -1 ; WX 722 ; N Odieresis ; B 34 -14 688 835 ;
-C -1 ; WX 500 ; N mu ; B 36 -218 512 450 ;
-C -1 ; WX 278 ; N igrave ; B -8 0 253 678 ;
-C -1 ; WX 500 ; N ohungarumlaut ; B 29 -10 491 678 ;
-C -1 ; WX 611 ; N Eogonek ; B 12 -165 597 662 ;
-C -1 ; WX 500 ; N dcroat ; B 27 -10 500 683 ;
-C -1 ; WX 750 ; N threequarters ; B 15 -14 718 676 ;
-C -1 ; WX 556 ; N Scedilla ; B 42 -215 491 676 ;
-C -1 ; WX 344 ; N lcaron ; B 19 0 347 695 ;
-C -1 ; WX 722 ; N Kcommaaccent ; B 34 -198 723 662 ;
-C -1 ; WX 611 ; N Lacute ; B 12 0 598 890 ;
-C -1 ; WX 980 ; N trademark ; B 30 256 957 662 ;
-C -1 ; WX 444 ; N edotaccent ; B 25 -10 424 623 ;
-C -1 ; WX 333 ; N Igrave ; B 18 0 315 890 ;
-C -1 ; WX 333 ; N Imacron ; B 11 0 322 813 ;
-C -1 ; WX 611 ; N Lcaron ; B 12 0 598 676 ;
-C -1 ; WX 750 ; N onehalf ; B 31 -14 746 676 ;
-C -1 ; WX 549 ; N lessequal ; B 26 0 523 666 ;
-C -1 ; WX 500 ; N ocircumflex ; B 29 -10 470 674 ;
-C -1 ; WX 500 ; N ntilde ; B 16 0 485 638 ;
-C -1 ; WX 722 ; N Uhungarumlaut ; B 14 -14 705 890 ;
-C -1 ; WX 611 ; N Eacute ; B 12 0 597 890 ;
-C -1 ; WX 444 ; N emacron ; B 25 -10 424 601 ;
-C -1 ; WX 500 ; N gbreve ; B 28 -218 470 664 ;
-C -1 ; WX 750 ; N onequarter ; B 37 -14 718 676 ;
-C -1 ; WX 556 ; N Scaron ; B 42 -14 491 886 ;
-C -1 ; WX 556 ; N Scommaaccent ; B 42 -218 491 676 ;
-C -1 ; WX 722 ; N Ohungarumlaut ; B 34 -14 688 890 ;
-C -1 ; WX 400 ; N degree ; B 57 390 343 676 ;
-C -1 ; WX 500 ; N ograve ; B 29 -10 470 678 ;
-C -1 ; WX 667 ; N Ccaron ; B 28 -14 633 886 ;
-C -1 ; WX 500 ; N ugrave ; B 9 -10 479 678 ;
-C -1 ; WX 453 ; N radical ; B 2 -60 452 768 ;
-C -1 ; WX 722 ; N Dcaron ; B 16 0 685 886 ;
-C -1 ; WX 333 ; N rcommaaccent ; B 5 -218 335 460 ;
-C -1 ; WX 722 ; N Ntilde ; B 12 -11 707 850 ;
-C -1 ; WX 500 ; N otilde ; B 29 -10 470 638 ;
-C -1 ; WX 667 ; N Rcommaaccent ; B 17 -198 659 662 ;
-C -1 ; WX 611 ; N Lcommaaccent ; B 12 -218 598 662 ;
-C -1 ; WX 722 ; N Atilde ; B 15 0 706 850 ;
-C -1 ; WX 722 ; N Aogonek ; B 15 -165 738 674 ;
-C -1 ; WX 722 ; N Aring ; B 15 0 706 898 ;
-C -1 ; WX 722 ; N Otilde ; B 34 -14 688 850 ;
-C -1 ; WX 444 ; N zdotaccent ; B 27 0 418 623 ;
-C -1 ; WX 611 ; N Ecaron ; B 12 0 597 886 ;
-C -1 ; WX 333 ; N Iogonek ; B 18 -165 315 662 ;
-C -1 ; WX 500 ; N kcommaaccent ; B 7 -218 505 683 ;
-C -1 ; WX 564 ; N minus ; B 30 220 534 286 ;
-C -1 ; WX 333 ; N Icircumflex ; B 11 0 322 886 ;
-C -1 ; WX 500 ; N ncaron ; B 16 0 485 674 ;
-C -1 ; WX 278 ; N tcommaaccent ; B 13 -218 279 579 ;
-C -1 ; WX 564 ; N logicalnot ; B 30 108 534 386 ;
-C -1 ; WX 500 ; N odieresis ; B 29 -10 470 623 ;
-C -1 ; WX 500 ; N udieresis ; B 9 -10 479 623 ;
-C -1 ; WX 549 ; N notequal ; B 12 -31 537 547 ;
-C -1 ; WX 500 ; N gcommaaccent ; B 28 -218 470 749 ;
-C -1 ; WX 500 ; N eth ; B 29 -10 471 686 ;
-C -1 ; WX 444 ; N zcaron ; B 27 0 418 674 ;
-C -1 ; WX 500 ; N ncommaaccent ; B 16 -218 485 460 ;
-C -1 ; WX 300 ; N onesuperior ; B 57 270 248 676 ;
-C -1 ; WX 278 ; N imacron ; B 6 0 271 601 ;
-C -1 ; WX 500 ; N Euro ; B 0 0 0 0 ;
-EndCharMetrics
-StartKernData
-StartKernPairs 2073
-KPX A C -40
-KPX A Cacute -40
-KPX A Ccaron -40
-KPX A Ccedilla -40
-KPX A G -40
-KPX A Gbreve -40
-KPX A Gcommaaccent -40
-KPX A O -55
-KPX A Oacute -55
-KPX A Ocircumflex -55
-KPX A Odieresis -55
-KPX A Ograve -55
-KPX A Ohungarumlaut -55
-KPX A Omacron -55
-KPX A Oslash -55
-KPX A Otilde -55
-KPX A Q -55
-KPX A T -111
-KPX A Tcaron -111
-KPX A Tcommaaccent -111
-KPX A U -55
-KPX A Uacute -55
-KPX A Ucircumflex -55
-KPX A Udieresis -55
-KPX A Ugrave -55
-KPX A Uhungarumlaut -55
-KPX A Umacron -55
-KPX A Uogonek -55
-KPX A Uring -55
-KPX A V -135
-KPX A W -90
-KPX A Y -105
-KPX A Yacute -105
-KPX A Ydieresis -105
-KPX A quoteright -111
-KPX A v -74
-KPX A w -92
-KPX A y -92
-KPX A yacute -92
-KPX A ydieresis -92
-KPX Aacute C -40
-KPX Aacute Cacute -40
-KPX Aacute Ccaron -40
-KPX Aacute Ccedilla -40
-KPX Aacute G -40
-KPX Aacute Gbreve -40
-KPX Aacute Gcommaaccent -40
-KPX Aacute O -55
-KPX Aacute Oacute -55
-KPX Aacute Ocircumflex -55
-KPX Aacute Odieresis -55
-KPX Aacute Ograve -55
-KPX Aacute Ohungarumlaut -55
-KPX Aacute Omacron -55
-KPX Aacute Oslash -55
-KPX Aacute Otilde -55
-KPX Aacute Q -55
-KPX Aacute T -111
-KPX Aacute Tcaron -111
-KPX Aacute Tcommaaccent -111
-KPX Aacute U -55
-KPX Aacute Uacute -55
-KPX Aacute Ucircumflex -55
-KPX Aacute Udieresis -55
-KPX Aacute Ugrave -55
-KPX Aacute Uhungarumlaut -55
-KPX Aacute Umacron -55
-KPX Aacute Uogonek -55
-KPX Aacute Uring -55
-KPX Aacute V -135
-KPX Aacute W -90
-KPX Aacute Y -105
-KPX Aacute Yacute -105
-KPX Aacute Ydieresis -105
-KPX Aacute quoteright -111
-KPX Aacute v -74
-KPX Aacute w -92
-KPX Aacute y -92
-KPX Aacute yacute -92
-KPX Aacute ydieresis -92
-KPX Abreve C -40
-KPX Abreve Cacute -40
-KPX Abreve Ccaron -40
-KPX Abreve Ccedilla -40
-KPX Abreve G -40
-KPX Abreve Gbreve -40
-KPX Abreve Gcommaaccent -40
-KPX Abreve O -55
-KPX Abreve Oacute -55
-KPX Abreve Ocircumflex -55
-KPX Abreve Odieresis -55
-KPX Abreve Ograve -55
-KPX Abreve Ohungarumlaut -55
-KPX Abreve Omacron -55
-KPX Abreve Oslash -55
-KPX Abreve Otilde -55
-KPX Abreve Q -55
-KPX Abreve T -111
-KPX Abreve Tcaron -111
-KPX Abreve Tcommaaccent -111
-KPX Abreve U -55
-KPX Abreve Uacute -55
-KPX Abreve Ucircumflex -55
-KPX Abreve Udieresis -55
-KPX Abreve Ugrave -55
-KPX Abreve Uhungarumlaut -55
-KPX Abreve Umacron -55
-KPX Abreve Uogonek -55
-KPX Abreve Uring -55
-KPX Abreve V -135
-KPX Abreve W -90
-KPX Abreve Y -105
-KPX Abreve Yacute -105
-KPX Abreve Ydieresis -105
-KPX Abreve quoteright -111
-KPX Abreve v -74
-KPX Abreve w -92
-KPX Abreve y -92
-KPX Abreve yacute -92
-KPX Abreve ydieresis -92
-KPX Acircumflex C -40
-KPX Acircumflex Cacute -40
-KPX Acircumflex Ccaron -40
-KPX Acircumflex Ccedilla -40
-KPX Acircumflex G -40
-KPX Acircumflex Gbreve -40
-KPX Acircumflex Gcommaaccent -40
-KPX Acircumflex O -55
-KPX Acircumflex Oacute -55
-KPX Acircumflex Ocircumflex -55
-KPX Acircumflex Odieresis -55
-KPX Acircumflex Ograve -55
-KPX Acircumflex Ohungarumlaut -55
-KPX Acircumflex Omacron -55
-KPX Acircumflex Oslash -55
-KPX Acircumflex Otilde -55
-KPX Acircumflex Q -55
-KPX Acircumflex T -111
-KPX Acircumflex Tcaron -111
-KPX Acircumflex Tcommaaccent -111
-KPX Acircumflex U -55
-KPX Acircumflex Uacute -55
-KPX Acircumflex Ucircumflex -55
-KPX Acircumflex Udieresis -55
-KPX Acircumflex Ugrave -55
-KPX Acircumflex Uhungarumlaut -55
-KPX Acircumflex Umacron -55
-KPX Acircumflex Uogonek -55
-KPX Acircumflex Uring -55
-KPX Acircumflex V -135
-KPX Acircumflex W -90
-KPX Acircumflex Y -105
-KPX Acircumflex Yacute -105
-KPX Acircumflex Ydieresis -105
-KPX Acircumflex quoteright -111
-KPX Acircumflex v -74
-KPX Acircumflex w -92
-KPX Acircumflex y -92
-KPX Acircumflex yacute -92
-KPX Acircumflex ydieresis -92
-KPX Adieresis C -40
-KPX Adieresis Cacute -40
-KPX Adieresis Ccaron -40
-KPX Adieresis Ccedilla -40
-KPX Adieresis G -40
-KPX Adieresis Gbreve -40
-KPX Adieresis Gcommaaccent -40
-KPX Adieresis O -55
-KPX Adieresis Oacute -55
-KPX Adieresis Ocircumflex -55
-KPX Adieresis Odieresis -55
-KPX Adieresis Ograve -55
-KPX Adieresis Ohungarumlaut -55
-KPX Adieresis Omacron -55
-KPX Adieresis Oslash -55
-KPX Adieresis Otilde -55
-KPX Adieresis Q -55
-KPX Adieresis T -111
-KPX Adieresis Tcaron -111
-KPX Adieresis Tcommaaccent -111
-KPX Adieresis U -55
-KPX Adieresis Uacute -55
-KPX Adieresis Ucircumflex -55
-KPX Adieresis Udieresis -55
-KPX Adieresis Ugrave -55
-KPX Adieresis Uhungarumlaut -55
-KPX Adieresis Umacron -55
-KPX Adieresis Uogonek -55
-KPX Adieresis Uring -55
-KPX Adieresis V -135
-KPX Adieresis W -90
-KPX Adieresis Y -105
-KPX Adieresis Yacute -105
-KPX Adieresis Ydieresis -105
-KPX Adieresis quoteright -111
-KPX Adieresis v -74
-KPX Adieresis w -92
-KPX Adieresis y -92
-KPX Adieresis yacute -92
-KPX Adieresis ydieresis -92
-KPX Agrave C -40
-KPX Agrave Cacute -40
-KPX Agrave Ccaron -40
-KPX Agrave Ccedilla -40
-KPX Agrave G -40
-KPX Agrave Gbreve -40
-KPX Agrave Gcommaaccent -40
-KPX Agrave O -55
-KPX Agrave Oacute -55
-KPX Agrave Ocircumflex -55
-KPX Agrave Odieresis -55
-KPX Agrave Ograve -55
-KPX Agrave Ohungarumlaut -55
-KPX Agrave Omacron -55
-KPX Agrave Oslash -55
-KPX Agrave Otilde -55
-KPX Agrave Q -55
-KPX Agrave T -111
-KPX Agrave Tcaron -111
-KPX Agrave Tcommaaccent -111
-KPX Agrave U -55
-KPX Agrave Uacute -55
-KPX Agrave Ucircumflex -55
-KPX Agrave Udieresis -55
-KPX Agrave Ugrave -55
-KPX Agrave Uhungarumlaut -55
-KPX Agrave Umacron -55
-KPX Agrave Uogonek -55
-KPX Agrave Uring -55
-KPX Agrave V -135
-KPX Agrave W -90
-KPX Agrave Y -105
-KPX Agrave Yacute -105
-KPX Agrave Ydieresis -105
-KPX Agrave quoteright -111
-KPX Agrave v -74
-KPX Agrave w -92
-KPX Agrave y -92
-KPX Agrave yacute -92
-KPX Agrave ydieresis -92
-KPX Amacron C -40
-KPX Amacron Cacute -40
-KPX Amacron Ccaron -40
-KPX Amacron Ccedilla -40
-KPX Amacron G -40
-KPX Amacron Gbreve -40
-KPX Amacron Gcommaaccent -40
-KPX Amacron O -55
-KPX Amacron Oacute -55
-KPX Amacron Ocircumflex -55
-KPX Amacron Odieresis -55
-KPX Amacron Ograve -55
-KPX Amacron Ohungarumlaut -55
-KPX Amacron Omacron -55
-KPX Amacron Oslash -55
-KPX Amacron Otilde -55
-KPX Amacron Q -55
-KPX Amacron T -111
-KPX Amacron Tcaron -111
-KPX Amacron Tcommaaccent -111
-KPX Amacron U -55
-KPX Amacron Uacute -55
-KPX Amacron Ucircumflex -55
-KPX Amacron Udieresis -55
-KPX Amacron Ugrave -55
-KPX Amacron Uhungarumlaut -55
-KPX Amacron Umacron -55
-KPX Amacron Uogonek -55
-KPX Amacron Uring -55
-KPX Amacron V -135
-KPX Amacron W -90
-KPX Amacron Y -105
-KPX Amacron Yacute -105
-KPX Amacron Ydieresis -105
-KPX Amacron quoteright -111
-KPX Amacron v -74
-KPX Amacron w -92
-KPX Amacron y -92
-KPX Amacron yacute -92
-KPX Amacron ydieresis -92
-KPX Aogonek C -40
-KPX Aogonek Cacute -40
-KPX Aogonek Ccaron -40
-KPX Aogonek Ccedilla -40
-KPX Aogonek G -40
-KPX Aogonek Gbreve -40
-KPX Aogonek Gcommaaccent -40
-KPX Aogonek O -55
-KPX Aogonek Oacute -55
-KPX Aogonek Ocircumflex -55
-KPX Aogonek Odieresis -55
-KPX Aogonek Ograve -55
-KPX Aogonek Ohungarumlaut -55
-KPX Aogonek Omacron -55
-KPX Aogonek Oslash -55
-KPX Aogonek Otilde -55
-KPX Aogonek Q -55
-KPX Aogonek T -111
-KPX Aogonek Tcaron -111
-KPX Aogonek Tcommaaccent -111
-KPX Aogonek U -55
-KPX Aogonek Uacute -55
-KPX Aogonek Ucircumflex -55
-KPX Aogonek Udieresis -55
-KPX Aogonek Ugrave -55
-KPX Aogonek Uhungarumlaut -55
-KPX Aogonek Umacron -55
-KPX Aogonek Uogonek -55
-KPX Aogonek Uring -55
-KPX Aogonek V -135
-KPX Aogonek W -90
-KPX Aogonek Y -105
-KPX Aogonek Yacute -105
-KPX Aogonek Ydieresis -105
-KPX Aogonek quoteright -111
-KPX Aogonek v -74
-KPX Aogonek w -52
-KPX Aogonek y -52
-KPX Aogonek yacute -52
-KPX Aogonek ydieresis -52
-KPX Aring C -40
-KPX Aring Cacute -40
-KPX Aring Ccaron -40
-KPX Aring Ccedilla -40
-KPX Aring G -40
-KPX Aring Gbreve -40
-KPX Aring Gcommaaccent -40
-KPX Aring O -55
-KPX Aring Oacute -55
-KPX Aring Ocircumflex -55
-KPX Aring Odieresis -55
-KPX Aring Ograve -55
-KPX Aring Ohungarumlaut -55
-KPX Aring Omacron -55
-KPX Aring Oslash -55
-KPX Aring Otilde -55
-KPX Aring Q -55
-KPX Aring T -111
-KPX Aring Tcaron -111
-KPX Aring Tcommaaccent -111
-KPX Aring U -55
-KPX Aring Uacute -55
-KPX Aring Ucircumflex -55
-KPX Aring Udieresis -55
-KPX Aring Ugrave -55
-KPX Aring Uhungarumlaut -55
-KPX Aring Umacron -55
-KPX Aring Uogonek -55
-KPX Aring Uring -55
-KPX Aring V -135
-KPX Aring W -90
-KPX Aring Y -105
-KPX Aring Yacute -105
-KPX Aring Ydieresis -105
-KPX Aring quoteright -111
-KPX Aring v -74
-KPX Aring w -92
-KPX Aring y -92
-KPX Aring yacute -92
-KPX Aring ydieresis -92
-KPX Atilde C -40
-KPX Atilde Cacute -40
-KPX Atilde Ccaron -40
-KPX Atilde Ccedilla -40
-KPX Atilde G -40
-KPX Atilde Gbreve -40
-KPX Atilde Gcommaaccent -40
-KPX Atilde O -55
-KPX Atilde Oacute -55
-KPX Atilde Ocircumflex -55
-KPX Atilde Odieresis -55
-KPX Atilde Ograve -55
-KPX Atilde Ohungarumlaut -55
-KPX Atilde Omacron -55
-KPX Atilde Oslash -55
-KPX Atilde Otilde -55
-KPX Atilde Q -55
-KPX Atilde T -111
-KPX Atilde Tcaron -111
-KPX Atilde Tcommaaccent -111
-KPX Atilde U -55
-KPX Atilde Uacute -55
-KPX Atilde Ucircumflex -55
-KPX Atilde Udieresis -55
-KPX Atilde Ugrave -55
-KPX Atilde Uhungarumlaut -55
-KPX Atilde Umacron -55
-KPX Atilde Uogonek -55
-KPX Atilde Uring -55
-KPX Atilde V -135
-KPX Atilde W -90
-KPX Atilde Y -105
-KPX Atilde Yacute -105
-KPX Atilde Ydieresis -105
-KPX Atilde quoteright -111
-KPX Atilde v -74
-KPX Atilde w -92
-KPX Atilde y -92
-KPX Atilde yacute -92
-KPX Atilde ydieresis -92
-KPX B A -35
-KPX B Aacute -35
-KPX B Abreve -35
-KPX B Acircumflex -35
-KPX B Adieresis -35
-KPX B Agrave -35
-KPX B Amacron -35
-KPX B Aogonek -35
-KPX B Aring -35
-KPX B Atilde -35
-KPX B U -10
-KPX B Uacute -10
-KPX B Ucircumflex -10
-KPX B Udieresis -10
-KPX B Ugrave -10
-KPX B Uhungarumlaut -10
-KPX B Umacron -10
-KPX B Uogonek -10
-KPX B Uring -10
-KPX D A -40
-KPX D Aacute -40
-KPX D Abreve -40
-KPX D Acircumflex -40
-KPX D Adieresis -40
-KPX D Agrave -40
-KPX D Amacron -40
-KPX D Aogonek -40
-KPX D Aring -40
-KPX D Atilde -40
-KPX D V -40
-KPX D W -30
-KPX D Y -55
-KPX D Yacute -55
-KPX D Ydieresis -55
-KPX Dcaron A -40
-KPX Dcaron Aacute -40
-KPX Dcaron Abreve -40
-KPX Dcaron Acircumflex -40
-KPX Dcaron Adieresis -40
-KPX Dcaron Agrave -40
-KPX Dcaron Amacron -40
-KPX Dcaron Aogonek -40
-KPX Dcaron Aring -40
-KPX Dcaron Atilde -40
-KPX Dcaron V -40
-KPX Dcaron W -30
-KPX Dcaron Y -55
-KPX Dcaron Yacute -55
-KPX Dcaron Ydieresis -55
-KPX Dcroat A -40
-KPX Dcroat Aacute -40
-KPX Dcroat Abreve -40
-KPX Dcroat Acircumflex -40
-KPX Dcroat Adieresis -40
-KPX Dcroat Agrave -40
-KPX Dcroat Amacron -40
-KPX Dcroat Aogonek -40
-KPX Dcroat Aring -40
-KPX Dcroat Atilde -40
-KPX Dcroat V -40
-KPX Dcroat W -30
-KPX Dcroat Y -55
-KPX Dcroat Yacute -55
-KPX Dcroat Ydieresis -55
-KPX F A -74
-KPX F Aacute -74
-KPX F Abreve -74
-KPX F Acircumflex -74
-KPX F Adieresis -74
-KPX F Agrave -74
-KPX F Amacron -74
-KPX F Aogonek -74
-KPX F Aring -74
-KPX F Atilde -74
-KPX F a -15
-KPX F aacute -15
-KPX F abreve -15
-KPX F acircumflex -15
-KPX F adieresis -15
-KPX F agrave -15
-KPX F amacron -15
-KPX F aogonek -15
-KPX F aring -15
-KPX F atilde -15
-KPX F comma -80
-KPX F o -15
-KPX F oacute -15
-KPX F ocircumflex -15
-KPX F odieresis -15
-KPX F ograve -15
-KPX F ohungarumlaut -15
-KPX F omacron -15
-KPX F oslash -15
-KPX F otilde -15
-KPX F period -80
-KPX J A -60
-KPX J Aacute -60
-KPX J Abreve -60
-KPX J Acircumflex -60
-KPX J Adieresis -60
-KPX J Agrave -60
-KPX J Amacron -60
-KPX J Aogonek -60
-KPX J Aring -60
-KPX J Atilde -60
-KPX K O -30
-KPX K Oacute -30
-KPX K Ocircumflex -30
-KPX K Odieresis -30
-KPX K Ograve -30
-KPX K Ohungarumlaut -30
-KPX K Omacron -30
-KPX K Oslash -30
-KPX K Otilde -30
-KPX K e -25
-KPX K eacute -25
-KPX K ecaron -25
-KPX K ecircumflex -25
-KPX K edieresis -25
-KPX K edotaccent -25
-KPX K egrave -25
-KPX K emacron -25
-KPX K eogonek -25
-KPX K o -35
-KPX K oacute -35
-KPX K ocircumflex -35
-KPX K odieresis -35
-KPX K ograve -35
-KPX K ohungarumlaut -35
-KPX K omacron -35
-KPX K oslash -35
-KPX K otilde -35
-KPX K u -15
-KPX K uacute -15
-KPX K ucircumflex -15
-KPX K udieresis -15
-KPX K ugrave -15
-KPX K uhungarumlaut -15
-KPX K umacron -15
-KPX K uogonek -15
-KPX K uring -15
-KPX K y -25
-KPX K yacute -25
-KPX K ydieresis -25
-KPX Kcommaaccent O -30
-KPX Kcommaaccent Oacute -30
-KPX Kcommaaccent Ocircumflex -30
-KPX Kcommaaccent Odieresis -30
-KPX Kcommaaccent Ograve -30
-KPX Kcommaaccent Ohungarumlaut -30
-KPX Kcommaaccent Omacron -30
-KPX Kcommaaccent Oslash -30
-KPX Kcommaaccent Otilde -30
-KPX Kcommaaccent e -25
-KPX Kcommaaccent eacute -25
-KPX Kcommaaccent ecaron -25
-KPX Kcommaaccent ecircumflex -25
-KPX Kcommaaccent edieresis -25
-KPX Kcommaaccent edotaccent -25
-KPX Kcommaaccent egrave -25
-KPX Kcommaaccent emacron -25
-KPX Kcommaaccent eogonek -25
-KPX Kcommaaccent o -35
-KPX Kcommaaccent oacute -35
-KPX Kcommaaccent ocircumflex -35
-KPX Kcommaaccent odieresis -35
-KPX Kcommaaccent ograve -35
-KPX Kcommaaccent ohungarumlaut -35
-KPX Kcommaaccent omacron -35
-KPX Kcommaaccent oslash -35
-KPX Kcommaaccent otilde -35
-KPX Kcommaaccent u -15
-KPX Kcommaaccent uacute -15
-KPX Kcommaaccent ucircumflex -15
-KPX Kcommaaccent udieresis -15
-KPX Kcommaaccent ugrave -15
-KPX Kcommaaccent uhungarumlaut -15
-KPX Kcommaaccent umacron -15
-KPX Kcommaaccent uogonek -15
-KPX Kcommaaccent uring -15
-KPX Kcommaaccent y -25
-KPX Kcommaaccent yacute -25
-KPX Kcommaaccent ydieresis -25
-KPX L T -92
-KPX L Tcaron -92
-KPX L Tcommaaccent -92
-KPX L V -100
-KPX L W -74
-KPX L Y -100
-KPX L Yacute -100
-KPX L Ydieresis -100
-KPX L quoteright -92
-KPX L y -55
-KPX L yacute -55
-KPX L ydieresis -55
-KPX Lacute T -92
-KPX Lacute Tcaron -92
-KPX Lacute Tcommaaccent -92
-KPX Lacute V -100
-KPX Lacute W -74
-KPX Lacute Y -100
-KPX Lacute Yacute -100
-KPX Lacute Ydieresis -100
-KPX Lacute quoteright -92
-KPX Lacute y -55
-KPX Lacute yacute -55
-KPX Lacute ydieresis -55
-KPX Lcaron quoteright -92
-KPX Lcaron y -55
-KPX Lcaron yacute -55
-KPX Lcaron ydieresis -55
-KPX Lcommaaccent T -92
-KPX Lcommaaccent Tcaron -92
-KPX Lcommaaccent Tcommaaccent -92
-KPX Lcommaaccent V -100
-KPX Lcommaaccent W -74
-KPX Lcommaaccent Y -100
-KPX Lcommaaccent Yacute -100
-KPX Lcommaaccent Ydieresis -100
-KPX Lcommaaccent quoteright -92
-KPX Lcommaaccent y -55
-KPX Lcommaaccent yacute -55
-KPX Lcommaaccent ydieresis -55
-KPX Lslash T -92
-KPX Lslash Tcaron -92
-KPX Lslash Tcommaaccent -92
-KPX Lslash V -100
-KPX Lslash W -74
-KPX Lslash Y -100
-KPX Lslash Yacute -100
-KPX Lslash Ydieresis -100
-KPX Lslash quoteright -92
-KPX Lslash y -55
-KPX Lslash yacute -55
-KPX Lslash ydieresis -55
-KPX N A -35
-KPX N Aacute -35
-KPX N Abreve -35
-KPX N Acircumflex -35
-KPX N Adieresis -35
-KPX N Agrave -35
-KPX N Amacron -35
-KPX N Aogonek -35
-KPX N Aring -35
-KPX N Atilde -35
-KPX Nacute A -35
-KPX Nacute Aacute -35
-KPX Nacute Abreve -35
-KPX Nacute Acircumflex -35
-KPX Nacute Adieresis -35
-KPX Nacute Agrave -35
-KPX Nacute Amacron -35
-KPX Nacute Aogonek -35
-KPX Nacute Aring -35
-KPX Nacute Atilde -35
-KPX Ncaron A -35
-KPX Ncaron Aacute -35
-KPX Ncaron Abreve -35
-KPX Ncaron Acircumflex -35
-KPX Ncaron Adieresis -35
-KPX Ncaron Agrave -35
-KPX Ncaron Amacron -35
-KPX Ncaron Aogonek -35
-KPX Ncaron Aring -35
-KPX Ncaron Atilde -35
-KPX Ncommaaccent A -35
-KPX Ncommaaccent Aacute -35
-KPX Ncommaaccent Abreve -35
-KPX Ncommaaccent Acircumflex -35
-KPX Ncommaaccent Adieresis -35
-KPX Ncommaaccent Agrave -35
-KPX Ncommaaccent Amacron -35
-KPX Ncommaaccent Aogonek -35
-KPX Ncommaaccent Aring -35
-KPX Ncommaaccent Atilde -35
-KPX Ntilde A -35
-KPX Ntilde Aacute -35
-KPX Ntilde Abreve -35
-KPX Ntilde Acircumflex -35
-KPX Ntilde Adieresis -35
-KPX Ntilde Agrave -35
-KPX Ntilde Amacron -35
-KPX Ntilde Aogonek -35
-KPX Ntilde Aring -35
-KPX Ntilde Atilde -35
-KPX O A -35
-KPX O Aacute -35
-KPX O Abreve -35
-KPX O Acircumflex -35
-KPX O Adieresis -35
-KPX O Agrave -35
-KPX O Amacron -35
-KPX O Aogonek -35
-KPX O Aring -35
-KPX O Atilde -35
-KPX O T -40
-KPX O Tcaron -40
-KPX O Tcommaaccent -40
-KPX O V -50
-KPX O W -35
-KPX O X -40
-KPX O Y -50
-KPX O Yacute -50
-KPX O Ydieresis -50
-KPX Oacute A -35
-KPX Oacute Aacute -35
-KPX Oacute Abreve -35
-KPX Oacute Acircumflex -35
-KPX Oacute Adieresis -35
-KPX Oacute Agrave -35
-KPX Oacute Amacron -35
-KPX Oacute Aogonek -35
-KPX Oacute Aring -35
-KPX Oacute Atilde -35
-KPX Oacute T -40
-KPX Oacute Tcaron -40
-KPX Oacute Tcommaaccent -40
-KPX Oacute V -50
-KPX Oacute W -35
-KPX Oacute X -40
-KPX Oacute Y -50
-KPX Oacute Yacute -50
-KPX Oacute Ydieresis -50
-KPX Ocircumflex A -35
-KPX Ocircumflex Aacute -35
-KPX Ocircumflex Abreve -35
-KPX Ocircumflex Acircumflex -35
-KPX Ocircumflex Adieresis -35
-KPX Ocircumflex Agrave -35
-KPX Ocircumflex Amacron -35
-KPX Ocircumflex Aogonek -35
-KPX Ocircumflex Aring -35
-KPX Ocircumflex Atilde -35
-KPX Ocircumflex T -40
-KPX Ocircumflex Tcaron -40
-KPX Ocircumflex Tcommaaccent -40
-KPX Ocircumflex V -50
-KPX Ocircumflex W -35
-KPX Ocircumflex X -40
-KPX Ocircumflex Y -50
-KPX Ocircumflex Yacute -50
-KPX Ocircumflex Ydieresis -50
-KPX Odieresis A -35
-KPX Odieresis Aacute -35
-KPX Odieresis Abreve -35
-KPX Odieresis Acircumflex -35
-KPX Odieresis Adieresis -35
-KPX Odieresis Agrave -35
-KPX Odieresis Amacron -35
-KPX Odieresis Aogonek -35
-KPX Odieresis Aring -35
-KPX Odieresis Atilde -35
-KPX Odieresis T -40
-KPX Odieresis Tcaron -40
-KPX Odieresis Tcommaaccent -40
-KPX Odieresis V -50
-KPX Odieresis W -35
-KPX Odieresis X -40
-KPX Odieresis Y -50
-KPX Odieresis Yacute -50
-KPX Odieresis Ydieresis -50
-KPX Ograve A -35
-KPX Ograve Aacute -35
-KPX Ograve Abreve -35
-KPX Ograve Acircumflex -35
-KPX Ograve Adieresis -35
-KPX Ograve Agrave -35
-KPX Ograve Amacron -35
-KPX Ograve Aogonek -35
-KPX Ograve Aring -35
-KPX Ograve Atilde -35
-KPX Ograve T -40
-KPX Ograve Tcaron -40
-KPX Ograve Tcommaaccent -40
-KPX Ograve V -50
-KPX Ograve W -35
-KPX Ograve X -40
-KPX Ograve Y -50
-KPX Ograve Yacute -50
-KPX Ograve Ydieresis -50
-KPX Ohungarumlaut A -35
-KPX Ohungarumlaut Aacute -35
-KPX Ohungarumlaut Abreve -35
-KPX Ohungarumlaut Acircumflex -35
-KPX Ohungarumlaut Adieresis -35
-KPX Ohungarumlaut Agrave -35
-KPX Ohungarumlaut Amacron -35
-KPX Ohungarumlaut Aogonek -35
-KPX Ohungarumlaut Aring -35
-KPX Ohungarumlaut Atilde -35
-KPX Ohungarumlaut T -40
-KPX Ohungarumlaut Tcaron -40
-KPX Ohungarumlaut Tcommaaccent -40
-KPX Ohungarumlaut V -50
-KPX Ohungarumlaut W -35
-KPX Ohungarumlaut X -40
-KPX Ohungarumlaut Y -50
-KPX Ohungarumlaut Yacute -50
-KPX Ohungarumlaut Ydieresis -50
-KPX Omacron A -35
-KPX Omacron Aacute -35
-KPX Omacron Abreve -35
-KPX Omacron Acircumflex -35
-KPX Omacron Adieresis -35
-KPX Omacron Agrave -35
-KPX Omacron Amacron -35
-KPX Omacron Aogonek -35
-KPX Omacron Aring -35
-KPX Omacron Atilde -35
-KPX Omacron T -40
-KPX Omacron Tcaron -40
-KPX Omacron Tcommaaccent -40
-KPX Omacron V -50
-KPX Omacron W -35
-KPX Omacron X -40
-KPX Omacron Y -50
-KPX Omacron Yacute -50
-KPX Omacron Ydieresis -50
-KPX Oslash A -35
-KPX Oslash Aacute -35
-KPX Oslash Abreve -35
-KPX Oslash Acircumflex -35
-KPX Oslash Adieresis -35
-KPX Oslash Agrave -35
-KPX Oslash Amacron -35
-KPX Oslash Aogonek -35
-KPX Oslash Aring -35
-KPX Oslash Atilde -35
-KPX Oslash T -40
-KPX Oslash Tcaron -40
-KPX Oslash Tcommaaccent -40
-KPX Oslash V -50
-KPX Oslash W -35
-KPX Oslash X -40
-KPX Oslash Y -50
-KPX Oslash Yacute -50
-KPX Oslash Ydieresis -50
-KPX Otilde A -35
-KPX Otilde Aacute -35
-KPX Otilde Abreve -35
-KPX Otilde Acircumflex -35
-KPX Otilde Adieresis -35
-KPX Otilde Agrave -35
-KPX Otilde Amacron -35
-KPX Otilde Aogonek -35
-KPX Otilde Aring -35
-KPX Otilde Atilde -35
-KPX Otilde T -40
-KPX Otilde Tcaron -40
-KPX Otilde Tcommaaccent -40
-KPX Otilde V -50
-KPX Otilde W -35
-KPX Otilde X -40
-KPX Otilde Y -50
-KPX Otilde Yacute -50
-KPX Otilde Ydieresis -50
-KPX P A -92
-KPX P Aacute -92
-KPX P Abreve -92
-KPX P Acircumflex -92
-KPX P Adieresis -92
-KPX P Agrave -92
-KPX P Amacron -92
-KPX P Aogonek -92
-KPX P Aring -92
-KPX P Atilde -92
-KPX P a -15
-KPX P aacute -15
-KPX P abreve -15
-KPX P acircumflex -15
-KPX P adieresis -15
-KPX P agrave -15
-KPX P amacron -15
-KPX P aogonek -15
-KPX P aring -15
-KPX P atilde -15
-KPX P comma -111
-KPX P period -111
-KPX Q U -10
-KPX Q Uacute -10
-KPX Q Ucircumflex -10
-KPX Q Udieresis -10
-KPX Q Ugrave -10
-KPX Q Uhungarumlaut -10
-KPX Q Umacron -10
-KPX Q Uogonek -10
-KPX Q Uring -10
-KPX R O -40
-KPX R Oacute -40
-KPX R Ocircumflex -40
-KPX R Odieresis -40
-KPX R Ograve -40
-KPX R Ohungarumlaut -40
-KPX R Omacron -40
-KPX R Oslash -40
-KPX R Otilde -40
-KPX R T -60
-KPX R Tcaron -60
-KPX R Tcommaaccent -60
-KPX R U -40
-KPX R Uacute -40
-KPX R Ucircumflex -40
-KPX R Udieresis -40
-KPX R Ugrave -40
-KPX R Uhungarumlaut -40
-KPX R Umacron -40
-KPX R Uogonek -40
-KPX R Uring -40
-KPX R V -80
-KPX R W -55
-KPX R Y -65
-KPX R Yacute -65
-KPX R Ydieresis -65
-KPX Racute O -40
-KPX Racute Oacute -40
-KPX Racute Ocircumflex -40
-KPX Racute Odieresis -40
-KPX Racute Ograve -40
-KPX Racute Ohungarumlaut -40
-KPX Racute Omacron -40
-KPX Racute Oslash -40
-KPX Racute Otilde -40
-KPX Racute T -60
-KPX Racute Tcaron -60
-KPX Racute Tcommaaccent -60
-KPX Racute U -40
-KPX Racute Uacute -40
-KPX Racute Ucircumflex -40
-KPX Racute Udieresis -40
-KPX Racute Ugrave -40
-KPX Racute Uhungarumlaut -40
-KPX Racute Umacron -40
-KPX Racute Uogonek -40
-KPX Racute Uring -40
-KPX Racute V -80
-KPX Racute W -55
-KPX Racute Y -65
-KPX Racute Yacute -65
-KPX Racute Ydieresis -65
-KPX Rcaron O -40
-KPX Rcaron Oacute -40
-KPX Rcaron Ocircumflex -40
-KPX Rcaron Odieresis -40
-KPX Rcaron Ograve -40
-KPX Rcaron Ohungarumlaut -40
-KPX Rcaron Omacron -40
-KPX Rcaron Oslash -40
-KPX Rcaron Otilde -40
-KPX Rcaron T -60
-KPX Rcaron Tcaron -60
-KPX Rcaron Tcommaaccent -60
-KPX Rcaron U -40
-KPX Rcaron Uacute -40
-KPX Rcaron Ucircumflex -40
-KPX Rcaron Udieresis -40
-KPX Rcaron Ugrave -40
-KPX Rcaron Uhungarumlaut -40
-KPX Rcaron Umacron -40
-KPX Rcaron Uogonek -40
-KPX Rcaron Uring -40
-KPX Rcaron V -80
-KPX Rcaron W -55
-KPX Rcaron Y -65
-KPX Rcaron Yacute -65
-KPX Rcaron Ydieresis -65
-KPX Rcommaaccent O -40
-KPX Rcommaaccent Oacute -40
-KPX Rcommaaccent Ocircumflex -40
-KPX Rcommaaccent Odieresis -40
-KPX Rcommaaccent Ograve -40
-KPX Rcommaaccent Ohungarumlaut -40
-KPX Rcommaaccent Omacron -40
-KPX Rcommaaccent Oslash -40
-KPX Rcommaaccent Otilde -40
-KPX Rcommaaccent T -60
-KPX Rcommaaccent Tcaron -60
-KPX Rcommaaccent Tcommaaccent -60
-KPX Rcommaaccent U -40
-KPX Rcommaaccent Uacute -40
-KPX Rcommaaccent Ucircumflex -40
-KPX Rcommaaccent Udieresis -40
-KPX Rcommaaccent Ugrave -40
-KPX Rcommaaccent Uhungarumlaut -40
-KPX Rcommaaccent Umacron -40
-KPX Rcommaaccent Uogonek -40
-KPX Rcommaaccent Uring -40
-KPX Rcommaaccent V -80
-KPX Rcommaaccent W -55
-KPX Rcommaaccent Y -65
-KPX Rcommaaccent Yacute -65
-KPX Rcommaaccent Ydieresis -65
-KPX T A -93
-KPX T Aacute -93
-KPX T Abreve -93
-KPX T Acircumflex -93
-KPX T Adieresis -93
-KPX T Agrave -93
-KPX T Amacron -93
-KPX T Aogonek -93
-KPX T Aring -93
-KPX T Atilde -93
-KPX T O -18
-KPX T Oacute -18
-KPX T Ocircumflex -18
-KPX T Odieresis -18
-KPX T Ograve -18
-KPX T Ohungarumlaut -18
-KPX T Omacron -18
-KPX T Oslash -18
-KPX T Otilde -18
-KPX T a -80
-KPX T aacute -80
-KPX T abreve -80
-KPX T acircumflex -80
-KPX T adieresis -40
-KPX T agrave -40
-KPX T amacron -40
-KPX T aogonek -80
-KPX T aring -80
-KPX T atilde -40
-KPX T colon -50
-KPX T comma -74
-KPX T e -70
-KPX T eacute -70
-KPX T ecaron -70
-KPX T ecircumflex -70
-KPX T edieresis -30
-KPX T edotaccent -70
-KPX T egrave -70
-KPX T emacron -30
-KPX T eogonek -70
-KPX T hyphen -92
-KPX T i -35
-KPX T iacute -35
-KPX T iogonek -35
-KPX T o -80
-KPX T oacute -80
-KPX T ocircumflex -80
-KPX T odieresis -80
-KPX T ograve -80
-KPX T ohungarumlaut -80
-KPX T omacron -80
-KPX T oslash -80
-KPX T otilde -80
-KPX T period -74
-KPX T r -35
-KPX T racute -35
-KPX T rcaron -35
-KPX T rcommaaccent -35
-KPX T semicolon -55
-KPX T u -45
-KPX T uacute -45
-KPX T ucircumflex -45
-KPX T udieresis -45
-KPX T ugrave -45
-KPX T uhungarumlaut -45
-KPX T umacron -45
-KPX T uogonek -45
-KPX T uring -45
-KPX T w -80
-KPX T y -80
-KPX T yacute -80
-KPX T ydieresis -80
-KPX Tcaron A -93
-KPX Tcaron Aacute -93
-KPX Tcaron Abreve -93
-KPX Tcaron Acircumflex -93
-KPX Tcaron Adieresis -93
-KPX Tcaron Agrave -93
-KPX Tcaron Amacron -93
-KPX Tcaron Aogonek -93
-KPX Tcaron Aring -93
-KPX Tcaron Atilde -93
-KPX Tcaron O -18
-KPX Tcaron Oacute -18
-KPX Tcaron Ocircumflex -18
-KPX Tcaron Odieresis -18
-KPX Tcaron Ograve -18
-KPX Tcaron Ohungarumlaut -18
-KPX Tcaron Omacron -18
-KPX Tcaron Oslash -18
-KPX Tcaron Otilde -18
-KPX Tcaron a -80
-KPX Tcaron aacute -80
-KPX Tcaron abreve -80
-KPX Tcaron acircumflex -80
-KPX Tcaron adieresis -40
-KPX Tcaron agrave -40
-KPX Tcaron amacron -40
-KPX Tcaron aogonek -80
-KPX Tcaron aring -80
-KPX Tcaron atilde -40
-KPX Tcaron colon -50
-KPX Tcaron comma -74
-KPX Tcaron e -70
-KPX Tcaron eacute -70
-KPX Tcaron ecaron -70
-KPX Tcaron ecircumflex -30
-KPX Tcaron edieresis -30
-KPX Tcaron edotaccent -70
-KPX Tcaron egrave -70
-KPX Tcaron emacron -30
-KPX Tcaron eogonek -70
-KPX Tcaron hyphen -92
-KPX Tcaron i -35
-KPX Tcaron iacute -35
-KPX Tcaron iogonek -35
-KPX Tcaron o -80
-KPX Tcaron oacute -80
-KPX Tcaron ocircumflex -80
-KPX Tcaron odieresis -80
-KPX Tcaron ograve -80
-KPX Tcaron ohungarumlaut -80
-KPX Tcaron omacron -80
-KPX Tcaron oslash -80
-KPX Tcaron otilde -80
-KPX Tcaron period -74
-KPX Tcaron r -35
-KPX Tcaron racute -35
-KPX Tcaron rcaron -35
-KPX Tcaron rcommaaccent -35
-KPX Tcaron semicolon -55
-KPX Tcaron u -45
-KPX Tcaron uacute -45
-KPX Tcaron ucircumflex -45
-KPX Tcaron udieresis -45
-KPX Tcaron ugrave -45
-KPX Tcaron uhungarumlaut -45
-KPX Tcaron umacron -45
-KPX Tcaron uogonek -45
-KPX Tcaron uring -45
-KPX Tcaron w -80
-KPX Tcaron y -80
-KPX Tcaron yacute -80
-KPX Tcaron ydieresis -80
-KPX Tcommaaccent A -93
-KPX Tcommaaccent Aacute -93
-KPX Tcommaaccent Abreve -93
-KPX Tcommaaccent Acircumflex -93
-KPX Tcommaaccent Adieresis -93
-KPX Tcommaaccent Agrave -93
-KPX Tcommaaccent Amacron -93
-KPX Tcommaaccent Aogonek -93
-KPX Tcommaaccent Aring -93
-KPX Tcommaaccent Atilde -93
-KPX Tcommaaccent O -18
-KPX Tcommaaccent Oacute -18
-KPX Tcommaaccent Ocircumflex -18
-KPX Tcommaaccent Odieresis -18
-KPX Tcommaaccent Ograve -18
-KPX Tcommaaccent Ohungarumlaut -18
-KPX Tcommaaccent Omacron -18
-KPX Tcommaaccent Oslash -18
-KPX Tcommaaccent Otilde -18
-KPX Tcommaaccent a -80
-KPX Tcommaaccent aacute -80
-KPX Tcommaaccent abreve -80
-KPX Tcommaaccent acircumflex -80
-KPX Tcommaaccent adieresis -40
-KPX Tcommaaccent agrave -40
-KPX Tcommaaccent amacron -40
-KPX Tcommaaccent aogonek -80
-KPX Tcommaaccent aring -80
-KPX Tcommaaccent atilde -40
-KPX Tcommaaccent colon -50
-KPX Tcommaaccent comma -74
-KPX Tcommaaccent e -70
-KPX Tcommaaccent eacute -70
-KPX Tcommaaccent ecaron -70
-KPX Tcommaaccent ecircumflex -30
-KPX Tcommaaccent edieresis -30
-KPX Tcommaaccent edotaccent -70
-KPX Tcommaaccent egrave -30
-KPX Tcommaaccent emacron -70
-KPX Tcommaaccent eogonek -70
-KPX Tcommaaccent hyphen -92
-KPX Tcommaaccent i -35
-KPX Tcommaaccent iacute -35
-KPX Tcommaaccent iogonek -35
-KPX Tcommaaccent o -80
-KPX Tcommaaccent oacute -80
-KPX Tcommaaccent ocircumflex -80
-KPX Tcommaaccent odieresis -80
-KPX Tcommaaccent ograve -80
-KPX Tcommaaccent ohungarumlaut -80
-KPX Tcommaaccent omacron -80
-KPX Tcommaaccent oslash -80
-KPX Tcommaaccent otilde -80
-KPX Tcommaaccent period -74
-KPX Tcommaaccent r -35
-KPX Tcommaaccent racute -35
-KPX Tcommaaccent rcaron -35
-KPX Tcommaaccent rcommaaccent -35
-KPX Tcommaaccent semicolon -55
-KPX Tcommaaccent u -45
-KPX Tcommaaccent uacute -45
-KPX Tcommaaccent ucircumflex -45
-KPX Tcommaaccent udieresis -45
-KPX Tcommaaccent ugrave -45
-KPX Tcommaaccent uhungarumlaut -45
-KPX Tcommaaccent umacron -45
-KPX Tcommaaccent uogonek -45
-KPX Tcommaaccent uring -45
-KPX Tcommaaccent w -80
-KPX Tcommaaccent y -80
-KPX Tcommaaccent yacute -80
-KPX Tcommaaccent ydieresis -80
-KPX U A -40
-KPX U Aacute -40
-KPX U Abreve -40
-KPX U Acircumflex -40
-KPX U Adieresis -40
-KPX U Agrave -40
-KPX U Amacron -40
-KPX U Aogonek -40
-KPX U Aring -40
-KPX U Atilde -40
-KPX Uacute A -40
-KPX Uacute Aacute -40
-KPX Uacute Abreve -40
-KPX Uacute Acircumflex -40
-KPX Uacute Adieresis -40
-KPX Uacute Agrave -40
-KPX Uacute Amacron -40
-KPX Uacute Aogonek -40
-KPX Uacute Aring -40
-KPX Uacute Atilde -40
-KPX Ucircumflex A -40
-KPX Ucircumflex Aacute -40
-KPX Ucircumflex Abreve -40
-KPX Ucircumflex Acircumflex -40
-KPX Ucircumflex Adieresis -40
-KPX Ucircumflex Agrave -40
-KPX Ucircumflex Amacron -40
-KPX Ucircumflex Aogonek -40
-KPX Ucircumflex Aring -40
-KPX Ucircumflex Atilde -40
-KPX Udieresis A -40
-KPX Udieresis Aacute -40
-KPX Udieresis Abreve -40
-KPX Udieresis Acircumflex -40
-KPX Udieresis Adieresis -40
-KPX Udieresis Agrave -40
-KPX Udieresis Amacron -40
-KPX Udieresis Aogonek -40
-KPX Udieresis Aring -40
-KPX Udieresis Atilde -40
-KPX Ugrave A -40
-KPX Ugrave Aacute -40
-KPX Ugrave Abreve -40
-KPX Ugrave Acircumflex -40
-KPX Ugrave Adieresis -40
-KPX Ugrave Agrave -40
-KPX Ugrave Amacron -40
-KPX Ugrave Aogonek -40
-KPX Ugrave Aring -40
-KPX Ugrave Atilde -40
-KPX Uhungarumlaut A -40
-KPX Uhungarumlaut Aacute -40
-KPX Uhungarumlaut Abreve -40
-KPX Uhungarumlaut Acircumflex -40
-KPX Uhungarumlaut Adieresis -40
-KPX Uhungarumlaut Agrave -40
-KPX Uhungarumlaut Amacron -40
-KPX Uhungarumlaut Aogonek -40
-KPX Uhungarumlaut Aring -40
-KPX Uhungarumlaut Atilde -40
-KPX Umacron A -40
-KPX Umacron Aacute -40
-KPX Umacron Abreve -40
-KPX Umacron Acircumflex -40
-KPX Umacron Adieresis -40
-KPX Umacron Agrave -40
-KPX Umacron Amacron -40
-KPX Umacron Aogonek -40
-KPX Umacron Aring -40
-KPX Umacron Atilde -40
-KPX Uogonek A -40
-KPX Uogonek Aacute -40
-KPX Uogonek Abreve -40
-KPX Uogonek Acircumflex -40
-KPX Uogonek Adieresis -40
-KPX Uogonek Agrave -40
-KPX Uogonek Amacron -40
-KPX Uogonek Aogonek -40
-KPX Uogonek Aring -40
-KPX Uogonek Atilde -40
-KPX Uring A -40
-KPX Uring Aacute -40
-KPX Uring Abreve -40
-KPX Uring Acircumflex -40
-KPX Uring Adieresis -40
-KPX Uring Agrave -40
-KPX Uring Amacron -40
-KPX Uring Aogonek -40
-KPX Uring Aring -40
-KPX Uring Atilde -40
-KPX V A -135
-KPX V Aacute -135
-KPX V Abreve -135
-KPX V Acircumflex -135
-KPX V Adieresis -135
-KPX V Agrave -135
-KPX V Amacron -135
-KPX V Aogonek -135
-KPX V Aring -135
-KPX V Atilde -135
-KPX V G -15
-KPX V Gbreve -15
-KPX V Gcommaaccent -15
-KPX V O -40
-KPX V Oacute -40
-KPX V Ocircumflex -40
-KPX V Odieresis -40
-KPX V Ograve -40
-KPX V Ohungarumlaut -40
-KPX V Omacron -40
-KPX V Oslash -40
-KPX V Otilde -40
-KPX V a -111
-KPX V aacute -111
-KPX V abreve -111
-KPX V acircumflex -71
-KPX V adieresis -71
-KPX V agrave -71
-KPX V amacron -71
-KPX V aogonek -111
-KPX V aring -111
-KPX V atilde -71
-KPX V colon -74
-KPX V comma -129
-KPX V e -111
-KPX V eacute -111
-KPX V ecaron -71
-KPX V ecircumflex -71
-KPX V edieresis -71
-KPX V edotaccent -111
-KPX V egrave -71
-KPX V emacron -71
-KPX V eogonek -111
-KPX V hyphen -100
-KPX V i -60
-KPX V iacute -60
-KPX V icircumflex -20
-KPX V idieresis -20
-KPX V igrave -20
-KPX V imacron -20
-KPX V iogonek -60
-KPX V o -129
-KPX V oacute -129
-KPX V ocircumflex -129
-KPX V odieresis -89
-KPX V ograve -89
-KPX V ohungarumlaut -129
-KPX V omacron -89
-KPX V oslash -129
-KPX V otilde -89
-KPX V period -129
-KPX V semicolon -74
-KPX V u -75
-KPX V uacute -75
-KPX V ucircumflex -75
-KPX V udieresis -75
-KPX V ugrave -75
-KPX V uhungarumlaut -75
-KPX V umacron -75
-KPX V uogonek -75
-KPX V uring -75
-KPX W A -120
-KPX W Aacute -120
-KPX W Abreve -120
-KPX W Acircumflex -120
-KPX W Adieresis -120
-KPX W Agrave -120
-KPX W Amacron -120
-KPX W Aogonek -120
-KPX W Aring -120
-KPX W Atilde -120
-KPX W O -10
-KPX W Oacute -10
-KPX W Ocircumflex -10
-KPX W Odieresis -10
-KPX W Ograve -10
-KPX W Ohungarumlaut -10
-KPX W Omacron -10
-KPX W Oslash -10
-KPX W Otilde -10
-KPX W a -80
-KPX W aacute -80
-KPX W abreve -80
-KPX W acircumflex -80
-KPX W adieresis -80
-KPX W agrave -80
-KPX W amacron -80
-KPX W aogonek -80
-KPX W aring -80
-KPX W atilde -80
-KPX W colon -37
-KPX W comma -92
-KPX W e -80
-KPX W eacute -80
-KPX W ecaron -80
-KPX W ecircumflex -80
-KPX W edieresis -40
-KPX W edotaccent -80
-KPX W egrave -40
-KPX W emacron -40
-KPX W eogonek -80
-KPX W hyphen -65
-KPX W i -40
-KPX W iacute -40
-KPX W iogonek -40
-KPX W o -80
-KPX W oacute -80
-KPX W ocircumflex -80
-KPX W odieresis -80
-KPX W ograve -80
-KPX W ohungarumlaut -80
-KPX W omacron -80
-KPX W oslash -80
-KPX W otilde -80
-KPX W period -92
-KPX W semicolon -37
-KPX W u -50
-KPX W uacute -50
-KPX W ucircumflex -50
-KPX W udieresis -50
-KPX W ugrave -50
-KPX W uhungarumlaut -50
-KPX W umacron -50
-KPX W uogonek -50
-KPX W uring -50
-KPX W y -73
-KPX W yacute -73
-KPX W ydieresis -73
-KPX Y A -120
-KPX Y Aacute -120
-KPX Y Abreve -120
-KPX Y Acircumflex -120
-KPX Y Adieresis -120
-KPX Y Agrave -120
-KPX Y Amacron -120
-KPX Y Aogonek -120
-KPX Y Aring -120
-KPX Y Atilde -120
-KPX Y O -30
-KPX Y Oacute -30
-KPX Y Ocircumflex -30
-KPX Y Odieresis -30
-KPX Y Ograve -30
-KPX Y Ohungarumlaut -30
-KPX Y Omacron -30
-KPX Y Oslash -30
-KPX Y Otilde -30
-KPX Y a -100
-KPX Y aacute -100
-KPX Y abreve -100
-KPX Y acircumflex -100
-KPX Y adieresis -60
-KPX Y agrave -60
-KPX Y amacron -60
-KPX Y aogonek -100
-KPX Y aring -100
-KPX Y atilde -60
-KPX Y colon -92
-KPX Y comma -129
-KPX Y e -100
-KPX Y eacute -100
-KPX Y ecaron -100
-KPX Y ecircumflex -100
-KPX Y edieresis -60
-KPX Y edotaccent -100
-KPX Y egrave -60
-KPX Y emacron -60
-KPX Y eogonek -100
-KPX Y hyphen -111
-KPX Y i -55
-KPX Y iacute -55
-KPX Y iogonek -55
-KPX Y o -110
-KPX Y oacute -110
-KPX Y ocircumflex -110
-KPX Y odieresis -70
-KPX Y ograve -70
-KPX Y ohungarumlaut -110
-KPX Y omacron -70
-KPX Y oslash -110
-KPX Y otilde -70
-KPX Y period -129
-KPX Y semicolon -92
-KPX Y u -111
-KPX Y uacute -111
-KPX Y ucircumflex -111
-KPX Y udieresis -71
-KPX Y ugrave -71
-KPX Y uhungarumlaut -111
-KPX Y umacron -71
-KPX Y uogonek -111
-KPX Y uring -111
-KPX Yacute A -120
-KPX Yacute Aacute -120
-KPX Yacute Abreve -120
-KPX Yacute Acircumflex -120
-KPX Yacute Adieresis -120
-KPX Yacute Agrave -120
-KPX Yacute Amacron -120
-KPX Yacute Aogonek -120
-KPX Yacute Aring -120
-KPX Yacute Atilde -120
-KPX Yacute O -30
-KPX Yacute Oacute -30
-KPX Yacute Ocircumflex -30
-KPX Yacute Odieresis -30
-KPX Yacute Ograve -30
-KPX Yacute Ohungarumlaut -30
-KPX Yacute Omacron -30
-KPX Yacute Oslash -30
-KPX Yacute Otilde -30
-KPX Yacute a -100
-KPX Yacute aacute -100
-KPX Yacute abreve -100
-KPX Yacute acircumflex -100
-KPX Yacute adieresis -60
-KPX Yacute agrave -60
-KPX Yacute amacron -60
-KPX Yacute aogonek -100
-KPX Yacute aring -100
-KPX Yacute atilde -60
-KPX Yacute colon -92
-KPX Yacute comma -129
-KPX Yacute e -100
-KPX Yacute eacute -100
-KPX Yacute ecaron -100
-KPX Yacute ecircumflex -100
-KPX Yacute edieresis -60
-KPX Yacute edotaccent -100
-KPX Yacute egrave -60
-KPX Yacute emacron -60
-KPX Yacute eogonek -100
-KPX Yacute hyphen -111
-KPX Yacute i -55
-KPX Yacute iacute -55
-KPX Yacute iogonek -55
-KPX Yacute o -110
-KPX Yacute oacute -110
-KPX Yacute ocircumflex -110
-KPX Yacute odieresis -70
-KPX Yacute ograve -70
-KPX Yacute ohungarumlaut -110
-KPX Yacute omacron -70
-KPX Yacute oslash -110
-KPX Yacute otilde -70
-KPX Yacute period -129
-KPX Yacute semicolon -92
-KPX Yacute u -111
-KPX Yacute uacute -111
-KPX Yacute ucircumflex -111
-KPX Yacute udieresis -71
-KPX Yacute ugrave -71
-KPX Yacute uhungarumlaut -111
-KPX Yacute umacron -71
-KPX Yacute uogonek -111
-KPX Yacute uring -111
-KPX Ydieresis A -120
-KPX Ydieresis Aacute -120
-KPX Ydieresis Abreve -120
-KPX Ydieresis Acircumflex -120
-KPX Ydieresis Adieresis -120
-KPX Ydieresis Agrave -120
-KPX Ydieresis Amacron -120
-KPX Ydieresis Aogonek -120
-KPX Ydieresis Aring -120
-KPX Ydieresis Atilde -120
-KPX Ydieresis O -30
-KPX Ydieresis Oacute -30
-KPX Ydieresis Ocircumflex -30
-KPX Ydieresis Odieresis -30
-KPX Ydieresis Ograve -30
-KPX Ydieresis Ohungarumlaut -30
-KPX Ydieresis Omacron -30
-KPX Ydieresis Oslash -30
-KPX Ydieresis Otilde -30
-KPX Ydieresis a -100
-KPX Ydieresis aacute -100
-KPX Ydieresis abreve -100
-KPX Ydieresis acircumflex -100
-KPX Ydieresis adieresis -60
-KPX Ydieresis agrave -60
-KPX Ydieresis amacron -60
-KPX Ydieresis aogonek -100
-KPX Ydieresis aring -100
-KPX Ydieresis atilde -100
-KPX Ydieresis colon -92
-KPX Ydieresis comma -129
-KPX Ydieresis e -100
-KPX Ydieresis eacute -100
-KPX Ydieresis ecaron -100
-KPX Ydieresis ecircumflex -100
-KPX Ydieresis edieresis -60
-KPX Ydieresis edotaccent -100
-KPX Ydieresis egrave -60
-KPX Ydieresis emacron -60
-KPX Ydieresis eogonek -100
-KPX Ydieresis hyphen -111
-KPX Ydieresis i -55
-KPX Ydieresis iacute -55
-KPX Ydieresis iogonek -55
-KPX Ydieresis o -110
-KPX Ydieresis oacute -110
-KPX Ydieresis ocircumflex -110
-KPX Ydieresis odieresis -70
-KPX Ydieresis ograve -70
-KPX Ydieresis ohungarumlaut -110
-KPX Ydieresis omacron -70
-KPX Ydieresis oslash -110
-KPX Ydieresis otilde -70
-KPX Ydieresis period -129
-KPX Ydieresis semicolon -92
-KPX Ydieresis u -111
-KPX Ydieresis uacute -111
-KPX Ydieresis ucircumflex -111
-KPX Ydieresis udieresis -71
-KPX Ydieresis ugrave -71
-KPX Ydieresis uhungarumlaut -111
-KPX Ydieresis umacron -71
-KPX Ydieresis uogonek -111
-KPX Ydieresis uring -111
-KPX a v -20
-KPX a w -15
-KPX aacute v -20
-KPX aacute w -15
-KPX abreve v -20
-KPX abreve w -15
-KPX acircumflex v -20
-KPX acircumflex w -15
-KPX adieresis v -20
-KPX adieresis w -15
-KPX agrave v -20
-KPX agrave w -15
-KPX amacron v -20
-KPX amacron w -15
-KPX aogonek v -20
-KPX aogonek w -15
-KPX aring v -20
-KPX aring w -15
-KPX atilde v -20
-KPX atilde w -15
-KPX b period -40
-KPX b u -20
-KPX b uacute -20
-KPX b ucircumflex -20
-KPX b udieresis -20
-KPX b ugrave -20
-KPX b uhungarumlaut -20
-KPX b umacron -20
-KPX b uogonek -20
-KPX b uring -20
-KPX b v -15
-KPX c y -15
-KPX c yacute -15
-KPX c ydieresis -15
-KPX cacute y -15
-KPX cacute yacute -15
-KPX cacute ydieresis -15
-KPX ccaron y -15
-KPX ccaron yacute -15
-KPX ccaron ydieresis -15
-KPX ccedilla y -15
-KPX ccedilla yacute -15
-KPX ccedilla ydieresis -15
-KPX comma quotedblright -70
-KPX comma quoteright -70
-KPX e g -15
-KPX e gbreve -15
-KPX e gcommaaccent -15
-KPX e v -25
-KPX e w -25
-KPX e x -15
-KPX e y -15
-KPX e yacute -15
-KPX e ydieresis -15
-KPX eacute g -15
-KPX eacute gbreve -15
-KPX eacute gcommaaccent -15
-KPX eacute v -25
-KPX eacute w -25
-KPX eacute x -15
-KPX eacute y -15
-KPX eacute yacute -15
-KPX eacute ydieresis -15
-KPX ecaron g -15
-KPX ecaron gbreve -15
-KPX ecaron gcommaaccent -15
-KPX ecaron v -25
-KPX ecaron w -25
-KPX ecaron x -15
-KPX ecaron y -15
-KPX ecaron yacute -15
-KPX ecaron ydieresis -15
-KPX ecircumflex g -15
-KPX ecircumflex gbreve -15
-KPX ecircumflex gcommaaccent -15
-KPX ecircumflex v -25
-KPX ecircumflex w -25
-KPX ecircumflex x -15
-KPX ecircumflex y -15
-KPX ecircumflex yacute -15
-KPX ecircumflex ydieresis -15
-KPX edieresis g -15
-KPX edieresis gbreve -15
-KPX edieresis gcommaaccent -15
-KPX edieresis v -25
-KPX edieresis w -25
-KPX edieresis x -15
-KPX edieresis y -15
-KPX edieresis yacute -15
-KPX edieresis ydieresis -15
-KPX edotaccent g -15
-KPX edotaccent gbreve -15
-KPX edotaccent gcommaaccent -15
-KPX edotaccent v -25
-KPX edotaccent w -25
-KPX edotaccent x -15
-KPX edotaccent y -15
-KPX edotaccent yacute -15
-KPX edotaccent ydieresis -15
-KPX egrave g -15
-KPX egrave gbreve -15
-KPX egrave gcommaaccent -15
-KPX egrave v -25
-KPX egrave w -25
-KPX egrave x -15
-KPX egrave y -15
-KPX egrave yacute -15
-KPX egrave ydieresis -15
-KPX emacron g -15
-KPX emacron gbreve -15
-KPX emacron gcommaaccent -15
-KPX emacron v -25
-KPX emacron w -25
-KPX emacron x -15
-KPX emacron y -15
-KPX emacron yacute -15
-KPX emacron ydieresis -15
-KPX eogonek g -15
-KPX eogonek gbreve -15
-KPX eogonek gcommaaccent -15
-KPX eogonek v -25
-KPX eogonek w -25
-KPX eogonek x -15
-KPX eogonek y -15
-KPX eogonek yacute -15
-KPX eogonek ydieresis -15
-KPX f a -10
-KPX f aacute -10
-KPX f abreve -10
-KPX f acircumflex -10
-KPX f adieresis -10
-KPX f agrave -10
-KPX f amacron -10
-KPX f aogonek -10
-KPX f aring -10
-KPX f atilde -10
-KPX f dotlessi -50
-KPX f f -25
-KPX f i -20
-KPX f iacute -20
-KPX f quoteright 55
-KPX g a -5
-KPX g aacute -5
-KPX g abreve -5
-KPX g acircumflex -5
-KPX g adieresis -5
-KPX g agrave -5
-KPX g amacron -5
-KPX g aogonek -5
-KPX g aring -5
-KPX g atilde -5
-KPX gbreve a -5
-KPX gbreve aacute -5
-KPX gbreve abreve -5
-KPX gbreve acircumflex -5
-KPX gbreve adieresis -5
-KPX gbreve agrave -5
-KPX gbreve amacron -5
-KPX gbreve aogonek -5
-KPX gbreve aring -5
-KPX gbreve atilde -5
-KPX gcommaaccent a -5
-KPX gcommaaccent aacute -5
-KPX gcommaaccent abreve -5
-KPX gcommaaccent acircumflex -5
-KPX gcommaaccent adieresis -5
-KPX gcommaaccent agrave -5
-KPX gcommaaccent amacron -5
-KPX gcommaaccent aogonek -5
-KPX gcommaaccent aring -5
-KPX gcommaaccent atilde -5
-KPX h y -5
-KPX h yacute -5
-KPX h ydieresis -5
-KPX i v -25
-KPX iacute v -25
-KPX icircumflex v -25
-KPX idieresis v -25
-KPX igrave v -25
-KPX imacron v -25
-KPX iogonek v -25
-KPX k e -10
-KPX k eacute -10
-KPX k ecaron -10
-KPX k ecircumflex -10
-KPX k edieresis -10
-KPX k edotaccent -10
-KPX k egrave -10
-KPX k emacron -10
-KPX k eogonek -10
-KPX k o -10
-KPX k oacute -10
-KPX k ocircumflex -10
-KPX k odieresis -10
-KPX k ograve -10
-KPX k ohungarumlaut -10
-KPX k omacron -10
-KPX k oslash -10
-KPX k otilde -10
-KPX k y -15
-KPX k yacute -15
-KPX k ydieresis -15
-KPX kcommaaccent e -10
-KPX kcommaaccent eacute -10
-KPX kcommaaccent ecaron -10
-KPX kcommaaccent ecircumflex -10
-KPX kcommaaccent edieresis -10
-KPX kcommaaccent edotaccent -10
-KPX kcommaaccent egrave -10
-KPX kcommaaccent emacron -10
-KPX kcommaaccent eogonek -10
-KPX kcommaaccent o -10
-KPX kcommaaccent oacute -10
-KPX kcommaaccent ocircumflex -10
-KPX kcommaaccent odieresis -10
-KPX kcommaaccent ograve -10
-KPX kcommaaccent ohungarumlaut -10
-KPX kcommaaccent omacron -10
-KPX kcommaaccent oslash -10
-KPX kcommaaccent otilde -10
-KPX kcommaaccent y -15
-KPX kcommaaccent yacute -15
-KPX kcommaaccent ydieresis -15
-KPX l w -10
-KPX lacute w -10
-KPX lcommaaccent w -10
-KPX lslash w -10
-KPX n v -40
-KPX n y -15
-KPX n yacute -15
-KPX n ydieresis -15
-KPX nacute v -40
-KPX nacute y -15
-KPX nacute yacute -15
-KPX nacute ydieresis -15
-KPX ncaron v -40
-KPX ncaron y -15
-KPX ncaron yacute -15
-KPX ncaron ydieresis -15
-KPX ncommaaccent v -40
-KPX ncommaaccent y -15
-KPX ncommaaccent yacute -15
-KPX ncommaaccent ydieresis -15
-KPX ntilde v -40
-KPX ntilde y -15
-KPX ntilde yacute -15
-KPX ntilde ydieresis -15
-KPX o v -15
-KPX o w -25
-KPX o y -10
-KPX o yacute -10
-KPX o ydieresis -10
-KPX oacute v -15
-KPX oacute w -25
-KPX oacute y -10
-KPX oacute yacute -10
-KPX oacute ydieresis -10
-KPX ocircumflex v -15
-KPX ocircumflex w -25
-KPX ocircumflex y -10
-KPX ocircumflex yacute -10
-KPX ocircumflex ydieresis -10
-KPX odieresis v -15
-KPX odieresis w -25
-KPX odieresis y -10
-KPX odieresis yacute -10
-KPX odieresis ydieresis -10
-KPX ograve v -15
-KPX ograve w -25
-KPX ograve y -10
-KPX ograve yacute -10
-KPX ograve ydieresis -10
-KPX ohungarumlaut v -15
-KPX ohungarumlaut w -25
-KPX ohungarumlaut y -10
-KPX ohungarumlaut yacute -10
-KPX ohungarumlaut ydieresis -10
-KPX omacron v -15
-KPX omacron w -25
-KPX omacron y -10
-KPX omacron yacute -10
-KPX omacron ydieresis -10
-KPX oslash v -15
-KPX oslash w -25
-KPX oslash y -10
-KPX oslash yacute -10
-KPX oslash ydieresis -10
-KPX otilde v -15
-KPX otilde w -25
-KPX otilde y -10
-KPX otilde yacute -10
-KPX otilde ydieresis -10
-KPX p y -10
-KPX p yacute -10
-KPX p ydieresis -10
-KPX period quotedblright -70
-KPX period quoteright -70
-KPX quotedblleft A -80
-KPX quotedblleft Aacute -80
-KPX quotedblleft Abreve -80
-KPX quotedblleft Acircumflex -80
-KPX quotedblleft Adieresis -80
-KPX quotedblleft Agrave -80
-KPX quotedblleft Amacron -80
-KPX quotedblleft Aogonek -80
-KPX quotedblleft Aring -80
-KPX quotedblleft Atilde -80
-KPX quoteleft A -80
-KPX quoteleft Aacute -80
-KPX quoteleft Abreve -80
-KPX quoteleft Acircumflex -80
-KPX quoteleft Adieresis -80
-KPX quoteleft Agrave -80
-KPX quoteleft Amacron -80
-KPX quoteleft Aogonek -80
-KPX quoteleft Aring -80
-KPX quoteleft Atilde -80
-KPX quoteleft quoteleft -74
-KPX quoteright d -50
-KPX quoteright dcroat -50
-KPX quoteright l -10
-KPX quoteright lacute -10
-KPX quoteright lcommaaccent -10
-KPX quoteright lslash -10
-KPX quoteright quoteright -74
-KPX quoteright r -50
-KPX quoteright racute -50
-KPX quoteright rcaron -50
-KPX quoteright rcommaaccent -50
-KPX quoteright s -55
-KPX quoteright sacute -55
-KPX quoteright scaron -55
-KPX quoteright scedilla -55
-KPX quoteright scommaaccent -55
-KPX quoteright space -74
-KPX quoteright t -18
-KPX quoteright tcommaaccent -18
-KPX quoteright v -50
-KPX r comma -40
-KPX r g -18
-KPX r gbreve -18
-KPX r gcommaaccent -18
-KPX r hyphen -20
-KPX r period -55
-KPX racute comma -40
-KPX racute g -18
-KPX racute gbreve -18
-KPX racute gcommaaccent -18
-KPX racute hyphen -20
-KPX racute period -55
-KPX rcaron comma -40
-KPX rcaron g -18
-KPX rcaron gbreve -18
-KPX rcaron gcommaaccent -18
-KPX rcaron hyphen -20
-KPX rcaron period -55
-KPX rcommaaccent comma -40
-KPX rcommaaccent g -18
-KPX rcommaaccent gbreve -18
-KPX rcommaaccent gcommaaccent -18
-KPX rcommaaccent hyphen -20
-KPX rcommaaccent period -55
-KPX space A -55
-KPX space Aacute -55
-KPX space Abreve -55
-KPX space Acircumflex -55
-KPX space Adieresis -55
-KPX space Agrave -55
-KPX space Amacron -55
-KPX space Aogonek -55
-KPX space Aring -55
-KPX space Atilde -55
-KPX space T -18
-KPX space Tcaron -18
-KPX space Tcommaaccent -18
-KPX space V -50
-KPX space W -30
-KPX space Y -90
-KPX space Yacute -90
-KPX space Ydieresis -90
-KPX v a -25
-KPX v aacute -25
-KPX v abreve -25
-KPX v acircumflex -25
-KPX v adieresis -25
-KPX v agrave -25
-KPX v amacron -25
-KPX v aogonek -25
-KPX v aring -25
-KPX v atilde -25
-KPX v comma -65
-KPX v e -15
-KPX v eacute -15
-KPX v ecaron -15
-KPX v ecircumflex -15
-KPX v edieresis -15
-KPX v edotaccent -15
-KPX v egrave -15
-KPX v emacron -15
-KPX v eogonek -15
-KPX v o -20
-KPX v oacute -20
-KPX v ocircumflex -20
-KPX v odieresis -20
-KPX v ograve -20
-KPX v ohungarumlaut -20
-KPX v omacron -20
-KPX v oslash -20
-KPX v otilde -20
-KPX v period -65
-KPX w a -10
-KPX w aacute -10
-KPX w abreve -10
-KPX w acircumflex -10
-KPX w adieresis -10
-KPX w agrave -10
-KPX w amacron -10
-KPX w aogonek -10
-KPX w aring -10
-KPX w atilde -10
-KPX w comma -65
-KPX w o -10
-KPX w oacute -10
-KPX w ocircumflex -10
-KPX w odieresis -10
-KPX w ograve -10
-KPX w ohungarumlaut -10
-KPX w omacron -10
-KPX w oslash -10
-KPX w otilde -10
-KPX w period -65
-KPX x e -15
-KPX x eacute -15
-KPX x ecaron -15
-KPX x ecircumflex -15
-KPX x edieresis -15
-KPX x edotaccent -15
-KPX x egrave -15
-KPX x emacron -15
-KPX x eogonek -15
-KPX y comma -65
-KPX y period -65
-KPX yacute comma -65
-KPX yacute period -65
-KPX ydieresis comma -65
-KPX ydieresis period -65
-EndKernPairs
-EndKernData
-EndFontMetrics
-
diff --git a/LibrarySource/com/lowagie/text/pdf/fonts/ZapfDingbats.afm b/LibrarySource/com/lowagie/text/pdf/fonts/ZapfDingbats.afm
deleted file mode 100644
index 430e6ff..0000000
--- a/LibrarySource/com/lowagie/text/pdf/fonts/ZapfDingbats.afm
+++ /dev/null
@@ -1,226 +0,0 @@
-StartFontMetrics 4.1
-Comment Copyright (c) 1985, 1987, 1988, 1989, 1997 Adobe Systems Incorporated. All Rights Reserved.
-Comment Creation Date: Thu May 1 15:14:13 1997
-Comment UniqueID 43082
-Comment VMusage 45775 55535
-FontName ZapfDingbats
-FullName ITC Zapf Dingbats
-FamilyName ZapfDingbats
-Weight Medium
-ItalicAngle 0
-IsFixedPitch false
-CharacterSet Special
-FontBBox -1 -143 981 820
-UnderlinePosition -100
-UnderlineThickness 50
-Version 002.000
-Notice Copyright (c) 1985, 1987, 1988, 1989, 1997 Adobe Systems Incorporated. All Rights Reserved.ITC Zapf Dingbats is a registered trademark of International Typeface Corporation.
-EncodingScheme FontSpecific
-StdHW 28
-StdVW 90
-StartCharMetrics 202
-C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
-C 33 ; WX 974 ; N a1 ; B 35 72 939 621 ;
-C 34 ; WX 961 ; N a2 ; B 35 81 927 611 ;
-C 35 ; WX 974 ; N a202 ; B 35 72 939 621 ;
-C 36 ; WX 980 ; N a3 ; B 35 0 945 692 ;
-C 37 ; WX 719 ; N a4 ; B 34 139 685 566 ;
-C 38 ; WX 789 ; N a5 ; B 35 -14 755 705 ;
-C 39 ; WX 790 ; N a119 ; B 35 -14 755 705 ;
-C 40 ; WX 791 ; N a118 ; B 35 -13 761 705 ;
-C 41 ; WX 690 ; N a117 ; B 34 138 655 553 ;
-C 42 ; WX 960 ; N a11 ; B 35 123 925 568 ;
-C 43 ; WX 939 ; N a12 ; B 35 134 904 559 ;
-C 44 ; WX 549 ; N a13 ; B 29 -11 516 705 ;
-C 45 ; WX 855 ; N a14 ; B 34 59 820 632 ;
-C 46 ; WX 911 ; N a15 ; B 35 50 876 642 ;
-C 47 ; WX 933 ; N a16 ; B 35 139 899 550 ;
-C 48 ; WX 911 ; N a105 ; B 35 50 876 642 ;
-C 49 ; WX 945 ; N a17 ; B 35 139 909 553 ;
-C 50 ; WX 974 ; N a18 ; B 35 104 938 587 ;
-C 51 ; WX 755 ; N a19 ; B 34 -13 721 705 ;
-C 52 ; WX 846 ; N a20 ; B 36 -14 811 705 ;
-C 53 ; WX 762 ; N a21 ; B 35 0 727 692 ;
-C 54 ; WX 761 ; N a22 ; B 35 0 727 692 ;
-C 55 ; WX 571 ; N a23 ; B -1 -68 571 661 ;
-C 56 ; WX 677 ; N a24 ; B 36 -13 642 705 ;
-C 57 ; WX 763 ; N a25 ; B 35 0 728 692 ;
-C 58 ; WX 760 ; N a26 ; B 35 0 726 692 ;
-C 59 ; WX 759 ; N a27 ; B 35 0 725 692 ;
-C 60 ; WX 754 ; N a28 ; B 35 0 720 692 ;
-C 61 ; WX 494 ; N a6 ; B 35 0 460 692 ;
-C 62 ; WX 552 ; N a7 ; B 35 0 517 692 ;
-C 63 ; WX 537 ; N a8 ; B 35 0 503 692 ;
-C 64 ; WX 577 ; N a9 ; B 35 96 542 596 ;
-C 65 ; WX 692 ; N a10 ; B 35 -14 657 705 ;
-C 66 ; WX 786 ; N a29 ; B 35 -14 751 705 ;
-C 67 ; WX 788 ; N a30 ; B 35 -14 752 705 ;
-C 68 ; WX 788 ; N a31 ; B 35 -14 753 705 ;
-C 69 ; WX 790 ; N a32 ; B 35 -14 756 705 ;
-C 70 ; WX 793 ; N a33 ; B 35 -13 759 705 ;
-C 71 ; WX 794 ; N a34 ; B 35 -13 759 705 ;
-C 72 ; WX 816 ; N a35 ; B 35 -14 782 705 ;
-C 73 ; WX 823 ; N a36 ; B 35 -14 787 705 ;
-C 74 ; WX 789 ; N a37 ; B 35 -14 754 705 ;
-C 75 ; WX 841 ; N a38 ; B 35 -14 807 705 ;
-C 76 ; WX 823 ; N a39 ; B 35 -14 789 705 ;
-C 77 ; WX 833 ; N a40 ; B 35 -14 798 705 ;
-C 78 ; WX 816 ; N a41 ; B 35 -13 782 705 ;
-C 79 ; WX 831 ; N a42 ; B 35 -14 796 705 ;
-C 80 ; WX 923 ; N a43 ; B 35 -14 888 705 ;
-C 81 ; WX 744 ; N a44 ; B 35 0 710 692 ;
-C 82 ; WX 723 ; N a45 ; B 35 0 688 692 ;
-C 83 ; WX 749 ; N a46 ; B 35 0 714 692 ;
-C 84 ; WX 790 ; N a47 ; B 34 -14 756 705 ;
-C 85 ; WX 792 ; N a48 ; B 35 -14 758 705 ;
-C 86 ; WX 695 ; N a49 ; B 35 -14 661 706 ;
-C 87 ; WX 776 ; N a50 ; B 35 -6 741 699 ;
-C 88 ; WX 768 ; N a51 ; B 35 -7 734 699 ;
-C 89 ; WX 792 ; N a52 ; B 35 -14 757 705 ;
-C 90 ; WX 759 ; N a53 ; B 35 0 725 692 ;
-C 91 ; WX 707 ; N a54 ; B 35 -13 672 704 ;
-C 92 ; WX 708 ; N a55 ; B 35 -14 672 705 ;
-C 93 ; WX 682 ; N a56 ; B 35 -14 647 705 ;
-C 94 ; WX 701 ; N a57 ; B 35 -14 666 705 ;
-C 95 ; WX 826 ; N a58 ; B 35 -14 791 705 ;
-C 96 ; WX 815 ; N a59 ; B 35 -14 780 705 ;
-C 97 ; WX 789 ; N a60 ; B 35 -14 754 705 ;
-C 98 ; WX 789 ; N a61 ; B 35 -14 754 705 ;
-C 99 ; WX 707 ; N a62 ; B 34 -14 673 705 ;
-C 100 ; WX 687 ; N a63 ; B 36 0 651 692 ;
-C 101 ; WX 696 ; N a64 ; B 35 0 661 691 ;
-C 102 ; WX 689 ; N a65 ; B 35 0 655 692 ;
-C 103 ; WX 786 ; N a66 ; B 34 -14 751 705 ;
-C 104 ; WX 787 ; N a67 ; B 35 -14 752 705 ;
-C 105 ; WX 713 ; N a68 ; B 35 -14 678 705 ;
-C 106 ; WX 791 ; N a69 ; B 35 -14 756 705 ;
-C 107 ; WX 785 ; N a70 ; B 36 -14 751 705 ;
-C 108 ; WX 791 ; N a71 ; B 35 -14 757 705 ;
-C 109 ; WX 873 ; N a72 ; B 35 -14 838 705 ;
-C 110 ; WX 761 ; N a73 ; B 35 0 726 692 ;
-C 111 ; WX 762 ; N a74 ; B 35 0 727 692 ;
-C 112 ; WX 762 ; N a203 ; B 35 0 727 692 ;
-C 113 ; WX 759 ; N a75 ; B 35 0 725 692 ;
-C 114 ; WX 759 ; N a204 ; B 35 0 725 692 ;
-C 115 ; WX 892 ; N a76 ; B 35 0 858 705 ;
-C 116 ; WX 892 ; N a77 ; B 35 -14 858 692 ;
-C 117 ; WX 788 ; N a78 ; B 35 -14 754 705 ;
-C 118 ; WX 784 ; N a79 ; B 35 -14 749 705 ;
-C 119 ; WX 438 ; N a81 ; B 35 -14 403 705 ;
-C 120 ; WX 138 ; N a82 ; B 35 0 104 692 ;
-C 121 ; WX 277 ; N a83 ; B 35 0 242 692 ;
-C 122 ; WX 415 ; N a84 ; B 35 0 380 692 ;
-C 123 ; WX 392 ; N a97 ; B 35 263 357 705 ;
-C 124 ; WX 392 ; N a98 ; B 34 263 357 705 ;
-C 125 ; WX 668 ; N a99 ; B 35 263 633 705 ;
-C 126 ; WX 668 ; N a100 ; B 36 263 634 705 ;
-C 128 ; WX 390 ; N a89 ; B 35 -14 356 705 ;
-C 129 ; WX 390 ; N a90 ; B 35 -14 355 705 ;
-C 130 ; WX 317 ; N a93 ; B 35 0 283 692 ;
-C 131 ; WX 317 ; N a94 ; B 35 0 283 692 ;
-C 132 ; WX 276 ; N a91 ; B 35 0 242 692 ;
-C 133 ; WX 276 ; N a92 ; B 35 0 242 692 ;
-C 134 ; WX 509 ; N a205 ; B 35 0 475 692 ;
-C 135 ; WX 509 ; N a85 ; B 35 0 475 692 ;
-C 136 ; WX 410 ; N a206 ; B 35 0 375 692 ;
-C 137 ; WX 410 ; N a86 ; B 35 0 375 692 ;
-C 138 ; WX 234 ; N a87 ; B 35 -14 199 705 ;
-C 139 ; WX 234 ; N a88 ; B 35 -14 199 705 ;
-C 140 ; WX 334 ; N a95 ; B 35 0 299 692 ;
-C 141 ; WX 334 ; N a96 ; B 35 0 299 692 ;
-C 161 ; WX 732 ; N a101 ; B 35 -143 697 806 ;
-C 162 ; WX 544 ; N a102 ; B 56 -14 488 706 ;
-C 163 ; WX 544 ; N a103 ; B 34 -14 508 705 ;
-C 164 ; WX 910 ; N a104 ; B 35 40 875 651 ;
-C 165 ; WX 667 ; N a106 ; B 35 -14 633 705 ;
-C 166 ; WX 760 ; N a107 ; B 35 -14 726 705 ;
-C 167 ; WX 760 ; N a108 ; B 0 121 758 569 ;
-C 168 ; WX 776 ; N a112 ; B 35 0 741 705 ;
-C 169 ; WX 595 ; N a111 ; B 34 -14 560 705 ;
-C 170 ; WX 694 ; N a110 ; B 35 -14 659 705 ;
-C 171 ; WX 626 ; N a109 ; B 34 0 591 705 ;
-C 172 ; WX 788 ; N a120 ; B 35 -14 754 705 ;
-C 173 ; WX 788 ; N a121 ; B 35 -14 754 705 ;
-C 174 ; WX 788 ; N a122 ; B 35 -14 754 705 ;
-C 175 ; WX 788 ; N a123 ; B 35 -14 754 705 ;
-C 176 ; WX 788 ; N a124 ; B 35 -14 754 705 ;
-C 177 ; WX 788 ; N a125 ; B 35 -14 754 705 ;
-C 178 ; WX 788 ; N a126 ; B 35 -14 754 705 ;
-C 179 ; WX 788 ; N a127 ; B 35 -14 754 705 ;
-C 180 ; WX 788 ; N a128 ; B 35 -14 754 705 ;
-C 181 ; WX 788 ; N a129 ; B 35 -14 754 705 ;
-C 182 ; WX 788 ; N a130 ; B 35 -14 754 705 ;
-C 183 ; WX 788 ; N a131 ; B 35 -14 754 705 ;
-C 184 ; WX 788 ; N a132 ; B 35 -14 754 705 ;
-C 185 ; WX 788 ; N a133 ; B 35 -14 754 705 ;
-C 186 ; WX 788 ; N a134 ; B 35 -14 754 705 ;
-C 187 ; WX 788 ; N a135 ; B 35 -14 754 705 ;
-C 188 ; WX 788 ; N a136 ; B 35 -14 754 705 ;
-C 189 ; WX 788 ; N a137 ; B 35 -14 754 705 ;
-C 190 ; WX 788 ; N a138 ; B 35 -14 754 705 ;
-C 191 ; WX 788 ; N a139 ; B 35 -14 754 705 ;
-C 192 ; WX 788 ; N a140 ; B 35 -14 754 705 ;
-C 193 ; WX 788 ; N a141 ; B 35 -14 754 705 ;
-C 194 ; WX 788 ; N a142 ; B 35 -14 754 705 ;
-C 195 ; WX 788 ; N a143 ; B 35 -14 754 705 ;
-C 196 ; WX 788 ; N a144 ; B 35 -14 754 705 ;
-C 197 ; WX 788 ; N a145 ; B 35 -14 754 705 ;
-C 198 ; WX 788 ; N a146 ; B 35 -14 754 705 ;
-C 199 ; WX 788 ; N a147 ; B 35 -14 754 705 ;
-C 200 ; WX 788 ; N a148 ; B 35 -14 754 705 ;
-C 201 ; WX 788 ; N a149 ; B 35 -14 754 705 ;
-C 202 ; WX 788 ; N a150 ; B 35 -14 754 705 ;
-C 203 ; WX 788 ; N a151 ; B 35 -14 754 705 ;
-C 204 ; WX 788 ; N a152 ; B 35 -14 754 705 ;
-C 205 ; WX 788 ; N a153 ; B 35 -14 754 705 ;
-C 206 ; WX 788 ; N a154 ; B 35 -14 754 705 ;
-C 207 ; WX 788 ; N a155 ; B 35 -14 754 705 ;
-C 208 ; WX 788 ; N a156 ; B 35 -14 754 705 ;
-C 209 ; WX 788 ; N a157 ; B 35 -14 754 705 ;
-C 210 ; WX 788 ; N a158 ; B 35 -14 754 705 ;
-C 211 ; WX 788 ; N a159 ; B 35 -14 754 705 ;
-C 212 ; WX 894 ; N a160 ; B 35 58 860 634 ;
-C 213 ; WX 838 ; N a161 ; B 35 152 803 540 ;
-C 214 ; WX 1016 ; N a163 ; B 34 152 981 540 ;
-C 215 ; WX 458 ; N a164 ; B 35 -127 422 820 ;
-C 216 ; WX 748 ; N a196 ; B 35 94 698 597 ;
-C 217 ; WX 924 ; N a165 ; B 35 140 890 552 ;
-C 218 ; WX 748 ; N a192 ; B 35 94 698 597 ;
-C 219 ; WX 918 ; N a166 ; B 35 166 884 526 ;
-C 220 ; WX 927 ; N a167 ; B 35 32 892 660 ;
-C 221 ; WX 928 ; N a168 ; B 35 129 891 562 ;
-C 222 ; WX 928 ; N a169 ; B 35 128 893 563 ;
-C 223 ; WX 834 ; N a170 ; B 35 155 799 537 ;
-C 224 ; WX 873 ; N a171 ; B 35 93 838 599 ;
-C 225 ; WX 828 ; N a172 ; B 35 104 791 588 ;
-C 226 ; WX 924 ; N a173 ; B 35 98 889 594 ;
-C 227 ; WX 924 ; N a162 ; B 35 98 889 594 ;
-C 228 ; WX 917 ; N a174 ; B 35 0 882 692 ;
-C 229 ; WX 930 ; N a175 ; B 35 84 896 608 ;
-C 230 ; WX 931 ; N a176 ; B 35 84 896 608 ;
-C 231 ; WX 463 ; N a177 ; B 35 -99 429 791 ;
-C 232 ; WX 883 ; N a178 ; B 35 71 848 623 ;
-C 233 ; WX 836 ; N a179 ; B 35 44 802 648 ;
-C 234 ; WX 836 ; N a193 ; B 35 44 802 648 ;
-C 235 ; WX 867 ; N a180 ; B 35 101 832 591 ;
-C 236 ; WX 867 ; N a199 ; B 35 101 832 591 ;
-C 237 ; WX 696 ; N a181 ; B 35 44 661 648 ;
-C 238 ; WX 696 ; N a200 ; B 35 44 661 648 ;
-C 239 ; WX 874 ; N a182 ; B 35 77 840 619 ;
-C 241 ; WX 874 ; N a201 ; B 35 73 840 615 ;
-C 242 ; WX 760 ; N a183 ; B 35 0 725 692 ;
-C 243 ; WX 946 ; N a184 ; B 35 160 911 533 ;
-C 244 ; WX 771 ; N a197 ; B 34 37 736 655 ;
-C 245 ; WX 865 ; N a185 ; B 35 207 830 481 ;
-C 246 ; WX 771 ; N a194 ; B 34 37 736 655 ;
-C 247 ; WX 888 ; N a198 ; B 34 -19 853 712 ;
-C 248 ; WX 967 ; N a186 ; B 35 124 932 568 ;
-C 249 ; WX 888 ; N a195 ; B 34 -19 853 712 ;
-C 250 ; WX 831 ; N a187 ; B 35 113 796 579 ;
-C 251 ; WX 873 ; N a188 ; B 36 118 838 578 ;
-C 252 ; WX 927 ; N a189 ; B 35 150 891 542 ;
-C 253 ; WX 970 ; N a190 ; B 35 76 931 616 ;
-C 254 ; WX 918 ; N a191 ; B 34 99 884 593 ;
-EndCharMetrics
-EndFontMetrics
-
diff --git a/LibrarySource/com/lowagie/text/pdf/hyphenation/ByteVector.java b/LibrarySource/com/lowagie/text/pdf/hyphenation/ByteVector.java
deleted file mode 100644
index 2ac6f83..0000000
--- a/LibrarySource/com/lowagie/text/pdf/hyphenation/ByteVector.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.lowagie.text.pdf.hyphenation;
-
-import java.io.Serializable;
-
-/**
- * This class implements a simple byte vector with access to the
- * underlying array.
- *
- * @author Carlos Villegas <cav at uniscope.co.jp>
- */
-public class ByteVector implements Serializable {
-
- /**
- * Capacity increment size
- */
- private static final int DEFAULT_BLOCK_SIZE = 2048;
- private int blockSize;
-
- /**
- * The encapsulated array
- */
- private byte[] array;
-
- /**
- * Points to next free item
- */
- private int n;
-
- public ByteVector() {
- this(DEFAULT_BLOCK_SIZE);
- }
-
- public ByteVector(int capacity) {
- if (capacity > 0) {
- blockSize = capacity;
- } else {
- blockSize = DEFAULT_BLOCK_SIZE;
- }
- array = new byte[blockSize];
- n = 0;
- }
-
- public ByteVector(byte[] a) {
- blockSize = DEFAULT_BLOCK_SIZE;
- array = a;
- n = 0;
- }
-
- public ByteVector(byte[] a, int capacity) {
- if (capacity > 0) {
- blockSize = capacity;
- } else {
- blockSize = DEFAULT_BLOCK_SIZE;
- }
- array = a;
- n = 0;
- }
-
- public byte[] getArray() {
- return array;
- }
-
- /**
- * return number of items in array
- */
- public int length() {
- return n;
- }
-
- /**
- * returns current capacity of array
- */
- public int capacity() {
- return array.length;
- }
-
- public void put(int index, byte val) {
- array[index] = val;
- }
-
- public byte get(int index) {
- return array[index];
- }
-
- /**
- * This is to implement memory allocation in the array. Like malloc().
- */
- public int alloc(int size) {
- int index = n;
- int len = array.length;
- if (n + size >= len) {
- byte[] aux = new byte[len + blockSize];
- System.arraycopy(array, 0, aux, 0, len);
- array = aux;
- }
- n += size;
- return index;
- }
-
- public void trimToSize() {
- if (n < array.length) {
- byte[] aux = new byte[n];
- System.arraycopy(array, 0, aux, 0, n);
- array = aux;
- }
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/hyphenation/CharVector.java b/LibrarySource/com/lowagie/text/pdf/hyphenation/CharVector.java
deleted file mode 100644
index a2f3c66..0000000
--- a/LibrarySource/com/lowagie/text/pdf/hyphenation/CharVector.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.lowagie.text.pdf.hyphenation;
-
-import java.io.Serializable;
-
-/**
- * This class implements a simple char vector with access to the
- * underlying array.
- *
- * @author Carlos Villegas <cav at uniscope.co.jp>
- */
-public class CharVector implements Cloneable, Serializable {
-
- /**
- * Capacity increment size
- */
- private static final int DEFAULT_BLOCK_SIZE = 2048;
- private int blockSize;
-
- /**
- * The encapsulated array
- */
- private char[] array;
-
- /**
- * Points to next free item
- */
- private int n;
-
- public CharVector() {
- this(DEFAULT_BLOCK_SIZE);
- }
-
- public CharVector(int capacity) {
- if (capacity > 0) {
- blockSize = capacity;
- } else {
- blockSize = DEFAULT_BLOCK_SIZE;
- }
- array = new char[blockSize];
- n = 0;
- }
-
- public CharVector(char[] a) {
- blockSize = DEFAULT_BLOCK_SIZE;
- array = a;
- n = a.length;
- }
-
- public CharVector(char[] a, int capacity) {
- if (capacity > 0) {
- blockSize = capacity;
- } else {
- blockSize = DEFAULT_BLOCK_SIZE;
- }
- array = a;
- n = a.length;
- }
-
- /**
- * Reset Vector but don't resize or clear elements
- */
- public void clear() {
- n = 0;
- }
-
- public Object clone() {
- CharVector cv = new CharVector((char[])array.clone(), blockSize);
- cv.n = this.n;
- return cv;
- }
-
- public char[] getArray() {
- return array;
- }
-
- /**
- * return number of items in array
- */
- public int length() {
- return n;
- }
-
- /**
- * returns current capacity of array
- */
- public int capacity() {
- return array.length;
- }
-
- public void put(int index, char val) {
- array[index] = val;
- }
-
- public char get(int index) {
- return array[index];
- }
-
- public int alloc(int size) {
- int index = n;
- int len = array.length;
- if (n + size >= len) {
- char[] aux = new char[len + blockSize];
- System.arraycopy(array, 0, aux, 0, len);
- array = aux;
- }
- n += size;
- return index;
- }
-
- public void trimToSize() {
- if (n < array.length) {
- char[] aux = new char[n];
- System.arraycopy(array, 0, aux, 0, n);
- array = aux;
- }
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/hyphenation/Hyphen.java b/LibrarySource/com/lowagie/text/pdf/hyphenation/Hyphen.java
deleted file mode 100644
index 8642c12..0000000
--- a/LibrarySource/com/lowagie/text/pdf/hyphenation/Hyphen.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.lowagie.text.pdf.hyphenation;
-
-import java.io.Serializable;
-
-/**
- * This class represents a hyphen. A 'full' hyphen is made of 3 parts:
- * the pre-break text, post-break text and no-break. If no line-break
- * is generated at this position, the no-break text is used, otherwise,
- * pre-break and post-break are used. Typically, pre-break is equal to
- * the hyphen character and the others are empty. However, this general
- * scheme allows support for cases in some languages where words change
- * spelling if they're split across lines, like german's 'backen' which
- * hyphenates 'bak-ken'. BTW, this comes from TeX.
- *
- * @author Carlos Villegas <cav at uniscope.co.jp>
- */
-
-public class Hyphen implements Serializable {
- public String preBreak;
- public String noBreak;
- public String postBreak;
-
- Hyphen(String pre, String no, String post) {
- preBreak = pre;
- noBreak = no;
- postBreak = post;
- }
-
- Hyphen(String pre) {
- preBreak = pre;
- noBreak = null;
- postBreak = null;
- }
-
- public String toString() {
- if (noBreak == null
- && postBreak == null
- && preBreak != null
- && preBreak.equals("-")) {
- return "-";
- }
- StringBuffer res = new StringBuffer("{");
- res.append(preBreak);
- res.append("}{");
- res.append(postBreak);
- res.append("}{");
- res.append(noBreak);
- res.append('}');
- return res.toString();
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/hyphenation/Hyphenation.java b/LibrarySource/com/lowagie/text/pdf/hyphenation/Hyphenation.java
deleted file mode 100644
index 8a1c372..0000000
--- a/LibrarySource/com/lowagie/text/pdf/hyphenation/Hyphenation.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.lowagie.text.pdf.hyphenation;
-
-/**
- * This class represents a hyphenated word.
- *
- * @author Carlos Villegas <cav at uniscope.co.jp>
- */
-public class Hyphenation {
-
- private int[] hyphenPoints;
- private String word;
-
- /**
- * number of hyphenation points in word
- */
- private int len;
-
- /**
- * rawWord as made of alternating strings and {@link Hyphen Hyphen}
- * instances
- */
- Hyphenation(String word, int[] points) {
- this.word = word;
- hyphenPoints = points;
- len = points.length;
- }
-
- /**
- * @return the number of hyphenation points in the word
- */
- public int length() {
- return len;
- }
-
- /**
- * @return the pre-break text, not including the hyphen character
- */
- public String getPreHyphenText(int index) {
- return word.substring(0, hyphenPoints[index]);
- }
-
- /**
- * @return the post-break text
- */
- public String getPostHyphenText(int index) {
- return word.substring(hyphenPoints[index]);
- }
-
- /**
- * @return the hyphenation points
- */
- public int[] getHyphenationPoints() {
- return hyphenPoints;
- }
-
- public String toString() {
- StringBuffer str = new StringBuffer();
- int start = 0;
- for (int i = 0; i < len; i++) {
- str.append(word.substring(start, hyphenPoints[i]) + "-");
- start = hyphenPoints[i];
- }
- str.append(word.substring(start));
- return str.toString();
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/hyphenation/HyphenationException.java b/LibrarySource/com/lowagie/text/pdf/hyphenation/HyphenationException.java
deleted file mode 100644
index 1c435d2..0000000
--- a/LibrarySource/com/lowagie/text/pdf/hyphenation/HyphenationException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.lowagie.text.pdf.hyphenation;
-
-/**
- * @author Carlos Villegas <cav at uniscope.co.jp>
- */
-public class HyphenationException extends Exception {
-
- public HyphenationException(String msg) {
- super(msg);
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/hyphenation/HyphenationTree.java b/LibrarySource/com/lowagie/text/pdf/hyphenation/HyphenationTree.java
deleted file mode 100644
index 9dd23a8..0000000
--- a/LibrarySource/com/lowagie/text/pdf/hyphenation/HyphenationTree.java
+++ /dev/null
@@ -1,462 +0,0 @@
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id: HyphenationTree.java,v 1.1 2004/09/06 18:03:12 gmazza Exp $ */
-
-package com.lowagie.text.pdf.hyphenation;
-
-import java.io.BufferedReader;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-/**
- * This tree structure stores the hyphenation patterns in an efficient
- * way for fast lookup. It provides the provides the method to
- * hyphenate a word.
- *
- * @author Carlos Villegas <cav at uniscope.co.jp>
- */
-public class HyphenationTree extends TernaryTree
- implements PatternConsumer, Serializable {
-
- /**
- * value space: stores the inteletter values
- */
- protected ByteVector vspace;
-
- /**
- * This map stores hyphenation exceptions
- */
- protected HashMap stoplist;
-
- /**
- * This map stores the character classes
- */
- protected TernaryTree classmap;
-
- /**
- * Temporary map to store interletter values on pattern loading.
- */
- private transient TernaryTree ivalues;
-
- public HyphenationTree() {
- stoplist = new HashMap(23); // usually a small table
- classmap = new TernaryTree();
- vspace = new ByteVector();
- vspace.alloc(1); // this reserves index 0, which we don't use
- }
-
- /**
- * Packs the values by storing them in 4 bits, two values into a byte
- * Values range is from 0 to 9. We use zero as terminator,
- * so we'll add 1 to the value.
- * @param values a string of digits from '0' to '9' representing the
- * interletter values.
- * @return the index into the vspace array where the packed values
- * are stored.
- */
- protected int packValues(String values) {
- int i, n = values.length();
- int m = (n & 1) == 1 ? (n >> 1) + 2 : (n >> 1) + 1;
- int offset = vspace.alloc(m);
- byte[] va = vspace.getArray();
- for (i = 0; i < n; i++) {
- int j = i >> 1;
- byte v = (byte)((values.charAt(i) - '0' + 1) & 0x0f);
- if ((i & 1) == 1) {
- va[j + offset] = (byte)(va[j + offset] | v);
- } else {
- va[j + offset] = (byte)(v << 4); // big endian
- }
- }
- va[m - 1 + offset] = 0; // terminator
- return offset;
- }
-
- protected String unpackValues(int k) {
- StringBuffer buf = new StringBuffer();
- byte v = vspace.get(k++);
- while (v != 0) {
- char c = (char)((v >>> 4) - 1 + '0');
- buf.append(c);
- c = (char)(v & 0x0f);
- if (c == 0) {
- break;
- }
- c = (char)(c - 1 + '0');
- buf.append(c);
- v = vspace.get(k++);
- }
- return buf.toString();
- }
-
- public void loadSimplePatterns(InputStream stream) throws HyphenationException {
- SimplePatternParser pp = new SimplePatternParser();
- ivalues = new TernaryTree();
-
- pp.parse(stream, this);
-
- // patterns/values should be now in the tree
- // let's optimize a bit
- trimToSize();
- vspace.trimToSize();
- classmap.trimToSize();
-
- // get rid of the auxiliary map
- ivalues = null;
- }
-
-
- public String findPattern(String pat) {
- int k = super.find(pat);
- if (k >= 0) {
- return unpackValues(k);
- }
- return "";
- }
-
- /**
- * String compare, returns 0 if equal or
- * t is a substring of s
- */
- protected int hstrcmp(char[] s, int si, char[] t, int ti) {
- for (; s[si] == t[ti]; si++, ti++) {
- if (s[si] == 0) {
- return 0;
- }
- }
- if (t[ti] == 0) {
- return 0;
- }
- return s[si] - t[ti];
- }
-
- protected byte[] getValues(int k) {
- StringBuffer buf = new StringBuffer();
- byte v = vspace.get(k++);
- while (v != 0) {
- char c = (char)((v >>> 4) - 1);
- buf.append(c);
- c = (char)(v & 0x0f);
- if (c == 0) {
- break;
- }
- c = (char)(c - 1);
- buf.append(c);
- v = vspace.get(k++);
- }
- byte[] res = new byte[buf.length()];
- for (int i = 0; i < res.length; i++) {
- res[i] = (byte)buf.charAt(i);
- }
- return res;
- }
-
- /**
- * <p>Search for all possible partial matches of word starting
- * at index an update interletter values. In other words, it
- * does something like:</p>
- * <code>
- * for(i=0; i<patterns.length; i++) {
- * if ( word.substring(index).startsWidth(patterns[i]) )
- * update_interletter_values(patterns[i]);
- * }
- * </code>
- * <p>But it is done in an efficient way since the patterns are
- * stored in a ternary tree. In fact, this is the whole purpose
- * of having the tree: doing this search without having to test
- * every single pattern. The number of patterns for languages
- * such as English range from 4000 to 10000. Thus, doing thousands
- * of string comparisons for each word to hyphenate would be
- * really slow without the tree. The tradeoff is memory, but
- * using a ternary tree instead of a trie, almost halves the
- * the memory used by Lout or TeX. It's also faster than using
- * a hash table</p>
- * @param word null terminated word to match
- * @param index start index from word
- * @param il interletter values array to update
- */
- protected void searchPatterns(char[] word, int index, byte[] il) {
- byte[] values;
- int i = index;
- char p, q;
- char sp = word[i];
- p = root;
-
- while (p > 0 && p < sc.length) {
- if (sc[p] == 0xFFFF) {
- if (hstrcmp(word, i, kv.getArray(), lo[p]) == 0) {
- values = getValues(eq[p]); // data pointer is in eq[]
- int j = index;
- for (int k = 0; k < values.length; k++) {
- if (j < il.length && values[k] > il[j]) {
- il[j] = values[k];
- }
- j++;
- }
- }
- return;
- }
- int d = sp - sc[p];
- if (d == 0) {
- if (sp == 0) {
- break;
- }
- sp = word[++i];
- p = eq[p];
- q = p;
-
- // look for a pattern ending at this position by searching for
- // the null char ( splitchar == 0 )
- while (q > 0 && q < sc.length) {
- if (sc[q] == 0xFFFF) { // stop at compressed branch
- break;
- }
- if (sc[q] == 0) {
- values = getValues(eq[q]);
- int j = index;
- for (int k = 0; k < values.length; k++) {
- if (j < il.length && values[k] > il[j]) {
- il[j] = values[k];
- }
- j++;
- }
- break;
- } else {
- q = lo[q];
-
- /**
- * actually the code should be:
- * q = sc[q] < 0 ? hi[q] : lo[q];
- * but java chars are unsigned
- */
- }
- }
- } else {
- p = d < 0 ? lo[p] : hi[p];
- }
- }
- }
-
- /**
- * Hyphenate word and return a Hyphenation object.
- * @param word the word to be hyphenated
- * @param remainCharCount Minimum number of characters allowed
- * before the hyphenation point.
- * @param pushCharCount Minimum number of characters allowed after
- * the hyphenation point.
- * @return a {@link Hyphenation Hyphenation} object representing
- * the hyphenated word or null if word is not hyphenated.
- */
- public Hyphenation hyphenate(String word, int remainCharCount,
- int pushCharCount) {
- char[] w = word.toCharArray();
- return hyphenate(w, 0, w.length, remainCharCount, pushCharCount);
- }
-
- /**
- * w = "****nnllllllnnn*****",
- * where n is a non-letter, l is a letter,
- * all n may be absent, the first n is at offset,
- * the first l is at offset + iIgnoreAtBeginning;
- * word = ".llllll.'\0'***",
- * where all l in w are copied into word.
- * In the first part of the routine len = w.length,
- * in the second part of the routine len = word.length.
- * Three indices are used:
- * index(w), the index in w,
- * index(word), the index in word,
- * letterindex(word), the index in the letter part of word.
- * The following relations exist:
- * index(w) = offset + i - 1
- * index(word) = i - iIgnoreAtBeginning
- * letterindex(word) = index(word) - 1
- * (see first loop).
- * It follows that:
- * index(w) - index(word) = offset - 1 + iIgnoreAtBeginning
- * index(w) = letterindex(word) + offset + iIgnoreAtBeginning
- */
-
- /**
- * Hyphenate word and return an array of hyphenation points.
- * @param w char array that contains the word
- * @param offset Offset to first character in word
- * @param len Length of word
- * @param remainCharCount Minimum number of characters allowed
- * before the hyphenation point.
- * @param pushCharCount Minimum number of characters allowed after
- * the hyphenation point.
- * @return a {@link Hyphenation Hyphenation} object representing
- * the hyphenated word or null if word is not hyphenated.
- */
- public Hyphenation hyphenate(char[] w, int offset, int len,
- int remainCharCount, int pushCharCount) {
- int i;
- char[] word = new char[len + 3];
-
- // normalize word
- char[] c = new char[2];
- int iIgnoreAtBeginning = 0;
- int iLength = len;
- boolean bEndOfLetters = false;
- for (i = 1; i <= len; i++) {
- c[0] = w[offset + i - 1];
- int nc = classmap.find(c, 0);
- if (nc < 0) { // found a non-letter character ...
- if (i == (1 + iIgnoreAtBeginning)) {
- // ... before any letter character
- iIgnoreAtBeginning ++;
- } else {
- // ... after a letter character
- bEndOfLetters = true;
- }
- iLength --;
- } else {
- if (!bEndOfLetters) {
- word[i - iIgnoreAtBeginning] = (char)nc;
- } else {
- return null;
- }
- }
- }
- len = iLength;
- if (len < (remainCharCount + pushCharCount)) {
- // word is too short to be hyphenated
- return null;
- }
- int[] result = new int[len + 1];
- int k = 0;
-
- // check exception list first
- String sw = new String(word, 1, len);
- if (stoplist.containsKey(sw)) {
- // assume only simple hyphens (Hyphen.pre="-", Hyphen.post = Hyphen.no = null)
- ArrayList hw = (ArrayList)stoplist.get(sw);
- int j = 0;
- for (i = 0; i < hw.size(); i++) {
- Object o = hw.get(i);
- // j = index(sw) = letterindex(word)?
- // result[k] = corresponding index(w)
- if (o instanceof String) {
- j += ((String)o).length();
- if (j >= remainCharCount && j < (len - pushCharCount)) {
- result[k++] = j + iIgnoreAtBeginning;
- }
- }
- }
- } else {
- // use algorithm to get hyphenation points
- word[0] = '.'; // word start marker
- word[len + 1] = '.'; // word end marker
- word[len + 2] = 0; // null terminated
- byte[] il = new byte[len + 3]; // initialized to zero
- for (i = 0; i < len + 1; i++) {
- searchPatterns(word, i, il);
- }
-
- // hyphenation points are located where interletter value is odd
- // i is letterindex(word),
- // i + 1 is index(word),
- // result[k] = corresponding index(w)
- for (i = 0; i < len; i++) {
- if (((il[i + 1] & 1) == 1) && i >= remainCharCount
- && i <= (len - pushCharCount)) {
- result[k++] = i + iIgnoreAtBeginning;
- }
- }
- }
-
-
- if (k > 0) {
- // trim result array
- int[] res = new int[k];
- System.arraycopy(result, 0, res, 0, k);
- return new Hyphenation(new String(w, offset, len), res);
- } else {
- return null;
- }
- }
-
- /**
- * Add a character class to the tree. It is used by
- * {@link SimplePatternParser SimplePatternParser} as callback to
- * add character classes. Character classes define the
- * valid word characters for hyphenation. If a word contains
- * a character not defined in any of the classes, it is not hyphenated.
- * It also defines a way to normalize the characters in order
- * to compare them with the stored patterns. Usually pattern
- * files use only lower case characters, in this case a class
- * for letter 'a', for example, should be defined as "aA", the first
- * character being the normalization char.
- */
- public void addClass(String chargroup) {
- if (chargroup.length() > 0) {
- char equivChar = chargroup.charAt(0);
- char[] key = new char[2];
- key[1] = 0;
- for (int i = 0; i < chargroup.length(); i++) {
- key[0] = chargroup.charAt(i);
- classmap.insert(key, 0, equivChar);
- }
- }
- }
-
- /**
- * Add an exception to the tree. It is used by
- * {@link SimplePatternParser SimplePatternParser} class as callback to
- * store the hyphenation exceptions.
- * @param word normalized word
- * @param hyphenatedword a vector of alternating strings and
- * {@link Hyphen hyphen} objects.
- */
- public void addException(String word, ArrayList hyphenatedword) {
- stoplist.put(word, hyphenatedword);
- }
-
- /**
- * Add a pattern to the tree. Mainly, to be used by
- * {@link SimplePatternParser SimplePatternParser} class as callback to
- * add a pattern to the tree.
- * @param pattern the hyphenation pattern
- * @param ivalue interletter weight values indicating the
- * desirability and priority of hyphenating at a given point
- * within the pattern. It should contain only digit characters.
- * (i.e. '0' to '9').
- */
- public void addPattern(String pattern, String ivalue) {
- int k = ivalues.find(ivalue);
- if (k <= 0) {
- k = packValues(ivalue);
- ivalues.insert(ivalue, (char)k);
- }
- insert(pattern, (char)k);
- }
-
- public void printStats() {
- System.out.println("Value space size = "
- + Integer.toString(vspace.length()));
- super.printStats();
- }
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/hyphenation/Hyphenator.java b/LibrarySource/com/lowagie/text/pdf/hyphenation/Hyphenator.java
deleted file mode 100644
index 142ef85..0000000
--- a/LibrarySource/com/lowagie/text/pdf/hyphenation/Hyphenator.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.lowagie.text.pdf.hyphenation;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.util.Hashtable;
-import com.lowagie.text.pdf.BaseFont;
-
-/**
- * This class is the main entry point to the hyphenation package.
- * You can use only the static methods or create an instance.
- *
- * @author Carlos Villegas <cav at uniscope.co.jp>
- */
-public class Hyphenator {
-
- /**@todo Don't use statics */
- private static Hashtable hyphenTrees = new Hashtable();
-
- private HyphenationTree hyphenTree = null;
- private int remainCharCount = 2;
- private int pushCharCount = 2;
- private static boolean errorDump = false;
- private static final String defaultHyphLocation = "com/lowagie/text/pdf/hyphenation/hyph/";
-
- /** Holds value of property hyphenDir. */
- private static String hyphenDir = "";
-
- public Hyphenator(String lang, String country, int leftMin,
- int rightMin) {
- hyphenTree = getHyphenationTree(lang, country);
- remainCharCount = leftMin;
- pushCharCount = rightMin;
- }
-
- public static HyphenationTree getHyphenationTree(String lang,
- String country) {
- String key = lang;
- // check whether the country code has been used
- if (country != null && !country.equals("none")) {
- key += "_" + country;
- }
- // first try to find it in the cache
- if (hyphenTrees.containsKey(key)) {
- return (HyphenationTree)hyphenTrees.get(key);
- }
- if (hyphenTrees.containsKey(lang)) {
- return (HyphenationTree)hyphenTrees.get(lang);
- }
-
- HyphenationTree hTree = getResourceHyphenationTree(key);
- if (hTree == null)
- hTree = getFileHyphenationTree(key);
- // put it into the pattern cache
- if (hTree != null) {
- hyphenTrees.put(key, hTree);
- }
- return hTree;
- }
-
- public static HyphenationTree getResourceHyphenationTree(String key) {
- try {
- InputStream stream = BaseFont.getResourceStream(defaultHyphLocation + key + ".xml");
- if (stream == null && key.length() > 2)
- stream = BaseFont.getResourceStream(defaultHyphLocation + key.substring(0, 2) + ".xml");
- if (stream == null)
- return null;
- HyphenationTree hTree = new HyphenationTree();
- hTree.loadSimplePatterns(stream);
- return hTree;
- }
- catch (Exception e) {
- return null;
- }
- }
-
- public static HyphenationTree getFileHyphenationTree(String key) {
- try {
- if (hyphenDir == null)
- return null;
- InputStream stream = null;
- File hyphenFile = new File(hyphenDir, key + ".xml");
- if (hyphenFile.canRead())
- stream = new FileInputStream(hyphenFile);
- if (stream == null && key.length() > 2) {
- hyphenFile = new File(hyphenDir, key.substring(0, 2) + ".xml");
- if (hyphenFile.canRead())
- stream = new FileInputStream(hyphenFile);
- }
- if (stream == null)
- return null;
- HyphenationTree hTree = new HyphenationTree();
- hTree.loadSimplePatterns(stream);
- return hTree;
- }
- catch (Exception e) {
- return null;
- }
- }
-
- public static Hyphenation hyphenate(String lang, String country,
- String word, int leftMin,
- int rightMin) {
- HyphenationTree hTree = getHyphenationTree(lang, country);
- if (hTree == null) {
- //log.error("Error building hyphenation tree for language "
- // + lang);
- return null;
- }
- return hTree.hyphenate(word, leftMin, rightMin);
- }
-
- public static Hyphenation hyphenate(String lang, String country,
- char[] word, int offset, int len,
- int leftMin, int rightMin) {
- HyphenationTree hTree = getHyphenationTree(lang, country);
- if (hTree == null) {
- //log.error("Error building hyphenation tree for language "
- // + lang);
- return null;
- }
- return hTree.hyphenate(word, offset, len, leftMin, rightMin);
- }
-
- public void setMinRemainCharCount(int min) {
- remainCharCount = min;
- }
-
- public void setMinPushCharCount(int min) {
- pushCharCount = min;
- }
-
- public void setLanguage(String lang, String country) {
- hyphenTree = getHyphenationTree(lang, country);
- }
-
- public Hyphenation hyphenate(char[] word, int offset, int len) {
- if (hyphenTree == null) {
- return null;
- }
- return hyphenTree.hyphenate(word, offset, len, remainCharCount,
- pushCharCount);
- }
-
- public Hyphenation hyphenate(String word) {
- if (hyphenTree == null) {
- return null;
- }
- return hyphenTree.hyphenate(word, remainCharCount, pushCharCount);
- }
-
- /** Getter for property hyphenDir.
- * @return Value of property hyphenDir.
- */
- public static String getHyphenDir() {
- return hyphenDir;
- }
-
- /** Setter for property hyphenDir.
- * @param _hyphenDir New value of property hyphenDir.
- */
- public static void setHyphenDir(String _hyphenDir) {
- hyphenDir = _hyphenDir;
- }
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/hyphenation/PatternConsumer.java b/LibrarySource/com/lowagie/text/pdf/hyphenation/PatternConsumer.java
deleted file mode 100644
index 148bded..0000000
--- a/LibrarySource/com/lowagie/text/pdf/hyphenation/PatternConsumer.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.lowagie.text.pdf.hyphenation;
-
-import java.util.ArrayList;
-
-/**
- * This interface is used to connect the XML pattern file parser to
- * the hyphenation tree.
- *
- * @author Carlos Villegas <cav at uniscope.co.jp>
- */
-public interface PatternConsumer {
-
- /**
- * Add a character class.
- * A character class defines characters that are considered
- * equivalent for the purpose of hyphenation (e.g. "aA"). It
- * usually means to ignore case.
- * @param chargroup character group
- */
- void addClass(String chargroup);
-
- /**
- * Add a hyphenation exception. An exception replaces the
- * result obtained by the algorithm for cases for which this
- * fails or the user wants to provide his own hyphenation.
- * A hyphenatedword is a vector of alternating String's and
- * {@link Hyphen Hyphen} instances
- */
- void addException(String word, ArrayList hyphenatedword);
-
- /**
- * Add hyphenation patterns.
- * @param pattern the pattern
- * @param values interletter values expressed as a string of
- * digit characters.
- */
- void addPattern(String pattern, String values);
-
-}
-
diff --git a/LibrarySource/com/lowagie/text/pdf/hyphenation/SimplePatternParser.java b/LibrarySource/com/lowagie/text/pdf/hyphenation/SimplePatternParser.java
deleted file mode 100644
index 85fa57e..0000000
--- a/LibrarySource/com/lowagie/text/pdf/hyphenation/SimplePatternParser.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Copyright 2005 by Paulo Soares.
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the License.
- *
- * The Original Code is 'iText, a free JAVA-PDF library'.
- *
- * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
- * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
- * All Rights Reserved.
- * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
- * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
- *
- * Contributor(s): all the names of the contributors are added in the source code
- * where applicable.
- *
- * Alternatively, the contents of this file may be used under the terms of the
- * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
- * provisions of LGPL are applicable instead of those above. If you wish to
- * allow use of your version of this file only under the terms of the LGPL
- * License and not to allow others to use your version of this file under
- * the MPL, indicate your decision by deleting the provisions above and
- * replace them with the notice and other provisions required by the LGPL.
- * If you do not delete the provisions above, a recipient may use your version
- * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MPL as stated above or under the terms of the GNU
- * Library General Public License as published by the Free Software Foundation;
- * either version 2 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
- * details.
- *
- * If you didn't download this code from the following link, you should check if
- * you aren't using an obsolete version:
- * http://www.lowagie.com/iText/
- */
-
-package com.lowagie.text.pdf.hyphenation;
-
-import com.lowagie.text.pdf.*;
-import com.lowagie.text.ExceptionConverter;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.FileInputStream;
-
-/** Parses the xml hyphenation pattern.
- *
- * @author Paulo Soares (psoares at consiste.pt)
- */
-public class SimplePatternParser implements SimpleXMLDocHandler, PatternConsumer {
- int currElement;
- PatternConsumer consumer;
- StringBuffer token;
- ArrayList exception;
- char hyphenChar;
- SimpleXMLParser parser;
-
- static final int ELEM_CLASSES = 1;
- static final int ELEM_EXCEPTIONS = 2;
- static final int ELEM_PATTERNS = 3;
- static final int ELEM_HYPHEN = 4;
-
- /** Creates a new instance of PatternParser2 */
- public SimplePatternParser() {
- token = new StringBuffer();
- hyphenChar = '-'; // default
- }
-
- public void parse(InputStream stream, PatternConsumer consumer) {
- this.consumer = consumer;
- try {
- SimpleXMLParser.parse(this, stream);
- }
- catch (IOException e) {
- throw new ExceptionConverter(e);
- }
- finally {
- try{stream.close();}catch(Exception e){}
- }
- }
-
- protected static String getPattern(String word) {
- StringBuffer pat = new StringBuffer();
- int len = word.length();
- for (int i = 0; i < len; i++) {
- if (!Character.isDigit(word.charAt(i))) {
- pat.append(word.charAt(i));
- }
- }
- return pat.toString();
- }
-
- protected ArrayList normalizeException(ArrayList ex) {
- ArrayList res = new ArrayList();
- for (int i = 0; i < ex.size(); i++) {
- Object item = ex.get(i);
- if (item instanceof String) {
- String str = (String)item;
- StringBuffer buf = new StringBuffer();
- for (int j = 0; j < str.length(); j++) {
- char c = str.charAt(j);
- if (c != hyphenChar) {
- buf.append(c);
- } else {
- res.add(buf.toString());
- buf.setLength(0);
- char[] h = new char[1];
- h[0] = hyphenChar;
- // we use here hyphenChar which is not necessarily
- // the one to be printed
- res.add(new Hyphen(new String(h), null, null));
- }
- }
- if (buf.length() > 0) {
- res.add(buf.toString());
- }
- } else {
- res.add(item);
- }
- }
- return res;
- }
-
- protected String getExceptionWord(ArrayList ex) {
- StringBuffer res = new StringBuffer();
- for (int i = 0; i < ex.size(); i++) {
- Object item = ex.get(i);
- if (item instanceof String) {
- res.append((String)item);
- } else {
- if (((Hyphen)item).noBreak != null) {
- res.append(((Hyphen)item).noBreak);
- }
- }
- }
- return res.toString();
- }
-
- protected static String getInterletterValues(String pat) {
- StringBuffer il = new StringBuffer();
- String word = pat + "a"; // add dummy letter to serve as sentinel
- int len = word.length();
- for (int i = 0; i < len; i++) {
- char c = word.charAt(i);
- if (Character.isDigit(c)) {
- il.append(c);
- i++;
- } else {
- il.append('0');
- }
- }
- return il.toString();
- }
-
- public void endDocument() {
- }
-
- public void endElement(String tag) {
- if (token.length() > 0) {
- String word = token.toString();
- switch (currElement) {
- case ELEM_CLASSES:
- consumer.addClass(word);
- break;
- case ELEM_EXCEPTIONS:
- exception.add(word);
- exception = normalizeException(exception);
- consumer.addException(getExceptionWord(exception),
- (ArrayList)exception.clone());
- break;
- case ELEM_PATTERNS:
- consumer.addPattern(getPattern(word),
- getInterletterValues(word));
- break;
- case ELEM_HYPHEN:
- // nothing to do
- break;
- }
- if (currElement != ELEM_HYPHEN) {
- token.setLength(0);
- }
- }
- if (currElement == ELEM_HYPHEN) {
- currElement = ELEM_EXCEPTIONS;
- } else {
- currElement = 0;
- }
- }
-
- public void startDocument() {
- }
-
- public void startElement(String tag, java.util.HashMap h) {
- if (tag.equals("hyphen-char")) {
- String hh = (String)h.get("value");
- if (hh != null && hh.length() == 1) {
- hyphenChar = hh.charAt(0);
- }
- } else if (tag.equals("classes")) {
- currElement = ELEM_CLASSES;
- } else if (tag.equals("patterns")) {
- currElement = ELEM_PATTERNS;
- } else if (tag.equals("exceptions")) {
- currElement = ELEM_EXCEPTIONS;
- exception = new ArrayList();
- } else if (tag.equals("hyphen")) {
- if (token.length() > 0) {
- exception.add(token.toString());
- }
- exception.add(new Hyphen((String)h.get("pre"),
- (String)h.get("no"),
- (String)h.get("post")));
- currElement = ELEM_HYPHEN;
- }
- token.setLength(0);
- }
-
- public void text(String str) {
- StringTokenizer tk = new StringTokenizer(str);
- while (tk.hasMoreTokens()) {
- String word = tk.nextToken();
- // System.out.println("\"" + word + "\"");
- switch (currElement) {
- case ELEM_CLASSES:
- consumer.addClass(word);
- break;
- case ELEM_EXCEPTIONS:
- exception.add(word);
- exception = normalizeException(exception);
- consumer.addException(getExceptionWord(exception),
- (ArrayList)exception.clone());
- exception.clear();
- break;
- case ELEM_PATTERNS:
- consumer.addPattern(getPattern(word),
- getInterletterValues(word));
- break;
- }
- }
- }
-
- // PatternConsumer implementation for testing purposes
- public void addClass(String c) {
- System.out.println("class: " + c);
- }
-
- public void addException(String w, ArrayList e) {
- System.out.println("exception: " + w + " : " + e.toString());
- }
-
- public void addPattern(String p, String v) {
- System.out.println("pattern: " + p + " : " + v);
- }
-
- public static void main(String[] args) throws Exception {
- try {
- if (args.length > 0) {
- SimplePatternParser pp = new SimplePatternParser();
- pp.parse(new FileInputStream(args[0]), pp);
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/LibrarySource/com/lowagie/text/pdf/hyphenation/TernaryTree.java b/LibrarySource/com/lowagie/text/pdf/hyphenation/TernaryTree.java
deleted file mode 100644
index 39658e6..0000000
--- a/LibrarySource/com/lowagie/text/pdf/hyphenation/TernaryTree.java
+++ /dev/null
@@ -1,668 +0,0 @@
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.lowagie.text.pdf.hyphenation;
-
-import java.util.Enumeration;
-import java.util.Stack;
-import java.io.Serializable;
-
-/**
- * <h2>Ternary Search Tree.</h2>
- *
- * <p>A ternary search tree is a hibrid between a binary tree and
- * a digital search tree (trie). Keys are limited to strings.
- * A data value of type char is stored in each leaf node.
- * It can be used as an index (or pointer) to the data.
- * Branches that only contain one key are compressed to one node
- * by storing a pointer to the trailer substring of the key.
- * This class is intended to serve as base class or helper class
- * to implement Dictionary collections or the like. Ternary trees
- * have some nice properties as the following: the tree can be
- * traversed in sorted order, partial matches (wildcard) can be
- * implemented, retrieval of all keys within a given distance
- * from the target, etc. The storage requirements are higher than
- * a binary tree but a lot less than a trie. Performance is
- * comparable with a hash table, sometimes it outperforms a hash
- * function (most of the time can determine a miss faster than a hash).</p>
- *
- * <p>The main purpose of this java port is to serve as a base for
- * implementing TeX's hyphenation algorithm (see The TeXBook,
- * appendix H). Each language requires from 5000 to 15000 hyphenation
- * patterns which will be keys in this tree. The strings patterns
- * are usually small (from 2 to 5 characters), but each char in the
- * tree is stored in a node. Thus memory usage is the main concern.
- * We will sacrify 'elegance' to keep memory requirenments to the
- * minimum. Using java's char type as pointer (yes, I know pointer
- * it is a forbidden word in java) we can keep the size of the node
- * to be just 8 bytes (3 pointers and the data char). This gives
- * room for about 65000 nodes. In my tests the english patterns
- * took 7694 nodes and the german patterns 10055 nodes,
- * so I think we are safe.</p>
- *
- * <p>All said, this is a map with strings as keys and char as value.
- * Pretty limited!. It can be extended to a general map by
- * using the string representation of an object and using the
- * char value as an index to an array that contains the object
- * values.</p>
- *
- * @author cav at uniscope.co.jp
- */
-
-public class TernaryTree implements Cloneable, Serializable {
-
- /**
- * We use 4 arrays to represent a node. I guess I should have created
- * a proper node class, but somehow Knuth's pascal code made me forget
- * we now have a portable language with virtual memory management and
- * automatic garbage collection! And now is kind of late, furthermore,
- * if it ain't broken, don't fix it.
- */
-
- /**
- * Pointer to low branch and to rest of the key when it is
- * stored directly in this node, we don't have unions in java!
- */
- protected char[] lo;
-
- /**
- * Pointer to high branch.
- */
- protected char[] hi;
-
- /**
- * Pointer to equal branch and to data when this node is a string terminator.
- */
- protected char[] eq;
-
- /**
- * <P>The character stored in this node: splitchar.
- * Two special values are reserved:</P>
- * <ul><li>0x0000 as string terminator</li>
- * <li>0xFFFF to indicate that the branch starting at
- * this node is compressed</li></ul>
- * <p>This shouldn't be a problem if we give the usual semantics to
- * strings since 0xFFFF is garanteed not to be an Unicode character.</p>
- */
- protected char[] sc;
-
- /**
- * This vector holds the trailing of the keys when the branch is compressed.
- */
- protected CharVector kv;
-
- protected char root;
- protected char freenode;
- protected int length; // number of items in tree
-
- protected static final int BLOCK_SIZE = 2048; // allocation size for arrays
-
- TernaryTree() {
- init();
- }
-
- protected void init() {
- root = 0;
- freenode = 1;
- length = 0;
- lo = new char[BLOCK_SIZE];
- hi = new char[BLOCK_SIZE];
- eq = new char[BLOCK_SIZE];
- sc = new char[BLOCK_SIZE];
- kv = new CharVector();
- }
-
- /**
- * Branches are initially compressed, needing
- * one node per key plus the size of the string
- * key. They are decompressed as needed when
- * another key with same prefix
- * is inserted. This saves a lot of space,
- * specially for long keys.
- */
- public void insert(String key, char val) {
- // make sure we have enough room in the arrays
- int len = key.length()
- + 1; // maximum number of nodes that may be generated
- if (freenode + len > eq.length) {
- redimNodeArrays(eq.length + BLOCK_SIZE);
- }
- char strkey[] = new char[len--];
- key.getChars(0, len, strkey, 0);
- strkey[len] = 0;
- root = insert(root, strkey, 0, val);
- }
-
- public void insert(char[] key, int start, char val) {
- int len = strlen(key) + 1;
- if (freenode + len > eq.length) {
- redimNodeArrays(eq.length + BLOCK_SIZE);
- }
- root = insert(root, key, start, val);
- }
-
- /**
- * The actual insertion function, recursive version.
- */
- private char insert(char p, char[] key, int start, char val) {
- int len = strlen(key, start);
- if (p == 0) {
- // this means there is no branch, this node will start a new branch.
- // Instead of doing that, we store the key somewhere else and create
- // only one node with a pointer to the key
- p = freenode++;
- eq[p] = val; // holds data
- length++;
- hi[p] = 0;
- if (len > 0) {
- sc[p] = 0xFFFF; // indicates branch is compressed
- lo[p] = (char)kv.alloc(len
- + 1); // use 'lo' to hold pointer to key
- strcpy(kv.getArray(), lo[p], key, start);
- } else {
- sc[p] = 0;
- lo[p] = 0;
- }
- return p;
- }
-
- if (sc[p] == 0xFFFF) {
- // branch is compressed: need to decompress
- // this will generate garbage in the external key array
- // but we can do some garbage collection later
- char pp = freenode++;
- lo[pp] = lo[p]; // previous pointer to key
- eq[pp] = eq[p]; // previous pointer to data
- lo[p] = 0;
- if (len > 0) {
- sc[p] = kv.get(lo[pp]);
- eq[p] = pp;
- lo[pp]++;
- if (kv.get(lo[pp]) == 0) {
- // key completly decompressed leaving garbage in key array
- lo[pp] = 0;
- sc[pp] = 0;
- hi[pp] = 0;
- } else {
- // we only got first char of key, rest is still there
- sc[pp] = 0xFFFF;
- }
- } else {
- // In this case we can save a node by swapping the new node
- // with the compressed node
- sc[pp] = 0xFFFF;
- hi[p] = pp;
- sc[p] = 0;
- eq[p] = val;
- length++;
- return p;
- }
- }
- char s = key[start];
- if (s < sc[p]) {
- lo[p] = insert(lo[p], key, start, val);
- } else if (s == sc[p]) {
- if (s != 0) {
- eq[p] = insert(eq[p], key, start + 1, val);
- } else {
- // key already in tree, overwrite data
- eq[p] = val;
- }
- } else {
- hi[p] = insert(hi[p], key, start, val);
- }
- return p;
- }
-
- /**
- * Compares 2 null terminated char arrays
- */
- public static int strcmp(char[] a, int startA, char[] b, int startB) {
- for (; a[startA] == b[startB]; startA++, startB++) {
- if (a[startA] == 0) {
- return 0;
- }
- }
- return a[startA] - b[startB];
- }
-
- /**
- * Compares a string with null terminated char array
- */
- public static int strcmp(String str, char[] a, int start) {
- int i, d, len = str.length();
- for (i = 0; i < len; i++) {
- d = (int)str.charAt(i) - a[start + i];
- if (d != 0) {
- return d;
- }
- if (a[start + i] == 0) {
- return d;
- }
- }
- if (a[start + i] != 0) {
- return (int)-a[start + i];
- }
- return 0;
-
- }
-
- public static void strcpy(char[] dst, int di, char[] src, int si) {
- while (src[si] != 0) {
- dst[di++] = src[si++];
- }
- dst[di] = 0;
- }
-
- public static int strlen(char[] a, int start) {
- int len = 0;
- for (int i = start; i < a.length && a[i] != 0; i++) {
- len++;
- }
- return len;
- }
-
- public static int strlen(char[] a) {
- return strlen(a, 0);
- }
-
- public int find(String key) {
- int len = key.length();
- char strkey[] = new char[len + 1];
- key.getChars(0, len, strkey, 0);
- strkey[len] = 0;
-
- return find(strkey, 0);
- }
-
- public int find(char[] key, int start) {
- int d;
- char p = root;
- int i = start;
- char c;
-
- while (p != 0) {
- if (sc[p] == 0xFFFF) {
- if (strcmp(key, i, kv.getArray(), lo[p]) == 0) {
- return eq[p];
- } else {
- return -1;
- }
- }
- c = key[i];
- d = c - sc[p];
- if (d == 0) {
- if (c == 0) {
- return eq[p];
- }
- i++;
- p = eq[p];
- } else if (d < 0) {
- p = lo[p];
- } else {
- p = hi[p];
- }
- }
- return -1;
- }
-
- public boolean knows(String key) {
- return (find(key) >= 0);
- }
-
- // redimension the arrays
- private void redimNodeArrays(int newsize) {
- int len = newsize < lo.length ? newsize : lo.length;
- char[] na = new char[newsize];
- System.arraycopy(lo, 0, na, 0, len);
- lo = na;
- na = new char[newsize];
- System.arraycopy(hi, 0, na, 0, len);
- hi = na;
- na = new char[newsize];
- System.arraycopy(eq, 0, na, 0, len);
- eq = na;
- na = new char[newsize];
- System.arraycopy(sc, 0, na, 0, len);
- sc = na;
- }
-
- public int size() {
- return length;
- }
-
- public Object clone() {
- TernaryTree t = new TernaryTree();
- t.lo = (char[])this.lo.clone();
- t.hi = (char[])this.hi.clone();
- t.eq = (char[])this.eq.clone();
- t.sc = (char[])this.sc.clone();
- t.kv = (CharVector)this.kv.clone();
- t.root = this.root;
- t.freenode = this.freenode;
- t.length = this.length;
-
- return t;
- }
-
- /**
- * Recursively insert the median first and then the median of the
- * lower and upper halves, and so on in order to get a balanced
- * tree. The array of keys is assumed to be sorted in ascending
- * order.
- */
- protected void insertBalanced(String[] k, char[] v, int offset, int n) {
- int m;
- if (n < 1) {
- return;
- }
- m = n >> 1;
-
- insert(k[m + offset], v[m + offset]);
- insertBalanced(k, v, offset, m);
-
- insertBalanced(k, v, offset + m + 1, n - m - 1);
- }
-
-
- /**
- * Balance the tree for best search performance
- */
- public void balance() {
- // System.out.print("Before root splitchar = "); System.out.println(sc[root]);
-
- int i = 0, n = length;
- String[] k = new String[n];
- char[] v = new char[n];
- Iterator iter = new Iterator();
- while (iter.hasMoreElements()) {
- v[i] = iter.getValue();
- k[i++] = (String)iter.nextElement();
- }
- init();
- insertBalanced(k, v, 0, n);
-
- // With uniform letter distribution sc[root] should be around 'm'
- // System.out.print("After root splitchar = "); System.out.println(sc[root]);
- }
-
- /**
- * Each node stores a character (splitchar) which is part of
- * some key(s). In a compressed branch (one that only contain
- * a single string key) the trailer of the key which is not
- * already in nodes is stored externally in the kv array.
- * As items are inserted, key substrings decrease.
- * Some substrings may completely disappear when the whole
- * branch is totally decompressed.
- * The tree is traversed to find the key substrings actually
- * used. In addition, duplicate substrings are removed using
- * a map (implemented with a TernaryTree!).
- *
- */
- public void trimToSize() {
- // first balance the tree for best performance
- balance();
-
- // redimension the node arrays
- redimNodeArrays(freenode);
-
- // ok, compact kv array
- CharVector kx = new CharVector();
- kx.alloc(1);
- TernaryTree map = new TernaryTree();
- compact(kx, map, root);
- kv = kx;
- kv.trimToSize();
- }
-
- private void compact(CharVector kx, TernaryTree map, char p) {
- int k;
- if (p == 0) {
- return;
- }
- if (sc[p] == 0xFFFF) {
- k = map.find(kv.getArray(), lo[p]);
- if (k < 0) {
- k = kx.alloc(strlen(kv.getArray(), lo[p]) + 1);
- strcpy(kx.getArray(), k, kv.getArray(), lo[p]);
- map.insert(kx.getArray(), k, (char)k);
- }
- lo[p] = (char)k;
- } else {
- compact(kx, map, lo[p]);
- if (sc[p] != 0) {
- compact(kx, map, eq[p]);
- }
- compact(kx, map, hi[p]);
- }
- }
-
-
- public Enumeration keys() {
- return new Iterator();
- }
-
- public class Iterator implements Enumeration {
-
- /**
- * current node index
- */
- int cur;
-
- /**
- * current key
- */
- String curkey;
-
- private class Item implements Cloneable {
- char parent;
- char child;
-
- public Item() {
- parent = 0;
- child = 0;
- }
-
- public Item(char p, char c) {
- parent = p;
- child = c;
- }
-
- public Object clone() {
- return new Item(parent, child);
- }
-
- }
-
- /**
- * Node stack
- */
- Stack ns;
-
- /**
- * key stack implemented with a StringBuffer
- */
- StringBuffer ks;
-
- public Iterator() {
- cur = -1;
- ns = new Stack();
- ks = new StringBuffer();
- rewind();
- }
-
- public void rewind() {
- ns.removeAllElements();
- ks.setLength(0);
- cur = root;
- run();
- }
-
- public Object nextElement() {
- String res = new String(curkey);
- cur = up();
- run();
- return res;
- }
-
- public char getValue() {
- if (cur >= 0) {
- return eq[cur];
- }
- return 0;
- }
-
- public boolean hasMoreElements() {
- return (cur != -1);
- }
-
- /**
- * traverse upwards
- */
- private int up() {
- Item i = new Item();
- int res = 0;
-
- if (ns.empty()) {
- return -1;
- }
-
- if (cur != 0 && sc[cur] == 0) {
- return lo[cur];
- }
-
- boolean climb = true;
-
- while (climb) {
- i = (Item)ns.pop();
- i.child++;
- switch (i.child) {
- case 1:
- if (sc[i.parent] != 0) {
- res = eq[i.parent];
- ns.push(i.clone());
- ks.append(sc[i.parent]);
- } else {
- i.child++;
- ns.push(i.clone());
- res = hi[i.parent];
- }
- climb = false;
- break;
-
- case 2:
- res = hi[i.parent];
- ns.push(i.clone());
- if (ks.length() > 0) {
- ks.setLength(ks.length() - 1); // pop
- }
- climb = false;
- break;
-
- default:
- if (ns.empty()) {
- return -1;
- }
- climb = true;
- break;
- }
- }
- return res;
- }
-
- /**
- * traverse the tree to find next key
- */
- private int run() {
- if (cur == -1) {
- return -1;
- }
-
- boolean leaf = false;
- while (true) {
- // first go down on low branch until leaf or compressed branch
- while (cur != 0) {
- if (sc[cur] == 0xFFFF) {
- leaf = true;
- break;
- }
- ns.push(new Item((char)cur, '\u0000'));
- if (sc[cur] == 0) {
- leaf = true;
- break;
- }
- cur = lo[cur];
- }
- if (leaf) {
- break;
- }
- // nothing found, go up one node and try again
- cur = up();
- if (cur == -1) {
- return -1;
- }
- }
- // The current node should be a data node and
- // the key should be in the key stack (at least partially)
- StringBuffer buf = new StringBuffer(ks.toString());
- if (sc[cur] == 0xFFFF) {
- int p = lo[cur];
- while (kv.get(p) != 0) {
- buf.append(kv.get(p++));
- }
- }
- curkey = buf.toString();
- return 0;
- }
-
- }
-
- public void printStats() {
- System.out.println("Number of keys = " + Integer.toString(length));
- System.out.println("Node count = " + Integer.toString(freenode));
- // System.out.println("Array length = " + Integer.toString(eq.length));
- System.out.println("Key Array length = "
- + Integer.toString(kv.length()));
-
- /*
- * for(int i=0; i<kv.length(); i++)
- * if ( kv.get(i) != 0 )
- * System.out.print(kv.get(i));
- * else
- * System.out.println("");
- * System.out.println("Keys:");
- * for(Enumeration enum = keys(); enum.hasMoreElements(); )
- * System.out.println(enum.nextElement());
- */
-
- }
-
-/* public static void main(String[] args) throws Exception {
- TernaryTree tt = new TernaryTree();
- tt.insert("Carlos", 'C');
- tt.insert("Car", 'r');
- tt.insert("palos", 'l');
- tt.insert("pa", 'p');
- tt.trimToSize();
- System.out.println((char)tt.find("Car"));
- System.out.println((char)tt.find("Carlos"));
- System.out.println((char)tt.find("alto"));
- tt.printStats();
- }*/
-
-}
-
-
diff --git a/LibrarySource/pal/alignment/AbstractAlignment.java b/LibrarySource/pal/alignment/AbstractAlignment.java
deleted file mode 100644
index 5d4d2f2..0000000
--- a/LibrarySource/pal/alignment/AbstractAlignment.java
+++ /dev/null
@@ -1,177 +0,0 @@
-// AbstractAlignment.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.alignment;
-
-import pal.io.*;
-import pal.datatype.*;
-import pal.misc.*;
-
-import java.io.*;
-
-/**
- * abstract base class for any alignment data.
- *
- * @version $Id: AbstractAlignment.java,v 1.3 2001/07/13 14:39:12 korbinian Exp $
- *
- * @author Alexei Drummond
- * @author Korbinian Strimmer
- */
-abstract public class AbstractAlignment implements Alignment, Serializable, IdGroup, Report
-{
- //
- // Public stuff
- //
-
- public AbstractAlignment()
- {
-
- }
-
- /** number of sequences */
- protected int numSeqs;
-
- /** length of each sequence */
- protected int numSites;
-
- /** sequence identifiers */
- protected IdGroup idGroup;
-
- /**
- * frequencies of the allowed states
- * (scaled to sum to 1.0 and suitable for RateMatrix)
- */
- protected double[] frequency;
-
- /** data type */
- protected DataType dataType;
-
- // Abstract method
-
- /** sequence alignment at (sequence, site) */
- abstract public char getData(int seq, int site);
-
- /**
- * returns true if there is a gap in the give position.
- */
- public boolean isGap(int seq, int site) {
- return DataTypeUtils.isGap(dataType, getData(seq, site));
- }
-
- /** Guess data type */
- public void guessDataType()
- {
- dataType = AlignmentUtils.getSuitableInstance(this);
- }
-
- /** Returns the datatype of this alignment */
- public DataType getDataType()
- {
- return dataType;
- }
-
- /** Sets the datatype of this alignment */
- public void setDataType(DataType d)
- {
- dataType = d;
-
- // if dataType was guessed incorrectly then when corrected
- // the frequencies should be recalculated.
- AlignmentUtils.estimateFrequencies(this);
- }
-
- /** returns representation of this alignment as a string */
- public String toString() {
-
- StringWriter sw = new StringWriter();
- AlignmentUtils.print(this, new PrintWriter(sw));
-
- return sw.toString();
- }
-
- // interface Report
-
- public void report(PrintWriter out)
- {
- AlignmentUtils.report(this, out);
- }
-
-
- /**
- * Fills a [numsequences][length] matrix with indices.
- * Each index represents the sequence state, -1 means a gap.
- */
- public int[][] getStates() {
-
- int[][] indices = new int[numSeqs][numSites];
-
- for (int i = 0; i < numSeqs; i++) {
- int seqcounter = 0;
-
- for (int j = 0; j < numSites; j++) {
-
- indices[i][j] = dataType.getState(getData(i, j));
-
- if (indices[i][j] >= dataType.getNumStates()) {
- indices[i][j] = -1;
- }
- }
- }
-
- return indices;
- }
-
- /**
- * Return number of sites in this alignment
- */
- public final int getLength() {
- return numSites;
- }
-
- /**
- * Return number of sequences in this alignment
- */
- public final int getSequenceCount() {
- return numSeqs;
- }
-
- /**
- * Return number of sites for each sequence in this alignment
- * @note for people who like accessor methods over public instance variables...
- */
- public final int getSiteCount() {
- return numSites;
- }
- /**
- * Returns a string representing a single sequence (including gaps)
- * from this alignment.
- */
- public String getAlignedSequenceString(int seq) {
- char[] data = new char[numSites];
- for (int i = 0; i < numSites; i++) {
- data[i] = getData(seq, i);
- }
- return new String(data);
- }
-
- //IdGroup interface
- public Identifier getIdentifier(int i) {return idGroup.getIdentifier(i);}
- public void setIdentifier(int i, Identifier ident) { idGroup.setIdentifier(i, ident); }
- public int getIdCount() { return idGroup.getIdCount(); }
- public int whichIdNumber(String name) { return idGroup.whichIdNumber(name); }
-
- public double[] getFrequency() {
- return frequency;
- }
-
- public void setFrequency(double[] f) {
- frequency = f;
- }
-
-}
-
diff --git a/LibrarySource/pal/alignment/Alignment.java b/LibrarySource/pal/alignment/Alignment.java
deleted file mode 100644
index 011976d..0000000
--- a/LibrarySource/pal/alignment/Alignment.java
+++ /dev/null
@@ -1,77 +0,0 @@
-// Alignment.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.alignment;
-
-import pal.io.*;
-import pal.datatype.*;
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * interface for any alignment data.
- *
- * @version $Id: Alignment.java,v 1.11 2001/07/13 14:39:12 korbinian Exp $
- *
- * @author Alexei Drummond
- * @author Korbinian Strimmer
- */
-public interface Alignment extends Serializable, IdGroup
-{
- //
- // Public stuff
- //
-
- /** character used to designate gaps */
- char GAP = '-';
-
- // Abstract method
-
- /** sequence alignment at (sequence, site) */
- char getData(int seq, int site);
-
- /**
- * Return number of sites for each sequence in this alignment
- * @note for people who like accessor methods over public instance variables...
- */
- int getSiteCount();
-
- /**
- * Return number of sequences in this alignment
- */
- int getSequenceCount();
-
- /**
- * Return DataType of this alignment.
- */
- DataType getDataType();
-
- /**
- * Sets the dataType of this alignment.
- */
- void setDataType(DataType dataType);
-
- /**
- * Returns string representation of single sequence in
- * alignment with gap characters included.
- */
- String getAlignedSequenceString(int sequence);
-
- /**
- * Returns frequency of character states.
- */
- double[] getFrequency();
-
- /**
- * Sets frequency of character states.
- */
- void setFrequency(double[] frequencies);
-}
-
diff --git a/LibrarySource/pal/alignment/AlignmentParseException.java b/LibrarySource/pal/alignment/AlignmentParseException.java
deleted file mode 100644
index 2c18b47..0000000
--- a/LibrarySource/pal/alignment/AlignmentParseException.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// AlignmentParseException.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.alignment;
-
-
-/**
- * Exception thrown by ReadAlignment
- *
- * @author Korbinian Strimmer
- */
-public class AlignmentParseException extends Exception
-{
- public AlignmentParseException() {}
-
- public AlignmentParseException(String msg)
- {
- super(msg);
- }
-}
-
diff --git a/LibrarySource/pal/alignment/AlignmentUtils.java b/LibrarySource/pal/alignment/AlignmentUtils.java
deleted file mode 100644
index 6d101f0..0000000
--- a/LibrarySource/pal/alignment/AlignmentUtils.java
+++ /dev/null
@@ -1,610 +0,0 @@
-// AlignmentUtils.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.alignment;
-
-import pal.datatype.*;
-import pal.io.*;
-import pal.misc.*;
-import java.io.*;
-
-/**
- * Helper utilities for alignments.
- *
- * @version $Id: AlignmentUtils.java,v 1.7 2001/07/13 14:39:12 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class AlignmentUtils {
-
- static FormattedOutput format = FormattedOutput.getInstance();
-
-
- /** report number of sequences, sites, and data type */
- public static void report(Alignment a, PrintWriter out)
- {
- if (a.getDataType() == null) {
- a.setDataType(AlignmentUtils.getSuitableInstance(a));
- }
-
- out.println("Number of sequences: " + a.getSequenceCount());
- out.println("Number of sites: " + a.getSiteCount());
- out.println("Data type: " + a.getDataType().getDescription() + " data");
- }
-
- /** print alignment (default format: INTERLEAVED) */
- public static void print(Alignment a, PrintWriter out)
- {
- printInterleaved(a, out);
- }
-
- /** print alignment (in plain format) */
- public static void printPlain(Alignment a, PrintWriter out) {
- printPlain(a, out, false);
- }
-
- /** print alignment (in plain format) */
- public static void printPlain(Alignment a, PrintWriter out, boolean relaxed)
- {
- // PHYLIP header line
- out.println(" " + a.getSequenceCount() + " " + a.getSiteCount());
-
- for (int s = 0; s < a.getSequenceCount(); s++)
- {
- format.displayLabel(out, a.getIdentifier(s).getName(), (relaxed ? 20 : 10));
- out.print(" ");
- printNextSites(a, out, false, s, 0, a.getSiteCount());
- out.println();
- }
- }
-
- /** print alignment (in PHYLIP SEQUENTIAL format) */
- public static void printSequential(Alignment a, PrintWriter out)
- {
- // PHYLIP header line
- out.println(" " + a.getSequenceCount() + " " + a.getSiteCount() + " S");
-
- // Print sequences
- for (int s = 0; s < a.getSequenceCount(); s++)
- {
- int n = 0;
- while (n < a.getSiteCount())
- {
- if (n == 0)
- {
- format.displayLabel(out,
- a.getIdentifier(s).getName(), 10);
- out.print(" ");
- }
- else
- {
- out.print(" ");
- }
- printNextSites(a, out, false, s, n, 50);
- out.println();
- n += 50;
- }
- }
- }
-
-
- /** print alignment (in PHYLIP 3.4 INTERLEAVED format) */
- public static void printInterleaved(Alignment a, PrintWriter out)
- {
- int n = 0;
-
- // PHYLIP header line
- out.println(" " + a.getSequenceCount() + " " + a.getSiteCount());
-
- // Print sequences
- while (n < a.getSiteCount())
- {
- for (int s = 0; s < a.getSequenceCount(); s++)
- {
- if (n == 0)
- {
- format.displayLabel(out,
- a.getIdentifier(s).getName(), 10);
- out.print(" ");
- }
- else
- {
- out.print(" ");
- }
- printNextSites(a, out, true, s, n, 50);
- out.println();
- }
- out.println();
- n += 50;
- }
- }
-
- /** Print alignment (in CLUSTAL W format) */
- public static void printCLUSTALW(Alignment a, PrintWriter out)
- {
- int n = 0;
-
- // CLUSTAL W header line
- out.println("CLUSTAL W multiple sequence alignment");
- out.println();
-
- // Print sequences
- while (n < a.getSiteCount())
- {
- out.println();
- for (int s = 0; s < a.getSequenceCount(); s++)
- {
- format.displayLabel(out, a.getIdentifier(s).getName(), 10);
- out.print(" ");
-
- printNextSites(a, out, false, s, n, 50);
- out.println();
- }
- // Blanks in status line are necessary for some parsers)
- out.println(" ");
- n += 50;
- }
- }
-
- /**
- * Returns state indices for a sequence.
- */
- public static final void getAlignedSequenceIndices(Alignment a, int i, int[] indices, DataType dataType) {
-
- String sequence = a.getAlignedSequenceString(i);
-
- for (int j = 0; j < a.getSiteCount(); j++) {
- indices[j] = dataType.getState(sequence.charAt(j));
- }
- }
-
- /**
- * Returns total sum of pairs alignment penalty using gap creation
- * and extension penalties and transition penalties in the
- * TransitionPenaltyTable provided. By default this is end-weighted.
- */
- public static double getAlignmentPenalty(
- Alignment a,
- TransitionPenaltyTable penalties,
- double gapCreation,
- double gapExtension) {
-
- return getAlignmentPenalty(a, a.getDataType(),
- penalties, gapCreation, gapExtension, false /* end-weighted */);
- }
-
- /**
- * Returns total sum of pairs alignment distance using gap creation
- * and extension penalties and transition penalties as defined in the
- * TransitionPenaltyTable provided.
- * @param local true if end gaps ignored, false otherwise
- */
- public static double getAlignmentPenalty(
- Alignment a,
- DataType dataType,
- TransitionPenaltyTable penalties,
- double gapCreation,
- double gapExtension,
- boolean local) {
-
- int[][] indices = new int[a.getSequenceCount()][a.getSiteCount()];
- for (int i = 0; i < a.getSequenceCount(); i++) {
- getAlignedSequenceIndices(a, i, indices[i], dataType);
- }
-
- CostBag totalBag = new CostBag();
- for (int i = 0; i < a.getSequenceCount(); i++) {
- for (int j = i + 1; j < a.getSequenceCount(); j++) {
- totalBag.add(getAlignmentPenalty(a, penalties, i, j,
- indices[i], indices[j], local));
- }
- }
- return totalBag.score(gapCreation, gapExtension);
- }
-
- /**
- * guess data type suitable for a given sequence data set
- *
- * @param alignment alignment
- *
- * @return suitable DataType object
- */
- public static DataType getSuitableInstance(Alignment alignment)
- {
- // count A, C, G, T, U, N
- long numNucs = 0;
- long numChars = 0;
- long numBins = 0;
- for (int i = 0; i < alignment.getSequenceCount(); i++)
- {
- for (int j = 0; j < alignment.getSiteCount(); j++)
- {
- char c = alignment.getData(i, j);
-
- if (c == 'A' || c == 'C' || c == 'G' ||
- c == 'T' || c == 'U' || c == 'N') numNucs++;
-
- if (c != '-' && c != '?') numChars++;
-
- if (c == '0' || c == '1') numBins++;
- }
- }
-
- if (numChars == 0) numChars = 1;
-
- // more than 85 % frequency advocates nucleotide data
- if ((double) numNucs / (double) numChars > 0.85)
- {
- return new Nucleotides();
- }
- else if ((double) numBins / (double) numChars > 0.2)
- {
- return new TwoStates();
- }
- else
- {
- return new AminoAcids();
- }
- }
-
- /** count states (creates dataType if not yet specified) */
- public static double[] estimateFrequencies(Alignment a)
- {
-
- if (a.getDataType() == null)
- {
- a.setDataType(getSuitableInstance(a));
- }
-
- int numStates = a.getDataType().getNumStates();
-
- double[] frequency = new double[numStates];
-
- long[] stateCount = new long[numStates+1];
-
- for (int i = 0; i < numStates+1; i++)
- {
- stateCount[i] = 0;
- }
-
- for (int i = 0; i < a.getSequenceCount(); i++)
- {
- for (int j = 0; j < a.getSiteCount(); j++)
- {
- stateCount[a.getDataType().getState(a.getData(i,j))] += 1;
- }
- }
-
- // Compute frequencies suitable for RateMatrix (sum = 1.0)
- long sumStates = a.getSiteCount()*a.getSequenceCount()-stateCount[numStates];
- for (int i = 0; i < numStates; i++)
- {
- frequency[i] = (double) stateCount[i]/sumStates;
- }
-
- a.setFrequency(frequency);
-
- return frequency;
- }
-
-
- public static final boolean isSiteRedundant(Alignment a, int site) {
- int numSeq = a.getSequenceCount();
- for(int i = 0 ; i < numSeq ; i++) {
- if (!isGap(a, i,site)) {
- return false;
- }
- }
- return true;
- }
-
- public static final Alignment removeRedundantSites(Alignment a) {
- boolean[] keep = new boolean[a.getSiteCount()];
- int toKeep = 0;
- for(int i = 0 ; i < keep.length ;i++) {
- keep[i] = !isSiteRedundant(a,i);
- if(keep[i]) {
- toKeep++;
- }
- }
- String[] newSeqs = new String[a.getSequenceCount()];
- int numberOfSites = a.getSiteCount();
- for(int i = 0 ; i < newSeqs.length ; i++) {
- StringBuffer sb = new StringBuffer(toKeep);
- for(int j = 0 ; j < numberOfSites ; j++) {
- if(keep[j]) {
- sb.append(a.getData(i,j));
- }
- }
- newSeqs[i] = sb.toString();
- }
- return new SimpleAlignment(a, newSeqs);
- }
-
- /**
- * Returns true if the alignment has a gap at the site in the
- * sequence specified.
- */
- public static boolean isGap(Alignment a, int seq, int site) {
- return DataTypeUtils.isGap(a.getDataType(), a.getData(seq, site));
- }
-
- /**
- * @param startingCodonPosition from {0,1,2}, representing codon position
- * of first value in sequences...
- * @param translator the translator to use for converting codons to
- * amino acids.
- * @param removeIncompleteCodons removes end codons that are not complete
- * (due to startingPosition, and sequence length).
- */
- public static void getPositionMisalignmentInfo(Alignment a, PrintWriter
- out, int startingCodonPosition, CodonTable translator, boolean removeIncompleteCodons) {
- int leftGaps, rightGaps; //The gaps to the left and right of the center nucleotide
- for(int i = 0 ; i < a.getSequenceCount() ; i++) {
- int codonPosition = startingCodonPosition;
- String codon = "";
- boolean first = true;
- out.print(a.getIdentifier(i)+":");
- leftGaps = 0;
- rightGaps = 0;
- for(int j = 0 ; j < a.getSiteCount() ; j++) {
- char c = a.getData(i, j);
- if(isGap(a, i, j)) {
- switch(codonPosition) {
- case 1: { leftGaps++; break; }
- case 2: { rightGaps++; break; }
- default: { out.print(c); break; }
- }
- } else {
- codon+=c;
- if(codonPosition==2) {
- if(!first||!(first&&codon.length()!=3&&removeIncompleteCodons)) {
- if(!first||(first&&startingCodonPosition==0)) {
- out.print('[');
- }
- outputChar(out,Alignment.GAP,leftGaps);
- out.print(translator.getAminoAcidChar(codon.toCharArray())); //Translator takes care of wrong length codons!S
- outputChar(out,Alignment.GAP,rightGaps); out.print(']');
- }
- first = false; codon = ""; leftGaps = 0; rightGaps = 0;
- }
- codonPosition = (codonPosition+1)%3;
- }
- }
- //If we finish on an incomplete codon (we ignore the case where a sequence is less than 3 nucleotides
- if(!removeIncompleteCodons && codonPosition!=0) {
- out.print('[');
- outputChar(out,Alignment.GAP,leftGaps);
- out.print('?');
- outputChar(out,Alignment.GAP,rightGaps);
- }
- out.print("\n");
- }
- }
-
- /**
- @param startingCodonPosition - from {0,1,2}, representing codon position of first value in sequences...
- @note uses middle nucelotide of code to display info...
- */
- public static void getPositionMisalignmentInfo(Alignment a, PrintWriter out, int startingCodonPosition) {
- for(int i = 0 ; i < a.getSequenceCount() ; i++) {
- int codonPosition = startingCodonPosition;
- out.print(a.getIdentifier(i)+":");
- for(int j = 0 ; j < a.getSiteCount(); j++) {
- char c = a.getData(i, j);
- if(isGap(a, i, j)) {
- out.print(c);
- }
- else {
- switch(codonPosition) {
- case 0 : { out.print('['); break; }
- case 1 : { out.print(c); break; }
- case 2 : { out.print(']'); break; }
- }
- codonPosition = (codonPosition+1)%3;
- }
-
- }
- out.print("\n");
- }
- }
-
- // PRIVATE METHODS
-
- private static final void outputChar(PrintWriter out, char c, int number) {
- for(int i = 0 ; i < number ; i++) {
- out.print(c);
- }
- }
-
- private static void printNextSites(Alignment a, PrintWriter out, boolean chunked, int seq, int start, int num)
- {
- // Print next num characters
- for (int i = 0; (i < num) && (start + i < a.getSiteCount()); i++)
- {
- // Chunks of 10 characters
- if (i % 10 == 0 && i != 0 && chunked)
- {
- out.print(' ');
- }
- out.print(a.getData(seq, start+i));
- }
- }
-
- /**
- * Returns the gap creation costs between sequences x and y from site start to site finish.
- * @param a alignment
- * @param x first sequence
- * @param y second sequence
- * @param start first site to consider (inclusive)
- * @param finish last site to consider (inclusive)
- */
- private static int getNaturalGapCost(Alignment a, int x, int y,
- int start, int finish) {
-
- int totalCost = 0;
- boolean inGap = false;
-
- // get gap creation costs
- for (int i = start; i <= finish; i++) {
- // if not a gap in one of them then consider column for x
- if (!(isGap(a, y, i) && isGap(a, x, i))) {
- // if gap in x then its the start of gap or already in gap
- if (isGap(a, x, i)) {
- // if not in gap then new gap
- if (!inGap) {
- totalCost += 1;
- inGap = true;
- } // else in gap and no extra cost
- } else {
- // else not null in x therefore not in gap
- inGap = false;
- }
- }
- }
-
- return totalCost;
- }
-
-//=================================================================
- private static final boolean isGoodSite(Alignment a, DataType dt, int site) {
- int numberOfSequences = a.getSequenceCount();
- for(int i = 0 ; i < numberOfSequences ; i++) {
- char c = a.getData(i,site);
- if(c!=Alignment.GAP&&dt.isUnknownState(dt.getState(c))) {
- return false;
- }
- }
- return true;
- }
-
- /** Returns an alignment which follows the pattern of the input alignment
- except that all sites which do not contain states in dt (excluding the
- gap character) are removed. The Datatype of the returned alignment is dt
- */
- public static final Alignment getChangedDataType(Alignment a, DataType dt) {
- int numberOfSites = a.getSiteCount();
- boolean[] include = new boolean[numberOfSites];
- int goodSiteCount = 0;
- for(int i = 0 ; i < numberOfSites ; i++) {
- include[i] = isGoodSite(a,dt,i);
- if(include[i]) {
- goodSiteCount++;
- }
- }
- //Yes, I'm aware it may be slightly faster to nest sequence
- // in site but it's easier to program this way
- String[] sequences = new String[a.getSequenceCount()];
- for(int i = 0 ; i < sequences.length ; i++) {
- char[] seq = new char[goodSiteCount];
- int count = 0;
- for(int j = 0 ; j < numberOfSites ; j++) {
- if(include[j]) {
- seq[count] = a.getData(i,j);
- count++;
- }
- }
- sequences[i] = new String(seq);
- }
- SimpleAlignment sa = new SimpleAlignment(new SimpleIdGroup(a), sequences);
- sa.setDataType(dt);
- return sa;
- }
-
- /**
- * Returns the score of this alignment based on all pairwise distance measures.
- * @param a alignment to score
- * @param cdm the character distance matrix
- * @param x
- */
- private static CostBag getAlignmentPenalty(Alignment a,
- TransitionPenaltyTable penalties,
- int x, int y, int[] xindices, int[] yindices,
- boolean local) {
-
- int start = 0;
- int finish = a.getSiteCount() - 1;
- if (local) {
- while (isGap(a, y, start) || isGap(a, x, start)) {
- start += 1;
- }
- while (isGap(a, y, finish) || isGap(a, x, finish)) {
- finish -= 1;
- }
- }
-
- // get gap costs (creation penalties)
- int gapCost = getNaturalGapCost(a, x, y, start, finish) +
- getNaturalGapCost(a, y, x, start, finish);
-
- int gapExCost = 0;
-
- double subCosts = 0.0;
- // get substitution costs (including extension penalties)
- for (int i = start; i <= finish; i++) {
- if (isGap(a, x, i) || isGap(a, y, i)) {
- if (a.getData(x, i) != a.getData(y, i)) {
- gapExCost += 1;
- }
- } else {
- subCosts += penalties.penalty(xindices[i], yindices[i]);
- }
- }
-
- return new CostBag(gapCost, gapExCost, subCosts);
- }
-
-}
-
-class CostBag {
-
- int gc = 0;
- int ge = 0;
- double substitutions = 0.0;
-
- public CostBag() {}
-
- public CostBag(int gc, int ge, double subs) {
- this.gc = gc;
- this.ge = ge;
- substitutions = subs;
- }
-
- public void add(CostBag bag) {
- gc += bag.gc;
- ge += bag.ge;
- substitutions += bag.substitutions;
- }
-
- public double score(double x, double y) {
- return substitutions + (gc * (x - y)) + (ge * y);
- }
-
- public double approximateIntegral(double x1, double x2,
- double y1, double y2) {
-
- double dx = (x2 - x1) / 100.0;
- double dy = (y2 - y1) / 100.0;
-
- double total = 0.0;
-
- int count = 0;
- for (double x = x1; x <= x2; x += dx) {
- for (double y = y1; y <= y2; y += dy) {
- total += score(x, y);
- count += 1;
- }
- }
-
- total /= (double)count;
-
- return total * (x2 - x1) * (y2 - y1);
- }
-
-}
-
-
diff --git a/LibrarySource/pal/alignment/AminoAcidAlignment.java b/LibrarySource/pal/alignment/AminoAcidAlignment.java
deleted file mode 100644
index 2ffdde6..0000000
--- a/LibrarySource/pal/alignment/AminoAcidAlignment.java
+++ /dev/null
@@ -1,102 +0,0 @@
-// AminoAcidAlignment.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.alignment;
-
-import pal.datatype.*;
-
-
-/**
- * generates an amino acid alignment from a nucleotide alignment. Is designed to
- * translate from nucleotide alignments that do not have gaps. Codons that include
- * one or more gaps will be translated as a '?'.
- *
- * @version $Id: AminoAcidAlignment.java,v 1.5 2001/07/13 14:39:12 korbinian Exp $
- *
- * @author Matthew Goode
- */
-public class AminoAcidAlignment extends AbstractAlignment {
-
-
-
- //
- // Public stuff
- //
-
- /**
- * Constructs an AminoAcidAlignment from a given alignment
- * (which should be a nucleotide alignment), from codon position 0.
- *
- * @param raw original alignment
- * @param if a codon contains a gap or uses non nucleotide
- * characters resulting amino acid will be marked as a '?'
- */
- public AminoAcidAlignment(Alignment raw) {
- this(raw,0);
- }
-
- /**
- * Constructor
- *
- * @param raw original alignment
- * @param startingCodonPosition - the starting codon position (0,1,2)
- * @param if a codon contains a gap or uses non nucleotide characters
- * resulting amino acid will be marked as a '?'
- */
- public AminoAcidAlignment(Alignment raw, int startingCodonPosition) {
- this(raw,startingCodonPosition,CodonTableFactory.createUniversalTranslator());
- }
-
- /**
- * Constructor
- *
- * @param raw original alignment
- * @param startingCodonPosition - the starting codon position (0,1,2)
- * @param trans - the CodonTable to use to convert nucleotides to amino acids
- * @param if a codon contains a gap or uses non nucleotide
- * characters resulting amino acid will be marked as a '?'
- */
- public AminoAcidAlignment(Alignment raw, int startingCodonPosition,
- CodonTable trans) {
- numSeqs = raw.getSequenceCount();
- idGroup = raw;
- numSites = (raw.getSiteCount()-startingCodonPosition)/3;
- dataType = new AminoAcids();
- this.data_ = new char[numSeqs][numSites];
- constructData(raw,startingCodonPosition, trans);
- }
-
- private void constructData(Alignment raw, int startingCodonPosition,
- CodonTable trans) {
- for(int i = 0 ; i < numSeqs ; i++) {
- for(int j = 0 ; j < numSites ; j++) {
- char[] cs = new char[3];
- for(int k = 0 ; k < 3 ; k++) {
- cs[k]=raw.getData(i,j*3+startingCodonPosition+k);
- }
- this.data_[i][j] = trans.getAminoAcidChar(cs);
- }
- }
- }
-
- // Implementation of abstract Alignment method
-
- /** sequence alignment at (sequence, site) */
- public char getData(int seq, int site)
- {
- return data_[seq][site];
- }
-
-
- //
- // Private stuff
- //
-
- private char[][] data_;
-}
-
diff --git a/LibrarySource/pal/alignment/BootstrappedAlignment.java b/LibrarySource/pal/alignment/BootstrappedAlignment.java
deleted file mode 100644
index ca91462..0000000
--- a/LibrarySource/pal/alignment/BootstrappedAlignment.java
+++ /dev/null
@@ -1,75 +0,0 @@
-// BootstrappedAlignment.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.alignment;
-
-import pal.math.*;
-import pal.misc.*;
-
-
-/**
- * generates bootstrapped alignments from a raw alignment
- *
- * @version $Id: BootstrappedAlignment.java,v 1.4 2001/07/13 14:39:12 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class BootstrappedAlignment extends AbstractAlignment
-{
- //
- // Public stuff
- //
-
- /**
- * Constructor
- *
- * @param raw original alignment
- */
- public BootstrappedAlignment(Alignment raw)
- {
- rawAlignment = raw;
-
- numSeqs = raw.getSequenceCount();
- idGroup = raw;
- numSites = raw.getSiteCount();
- dataType = raw.getDataType();
-
- alias = new int[numSites];
- urn = new UrnModel(numSites);
-
- bootstrap();
- }
-
- // Implementation of abstract Alignment method
-
- /** sequence alignment at (sequence, site) */
- public char getData(int seq, int site)
- {
- return rawAlignment.getData(seq, alias[site]);
- }
-
-
- /** bootstrap alignment */
- public void bootstrap()
- {
- for (int i = 0; i < numSites; i++)
- {
- alias[i] = urn.drawPutBack();
- }
- }
-
-
- //
- // Private stuff
- //
-
- private UrnModel urn;
- private Alignment rawAlignment;
- private int[] alias;
-}
-
diff --git a/LibrarySource/pal/alignment/CodonAlignment.java b/LibrarySource/pal/alignment/CodonAlignment.java
deleted file mode 100644
index 785f739..0000000
--- a/LibrarySource/pal/alignment/CodonAlignment.java
+++ /dev/null
@@ -1,103 +0,0 @@
-// CodonAlignment.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.alignment;
-
-import pal.datatype.*;
-
-
-/**
- * generates an codon alignment from a nucleotide alignment. Is designed to
- * translate from nucleotide alignments that do not have gaps. Codons that include
- * one or more gaps will be translated as a '?' (an UNKNOWN_CHARACTER).
- *
- * @version $Id: CodonAlignment.java,v 1.4 2001/07/13 14:39:12 korbinian Exp $
- *
- * @author Matthew Goode
- */
-public class CodonAlignment extends AbstractAlignment {
-
- public static final GeneralizedCodons DEFAULT_CODON_TRANSLATOR = new GeneralizedCodons();
-
-
- //
- // Public stuff
- //
-
- /**
- * Constructs an CodonAlignment from a given alignment
- * (which should be a nucleotide alignment), from codon position 0.
- *
- * @param raw original alignment
- * @param if a codon contains a gap or uses non nucleotide
- * characters resulting amino acid will be marked as a '?'
- */
- public CodonAlignment(Alignment raw) {
- this(raw,0);
- }
-
- /**
- * Constructor
- *
- * @param raw original alignment
- * @param startingCodonPosition - the starting codon position (0,1,2)
- * @param if a codon contains a gap or uses non nucleotide characters
- * resulting amino acid will be marked as a '?'
- */
- public CodonAlignment(Alignment raw, int startingCodonPosition) {
- this(raw,startingCodonPosition,DEFAULT_CODON_TRANSLATOR);
- }
-
- /**
- * Constructor
- *
- * @param raw original alignment
- * @param startingCodonPosition - the starting codon position (0,1,2)
- * @param trans - the translator (DataType) to use to convert nucleotides to amino acids
- * @param if a codon contains a gap or uses non nucleotide
- * characters resulting amino acid will be marked as a '?'
- */
- public CodonAlignment(Alignment raw, int startingCodonPosition,
- GeneralizedCodons trans) {
- numSeqs = raw.getSequenceCount();
- idGroup = raw;
- numSites = (raw.getSiteCount()-startingCodonPosition)/3;
- dataType = new GeneralizedCodons();
- this.data_ = new char[numSeqs][numSites];
- constructData(raw,startingCodonPosition, trans);
- }
-
- private void constructData(Alignment raw, int startingCodonPosition,
- GeneralizedCodons trans) {
- for(int i = 0 ; i < numSeqs ; i++) {
- for(int j = 0 ; j < numSites ; j++) {
- char[] cs = new char[3];
- for(int k = 0 ; k < 3 ; k++) {
- cs[k]=raw.getData(i,j*3+startingCodonPosition+k);
- }
- this.data_[i][j] = trans.getCodonCharFromCodon(cs);
- }
- }
- }
-
- // Implementation of abstract Alignment method
-
- /** sequence alignment at (sequence, site) */
- public char getData(int seq, int site)
- {
- return data_[seq][site];
- }
-
-
- //
- // Private stuff
- //
-
- private char[][] data_;
-}
-
diff --git a/LibrarySource/pal/alignment/ConcatenatedAlignment.java b/LibrarySource/pal/alignment/ConcatenatedAlignment.java
deleted file mode 100644
index cf0f51f..0000000
--- a/LibrarySource/pal/alignment/ConcatenatedAlignment.java
+++ /dev/null
@@ -1,89 +0,0 @@
-// ConcatenatedAlignment.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.alignment;
-
-/**
- * concatenates a list of alignments to one single alignment,
- * increasing the number of sites
- *
- * @version $Id: ConcatenatedAlignment.java,v 1.3 2001/07/13 14:39:12 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class ConcatenatedAlignment extends AbstractAlignment
-{
- //
- // Public stuff
- //
-
- /**
- * concatenate alignments
- *
- * @param Alignment array with alignment to concatenate
- */
- public ConcatenatedAlignment(Alignment[] list)
- throws IllegalArgumentException
- {
- alignmentList = list;
-
- numAlignments = alignmentList.length;
- if (numAlignments == 0)
- {
- throw new IllegalArgumentException("NO ALIGNMENT");
- }
-
- numSeqs = alignmentList[0].getSequenceCount();
- idGroup = alignmentList[0];
-
- numSites = 0;
- for (int i = 0; i < numAlignments; i++)
- {
- numSites += alignmentList[i].getSiteCount();
-
- if (alignmentList[i].getSequenceCount() != numSeqs)
- {
- throw new IllegalArgumentException("INCOMPATIBLE ALIGNMENTS");
- }
- }
-
- // Create indices
- alignmentIndex = new int[numSites];
- siteIndex = new int[numSites];
-
- int s = 0;
- for (int i = 0; i < numAlignments; i++)
- {
- for (int j = 0; j < alignmentList[i].getSiteCount(); j++)
- {
- alignmentIndex[s+j] = i;
- siteIndex[s+j] = j;
- }
- s += alignmentList[i].getSiteCount();
- }
- }
-
- // Implementation of abstract Alignment method
-
- /** sequence alignment at (sequence, site) */
- public char getData(int seq, int site)
- {
- return alignmentList[alignmentIndex[site]].getData(seq, siteIndex[site]);
- }
-
-
- //
- // Private stuff
- //
-
- private Alignment[] alignmentList;
- private int numAlignments;
- private int[] alignmentIndex;
- private int[] siteIndex;
-}
-
diff --git a/LibrarySource/pal/alignment/GapBalancedAlignment.java b/LibrarySource/pal/alignment/GapBalancedAlignment.java
deleted file mode 100644
index 17459c2..0000000
--- a/LibrarySource/pal/alignment/GapBalancedAlignment.java
+++ /dev/null
@@ -1,230 +0,0 @@
-// GapBalancedAcidAlignment.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.alignment;
-
-/**
- * Creates a "Gap-Balanced" alignment.
- *
- * @version $Id: GapBalancedAlignment.java,v 1.5 2001/07/13 14:39:12 korbinian Exp $
- *
- * @author Matthew Goode
- */
-public class GapBalancedAlignment extends AbstractAlignment implements java.io.Serializable{
-
- final static int DEFAULT_CODON_LENGTH = 3; /** Just in case we find some Alien DNA */
-
- //
- // Public stuff
- //
-
- /**
- * The standard GapBalanced constructor
- *
- * @param Alignment on which to based this gap balanced alignment
- * @param the estimated startingCodonPosition of the alignment
- */
- public GapBalancedAlignment(Alignment base, int startingCodonPosition) {
- calculateData(base,startingCodonPosition,DEFAULT_CODON_LENGTH);
- }
-
- /**
- * GapBalanced power user constructor
- *
- * @param Alignment on which to based this gap balanced alignment
- * @param startingCodonPosition the starting codon position of the alignment
- * @param codonLength the length of a codon (to make things general,
- * - the author is a Computer Scientist)
- */
- public GapBalancedAlignment(Alignment base, int startingCodonPosition,int codonLength) {
- calculateData(base,startingCodonPosition,codonLength);
- }
-
-
- /** Generates Alignment information by removing sites that have misaligned codon positions */
- private void calculateData(Alignment base, int startingCodonPosition, int codonLength) {
- GapIterator gi = new GapIterator(base,startingCodonPosition, codonLength);
- gi.processAllSites();
- data_ = gi.getData();
-
-
- this.numSeqs = gi.getNumberOfSequences();
- this.numSites = gi.getNumberOfAcceptedSites();
- this.idGroup = base;
-
-
- }
-
- // Implementation of abstract Alignment method
-
- /** sequence alignment at (sequence, site) */
- public char getData(int seq, int site)
- {
- return data_[seq][site];
- }
-
-
- //
- // Private stuff
- //
- private char[][] data_;
-
-}
-
-
-/** An statefull algorithmic solution.
-*/
-class GapIterator {
-
- Alignment base_;
- int startingCodonPosition_;
-
- int numberOfSites_ = -1;
- int numberOfSequences_ = -1;
-
- boolean[] siteAcceptance_ = null;
- int numberOfAcceptedSites_ = -1;
- int[] currentSequenceCodonPosition_ = null;
-
- int currentSite_ = -1;
-
- int codonLength_ = -1;
-
- int currentCodonPosition_ = -1;
- int[] currentCodonSites_;
- int numberOfCurrentCodonSites_ = -1;
-
- transient boolean acceptSite_ = false;
- transient boolean allGaps_ = false;
- transient int predominateCodonPosition_ = -1;
-
- public GapIterator(Alignment base, int startingCodonPosition, int codonLength) {
- this.base_ = base;
- this.startingCodonPosition_ = startingCodonPosition;
- this.codonLength_ = codonLength;
- setup();
- reset();
-
- }
-
- private void setup() {
- this.numberOfSites_ = base_.getSiteCount();
- this.numberOfSequences_ = base_.getSequenceCount();
- siteAcceptance_ = new boolean[numberOfSites_];
- currentSequenceCodonPosition_ = new int[numberOfSequences_];
- currentCodonSites_ = new int[codonLength_];
- }
-
- public void reset() {
- for(int i = 0 ; i < siteAcceptance_.length ; i++) {
- siteAcceptance_[i] = false;
- }
- numberOfAcceptedSites_ = 0;
- for(int i = 0 ; i < currentSequenceCodonPosition_.length ; i++) {
- currentSequenceCodonPosition_[i] = startingCodonPosition_;
- }
- currentSite_ = 0;
- currentCodonPosition_ = startingCodonPosition_;
- }
-
- public final void processAllSites() {
- while(hasMoreSites()) {
- processAnotherSite();
- }
- }
-
- public boolean hasMoreSites() {
- return (currentSite_ < numberOfSites_);
- }
-
- public int getCurrentSite() {
- return currentSite_;
- }
-
- /** Proccess a site and sets up instance variables acceptSite_, predominateCodonPosition_, allGaps_
- */
- private synchronized void processSite(int siteNumber) {
- acceptSite_ = true;
- predominateCodonPosition_ = -1;
- allGaps_ = true;
- for(int currentSequence = 0 ; currentSequence < numberOfSequences_ ; currentSequence++) {
- char c = base_.getData(currentSequence,currentSite_);
- if(c!=Alignment.GAP) {
- allGaps_ = false;
- if(predominateCodonPosition_==-1) {
- predominateCodonPosition_ = currentSequenceCodonPosition_[currentSequence];
- } else {
- if(currentSequenceCodonPosition_[currentSequence]!=predominateCodonPosition_) {
- acceptSite_ = false;
- }
- }
- currentSequenceCodonPosition_[currentSequence] = (currentSequenceCodonPosition_[currentSequence]+1)%codonLength_;
- } else {
- acceptSite_ = false;
- }
- }
- }
-
- private synchronized void acceptCurrentCodon() {
- for(int i = 0 ; i < 3 ; i ++ ) {
- siteAcceptance_[currentCodonSites_[i]] = true;
- }
- numberOfAcceptedSites_+=3;
- removeCurrentCodon();
- }
-
- private synchronized void removeCurrentCodon() {
- currentCodonPosition_ = 0;
- }
- public synchronized void processAnotherSite() {
-
- processSite(currentSite_);
- if(acceptSite_) {
- if(predominateCodonPosition_!=currentCodonPosition_) { // If things don't line up we remove the related sites...
- acceptSite_=false;
- removeCurrentCodon();
- }
- } else {
- if(!allGaps_) {
- removeCurrentCodon();
- }
- }
- if(acceptSite_) {
- currentCodonSites_[currentCodonPosition_] = currentSite_;
- currentCodonPosition_ = currentCodonPosition_+1;
- if(currentCodonPosition_==3) {
- acceptCurrentCodon();
- }
- }
- currentSite_++;
- }
-
- public int getNumberOfSequences() {
- return numberOfSequences_;
- }
-
- public int getNumberOfAcceptedSites() {
- return numberOfAcceptedSites_;
- }
-
- public synchronized char[][] getData() {
- char[][] data = new char[numberOfSequences_][numberOfAcceptedSites_];
- int currentAcceptedSiteIndex = 0;
- for(int j = 0 ; j < numberOfSites_ ; j++) {
- if(siteAcceptance_[j]) {
- for(int i = 0 ; i < numberOfSequences_; i++) {
- data[i][currentAcceptedSiteIndex] = base_.getData(i,j);
- }
- currentAcceptedSiteIndex++;
- }
- }
- return data;
- }
-
-
-}
-
diff --git a/LibrarySource/pal/alignment/JumbledAlignment.java b/LibrarySource/pal/alignment/JumbledAlignment.java
deleted file mode 100644
index da018a8..0000000
--- a/LibrarySource/pal/alignment/JumbledAlignment.java
+++ /dev/null
@@ -1,78 +0,0 @@
-// JumbledAlignment.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.alignment;
-
-import pal.math.*;
-import pal.misc.*;
-
-
-/**
- * generates jumbled alignments (randomizing input order of sequences)
- *
- * @version $Id: JumbledAlignment.java,v 1.4 2001/07/13 14:39:12 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class JumbledAlignment extends AbstractAlignment
-{
- //
- // Public stuff
- //
-
- /*
- * create jumbled alignment
- *
- * @param raw original alignment
- */
- public JumbledAlignment(Alignment raw)
- {
- rawAlignment = raw;
-
- numSeqs = raw.getSequenceCount();
- numSites = raw.getSiteCount();
-
- idGroup = new SimpleIdGroup(numSeqs);
- alias = new int[numSeqs];
-
- urn = new UrnModel(numSeqs);
-
- jumble();
- }
-
- // Implementation of abstract Alignment method
-
- /** sequence alignment at (sequence, site) */
- public char getData(int seq, int site)
- {
- return rawAlignment.getData(alias[seq], site);
- }
-
-
- /** jumble sequences (rearrange input order) */
- public void jumble()
- {
- urn.reset();
- for (int i = 0; i < numSeqs; i++)
- {
- alias[i] = urn.drawDontPutBack();
- idGroup.setIdentifier(i, rawAlignment.getIdentifier(alias[i]));
- }
- }
-
-
- //
- // Private stuff
- //
-
- private UrnModel urn;
- private Alignment rawAlignment;
- private int[] alias;
-}
-
diff --git a/LibrarySource/pal/alignment/ReadAlignment.java b/LibrarySource/pal/alignment/ReadAlignment.java
deleted file mode 100644
index 422f9f2..0000000
--- a/LibrarySource/pal/alignment/ReadAlignment.java
+++ /dev/null
@@ -1,410 +0,0 @@
-// ReadAlignment.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.alignment;
-
-import pal.io.*;
-import pal.misc.*;
-
-import java.io.*;
-import java.util.*;
-
-
-/**
- * reads aligned sequence data from plain text files.<p>
- *
- * recognizes PHYLIP 3.4 INTERLEAVED,
- * PHYLIP SEQUENTIAL,
- * CLUSTAL and derived formats.<p>
- *
- * Other features:
- * - the dot as "copy character" is recognized,
- * - all base characters are capitalized,
- * - automatic data type estimation
- * - determination of corresponding base frequencies.
- *
- * @version $Id: ReadAlignment.java,v 1.4 2001/07/13 14:39:12 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class ReadAlignment extends AbstractAlignment
-{
- //
- // Public stuff
- //
-
- /** read from stream */
- public ReadAlignment(PushbackReader input)
- throws AlignmentParseException, IOException
- {
- readFile(input);
- }
-
- /** read from file */
- public ReadAlignment(String file)
- throws AlignmentParseException, IOException
- {
- PushbackReader input = InputSource.openFile(file);
- readFile(input);
- input.close();
- }
-
-
- // Implementation of abstract Alignment method
-
- /** sequence alignment at (sequence, site) */
- public char getData(int seq, int site)
- {
- return data[seq][site];
- }
-
-
- //
- // Private stuff
- //
-
- private int lineLength;
- private Vector names, seqs, sites;
- private FormattedInput fi = FormattedInput.getInstance();
-
- // Raw sequence alignment [sequence][site]
- private char[][] data = null;
-
-
- private void readFile(PushbackReader in)
- throws AlignmentParseException, IOException
- {
- // Check for CLUSTAL style alignment
-
- int c;
- String id = "CLUSTAL";
- boolean isClustal = true;
-
- for (int i = 0; i < id.length(); i++)
- {
- c = fi.readNextChar(in);
- if (c != id.charAt(i) && isClustal)
- {
- isClustal = false;
- in.unread(c);
- break;
- }
- }
-
- if (isClustal)
- {
- fi.nextLine(in);
- readCLUSTALW(in);
- }
- else
- {
- readPHYLIP(in);
- }
-
- // Capitalize
- for (int i = 0; i < numSeqs; i++)
- {
- for (int j = 0; j < numSites; j++)
- {
- data[i][j] = Character.toUpperCase(data[i][j]);
- }
- }
-
- // Estimate data type
- guessDataType();
-
- // Determine frequencies
- AlignmentUtils.estimateFrequencies(this);
- }
-
- // Read alignment (in CLUSTAL W format)
- private void readCLUSTALW(PushbackReader in)
- throws AlignmentParseException
- {
- int EOF = -1;
- int c, seq = 0, pos = 0;
-
- try
- {
- // Find start block
- c = fi.readNextChar(in);
- in.unread(c);
-
- names = new Vector();
- seqs = new Vector();
-
- // Reading first data block
- c = in.read();
- while (c != ' ' && c != '\n' && c != '\r')
- {
- in.unread(c);
- names.addElement(fi.readLabel(in, 10));
- readSeqLineC(in, seq, pos);
- seq++;
- c = in.read();
- }
- in.unread(c);
-
-
- // Skip CLUSTAL W status line
- fi.nextLine(in);
-
- pos += lineLength;
- numSeqs = seq;
-
- // Go to next block
- c = fi.readNextChar(in);
- in.unread(c);
-
- // Reading remaining blocks
- while (c != EOF)
- {
- for (seq = 0; seq < numSeqs; seq++)
- {
- // goto next blank
- do
- {
- c = in.read();
- }
- while (c != ' ');
-
- readSeqLineC(in, seq, pos);
- }
-
- // Skip CLUSTAL W status line
- fi.nextLine(in);
-
- pos += lineLength;
-
- // Go to next block
- c = fi.readNextChar(in);
- in.unread(c);
- }
-
- numSites = pos;
-
- // Copy to array
- idGroup = new SimpleIdGroup(numSeqs);
- data = new char[numSeqs][numSites];
- for (int i = 0; i < numSeqs; i++)
- {
- idGroup.setIdentifier(i,
- new Identifier((String)names.elementAt(i)));
- }
- for (int i = 0; i < numSeqs; i++)
- {
- for (int j = 0; j < numSites; j++)
- {
- data[i][j] =
- ((Character)
- ((Vector) seqs.elementAt(i)
- ).elementAt(j)).charValue();
- }
- }
-
- // Help garbage collector
- names = null;
- for (int i = 0; i < numSeqs; i++)
- {
- ((Vector) seqs.elementAt(i)).removeAllElements();
- }
- seqs = null;
- }
- catch (IOException e)
- {
- throw new AlignmentParseException("IO error after pos. " + (pos + 1) + ", seq. " + (seq + 1));
- }
- }
-
-
- private void readSeqLineC(PushbackReader in, int s, int pos)
- throws IOException, AlignmentParseException
- {
- int c;
-
- if (pos == 0)
- {
- sites = new Vector();
- seqs.addElement(sites);
- }
- else
- {
- sites = (Vector) seqs.elementAt(s);
- }
-
- if (s == 0)
- {
- String thisLine = fi.readLine(in, false);
- lineLength = thisLine.length();
-
- for (int i = 0; i < lineLength; i++)
- {
- c = thisLine.charAt(i);
- if (c == '.')
- {
- throw new AlignmentParseException("Copy character (.) in first sequence not allowed (pos. "
- + (i + pos + 1) + ")");
- }
- sites.addElement(new Character((char) c));
- }
- }
- else
- {
- for (int i = 0; i < lineLength; i++)
- {
- c = fi.readNextChar(in);
- if (c == '.')
- {
- c = ((Character)
- ((Vector) seqs.elementAt(0)
- ).elementAt(pos + i)).charValue();
- }
- sites.addElement(new Character((char) c));
- }
- fi.nextLine(in);
- }
- }
-
- // Read alignment (in PHYLIP 3.4 INTERLEAVED or PHYLIP SEQUENTIAL format)
- private void readPHYLIP(PushbackReader in)
- throws AlignmentParseException
- {
- int c, pos = 0, seq = 0;
-
- try
- {
- // Parse PHYLIP header line
- numSeqs = fi.readInt(in);
- numSites = fi.readInt(in);
-
- // Reserve memory
- idGroup = new SimpleIdGroup(numSeqs);
- data = new char[numSeqs][numSites];
-
-
- // Determine whether sequences are in INTERLEAVED
- // or in sequential format
- String header = fi.readLine(in, false);
-
- boolean interleaved = true;
-
- if (header.length() > 0)
- {
- if (header.charAt(0) == 'S')
- {
- interleaved = false;
- }
- }
-
- if (interleaved) // PHYLIP INTERLEAVED
- {
- //System.out.println("PHYLIP INTERLEAVED");
-
-
- // Reading data
- while (pos < numSites)
- {
- // Go to next block
- c = fi.readNextChar(in);
- in.unread(c);
-
- for (seq = 0; seq < numSeqs; seq++)
- {
- readSeqLineP(in, seq, pos, numSites);
- }
- pos += lineLength;
- }
- }
- else // PHYLIP SEQUENTIAL
- {
- //System.out.println("PHYLIP SEQUENTIAL");
-
- for (seq = 0; seq < numSeqs; seq++)
- {
- // Go to next block
- c = fi.readNextChar(in);
- in.unread(c);
-
- // Read label
- idGroup.setIdentifier(seq, new Identifier(fi.readLabel(in, 10)));
-
- // Read sequences
- for (pos = 0; pos < numSites; pos++)
- {
- data[seq][pos] = (char) fi.readNextChar(in);
-
- if (data[0][pos] == '.')
- {
- if (seq == 0)
- {
- throw new AlignmentParseException(
- "Copy character (.) in first sequence not allowed (pos. "
- + (pos + 1) + ")");
- }
- else
- {
- data[seq][pos] = data[0][pos];
- }
- }
- }
- }
- }
- }
- catch (IOException e)
- {
- throw new AlignmentParseException("IO error after pos. " + (pos + 1) + ", seq. " + (seq + 1));
- }
- }
-
- private void readSeqLineP(PushbackReader in, int s, int pos, int maxPos)
- throws IOException, AlignmentParseException
- {
- if (pos == 0)
- {
- idGroup.setIdentifier(s, new Identifier(fi.readLabel(in, 10)));
- }
-
- if (s == 0)
- {
- String thisLine = fi.readLine(in, false);
-
- if (thisLine.length() > maxPos - pos)
- {
- lineLength = maxPos - pos;
- }
- else
- {
- lineLength = thisLine.length();
- }
-
- for (int i = 0; i < lineLength; i++)
- {
- data[0][pos + i] = thisLine.charAt(i);
- if (data[0][pos + i] == '.')
- {
- throw new AlignmentParseException("Copy character (.) in first sequence not allowed (pos. "
- + (i + pos + 1) + ")");
- }
- }
- }
- else
- {
- for (int i = 0; i < lineLength; i++)
- {
- data[s][pos + i] = (char) fi.readNextChar(in);
- if (data[s][pos + i] == '.')
- {
- data[s][pos + i] = data[0][pos + i];
- }
- }
- fi.nextLine(in);
- }
- }
-}
-
diff --git a/LibrarySource/pal/alignment/SimpleAlignment.java b/LibrarySource/pal/alignment/SimpleAlignment.java
deleted file mode 100644
index 5775111..0000000
--- a/LibrarySource/pal/alignment/SimpleAlignment.java
+++ /dev/null
@@ -1,181 +0,0 @@
-// SimpleAlignment.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.alignment;
-
-import pal.io.*;
-import pal.datatype.*;
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * An alignment class that can be efficiently constructed
- * from an array of strings.
- *
- * @version $Id: SimpleAlignment.java,v 1.11 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class SimpleAlignment extends AbstractAlignment
-{
- //
- // Public stuff
- //
-
- /** The sequences */
- String[] sequences;
-
- /**
- * parameterless constructor.
- */
- public SimpleAlignment() {}
-
-
- /**
- * Clone constructor.
- */
- public SimpleAlignment(Alignment a) {
-
- String[] sequences = new String[a.getIdCount()];
- for (int i = 0; i < sequences.length; i++) {
- sequences[i] = a.getAlignedSequenceString(i);
- }
- String gaps = a.GAP + "";
-
- init(new SimpleIdGroup(a), sequences, gaps);
- }
-
- public SimpleAlignment(Identifier[] ids, String[] sequences,
- String gaps) {
-
- init(new SimpleIdGroup(ids), sequences, gaps);
- }
-
- public SimpleAlignment(IdGroup group, String[] sequences) {
-
- init(group, sequences, null);
- }
-
- public SimpleAlignment(IdGroup group, String[] sequences,
- String gaps) {
-
- init(group, sequences, gaps);
- }
-
- private void init(IdGroup group, String[] sequences, String gaps) {
-
- numSeqs = sequences.length;
- numSites = sequences[0].length();
-
- this.sequences = sequences;
- idGroup = group;
-
- if (gaps != null) {
- convertGaps(gaps);
- }
-
- AlignmentUtils.estimateFrequencies(this);
- }
-
- /**
- * Constructor taking single identifier and sequence.
- */
- public SimpleAlignment(Identifier id, String sequence, DataType dataType_) {
- this(id, sequence, dataType_ ,true);
- }
-
- /**
- * Constructor taking single identifier and sequence.
- */
- public SimpleAlignment(Identifier id, String sequence, DataType dataType_ ,boolean estFreqs) {
-
- this.dataType = dataType_;
- numSeqs = 1;
- numSites = sequence.length();
-
- sequences = new String[1];
- sequences[0] = sequence;
-
- Identifier[] ids = new Identifier[1];
- ids[0] = id;
- idGroup = new SimpleIdGroup(ids);
-
- if (estFreqs) {
- AlignmentUtils.estimateFrequencies(this);
- }
- }
-
- /**
- * This constructor combines to alignments given two guide strings.
- */
- public SimpleAlignment(Alignment a, Alignment b,
- String guide1, String guide2, char gap) {
-
- sequences = new String[a.getSequenceCount() + b.getSequenceCount()];
- numSeqs = sequences.length;
-
- for (int i = 0; i < a.getSequenceCount(); i++) {
- sequences[i] = getAlignedString(a.getAlignedSequenceString(i), guide1, gap, GAP);
- }
- for (int i = 0; i < b.getSequenceCount(); i++) {
- sequences[i + a.getSequenceCount()] =
- getAlignedString(b.getAlignedSequenceString(i), guide2, gap, GAP);
- }
-
- numSites = sequences[0].length();
- idGroup = new SimpleIdGroup(a, b);
- AlignmentUtils.estimateFrequencies(this);
- }
-
- // Abstract method
-
- /** sequence alignment at (sequence, site) */
- public char getData(int seq, int site) {
- return sequences[seq].charAt(site);
- }
-
- /**
- * Returns a string representing a single sequence (including gaps)
- * from this alignment.
- */
- public String getAlignedSequenceString(int seq) {
- return sequences[seq];
- }
-
- // PRIVATE STUFF
-
- private String getAlignedString(String original, String guide,
- char guideChar, char gapChar) {
-
- StringBuffer buf = new StringBuffer(guide.length());
- int seqcounter = 0;
- for (int j = 0; j < guide.length(); j++) {
- if (guide.charAt(j) != guideChar) {
- buf.append(original.charAt(seqcounter));
- seqcounter += 1;
- } else {
- buf.append(gapChar);
- }
- }
- return new String(buf);
- }
-
- /**
- * Converts all gap characters to Alignment.GAP
- */
- private void convertGaps(String gaps) {
- for (int i = 0; i < sequences.length; i++) {
- for (int j = 0; j < gaps.length(); j++) {
- sequences[i] = sequences[i].replace(gaps.charAt(j), Alignment.GAP);
- }
- }
- }
-}
-
diff --git a/LibrarySource/pal/alignment/SitePattern.java b/LibrarySource/pal/alignment/SitePattern.java
deleted file mode 100644
index 72b331b..0000000
--- a/LibrarySource/pal/alignment/SitePattern.java
+++ /dev/null
@@ -1,253 +0,0 @@
-// SitePattern.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-// Known bugs and limitations:
-// - computational complexity O(numSeqs*numSites)
-
-
-package pal.alignment;
-
-import pal.datatype.*;
-import pal.misc.*;
-
-
-/**
- * takes an Alignment and determines its site patterns
- *
- * @version $Id: SitePattern.java,v 1.6 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class SitePattern extends AbstractAlignment
-{
- //
- // Public stuff
- //
-
-
- /** number of site patterns */
- public int numPatterns;
-
- /** site -> site pattern */
- public int[] alias;
-
- /** weights of each site pattern */
- public int weight[];
-
- /** site patterns [sequence][site pattern] */
- public byte[][] pattern;
-
-
- // Implementation of abstract Alignment method
-
- /** sequence alignment at (sequence, site) */
- public char getData(int seq, int site)
- {
- return dataType.getChar(pattern[seq][alias[site]]);
- }
-
- /**
- * infer site patterns for a given alignment
- *
- * @param a alignment
- */
- public SitePattern(Alignment a)
- {
- if (a.getDataType() == null)
- {
- a.setDataType(AlignmentUtils.getSuitableInstance(a));
- }
-
- // Fields from Alignment
- dataType = a.getDataType();
- numSites = a.getSiteCount();
- numSeqs = a.getSequenceCount();
- idGroup = a;
- frequency = a.getFrequency(); // Bernard Suh <bsuh at tigr.org>
-
-
- makeSitePattern(a);
- }
-
- /**
- * construct SitePattern from scratch
- *
- * @param dataType data type
- * @param numSites number of sites
- * @param numSeqs number of sequences
- * @param idGroup sequence identifiers
- * @param numPatterns number of site patterns
- * @param alias link site -> site pattern
- * @param weight frequency of a site pattern
- * @param pattern site patterns
- */
- public SitePattern(DataType dataType, int numSites, int numSeqs, IdGroup idGroup,
- int numPatterns, int[] alias, int[] weight, byte[][] pattern)
- {
- this.dataType = dataType;
- this.numSites = numSites;
- this.numSeqs = numSeqs;
- this.idGroup = idGroup;
-
- this.numPatterns = numPatterns;
- this.alias = alias;
- this.weight = weight;
- this.pattern = pattern;
-
- AlignmentUtils.estimateFrequencies(this); // Bernard Suh <bsuh at tigr.org>
- }
-
-
- //
- // Private stuff
- //
-
- private int[] patSort;
-
- private void makeSitePattern(Alignment alignment)
- {
- alias = new int[numSites];
-
- if (numSeqs > 0 && numSites > 0)
- {
- patSort = new int[numSites];
-
- getNumpattern(alignment);
- pattern = new byte[numSeqs][numPatterns];
- weight = new int[numPatterns];
- copypattern(alignment);
-
- patSort = null;
- }
- else
- {
- numPatterns = 0;
- pattern = null;
- weight = null;
- }
- }
-
- private int stateData(Alignment al, int seq, int site)
- {
- return dataType.getState(al.getData(seq, site));
- }
-
- private void getNumpattern(Alignment alignment)
- {
- byte tpmradix = (byte) dataType.getNumStates();
-
- int[] awork = new int[numSites];
- int[] count = new int[tpmradix+1];
-
- for (int j = 0; j < numSites; j++)
- {
- patSort[j] = j;
- }
- for (int i = numSeqs - 1; i >= 0; i--)
- {
- for (int k = 0; k < tpmradix+1; k++)
- {
- count[k] = 0;
- }
- for (int j = 0; j < numSites; j++)
- {
- count[stateData(alignment, i, patSort[j])]++;
- }
- for (int k = 1; k < tpmradix+1; k++)
- {
- count[k] += count[k-1];
- }
- for (int j = numSites-1; j >= 0; j--)
- {
- awork[ --count[stateData(alignment, i, patSort[j])] ] = patSort[j];
- }
- for (int j = 0; j < numSites; j++)
- {
- patSort[j] = awork[j];
- }
- }
- awork = null;
- count = null;
-
- numPatterns = 1;
- for (int j = 1; j < numSites; j++)
- {
- int s = patSort[j-1];
- int t = patSort[j];
- for (int i = 0; i < numSeqs; i++)
- {
- if ( stateData(alignment, i, t) !=
- stateData(alignment, i, s))
- {
- numPatterns++;
- break;
- }
- }
- }
- }
-
- void copypattern(Alignment alignment)
- {
- int k, n;
- boolean isSame;
-
- n = 0;
- k = patSort[n];
- for (int i = 0; i < numSeqs; i++)
- {
- pattern[i][n] = (byte) stateData(alignment, i, k);
- }
- weight[n] = 1;
- alias[k] = 0;
-
- for (int j = 1; j < numSites; j++)
- {
- k = patSort[j];
-
- isSame = true;
- for (int i = 0; i < numSeqs; i++)
- {
- if (pattern[i][n] != (byte) stateData(alignment, i, k))
- {
- isSame = false;
- break;
- }
- }
-
- if (isSame)
- {
- weight[n]++;
- alias[k] = n;
- }
- else
- {
- n++;
- for (int i = 0; i < numSeqs; i++)
- {
- pattern[i][n] = (byte) stateData(alignment, i, k);
- }
- weight[n] = 1;
- alias[k] = n;
- }
- }
- }
-
- // ====================================== Static Methods ===========================
- /**
- @param a An alignment
- @return alignment as a site pattern if it isn't already one (other wise just returns alighnment)
- */
- public static final SitePattern getSitePattern(Alignment a) {
- if(a instanceof SitePattern) {
- return (SitePattern)a;
- }
- return new SitePattern(a);
- }
-}
-
diff --git a/LibrarySource/pal/alignment/StrippedAlignment.java b/LibrarySource/pal/alignment/StrippedAlignment.java
deleted file mode 100644
index 445ddfe..0000000
--- a/LibrarySource/pal/alignment/StrippedAlignment.java
+++ /dev/null
@@ -1,213 +0,0 @@
-// StrippedAlignment.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-// Known bugs and limitations:
-// - can be pretty slow, a better data structure
-// such as a linked list would improve performance a lot
-
-
-package pal.alignment;
-
-
-/**
- * takes an alignment and repeatedly removes sites
- *
- * @version $Id: StrippedAlignment.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class StrippedAlignment extends AbstractAlignment
-{
- //
- // Public stuff
- //
-
- /**
- * Constructor
- *
- * @param raw original alignment
- */
- public StrippedAlignment(Alignment raw)
- {
- numSeqs = raw.getSequenceCount();
- idGroup = raw;
- numSites = raw.getSiteCount();
-
- rawAlignment = raw;
- rawNumSites = getSiteCount();
-
- alias = new int[getSiteCount()];
- notDropped = new boolean[getSiteCount()];
- for (int i = 0; i < getSiteCount(); i++)
- {
- alias[i] = i;
- notDropped[i] = true;
- }
- }
-
- // Implementation of abstract Alignment method
-
- /** sequence alignment at (sequence, site) */
- public char getData(int seq, int site)
- {
- return rawAlignment.getData(seq, alias[site]);
- }
-
- /**
- * drop a site
- *
- * @param s site of original alignment
- */
- public void dropSite(int s)
- {
- if (notDropped[s])
- {
- notDropped[s] = false;
- numSites -= 1;
-
- // Look for s in alias
- int n = 0;
- while (alias[n] != s)
- {
- n++;
- }
-
- // Drop s and shift the remaining part
- for (int i = n; i < getSiteCount(); i++)
- {
- alias[i] = alias[i+1];
- }
- alias[getSiteCount()] = -1;
- }
- }
-
- /**
- * remove site that contain a specified character
- *
- * @param c character that will cause the removal of a site
- */
- public void removeSites(char c)
- {
- // Drop sites with that character
- for (int i = 0; i < rawAlignment.getSiteCount(); i++)
- {
- for (int j = 0; j < numSeqs; j++)
- {
- if (rawAlignment.getData(j,i) == c)
- {
- dropSite(i);
- break;
- }
- }
- }
- }
-
- /**
- * remove sites with gaps
- *
- */
- public void removeGaps()
- {
- removeSites('-');
- }
-
-
- /**
- * remove sites with unknowns
- *
- */
- public void removeUnknowns()
- {
- removeSites('?');
- }
-
-
- /**
- * remove constant sites
- */
- public void removeConstantSites()
- {
- for (int i = 0; i < rawAlignment.getSiteCount(); i++)
- {
- char c = rawAlignment.getData(0, i);
- int count = 1;
-
- for (int j = 1; j < numSeqs; j++)
- {
- if (rawAlignment.getData(j, i) == c)
- {
- count++;
- }
- else
- {
- break;
- }
- }
-
- if (count == numSeqs) dropSite(i);
- }
- }
-
- /**
- * remove noninformative sites
- */
- public void removeNoninformativeSites()
- {
- int[] charCount = new int[numSeqs];
-
- for (int i = 0; i < rawAlignment.getSiteCount(); i++)
- {
- for (int j = 0; j < numSeqs; j++)
- {
- charCount[j] = 0;
- }
-
- // count how often each character appears in this column
- for (int j = 0; j < numSeqs; j++)
- {
- if (charCount[j] == 0)
- {
- charCount[j] = 1;
- char c = rawAlignment.getData(j, i);
-
- for (int k = j+1; k < numSeqs; k++)
- {
- if (c == rawAlignment.getData(k, i))
- {
- charCount[j]++;
- charCount[k] = -1;
- }
- }
- }
- }
-
- // number of different characters that appear more than 1 time
- int num = 0;
- for (int j = 0; j < numSeqs; j++)
- {
- if (charCount[j] > 1)
- {
- num++;
- }
- }
-
- // drop uninformative sites
- if (num < 2) dropSite(i);
- }
- }
-
- //
- // Private stuff
- //
-
- private Alignment rawAlignment = null;
- private int rawNumSites;
- private int[] alias;
- private boolean[] notDropped;
-}
-
diff --git a/LibrarySource/pal/alignment/makefile b/LibrarySource/pal/alignment/makefile
deleted file mode 100644
index dca8f11..0000000
--- a/LibrarySource/pal/alignment/makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-### VARIABLES ###
-
-JIKESOPTS := +P
-GCJOPTS :=
-
-# Always check dependencies
-JIKESOPTS += +M
-
-SRC := $(wildcard *.java)
-CLS := $(patsubst %.java, %.class, $(SRC))
-OBJ := $(patsubst %.class, %.o, $(wildcard *.class))
-
-
-### RULES ###
-
-# Compile Java sources into class files
-%.class: %.java
- jikes $(JIKESOPTS) $<
-
-# Alternative to using jikes: gcj -C
-
-# Compile class files into native code
-%.o: %.class
- gcj -c $(GCJOPTS) $<
-
-
-### TARGETS ###
-
-.PHONY: classes native clean
-
-classes: $(CLS)
-
-ifneq ($(OBJ),)
-native: $(OBJ)
- (ar -rv package.a *.o; ranlib package.a)
-else
-native: $(OBJ)
-endif
-
-clean:
- rm -f *.class *.o *.u *.a *~
-
diff --git a/LibrarySource/pal/alignment/package.html b/LibrarySource/pal/alignment/package.html
deleted file mode 100644
index 188e66c..0000000
--- a/LibrarySource/pal/alignment/package.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
-<body>
-Classes dealing with sequence alignments, including methods for reading
-and printing in several possible formats, as well as rearranging and
-concatenating.
-</body>
-</html>
-
diff --git a/LibrarySource/pal/coalescent/CoalescentException.java b/LibrarySource/pal/coalescent/CoalescentException.java
deleted file mode 100644
index 1f5ba0a..0000000
--- a/LibrarySource/pal/coalescent/CoalescentException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// CoalescentException.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.coalescent;
-
-/**
- * Exceptions to do with coalescent models et cetera.
- *
- * @version $Id: CoalescentException.java,v 1.2 2001/07/12 12:17:43 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class CoalescentException extends Exception {
-
- /**
- * Parameterless constructor.
- */
- public CoalescentException() {
- super();
- }
-
- /**
- * Constructor taking message.
- */
- public CoalescentException(String s) {
- super(s);
- }
-}
-
diff --git a/LibrarySource/pal/coalescent/CoalescentIntervals.java b/LibrarySource/pal/coalescent/CoalescentIntervals.java
deleted file mode 100644
index f575216..0000000
--- a/LibrarySource/pal/coalescent/CoalescentIntervals.java
+++ /dev/null
@@ -1,405 +0,0 @@
-// CoalescentIntervals.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.coalescent;
-
-import pal.misc.*;
-import pal.tree.*;
-import pal.util.*;
-import pal.io.*;
-
-import java.util.*;
-import java.io.*;
-
-
-/**
- * A series of coalescent intervals representing the time
- * order information contained in a (serial) clock-constrained
- * tree. Can model both n-coalescents and s-coalescents.
- *
- * @version $Id: CoalescentIntervals.java,v 1.13 2001/07/12 12:17:43 korbinian Exp $
- *
- * @author Alexei Drummond
- * @author Korbinian Strimmer
- */
-public class CoalescentIntervals implements Units, Report, Serializable
-{
-
- // PUBLIC STUFF
-
- /** Denotes and interval after which a coalescent event is observed
- * (i.e. the number of lineages is smaller in the next interval) */
- public static final int COALESCENT = 0;
-
- /**
- * Denotes an interval at the end of which a new sample addition is
- * observed (i.e. the number of lineages is larger in the next interval).
- */
- public static final int NEW_SAMPLE = 1;
-
- /**
- * Denotes an interval at the end of which nothing is
- * observed (i.e. the number of lineages is the same in the next interval).
- */
- public static final int NOTHING = 2;
-
-
-
- /** The widths of the intervals. */
- private double[] intervals;
-
- /** The number of uncoalesced lineages within a particular interval. */
- private int[] numLineages;
-
- /**
- * Parameterless constructor.
- */
- public CoalescentIntervals()
- {
- units = GENERATIONS;
-
- fo = FormattedOutput.getInstance();
- }
-
- /**
- * Constructor taking a number of intervals.
- */
- public CoalescentIntervals(int size)
- {
- this();
-
- intervals = new double[size];
- numLineages = new int[size];
- }
-
- /** The units in which the intervals are expressed. */
- private int units;
-
- /**
- * Sets the units these coalescent intervals are
- * measured in.
- */
- public void setUnits(int u)
- {
- units = u;
- }
-
- /**
- * Returns the units these coalescent intervals are
- * measured in.
- */
- public int getUnits()
- {
- return units;
- }
-
- /**
- * Returns the number of uncoalesced lineages within this interval.
- * Required for s-coalescents, where new lineages are added as
- * earlier samples are come across.
- */
- public int getNumLineages(int i) {
- return numLineages[i];
- }
-
- /**
- * set the number lineages for this particular interval.
- */
- public void setNumLineages(int i, int numLines) {
- numLineages[i] = numLines;
- }
-
-
- /**
- * Returns the number coalescent events in an interval
- */
- public int getCoalescentEvents(int i)
- {
- if (i < intervals.length-1)
- {
- return numLineages[i]-numLineages[i+1];
- }
- else
- {
- return numLineages[i]-1;
- }
- }
-
- /**
- * Returns the type of interval observed.
- */
- public int getIntervalType(int i)
- {
- int numEvents = getCoalescentEvents(i);
-
- if (numEvents > 0) return COALESCENT;
- else if (numEvents < 0) return NEW_SAMPLE;
- else return NOTHING;
- }
-
- /**
- * Gets an interval.
- */
- public double getInterval(int i) {
- return intervals[i];
- }
-
- /**
- * Sets interval.
- */
- public void setInterval(int i, double value) {
- intervals[i] = value;
- }
-
- /**
- * get the total height of the genealogy represented by these
- * intervals.
- */
- public double getTotalHeight() {
-
- double height=0.0;
- for (int j=0; j < intervals.length; j++) {
- height += intervals[j];
- }
- return height;
- }
-
-
- /**
- * get number of intervals
- */
- public int getIntervalCount()
- {
- return intervals.length;
- }
-
-
- /**
- * Checks whether this set of coalescent intervals is fully resolved
- * (i.e. whether is has exactly one coalescent event in each
- * subsequent interval)
- */
- public boolean isBinaryCoalescent()
- {
- for (int i = 0; i < intervals.length; i++)
- {
- if (getCoalescentEvents(i) != 1) return false;
- }
-
- return true;
- }
-
- /**
- * Checks whether this set of coalescent intervals coalescent only
- * (i.e. whether is has exactly one or more coalescent event in each
- * subsequent interval)
- */
- public boolean isCoalescentOnly()
- {
- for (int i = 0; i < intervals.length; i++)
- {
- if (getCoalescentEvents(i) < 1) return false;
- }
-
- return true;
- }
-
-
- /**
- * Group intervals following a given (compatible) reference.
- * The reference must have the same number of lineages at
- * the start of the first interval, and the present
- * CoalsecentIntervals must be fully resolved.
- */
- public void groupIntervals(CoalescentIntervals reference)
- {
- if (!isBinaryCoalescent())
- {
- throw new IllegalArgumentException("CoalescentIntervals must purely consist of only single coalescents");
- }
-
- if (getNumLineages(0) != reference.getNumLineages(0))
- {
- throw new IllegalArgumentException("Incompatible reference CoalescentIntervals");
- }
-
- int refSize = reference.getIntervalCount();
-
- double[] newIntervals = new double[refSize];
- int[] newNumLineages = new int[refSize];
-
- int count = 0;
- for (int i = 0; i < refSize; i++)
- {
- newNumLineages[i] = reference.getNumLineages(i);
-
- int numEvents = reference.getCoalescentEvents(i);
- for (int j = 0; j < numEvents; j++)
- {
- newIntervals[i] += intervals[count];
- count++;
- }
- }
-
- intervals = newIntervals;
- numLineages = newNumLineages;
- }
-
- /**
- * Returns a list stating which of the intervals are <= minSize
- * (and thus should be pooled).
- */
- public void getSmallIntervals(double minSize, boolean[] smallInterval)
- {
- if (intervals.length != smallInterval.length)
- throw new IllegalArgumentException("Array length incompatible");
-
- for (int i = 0; i < intervals.length; i++)
- {
- if (intervals[i] > minSize)
- {
- smallInterval[i] = false;
- }
- else
- {
- smallInterval[i] = true;
- }
- }
- }
-
-
- /**
- * Starting at time zero (i.e. with the interval with largest number of lineages),
- * the specified small intervals are pooled with the next non-small interval
- * (if this does not exist then with the previous non-small interval)
- */
- public void poolIntervals(boolean[] smallInterval)
- {
- int uniqueIntervals = 0;
- for (int i = 0; i < intervals.length; i++)
- {
- if (smallInterval[i] == false) uniqueIntervals++;
- }
- if (uniqueIntervals == 0) uniqueIntervals = 1;
-
- double[] newIntervals = new double[uniqueIntervals];
- int[] newNumLineages = new int[uniqueIntervals];
-
- int count = 0;
- int coalescences = 0;
- int numLines = numLineages[0];
- for (int i = 0; i < intervals.length; i++)
- {
- if (i < intervals.length-1)
- {
- coalescences += numLineages[i]-numLineages[i+1];
- }
- else
- {
- coalescences += numLineages[i]-1;
- }
-
- newIntervals[count] = intervals[i] + newIntervals[count];
- newNumLineages[count] = numLines;
-
- if (smallInterval[i] == false)
- {
- count++;
- if (count == uniqueIntervals) count--;
- numLines = numLines - coalescences;
-
- coalescences = 0;
- }
- }
-
- intervals = newIntervals;
- numLineages = newNumLineages;
- }
-
-
- /**
- * Starting at time zero (i.e. with the interval with largest number of lineages),
- * small intervals (<= minSize) are pooled with the next non-small interval
- * (if this does not exist then with the previous non-small interval)
- */
- public void poolSmallIntervals(double minSize)
- {
- boolean[] smallInterval = new boolean[intervals.length];
- getSmallIntervals(minSize, smallInterval);
- poolIntervals(smallInterval);
- }
-
-
- /**
- * Returns the log likelihood of this set of coalescent intervals,
- * given a demographic model.
- */
- public double computeLogLikelihood(DemographicModel model) {
-
- double total=0.0;
- double currentTime = 0.0;
- double intervalVal = 0.0;
-
- try {
-
- for (int j = 0; j < intervals.length; j++)
- {
- total += model.computeLogLikelihood(intervals[j], currentTime, numLineages[j],
- getIntervalType(j));
-
- // insert zero-length coalescent intervals
- int diff = getCoalescentEvents(j)-1;
- for (int k = 0; k < diff; k++)
- {
- total += model.computeLogLikelihood(0.0, currentTime, numLineages[j]-k-1, COALESCENT);
- }
-
- currentTime += intervals[j];
- }
- } catch (ArrayIndexOutOfBoundsException e) {
- System.out.println(this);
- }
- return total;
- }
-
- public String toString()
- {
- OutputTarget out = OutputTarget.openString();
-
- out.println("Lin.\tCoal.\tSize\tTotal");
- double total = 0.0;
-
- for (int i = 0; i < intervals.length; i++)
- {
- total += intervals[i];
-
- out.print(numLineages[i] + "\t");
- out.print(getCoalescentEvents(i) + "\t");
-
- fo.displayDecimal(out, intervals[i], 5);
- out.print("\t");
- fo.displayDecimal(out, total, 5);
- out.println();
- }
- out.close();
-
- return out.getString();
- }
-
- public void report(PrintWriter out)
- {
- out.println(this);
- }
-
- //
- // private stuff
- //
-
- private FormattedOutput fo;
-}
-
diff --git a/LibrarySource/pal/coalescent/CoalescentSimulator.java b/LibrarySource/pal/coalescent/CoalescentSimulator.java
deleted file mode 100644
index 82a7f9d..0000000
--- a/LibrarySource/pal/coalescent/CoalescentSimulator.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// CoalescentSimulator.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.coalescent;
-
-import pal.tree.*;
-
-/**
- * Simulates a set of coalescent intervals given a demographic model.
- *
- * @version $Id: CoalescentSimulator.java,v 1.5 2001/07/12 12:17:43 korbinian Exp $
- *
- * @author Alexei Drummond
- * @author Korbinian Strimmer
- */
-public class CoalescentSimulator {
-
- /**
- * Simulates a set of CoalescentIntervals from a genealogy assuming
- * contemporaneous tips.
- * @param numLines the number of tips in the sample genealogy
- * @param model the demographic model to use
- */
- public CoalescentIntervals simulateIntervals(int numLines, DemographicModel model) {
-
- CoalescentIntervals ci = new CoalescentIntervals(numLines-1);
-
- double currentTime = 0.0;
- for (int i = 0; i < (numLines - 1); i++) {
- //try {
- ci.setInterval(i,
- model.getSimulatedInterval(numLines,
- currentTime));
- //} catch (CoalescentException ce) {
- // ce.printStackTrace();
- //}
- ci.setNumLineages(i, numLines);
- currentTime += ci.getInterval(i);
- numLines -= 1;
- }
- return ci;
- }
-}
-
-
diff --git a/LibrarySource/pal/coalescent/CoalescentTree.java b/LibrarySource/pal/coalescent/CoalescentTree.java
deleted file mode 100644
index 5e32810..0000000
--- a/LibrarySource/pal/coalescent/CoalescentTree.java
+++ /dev/null
@@ -1,23 +0,0 @@
-// CoalescentTree.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.coalescent;
-
-import pal.tree.*;
-
-/**
- * interface defining a parameterized tree that
- * includes demographic information.
- *
- * @author Alexei Drummond
- */
-public interface CoalescentTree {
-
- CoalescentIntervals getCoalescentIntervals();
-}
-
-
diff --git a/LibrarySource/pal/coalescent/ConstExpGrowth.java b/LibrarySource/pal/coalescent/ConstExpGrowth.java
deleted file mode 100644
index c7186a7..0000000
--- a/LibrarySource/pal/coalescent/ConstExpGrowth.java
+++ /dev/null
@@ -1,416 +0,0 @@
-// ConstExpGrowth.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.coalescent;
-
-import pal.math.*;
-import pal.misc.*;
-import pal.io.*;
-
-import java.io.*;
-
-/**
- * This class models a population that grows
- * exponentially from an inital population size alpha N0 to a present-day size N0.
- * (Parameters: N0=present-day population size; r=growth rate; alpha: ratio of
- * population sizes).
- * or
- * (Parameters: N0=present-day population size; r=growth rate; N1: pre-growth
- * ancestral population size).
- * This model is nested with the exponential-growth model (alpha -> 0 or N1 = N0).
- * It is similar but not identical to the model used in ExpandingPopulation.
- *
- *
- * @version $Id: ConstExpGrowth.java,v 1.4 2001/07/12 12:17:43 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Andrew Rambaut
- */
-public class ConstExpGrowth extends ExponentialGrowth implements Report, Parameterized, Serializable
-{
-
- //
- // Public stuff
- //
-
- /** Constants for different parameterizations */
- public final int ALPHA_PARAMETERIZATION = 0;
- public final int N1_PARAMETERIZATION = 1;
-
- /** parameterization */
- public int parameterization;
-
-
- /** ratio of pop. sizes */
- public double alpha;
-
- /** standard error of time alpha */
- public double alphaSE;
-
- /** ancestral pop. size */
- public double N1;
-
- /** standard error of ancestral pop. size */
- public double N1SE;
-
-
- /**
- * Construct demographic model with default settings
- */
- public ConstExpGrowth(int units, int parameterization) {
-
- super(units);
-
- this.parameterization = parameterization;
-
- switch (this.parameterization) {
- case ALPHA_PARAMETERIZATION:
- alpha = getDefaultValue(2);
- break;
-
- case N1_PARAMETERIZATION:
- N1 = getDefaultValue(2);
- break;
- }
- }
-
-
- /**
- * Construct demographic model of an expanding population
- *
- */
- public ConstExpGrowth(double size, double growth, double ancestral, int units, int parameterization) {
-
- super(size, growth, units);
-
- this.parameterization = parameterization;
-
- switch (this.parameterization) {
- case ALPHA_PARAMETERIZATION:
- alpha = ancestral;
- break;
-
- case N1_PARAMETERIZATION:
- N1 = ancestral;
- break;
- }
- }
-
- public Object clone() {
- return new ConstExpGrowth(getN0(), getGrowthRate(), getAncestral(), getUnits(), getParameterization());
- }
-
- /**
- * returns ancestral population sizes
- */
- public double getAncestral()
- {
- if (this.parameterization == N1_PARAMETERIZATION)
- return N1;
- else
- return alpha;
- }
-
- /**
- * returns parameterization
- */
- public int getParameterization()
- {
- return parameterization;
- }
-
- // Implementation of abstract methods
-
- public double getDemographic(double t)
- {
- if (this.parameterization == N1_PARAMETERIZATION)
- alpha = N1 / N0;
-
- if (alpha == 1.0 || r == 0.0)
- {
- return N0;
- }
- else if (alpha == 0.0)
- {
- return N0 * Math.exp(-t * r);
- }
- else
- {
- double tc = -Math.log(alpha)/r;
-
- if (t < tc)
- {
- return N0 * Math.exp(-t * r);
- }
- else
- {
- return N0 * alpha;
- }
- }
- }
-
- public double getIntensity(double t)
- {
- if (this.parameterization == N1_PARAMETERIZATION)
- alpha = N1 / N0;
-
- if (alpha == 1.0 || r == 0.0)
- {
- return t/N0;
- }
- else if (alpha == 0.0)
- {
- return (Math.exp(t*r)-1.0)/N0/r;
- }
- else
- {
- double tc = -Math.log(alpha)/r;
-
- if (t < tc)
- {
- return (Math.exp(r*t)-1.0)/(N0*r);
- }
- else
- {
- return (1.0-alpha+r*t+Math.log(alpha))/(alpha*N0*r);
- }
- }
- }
-
- public double getInverseIntensity(double x)
- {
- if (this.parameterization == N1_PARAMETERIZATION)
- alpha = N1 / N0;
-
- if (r == 0)
- {
- return N0*x;
- }
- else if (alpha == 0)
- {
- return Math.log(1.0+N0*x*r)/r;
- }
- else
- {
- double xc = (1.0-alpha)/(alpha*N0*r);
-
- if (x < xc)
- {
- return Math.log(1.0+N0*r*x)/r;
- }
- else
- {
- return (alpha-1.0+alpha*N0*r*x-Math.log(alpha))/r;
- }
- }
- }
-
- // Parameterized interface
-
- public int getNumParameters()
- {
- return 3;
- }
-
- public double getParameter(int k)
- {
- switch (k)
- {
- case 0: return N0;
- case 1: return r;
- case 2:
- if (this.parameterization == N1_PARAMETERIZATION)
- return N1;
- else
- return alpha;
- default: return 0;
- }
- }
-
- public double getUpperLimit(int k)
- {
- double max = 0;
- switch (k)
- {
- case 0: max = 1e50; break;
- case 1: max = 1000; break;
- // we have to to compute lots of exp(rt) !!
- case 2:
- if (this.parameterization == N1_PARAMETERIZATION)
- max = 1e50;
- else
- max = 1.0;
- break;
- default: break;
- }
-
- return max;
- }
-
- public double getLowerLimit(int k)
- {
- double min = 0;
- switch (k)
- {
- case 0: min = 1e-12; break;
- case 1: min = 0; break;
- case 2: min = 0; break;
- default: break;
- }
- return min;
- }
-
- public double getDefaultValue(int k)
- {
-
- if (k == 0)
- {
- //arbitrary default values
- if (getUnits() == GENERATIONS) {
- return 1000.0;
- } else {
- return 0.2;
- }
- }
- else if (k == 1)
- {
- return 0; //constant population
- }
- else
- {
- if (this.parameterization == N1_PARAMETERIZATION)
- return getDefaultValue(0);
- else
- return 0.5;
- }
- }
-
- public void setParameter(double value, int k)
- {
- switch (k)
- {
- case 0: N0 = value; break;
- case 1: r = value; break;
- case 2:
- if (this.parameterization == N1_PARAMETERIZATION)
- N1 = value;
- else
- alpha = value;
- break;
- default: break;
- }
- }
-
- public void setParameterSE(double value, int k)
- {
- switch (k)
- {
- case 0: N0SE = value; break;
- case 1: rSE = value; break;
- case 2:
- if (this.parameterization == N1_PARAMETERIZATION)
- N1SE = value;
- else
- alphaSE = value;
- break;
- default: break;
- }
- }
-
- public String toString()
- {
- OutputTarget out = OutputTarget.openString();
- report(out);
- out.close();
-
- return out.getString();
- }
-
- public void report(PrintWriter out)
- {
- out.println("Demographic model: const-exp growth");
- if (this.parameterization == N1_PARAMETERIZATION) {
- out.println("Demographic function: N(t) = N0 exp(-r t) for t < -ln(N1/N0)/r");
- out.println(" N1 otherwise");
- } else {
- out.println("Demographic function: N(t) = N0 exp(-r t) for t < -ln(alpha)/r");
- out.println(" N0 alpha otherwise");
- }
- out.print("Unit of time: ");
- if (getUnits() == GENERATIONS)
- {
- out.print("generations");
- }
- else
- {
- out.print("expected substitutions");
- }
- out.println();
- out.println();
- out.println("Parameters of demographic function:");
- out.print(" present-day population size N0: ");
- fo.displayDecimal(out, N0, 6);
- if (N0SE != 0.0)
- {
- out.print(" (S.E. ");
- fo.displayDecimal(out, N0SE, 6);
- out.print(")");
- }
- out.println();
-
- out.print(" growth rate r: ");
- fo.displayDecimal(out, r, 6);
- if (rSE != 0.0)
- {
- out.print(" (S.E. ");
- fo.displayDecimal(out, rSE, 6);
- out.print(")");
- }
- out.println();
-
- if (this.parameterization == N1_PARAMETERIZATION) {
- out.print(" pre-growth population size N1: ");
- fo.displayDecimal(out, N1, 6);
- if (N1SE != 0.0)
- {
- out.print(" (S.E. ");
- fo.displayDecimal(out, N1SE, 6);
- out.print(")");
- }
-
- out.println();
- out.print(" Ratio of poulation sizes alpha: ");
- fo.displayDecimal(out, N1/N0, 6);
- out.println();
- } else {
- out.print(" ratio of population sizes alpha: ");
- fo.displayDecimal(out, alpha, 6);
- if (alphaSE != 0.0)
- {
- out.print(" (S.E. ");
- fo.displayDecimal(out, alphaSE, 6);
- out.print(")");
- }
-
- out.println();
- out.print(" initial population size alpha N0: ");
- fo.displayDecimal(out, alpha*N0, 6);
- out.println();
- }
- out.println();
-
- if (getLogL() != 0.0)
- {
- out.println();
- out.print("log L: ");
- fo.displayDecimal(out, getLogL(), 6);
- out.println();
- }
- }
-}
-
diff --git a/LibrarySource/pal/coalescent/ConstantPopulation.java b/LibrarySource/pal/coalescent/ConstantPopulation.java
deleted file mode 100644
index d9d067b..0000000
--- a/LibrarySource/pal/coalescent/ConstantPopulation.java
+++ /dev/null
@@ -1,236 +0,0 @@
-// ConstantPopulation.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.coalescent;
-
-import pal.math.*;
-import pal.misc.*;
-import pal.io.*;
-
-import java.io.*;
-
-/**
- * This class models coalescent intervals for a constant population
- * (parameter: N0=present-day population size). <BR>
- * If time units are set to Units.EXPECTED_SUBSTITUTIONS then
- * the N0 parameter will be interpreted as N0 * mu. <BR>
- * Also note that if you are dealing with a diploid population
- * N0 will be out by a factor of 2.
- *
- * @version $Id: ConstantPopulation.java,v 1.12 2001/07/12 12:17:43 korbinian Exp $
- *
- * @author Alexei Drummond
- + @author Korbinian Strimmer
- */
-public class ConstantPopulation extends DemographicModel implements Report, Summarizable, Parameterized, Serializable
-{
-
- //
- // private stuff
- //
- /** The summary descriptor stuff for the public values of this
- class
- @see Summarizable, getSummaryDescriptors()
- */
- private static final String[] CP_SUMMARY_TYPES = {"N0","N0SE"}; //This is still 1.0 compliant...
-
- //
- // Public stuff
- //
-
- /** population size */
- public double N0;
-
- /** standard error of population size */
- public double N0SE = 0.0;
-
-
- /**
- * Construct demographic model with default settings
- */
- public ConstantPopulation(int units) {
-
- super();
-
- setUnits(units);
-
- N0 = getDefaultValue(0);
-
- // necessary to conform to Java 1.0 language standard
- // SUMMARY_TYPES[0] = "N0";
- //SUMMARY_TYPES[1] = "N0SE";
- }
-
-
- /**
- * Construct demographic model of a constant population size.
- */
- public ConstantPopulation(double size, int units) {
-
- super();
-
- N0 = size;
- setUnits(units);
-
-
- }
-
- public Object clone()
- {
- return new ConstantPopulation(getN0(), getUnits());
- }
-
- public String[] getSummaryTypes() {
- return CP_SUMMARY_TYPES;
- }
-
- public double getSummaryValue(int summaryType) {
- switch(summaryType) {
- case 0 : {
- return N0;
- }
- case 1 : {
- return N0SE;
- }
- }
- throw new RuntimeException("Assertion error: unknown summary type :"+summaryType);
- }
-
- /**
- * returns initial population size.
- */
- public double getN0()
- {
- return N0;
- }
-
-
- // Implementation of abstract methods
-
- public double getDemographic(double t)
- {
- return N0;
- }
-
- public double getIntensity(double t)
- {
- return t/N0;
- }
-
- public double getInverseIntensity(double x)
- {
- return N0*x;
- }
-
- // Parameterized interface
-
- public int getNumParameters()
- {
- return 1;
- }
-
- public double getParameter(int k)
- {
- return N0;
- }
-
- public double getUpperLimit(int k)
- {
- return 1e50;
- }
-
- public double getLowerLimit(int k)
- {
- return 1e-12;
- }
-
- public double getDefaultValue(int k)
- {
- //arbitrary default values
- if (getUnits() == GENERATIONS) {
- return 1000.0;
- } else {
- return 0.2;
- }
- }
-
- public void setParameter(double value, int k)
- {
- N0 = value;
- }
-
- public void setParameterSE(double value, int k)
- {
- N0SE = value;
- }
-
- public String toString()
- {
- /*
- String s =
- "Constant Population:\n";
-
- if (getUnits() == GENERATIONS) {
- s += "Effective Population Size = " + N0 + "\n";
- } else {
- s += "Theta (haploid) = " + (N0 * 2) + "\n";
- }
- return s;
- */
-
- OutputTarget out = OutputTarget.openString();
- report(out);
- out.close();
-
- return out.getString();
- }
-
- public void report(PrintWriter out)
- {
- out.println("Demographic model: constant population size ");
- out.println("Demographic function: N(t) = N0");
-
- out.print("Unit of time: ");
- if (getUnits() == GENERATIONS)
- {
- out.print("generations");
- }
- else
- {
- out.print("expected substitutions");
- }
- out.println();
- out.println();
- out.println("Parameters of demographic function:");
- if (getUnits() == GENERATIONS)
- {
- out.print(" present day population size N0: ");
- fo.displayDecimal(out, N0, 6);
- }
- else
- {
- out.print(" present day Theta (N0 * mu): ");
- fo.displayDecimal(out, N0, 6);
- }
- if (N0SE != 0.0)
- {
- out.print(" (S.E. ");
- fo.displayDecimal(out, N0SE, 6);
- out.print(")");
- }
- out.println();
-
- if (getLogL() != 0.0)
- {
- out.println();
- out.print("log L: ");
- fo.displayDecimal(out, getLogL(), 6);
- out.println();
- }
- }
-}
-
diff --git a/LibrarySource/pal/coalescent/DemographicClockTree.java b/LibrarySource/pal/coalescent/DemographicClockTree.java
deleted file mode 100644
index ce3a300..0000000
--- a/LibrarySource/pal/coalescent/DemographicClockTree.java
+++ /dev/null
@@ -1,110 +0,0 @@
-// DemographicClockTree.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.coalescent;
-
-import pal.misc.*;
-import pal.tree.*;
-
-/**
- * Provides parameter interface to a clock-like genealogy which is
- * assumed to have some demographic pattern of theta (diversity) as
- * well as branch parameters (the minimal node height differences
- * at each internal node).
- *
- * <em>Must be used in conjunction with DemographicLikelihoodFunction! </em>
- *
- * @author Alexei Drummond
- */
-public class DemographicClockTree extends ClockTree implements DemographicTree {
-
- //
- // Public stuff
- //
-
- DemographicModel model;
-
- /**
- * take any tree and afford it with an interface
- * suitable for a clock-like genealogy, under a certain demographic
- * assumption.
- * <p>
- * <em>This parameterisation of branches, ensuring that
- * all parameters are independent of each other is due to
- * Andrew Rambaut (personal communication).</em>
- */
- public DemographicClockTree(Tree t, DemographicModel model)
- {
- setBaseTree(t);
-
- this.model = model;
-
- if (t.getRoot().getChildCount() < 2)
- {
- throw new IllegalArgumentException(
- "The root node must have at least two childs!");
- }
-
- NodeUtils.heights2Lengths(getRoot());
-
- parameter = new double[getInternalNodeCount() + model.getNumParameters()];
- heights2parameters();
- }
-
- /**
- * Returns the likelihood of the current demographic model, given
- * the current branch lengths.
- */
- public double computeDemoLogLikelihood() {
-
- CoalescentIntervals ci = IntervalsExtractor.extractFromTree(this);
-
- double value = ci.computeLogLikelihood(model);
-
- return value;
- }
-
- // interface Parameterized
-
- public int getNumParameters()
- {
- return getInternalNodeCount() + model.getNumParameters();
- }
-
- //
- // Private stuff
- //
-
- protected void parameters2Heights()
- {
- super.parameters2Heights();
-
- for (int i = 0; i < model.getNumParameters(); i++) {
- model.setParameter(parameter[getInternalNodeCount() + i], i);
- }
- }
-
- protected void heights2parameters()
- {
- super.heights2parameters();
-
- if (model != null) {
- for (int i = 0; i < model.getNumParameters(); i++) {
- parameter[getInternalNodeCount() + i] = model.getParameter(i);
- }
- }
- }
-
- /**
- * Return the demographic model being used to optimize the
- * likelihood of this tree.
- */
- public DemographicModel getDemographicModel() {
- return model;
- }
-}
-
diff --git a/LibrarySource/pal/coalescent/DemographicModel.java b/LibrarySource/pal/coalescent/DemographicModel.java
deleted file mode 100644
index b046a97..0000000
--- a/LibrarySource/pal/coalescent/DemographicModel.java
+++ /dev/null
@@ -1,189 +0,0 @@
-// DemographicModel.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.coalescent;
-
-import pal.math.*;
-import pal.misc.*;
-import pal.io.*;
-import java.io.*;
-
-
-/**
- * This abstract class contains methods that are of general use for
- * modelling coalescent intervals given a demographic model.
- *
- * Parts of this class were inspired by C++ code
- * generously provided by Oliver Pybus.
- *
- * @version $Id: DemographicModel.java,v 1.11 2001/07/12 12:17:43 korbinian Exp $
- *
- * @author Alexei Drummond
- * @author Korbinian Strimmer
- */
-public abstract class DemographicModel implements Units,
- Parameterized, Report, Cloneable, Serializable, Summarizable
-{
-
- //
- // Public stuff
- //
-
- public DemographicModel()
- {
- rng = new MersenneTwisterFast();
- binom = new Binomial();
-
- units = GENERATIONS;
-
- fo = FormattedOutput.getInstance();
- }
-
- public abstract Object clone();
-
-
- //
- // functions that define a demographic model (left for subclass)
- //
-
- /**
- * Gets the value of the demographic function N(t) at time t.
- */
- public abstract double getDemographic(double t);
-
- /**
- * Returns value of demographic intensity function at time t
- * (= integral 1/N(x) dx from 0 to t).
- */
- public abstract double getIntensity(double t);
-
- /**
- * Returns value of inverse demographic intensity function
- * (returns time, needed for simulation of coalescent intervals).
- */
- public abstract double getInverseIntensity(double x);
-
- // Parameterized and Report interface is also left for subclass
-
-
- // general functions
-
- /**
- * Returns an random interval size selected from the Kingman prior of the demographic model.
- */
- public double getSimulatedInterval (int numLin, double timeOfLastCoal)
- {
- double U = rng.nextDouble(); // create unit uniform random variate
- // has to be done somewhere!
- binom.setMax(numLin);
-
- double tmp = -Math.log(U)/binom.getNChoose2(numLin) + getIntensity(timeOfLastCoal);
- double interval = getInverseIntensity(tmp) - timeOfLastCoal;
-
- return interval;
- }
-
- /**
- * Calculates the integral 1/N(x) dx between start and finish.
- */
- public double getIntegral(double start, double finish)
- {
- return getIntensity(finish) - getIntensity(start);
- }
-
-
- /**
- * Returns the likelihood of a given *coalescent* interval
- */
- public double computeLogLikelihood(double width, double timeOfPrevCoal, int numLineages)
- {
-
- return computeLogLikelihood(width, timeOfPrevCoal,
- numLineages, CoalescentIntervals.COALESCENT);
- }
-
- /**
- * Returns the likelihood of a given interval,coalescent or otherwise.
- */
- public double computeLogLikelihood(double width,
- double timeOfPrevCoal, int numLineages, int type)
- {
- binom.setMax(numLineages);
-
- double timeOfThisCoal = width + timeOfPrevCoal;
-
- double intervalArea = getIntegral(timeOfPrevCoal, timeOfThisCoal);
- double like = 0;
- switch (type) {
- case CoalescentIntervals.COALESCENT:
- like = -Math.log(getDemographic(timeOfThisCoal)) -
- (binom.getNChoose2(numLineages)*intervalArea);
- break;
- case CoalescentIntervals.NEW_SAMPLE:
- like = -(binom.getNChoose2(numLineages)*intervalArea);
- break;
- }
-
- return like;
- }
-
-
- /**
- * Units in which population size is measured.
- */
- private int units;
-
- /**
- * sets units of measurement.
- *
- * @param u units
- */
- public void setUnits(int u)
- {
- units = u;
- }
-
- /**
- * returns units of measurement.
- */
- public int getUnits()
- {
- return units;
- }
-
- private double logL = 0.0;
-
- /**
- * sets log likelihood
- *
- * @param l log-likelihood
- */
- public void setLogL(double l)
- {
- logL = l;
- }
-
- /**
- * returns log-likelihood.
- */
- public double getLogL()
- {
- return logL;
- }
-
-
- //
- // Private and protected stuff
- //
-
- private MersenneTwisterFast rng;
- private Binomial binom;
-
- protected FormattedOutput fo;
-}
-
diff --git a/LibrarySource/pal/coalescent/DemographicTree.java b/LibrarySource/pal/coalescent/DemographicTree.java
deleted file mode 100644
index a4468de..0000000
--- a/LibrarySource/pal/coalescent/DemographicTree.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// DemographicTree.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-// - partial likelihoods need a lot of memory storage
-// memory usage could be opimized by working in a single site
-
-
-package pal.coalescent;
-
-/**
- * interface defining a parameterized tree that
- * includes demographic information.
- *
- * @author Alexei Drummond
- */
-public interface DemographicTree {
-
- double computeDemoLogLikelihood();
-
- DemographicModel getDemographicModel();
-}
-
-
diff --git a/LibrarySource/pal/coalescent/ExpandingPopulation.java b/LibrarySource/pal/coalescent/ExpandingPopulation.java
deleted file mode 100644
index 773026a..0000000
--- a/LibrarySource/pal/coalescent/ExpandingPopulation.java
+++ /dev/null
@@ -1,287 +0,0 @@
-// ExpandingPopulation.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.coalescent;
-
-import pal.math.*;
-import pal.misc.*;
-import pal.io.*;
-
-import java.io.*;
-
-/**
- * This class models a population that grows
- * exponentially from an inital population size alpha N0 to a present-day size N0.
- * (Parameters: N0=present-day population size; r=growth rate; alpha: ratio of
- * population sizes).
- * This model is nested with the exponential-growth model (alpha -> 0).
- *
- *
- * @version $Id: ExpandingPopulation.java,v 1.6 2001/07/12 12:17:43 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class ExpandingPopulation extends ExponentialGrowth implements Report, Parameterized, Serializable
-{
-
- //
- // Public stuff
- //
-
- /** ratio of pop. sizes */
- public double alpha;
-
-
- /** standard error of time alpha */
- public double alphaSE;
-
-
- /**
- * Construct demographic model with default settings
- */
- public ExpandingPopulation(int units) {
-
- super(units);
-
- alpha = getDefaultValue(2);
- }
-
-
- /**
- * Construct demographic model of an expanding population
- *
- */
- public ExpandingPopulation(double size, double growth, double ratio, int units) {
-
- super(size, growth, units);
-
- alpha = ratio;
- }
-
- public Object clone() {
- return new ExpandingPopulation(getN0(), getGrowthRate(), getRatio(), getUnits());
- }
-
- /**
- * returns ratio of population sizes
- */
- public double getRatio()
- {
- return alpha;
- }
-
- // Implementation of abstract methods
-
- public double getDemographic(double t)
- {
- if (r == 0)
- {
- return N0;
- }
- else if (alpha == 0)
- {
- return N0 * Math.exp(-t * r);
- }
- else
- {
- return N0 * (alpha + (1.0-alpha) * Math.exp(-t * r));
- }
- }
-
- public double getIntensity(double t)
- {
- if (r == 0)
- {
- return t/N0;
- }
- else if (alpha == 0)
- {
- return (Math.exp(t*r)-1.0)/N0/r;
- }
- else
- {
- return Math.log(1.0+alpha*(Math.exp(t*r)-1.0))/alpha/N0/r;
- }
- }
-
- public double getInverseIntensity(double x)
- {
- if (r == 0)
- {
- return N0*x;
- }
- else if (alpha == 0)
- {
- return Math.log(1.0+N0*x*r)/r;
- }
- else
- {
- return Math.log( (alpha-1.0+Math.exp(alpha*N0*x*r) )/alpha )/r;
- }
- }
-
- // Parameterized interface
-
- public int getNumParameters()
- {
- return 3;
- }
-
- public double getParameter(int k)
- {
- switch (k)
- {
- case 0: return N0;
- case 1: return r;
- case 2: return alpha;
- default: return 0;
- }
- }
-
- public double getUpperLimit(int k)
- {
- double max = 0;
- switch (k)
- {
- case 0: max = 1e50; break;
- case 1: max = 1000; break;
- // we have to to compute lots of exp(rt) !!
- case 2: max = 1; break;
- default: break;
- }
-
- return max;
- }
-
- public double getLowerLimit(int k)
- {
- double min = 0;
- switch (k)
- {
- case 0: min = 1e-12; break;
- case 1: min = 0; break;
- case 2: min = 0; break;
- default: break;
- }
- return min;
- }
-
- public double getDefaultValue(int k)
- {
-
- if (k == 0)
- {
- //arbitrary default values
- if (getUnits() == GENERATIONS) {
- return 1000.0;
- } else {
- return 0.2;
- }
- }
- else if (k == 1)
- {
- return 0; //constant population
- }
- else
- {
- return 0.5;
- }
- }
-
- public void setParameter(double value, int k)
- {
- switch (k)
- {
- case 0: N0 = value; break;
- case 1: r = value; break;
- case 2: alpha = value; break;
- default: break;
- }
- }
-
- public void setParameterSE(double value, int k)
- {
- switch (k)
- {
- case 0: N0SE = value; break;
- case 1: rSE = value; break;
- case 2: alphaSE = value; break;
- default: break;
- }
- }
-
- public String toString()
- {
- OutputTarget out = OutputTarget.openString();
- report(out);
- out.close();
-
- return out.getString();
- }
-
- public void report(PrintWriter out)
- {
- out.println("Demographic model: expanding population");
- out.println("Demographic function: N(t) = N0 (alpha + (1-alpha) exp(-r t)");
- out.print("Unit of time: ");
- if (getUnits() == GENERATIONS)
- {
- out.print("generations");
- }
- else
- {
- out.print("expected substitutions");
- }
- out.println();
- out.println();
- out.println("Parameters of demographic function:");
- out.print(" present-day population size N0: ");
- fo.displayDecimal(out, N0, 6);
- if (N0SE != 0.0)
- {
- out.print(" (S.E. ");
- fo.displayDecimal(out, N0SE, 6);
- out.print(")");
- }
- out.println();
-
- out.print(" growth rate r: ");
- fo.displayDecimal(out, r, 6);
- if (rSE != 0.0)
- {
- out.print(" (S.E. ");
- fo.displayDecimal(out, rSE, 6);
- out.print(")");
- }
- out.println();
-
- out.print(" ratio of population sizes alpha: ");
- fo.displayDecimal(out, alpha, 6);
- if (alphaSE != 0.0)
- {
- out.print(" (S.E. ");
- fo.displayDecimal(out, alphaSE, 6);
- out.print(")");
- }
- out.println();
-
- out.println();
- out.print(" initial poulation size alpha N0: ");
- fo.displayDecimal(out, alpha*N0, 6);
- out.println();
-
- if (getLogL() != 0.0)
- {
- out.println();
- out.print("log L: ");
- fo.displayDecimal(out, getLogL(), 6);
- out.println();
- }
- }
-}
-
diff --git a/LibrarySource/pal/coalescent/ExponentialGrowth.java b/LibrarySource/pal/coalescent/ExponentialGrowth.java
deleted file mode 100644
index 0f26c9e..0000000
--- a/LibrarySource/pal/coalescent/ExponentialGrowth.java
+++ /dev/null
@@ -1,285 +0,0 @@
-// ExponentialGrowth.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.coalescent;
-
-import pal.math.*;
-import pal.misc.*;
-import pal.io.*;
-
-import java.io.*;
-
-/**
- * This class models an exponentially growing (or shrinking) population
- * (Parameters: N0=present-day population size; r=growth rate).
- * This model is nested with the constant-population size model (r=0).
- *
- * Parts of this class were inspired by C++ code
- * generously provided by Oliver Pybus.
- *
- * @version $Id: ExponentialGrowth.java,v 1.10 2001/07/12 12:17:43 korbinian Exp $
- *
- * @author Alexei Drummond
- * @author Korbinian Strimmer
- */
-public class ExponentialGrowth extends ConstantPopulation implements Report, Parameterized, Serializable, Summarizable
-{
-
- //
- // Public stuff
- //
-
- private static final String[] EG_SUMMARY_TYPES = {"N0","N0SE", "R", "RSE"}; //This is dependent on ConstantPopulation!
-
-
- /** growth rate r */
- public double r;
-
-
- /** standard error of growth rate r */
- public double rSE;
-
-
- /**
- * Construct demographic model with default settings
- */
- public ExponentialGrowth(int units) {
-
- super(units);
-
- r = getDefaultValue(1);
- }
-
-
- /**
- * Construct demographic model of an exponentially growing population
- */
- public ExponentialGrowth(double size, double growth, int units) {
-
- super(size, units);
-
- r = growth;
- }
-
- public String[] getSummaryTypes() {
- return EG_SUMMARY_TYPES;
- }
-
- public double getSummaryValue(int summaryType) { //This is dependent on ConstantPopulation!
- switch(summaryType) {
- case 2 : {
- return r;
- }
- case 3 : {
- return rSE;
- }
- default : {
- return super.getSummaryValue(summaryType);
- }
- }
- }
-
-
- public Object clone() {
- return new ExponentialGrowth(getN0(), getGrowthRate(), getUnits());
- }
-
- /**
- * returns growth rate.
- */
- public double getGrowthRate() {
- return r;
- }
-
- // Implementation of abstract methods
-
- public double getDemographic(double t)
- {
- if (r == 0)
- {
- return N0;
- }
- else
- {
- return N0 * Math.exp(-t * r);
- }
- }
-
- public double getIntensity(double t)
- {
- if (r == 0)
- {
- return t/N0;
- }
- else
- {
- return (Math.exp(t*r)-1.0)/N0/r;
- }
- }
-
- public double getInverseIntensity(double x)
- {
- if (r == 0)
- {
- return N0*x;
- }
- else
- {
- return Math.log(1.0+N0*x*r)/r;
- }
- }
-
-
-
- // Parameterized interface
-
- public int getNumParameters()
- {
- return 2;
- }
-
- public double getParameter(int k)
- {
- if (k == 0) return N0;
-
- return r;
- }
-
- public double getUpperLimit(int k)
- {
- double max = 0;
- switch (k)
- {
- case 0: max = 1e50; break;
- case 1: max = 1000; break;
- // we have to to compute lots of exp(rt) !!
- default: break;
- }
-
- return max;
- }
-
- public double getLowerLimit(int k)
- {
- double min = 0;
- switch (k)
- {
- case 0: min = 1e-12; break;
- case 1: min = -200; break;
- // we allow also shrinking populations
- default: break;
- }
- return min;
- }
-
- public double getDefaultValue(int k)
- {
-
- if (k == 0)
- {
- //arbitrary default values
- if (getUnits() == GENERATIONS) {
- return 1000.0;
- } else {
- return 0.2;
- }
- } else
- {
- return 0; //constant population
- }
- }
-
- public void setParameter(double value, int k)
- {
- switch (k)
- {
- case 0: N0 = value; break;
- case 1: r = value; break;
- default: break;
- }
- }
-
- public void setParameterSE(double value, int k)
- {
- switch (k)
- {
- case 0: N0SE = value; break;
- case 1: rSE = value; break;
- default: break;
- }
- }
-
- public String toString()
- {
- /*
- String s =
- "Exponentially growing population:\n";
-
- if (getUnits() == GENERATIONS) {
- s += "Effective Population Size = " + N0 + "\n";
- s += "Growth rate (r) = " + r + "\n";
- } else {
- s += "Theta (haploid) = " + (N0 * 2) + "\n";
- s += "Growth rate (rho) = " + r + "\n";
- }
- return s;
- */
-
- OutputTarget out = OutputTarget.openString();
- report(out);
- out.close();
-
- return out.getString();
- }
-
- public void report(PrintWriter out)
- {
- out.println("Demographic model: exponential growth");
- out.println("Demographic function: N(t) = N0 exp(-r t)");
-
- out.print("Unit of time: ");
- if (getUnits() == GENERATIONS)
- {
- out.print("generations");
- }
- else
- {
- out.print("expected substitutions");
- }
- out.println();
- out.println();
- out.println("Parameters of demographic function:");
- out.print(" present-day population size N0: ");
- fo.displayDecimal(out, N0, 6);
- if (N0SE != 0.0)
- {
- out.print(" (S.E. ");
- fo.displayDecimal(out, N0SE, 6);
- out.print(")");
- }
- out.println();
- out.print(" growth rate r: ");
- fo.displayDecimal(out, r, 6);
- if (rSE != 0.0)
- {
- out.print(" (S.E. ");
- fo.displayDecimal(out, rSE, 6);
- out.print(")");
- }
- out.println();
-
- if (getLogL() != 0.0)
- {
- out.println();
- out.print("log L: ");
- fo.displayDecimal(out, getLogL(), 6);
- out.println();
- }
- }
-}
-
diff --git a/LibrarySource/pal/coalescent/IntervalsExtractor.java b/LibrarySource/pal/coalescent/IntervalsExtractor.java
deleted file mode 100644
index 1862978..0000000
--- a/LibrarySource/pal/coalescent/IntervalsExtractor.java
+++ /dev/null
@@ -1,237 +0,0 @@
-// IntervalsExtractor.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.coalescent;
-
-import pal.misc.*;
-import pal.tree.*;
-import pal.util.*;
-import pal.mep.*;
-import java.util.Vector;
-
-/**
- * A series of coalescent intervals representing the time
- * order information contained in a (serial) clock-constrained
- * tree.
- *
- * @version $Id: IntervalsExtractor.java,v 1.12 2001/07/12 12:17:43 korbinian Exp $
- *
- * @author Alexei Drummond
- * @author Korbinian Strimmer
- */
-public class IntervalsExtractor implements Units
-{
-
- /**
- * extracts intervals from clock tree.
- */
- public static CoalescentIntervals extractFromClockTree(Tree tree)
- {
- return extractFromClockTree(tree, -1);
- }
-
- /**
- * extracts intervals from clock tree. Leafs are assumed to have
- * height zero. Starting at time zero, small (<= minSize) intervals are pooled
- * with the next non-small interval (if this does not exist then
- * with the previous non-small interval)
- */
- public static CoalescentIntervals extractFromClockTree(Tree tree, double minSize)
- {
- tree.createNodeList(); //make consistent
- NodeUtils.lengths2Heights(tree.getRoot());
- //NodeUtils.lengths2HeightsKeepTips(tree.getRoot(),true);
-
- // Set heights of all external nodes to zero
- // we need a proper clock-tree
- //for (int i = 0; i < tree.getExternalNodeCount(); i++)
- //{
- // tree.getExternalNode(i).setNodeHeight(0.0);
- //}
-
-
- Vector times = new Vector();
- Vector childs = new Vector();
- collectInternalNodeHeights(tree.getRoot(), times, childs);
- int[] indices = new int[times.size()];
-
- HeapSort.sort(times, indices);
-
- int uniqueIntervals = 0;
-
- double currentTime = 0.0;
- for (int i = 0; i < times.size(); i++) {
- double time = ((ComparableDouble)times.elementAt(indices[i])).doubleValue();
- if (Math.abs(time - currentTime) > minSize)
- {
- uniqueIntervals += 1;
- }
- currentTime = time;
- }
- if (uniqueIntervals == 0) uniqueIntervals = 1;
-
- CoalescentIntervals ci = new CoalescentIntervals(uniqueIntervals);
- ci.setUnits(tree.getUnits());
-
- double start = 0.0;
- int numLines = tree.getExternalNodeCount();
-
- int count = 0;
- int coalescences = 0;
- for (int i = 0; i < times.size(); i++)
- {
- double finish = ((ComparableDouble)times.elementAt(indices[i])).doubleValue();
- int childCount = ((Integer)childs.elementAt(indices[i])).intValue();
-
- double length = Math.abs(finish - start);
- coalescences += childCount-1;
-
- ci.setInterval(count, length + ci.getInterval(count) );
- ci.setNumLineages(count, numLines);
-
- if (length > minSize)
- {
- count++;
- if (count == uniqueIntervals) count--;
- numLines = numLines - coalescences;
-
- coalescences = 0;
- }
-
- start = finish;
- }
-
- return ci;
- }
-
- /**
- * extracts intervals in generation times from serial clock tree (in mutation times)
- * after taking into account mutation rate model.
- */
- public static CoalescentIntervals extractFromTree(Tree tree, MutationRateModel muModel) {
-
- Tree newTree = TreeUtils.mutationsToGenerations(tree, muModel);
- return extractFromTree(newTree);
- }
-
- /**
- * extracts intervals from serial clock tree.
- */
- public static CoalescentIntervals extractFromTree(Tree tree)
- {
- double MULTIFURCATION_LIMIT = BranchLimits.MINARC;
-
- // get heights if it looks necessary
- if (tree.getRoot().getNodeHeight() == 0.0) {
- NodeUtils.lengths2Heights(tree.getRoot());
- }
-
- Vector times = new Vector();
- Vector childs = new Vector();
- collectAllTimes(tree.getRoot(), times, childs);
- int[] indices = new int[times.size()];
- Vector lineages = new Vector();
- Vector intervals = new Vector();
-
- HeapSort.sort(times, indices);
-
- double start = 0.0;
- int numLines = 0;
- int i = 0;
- while (i < times.size())
- {
-
- int lineagesRemoved = 0;
- int lineagesAdded = 0;
-
- double finish = ((ComparableDouble)times.elementAt(indices[i])).doubleValue();
- double next = finish;
-
- while (Math.abs(next - finish) < MULTIFURCATION_LIMIT) {
- int children = ((Integer)childs.elementAt(indices[i])).intValue();
- if (children == 0) {
- lineagesAdded += 1;
- } else {
- lineagesRemoved += (children - 1);
- }
- i += 1;
- if (i < times.size()) {
- next = ((ComparableDouble)times.elementAt(indices[i])).doubleValue();
- } else break;
- }
- //System.out.println("time = " + finish + " removed = " + lineagesRemoved + " added = " + lineagesAdded);
- if (lineagesAdded > 0) {
-
- if ((intervals.size() > 0) || ((finish - start) > MULTIFURCATION_LIMIT)) {
- intervals.addElement(new Double(finish - start));
- lineages.addElement(new Integer(numLines));
- }
-
- start = finish;
- }
- // add sample event
- numLines += lineagesAdded;
-
- if (lineagesRemoved > 0) {
-
- intervals.addElement(new Double(finish - start));
- lineages.addElement(new Integer(numLines));
- start = finish;
- }
- // coalescent event
- numLines -= lineagesRemoved;
-
-
-
- }
-
- CoalescentIntervals ci = new CoalescentIntervals(intervals.size());
- for (i = 0; i < intervals.size(); i++) {
- ci.setInterval(i, ((Double)intervals.elementAt(i)).doubleValue());
- ci.setNumLineages(i, ((Integer)lineages.elementAt(i)).intValue());
- }
-
- // Same Units as tree
- ci.setUnits(tree.getUnits());
-
-
- return ci;
- }
-
- // PRIVATE STUFF
-
- /**
- * extract coalescent times and tip information into Vector times from tree.
- */
- private static void collectAllTimes(Node node, Vector times, Vector childs) {
-
- times.addElement(new ComparableDouble(node.getNodeHeight()));
- childs.addElement(new Integer(node.getChildCount()));
-
- for (int i = 0; i < node.getChildCount(); i++) {
- collectAllTimes(node.getChild(i), times, childs);
- }
- }
-
- /**
- * extract internal node heights Vector times from tree.
- */
- private static void collectInternalNodeHeights(Node node, Vector times, Vector childs)
- {
- if (!node.isLeaf())
- {
- times.addElement(new ComparableDouble(node.getNodeHeight()));
- childs.addElement(new Integer(node.getChildCount()));
-
- for (int i = 0; i < node.getChildCount(); i++) {
- collectInternalNodeHeights(node.getChild(i), times, childs);
- }
- }
- }
-}
-
diff --git a/LibrarySource/pal/coalescent/SkylinePlot.java b/LibrarySource/pal/coalescent/SkylinePlot.java
deleted file mode 100644
index 47ab9e3..0000000
--- a/LibrarySource/pal/coalescent/SkylinePlot.java
+++ /dev/null
@@ -1,415 +0,0 @@
-// SkylinePlot.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.coalescent;
-
-import pal.tree.*;
-import pal.misc.*;
-import pal.math.*;
-import pal.io.*;
-import pal.statistics.*;
-
-import java.io.*;
-
-/**
- * Skyline plot derived from a strictly bifurcating tree
- * or a coalescent interval.
- *
- * This class provides the "classic" skyline plot method by
- * Pybus, Rambaut and Harvey .2000. Genetics 155:1429-1437, as well
- * as the "generalized" skyline plot method described in
- * Strimmer and Pybus. 2001. MBE submitted.
- *
- * @version $Id: SkylinePlot.java,v 1.16 2001/07/11 13:51:16 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class SkylinePlot implements Report, Units, Serializable
-{
- //
- // Public stuff
- //
-
-
- /**
- * Construct skyline plot from tree
- *
- * @param epsilon smoothing parameter (if set < 0 then epsilon will be optimized)
- */
- public SkylinePlot(Tree tree, double epsilon)
- {
- this(IntervalsExtractor.extractFromClockTree(tree), epsilon);
- }
-
-
- /**
- * Construct skyline plot from given coalescent intervals
- *
- * @param epsilon smoothing parameter (if set < 0 then epsilon will be optimized)
- */
- public SkylinePlot(CoalescentIntervals ci, double epsilon)
- {
- if (!ci.isBinaryCoalescent())
- {
- throw new IllegalArgumentException("All coalescent intervals must contain only a single coalescent");
- }
-
- fo = FormattedOutput.getInstance();
-
- size = ci.getIntervalCount();
-
- this.ci = ci;
-
- // population size in each coalescent interval
- populationSize = new double[size];
-
- // cumulative interval sizes
- cis = new double[size];
-
- maxTime = 0.0;
- for (int i = 0; i < size; i++)
- {
- cis[i] = maxTime;
- maxTime += ci.getInterval(i);
- }
-
- if (epsilon == 0.0)
- {
- /* init with classic skyline plot */
- computeClassic();
- }
- else if (epsilon > 0.0)
- {
- /* init with generalized skyline plot */
- computeGeneralized(epsilon);
- }
- else
- {
- // find optimal generalized skyline plot
- optimize();
- }
- }
-
-
- public String toString()
- {
- OutputTarget out = OutputTarget.openString();
- report(out);
- out.close();
-
- return out.getString();
- }
-
- public void report(PrintWriter out)
- {
- out.println("Skyline Plot");
- out.println();
- out.print("Smoothing parameter epsilon = " + eps + " ");
- if (eps == 0.0) out.println("(classic skyline plot)");
- else out.println("(generalized skyline plot)");
-
- out.print("Unit of time: ");
- if (ci.getUnits() == GENERATIONS)
- {
- out.print("generations");
- }
- else
- {
- out.print("expected substitutions");
- }
- out.println();
-
- printIntervals(out);
-
- out.println();
- out.println("For each composite interval the first and the last simple interval is given.");
- out.println();
- out.println("log L = " + getLogLikelihood());
- out.println("Number of intervals: " + size);
- out.println("Number of composite intervals:" + params);
- if (params > size-2)
- out.println("log L(AICC) not available");
- else
- out.println("log L(AICC) = " + getAICC());
- }
-
- private void printIntervals(PrintWriter out)
- {
- out.println("Int.\tTime\tEstimated N(t)");
- double total = 0.0;
- for (int i = 0; i < size; i++)
- {
- double m = populationSize[i];
-
- printLine(out, i, total, m);
- total += ci.getInterval(i);
-
- int j;
- for (j = i+1; j < size; j++)
- {
- if (populationSize[j] != m) break;
- }
- i=j-1;
-
- printLine(out, i, total, m);
- }
- }
-
-
- private void printLine(PrintWriter out, int i, double total, double m)
- {
- out.print((size-i) + "\t");
- fo.displayDecimal(out, total, 4);
- out.print("\t");
- fo.displayDecimal(out, m, 4);
- out.println();
- }
-
-
-
- /**
- * Compute classic skyline plot
- */
- public void computeClassic()
- {
- for (int i = 0; i < size; i++)
- {
- double w = ci.getInterval(i);
- double n = ci.getNumLineages(i);
-
- populationSize[i] = w * (n*(n-1))/2.0 ;
- }
-
- params = size;
- eps = 0.0;
- }
-
- /**
- * Compute generalized skyline plot
- */
- public void computeGeneralized(double epsilon)
- {
- params = 0;
- double cw = 0; //cumulative w
-
- for (int i = 0; i < size; i++)
- {
- double n = ci.getNumLineages(i);
-
- double w = ci.getInterval(i);
-
- int start = i;
- int k = 1;
- while (w < epsilon && i < size-1)
- {
- i++;
- k++;
- w += ci.getInterval(i);
-
- //System.out.println(ci.getInterval(i));
- }
-
- //System.out.println("w=" + w + " k=" + k + " i=" + i);
-
- // if remainder is smaller than epsilon
- // continue pooling until the end
- if (maxTime - cw - w < epsilon)
- {
- for (int j = i+1; j < size; j++)
- {
- i++;
- k++;
- w += ci.getInterval(i);
- }
-
- }
-
- double m = w * (n*(n-k))/(2.0*k);
-
- // assign the same pop.size to all sub intervals
- for (int j = start; j < start+k; j++)
- {
- populationSize[j] = m;
- }
- params++;
- cw += w;
- }
- eps = epsilon;
- }
-
- /**
- * Optimize generalized skyline plot
- */
- public void optimize()
- {
- // this is the naive way of doing this ...
-
- double besteps = getMaxTime();
- computeGeneralized(besteps);
- double bestaicc = getAICC();
-
- int GRID = 1000;
- double delta = besteps/GRID;
-
- double MINEPS = 1e-6;
- // Why MINEPS?
- // Because most "clock-like" trees are not properly
- // clock-like for a variety of reasons, i.e. the heights
- // of the tips are not exactly zero.
-
-
-
- eps = eps - delta;
- while(eps > MINEPS)
- {
- computeGeneralized(eps);
- double aicc = getAICC();
-
- if (aicc > bestaicc && params < size-1)
- {
- besteps = eps;
- bestaicc = aicc;
- }
- eps = eps - delta;
- }
-
- computeGeneralized(besteps);
- }
-
- /**
- * Compute log-likelihood
- */
- public double getLogLikelihood()
- {
- double logL = 0.0;
-
- for (int i = 0; i < size; i++)
- {
- double w = ci.getInterval(i);
- double m = populationSize[i];
-
- double n = ci.getNumLineages(i);
- double nc2 = n*(n-1.0)/2.0;
-
- logL += Math.log(nc2/m) - w*nc2/m ;
- }
-
- return logL;
- }
-
- /**
- * Compute AICC-corrected log-likelihood
- */
- public double getAICC()
- {
- double logL = getLogLikelihood();
-
- return PenalizedLikelihood.AICC(logL, params, size);
- }
-
- /**
- * Find interval corresponding to a specific time
- */
- public double findInterval(double time)
- {
- if (time < 0) throw new IllegalArgumentException("Negative values for time are not allowed");
-
- for (int i = 0; i < size-1; i++)
- {
- if (time >= cis[i] && time < cis[i+1]) return i;
- }
-
- return size-1;
- }
-
- /**
- * Returns the largest value of time defined in this plot
- * (= maximum value for epsilon)
- */
- public double getMaxTime()
- {
- return maxTime;
- }
-
-
- /**
- * Returns the largest estimate of population size.
- */
- public double getMaxPopulationSize() {
- double max = 0.0;
- for (int i = 0; i < size; i++) {
- if (populationSize[i] > max) {
- max = populationSize[i];
- }
- }
-
- return max;
- }
-
- /**
- * Returns the coalescent intervals in this skyline plot.
- */
- public CoalescentIntervals getIntervals() {
- return ci;
- }
-
- /**
- * Returns the number of intervals in this skyline plot.
- */
- public int getSize() {
- return size;
- }
-
- /**
- * Returns the number of composite intervals (=number of parameters).
- */
- public int getParameterCount() {
- return params;
- }
-
- /**
- * Returns epsilon
- */
- public double getEpsilon() {
- return eps;
- }
-
- /**
- * Returns the population size in interval i.
- */
- public double getPopulationSize(int i) {
- return populationSize[i];
- }
-
- /**
- * Returns unit of time.
- */
- public int getUnits()
- {
- return ci.getUnits();
- }
-
-
- // private
-
- private CoalescentIntervals ci;
- private FormattedOutput fo;
- private int size;
- private double maxTime;
- private double eps;
- private int params;
-
- /** cummulative interval sizes */
- private double[] cis;
-
- /** estimated population size in a coalescent interval */
- private double[] populationSize;
-
-
-}
-
diff --git a/LibrarySource/pal/coalescent/makefile b/LibrarySource/pal/coalescent/makefile
deleted file mode 100644
index dca8f11..0000000
--- a/LibrarySource/pal/coalescent/makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-### VARIABLES ###
-
-JIKESOPTS := +P
-GCJOPTS :=
-
-# Always check dependencies
-JIKESOPTS += +M
-
-SRC := $(wildcard *.java)
-CLS := $(patsubst %.java, %.class, $(SRC))
-OBJ := $(patsubst %.class, %.o, $(wildcard *.class))
-
-
-### RULES ###
-
-# Compile Java sources into class files
-%.class: %.java
- jikes $(JIKESOPTS) $<
-
-# Alternative to using jikes: gcj -C
-
-# Compile class files into native code
-%.o: %.class
- gcj -c $(GCJOPTS) $<
-
-
-### TARGETS ###
-
-.PHONY: classes native clean
-
-classes: $(CLS)
-
-ifneq ($(OBJ),)
-native: $(OBJ)
- (ar -rv package.a *.o; ranlib package.a)
-else
-native: $(OBJ)
-endif
-
-clean:
- rm -f *.class *.o *.u *.a *~
-
diff --git a/LibrarySource/pal/coalescent/package.html b/LibrarySource/pal/coalescent/package.html
deleted file mode 100644
index 7518094..0000000
--- a/LibrarySource/pal/coalescent/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body>
-Classes to model population genetic processes using the coalescent.
-</body>
-</html>
diff --git a/LibrarySource/pal/datatype/AminoAcids.java b/LibrarySource/pal/datatype/AminoAcids.java
deleted file mode 100644
index 640f829..0000000
--- a/LibrarySource/pal/datatype/AminoAcids.java
+++ /dev/null
@@ -1,164 +0,0 @@
-// AminoAcidData.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.datatype;
-
-
-/**
- * implements DataType for amino acids
- *
- * @version $Id: AminoAcids.java,v 1.10 2001/07/13 14:39:13 korbinian Exp $
- *
- * @note The Terminate state is not part of the "true" states of this DataType. It exists for terms of translating but
- is regarded as a unknowncharacter in general. (but using getChar('*') will not return getNumStates(), but isUnknown() will classify it as unknown)
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- * @author Matthew Goode
- */
-public class AminoAcids extends SimpleDataType
-{
-
- public static final char TERMINATE_CHARACTER = '*';
- public static final int TERMINATE_STATE = 21;
- // Get number of amino acids
- public int getNumStates()
- {
- return 20;
- }
-
- // Get state corresponding to character c
- public int getState(char c)
- {
- switch (c)
- {
- case 'A':
- return 0;
- case 'C':
- return 4;
- case 'D':
- return 3;
- case 'E':
- return 6;
- case 'F':
- return 13;
- case 'G':
- return 7;
- case 'H':
- return 8;
- case 'I':
- return 9;
- case 'K':
- return 11;
- case 'L':
- return 10;
- case 'M':
- return 12;
- case 'N':
- return 2;
- case 'P':
- return 14;
- case 'Q':
- return 5;
- case 'R':
- return 1;
- case 'S':
- return 15;
- case 'T':
- return 16;
- case 'V':
- return 19;
- case 'W':
- return 17;
- case 'Y':
- return 18;
- case UNKNOWN_CHARACTER:
- return 20;
- case TERMINATE_CHARACTER:
- return 21; //Terminate
- default:
- return 20;
- }
- }
-
- // Get character corresponding to a given state
- public char getChar(int state)
- {
- switch (state)
- {
- case 0:
- return 'A';
- case 1:
- return 'R';
- case 2:
- return 'N';
- case 3:
- return 'D';
- case 4:
- return 'C';
- case 5:
- return 'Q';
- case 6:
- return 'E';
- case 7:
- return 'G';
- case 8:
- return 'H';
- case 9:
- return 'I';
- case 10:
- return 'L';
- case 11:
- return 'K';
- case 12:
- return 'M';
- case 13:
- return 'F';
- case 14:
- return 'P';
- case 15:
- return 'S';
- case 16:
- return 'T';
- case 17:
- return 'W';
- case 18:
- return 'Y';
- case 19:
- return 'V';
- case 20:
- return UNKNOWN_CHARACTER;
- case 21:
- return TERMINATE_CHARACTER; //Terminate
-
-
- default:
- return UNKNOWN_CHARACTER;
- }
- }
-
- /**
- * @retrun true if this state is an unknown state
- */
- public boolean isUnknownState(int state) {
- return(state>=20);
- }
-
- // String describing the data type
- public String getDescription()
- {
- return "Amino acid";
- }
-
- // Get numerical code describing the data type
- public int getTypeID()
- {
- return 1;
- }
-}
-
diff --git a/LibrarySource/pal/datatype/CodonTable.java b/LibrarySource/pal/datatype/CodonTable.java
deleted file mode 100644
index 0a09afc..0000000
--- a/LibrarySource/pal/datatype/CodonTable.java
+++ /dev/null
@@ -1,56 +0,0 @@
-// CodonTable.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.datatype;
-
-
-/**
- * Describes a device for translating Nucleotide triplets
- * or codon indices into amino acid codes
- *
- * @author Matthew Goode
- * @author Alexei Drummond
- *
- * @version $Id: CodonTable.java,v 1.5 2001/07/13 14:39:13 korbinian Exp $
- */
-
-public interface CodonTable extends java.io.Serializable {
-
- /**
- * Returns the char associated with AminoAcid represented by 'codon'
- * @note char is as defined by AminoAcids.java
- * @see AminoAcids
- * @return state for '?' if codon unknown or wrong length
- */
- char getAminoAcidChar(char[] codon);
-
- /**
- * Returns the state associated with AminoAcid represented by 'codon'
- * @note state is as defined by AminoAcids.java
- * @see AminoAcids
- * @return '?' if codon unknown or wrong length
- */
- int getAminoAcidState(char[] codon);
-
- /** Returns the amino acid char at the corresponding codonIndex */
- char getAminoAcidCharFromCodonIndex(int codonIndex);
-
- /** Returns the amino acid state at the corresponding codonIndex */
- int getAminoAcidStateFromCodonIndex(int codonIndex);
-
- /**
- * Returns the codon indexes of terminator amino acids.
- */
- int[] getTerminatorIndexes();
-
- /**
- * Returns the number of terminator amino acids.
- */
- int getNumberOfTerminatorIndexes();
-}
-
diff --git a/LibrarySource/pal/datatype/CodonTableFactory.java b/LibrarySource/pal/datatype/CodonTableFactory.java
deleted file mode 100644
index d9fc286..0000000
--- a/LibrarySource/pal/datatype/CodonTableFactory.java
+++ /dev/null
@@ -1,271 +0,0 @@
-// CodonTableFactory.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.datatype;
-
-
-/**
- * Generates CodonTables
- *
- * @author Matthew Goode
- * @version $Id: CodonTableFactory.java,v 1.5 2001/07/13 14:39:13 korbinian Exp $
- */
-
-
-public class CodonTableFactory {
-
- /** Universal type */
- public static final int UNIVERSAL = 0;
-
- /** Mitochondrial Vertebrate type */
- public static final int M_VERTEBRATE = 1;
-
- public static final String[] TYPE_NAMES = {
- "Universal",
- "Mitochondrial Vertebrate"
- };
-
- /**
- * Creates a translator of a given types
- * @param type - UNIVERSAL, M_VERTEBRATE
- */
- public static CodonTable createTranslator(int type) {
- switch(type) {
- case UNIVERSAL : {
- return new UniversalTranslator();
- }
- case M_VERTEBRATE : {
- return new MVertebrateTranslator();
- }
- default : {
- return new UniversalTranslator();
- }
- }
- }
-
- public static final CodonTable createUniversalTranslator() {
- return createTranslator(UNIVERSAL);
- }
-}
-
-// ========================================================================
-
-
-/**
- * A concrete implementation of a NucleotideTranslator for
- * the Standard/Universal set of codes.
- */
-class UniversalTranslator implements CodonTable {
- int[] translations_ = new int[64];
- int[] terminatorIndexes_ = null;
- DataType aminoAcids_ = new AminoAcids();
- DataType nucleotides_ = new Nucleotides();
-GeneralizedCodons generalizedCodons_ = new GeneralizedCodons();
-
-
- private void addTerminalIndex(int index) {
- int[] ts = new int[terminatorIndexes_.length+1];
-
- for(int i = 0 ; i < terminatorIndexes_.length ; i++) {
- ts[i] = terminatorIndexes_[i];
- }
- ts[ts.length-1] = index;
- terminatorIndexes_ = ts;
- }
-
- /**
- * state must already be in set!
- */
- private void removeTerminalIndex(int index) {
-
- int[] ts = new int[terminatorIndexes_.length-1];
- int toAddIndex = 0;
-
- for(int i = 0 ; i < terminatorIndexes_.length ; i++) {
- if(index!=terminatorIndexes_[i]) {
- ts[toAddIndex] = terminatorIndexes_[i];
- toAddIndex++;
- }
- }
- }
-
- /** Add a codon/aminoAcid translation into table.
- * Overwrites previous translation for that codon.
- * If the codon is invalid will throw a runtime exception!
- */
- protected void add(String codon, char aminoAcid) {
- int index = generalizedCodons_.getCodonIndexFromCodon(codon.toCharArray());
- if(index<0) {
- throw new RuntimeException("Assertion error: Adding invalid Codon:"+codon);
- }
- if(aminoAcid!= AminoAcids.TERMINATE_CHARACTER) {
- //Are we obscuring a terminate?
- if(translations_[index]==AminoAcids.TERMINATE_STATE) {
- removeTerminalIndex(index);
- }
- } else {
- addTerminalIndex(index);
- }
- translations_[index] = aminoAcids_.getState(aminoAcid);
- }
-
- /**
- * Returns the char associated with AminoAcid represented by 'codon'.
- * @note char is as defined by AminoAcids.java
- * @see AminoAcids
- * @return state for '?' if codon unknown or wrong length
- */
- public char getAminoAcidChar(char[] codon) {
- return aminoAcids_.getChar(getAminoAcidState(codon));
- }
-
-
- /**
- * Returns the state associated with AminoAcid represented by 'codon'.
- * @note state is as defined by AminoAcids.java
- * @return '?' if codon unknown or wrong length
- * @see AminoAcids
- */
- public int getAminoAcidState(char[] codon) {
- int index = generalizedCodons_.getCodonIndexFromCodon(codon);
- if(index<0) {
- return aminoAcids_.getState(DataType.UNKNOWN_CHARACTER);
- }
- return translations_[index];
- }
-
- public char getAminoAcidCharFromCodonIndex(int codonIndex) {
- return aminoAcids_.getChar(getAminoAcidStateFromCodonIndex(codonIndex));
- }
-
- public int getAminoAcidStateFromCodonIndex(int codonIndex) {
- return translations_[codonIndex];
- }
-
- /**
- * Reset all values of the translation tables to -1 to
- * signify they have not be initialised.
- */
- private void clearTranslationTables() {
- for(int i = 0 ; i < translations_.length ; i++) {
- translations_[i] = -1;
- }
- terminatorIndexes_ = new int[0];
- }
-
- public UniversalTranslator() {
- clearTranslationTables();
- //Phe
- add("UUU", 'F'); add("UUC", 'F');
-
- //Leu
- add("UUA", 'L'); add("UUG", 'L'); add("CUU", 'L'); add("CUC", 'L'); add("CUA", 'L'); add("CUG", 'L');
-
- //Ile
- add("AUU", 'I'); add("AUC", 'I'); add("AUA", 'I');
-
- //Met
- add("AUG", 'M');
-
- //Val
- add("GUU", 'V'); add("GUC", 'V'); add("GUA", 'V'); add("GUG", 'V');
-
- //Ser
- add("UCU", 'S'); add("UCC", 'S'); add("UCA", 'S'); add("UCG", 'S');
-
- //Pro
- add("CCU", 'P'); add("CCC", 'P'); add("CCA", 'P'); add("CCG", 'P');
-
- //Thr
- add("ACU", 'T'); add("ACC", 'T'); add("ACA", 'T'); add("ACG", 'T');
-
- //Ala
- add("GCU", 'A'); add("GCC", 'A'); add("GCA", 'A'); add("GCG", 'A');
-
- //Tyr
- add("UAU", 'Y'); add("UAC", 'Y');
-
- //Ter
- add("UAA", AminoAcids.TERMINATE_CHARACTER); add("UAG", AminoAcids.TERMINATE_CHARACTER);
-
- //His
- add("CAU", 'H'); add("CAC", 'H');
-
- //Gln
- add("CAA", 'Q'); add("CAG", 'Q');
-
- //Asn
- add("AAU", 'N'); add("AAC", 'N');
-
- //Lys
- add("AAA", 'K'); add("AAG", 'K');
-
- //Asp
- add("GAU", 'D'); add("GAC", 'D');
-
- //Glu
- add("GAA", 'E'); add("GAG", 'E');
-
- //Cys
- add("UGU", 'C'); add("UGC", 'C');
-
- //Ter
- add("UGA", AminoAcids.TERMINATE_CHARACTER);
-
- //Trp
- add("UGG", 'W');
-
- //Arg
- add("CGU", 'R'); add("CGC" , 'R'); add("CGA", 'R'); add("CGG", 'R');
-
- //Ser
- add("AGU", 'S'); add("AGC" , 'S');
-
- //Arg
- add("AGA", 'R'); add("AGG", 'R');
-
- //Gly
- add("GGU", 'G'); add("GGC" , 'G'); add("GGA", 'G'); add("GGG", 'G');
-
- //check();
- }
-
- public void check() {
- System.out.println("Checking");
- for(int i = 0 ; i < translations_.length ; i++) {
- if(translations_[i] == -1) {
- System.out.println("No Translation for codon:"+i+"("+(new String(generalizedCodons_.getCodonFromCodonIndex(i)))+")");
- }
- }
- }
-
- public int[] getTerminatorIndexes() {
- return terminatorIndexes_;
- }
- public int getNumberOfTerminatorIndexes() {
- return terminatorIndexes_.length;
- }
-}
-
-class MVertebrateTranslator extends UniversalTranslator {
- public MVertebrateTranslator() {
- super();
- //Tro
- add("UGA", 'W');
-
- //Ter
- add("AGA", AminoAcids.TERMINATE_CHARACTER); add("AGG", AminoAcids.TERMINATE_CHARACTER);
-
- //Met
- add("AUA", 'M');
- }
-}
-
-
-
-
diff --git a/LibrarySource/pal/datatype/CodonTableUtils.java b/LibrarySource/pal/datatype/CodonTableUtils.java
deleted file mode 100644
index 5728e78..0000000
--- a/LibrarySource/pal/datatype/CodonTableUtils.java
+++ /dev/null
@@ -1,76 +0,0 @@
-// CodonTableUtils.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.datatype;
-
-
-/**
- * Nucleotide Translating Utilities
- *
- * @author Matthew Goode
- *
- * @version $Id: CodonTableUtils.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- */
-
-public class CodonTableUtils {
-
-
- /**
- * Translates a Nucleotide sequence into a Amino Acid sequence
- */
- public static final String convertNucleotideToAminoAcid(String
- nucleotideSequence, int startingPosition, int length, boolean reverse,
- CodonTable translator) {
- return (convertNucleotideToAminoAcid(nucleotideSequence.toCharArray(), startingPosition,length, reverse, translator)).toString();
- }
-
-
- /**
- * Translates a Nucleotide sequence into a Amino Acid sequence
- * @param nucleotideSequence - the base nucleotide sequence as a char array
- * @param starting position - the starting position to begin reading from
- * @param length - the length of the reading frame (in nucleotide units -
- * should be a multiple of 3, if not remainder is truncated!)
- * @param reverse - if true works backwards with codon at starting
- * position being last in translation (codon read in reverse as well).
- * Else reads forwards.
- * @param translator - the nucleotide translator to use for translation
- * nucleotides into amino acids.
- * @note can handle circular reading frames (ie startingPositon+length
- * can be greater than seuqnce length)
- */
- public static final char[] convertNucleotideToAminoAcid(char[]
- nucleotideSequence, int startingPosition, int length, boolean reverse,
- CodonTable translator) {
- char[] work = new char[3];
- //Normal dircection
- int numberOfAminoAcids = (length)/3;
- char[] aas = new char[numberOfAminoAcids];
- if(reverse) {
- for(int i = 0 ; i < numberOfAminoAcids ; i++) {
- int index = i*3+startingPosition;;
- for(int j = 0 ; j < 3 ; j++) {
- work[j] = nucleotideSequence[(index+2-j)%nucleotideSequence.length];
- }
- aas[numberOfAminoAcids-i-1] = translator.getAminoAcidChar(work);
- }
- } else {
- for(int i = 0 ; i < numberOfAminoAcids ; i++) {
- int index = i*3+startingPosition;
- for(int j = 0 ; j < 3 ; j++) {
- work[j] = nucleotideSequence[(index+j)%nucleotideSequence.length];
- }
- aas[i] = translator.getAminoAcidChar(work);
- }
- }
- return aas;
-
- }
-
-}
-
diff --git a/LibrarySource/pal/datatype/Codons.java b/LibrarySource/pal/datatype/Codons.java
deleted file mode 100644
index 71054ae..0000000
--- a/LibrarySource/pal/datatype/Codons.java
+++ /dev/null
@@ -1,73 +0,0 @@
-// Codons.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.datatype;
-
-
-/**
- * implements DataType for all Codons (including terminators).
- * Accepts the same characters as those given by
- * CodonTranslator.getUniqueCharacter(),
- * states here are index for CodonTranslator.getCodonIndex()
- * That is. Codons.getCharacter(CondonTranslator.getIndex("codon")) ==
- * CondonTranslator.getUniqueCharacter("codon")
- *
- * @version $Id: Codons.java,v 1.8 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class Codons extends SimpleDataType
-{
-
- // Get number of bases
- public int getNumStates()
- {
- return 64;
- }
-
-
- public int getState(char c)
- {
- if(c==UNKNOWN_CHARACTER) {
- return 64;
- }
- return (int)(c - 64);
- }
-
- /**
- * Get character corresponding to a given state
- */
- public char getChar(int state)
- {
-
- if(state>=64) {
- return UNKNOWN_CHARACTER;
- }
- return (char)(state + 64);
- }
-
- // String describing the data type
- public String getDescription()
- {
- return "Codon";
- }
-
- /**
- * @retrun true if this state is an unknown state
- */
- public boolean isUnknownState(int state) {
- return(state>=64);
- }
-
- // Get numerical code describing the data type
- public int getTypeID()
- {
- return DataType.CODONS;
- }
-}
-
diff --git a/LibrarySource/pal/datatype/DataType.java b/LibrarySource/pal/datatype/DataType.java
deleted file mode 100644
index 1bd2529..0000000
--- a/LibrarySource/pal/datatype/DataType.java
+++ /dev/null
@@ -1,103 +0,0 @@
-// DataType.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-// Known bugs and limitations:
-// - all states must have a non-negative value 0..getNumStates()-1
-// - ? (unknown state) has value getNumStates()
-
-
-package pal.datatype;
-
-import java.io.Serializable;
-
-/**
- * interface for sequence data types
- *
- * @version $Id: DataType.java,v 1.11 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public interface DataType extends Serializable
-{
- //
- // Public stuff
- //
-
- char UNKNOWN_CHARACTER = '?';
-
- int NUCLEOTIDES = 0;
- int AMINOACIDS = 1;
- int TWOSTATES = 2;
- int IUPACNUCLEOTIDES = 3;
- int CODONS = 4;
- int GENERALIZEDCODONS = 5;
-
- /**
- * get number of unique states
- *
- * @return number of unique states
- */
- int getNumStates();
-
- /**
- * get number of unique non-ambiguous states
- *
- * @return number of unique states
- */
- int getNumSimpleStates();
-
- /**
- * get state corresponding to a character
- *
- * @param c character
- *
- * @return state
- */
- int getState(char c);
-
- /**
- * get character corresponding to a given state
- *
- * @param state state
- *
- * return corresponding character
- */
- char getChar(int state);
-
- /**
- * returns true if this state is an ambiguous state.
- */
- boolean isAmbiguousState(int state);
-
- /**
- * returns an array containing the non-ambiguous states that this state represents.
- */
- int[] getSimpleStates(int state);
-
- /**
- * description of data type
- *
- * @return string describing the data type
- */
- String getDescription();
-
- /**
- * get numerical code describing the data type
- *
- * @return numerical code
- */
- int getTypeID();
-
- /**
- * @return true if this state is an unknown state
- * (the same as check if a state is >= the number of states... but neater)
- */
- boolean isUnknownState(int state);
-}
-
diff --git a/LibrarySource/pal/datatype/DataTypeUtils.java b/LibrarySource/pal/datatype/DataTypeUtils.java
deleted file mode 100644
index 48ad485..0000000
--- a/LibrarySource/pal/datatype/DataTypeUtils.java
+++ /dev/null
@@ -1,81 +0,0 @@
-// DataTypeUtils.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.datatype;
-
-import java.io.Serializable;
-
-/**
- * helper class for sequence data types.
- *
- * @version $Id: DataTypeUtils.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class DataTypeUtils implements Serializable
-{
- //
- // Public stuff
- //
-
- /**
- * create object according to this code
- *
- * @param typeID selected data type
- *
- * @return DataType object
- */
- public static DataType getInstance(int typeID)
- {
- if (typeID == DataType.NUCLEOTIDES)
- {
- return new Nucleotides();
- }
- else if (typeID == DataType.AMINOACIDS)
- {
- return new AminoAcids();
- }
- else if (typeID == DataType.TWOSTATES)
- {
- return new TwoStates();
- }
- else if (typeID == DataType.CODONS)
- {
- return new Codons();
- }
- else if (typeID == DataType.GENERALIZEDCODONS)
- {
- return new Codons();
- }
- else
- {
- throw new IllegalArgumentException("Wrong typeID");
- }
- }
-
- /**
- * Return states of a sequence.
- */
- public final static int[] getSequenceStates(DataType d, String sequence) {
-
- int[] states = new int[sequence.length()];
-
- for (int i = 0; i < sequence.length(); i++) {
- states[i] = d.getState(sequence.charAt(i));
- }
- return states;
- }
-
- /**
- * returns true if the character represents a gap in the sequence.
- */
- public final static boolean isGap(DataType d, char c) {
- return d.getState(c) == d.getNumStates();
- }
-}
-
diff --git a/LibrarySource/pal/datatype/GeneralizedCodons.java b/LibrarySource/pal/datatype/GeneralizedCodons.java
deleted file mode 100644
index 6ad4636..0000000
--- a/LibrarySource/pal/datatype/GeneralizedCodons.java
+++ /dev/null
@@ -1,223 +0,0 @@
-// GeneralizedCodons.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.datatype;
-
-import pal.math.MathUtils;
-
-// Note this class used to be called CodonTranslator
-
-/**
- * Used for mapping an exact codon to an exact state, and vice versa
- * Can also be used as a DataType (exactly as for Codons, but more versatile).
- *
- * @author Matthew Goode
- * @version $Id: GeneralizedCodons.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- */
-public class GeneralizedCodons extends SimpleDataType implements java.io.Serializable {
-
- DataType characterType_ = null;
- int numberOfCharacterStates_ = -1; // Caching of characterType_.getNumStates()
- int codonLength_;
-
- //==== For Datatype Interface ====
- int numberOfCodonStates_;
-
- /** The Biologists, what else do we need, constructor (nucleode character types, codon length 3) */
- public GeneralizedCodons () {
- this(new Nucleotides(),3);
- }
-
- /** The Computer Scientist's want of abstraction consturctor */
- public GeneralizedCodons (DataType characterType, int codonLength) {
- this.characterType_ = characterType;
- this.numberOfCharacterStates_ = characterType_.getNumStates();
- this.codonLength_ = codonLength;
- numberOfCodonStates_ = 1;
- for(int i = 0 ; i < codonLength_ ; i++) {
- numberOfCodonStates_*=numberOfCharacterStates_;
- }
- }
-
- /** Returns -1 if the codon has unknowns, or gaps in it, or is less than length length! */
- public final int getCodonIndexFromCodon(char[] codon) {
- if(codon.length<codonLength_) {
- return -1;
- }
- int index = 0;
- for(int i = 0 ; i < codonLength_ ; i++) {
- index*=numberOfCharacterStates_;
- int state = characterType_.getState(codon[i]);
- if(state>=numberOfCharacterStates_) {
- return -1;
- }
- index+=state;
- }
- return index;
- }
-
- /** Translates an index into a codon */
- public final char[] getCodonFromCodonIndex(int index) {
- char[] cs = new char[codonLength_];
- for(int i = codonLength_-1 ; i >=0 ; i--) {
- cs[i] = characterType_.getChar(index%numberOfCharacterStates_);
- index/=numberOfCharacterStates_;
- }
- return cs;
- }
-
- /**
- * Returns a unique ascii character for any given codon index
- */
- public final char getCodonCharFromCodonIndex(int index) {
- return (char)(index + 64);
- }
-
- /**
- * Returns a unique ascii character for any given codon index
- */
- public final int getCodonIndexFromCodonChar(char c) {
- return (int)(c - 64);
- }
-
- /**
- * Returns a unique ascii character for any given codon
- */
- public final char getCodonCharFromCodon(char[] codon) {
- return getCodonCharFromCodonIndex(getCodonIndexFromCodon(codon));
- }
-
-
- /**
- * Translates a Nucleotide sequence into a Codon sequence
- */
- public final String convertNucleotideToCodon(String nucleotideSequence, int startingPosition, int length, boolean reverse ) {
- return (convertNucleotideToCodon(nucleotideSequence.toCharArray(), startingPosition,length, reverse )).toString();
- }
-
- /**
- * Translates a Nucleotide sequence into a Codon sequence
- * @param nucleotideSequence - the base nucleotide sequence as a char array
- * @param starting position - the starting position to begin reading from
- * @param length - the length of the reading frame (in nucleotide units -
- * should be a multiple of 3, if not remainder is truncated!)
- * @param reverse - if true works backwards with codon at starting
- * position being last in translation (codon read in reverse as well).
- * Else reads forwards.
- * @param translator - the nucleotide translator to use for translation
- * nucleotides into amino acids.
- * @note can handle circular reading frames (ie startingPositon+length
- * can be greater than seuqnce length)
- */
- public final char[] convertNucleotideToCodon(char[] nucleotideSequence, int startingPosition, int length, boolean reverse) {
-
- char[] work = new char[codonLength_];
- //Normal direction
- int numberOfCodons = (length)/codonLength_;
- char[] aas = new char[numberOfCodons];
- if(reverse) {
- for(int i = 0 ; i < numberOfCodons ; i++) {
- int index = i*codonLength_+startingPosition;;
- for(int j = 0 ; j < codonLength_ ; j++) {
- work[j] = nucleotideSequence[(index+codonLength_-1-j)%nucleotideSequence.length];
- }
- aas[numberOfCodons-i-1] = getCodonCharFromCodon(work);
- }
- } else {
- for(int i = 0 ; i < numberOfCodons ; i++) {
- int index = i*codonLength_+startingPosition;
- for(int j = 0 ; j < codonLength_ ; j++) {
- work[j] = nucleotideSequence[(index+j)%nucleotideSequence.length];
- }
- aas[i] = getCodonCharFromCodon(work);
- }
- }
- return aas;
- }
-
- // ============================== Datatype Stuff ============================
-
- /**
- * get number of unique states
- *
- * @return number of unique states
- */
- public int getNumStates() { return numberOfCodonStates_; }
-
- /**
- * get state corresponding to a character
- *
- * @param c character
- *
- * @return state
- */
- public int getState(char c) {
- if(c==UNKNOWN_CHARACTER) {
- return numberOfCodonStates_;
- }
- return getCodonIndexFromCodonChar(c);
- }
-
- /**
- * Get character corresponding to a given state
- */
- public char getChar(int state) {
-
- if(state>=numberOfCodonStates_) {
- return UNKNOWN_CHARACTER;
- }
- return getCodonCharFromCodonIndex(state);
- }
-
- /**
- * String describing the data type
- */
- public String getDescription() {
- return "Codon";
- }
-
- /**
- * @return true if this state is an unknown state
- */
- public boolean isUnknownState(int state) {
- return(state>=64);
- }
-
- /**
- * Get numerical code describing the data type
- */
- public int getTypeID() {
- return DataType.GENERALIZEDCODONS;
- }
-
- //======
-
- public double[] getCodonFrequencies(double[] residueFrequencies) {
- residueFrequencies = MathUtils.getNormalized(residueFrequencies);
- double[] codonFreqs = new double[numberOfCodonStates_];
-
- for(int j = 0 ; j < numberOfCodonStates_ ; j++) {
- int index = j;
- double prob = 1;
-
- for(int i = codonLength_-1 ; i >=0 ; i--) {
- prob *= residueFrequencies[index%numberOfCharacterStates_];
- index/=numberOfCharacterStates_;
- }
-
- codonFreqs[j] = prob;
- }
- return MathUtils.getNormalized(codonFreqs);
- }
-
- /** Not correctly implemented!! */
- public double[] getNucleotideFrequencies(double[] codonFrequencies) {
- return new double[] {0.25,0.25,0.25,0.25};
- }
-
-}
-
diff --git a/LibrarySource/pal/datatype/IUPACNucleotides.java b/LibrarySource/pal/datatype/IUPACNucleotides.java
deleted file mode 100644
index 5ae2afb..0000000
--- a/LibrarySource/pal/datatype/IUPACNucleotides.java
+++ /dev/null
@@ -1,148 +0,0 @@
-// IUPACNucleotides.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.datatype;
-
-
-/**
- * implements DataType for nucleotides with ambiguous characters
- *
- * @version $Id: IUPACNucleotides.java,v 1.6 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class IUPACNucleotides implements DataType
-{
- /**
- * Get number of states.
- */
- public int getNumStates()
- {
- return 15;
- }
-
- /**
- * @retrun true if this state is an unknown state
- */
- public boolean isUnknownState(int state) {
- return(state>=getNumStates());
- }
-
- /**
- * returns the number of true non-ambiguous states.
- */
- public int getNumSimpleStates() {
- return 4;
- }
-
-
- // Get state corresponding to character c
- public final int getState(char c) {
-
- switch (c) {
- case 'A': return 0;
- case 'C': return 1;
- case 'G': return 2;
- case 'T': return 3;
- case 'U': return 3;
- case 'K': return 4;
- case 'M': return 5;
- case 'R': return 6;
- case 'S': return 7;
- case 'W': return 8;
- case 'Y': return 9;
- case 'B': return 10;
- case 'D': return 11;
- case 'H': return 12;
- case 'V': return 13;
- case 'N': return 14;
- default: return 15;
- }
- }
-
- // Get character corresponding to a given state
- public final char getChar(int c) {
-
- switch (c) {
- case 0: return 'A';
- case 1: return 'C';
- case 2: return 'G';
- case 3: return 'U';
- case 4: return 'K';
- case 5: return 'M';
- case 6: return 'R';
- case 7: return 'S';
- case 8: return 'W';
- case 9: return 'Y';
- case 10: return 'B';
- case 11: return 'D';
- case 12: return 'H';
- case 13: return 'V';
- case 14: return 'N';
- default: return '?';
- }
- }
-
- // String describing the data type
- public String getDescription()
- {
- return "IUPACNucleotide";
- }
-
- // Get numerical code describing the data type
- public int getTypeID()
- {
- return DataType.IUPACNUCLEOTIDES;
- }
-
- /**
- * returns true if this state is an ambiguous state.
- */
- public boolean isAmbiguousState(int state) {
- if ((state > 3) && (state < getNumStates())) {
- return true;
- }
- return false;
- }
-
- /**
- * returns an array containing the non-ambiguous states
- * that this state represents.
- */
- public int[] getSimpleStates(int state) {
-
- String stateString = "";
-
- switch (state) {
- case 0: stateString = "A"; break;
- case 1: stateString = "C"; break;
- case 2: stateString = "G"; break;
- case 3: stateString = "T"; break;
- case 4: stateString = "GT"; break;
- case 5: stateString = "AC"; break;
- case 6: stateString = "AG"; break;
- case 7: stateString = "CG"; break;
- case 8: stateString = "AT"; break;
- case 9: stateString = "CT"; break;
- case 10: stateString = "CGT"; break;
- case 11: stateString = "AGT"; break;
- case 12: stateString = "ACT"; break;
- case 13: stateString = "ACG"; break;
- case 14: stateString = "ACGT"; break;
- default: stateString = "ACGT"; break;
- }
-
- int[] states = new int[stateString.length()];
- for (int i = 0; i < stateString.length(); i++) {
- states[i] = getState(stateString.charAt(i));
- }
-
- return states;
- }
-}
-
diff --git a/LibrarySource/pal/datatype/IUPACPenaltyTable.java b/LibrarySource/pal/datatype/IUPACPenaltyTable.java
deleted file mode 100644
index e24a693..0000000
--- a/LibrarySource/pal/datatype/IUPACPenaltyTable.java
+++ /dev/null
@@ -1,67 +0,0 @@
-// IUPACPenaltyTable.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.datatype;
-
-/**
- * Implements a table of transition penalties for a DNA states
- * and IUPAC ambiguous states. A mismatch is normalized to a
- * penalty of 1.0 <br>
- * Used for alignment scoring.
- *
- * @version $Id: IUPACPenaltyTable.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-
-public class IUPACPenaltyTable implements TransitionPenaltyTable {
-
- private static final double hlf = 0.5;
- private static final double tth = 2.0 / 3.0;
- private static final double fsx = 5.0 / 6.0;
- private static final double thq = 3.0 / 4.0;
- private static final double sni = 7.0 / 9.0;
-
- public double[][] IUPACPenalties = {
- // A C G T K M R S W Y B D H V N -
- { 0, 1, 1, 1, 1, hlf, hlf, 1, hlf, 1, 1, tth, tth, tth, thq, 1}, // A
- { 1, 0, 1, 1, 1, hlf, 1, hlf, 1, hlf, tth, 1, tth, tth, thq, 1}, // C
- { 1, 1, 0, 1, hlf, 1, hlf, hlf, 1, 1, tth, tth, 1, tth, thq, 1}, // G
- { 1, 1, 1, 0, hlf, 1, 1, 1, hlf, hlf, tth, tth, tth, 1, thq, 1}, // T
-
- { 1, 1, hlf, hlf, hlf, 1, thq, thq, thq, thq, tth, tth, fsx, fsx, thq, 1}, // K
- {hlf, hlf, 1, 1, 1, hlf, thq, thq, thq, thq, fsx, fsx, tth, tth, thq, 1}, // M
- {hlf, 1, hlf, 1, thq, thq, hlf, thq, thq, 1, fsx, tth, fsx, tth, thq, 1}, // R
- { 1, hlf, hlf, 1, thq, thq, thq, hlf, 1, thq, tth, fsx, fsx, tth, thq, 1}, // S
- {hlf, 1, 1, hlf, thq, thq, thq, 1, hlf, thq, fsx, tth, tth, fsx, thq, 1}, // W
- { 1, hlf, 1, hlf, thq, thq, 1, thq, thq, hlf, tth, fsx, tth, fsx, thq, 1}, // Y
-
- { 1, tth, tth, tth, tth, fsx, fsx, tth, fsx, tth, tth, sni, sni, sni, thq, 1}, // B
- {tth, 1, tth, tth, tth, fsx, tth, fsx, tth, fsx, sni, tth, sni, sni, thq, 1}, // D
- {tth, tth, 1, tth, fsx, tth, fsx, fsx, tth, tth, sni, sni, tth, sni, thq, 1}, // H
- {tth, tth, tth, 1, fsx, tth, tth, tth, fsx, fsx, sni, sni, sni, tth, thq, 1}, // V
-
- {thq, thq, thq, thq, thq, thq, thq, thq, thq, thq, thq, thq, thq, thq, thq, 1}, // N
-
- { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0} // -
- };
-
- public static final String[] all = {"A", "C", "G", "U", "K", "M", "R", "S", "W", "Y", "B", "D", "H", "V", "N", "-"};
-
- private DataType dataType = new IUPACNucleotides();
-
- public final double penalty(int a, int b) {
-
- return IUPACPenalties[a][b];
- }
-
- public final DataType getDataType() {
- return dataType;
- }
-}
-
diff --git a/LibrarySource/pal/datatype/Nucleotides.java b/LibrarySource/pal/datatype/Nucleotides.java
deleted file mode 100644
index 4edb35a..0000000
--- a/LibrarySource/pal/datatype/Nucleotides.java
+++ /dev/null
@@ -1,151 +0,0 @@
-// NucleotideData.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.datatype;
-
-
-/**
- * implements DataType for nucleotides
- *
- * @version $Id: Nucleotides.java,v 1.8 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class Nucleotides extends SimpleDataType {
- public static final int A_STATE = 0;
- public static final int C_STATE = 1;
- public static final int G_STATE = 2;
- public static final int UT_STATE = 3;
-
-
- boolean isRNA_;
-
-
- public Nucleotides() {
- this(false);
- }
-
- /** If isRNA is true than getChar(state) will return a U instead of a T */
- public Nucleotides(boolean isRNA) {
- this.isRNA_ = isRNA;
- }
-
- // Get number of bases
- public int getNumStates()
- {
- return 4;
- }
-
- /**
- * @retrun true if this state is an unknown state
- */
- public boolean isUnknownState(int state) {
- return(state>=4);
- }
- // Get state corresponding to character c
- // NOTE: IF YOU CHANGE THIS IT MAY STOP THE NUCLEOTIDE TRANSLATOR FROM WORKING!
- // - It relies on the fact that all the states for 'ACGTU' are between [0, 3]
- public int getState(char c)
- {
- switch (c)
- {
- case 'A':
- return A_STATE;
- case 'C':
- return C_STATE;
- case 'G':
- return G_STATE;
- case 'T':
- return UT_STATE;
- case 'U':
- return UT_STATE;
-
- case UNKNOWN_CHARACTER:
- return 4;
-
- default:
- return 4;
- }
- }
-
- // Get character corresponding to a given state
- public char getChar(int state) {
- switch (state)
- {
- case A_STATE:
- return 'A';
- case C_STATE:
- return 'C';
- case G_STATE:
- return 'G';
- case UT_STATE:
- return (isRNA_ ? 'U' :'T');
-
- case 4:
- return UNKNOWN_CHARACTER;
-
- default:
- return UNKNOWN_CHARACTER;
- }
- }
-
- // String describing the data type
- public String getDescription() {
- return "Nucleotide";
- }
-
- // Get numerical code describing the data type
- public int getTypeID() {
- return 0;
- }
-
- /**
- Returns true if A->G, G->A, C->T, or T->C
- if firstState equals secondState returns FALSE!
- */
- public final boolean isTransistionByState(int firstState, int secondState) {
- switch(firstState) {
- case A_STATE: {
- if(secondState==G_STATE) {
- return true;
- }
- return false;
- }
- case C_STATE : {
- if(secondState==UT_STATE) {
- return true;
- }
- return false;
- }
- case G_STATE : {
- if(secondState==A_STATE) {
- return true;
- }
- return false;
- }
- case UT_STATE : {
- if(secondState==C_STATE) {
- return true;
- }
- return false;
- }
- }
- return false;
- }
- /**
- Returns true if A->G, G->A, C->T, or T->C
- if firstState equals secondState returns FALSE!
- (I've renamed things to avoid confusion between java typing of ints and chars)
- */
- public final boolean isTransistionByChar(char firstChar, char secondChar) {
- //I'm leaving it open to a possible optimisation if anyone cares.
- return isTransistionByState(getState(firstChar), getState(secondChar));
- }
-}
-
diff --git a/LibrarySource/pal/datatype/SimpleDataType.java b/LibrarySource/pal/datatype/SimpleDataType.java
deleted file mode 100644
index 0a697f3..0000000
--- a/LibrarySource/pal/datatype/SimpleDataType.java
+++ /dev/null
@@ -1,60 +0,0 @@
-// SimpleDataType.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-// Known bugs and limitations:
-// - all states must have a non-negative value 0..getNumStates()-1
-// - ? (unknown state) has value getNumStates()
-
-
-package pal.datatype;
-
-import java.io.Serializable;
-
-/**
- * interface for sequence data types
- *
- * @version $Id: SimpleDataType.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public abstract class SimpleDataType implements DataType
-{
-
- /**
- * returns true if this state is an ambiguous state.
- */
- public final boolean isAmbiguousState(int state) {
- return false;
- }
-
- /**
- * returns an array containing the non-ambiguous states that this state represents.
- */
- public final int[] getSimpleStates(int state) {
- int[] simple = new int[1];
- simple[0] = state;
- return simple;
- }
-
- /**
- * get number of unique non-ambiguous states
- *
- * @return number of unique states
- */
- public final int getNumSimpleStates() {
- return getNumStates();
- }
-
- /**
- * Returns true if state is unknown
- */
- public boolean isUnknownState(int state) {
- return state >= getNumStates();
- }
-}
-
diff --git a/LibrarySource/pal/datatype/StateRemover.java b/LibrarySource/pal/datatype/StateRemover.java
deleted file mode 100644
index a07db44..0000000
--- a/LibrarySource/pal/datatype/StateRemover.java
+++ /dev/null
@@ -1,91 +0,0 @@
-// StateRemover.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.datatype;
-
-/** A standard data type, but with characters removed */
-public class StateRemover extends SimpleDataType implements java.io.Serializable {
- DataType toAdjust_;
-
- int[] originalToAdjusted_; /** A translation array -> originalToAdjusted_["original State"] = "adjusted state" */
- int[] adjustedToOriginal_; /** A translation array -> originalToAdjusted_["adjusted State"] = "original state" */
-
- public StateRemover(DataType toAdjust, int[] statesToRemove) {
- this.toAdjust_ = toAdjust;
- createTranslationTables(toAdjust.getNumStates(),statesToRemove);
- }
-
- private final void createTranslationTables(int numberOfOriginalStates, int[] statesToRemove) {
- originalToAdjusted_ = new int[numberOfOriginalStates];
- adjustedToOriginal_ = new int[numberOfOriginalStates-statesToRemove.length];
- int currentAdjustedState = 0;
- for(int i = 0 ; i < numberOfOriginalStates ; i++ ) {
- boolean removeState = false;
- for(int j = 0 ; j < statesToRemove.length ; j++) {
- if(statesToRemove[j] == i) {
- removeState = true;
- break;
- }
- }
- if(removeState) {
- originalToAdjusted_[i] = adjustedToOriginal_.length;
- } else {
- originalToAdjusted_[i] = currentAdjustedState;
- adjustedToOriginal_[currentAdjustedState] = i;
- currentAdjustedState++;
- }
- }
- }
-
- // Get number of bases
- public int getNumStates() {
- return adjustedToOriginal_.length;
- }
-
- /**
- * @retrun true if this state is an unknown state
- */
- public boolean isUnknownState(int state) {
- return(state>=adjustedToOriginal_.length);
- }
-
-
- public int getState(char c) {
- int unadjustedState = toAdjust_.getState(c);
- if(!toAdjust_.isUnknownState(unadjustedState)) {
- return originalToAdjusted_[unadjustedState]; /* May also return unknown, see constructor*/
- }
- return adjustedToOriginal_.length;
- }
-
- /**
- * Get character corresponding to a given state
- */
- public char getChar(int state)
- {
- if(state>adjustedToOriginal_.length) {
- return UNKNOWN_CHARACTER;
- }
- return toAdjust_.getChar(adjustedToOriginal_[state]);
- }
-
- // String describing the data type
- public String getDescription()
- {
- return toAdjust_.getDescription()+" with states removed";
- }
-
- // Get numerical code describing the data type
- public int getTypeID()
- {
- return toAdjust_.getTypeID();
- }
-
-
-
-}
-
diff --git a/LibrarySource/pal/datatype/TransitionPenaltyTable.java b/LibrarySource/pal/datatype/TransitionPenaltyTable.java
deleted file mode 100644
index c3c4d79..0000000
--- a/LibrarySource/pal/datatype/TransitionPenaltyTable.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// TransitionPenaltyTable.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.datatype;
-
-
-/**
- * Implements a table of transition penalties for a particular datatype.
- * Used for alignment scoring.
- *
- * @version $Id: TransitionPenaltyTable.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public interface TransitionPenaltyTable {
-
- double penalty(int a, int b);
- DataType getDataType();
-}
-
diff --git a/LibrarySource/pal/datatype/TwoStates.java b/LibrarySource/pal/datatype/TwoStates.java
deleted file mode 100644
index 48d9e41..0000000
--- a/LibrarySource/pal/datatype/TwoStates.java
+++ /dev/null
@@ -1,83 +0,0 @@
-// TwoStateData.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.datatype;
-
-
-/**
- * implements DataType for two-state data
- *
- * @version $Id: TwoStates.java,v 1.5 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class TwoStates extends SimpleDataType
-{
- // Get number of bases
- public int getNumStates()
- {
- return 2;
- }
-
- // Get state corresponding to character c
- public int getState(char c)
- {
- switch (c)
- {
- case '0':
- return 0;
- case '1':
- return 1;
-
- case UNKNOWN_CHARACTER:
- return 2;
-
- default:
- return 2;
- }
- }
-
- /**
- * @retrun true if this state is an unknown state
- */
- public boolean isUnknownState(int state) {
- return(state>=2);
- }
-
- // Get character corresponding to a given state
- public char getChar(int state)
- {
- switch (state)
- {
- case 0:
- return '0';
- case 1:
- return '1';
-
- case 2:
- return UNKNOWN_CHARACTER;
-
- default:
- return UNKNOWN_CHARACTER;
- }
- }
-
- // String describing the data type
- public String getDescription()
- {
- return "Two state";
- }
-
- // Get numerical code describing the data type
- public int getTypeID()
- {
- return 2;
- }
-}
-
diff --git a/LibrarySource/pal/datatype/makefile b/LibrarySource/pal/datatype/makefile
deleted file mode 100644
index dca8f11..0000000
--- a/LibrarySource/pal/datatype/makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-### VARIABLES ###
-
-JIKESOPTS := +P
-GCJOPTS :=
-
-# Always check dependencies
-JIKESOPTS += +M
-
-SRC := $(wildcard *.java)
-CLS := $(patsubst %.java, %.class, $(SRC))
-OBJ := $(patsubst %.class, %.o, $(wildcard *.class))
-
-
-### RULES ###
-
-# Compile Java sources into class files
-%.class: %.java
- jikes $(JIKESOPTS) $<
-
-# Alternative to using jikes: gcj -C
-
-# Compile class files into native code
-%.o: %.class
- gcj -c $(GCJOPTS) $<
-
-
-### TARGETS ###
-
-.PHONY: classes native clean
-
-classes: $(CLS)
-
-ifneq ($(OBJ),)
-native: $(OBJ)
- (ar -rv package.a *.o; ranlib package.a)
-else
-native: $(OBJ)
-endif
-
-clean:
- rm -f *.class *.o *.u *.a *~
-
diff --git a/LibrarySource/pal/datatype/package.html b/LibrarySource/pal/datatype/package.html
deleted file mode 100644
index 39a3297..0000000
--- a/LibrarySource/pal/datatype/package.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<html>
-<body>
-Classes describing data types (nucleotides, amino acids, codons, codon tables etc.)
-</body>
-</html>
-
diff --git a/LibrarySource/pal/distance/AlignmentDistanceMatrix.java b/LibrarySource/pal/distance/AlignmentDistanceMatrix.java
deleted file mode 100644
index c83cfd1..0000000
--- a/LibrarySource/pal/distance/AlignmentDistanceMatrix.java
+++ /dev/null
@@ -1,109 +0,0 @@
-// AlignmentDistanceMatrix.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-// Known bugs and limitations:
-// - computational complexity of order O(numSeqs^2)
-
-
-package pal.distance;
-
-import pal.alignment.*;
-import pal.substmodel.*;
-import java.io.*;
-
-
-/**
- * compute distance matrix (observed and ML) from alignment (SitePattern)
- *
- * @version $Id: AlignmentDistanceMatrix.java,v 1.6 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class AlignmentDistanceMatrix extends DistanceMatrix implements Serializable {
- //
- // Public stuff
- //
-
- /**
- * compute observed distances
- *
- * @param sp site pattern
- */
- public AlignmentDistanceMatrix(SitePattern sp)
- {
- numSeqs = sp.getSequenceCount();
- idGroup = sp;
- distance = new double[numSeqs][numSeqs];
-
- pwd = new PairwiseDistance(sp);
-
- computeDistances();
- }
-
- /**
- * compute maximum-likelihood distances
- *
- * @param sp site pattern
- * @param m evolutionary model
- */
- public AlignmentDistanceMatrix(SitePattern sp, SubstitutionModel m)
- {
- numSeqs = sp.getSequenceCount();
- idGroup = sp;
- distance = new double[numSeqs][numSeqs];
-
- pwd = new PairwiseDistance(sp, m);
-
- computeDistances();
- }
-
- /**
- * recompute maximum-likelihood distances under new model
- *
- * @param m evolutionary model
- */
- public void recompute(SubstitutionModel m)
- {
- pwd.updateModel(m);
-
- computeDistances();
- }
-
- /**
- * recompute maximum-likelihood distances under new site pattern
- *
- * @param sp site pattern
- */
- public void recompute(SitePattern sp)
- {
- pwd.updateSitePattern(sp);
-
- computeDistances();
- }
-
-
- //
- // Private stuff
- //
-
- private PairwiseDistance pwd;
-
- private void computeDistances()
- {
- for (int i = 0; i < numSeqs; i++)
- {
- distance[i][i] = 0;
- for (int j = i + 1; j < numSeqs; j++)
- {
- distance[i][j] = pwd.getDistance(i, j);
- distance[j][i] = distance[i][j];
- }
- }
- }
-}
-
diff --git a/LibrarySource/pal/distance/DistanceMatrix.java b/LibrarySource/pal/distance/DistanceMatrix.java
deleted file mode 100644
index e7e50a7..0000000
--- a/LibrarySource/pal/distance/DistanceMatrix.java
+++ /dev/null
@@ -1,286 +0,0 @@
-// DistanceMatrix.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.distance;
-
-import pal.io.*;
-import pal.misc.*;
-
-import java.io.*;
-import java.text.*;
-import java.util.*;
-
-
-/**
- * storage for pairwise distance matrices.<p>
- *
- * features:
- * - printing in in PHYLIP format,
- * - computation of (weighted) squared distance to other distance matrix
- * - Fills in all of array...
- *
- * @version $Id: DistanceMatrix.java,v 1.9 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class DistanceMatrix implements Serializable, IdGroup
-{
-
- /**
- * This class has a hard-coded serialVersionUID
- * all fields should be maintained under the same name
- * for backwards compatibility with serialized objects.
- */
- static final long serialVersionUID = 4725925229860707633L;
-
- //
- // Public stuff
- //
-
- /**
- * number of sequences. Should be replaced by method that
- * looks directly at size of distance matrix.
- */
- public int numSeqs = 0;
-
- /** sequence identifiers */
- public IdGroup idGroup;
-
- /** distances [seq1][seq2] */
- public double[][] distance = null;
-
-
-
- /** constructor */
- public DistanceMatrix()
- {
- format = FormattedOutput.getInstance();
- }
-
- /** constructor taking distances array and IdGroup */
- public DistanceMatrix(double[][] distance, IdGroup idGroup)
- {
- super();
-
- this.distance = distance;
- this.idGroup = idGroup;
- numSeqs = distance.length;
- format = FormattedOutput.getInstance();
- }
-
- /**
- * constructor that takes a distance matrix and clones the distances
- * but uses the same idGroup.
- */
- public DistanceMatrix(DistanceMatrix dm) {
- distance = new double[dm.getSize()][dm.getSize()];
- for (int i = 0; i < dm.getSize(); i++) {
- for (int j = 0; j < dm.getSize(); j++) {
- distance[i][j] = dm.distance[i][j];
- }
- }
- numSeqs = distance.length;
- format = dm.format;
- idGroup = dm.getIdGroup();
- }
-
- /**
- * constructor that takes a distance matrix and clones the distances,
- * of a the identifiers in idGroup.
- */
- public DistanceMatrix(DistanceMatrix dm, IdGroup subset) {
-
- int index1, index2;
-
- distance = new double[subset.getIdCount()][subset.getIdCount()];
- for (int i = 0; i < distance.length; i++) {
- index1 = dm.whichIdNumber(subset.getIdentifier(i).getName());
-
- for (int j = 0; j < i; j++) {
- index2 = dm.whichIdNumber(subset.getIdentifier(j).getName());
- distance[i][j] = dm.distance[index1][index2];
- distance[j][i] = distance[i][j];
- }
- }
- numSeqs = distance.length;
- format = dm.format;
- idGroup = subset;
- }
-
- /** print alignment (PHYLIP format) */
- public void printPHYLIP(PrintWriter out)
- {
- // PHYLIP header line
- out.println(" " + numSeqs);
-
- for (int i = 0; i < numSeqs; i++)
- {
- format.displayLabel(out,
- idGroup.getIdentifier(i).getName(), 10);
- out.print(" ");
-
- for (int j = 0; j < numSeqs; j++)
- {
- // Chunks of 6 blocks each
- if (j % 6 == 0 && j != 0)
- {
- out.println();
- out.print(" ");
- }
-
- out.print(" ");
- format.displayDecimal(out, distance[i][j], 5);
- }
- out.println();
- }
- }
-
- /** returns representation of this alignment as a string */
- public String toString() {
-
- StringWriter sw = new StringWriter();
- printPHYLIP(new PrintWriter(sw));
-
- return sw.toString();
- }
-
- /** compute squared distance to second distance matrix */
- public double squaredDistance(DistanceMatrix mat, boolean weighted)
- {
- double sum = 0;
- for (int i = 0; i < numSeqs-1; i++)
- {
- for (int j = i+1; j < numSeqs; j++)
- {
- double diff = distance[i][j] - mat.distance[i][j];
- double weight;
- if (weighted)
- {
- // Fitch-Margoliash weight
- // (variances proportional to distances)
- weight = 1.0/(distance[i][j]*distance[i][j]);
- }
- else
- {
- // Cavalli-Sforza-Edwards weight
- // (homogeneity of variances)
- weight = 1.0;
- }
- sum += weight*diff*diff;
- }
- }
-
- return 2.0*sum; // we counted only half the matrix
- }
-
- /** compute absolute distance to second distance matrix */
- public double absoluteDistance(DistanceMatrix mat)
- {
- double sum = 0;
- for (int i = 0; i < numSeqs-1; i++)
- {
- for (int j = i+1; j < numSeqs; j++)
- {
- double diff =
- Math.abs(distance[i][j] - mat.distance[i][j]);
-
- sum += diff;
- }
- }
-
- return 2.0*sum; // we counted only half the matrix
- }
-
- /**
- * Returns the number of rows and columns that the distance matrix has.
- */
- public int getSize() {
- return distance.length;
- }
-
- /**
- * Returns the distances as a 2-dimensional array of doubles.
- */
- public double[][] getDistances() {
- return distance;
- }
-
- /**
- * Sets both upper and lower triangles.
- */
- public void setDistance(int i, int j, double dist) {
- distance[i][j] = distance[j][i] = dist;
- }
-
- /**
- * Adds a delta to both upper and lower triangle distances.
- */
- public void addDistance(int i, int j, double delta) {
- distance[i][j] += delta;
- distance[j][i] += delta;
- }
-
- /**
- * Returns the mean pairwise distance of this matrix
- */
- public double meanDistance() {
- double dist = 0.0;
- int count = 0;
- for (int i = 0; i < distance.length; i++) {
- for (int j = 0; j < distance[i].length; j++) {
- if (i != j) {
- dist += distance[i][j];
- count += 1;
- }
- }
- }
- return dist / (double)count;
- }
-
- //IdGroup interface
- public Identifier getIdentifier(int i) {return idGroup.getIdentifier(i);}
- public void setIdentifier(int i, Identifier ident) { idGroup.setIdentifier(i, ident); }
- public int getIdCount() { return idGroup.getIdCount(); }
- public int whichIdNumber(String name) { return idGroup.whichIdNumber(name); }
-
- /**
- * Return id group of this alignment.
- * @deprecated distance matrix now implements IdGroup
- */
- public IdGroup getIdGroup() { return idGroup; }
-
-
- /**
- * test whether this matrix is a symmetric distance matrix
- *
- */
- public boolean isSymmetric()
- {
- for (int i = 0; i < distance.length; i++)
- {
- if (distance[i][i] != 0) return false;
- }
- for (int i = 0; i < distance.length-1; i++)
- {
- for (int j = i+1; j < distance.length; j++)
- {
- if (distance[i][j] != distance[j][i]) return false;
- }
- }
- return true;
- }
-
-
- //
- // Private stuff
- //
-
- FormattedOutput format;
-}
-
diff --git a/LibrarySource/pal/distance/DistanceMatrixUtils.java b/LibrarySource/pal/distance/DistanceMatrixUtils.java
deleted file mode 100644
index 62208b0..0000000
--- a/LibrarySource/pal/distance/DistanceMatrixUtils.java
+++ /dev/null
@@ -1,121 +0,0 @@
-// DistanceMatrixUtils.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.distance;
-
-import pal.io.*;
-import pal.misc.*;
-
-import java.io.*;
-import java.util.*;
-
-
-/**
- * Auxillary functions for distance matrices<p>
- *
- * @version $Id: DistanceMatrixUtils.java,v 1.5 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class DistanceMatrixUtils implements Serializable {
-
- /**
- * compute squared distance to second distance matrix.
- * If both matrices have the same size it is assumed that the order of the taxa
- * is identical.
- */
- public static double squaredDistance(DistanceMatrix mat1, DistanceMatrix mat2, boolean weighted) {
-
- boolean aliasNeeded = false;
- if (mat1.getSize() != mat2.getSize())
- {
- aliasNeeded = true;
- }
-
- int[] alias = null;
-
- if (aliasNeeded) {
- if (mat1.getSize() > mat2.getSize()) {
- //swap so mat1 is the smaller of the two
- DistanceMatrix temp = mat2;
- mat2 = mat1;
- mat1 = temp;
- }
- alias = new int[mat1.getSize()];
- for (int i = 0; i < alias.length; i++) {
- alias[i] = mat2.whichIdNumber(mat1.getIdentifier(i).getName());
- }
- } else {
- alias = new int[mat1.getSize()];
- for (int i = 0; i < alias.length; i++) {
- alias[i] = i;
- }
- }
-
-
- double sum = 0;
- int ai;
- for (int i = 0; i < mat1.numSeqs-1; i++)
- {
- ai = alias[i];
-
- for (int j = i+1; j < mat1.numSeqs; j++)
- {
- double diff = mat1.distance[i][j] - mat2.distance[ai][alias[j]];
- double weight;
- if (weighted)
- {
- // Fitch-Margoliash weight
- // (variances proportional to distances)
- weight = 1.0/(mat1.distance[i][j]*mat2.distance[ai][alias[j]]);
- }
- else
- {
- // Cavalli-Sforza-Edwards weight
- // (homogeneity of variances)
- weight = 1.0;
- }
- sum += weight*diff*diff;
- }
- }
-
- return 2.0*sum; // we counted only half the matrix
- }
-
- /**
- * Returns a distance matrix with the specified taxa removed.
- */
- public static DistanceMatrix minus(DistanceMatrix parent, int taxaToRemove) {
-
- int size = parent.getIdCount() - 1;
-
- double[][] distances = new double[size][size];
- Identifier[] ids = new Identifier[size];
- int counti = 0, countj = 0;
- for (int i = 0; i < size; i++) {
- if (counti == taxaToRemove) {
- counti += 1;
- }
- ids[i] = parent.getIdentifier(counti);
-
- countj = 0;
- for (int j = 0; j < size; j++) {
- if (countj == taxaToRemove) {
- countj += 1;
- }
- distances[i][j] = parent.distance[counti][countj];
- countj += 1;
- }
- counti += 1;
- }
-
- DistanceMatrix smaller = new DistanceMatrix(distances, new SimpleIdGroup(ids));
-
- return smaller;
- }
-}
-
diff --git a/LibrarySource/pal/distance/DistanceParseException.java b/LibrarySource/pal/distance/DistanceParseException.java
deleted file mode 100644
index 5d4c87a..0000000
--- a/LibrarySource/pal/distance/DistanceParseException.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// DistanceParseException.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.distance;
-
-
-/**
- * exception thrown by ReadDistanceMatrix
- *
- * @author Korbinian Strimmer
- */
-public class DistanceParseException extends Exception
-{
- public DistanceParseException() {}
-
- public DistanceParseException(String msg)
- {
- super(msg);
- }
-}
-
diff --git a/LibrarySource/pal/distance/JukesCantorDistanceMatrix.java b/LibrarySource/pal/distance/JukesCantorDistanceMatrix.java
deleted file mode 100644
index ba602b3..0000000
--- a/LibrarySource/pal/distance/JukesCantorDistanceMatrix.java
+++ /dev/null
@@ -1,130 +0,0 @@
-// JukesCantorDistanceMatrix.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.distance;
-
-import pal.alignment.*;
-import pal.substmodel.*;
-import pal.misc.*;
-
-
-/**
- * compute jukes-cantor corrected distance matrix
- *
- * @version $Id: JukesCantorDistanceMatrix.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- * @author Korbinian Strimmer
- */
-public class JukesCantorDistanceMatrix extends DistanceMatrix
-{
- //
- // Public stuff
- //
-
- /**
- * compute jukes-cantor corrected distances
- * (assumes nucleotides as underlying data)
- *
- * @param dist distance matrix
- */
- public JukesCantorDistanceMatrix(DistanceMatrix dist)
- {
- this(dist, 4);
- }
-
-
- /**
- * compute jukes-cantor corrected distances
- *
- * @param dist distance matrix
- * @param numStates number of states of underlying data
- */
- public JukesCantorDistanceMatrix(DistanceMatrix dist, int numStates)
- {
- numSeqs = dist.numSeqs;
- idGroup = dist.getIdGroup();
- distance = new double[numSeqs][numSeqs];
-
- obsDistance = dist.distance;
-
- double n = numStates;
-
- const1 = (n-1)/n;
- const2 = n/(n-1);
-
- computeDistances();
- }
-
-
- /**
- * compute jukes-cantor corrected distances
- *
- * @param alignment Alignment
- */
- public JukesCantorDistanceMatrix(Alignment alignment)
- {
- this(new SitePattern(alignment));
- }
-
- /**
- * compute jukes-cantor corrected distances
- *
- * @param sitePattern SitePattern
- */
- public JukesCantorDistanceMatrix(SitePattern sitePattern)
- {
- this( new AlignmentDistanceMatrix(sitePattern),
- sitePattern.getDataType().getNumStates());
- }
-
-
- //
- // Private stuff
- //
-
- private double[][] obsDistance;
-
- //used in correction formula
- private double const1, const2;
-
- private void computeDistances()
- {
- for (int i = 0; i < numSeqs-1; i++)
- {
- distance[i][i] = 0.0;
- for (int j = i+1; j < numSeqs; j++)
- {
- distance[i][j] = distance[j][i] = jccorrection(obsDistance[i][j]);
- }
- }
- }
-
-
- private double jccorrection(double obsdist)
- {
- if (obsdist == 0.0) return 0.0;
-
- if (obsdist >= const1)
- {
- return BranchLimits.MAXARC;
- }
-
- double expDist = -const1 * Math.log(1.0 - (const2 * obsdist));
-
- if (expDist < BranchLimits.MAXARC)
- {
- return expDist;
- }
- else
- {
- return BranchLimits.MAXARC;
- }
- }
-}
-
diff --git a/LibrarySource/pal/distance/PairwiseDistance.java b/LibrarySource/pal/distance/PairwiseDistance.java
deleted file mode 100644
index a252d9c..0000000
--- a/LibrarySource/pal/distance/PairwiseDistance.java
+++ /dev/null
@@ -1,213 +0,0 @@
-// PairwiseDistance.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.distance;
-
-import pal.alignment.*;
-import pal.substmodel.*;
-import pal.misc.*;
-import pal.math.*;
-
-
-/**
- * determines the (observed and ML) distance between a pair of sequences
- *
- * @version $Id: PairwiseDistance.java,v 1.5 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class PairwiseDistance
-{
- //
- // Public stuff
- //
-
- /** last estimated distance */
- public double distance;
-
- /** last estimate standard error of a distance */
- public double distanceSE;
-
-
- /**
- * Constructor 1 (estimate observed distances only)
- *
- * @param sp site pattern
- */
- public PairwiseDistance(SitePattern sp)
- {
- updateSitePattern(sp);
- }
-
- /**
- * Constructor 2 (uses evolutionary model)
- *
- * @param sp site pattern
- * @param m evolutionary model
- */
- public PairwiseDistance(SitePattern sp, SubstitutionModel m)
- {
- this(sp);
-
- modelBased = true;
- of = new SequencePairLikelihood(sp, m);
- um = new UnivariateMinimum();
- }
-
- /**
- * update model of substitution
- *
- * @param model of substitution
- */
- public void updateModel(SubstitutionModel m)
- {
- of.updateModel(m);
- }
-
- /**
- * update site pattern
- *
- * @param site pattern
- */
- public void updateSitePattern(SitePattern sp)
- {
- sitePattern = sp;
- numSites = sp.getSiteCount();
- numPatterns = sp.numPatterns;
- numStates = sp.getDataType().getNumStates();
- weight = sp.weight;
-
- jcratio = ((double) numStates-1.0)/(double) numStates;
-
- if (modelBased) of.updateSitePattern(sp);
- }
-
- /**
- * compute distance between two sequences in the given alignment
- *
- * @param s1 number of first sequence
- * @param s2 number of second sequence
- *
- * @return estimated distance (observed or ML, depending on constructor used)
- */
- public double getDistance(int s1, int s2)
- {
- return getDistance(sitePattern.pattern[s1], sitePattern.pattern[s2]);
- }
-
- /**
- * compute distance between two sequences (not necessarly
- * in the given alignment but with the same weights in the site pattern)
- *
- * @param s1 site pattern of first sequence
- * @param s2 site pattern of second sequence
- *
- * @return estimated distance (observed or ML, depending on constructor used)
- */
- public double getDistance(byte[] s1, byte[] s2)
- {
- double dist = getObservedDistance(s1, s2);
-
- if (modelBased && dist != 0.0)
- {
- // Apply generalized JC correction if possible
- double start = 1.0 - dist/jcratio;
- if (start > 0.0)
- {
- start = -jcratio*Math.log(start);
- }
- else
- {
- start = dist;
- }
-
- // Determine ML distance
- of.setSequences(s1, s2);
- if (start > BranchLimits.MAXARC || start < BranchLimits.MINARC)
- {
- // Don�t use start value
- dist = um.findMinimum(of, BranchLimits.FRACDIGITS);
- }
- else
- {
- // Use start value
- dist = um.findMinimum(start, of, BranchLimits.FRACDIGITS);
- }
- }
-
- if (modelBased)
- {
- double f2x = um.f2minx;
-
- if (1.0/(BranchLimits.MAXARC*BranchLimits.MAXARC) < f2x)
- {
- distanceSE = Math.sqrt(1.0/f2x);
- }
- else
- {
- distanceSE = BranchLimits.MAXARC;
- }
- }
- else
- {
- distanceSE = 0.0;
- }
-
- distance = dist;
-
- return dist;
- }
-
-
- //
- // Private stuff
- //
-
- private int numSites;
- private int numPatterns;
- private int numStates;
- private int[] weight;
- private double jcratio;
- private boolean modelBased;
- private SitePattern sitePattern;
- private UnivariateMinimum um;
- private SequencePairLikelihood of;
-
- private boolean isDifferent(int s1, int s2)
- {
- // ? is considered identical to anything
- if (s1 == numStates || s2 == numStates)
- {
- return false;
- }
-
- // Check for identity
- if (s1 == s2)
- {
- return false;
- }
-
- // The remaining pairs are all different
- return true;
- }
-
- private double getObservedDistance(byte[] seqPat1, byte[] seqPat2)
- {
- int diff = 0;
- for (int i = 0; i < numPatterns; i++)
- {
- if (isDifferent(seqPat1[i], seqPat2[i]))
- {
- diff += weight[i];
- }
- }
-
- return (double) diff/(double) numSites;
- }
-}
-
diff --git a/LibrarySource/pal/distance/ReadDistanceMatrix.java b/LibrarySource/pal/distance/ReadDistanceMatrix.java
deleted file mode 100644
index 9877724..0000000
--- a/LibrarySource/pal/distance/ReadDistanceMatrix.java
+++ /dev/null
@@ -1,88 +0,0 @@
-// ReadDistanceMatrix.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.distance;
-
-import pal.io.*;
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * reads pairwise distance matrices in PHYLIP format
- * (full matrix)
- *
- * @version $Id: ReadDistanceMatrix.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class ReadDistanceMatrix extends DistanceMatrix
-{
- //
- // Public stuff
- //
-
- /** read from stream */
- public ReadDistanceMatrix(PushbackReader input)
- throws DistanceParseException
- {
- readSquare(input);
- }
-
- /** read from file */
- public ReadDistanceMatrix(String file)
- throws DistanceParseException, IOException
- {
- PushbackReader input = InputSource.openFile(file);
- readSquare(input);
- input.close();
- }
-
-
- //
- // Private stuff
- //
-
- // Read square matrix
- private void readSquare(PushbackReader in)
- throws DistanceParseException
- {
- FormattedInput fi = FormattedInput.getInstance();
-
- try
- {
- // Parse PHYLIP header line
- numSeqs = fi.readInt(in);
- fi.nextLine(in);
-
- // Read distance and sequence names
- distance = new double[numSeqs][numSeqs];
- idGroup = new SimpleIdGroup(numSeqs);
- for (int i = 0; i < numSeqs; i++)
- {
- idGroup.setIdentifier(i, new Identifier(fi.readLabel(in, 10)));
- for (int j = 0; j < numSeqs; j++)
- {
- distance[i][j] = fi.readDouble(in);
- }
- fi.nextLine(in);
- }
- }
- catch (IOException e)
- {
- throw new DistanceParseException("IO error");
- }
- catch (NumberFormatException e)
- {
- throw new DistanceParseException("Number format error");
- }
- }
-}
-
diff --git a/LibrarySource/pal/distance/SUPGMADistanceMatrix.java b/LibrarySource/pal/distance/SUPGMADistanceMatrix.java
deleted file mode 100644
index f136228..0000000
--- a/LibrarySource/pal/distance/SUPGMADistanceMatrix.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// SUPGMADistanceMatrix.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.distance;
-
-import pal.misc.*;
-
-/**
- * Corrects distances in a distance matrix such that all tips appear
- * contemporaneous, given a time/date and rate information for the
- * taxa.
- *
- * @version $Id: SUPGMADistanceMatrix.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class SUPGMADistanceMatrix extends DistanceMatrix {
-
-
- /**
- * Uses date/time information and a constant rate to correct distance matrices.
- */
- public SUPGMADistanceMatrix(DistanceMatrix raw, TimeOrderCharacterData tocd, double rate) {
-
- super(raw);
-
- double[] tips = new double[tocd.getIdGroup().getIdCount()];
- for (int i = 0; i < tips.length; i++) {
- if (tocd.hasTimes()) {
- tips[i] = rate * tocd.getTime(i);
- } else {
- tips[i] = 0.0;
- }
-
- for (int j = 0; j < tips.length; j++) {
- if (i != j) {
- addDistance(i, j, tips[i]);
- }
- }
- }
- }
-}
-
diff --git a/LibrarySource/pal/distance/SequencePairLikelihood.java b/LibrarySource/pal/distance/SequencePairLikelihood.java
deleted file mode 100644
index 9741e4a..0000000
--- a/LibrarySource/pal/distance/SequencePairLikelihood.java
+++ /dev/null
@@ -1,168 +0,0 @@
-// SequencePairLikelihood.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.distance;
-
-import pal.alignment.*;
-import pal.substmodel.*;
-import pal.misc.*;
-import pal.math.*;
-
-
-/**
- * computation of the (negative) log-likelihood for a pair of sequences
- *
- * @version $Id: SequencePairLikelihood.java,v 1.5 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class SequencePairLikelihood implements UnivariateFunction
-{
- /**
- * initialisation
- *
- * @param sp site pattern
- * @param m model of substitution
- */
- public SequencePairLikelihood(SitePattern sp, SubstitutionModel m)
- {
- updateSitePattern(sp);
- updateModel(m);
- }
-
- /**
- * update model of substitution
- *
- * @param model of substitution
- */
- public void updateModel(SubstitutionModel m)
- {
- model = m;
- numRates = model.rateDistribution.numRates;
- rateProb = model.rateDistribution.probability;
- rateMatrix = model.rateMatrix;
- }
-
- /**
- * update site pattern
- *
- * @param site pattern
- */
- public void updateSitePattern(SitePattern sp)
- {
- sitePattern = sp;
-
- numPatterns = sp.numPatterns;
- numSites = sp.getSiteCount();
- numStates = sp.getDataType().getNumStates();
- weight = sp.weight;
- }
-
-
- /**
- * specification of two sequences in the given alignment
- *
- * @param s1 number of first sequence
- * @param s2 number of second sequence
- */
- public void setSequences(int s1, int s2)
- {
- setSequences(sitePattern.pattern[s1], sitePattern.pattern[s2]);
- }
-
- /**
- * specification of two sequences (not necessarily in the given
- * alignment but with the same weights in the site pattern)
- *
- * @param s1 site pattern of first sequence
- * @param s2 site pattern of second sequence
- */
- public void setSequences(byte[] s1, byte[] s2)
- {
- seqPat1 = s1;
- seqPat2 = s2;
- }
-
- /**
- * compute (negative) log-likelihood for a given distance
- * between the two sequences
- *
- * @param arc expected distance
- *
- * @return negative log-likelihood
- */
- public double evaluate(double arc)
- {
- model.setDistance(arc);
-
- double loglkl = 0;
- for (int i = 0; i < numPatterns; i++)
- {
- double sumprob = 0;
- for (int r = 0; r < numRates; r++)
- {
- sumprob += rateProb[r]*probConfig(r, seqPat1[i], seqPat2[i]);
- }
- loglkl += weight[i]*Math.log(sumprob);
- }
-
- return -loglkl;
- }
-
- public double getLowerBound()
- {
- return BranchLimits.MINARC;
- }
-
- public double getUpperBound()
- {
- return BranchLimits.MAXARC;
- }
-
-
- //
- // Private stuff
- //
-
- private SubstitutionModel model;
- private RateMatrix rateMatrix;
- private SitePattern sitePattern;
- private int numPatterns;
- private int numSites;
- private int numStates;
- private int numRates;
- private int[] weight;
- private double[] rateProb;
- private byte[] seqPat1;
- private byte[] seqPat2;
-
- private double probConfig(int r, int i, int j)
- {
- double p;
-
- if (i == numStates && j == numStates)
- {
- p = 1.0;
- }
- else if (i == numStates)
- {
- p = rateMatrix.getEqulibriumFrequency(j);
- }
- else if (j == numStates)
- {
- p = rateMatrix.getEqulibriumFrequency(i);
- }
- else
- {
- p = rateMatrix.getEqulibriumFrequency(i)*model.transProb(r, i, j);
- }
-
- return p;
- }
-}
-
diff --git a/LibrarySource/pal/distance/makefile b/LibrarySource/pal/distance/makefile
deleted file mode 100644
index dca8f11..0000000
--- a/LibrarySource/pal/distance/makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-### VARIABLES ###
-
-JIKESOPTS := +P
-GCJOPTS :=
-
-# Always check dependencies
-JIKESOPTS += +M
-
-SRC := $(wildcard *.java)
-CLS := $(patsubst %.java, %.class, $(SRC))
-OBJ := $(patsubst %.class, %.o, $(wildcard *.class))
-
-
-### RULES ###
-
-# Compile Java sources into class files
-%.class: %.java
- jikes $(JIKESOPTS) $<
-
-# Alternative to using jikes: gcj -C
-
-# Compile class files into native code
-%.o: %.class
- gcj -c $(GCJOPTS) $<
-
-
-### TARGETS ###
-
-.PHONY: classes native clean
-
-classes: $(CLS)
-
-ifneq ($(OBJ),)
-native: $(OBJ)
- (ar -rv package.a *.o; ranlib package.a)
-else
-native: $(OBJ)
-endif
-
-clean:
- rm -f *.class *.o *.u *.a *~
-
diff --git a/LibrarySource/pal/distance/package.html b/LibrarySource/pal/distance/package.html
deleted file mode 100644
index 0f05a80..0000000
--- a/LibrarySource/pal/distance/package.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
-<body>
-Classes for reading and generating distance matrices, including computation
-of pairwise distances for sequence data (maximum-likelihood and observed
-distances).
-</body>
-</html>
-
diff --git a/LibrarySource/pal/eval/ChiSquareValue.java b/LibrarySource/pal/eval/ChiSquareValue.java
deleted file mode 100644
index 6b231e6..0000000
--- a/LibrarySource/pal/eval/ChiSquareValue.java
+++ /dev/null
@@ -1,196 +0,0 @@
-// ChiSquareValue.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.eval;
-
-import pal.distance.*;
-import pal.math.*;
-import pal.misc.*;
-import pal.tree.*;
-
-
-/**
- * computes chi-square value of a (parameterized) tree for
- * its set of parameters (e.g., branch lengths)
- * and a given distance matrix
- *
- * @version $Id: ChiSquareValue.java,v 1.12 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class ChiSquareValue implements MultivariateFunction
-{
- //
- // Public stuff
- //
-
- /**
- * initialization
- *
- * @param m distance matrix
- * @param w determines whether weighted or
- * unweighted chi-squares are computed
- */
- public ChiSquareValue(DistanceMatrix m, boolean w)
- {
- givenMat = m;
- weighted = w;
- }
-
-
- /**
- * define (parameterized) tree
- *
- * @param t tree
- */
- public void setTree(Tree t)
- {
- tree = t;
-
- //changed so that smaller trees could be easily handled
- //for tree-search purposes
- inducedMat = new TreeDistanceMatrix(tree);
-
- if (tree instanceof ParameterizedTree)
- {
- ptree = (ParameterizedTree) tree;
- numParams = ptree.getNumParameters();
- }
- else
- {
- ptree = null;
- numParams = 0;
- }
- }
-
-
- /**
- * Returns the (parameterized) tree of this likelihood value.
- */
- public Tree getTree()
- {
- return tree;
- }
-
-
- /**
- * compute (weighted) least-square value
- * for current tree (fixed branch lengths)
- *
- * return chi-square value
- */
- public double compute()
- {
- inducedMat.computeDistances();
-
- return DistanceMatrixUtils.squaredDistance(inducedMat,
- givenMat, weighted);
- }
-
- /**
- * optimise parameters of a tree by minimising its chi-square value
- * (tree must be a ParameterizedTree)
- *
- * @return minimimum chi-square value
- */
- public double optimiseParameters()
- {
- return optimiseParameters(null);
- }
-
-
- /**
- * optimise parameters of a tree by minimising its chi-square value
- * (tree must be a ParameterizedTree)
- *
- * @param mm optimiser for ParameterizedTree
- *
- * @return minimum chi-square value
- */
- public double optimiseParameters(MultivariateMinimum mm)
- {
- if (!(tree instanceof ParameterizedTree))
- {
- // we need a ParameterizedTree here!
- new IllegalArgumentException("ParameterizedTree required");
- }
-
- if (mm == null)
- {
- if (mvm == null) mvm = new DifferentialEvolution(numParams);
- }
- else
- {
- mvm = mm;
- }
-
- // first guess are the default parameters of the tree
- double[] estimate = new double[numParams];
- for (int i = 0; i < numParams; i++)
- {
- estimate[i] = ptree.getDefaultValue(i);
- }
-
- mvm.findMinimum(this, estimate, BranchLimits.FRACDIGITS, BranchLimits.FRACDIGITS);
-
- return evaluate(estimate);
- }
-
-
-
- // interface MultivariateFunction
-
- /**
- * compute (weighted) least-squares value
- *
- * @param params parameters (branch lengths) of the tree
- */
- public double evaluate(double[] params)
- {
- for (int i = 0; i < numParams; i++)
- {
- ptree.setParameter(params[i], i);
- }
-
- return compute();
- }
-
- /**
- * get number of parameters in tree
- *
- * @return number of parameters
- */
- public int getNumArguments()
- {
- return ptree.getNumParameters();
- }
-
- public double getLowerBound(int n)
- {
- return ptree.getLowerLimit(n);
- }
-
- public double getUpperBound(int n)
- {
- return ptree.getUpperLimit(n);
- }
-
-
- //
- // Private stuff
- //
-
- private int numParams;
- private Tree tree;
- private ParameterizedTree ptree;
- private DistanceMatrix givenMat;
- private TreeDistanceMatrix inducedMat;
- private boolean weighted;
- private MultivariateMinimum mvm = null;
-}
-
diff --git a/LibrarySource/pal/eval/DemographicLikelihoodValue.java b/LibrarySource/pal/eval/DemographicLikelihoodValue.java
deleted file mode 100644
index 06903d2..0000000
--- a/LibrarySource/pal/eval/DemographicLikelihoodValue.java
+++ /dev/null
@@ -1,58 +0,0 @@
-// DemographicLikelihoodValue.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-// - partial likelihoods need a lot of memory storage
-// memory usage could be opimized by working in a single site
-
-
-package pal.eval;
-
-import pal.coalescent.*;
-import pal.alignment.*;
-
-/**
- * Estimates the likelihood for a tree using a specified
- * model of sequence evolution and a sequence alignment and
- * a specific demographic model as a prior on coalescent intervals.
- *
- * <em>Must be used in conjunction with DemographicClockTree! </em>
- *
- * @version $Id: DemographicLikelihoodValue.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class DemographicLikelihoodValue extends LikelihoodValue
-{
- //
- // Public stuff
- //
-
- /**
- * Parameter taking a site pattern.
- */
- public DemographicLikelihoodValue(SitePattern sp) {
- super(sp);
- }
-
-
- /**
- * compute log-likelihood
- * for current branch lengths and model
- *
- * return negative log-likelihood
- */
- public double compute()
- {
- super.compute();
-
- logL += ((DemographicTree)tree).computeDemoLogLikelihood();
-
- return -logL;
- }
-}
-
-
diff --git a/LibrarySource/pal/eval/DemographicValue.java b/LibrarySource/pal/eval/DemographicValue.java
deleted file mode 100644
index 5c4b0a8..0000000
--- a/LibrarySource/pal/eval/DemographicValue.java
+++ /dev/null
@@ -1,178 +0,0 @@
-// DemographicValue.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.eval;
-
-import pal.coalescent.*;
-import pal.tree.*;
-import pal.math.*;
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * estimates demographic parameters by maximising the coalescent
- * prior for a tree with given branch lengths.
- *
- * @version $Id: DemographicValue.java,v 1.5 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- * @authro Korbinian Strimmer
- */
-public class DemographicValue implements MultivariateFunction
-{
- //
- // Public stuff
- //
-
- /** Log-Likelihood */
- public double logL;
-
- /**
- * define model
- *
- * @param m model of demographic
- */
- public void setDemographicModel(DemographicModel m)
- {
- model = m;
- numParams = model.getNumParameters();
-
-
- // likelihood functions contains many local optima
- mvm = new DifferentialEvolution(numParams, 20*numParams);
- //mvm = new ConjugateGradientSearch();
- }
-
- /**
- * Returns the demographic model of this likelihood value
- */
- public DemographicModel getDemographicModel() {
- return model;
- }
-
- /**
- * Returns the coalescent tree of this likelihood value.
- */
- public CoalescentIntervals getCoalescentIntervals() {
- return intervals;
- }
-
- /**
- * define coalescent tree.
- *
- * @param t tree
- */
- public void setCoalescentIntervals(CoalescentIntervals ci)
- {
- intervals = ci;
- }
-
- /**
- * compute log-likelihood
- * for current model
- *
- * return negative log-likelihood
- */
- public double compute()
- {
- computeLogLikelihood();
-
- return -logL;
- }
-
- /**
- * optimize log-likelihood
- * using default optimizer
- *
- * return minimum negative log-likelihood
- */
- public double optimize()
- {
- return optimize(mvm);
- }
-
- /**
- * optimize log-likelihood value and compute corresponding SEs
- * given an optimizer
- *
- * @return minimimum negative log-likelihood value
- */
- public double optimize(MultivariateMinimum givenMvm)
- {
- double[] estimate = new double[numParams];
-
- for (int i = 0; i < numParams; i++)
- {
- estimate[i] = model.getParameter(i);
- }
-
- givenMvm.findMinimum(this, estimate,
- BranchLimits.FRACDIGITS, BranchLimits.FRACDIGITS);
-
-
- // Corresponding SEs
- double[] estimateSE = new double[numParams];
- estimateSE = NumericalDerivative.diagonalHessian(this, estimate);
- for (int i = 0; i < numParams; i++)
- {
- estimateSE[i] = Math.sqrt(Math.abs(1.0/estimateSE[i]));
- model.setParameterSE(estimateSE[i], i);
- }
- evaluate(estimate);
-
- model.setLogL(logL);
-
- return -logL;
- }
-
- // interface MultivariateFunction
-
- public double evaluate(double[] params)
- {
- // set tree parameters
- for (int i = 0; i < numParams; i++)
- {
- model.setParameter(params[i], i);
- }
-
- return compute();
- }
-
- public int getNumArguments()
- {
- return numParams;
- }
-
- public double getLowerBound(int n)
- {
- return model.getLowerLimit(n);
- }
-
- public double getUpperBound(int n)
- {
- return model.getUpperLimit(n);
- }
-
- //
- // Private stuff
- //
-
- private int numParams;
- protected CoalescentIntervals intervals;
- protected DemographicModel model;
- private MultivariateMinimum mvm;
-
- // Calculate likelihood of model given intervals
-
- protected void computeLogLikelihood() {
- logL = intervals.computeLogLikelihood(model);
- }
-}
-
-
diff --git a/LibrarySource/pal/eval/LikelihoodValue.java b/LibrarySource/pal/eval/LikelihoodValue.java
deleted file mode 100644
index 6407eec..0000000
--- a/LibrarySource/pal/eval/LikelihoodValue.java
+++ /dev/null
@@ -1,1358 +0,0 @@
-// LikelihoodValue.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.eval;
-
-import pal.alignment.*;
-import pal.substmodel.*;
-import pal.tree.*;
-import pal.distance.*;
-import pal.math.*;
-import pal.misc.*;
-
-import java.io.*;
-import java.util.*;
-
-
-/**
- * Computes the likelihood for a tree given a
- * model of sequence evolution and a sequence alignment;
- * also optimises tree parameters such as branch lengths
- * by maximising the likelihood (for optimal performance
- * special optimisation procedures are
- * employed for UnconstrainedTree, ClockTree and DatedTipsClockTree;
- * a general optimisation precedure is used for another
- * ParameterizedTree).
- *
- * @version $Id: LikelihoodValue.java,v 1.32 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class LikelihoodValue
-{
- //
- // Public stuff
- //
-
- /** Log-Likelihood */
- public double logL;
-
- /** log-likelihood for each site pattern */
- public double[] siteLogL;
-
- /** map estimation of rate at site pattern */
- public int[] rateAtSite;
-
-
- /**
- * initialization
- *
- * @param sp site pattern
- */
- public LikelihoodValue(SitePattern sp)
- {
- sitePattern = sp;
-
- numPatterns = sp.numPatterns;
- siteLogL = new double[numPatterns];
- rateAtSite = new int[numPatterns];
- }
-
- /**
- * Returns the site pattern of this likelihood value
- */
- public SitePattern getSitePattern() {
- return sitePattern;
- }
-
-
- /**
- * Set new site pattern (while keeping tree and model)
- */
- public void renewSitePattern(SitePattern sp)
- {
- sitePattern = sp;
-
- numPatterns = sp.numPatterns;
- siteLogL = new double[numPatterns];
- rateAtSite = new int[numPatterns];
-
- setModel(getModel());
- setTree(getTree());
- }
-
-
- /**
- * define model
- * (a site pattern must have been set before calling this method)
- *
- * @param m model of substitution (rate matrix + rate distribution)
- */
- public void setModel(SubstitutionModel m)
- {
- model = m;
-
- frequency = model.rateMatrix.getEqulibriumFrequencies();
- rprob = model.rateDistribution.probability;
- numStates = model.dimension;
- numRates = model.numRates;
-
- int maxNodes = 2*sitePattern.getSequenceCount()-2;
-
- allocatePartialMemory(maxNodes);
- }
-
- /**
- * Returns the model of this likelihood value.
- */
- public SubstitutionModel getModel() {
- return model;
- }
-
-
- /**
- * define (parameterized) tree
- *,(must only be called only after a site pattern has been defined).
- *
- * @param t tree
- */
- public void setTree(Tree t)
- {
- tree = t;
-
- // Assign sequences to leaves
- int[] alias =
- TreeUtils.mapExternalIdentifiers(sitePattern, tree);
-
- for (int i = 0; i < tree.getExternalNodeCount(); i++)
- {
- tree.getExternalNode(i).setSequence(sitePattern.pattern[alias[i]]);
- }
-
- if (tree instanceof ParameterizedTree)
- {
- ptree = (ParameterizedTree) tree;
- numParams = ptree.getNumParameters();
- }
- else
- {
- ptree = null;
- numParams = 0;
- }
- }
-
- /**
- * Returns the (potentially parameterized) tree of this likelihood value.
- */
- public Tree getTree()
- {
- return tree;
- }
-
-
- /**
- * compute log-likelihood for current tree (fixed branch lengths and model)
- *
- * return log-likelihood
- */
- public double compute()
- {
- treeLikelihood();
-
- return logL;
- }
-
-
- /**
- * optimise parameters of tree by maximising its likelihood
- * (this assumes that tree is a ParameterizedTree)
- *
- * @return minimimum log-likelihood value
- */
- public double optimiseParameters()
- {
- return optimiseParameters(null);
- }
-
-
- /**
- * optimise parameters of tree by maximising its likelihood
- * (this assumes that tree is a ParameterizedTree)
- *
- * @param mm optimiser for generic ParameterisedTree
- *
- * @return minimimum log-likelihood value
- */
- public double optimiseParameters(MultivariateMinimum mm)
- {
- if (!(tree instanceof ParameterizedTree))
- {
- // we need a ParameterizedTree here!
- new IllegalArgumentException("ParameterizedTree required");
- }
-
- double[] estimate = new double[numParams];
-
- // we need these in any case
- if (um == null) um = new UnivariateMinimum();
- if (tl == null) tl = new TreeLikelihood(this);
-
- if (bl == null) bl = new BranchLikelihood(this);
- else bl.update();
-
- if (tree instanceof UnconstrainedTree)
- {
- optimiseUnconstrainedTree(true);
- }
- else if (tree instanceof ClockTree)
- {
- if (nl == null) nl = new NodeLikelihood(this);
- else nl.update();
-
- int ns;
- do
- {
- optimiseClockTree(false);
-
- ns = collapseShortInternalBranches();
-
- // make consistent
- ((ClockTree) ptree).update();
-
- numParams = numParams - ns;
- }
- while (ns != 0);
-
- numParams += restoreShortInternalBranches();
-
- // make consistent
- ((ClockTree) ptree).update();
- }
- else if (tree instanceof DatedTipsClockTree)
- {
- if (nl == null) nl = new NodeLikelihood(this);
- else nl.update();
- if (rl == null) rl = new RateLikelihood(this);
- else rl.update();
-
- int ns;
- do
- {
- optimiseClockTree(true);
-
- ns = collapseShortInternalBranches();
-
- // make consistent
- ((DatedTipsClockTree) ptree).update();
-
- numParams = numParams - ns;
- }
- while (ns != 0);
-
- numParams += restoreShortInternalBranches();
-
- // make consistent
- ((DatedTipsClockTree) ptree).update();
- }
- else
- {
- for (int i = 0; i < numParams; i++)
- {
- estimate[i] = ptree.getParameter(i);
- }
-
- if (mm == null)
- {
- if (mvm == null) mvm = new DifferentialEvolution(numParams);
- }
- else
- {
- mvm = mm;
- }
- mvm.findMinimum(tl, estimate, BranchLimits.FRACDIGITS,
- BranchLimits.FRACDIGITS);
- }
-
- // compute estimates for SEs of branch lengths
- optimiseUnconstrainedTree(false);
-
- for (int i = 0; i < numParams; i++)
- {
- estimate[i] = ptree.getParameter(i);
- }
-
- return -tl.evaluate(estimate);
- }
-
-
- //
- // Friendly stuff
- //
-
- int numStates;
- int numRates;
- int numPatterns;
- double[] frequency;
- double[] rprob;
- SitePattern sitePattern;
- int numParams;
- Tree tree;
- ParameterizedTree ptree;
-
- /** get partial likelihood of a branch */
- double[][][] getPartial(Node branch)
- {
- return partials[getKey(branch)];
- }
-
- /** get next branch around a center node
- (center may be root, but root is never returned) */
- Node getNextBranch(Node branch, Node center)
- {
- Node b = getNextBranchOrRoot(branch, center);
-
- if (b.isRoot())
- {
- b = b.getChild(0);
- }
-
- return b;
- }
-
- /** multiply partials into the neighbour of branch */
- void productPartials(Node branch, Node center)
- {
- int numBranches = getBranchCount(center);
-
- Node nextBranch = getNextBranch(branch, center);
- double[][][] partial = getPartial(nextBranch);
-
- for (int i = 0; i < numBranches-2; i++)
- {
- nextBranch = getNextBranch(nextBranch, center);
- double[][][] partial2 = getPartial(nextBranch);
-
- for (int l = 0; l < numPatterns; l++)
- {
- for (int r = 0; r < numRates; r++)
- {
- double[] p = partial[l][r];
- double[] p2 = partial2[l][r];
-
- for (int d = 0; d < numStates; d++)
- {
- p[d] *= p2[d];
- }
-
- }
- }
- }
- }
-
-
- /** compute partials for branch around center node
- (it is assumed that multiplied partials are available in
- the neighbor branch) */
- void partialsInternal(Node branch, Node center)
- {
- double[][][] partial = getPartial(branch);
- double[][][] multPartial = getPartial(getNextBranch(branch, center));
-
- model.setDistance(branch.getBranchLength());
- for (int l = 0; l < numPatterns; l++)
- {
- for (int r = 0; r < numRates; r++)
- {
- double[] p = partial[l][r];
- double[] mp = multPartial[l][r];
-
- for (int d = 0; d < numStates; d++)
- {
- double sum = 0;
- for (int j = 0; j < numStates; j++)
- {
- sum += model.transProb(r, d, j)*mp[j];
- }
- p[d] = sum;
- }
- }
- }
- }
-
- /** compute partials for external branch */
- void partialsExternal(Node branch)
- {
- double[][][] partial = getPartial(branch);
- byte[] seq = branch.getSequence();
-
- model.setDistance(branch.getBranchLength());
-
- for (int l = 0; l < numPatterns; l++)
- {
- for (int r = 0; r < numRates; r++)
- {
- double[] p = partial[l][r];
- int sl = seq[l];
-
- if (sl == numStates)
- {
- for (int d = 0; d < numStates; d++)
- {
- p[d] = 1;
- }
- }
- else
- {
- for (int d = 0; d < numStates; d++)
- {
- p[d] = model.transProb(r, d, sl);
- }
- }
- }
- }
- }
-
-
-
- //
- // Private stuff
- //
-
- // max. number of iterations in ml optimization
- private int MAXROUNDS = 1000;
-
- private SubstitutionModel model;
- private AlignmentDistanceMatrix distMat;
- private double[][][][] partials;
- private boolean down;
- private Node currentBranch;
- private UnivariateMinimum um;
- private MultivariateMinimum mvm;
- private BranchLikelihood bl;
- private TreeLikelihood tl;
- private NodeLikelihood nl;
- private RateLikelihood rl;
-
- private void allocatePartialMemory(int numNodes) {
-
- // I love the profiler!
- // This 'if' statement sped my MCMC algorithm up by nearly 300%
- // Never underestimate the time it takes to allocate and de-allocate memory!
- // AD
- if (
- (partials == null) ||
- (numNodes != partials.length) ||
- (numPatterns != partials[0].length) ||
- (numRates != partials[0][0].length) ||
- (numStates != partials[0][0][0].length)) {
-
- partials = new double[numNodes][numPatterns][numRates][numStates];
- }
- }
-
- /** get next branch around a center node
- (center may be root, and root may also be returned) */
- private Node getNextBranchOrRoot(Node branch, Node center)
- {
- int numChilds = center.getChildCount();
-
- int num;
- for (num = 0; num < numChilds; num++)
- {
- if (center.getChild(num) == branch)
- {
- break;
- }
- }
-
- // num is now child number (if num = numChilds then branch == center)
-
- // next node
- num++;
-
- if (num > numChilds)
- {
- num = 0;
- }
-
- if (num == numChilds)
- {
- return center;
- }
- else
- {
- return center.getChild(num);
- }
- }
-
- private int getKey(Node node)
- {
- int key;
- if (node.isLeaf())
- {
- key = node.getNumber();
- }
- else
- {
- key = node.getNumber() + tree.getExternalNodeCount();
- }
-
- return key;
- }
-
- /** returns number of branches centered around an internal node */
- private int getBranchCount(Node center)
- {
- if (center.isRoot())
- {
- return center.getChildCount();
- }
- else
- {
- return center.getChildCount()+1;
- }
- }
-
- private void traverseTree()
- {
- if ((!currentBranch.isLeaf() && down) || currentBranch.isRoot())
- {
- currentBranch = currentBranch.getChild(0);
- down = true;
- }
- else
- {
- Node center = currentBranch.getParent();
- currentBranch = getNextBranchOrRoot(currentBranch, center);
-
- if (currentBranch == center)
- {
- down = false;
- }
- else
- {
- down = true;
- }
- }
- }
-
- /** init partial likelihoods */
- private void initPartials()
- {
- currentBranch = tree.getRoot();
- down = true;
-
- Node firstBranch = currentBranch;
-
- do
- {
- if (currentBranch.isRoot())
- {
- //do nothing
- }
- else
- if (currentBranch.isLeaf())
- {
- partialsExternal(currentBranch);
- }
- else if (!down)
- {
- productPartials(currentBranch, currentBranch);
- partialsInternal(currentBranch, currentBranch);
- }
-
- traverseTree();
- }
- while (currentBranch != firstBranch);
- }
-
- /** calculate likelihood of any tree and infer MAP estimates of rates at a site */
- private void treeLikelihood()
- {
- initPartials();
-
- Node center = tree.getRoot();
-
- Node firstBranch = center.getChild(0);
- Node lastBranch = center.getChild(center.getChildCount()-1);
-
- double[][][] partial1 = getPartial(firstBranch);
- double[][][] partial2 = getPartial(lastBranch);
-
- productPartials(lastBranch, center);
-
- logL = 0;
- for (int l = 0; l < numPatterns; l++)
- {
- int bestR = 0;
- double maxSum = 0;
-
- double rsum = 0.0;
- for (int r = 0; r < numRates; r++)
- {
- double[] p1 = partial1[l][r];
- double[] p2 = partial2[l][r];
-
- double sum = 0.0;
- for (int d = 0; d < numStates; d++)
- {
- sum += frequency[d]*p1[d]*p2[d];
- }
- sum *= rprob[r];
-
- // find rate category that contributes the most
- if (r == 0)
- {
- bestR = 0;
- maxSum = sum;
- }
- else
- {
- if (sum > maxSum)
- {
- bestR = r;
- maxSum = sum;
- }
- }
-
- rsum += sum;
- }
-
- siteLogL[l] = Math.log(rsum);
- rateAtSite[l] = bestR;
- logL += siteLogL[l]*sitePattern.weight[l];
- }
-
- }
-
- /** optimise branch lengths and find SEs (UnconstrainedTree) */
- private void optimiseUnconstrainedTree(boolean optimise)
- {
- int numBranches = tree.getInternalNodeCount() + tree.getExternalNodeCount()-1;
-
- initPartials();
-
- Node firstBranch = currentBranch;
- double len, lenOld, lenDiff;
- int nconv = 0;
-
- int numRounds = 0;
-
- double lenSE;
- double INVARC = 1.0/(BranchLimits.MAXARC*BranchLimits.MAXARC);
- do
- {
- if (currentBranch.isRoot())
- {
- // do nothing
- }
- else if (currentBranch.isLeaf())
- {
- productPartials(currentBranch, currentBranch.getParent());
- bl.setBranch(currentBranch);
- lenOld = currentBranch.getBranchLength();
-
- //optimise
- if (optimise)
- {
- len = um.findMinimum(lenOld, bl, BranchLimits.FRACDIGITS);
- currentBranch.setBranchLength(len);
- }
- else
- {
- // find corresponding SE
- len = lenOld;
- lenSE = NumericalDerivative.secondDerivative(bl, lenOld);
- if (INVARC < lenSE)
- lenSE = Math.sqrt(1.0/lenSE);
- else
- lenSE = BranchLimits.MAXARC;
- currentBranch.setBranchLengthSE(lenSE);
- }
-
- // check progress
- lenDiff = Math.abs(len-lenOld);
- if (lenDiff < BranchLimits.ABSTOL) nconv++;
- else nconv = 0;
-
- if (nconv >= numBranches || numRounds == MAXROUNDS)
- {
- bl.evaluate(len);
- break;
- }
-
- // update partials
- partialsExternal(currentBranch);
- }
- else if (down)
- {
- productPartials(currentBranch, currentBranch.getParent());
- partialsInternal(currentBranch, currentBranch.getParent());
- }
- else // !down
- {
- productPartials(currentBranch, currentBranch);
- bl.setBranch(currentBranch);
- lenOld = currentBranch.getBranchLength();
-
- //optimise
- if (optimise)
- {
- len = um.findMinimum(lenOld, bl, BranchLimits.FRACDIGITS);
- currentBranch.setBranchLength(len);
- }
- else
- {
- // find corresponding SE
- len = lenOld;
- lenSE = NumericalDerivative.secondDerivative(bl, lenOld);
- if (INVARC < lenSE)
- lenSE = Math.sqrt(1.0/lenSE);
- else
- lenSE = BranchLimits.MAXARC;
- currentBranch.setBranchLengthSE(lenSE);
- }
-
- // check progress
- lenDiff = Math.abs(len-lenOld);
- if (lenDiff < BranchLimits.ABSTOL) nconv++;
- else nconv = 0;
-
- if (nconv >= numBranches || numRounds == MAXROUNDS)
- {
- bl.evaluate(len);
- break;
- }
-
- // update branch length and partials
- partialsInternal(currentBranch, currentBranch);
- }
-
- traverseTree();
-
- if (currentBranch == firstBranch) numRounds++;
- }
- while (true);
- }
-
- private Vector shortBranches = null;
-
- /** collapse internal branches that are close to zero */
- private int collapseShortInternalBranches()
- {
- // minus 1 because root node has no own branch
- int numInternalBranches = tree.getInternalNodeCount()-1;
- int numShortBranches = 0;
- for (int i = 0; i < numInternalBranches; i++)
- {
- Node b = tree.getInternalNode(i);
- if (b.getBranchLength() <= 2*BranchLimits.MINARC)
- {
- numShortBranches++;
-
- NodeUtils.removeBranch(b);
-
- if (shortBranches == null) shortBranches = new Vector();
-
- shortBranches.addElement(b);
- }
- }
-
- //numParams = numParams - numShortBranches;
- tree.createNodeList();
-
- return numShortBranches;
- }
-
- /** restore internal branches */
- private int restoreShortInternalBranches()
- {
- int size = 0;
-
- if (shortBranches != null)
- {
- size = shortBranches.size();
- for (int i = size-1; i >= 0; i--)
- {
- Node node = (Node) shortBranches.elementAt(i);
- NodeUtils.restoreBranch(node);
- node.setBranchLength(BranchLimits.MINARC);
- node.setNodeHeight(node.getParent().getNodeHeight()-BranchLimits.MINARC);
- shortBranches.removeElementAt(i);
- }
- }
-
- //numParams = numParams+size;
- tree.createNodeList();
-
- return size;
- }
-
-
- /** optimise branch lengths (ClockTree) */
- private void optimiseClockTree(boolean datedTips)
- {
- int numNodes = tree.getInternalNodeCount();
-
- double MAXHEIGHT = numNodes*BranchLimits.MAXARC;
-
- initPartials();
-
- Node firstBranch = currentBranch;
- double h, hOld, hDiff, hMin, hMax, hSE;
- int nconv = 0;
-
- int numRounds = 0;
-
- double INVMAX = 1.0/(MAXHEIGHT*MAXHEIGHT);
- do
- {
- if (currentBranch.isRoot())
- {
- if (datedTips && numRounds > 0)
- {
- // in the first round we did not adjust the rate
- // so we assume that the likelihood has not converged
- if (numRounds == 1) nconv = 0;
- //nconv = 0;
-
- double oldLogL = logL;
-
- // optimise rate
- DatedTipsClockTree dtree = (DatedTipsClockTree) ptree;
- double rOld = dtree.getRate();
- double maxR = dtree.getMaxRate();
- double r = um.findMinimum(rOld, rl);
- rl.evaluate(r);
-
- // find corresponding SE
- double rSE = um.f2minx;
- if (1 < rSE)
- rSE = Math.sqrt(1.0/rSE);
- else
- rSE = 1;
- dtree.setRateSE(rSE);
-
- // check progress
- /*double logLDiff = Math.abs(logL-oldLogL);
- if (logLDiff > 0.001)
- {
- // reset
- nconv = 0;
- }*/
- }
-
- // min-max heights
- hMin = NodeUtils.findLargestChild(currentBranch)+BranchLimits.MINARC;
- hMax = MAXHEIGHT-BranchLimits.MINARC;
-
- //optimise
- nl.setBranch(currentBranch, hMin, hMax);
- hOld = currentBranch.getNodeHeight();
- h = um.findMinimum(hOld, nl, BranchLimits.FRACDIGITS);
- nl.evaluate(h);
-
- // find corresponding SE
- hSE = um.f2minx;
- if (INVMAX < hSE)
- hSE = Math.sqrt(1.0/hSE);
- else
- hSE = MAXHEIGHT;
- currentBranch.setNodeHeightSE(hSE);
-
- // check progress
- hDiff = Math.abs(h-hOld);
- if (hDiff < BranchLimits.ABSTOL) nconv++;
- else nconv = 0;
-
- if (nconv >= numNodes || numRounds == MAXROUNDS)
- {
- break;
- }
- }
- else if (currentBranch.isLeaf())
- {
- productPartials(currentBranch, currentBranch.getParent());
- partialsExternal(currentBranch);
- }
- else if (down)
- {
- productPartials(currentBranch, currentBranch.getParent());
-
- // min-max heights
- hMin = NodeUtils.findLargestChild(currentBranch)+BranchLimits.MINARC;
- hMax = currentBranch.getParent().getNodeHeight()-BranchLimits.MINARC;
-
- //optimise
- nl.setBranch(currentBranch, hMin, hMax);
- hOld = currentBranch.getNodeHeight();
- h = um.findMinimum(hOld, nl, BranchLimits.FRACDIGITS);
- nl.evaluate(h);
-
- // find corresponding SE
- hSE = um.f2minx;
- if (INVMAX < hSE)
- hSE = Math.sqrt(1.0/hSE);
- else
- hSE = MAXHEIGHT;
- currentBranch.setNodeHeightSE(hSE);
-
- // check progress
- hDiff = Math.abs(h-hOld);
- if (hDiff < BranchLimits.ABSTOL) nconv++;
- else nconv = 0;
-
- if (nconv >= numNodes || numRounds == MAXROUNDS)
- {
- break;
- }
-
- partialsInternal(currentBranch, currentBranch.getParent());
- }
- else // !down
- {
- productPartials(currentBranch, currentBranch);
- partialsInternal(currentBranch, currentBranch);
- }
-
- traverseTree();
-
- if (currentBranch == firstBranch) numRounds++;
- }
- while (true);
- }
-}
-
-class RateLikelihood implements UnivariateFunction
-{
- public RateLikelihood(LikelihoodValue lv)
- {
- this.lv = lv;
- update();
- }
-
- public void update()
- {
- dtree = (DatedTipsClockTree) lv.ptree;
- }
-
- public double evaluate(double param)
- {
- // set rate parameters
- dtree.setRate(param);
-
- return -lv.compute();
- }
-
- public double getLowerBound()
- {
- return 0;
- }
-
- public double getUpperBound()
- {
- return dtree.getMaxRate();
- }
-
- // private stuff
- private LikelihoodValue lv;
- private DatedTipsClockTree dtree;
-}
-
-class TreeLikelihood implements MultivariateFunction
-{
-
-
-
- public TreeLikelihood(LikelihoodValue lv)
- {
- this.lv = lv;
- }
-
- public double evaluate(double[] params)
- {
- // set tree parameters
- for (int i = 0; i < lv.numParams; i++)
- {
- lv.ptree.setParameter(params[i], i);
- }
-
- return -lv.compute();
- }
-
- public int getNumArguments()
- {
- return lv.numParams;
- }
-
- public double getLowerBound(int n)
- {
- return lv.ptree.getLowerLimit(n);
- }
-
- public double getUpperBound(int n)
- {
- return lv.ptree.getUpperLimit(n);
- }
-
- // private stuff
- private LikelihoodValue lv;
-}
-
-class ModelLikelihood implements MultivariateFunction
-{
-
- public ModelLikelihood(LikelihoodValue lv)
- {
- this.lv = lv;
- this.model_ = lv.getModel();
- }
-
- public double evaluate(double[] params)
- {
- // set tree parameters
- for (int i = 0; i < lv.numParams; i++)
- {
- model_.setParameter(params[i], i);
- }
-
- return -lv.compute();
- }
-
- public int getNumArguments()
- {
- return model_.getNumParameters();
- }
-
- public double getLowerBound(int n)
- {
- return model_.getLowerLimit(n);
- }
-
- public double getUpperBound(int n)
- {
- return model_.getUpperLimit(n);
- }
-
- // private stuff
- private LikelihoodValue lv;
- private SubstitutionModel model_; //Cached results
-}
-
-/** Basically for cobmining model and tree likelihood optimising functions */
-class CombinedLikelihood implements MultivariateFunction {
- public CombinedLikelihood(MultivariateFunction f1, MultivariateFunction f2, LikelihoodValue lv) {
- this.f1_ = f1;
- this.f2_ = f2;
- this.f1Params_ = new double[f1.getNumArguments()];
- this.f2Params_ = new double[f2.getNumArguments()];
- }
- public double evaluate(double[] params) {
- for(int i = 0 ; i < f1Params_.length ; i++) {
- f1Params_[i] = params[i];
- }
- for(int i = 0 ; i < f2Params_.length ; i++) {
- f2Params_[i] = params[i-f1Params_.length];
- }
- return -lv.compute();
- }
-
- public int getNumArguments() {
- return f1Params_.length+f2Params_.length;
- }
-
- public double getLowerBound(int n) {
- if(n<f1Params_.length) {
- f1_.getLowerBound(n);
- }
- return f2_.getLowerBound(n-f1Params_.length);
- }
-
- public double getUpperBound(int n) {
- if(n<f1Params_.length) {
- f1_.getUpperBound(n);
- }
- return f2_.getUpperBound(n-f1Params_.length);
- }
-
- private double[] f1Params_;
- private double[] f2Params_;
-
- private LikelihoodValue lv;
- private MultivariateFunction f1_, f2_; //Cached results
-}
-
-
-class BranchLikelihood implements UnivariateFunction
-{
- public BranchLikelihood(LikelihoodValue lv)
- {
- this.lv = lv;
- update();
- }
-
- public void update()
- {
- model = lv.getModel();
-
- numPatterns = lv.numPatterns;
- numRates = lv.numRates;
- numStates = lv.numStates;
- frequency = lv.frequency;
- rprob = lv.rprob;
-
- sitePattern = lv.sitePattern;
- }
-
- public void setBranch(Node branch)
- {
- if (branch.isRoot())
- {
- throw new IllegalArgumentException();
- }
- else if (branch.isLeaf())
- {
- Node multNode = lv.getNextBranch(branch, branch.getParent());
- multPartial = lv.getPartial(multNode);
- seq = branch.getSequence();
- }
- else
- {
- Node multNode1 = lv.getNextBranch(branch, branch.getParent());
- multPartial1 = lv.getPartial(multNode1);
-
- Node multNode2 = lv.getNextBranch(branch, branch);
- multPartial2 = lv.getPartial(multNode2);
- }
- this.branch = branch;
- }
-
- public double evaluate(double arc)
- {
- model.setDistance(arc);
-
- lv.logL = 0;
- for (int l = 0; l < numPatterns; l++)
- {
- double rsum = 0.0;
- for (int r = 0; r < numRates; r++)
- {
- double sum = 0;
-
- if (branch.isLeaf())
- {
- double[] mp = multPartial[l][r];
- int sl = seq[l];
-
- if (sl == numStates)
- {
- for (int d = 0; d < numStates; d++)
- {
- sum += frequency[d]*mp[d];
- }
- }
- else
- {
- for (int d = 0; d < numStates; d++)
- {
- sum += frequency[d]*mp[d]*model.transProb(r, d, sl);
- }
- }
- }
- else
- {
- double[] mp1 = multPartial1[l][r];
- double[] mp2 = multPartial2[l][r];
-
- for (int i = 0; i < numStates; i++)
- {
- double sum2 = 0.0;
- for (int j = 0; j < numStates; j++)
- {
- sum2 += mp2[j]*model.transProb(r, i, j);
- }
- sum += frequency[i]*mp1[i]*sum2;
- }
- }
-
-
- sum *= rprob[r];
- rsum += sum;
- }
-
- lv.siteLogL[l] = Math.log(rsum);
- lv.logL += lv.siteLogL[l]*sitePattern.weight[l];
- }
-
- return -lv.logL;
- }
-
- public double getLowerBound()
- {
- return BranchLimits.MINARC;
- }
-
- public double getUpperBound()
- {
- return BranchLimits.MAXARC;
- }
-
- // private
-
- private LikelihoodValue lv;
- private double[][][] multPartial, multPartial1, multPartial2;
- private byte[] seq;
- private int numStates;
- private int numRates;
- private int numPatterns;
- private double[] frequency;
- private double[] rprob;
- private SitePattern sitePattern;
- private SubstitutionModel model;
- private Node branch;
-}
-
-class NodeLikelihood implements UnivariateFunction
-{
- public NodeLikelihood(LikelihoodValue lv)
- {
- this.lv = lv;
- update();
- }
-
- public void update()
- {
- model = lv.getModel();
-
- numPatterns = lv.numPatterns;
- numRates = lv.numRates;
- numStates = lv.numStates;
- frequency = lv.frequency;
- rprob = lv.rprob;
-
- sitePattern = lv.sitePattern;
- }
-
- public void setBranch(Node branch, double min, double max)
- {
- center = branch;
-
- if (center.isLeaf())
- {
- throw new IllegalArgumentException();
- }
- else if (center.isRoot())
- {
- firstBranch = center.getChild(0);
- lastBranch = center.getChild(center.getChildCount()-1);
-
- partial1 = lv.getPartial(firstBranch);
- partial2 = lv.getPartial(lastBranch);
- }
- else
- {
- partial1 = lv.getPartial(center);
- partial2 = lv.getPartial(lv.getNextBranch(center, center.getParent()));
- }
-
- minHeight = min;
- maxHeight = max;
- }
-
- public double evaluate(double h)
- {
- center.setNodeHeight(h);
-
- // branch lengths to child
- for (int i = 0; i < center.getChildCount(); i++)
- {
- Node child = center.getChild(i);
- child.setBranchLength(h-child.getNodeHeight());
- }
-
- // update partials of childs
- for (int i = 0; i < center.getChildCount(); i++)
- {
- Node child = center.getChild(i);
- if (child.isLeaf())
- {
- lv.partialsExternal(child);
- }
- else
- {
- lv.partialsInternal(child, child);
- }
- }
-
- if (center.isRoot())
- {
- lv.productPartials(lastBranch, center);
- }
- else
- {
- // multiply child partials
- lv.productPartials(center, center);
-
- center.setBranchLength(maxHeight-h);
-
- lv.partialsInternal(center, center);
- }
-
- lv.logL = 0;
- for (int l = 0; l < numPatterns; l++)
- {
- double rsum = 0.0;
- for (int r = 0; r < numRates; r++)
- {
- double[] p1 = partial1[l][r];
- double[] p2 = partial2[l][r];
-
- double sum = 0.0;
- for (int d = 0; d < numStates; d++)
- {
- sum += frequency[d]*p1[d]*p2[d];
- }
- sum *= rprob[r];
- rsum += sum;
- }
-
- lv.siteLogL[l] = Math.log(rsum);
- lv.logL += lv.siteLogL[l]*sitePattern.weight[l];
- }
-
- return -lv.logL;
- }
-
- public double getLowerBound()
- {
- return minHeight;
- }
-
- public double getUpperBound()
- {
- return maxHeight;
- }
-
- // private
-
- private LikelihoodValue lv;
- private double[][][] partial1;
- private double[][][] partial2;
- private byte[] seq;
- private int numStates;
- private int numRates;
- private int numPatterns;
- private double[] frequency;
- private double[] rprob;
- private SitePattern sitePattern;
- private SubstitutionModel model;
- private double minHeight, maxHeight;
- private Node center, firstBranch, lastBranch;
-}
-
diff --git a/LibrarySource/pal/eval/ModelParameters.java b/LibrarySource/pal/eval/ModelParameters.java
deleted file mode 100644
index ca13fab..0000000
--- a/LibrarySource/pal/eval/ModelParameters.java
+++ /dev/null
@@ -1,236 +0,0 @@
-// ModelParameters.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.eval;
-
-import pal.alignment.*;
-import pal.substmodel.*;
-import pal.tree.*;
-import pal.distance.*;
-import pal.math.*;
-import pal.misc.*;
-
-import java.io.*;
-
-/**
- * estimates substitution model parameters from the data
- *
- * @version $Id: ModelParameters.java,v 1.7 2001/07/13 14:39:13 korbinian Exp $
- * @author Korbinian Strimmer
- */
-public class ModelParameters implements MultivariateFunction
-{
- //
- // public stuff
- //
-
- /** fractional digits desired for parameters */
- public final static int FRACDIGITS = 3;
-
- /**
- * Constructor
- *
- * @param sp site pattern
- * @param m substitution model
- */
- public ModelParameters(SitePattern sp, SubstitutionModel m)
- {
- sitePattern = sp;
- model = m;
- numParams = model.getNumParameters();
-
- lv = new LikelihoodValue(sitePattern);
- lv.setModel(model);
-
- if (numParams == 1)
- {
- mvm = new OrthogonalSearch();
- }
- else
- {
- mvm = new ConjugateGradientSearch();
- //((ConjugateGradientSearch) mvm).prin = 2;
- }
- }
-
- /**
- * estimate (approximate) values for the model parameters
- * from the data using a neighbor-joining tree
- *
- * @return parameter estimates
- */
- public double[] estimate()
- {
- double[] p = new double[numParams];
- for (int i = 0; i < numParams; i++)
- {
- p[i] = model.getDefaultValue(i);
- }
- double fp;
-
- AlignmentDistanceMatrix distMat = null;
- double tolfp = Math.pow(10, -1-FRACDIGITS);
- double tolp = Math.pow(10, -1-FRACDIGITS);
- boolean first = true;
- do
- {
- if (first)
- {
- distMat = new AlignmentDistanceMatrix(sitePattern, model);;
- }
- else
- {
- distMat.recompute(model);
- }
-
- NeighborJoiningTree t = new NeighborJoiningTree(distMat);
- ParameterizedTree pt = new UnconstrainedTree(t);
-
- //ChiSquareValue cs = new ChiSquareValue(distMat, true);
- //cs.setTree(pt);
- //cs.optimiseParameters();
-
- lv.setTree(pt);
-
- if (first)
- {
- fp = evaluate(p);
- mvm.stopCondition(fp, p, tolfp, tolp, true);
- first = false;
- }
-
- mvm.optimize(this, p, tolfp, tolp);
-
- fp = evaluate(p);
- }
- while (!mvm.stopCondition(fp, p, tolfp, tolp, false));
-
- // trim p
- double m = Math.pow(10, FRACDIGITS);
- for (int i = 0; i < p.length; i++)
- {
- p[i] = Math.round(p[i]*m)/m;
- }
-
- fp = evaluate(p);
-
- // Corresponding SEs
- double[] pSE = new double[numParams];
- pSE = NumericalDerivative.diagonalHessian(this, p);
- for (int i = 0; i < numParams; i++)
- {
- pSE[i] = Math.sqrt(1.0/pSE[i]);
- model.setParameterSE(pSE[i], i);
- }
- return p;
- }
-
- /**
- * estimate (approximate) values for the model parameters
- * from the data using a given (parameterized) tree
- * @return parameter estimates
- */
- public double[] estimateFromTree(ParameterizedTree t)
- {
- // there is a horrible amount of code duplication
- // here - should be cleaned up at some time
-
-
- double[] p = new double[numParams];
- for (int i = 0; i < numParams; i++)
- {
- p[i] = model.getDefaultValue(i);
- }
- double fp;
-
- double tolfp = Math.pow(10, -1-FRACDIGITS);
- double tolp = Math.pow(10, -1-FRACDIGITS);
- boolean first = true;
- do
- {
- lv.setTree(t);
-
- if (first)
- {
- fp = evaluate(p);
- mvm.stopCondition(fp, p, tolfp, tolp, true);
- first = false;
- }
-
- mvm.optimize(this, p, tolfp, tolp);
-
- fp = evaluate(p);
- }
- while (!mvm.stopCondition(fp, p, tolfp, tolp, false));
-
- // trim p
- double m = Math.pow(10, FRACDIGITS);
- for (int i = 0; i < p.length; i++)
- {
- p[i] = Math.round(p[i]*m)/m;
- }
-
- fp = evaluate(p);
-
- // Corresponding SEs
- double[] pSE = new double[numParams];
- pSE = NumericalDerivative.diagonalHessian(this, p);
- for (int i = 0; i < numParams; i++)
- {
- pSE[i] = Math.sqrt(1.0/pSE[i]);
- model.setParameterSE(pSE[i], i);
- }
- return p;
- }
-
-
-
- // interface MultivariateFunction
-
- public double evaluate(double[] params)
- {
- // set model parameters
- for (int i = 0; i < numParams; i++)
- {
- model.setParameter(params[i], i);
- }
-
- double r = -lv.compute();
- //double r = -lv.optimiseParameters();
-
- return r;
- }
-
- public int getNumArguments()
- {
- return numParams;
- }
-
- public double getLowerBound(int n)
- {
- return model.getLowerLimit(n);
- }
-
- public double getUpperBound(int n)
- {
- return model.getUpperLimit(n);
- }
-
-
- //
- // Private stuff
- //
-
- private int numParams;
- private SubstitutionModel model;
- private SitePattern sitePattern;
- private ParameterizedTree tree;
- private LikelihoodValue lv;
- private MultivariateMinimum mvm;
-}
-
diff --git a/LibrarySource/pal/eval/makefile b/LibrarySource/pal/eval/makefile
deleted file mode 100644
index dca8f11..0000000
--- a/LibrarySource/pal/eval/makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-### VARIABLES ###
-
-JIKESOPTS := +P
-GCJOPTS :=
-
-# Always check dependencies
-JIKESOPTS += +M
-
-SRC := $(wildcard *.java)
-CLS := $(patsubst %.java, %.class, $(SRC))
-OBJ := $(patsubst %.class, %.o, $(wildcard *.class))
-
-
-### RULES ###
-
-# Compile Java sources into class files
-%.class: %.java
- jikes $(JIKESOPTS) $<
-
-# Alternative to using jikes: gcj -C
-
-# Compile class files into native code
-%.o: %.class
- gcj -c $(GCJOPTS) $<
-
-
-### TARGETS ###
-
-.PHONY: classes native clean
-
-classes: $(CLS)
-
-ifneq ($(OBJ),)
-native: $(OBJ)
- (ar -rv package.a *.o; ranlib package.a)
-else
-native: $(OBJ)
-endif
-
-clean:
- rm -f *.class *.o *.u *.a *~
-
diff --git a/LibrarySource/pal/eval/package.html b/LibrarySource/pal/eval/package.html
deleted file mode 100644
index cfc3903..0000000
--- a/LibrarySource/pal/eval/package.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<html>
-<body>
-Classes for evaluating evolutionary hypothesis (chi-square and likelihood
-criteria) and estimating model parameters.
-</body>
-</html>
-
diff --git a/LibrarySource/pal/gui/CircularGraphics.java b/LibrarySource/pal/gui/CircularGraphics.java
deleted file mode 100644
index 80a3337..0000000
--- a/LibrarySource/pal/gui/CircularGraphics.java
+++ /dev/null
@@ -1,213 +0,0 @@
-// CircularGraphics.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.gui;
-
-import headless.awt.*;
-
-/**
- @author Matthew Goode
-*/
-
-public class CircularGraphics {
-
- double worldRadius_, worldAngle_;
- public int screenCentreX;
- public int screenCentreY;
- public int screenRadius;
-
- final static double TWO_PI = 2*Math.PI;
-
- Graphics g_;
- FontMetrics fm_;
- Font font_;
- boolean invertY_;
-
- public CircularGraphics(Graphics g, double worldAngle, double worldRadius, int screenX, int screenY, int screenWidth, int screenHeight) {
- this(g,worldAngle,worldRadius,screenX, screenY, screenWidth, screenHeight,false);
- }
- public CircularGraphics(Graphics g, double worldAngle, double worldRadius, int screenX, int screenY, int screenWidth, int screenHeight, boolean invertY) {
- this.g_ = g;
- this.invertY_ = invertY;
- this.worldAngle_ = worldAngle;
- this.worldRadius_ = worldRadius;
- screenRadius = Math.min(screenWidth/2, screenHeight/2);
- screenCentreX = screenX+screenWidth/2;
- screenCentreY = screenY+screenHeight/2;
-
- font_ = g_.getFont();
- if(font_!=null) {
- fm_ = g_.getFontMetrics(font_);
- }
- }
-
- public void setFont(Font newFont) {
- g_.setFont(newFont);
- this.font_ = newFont;
- fm_ = g_.getFontMetrics(font_);
- }
-
- /** For drawing arbitary lines */
- public void drawLine( double angle1, double radius1, double angle2, double radius2) {
- g_.drawLine(getScreenX(angle1,radius1), getScreenY(angle1, radius1), getScreenX(angle2,radius2),getScreenY(angle2,radius2) );
- }
-
- /** For drawing arbitary lines */
- public void drawLine( double angle, double radiusStart, double radiusEnd) {
- g_.drawLine(getScreenX(angle,radiusStart), getScreenY(angle, radiusStart), getScreenX(angle,radiusEnd),getScreenY(angle,radiusEnd) );
- }
-
- /** For drawing arbitary lines */
- public void drawLineDegreeAlign( double angle, double radiusStart, double radiusEnd) {
- angle = ((int)(angle*360/worldAngle_))*worldAngle_/360;
- g_.drawLine(getScreenX(angle,radiusStart), getScreenY(angle, radiusStart), getScreenX(angle,radiusEnd),getScreenY(angle,radiusEnd) );
- }
- private final double convertRadius(double radius) {
- //return radius;
- return worldRadius_ - radius;
- }
-
- /** For drawing arbitary lines */
- public void drawArc( double angleStart, double angleEnd, double radius) {
- int actualRadius = (int)(screenRadius*convertRadius(radius)/worldRadius_);
- if(actualRadius<1) {
- return;
- }
- int startAngle, endAngle;
-// if(invertY_) {
- startAngle = (int)(angleStart*360/worldAngle_);
- endAngle = (int)(angleEnd*360/worldAngle_);
-// } else {
-// startAngle = (int)(angleStart*360/worldAngle_);
-// endAngle = (int)(angleEnd*360/worldAngle_);
-// }
-// if(invertY_) {
-// g_.drawArc(screenCentreX-actualRadius, screenCentreY+actualRadius, actualRadius*2,-actualRadius*2, startAngle, endAngle-startAngle );
-// } else {
- g_.drawArc(screenCentreX-actualRadius, screenCentreY-actualRadius, actualRadius*2,actualRadius*2, startAngle, endAngle-startAngle );
- /*System.out.println(""+(screenCentreX-actualRadius)+ " "+
- ( screenCentreY-actualRadius)+ " " +
- ( actualRadius*2) + " " +
- ( actualRadius*2 ) + " " +
- ( startAngle ) + " " +
- ( endAngle-startAngle ));
- */
-// }
- }
-
- public void setColor(Color c) {
- g_.setColor(c);
- }
-
-
- public void drawString(String s, double angle, double radius) {
- int sX =getScreenX(angle,radius);
- int sY = getScreenY(angle,radius);
- FontMetrics fm = g_.getFontMetrics(g_.getFont());
- int stringWidth = fm.stringWidth(s);
- int stringHeight = fm.getHeight();
-
- g_.drawString(s,sX-stringWidth/2,sY+stringHeight/2);
-
-
- }
- public void drawString(String s, double angle, double radius,int outdent) {
- int sX =getScreenX(angle,radius,outdent);
- int sY = getScreenY(angle,radius,outdent);
- FontMetrics fm = g_.getFontMetrics(g_.getFont());
- int stringWidth = fm.stringWidth(s);
- int stringHeight = fm.getHeight();
-
- g_.drawString(s,sX-stringWidth/2,sY+stringHeight/2);
- }
-
- public void circleString(String s, double angle, double radius,int outdent) {
- int sX =getScreenX(angle,radius,outdent);
- int sY = getScreenY(angle,radius,outdent);
- FontMetrics fm = g_.getFontMetrics(g_.getFont());
- int stringWidth = fm.stringWidth(s);
- int stringHeight = fm.getHeight();
-
- g_.drawString(s,sX-stringWidth/2,sY+stringHeight/2);
- g_.drawOval(sX-stringWidth/2-5,sY-stringHeight/2-2 ,stringWidth+10, stringHeight+10);
- }
- public int getScreenX(double angle, double radius) {
- return screenCentreX + (int)(convertRadius(radius)*screenRadius*Math.cos(angle*TWO_PI/worldAngle_)/worldRadius_);
- }
- public int getScreenX(double angle, double radius, int outdent) {
- double trigBit = Math.cos(angle*TWO_PI/worldAngle_);
- return screenCentreX + (int)(outdent*trigBit + convertRadius(radius)*screenRadius*trigBit/worldRadius_);
- }
-
- public int getScreenDeltaX(double angle, double radius) {
-
- return (int)(convertRadius(radius)*screenRadius*Math.cos(angle*TWO_PI/worldAngle_
- )/worldRadius_ );
-
- }
-
- public int getScreenY(double angle, double radius) {
- int offset = (int)(convertRadius(radius)*screenRadius*Math.sin(angle*TWO_PI/worldAngle_)/worldRadius_);
-
- return (invertY_ ? (screenCentreY + offset) : (screenCentreY - offset));
- }
- public int getScreenY(double angle, double radius, int outdent) {
- double trigBit = Math.sin(angle*TWO_PI/worldAngle_);
- int offset = (int)(outdent*trigBit + convertRadius(radius)*screenRadius*trigBit/worldRadius_);
- return (invertY_ ? (screenCentreY + offset) : (screenCentreY - offset));
- }
-
- public int getScreenDeltaY(double angle, double radius) {
- return (invertY_ ? 1 : -1 )*(int)(convertRadius(radius)*screenRadius*Math.sin(angle*TWO_PI/worldAngle_)/worldRadius_);
- }
- public void fillPoint(double angle, double radius, int size) {
- int x = getScreenX(angle,radius);
- int y = getScreenY(angle,radius);
-
- g_.fillOval(x-size,y-size,2*size,2*size);
- }
-
-
- public void drawPoint(double angle, double radius, int size) {
- int x = getScreenX(angle,radius);
- int y = getScreenY(angle,radius);
-
- g_.drawOval(x-size,y-size,2*size,2*size);
- }
-
- public void drawSymbol(double angle, double radius, int outdent, int width, int symbol) {
-
- int halfWidth = width / 2;
- int x = getScreenX(angle,radius,outdent);
- int y = getScreenY(angle,radius,outdent);
-
- switch (symbol% 6) {
- case 0: g_.fillRect(x, y, width, width); break;
- case 1: g_.drawRect(x, y, width, width); break;
- case 2: g_.fillOval(x, y, width, width); break;
- case 3: g_.drawOval(x, y, width, width); break;
- case 4: // draw triangle
- g_.drawLine(x, y + width, x + halfWidth, y);
- g_.drawLine(x + halfWidth, y, x + width, y + width);
- g_.drawLine(x, y + width, x + width, y + width);
- break;
- case 5: // draw X
- g_.drawLine(x, y, x + width, y + width);
- g_.drawLine(x, y + width, x + width, y);
- break;
- }
- }
-
-
-
-
-
-
-
-
-}
-
diff --git a/LibrarySource/pal/gui/Painter.java b/LibrarySource/pal/gui/Painter.java
deleted file mode 100644
index 2db4d00..0000000
--- a/LibrarySource/pal/gui/Painter.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// Painter.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.gui;
-
-import headless.awt.Graphics;
-import headless.awt.Dimension;
-
-
-/**
- * An interface for objects which are used for painting themselves in a
- * general Graphics object
- *
- * @author Matthew Goode
- */
-
-public interface Painter {
- void paint(Graphics g, int displayWidth, int displayHeight);
- Dimension getPreferredSize();
-
-}
-
diff --git a/LibrarySource/pal/gui/PositionedNode.java b/LibrarySource/pal/gui/PositionedNode.java
deleted file mode 100644
index 38e3b32..0000000
--- a/LibrarySource/pal/gui/PositionedNode.java
+++ /dev/null
@@ -1,80 +0,0 @@
-// PositionedNode.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.gui;
-
-import pal.tree.*;
-
-
-/**
- * A tree node that has a scalar position for the purposes of drawing the tree.
- *
- * @author Alexei Drummond
- * @version $Id: PositionedNode.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- */
-public class PositionedNode extends SimpleNode {
-
- protected double x; //Please excuse this - it will be returned to its non public state eventually - MG
-
- boolean highlight_;
-
-
- /** Builds a tree based on node, but highlights highlightNode */
- public PositionedNode(Node node, Node highlightNode) {
-
- init(node);
- if (!node.isLeaf()) {
- for (int i = 0; i < node.getChildCount(); i++) {
- addChild(new PositionedNode(node.getChild(i),highlightNode));
- }
- }
-
- highlight_ = (node==highlightNode);
- }
-
- public PositionedNode(Node node) {
-
- init(node);
- if (!node.isLeaf()) {
- for (int i = 0; i < node.getChildCount(); i++) {
- addChild(new PositionedNode(node.getChild(i)));
- }
- }
- }
-
- public void calculatePositions() {
-
- double[] currentXPos = {0.0};
- calculateXPositions(currentXPos);
- }
-
- private double calculateXPositions(double[] currentXPos) {
-
- if (!isLeaf()) {
- // find average x position
- x = ((PositionedNode)getChild(0)).calculateXPositions(currentXPos);
- for (int i = 1; i < getChildCount(); i++) {
- x += ((PositionedNode)getChild(i)).calculateXPositions(currentXPos);
- }
- x /= getChildCount();
- } else {
- x = currentXPos[0];
- currentXPos[0] += 1.0;
- }
-
- return x;
- }
-
- public boolean isHighlighted() {
- return highlight_;
- }
-
- public double getX() {
- return x;
- }
-}
-
diff --git a/LibrarySource/pal/gui/TreeComponent.java b/LibrarySource/pal/gui/TreeComponent.java
deleted file mode 100644
index 2212ff3..0000000
--- a/LibrarySource/pal/gui/TreeComponent.java
+++ /dev/null
@@ -1,152 +0,0 @@
-// TreeComponent.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.gui;
-
-import pal.tree.*;
-import pal.misc.*;
-
-import headless.awt.*;
-
-
-/**
- * An AWT Component for displaying a tree.
- *
- * @author Alexei Drummond
- * @version $Id: TreeComponent.java,v 1.12 2001/07/13 14:39:13 korbinian Exp $
- */
-public class TreeComponent extends Component {
-
- boolean circular_ = false;
-
- public final static int NORMAL_BW = 0;
- public final static int CIRCULAR_BW = 1;
- public final static int NORMAL_COLOR = 2;
- public final static int CIRCULAR_COLOR = 3;
-
- int mode_;
-
- public final static String[] MODE_NAMES = new String[4];
-
- // unfortunate but necessary to avoid Java 1.1 language features
- static {
- MODE_NAMES[NORMAL_BW] = "Normal (bw)";
- MODE_NAMES[CIRCULAR_BW] = "Circular (bw)";
- MODE_NAMES[NORMAL_COLOR] = "Normal (color)";
- MODE_NAMES[CIRCULAR_COLOR] = "Circular (color)";
-
- }
-
- TreePainterCircular circlePainter_;
- TreePainter painter_;
-
- boolean invertCiruclar_;
-
- // constructors
-
- public TreeComponent(Tree tree, boolean usingSymbols) {
- this(tree, (TimeOrderCharacterData)null, usingSymbols);
- }
- public TreeComponent(Tree tree, boolean usingSymbols, Node highlighNode) {
- this(tree, (TimeOrderCharacterData)null, usingSymbols, highlighNode);
- }
- public TreeComponent(Tree tree, TimeOrderCharacterData tocd, boolean usingSymbols) {
- this(tree,tocd, usingSymbols,null);
-
- }
- public TreeComponent(Tree tree, TimeOrderCharacterData tocd, boolean usingSymbols, Node highlightNode) {
- this(tree,highlightNode);
-
- if (tocd != null) {
- painter_.setTimeOrderCharacterData(tocd);
- }
- painter_.setUsingSymbols(usingSymbols);
- }
- public TreeComponent(Tree tree, Node highlightNode) {
- this(tree, "", false, highlightNode);
- }
-
- public TreeComponent(Tree tree) {
- this(tree, "", false,null);
- }
-
- public TreeComponent(Tree tree, String title) {
- this(tree, title, true,null);
- }
- public TreeComponent(Tree tree, String title, Node highlightNode) {
- this(tree, title, true,highlightNode);
- }
- private TreeComponent(Tree tree, String title, boolean showTitle, Node highlightNode) {
- painter_ = new TreePainterNormal(tree,title,showTitle,highlightNode);
- circlePainter_ = new TreePainterCircular(tree,title,showTitle, highlightNode);
- setMode(NORMAL_COLOR);
- setSize(getPreferredSize());
- }
-
- public void setTree(Tree tree) {
- painter_.setTree(tree);
- circlePainter_.setTree(tree);
- }
-
- public void setTitle(String title) {
- painter_.setTitle(title);
- circlePainter_.setTitle(title);
- }
-
- public Dimension getPreferredSize() {
- return painter_.getPreferredSize();
- }
- public void setInvertCircular(boolean invert) {
- this.invertCiruclar_ = invert;
- }
-
-
- public Dimension getMinimumSize() {
- return getPreferredSize();
- }
-
- public String getTitle() {
- return painter_.getTitle();
- }
-
- /**
- * Sets the mode of display for this component.
- * @param the mode to switch to. Valid arguments are NORMAL (for normal tree
- * display), and CIRCULAR (for a circular view of the trees)
- */
- public void setMode(int mode) {
- this.mode_= mode;
- switch(mode) {
- case NORMAL_BW : {
- circular_ = false; painter_.setUsingColor(false);
- break;
- }
- case NORMAL_COLOR : {
- circular_ = false; painter_.setUsingColor(true);
- break;
- }
- case CIRCULAR_BW : {
- circular_ = true; circlePainter_.setUsingColor(false);
- break;
- }
- case CIRCULAR_COLOR : {
- circular_ = true; circlePainter_.setUsingColor(true);
- break;
- }
- }
- }
-
- public void paint(Graphics g) {
- if(!circular_) {
- painter_.paint(g,getSize().width,getSize().height);
- } else {
- circlePainter_.paint(g,getSize().width,getSize().height,invertCiruclar_);
- }
-
- }
-}
-
diff --git a/LibrarySource/pal/gui/TreePainter.java b/LibrarySource/pal/gui/TreePainter.java
deleted file mode 100644
index 97c34e3..0000000
--- a/LibrarySource/pal/gui/TreePainter.java
+++ /dev/null
@@ -1,247 +0,0 @@
-// TreePainter.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.gui;
-
-import pal.tree.*;
-import pal.io.*;
-import pal.misc.*;
-
-import headless.awt.*;
-
-/**
- * A class that can paint a tree into a Graphics object.
- *
- * @version $Id: TreePainter.java,v 1.10 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-abstract public class TreePainter implements Painter {
-
- public static final Color BACKGROUND = Color.white;
- public static final Color FOREGROUND = Color.black;
- public static final Color NORMAL_LABEL_COLOR = Color.green.darker();
-
- public PositionedNode treeNode;
-
- public String title_;
-
- boolean showTitle_;
-
- /** The tree being painted */
- private Tree tree;
-
- /** The time order character data used for determining symbols. */
- private TimeOrderCharacterData tocd = null;
-
- double width, height;
-
- double maxLeafTime = 0.0;
- double sizeOfScale = 0.0;
-
- /** Width of pen used to paint lines */
- private int penWidth = 2;
-
- /** determines whether colors are used to distinguish branch depth */
- private boolean usingColor = true;
-
- /** determines whether node heights are displayed on the tree */
- private boolean showingNodeHeights = false;
-
- /** determines whether internal nodes are labelled */
- protected boolean showingInternalLabels = true;
-
- /** determines whether symbols are used instead of names */
- private boolean usingSymbols = false;
-
- public TreePainter(Tree toDisplay, String title, boolean showTitle) {
-
- this.title_ = title;
- this.showTitle_ = showTitle;
- this.tree = toDisplay;
-
- if (toDisplay instanceof DatedTipsClockTree) {
- tocd = ((DatedTipsClockTree)toDisplay).getTimeOrderCharacterData();
- }
- }
-
- /** Rotates the tree by leaf count, creates a positioned node version of the
- trees root and calculates postions and width and height information.
- @param highlightNode
- */
- protected void standardTreePrep(Node highlightNode) {
- TreeUtils.rotateByLeafCount(tree);
-
- if(highlightNode!=null) {
- treeNode = new PositionedNode(tree.getRoot(),highlightNode);
- } else {
- treeNode = new PositionedNode(tree.getRoot());
- }
- treeNode.calculatePositions();
-
- width = NodeUtils.getLeafCount(treeNode);
- height = treeNode.getNodeHeight();
-
- maxLeafTime = 0.0;
- maxLeafTime = getMaxLeafTime(treeNode);
- maxLeafTime *= 1.5;
-
- sizeOfScale = getSizeOfScale( height / 5.0);
- }
-
- public final void setPenWidth(int p) {
- penWidth = p;
- }
-
- public final int getPenWidth() {
- return penWidth;
- }
-
- public final void setTree(Tree tree) {
- this.tree = tree;
- standardTreePrep(null);
- }
-
-
- public final void setTree(Tree tree, Node highlightNode) {
- this.tree = tree;
- standardTreePrep(highlightNode);
- }
-
- public final void setUsingColor(boolean use) {
- usingColor = use;
- }
-
- public final boolean isUsingColor() {
- return usingColor;
- }
-
- public final void setShowingNodeHeights(boolean s) {
- showingNodeHeights = s;
- }
-
- public final boolean isShowingNodeHeights() {
- return showingNodeHeights;
- }
-
- public final boolean isShowingInternalLabels() {
- return showingInternalLabels;
- }
-
- public final TimeOrderCharacterData getTimeOrderCharacterData() {
- return this.tocd;
- }
-
- public final void setTimeOrderCharacterData(TimeOrderCharacterData tocd) {
- this.tocd = tocd;
- usingSymbols = true;
- }
-
- public final boolean isUsingSymbols() {
- return usingSymbols;
- }
-
- /**
- * Sets whether the tree is painted with symbols. This can
- * only be set to true of a TimeOrderCharacterData has been set.
- */
- public final void setUsingSymbols(boolean use) {
- usingSymbols = use;
- if (tocd == null) usingSymbols = false;
- }
-
-
-
- protected final double getSizeOfScale(double target) {
-
- double sos = 0.1;
- boolean accept = false;
- boolean divideByTwo = true;
-
- while (!accept) {
- if ((sos / target) >= 5.0) {
- sos /= (divideByTwo ? 2.0 : 5.0);
- divideByTwo = !divideByTwo;
- } else if ((sos / target) < 0.2) {
- sos *= (divideByTwo ? 5.0 : 2.0);
- divideByTwo = !divideByTwo;
- } else accept = true;
- }
-
- return sos;
- }
-
-
- protected static final double getMaxLeafTime(Node node) {
-
- if (!node.isLeaf()) {
- double max = getMaxLeafTime(node.getChild(0));
- double posmax = 0.0;
- for (int i = 1; i < node.getChildCount(); i++) {
- posmax = getMaxLeafTime(node.getChild(i));
- if (posmax > max) max = posmax;
- }
- return max;
- } else {
- return node.getNodeHeight();
- }
- }
-
- public final static void drawSymbol(Graphics g, int x, int y, int width, int index) {
-
- int halfWidth = width / 2;
-
- switch (index % 6) {
- case 0: g.fillRect(x, y, width, width); break;
- case 1: g.drawRect(x, y, width, width); break;
- case 2: g.fillOval(x, y, width, width); break;
- case 3: g.drawOval(x, y, width, width); break;
- case 4: // draw triangle
- g.drawLine(x, y + width, x + halfWidth, y);
- g.drawLine(x + halfWidth, y, x + width, y + width);
- g.drawLine(x, y + width, x + width, y + width);
- break;
- case 5: // draw X
- g.drawLine(x, y, x + width, y + width);
- g.drawLine(x, y + width, x + width, y);
- break;
- }
- }
-
- public final boolean isShowTitle() {
- return showTitle_;
- }
-
- public final void setTitle(String title) {
- this.title_ = title;
- showTitle_ = true;
- }
-
- public final String getTitle() {
- return title_;
- }
-
- public final void doTitle(Graphics g, int x, int y) {
- if(showTitle_) {
- g.drawString(title_, x,y);
- }
- }
-
- protected final void doScale(Graphics g, double xScale, int x, int y) {
- g.setColor(FOREGROUND);
- g.drawLine(x,
- y,
- x+ (int)Math.round(sizeOfScale * xScale),
- y);
-
- g.drawString(sizeOfScale + ((tree.getUnits() == Tree.GENERATIONS) ?
- " generations" : " substitutions"),
- x,y-12);
- }
-
-}
-
diff --git a/LibrarySource/pal/gui/TreePainterCircular.java b/LibrarySource/pal/gui/TreePainterCircular.java
deleted file mode 100644
index 2424b7f..0000000
--- a/LibrarySource/pal/gui/TreePainterCircular.java
+++ /dev/null
@@ -1,142 +0,0 @@
-// TreePainter.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.gui;
-
-import pal.tree.*;
-import pal.io.*;
-import pal.misc.*;
-
-import headless.awt.*;
-
-/**
- * A class that can paint a tree (in a circular fashion) into a Graphics object .
- *
- * @version $Id: TreePainterCircular.java,v 1.8 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond, Matthew Goode
- */
-public class TreePainterCircular extends TreePainter {
-
- public static final int RIGHTBORDER = 75;
- public static final int LEFTBORDER = 10;
- public static final int TOPBORDER = 20;
- public static final int BOTTOMBORDER = 30;
- static final int SYMBOL_SIZE = 8;
- public static final int FONT_SIZE = 9;
- public static final int YSPACER = 20;
- public static final int XSPACER = 10;
-
- double maxAngle_, maxRadius_;
- public TreePainterCircular(Tree toDisplay, String title, boolean showTitle) {
- this(toDisplay, title, showTitle,null);
- }
- public TreePainterCircular(Tree toDisplay, String title, boolean showTitle, Node highlightNode) {
- super(toDisplay, title, showTitle);
- standardTreePrep(highlightNode);
- maxRadius_ = treeNode.getNodeHeight();
- maxAngle_ = NodeUtils.getLeafCount(treeNode);
- }
-
- /**
- * Returns the preferred size for drawing
- * (that is the size that will show everything nicely)
- */
- public Dimension getPreferredSize() {
- return new Dimension(100 + LEFTBORDER + RIGHTBORDER,
- 100+TOPBORDER+ BOTTOMBORDER);
- }
-
- protected void paint(PositionedNode node, CircularGraphics cg) {
- cg.setColor(FOREGROUND);
- double angle = node.x;
- double radius = node.getNodeHeight();
-
- if (node.hasChildren()) {
- for (int i = 0; i < node.getChildCount(); i++) {
- paintLeafBranch(node, (PositionedNode)node.getChild(i), cg);
- }
-
- for (int i = 0; i < node.getChildCount(); i++) {
- paint((PositionedNode)node.getChild(i), cg);
- }
- } else {
-
- if ((maxLeafTime > 0.0) && isUsingColor()) {
- cg.setColor(Color.getHSBColor((float)(maxLeafTime - radius)/(float)maxLeafTime, 1.0f, 1.0f));
- } else {
- cg.setColor(NORMAL_LABEL_COLOR);
- }
-
-
- if (isUsingColor()) {
- cg.fillPoint(angle,radius,2);
- }
- if (isUsingSymbols() && (getTimeOrderCharacterData() != null)) {
- cg.drawSymbol(angle,radius, XSPACER, SYMBOL_SIZE, getTimeOrderCharacterData().getTimeOrdinal(getTimeOrderCharacterData().whichIdNumber(node.getIdentifier().getName())));
- } else {
- if(isUsingColor()) {
- cg.drawString( node.getIdentifier().getName(), angle,radius, XSPACER);
- if(node.isHighlighted()) {
- cg.setColor(Color.red);
- cg.circleString(node.getIdentifier().getName(), angle,radius, XSPACER);
- }
- } else {
- if(node.isHighlighted()) {
- cg.setColor(Color.red);
- }
- cg.drawString( node.getIdentifier().getName(), angle,radius, XSPACER);
- }
-
- }
- }
-
- }
-
-
- private void paintLeafBranch(PositionedNode parentNode, PositionedNode childNode, CircularGraphics g) {
-
- // paint join to parent
- g.drawArc(parentNode.x,childNode.x, parentNode.getNodeHeight() );
- // paint branch
- g.drawLineDegreeAlign(childNode.x, childNode.getNodeHeight(), parentNode.getNodeHeight()
- );
-
- if (isShowingNodeHeights()) {
-
- String label = FormattedOutput.getInstance().getDecimalString(childNode.getNodeHeight(), 4);
- g.drawString(label, childNode.x, childNode.getNodeHeight(), XSPACER);
- }
- }
-
- public void paint(Graphics g, int displayWidth, int displayHeight) {
- paint(g,displayWidth,displayHeight,false);
- }
- public void paint(Graphics g, int displayWidth, int displayHeight,boolean invert) {
-
- CircularGraphics cg =
- new CircularGraphics(g,maxAngle_,maxRadius_,
- LEFTBORDER,TOPBORDER,
- (displayWidth - LEFTBORDER - RIGHTBORDER),
- (displayHeight - TOPBORDER - BOTTOMBORDER),
- invert
- );
-
- cg.setFont(new Font("Times", Font.PLAIN, FONT_SIZE));
-
- g.setColor(BACKGROUND);
- g.fillRect(0, 0, displayWidth, displayHeight);
- paint(treeNode, cg);
-
- doTitle(g,LEFTBORDER, TOPBORDER - 8);
- //doScale(g,1,LEFTBORDER,displayHeight - BOTTOMBORDER + 12);
-
- }
-}
-
-
-
diff --git a/LibrarySource/pal/gui/TreePainterNormal.java b/LibrarySource/pal/gui/TreePainterNormal.java
deleted file mode 100644
index 54a5156..0000000
--- a/LibrarySource/pal/gui/TreePainterNormal.java
+++ /dev/null
@@ -1,168 +0,0 @@
-// TreePainterNormal.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.gui;
-
-import pal.tree.*;
-import pal.io.*;
-import pal.misc.*;
-
-import headless.awt.*;
-
-/**
- * A class that can paint a tree into a Graphics object.
- *
- * @version $Id: TreePainterNormal.java,v 1.6 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class TreePainterNormal extends TreePainter {
-
- public static final int RIGHTBORDER = 75;
- public static final int LEFTBORDER = 10;
- public static final int TOPBORDER = 20;
- public static final int BOTTOMBORDER = 30;
-
- public static final int FONT_SIZE = 9;
- public static final int YSPACER = 20;
- public static final int XSPACER = 4;
-
- private double xScale = 1.0;
- private double yScale = 1.0;
-
-
- public TreePainterNormal(Tree toDisplay, String title, boolean showTitle) {
- this(toDisplay,title,showTitle,null);
- }
- public TreePainterNormal(Tree toDisplay, String title, boolean showTitle, Node highlightNode) {
- super(toDisplay,title,showTitle);
- standardTreePrep(highlightNode);
- System.out.println("HLNODE:"+highlightNode);
- }
-
-
- /**
- * Returns the preferred size for drawing
- * (that is the size that will show everything nicely)
- */
- public Dimension getPreferredSize() {
- return new Dimension(100 + LEFTBORDER + RIGHTBORDER,
- (int)Math.round(width * FONT_SIZE) + TOPBORDER + BOTTOMBORDER);
- }
-
- protected void paint(PositionedNode node, Graphics g,
- int displayWidth, int displayHeight) {
-
- Point p = getPoint(node,displayWidth, displayHeight);
- g.setColor(FOREGROUND);
-
- if (node.hasChildren()) {
- for (int i = 0; i < node.getChildCount(); i++) {
- paintLeafBranch(p, getPoint((PositionedNode)node.getChild(i),
- displayWidth,displayHeight), node, g);
- }
-
- for (int i = 0; i < node.getChildCount(); i++) {
- paint((PositionedNode)node.getChild(i), g,displayWidth, displayHeight);
- }
- } else {
-
- if ((maxLeafTime > 0.0) && isUsingColor()) {
- g.setColor(Color.getHSBColor((float)(maxLeafTime - node.getNodeHeight())/(float)maxLeafTime, 1.0f, 1.0f));
- } else {
- g.setColor(NORMAL_LABEL_COLOR);
- }
-
- if (isUsingColor()) {
- int halfWidth = getPenWidth() / 2;
- g.fillRect(p.x - halfWidth, p.y - halfWidth, getPenWidth(), getPenWidth());
- }
- if (isUsingSymbols()&&getTimeOrderCharacterData()!=null) {
-
- drawSymbol(g, p.x + XSPACER, p.y - (FONT_SIZE / 2), FONT_SIZE,
- getTimeOrderCharacterData().getTimeOrdinal(getTimeOrderCharacterData().whichIdNumber(node.getIdentifier().getName())));
- } else {
- String name = node.getIdentifier().getName();
- int width = g.getFontMetrics().stringWidth(name);
- if(isUsingColor()) {
- g.drawString(name, p.x + XSPACER,
- p.y + (FONT_SIZE / 2));
- if(node.isHighlighted()) {
- g.setColor(Color.red);
- g.drawOval(p.x - 4+XSPACER, p.y-FONT_SIZE/2-5, width +10, FONT_SIZE+8 );
- }
- } else {
- if(node.isHighlighted()) {
- g.setColor(Color.red);
- }
- g.drawString(name, p.x + XSPACER,
- p.y + (FONT_SIZE / 2));
- }
- }
- }
-
- }
-
- public Point getPoint(PositionedNode node, int displayWidth, int displayHeight) {
-
- return new Point(displayWidth -
- (int)Math.round(node.getNodeHeight() * xScale) - RIGHTBORDER,
- (int)Math.round(node.x * yScale) + TOPBORDER);
- }
-
- private void paintLeafBranch(Point p, Point lp, PositionedNode node, Graphics g) {
-
- int halfWidth = getPenWidth() / 2;
-
- // paint join to parent
- g.fillRect(p.x - halfWidth, Math.min(p.y, lp.y) - halfWidth,
- getPenWidth(), Math.abs(lp.y - p.y) + getPenWidth());
-
- // paint branch
- g.fillRect(Math.min(p.x, lp.x) - halfWidth, lp.y - halfWidth,
- Math.abs(lp.x - p.x) + getPenWidth(), getPenWidth());
-
- if (isShowingNodeHeights()) {
-
- String label = FormattedOutput.getInstance().getDecimalString(node.getNodeHeight(), 4);
- int width = g.getFontMetrics().stringWidth(label);
-
- int x = Math.min(p.x, lp.x) - (width / 2);
-
- g.drawString(label, x, p.y - halfWidth - 1);
-
- }
-
- if (isShowingInternalLabels()) {
- String label = node.getIdentifier().getName();
- int width = g.getFontMetrics().stringWidth(label);
-
- int x = Math.min(p.x, lp.x) - (width / 2);
-
- g.drawString(label, x, p.y - halfWidth - 1);
- }
- }
-
-
- public void paint(Graphics g, int displayWidth, int displayHeight) {
-
- g.setFont(new Font("Times", Font.PLAIN, FONT_SIZE));
-
- xScale = (double)(displayWidth - LEFTBORDER - RIGHTBORDER) / height;
- yScale = (double)(displayHeight - TOPBORDER - BOTTOMBORDER) / width;
-
- g.setColor(BACKGROUND);
- g.fillRect(0, 0, displayWidth, displayHeight);
- paint(treeNode, g, displayWidth, displayHeight);
-
- doTitle(g,LEFTBORDER, TOPBORDER - 8);
- doScale(g,xScale,LEFTBORDER,displayHeight - BOTTOMBORDER + 12);
- }
-
-}
-
diff --git a/LibrarySource/pal/gui/makefile b/LibrarySource/pal/gui/makefile
deleted file mode 100644
index dca8f11..0000000
--- a/LibrarySource/pal/gui/makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-### VARIABLES ###
-
-JIKESOPTS := +P
-GCJOPTS :=
-
-# Always check dependencies
-JIKESOPTS += +M
-
-SRC := $(wildcard *.java)
-CLS := $(patsubst %.java, %.class, $(SRC))
-OBJ := $(patsubst %.class, %.o, $(wildcard *.class))
-
-
-### RULES ###
-
-# Compile Java sources into class files
-%.class: %.java
- jikes $(JIKESOPTS) $<
-
-# Alternative to using jikes: gcj -C
-
-# Compile class files into native code
-%.o: %.class
- gcj -c $(GCJOPTS) $<
-
-
-### TARGETS ###
-
-.PHONY: classes native clean
-
-classes: $(CLS)
-
-ifneq ($(OBJ),)
-native: $(OBJ)
- (ar -rv package.a *.o; ranlib package.a)
-else
-native: $(OBJ)
-endif
-
-clean:
- rm -f *.class *.o *.u *.a *~
-
diff --git a/LibrarySource/pal/gui/package.html b/LibrarySource/pal/gui/package.html
deleted file mode 100644
index 3ec991c..0000000
--- a/LibrarySource/pal/gui/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body>
-GUI components for some special objects (e.g., trees).
-</body>
-</html>
diff --git a/LibrarySource/pal/io/FormattedInput.java b/LibrarySource/pal/io/FormattedInput.java
deleted file mode 100644
index b7b2256..0000000
--- a/LibrarySource/pal/io/FormattedInput.java
+++ /dev/null
@@ -1,362 +0,0 @@
-// FormattedInput.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.io;
-
-import java.io.*;
-import java.text.*;
-import java.util.*;
-
-
-/**
- * tools to simplify formatted input from an input stream
- *
- * @version $Id: FormattedInput.java,v 1.6 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class FormattedInput implements Serializable
-{
- //
- // Public stuff
- //
-
- /**
- * create new instance of this object
- * (note that there is no public constructor
- * because this class is a singleton!)
- */
- public static FormattedInput getInstance()
- {
- if (singleton == null)
- {
- singleton = new FormattedInput();
- }
-
- return singleton;
- }
-
- /**
- * go to the beginning of the next line.
- * Recognized line terminators:
- * Unix: \n, DOS: \r\n, Macintosh: \r
- *
- * @param in input stream
- */
- public void nextLine(PushbackReader in)
- throws IOException
- {
- readLine(in, false);
- }
-
- /**
- * read a whole line
- *
- * @param in input stream
- * @param keepWhiteSpace keep or drop white space
- *
- * @return string with content of line
- */
- public String readLine(PushbackReader in, boolean keepWhiteSpace)
- throws IOException
- {
- StringBuffer buffer = new StringBuffer();
-
- int EOF = -1;
- int c;
-
- c = in.read();
- while (c != EOF && c != '\n' && c != '\r')
- {
- if (!isWhite(c) || keepWhiteSpace)
- {
- buffer.append((char) c);
- }
- c = in.read();
- }
-
- if (c == '\r')
- {
- c = in.read();
- if (c != '\n')
- {
- in.unread(c);
- }
- }
-
- return buffer.toString();
- }
-
- /**
- * go to first non-whitespace character
- *
- * @param in input stream
- *
- * @return character or EOF
- */
- public int skipWhiteSpace(PushbackReader in)
- throws IOException
- {
- int EOF = -1;
- int c;
-
- // search for first non-whitespace character
- do
- {
- c = in.read();
- }
- while (c != EOF && isWhite(c));
-
- return c;
- }
-
- /**
- * read next character from stream
- * (EOF does not count as character but will throw exception)
- *
- * @param input input stream
- *
- * @return character
- */
- public int readNextChar(PushbackReader input)
- throws IOException
- {
- int EOF = -1;
-
- int c = skipWhiteSpace(input);
-
- if (c == EOF)
- {
- new IOException("End of file/stream");
- }
-
- return c;
- }
-
- /**
- * read word from stream
- *
- * @param input stream
- *
- * @return word read from stream
- */
- public String readWord(PushbackReader in)
- throws IOException
- {
- StringBuffer buffer = new StringBuffer();
-
- int EOF = -1;
- int c;
-
- c = skipWhiteSpace(in);
-
- // search for last non-whitespace character
- while (c != EOF && !isWhite(c))
- {
- buffer.append((char) c);
- c = in.read();
- }
-
- if (c != EOF)
- {
- in.unread(c);
- }
-
- return buffer.toString();
- }
-
- /**
- * read sequence label from stream
- *
- * A sequence label is not allowed to contain
- * whitespace and either of :,;()[]{}. Note
- * that newline/cr is NOT counted as white space!!
- *
- * @param in input stream
- * @param maxLength maximum allowed length of label
- * (if negative any length is permitted)
- *
- * @return label
- */
- public String readLabel(PushbackReader in, int maxLength)
- throws IOException
- {
- StringBuffer buffer = new StringBuffer();
-
- int EOF = -1;
- int c;
- int len = 0;
-
-
- c = skipWhiteSpace(in);
-
- // search for last label character
- while (c != EOF && buffer.length() != maxLength &&
- !(
- (isWhite(c) && c != '\n' && c != '\r') ||
- c == ':' || c == ',' || c == ';' ||
- c == '(' || c == ')' ||
- c == '[' || c == ']' ||
- c == '{' || c == '}'))
- {
- // read over newline/cr
- if (c != '\n' && c != '\r') buffer.append((char) c);
- c = in.read();
- }
-
- if (c != EOF)
- {
- in.unread(c);
- }
-
- return buffer.toString();
- }
-
- /*
- * read next number from stream
- *
- * @param in input stream
- * @param ignoreNewlineCR ignore newline/cr as separator
- *
- * @return number (as string)
- */
- public String readNumber(PushbackReader in, boolean ignoreNewlineCR)
- throws IOException
- {
- StringBuffer buffer = new StringBuffer();
-
- int EOF = -1;
- int c;
-
- // search for first number character
- do
- {
- c = in.read();
- }
- while (c != EOF &&
- !(c == '-' || c == '.' || Character.isDigit((char) c)));
-
- // search for last number character
- while (c != EOF &&
- (c == '-' || c == '.' || c == 'e'
- || c == 'E' || Character.isDigit((char) c))
- || (isNewlineCR(c) && ignoreNewlineCR) )
- {
- if (!(isNewlineCR(c) && ignoreNewlineCR))
- buffer.append((char) c);
- c = in.read();
- }
-
- if (c != EOF)
- {
- in.unread(c);
- }
-
- return buffer.toString();
- }
-
- /**
- * read next number from stream and convert it to a double
- * (newline/cr are treated as separators)
- *
- * @param in input stream
- *
- * @return double
- */
- public double readDouble(PushbackReader in)
- throws IOException, NumberFormatException
- {
- return readDouble(in, false);
- }
-
- /**
- * read next number from stream and convert it to a double
- *
- * @param in input stream
- * @param ignoreNewlineCR ignore newline/cr as separator
- *
- * @return double
- */
- public double readDouble(PushbackReader in, boolean ignoreNewlineCR)
- throws IOException, NumberFormatException
- {
- String w = readNumber(in, ignoreNewlineCR);
- if (w.length() == 0)
- {
- throw new IOException("End of file/stream");
- }
-
- return Double.valueOf(w).doubleValue();
- }
-
-
- /**
- * read next number from stream and convert it to a int
- * (newline/cr are treated as separators)
- *
- * @param in input stream
- *
- * @return integer
- */
- public int readInt(PushbackReader in)
- throws IOException, NumberFormatException
- {
- return readInt(in, false);
- }
-
- /**
- * read next number from stream and convert it to a int
- *
- * @param in input stream
- * @param ignoreNewlineCR ignore newline/cr as separator
- *
- * @return integer
- */
- public int readInt(PushbackReader in, boolean ignoreNewlineCR)
- throws IOException, NumberFormatException
- {
- String w = readNumber(in, ignoreNewlineCR);
- if (w.length() == 0)
- {
- throw new IOException("End of file/stream");
- }
-
- return Integer.valueOf(w).intValue();
- }
-
-
- //
- // Private stuff
- //
-
- // private constructor
- private FormattedInput()
- {
- // Just to prevent a public constructor
- }
-
- private static FormattedInput singleton;
-
- private static boolean isWhite(int c)
- {
- return Character.isWhitespace((char) c);
- }
-
- private static boolean isNewlineCR(int c)
- {
- if (c == '\n' || c == 'r')
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-}
-
diff --git a/LibrarySource/pal/io/FormattedOutput.java b/LibrarySource/pal/io/FormattedOutput.java
deleted file mode 100644
index bdb79ad..0000000
--- a/LibrarySource/pal/io/FormattedOutput.java
+++ /dev/null
@@ -1,312 +0,0 @@
-// FormattedOutput.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.io;
-
-import java.io.*;
-import java.text.*;
-import java.util.*;
-import java.math.*;
-
-/**
- * tools to simplify formatted output to a stream
- *
- * @version $Id: FormattedOutput.java,v 1.14 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class FormattedOutput implements Serializable
-{
- //
- // Public stuff
- //
-
- /**
- * create instance of this class
- * (note that there is no public constructor
- * as this class is a singleton)
- */
- public synchronized static FormattedOutput getInstance()
- {
- if (singleton == null)
- {
- singleton = new FormattedOutput();
- }
-
- return singleton;
- }
-
- /**
- * print decimal number with a prespecified number
- * of digits after the point
- *
- * @param out output stream
- * @param number to be printed
- * @param width number of fraction digits
- *
- * @return length of the string printed
- */
- public int displayDecimal(PrintWriter out, double number, int width)
- {
- String s = getDecimalString(number, width);
-
- out.print(s);
-
- return s.length();
- }
-
- /**
- * Returns a decimal string representation of a number with
- * constrained width.
- */
- public synchronized String getDecimalString(double number, int width) {
- nf.setMinimumFractionDigits(width);
- nf.setMaximumFractionDigits(width);
-
- return nf.format(number);
- }
-
- private static final double round(double number, int sf) {
- double decimals = Math.floor(Math.log(number) / Math.log(10.0));
- double power = Math.pow(10, decimals - sf+1);
- number /= power;
- number = Math.round(number);
- number *= power;
- return number;
- }
-
- //public String getSFString(double number, int sf) {
- // double decimals = Math.floor(Math.log(number) / Math.log(10.0));
- // double power = Math.pow(10, decimals - sf);
- // number /= power;
- // number = Math.round(number);
- // number *= power;
- //
- // return "" + number;
- //}
-
- /** Used by getSFString3() */
- private SFStringInfo getSFStringInfo(String buffer,int sf, boolean includeRightZeros, boolean previousCarry) {
- char[] b2 = new char[(includeRightZeros ? buffer.length() : Math.min(sf,buffer.length()))];
- boolean carry = (sf>=buffer.length() ? previousCarry : buffer.charAt(sf) >= '5');
- for(int i = b2.length-1 ; i >=0; i--) {
- if(i<sf) {
- b2[i] = buffer.charAt(i);
- if(carry) {
- if(b2[i] == '9') {
- b2[i] = '0';
- } else {
- b2[i]++;
- carry = false;
- }
- }
- } else {
- carry = buffer.charAt(i)>='5';
- b2[i] = '0';
- }
- }
- return new SFStringInfo(new String(b2), carry);
-
- }
-
- /**
- * An alternative version of getSFString which works on the actual string
- * Returns a string representing the given number to the number
- * of significant figures requested.
- */
- public String getSFString(double number, int sf) {
- String s = number+"";
- String preFullStop = null;
- String postFullStop = null;
- String postE = null;
-
- int fullStopIndex = s.indexOf('.');
- int eIndex = s.indexOf('e');
- if(eIndex<0) {
- eIndex = s.indexOf('E');
- }
-
- if(eIndex>=0) {
- postE = s.substring(eIndex+1);
- }
- eIndex = s.length();
- if(fullStopIndex>=0) {
- postFullStop = s.substring(fullStopIndex+1,eIndex);
-
- } else {
- fullStopIndex = eIndex;
- }
-
- preFullStop = s.substring(0,fullStopIndex);
-
- SFStringInfo postFSI = null;
-
-
- boolean postCarry = false;
- if(postFullStop!=null) {
- int postSF = sf - preFullStop.length();
- if(postSF>0) {
- postFSI = getSFStringInfo(postFullStop, postSF, false,false);
- postCarry = postFSI.carry;
- } else {
-
- postCarry = postFullStop.charAt(0)>='5';
- }
-
- }
- SFStringInfo preFSI;
- preFSI = getSFStringInfo(preFullStop,sf,true,postCarry);
- if(preFSI.carry) {
- preFSI.string = "1"+preFSI.string;
- }
- String b;
- if(postFSI!=null) {
- b = preFSI.string+"."+postFSI.string;
- } else {
- b = preFSI.string;
- }
- if(postE != null) {
- b+='e'+postE;
- }
-
- while (b.charAt(b.length() - 1) == '0') {
- b = b.substring(0, b.length()-1);
- }
- if (b.charAt(b.length() - 1) == '.') {
- b = b.substring(0, b.length()-1);
- }
-
- return b;
- }
- /**
- * print label with a prespecified length
- * (label will be shortened or spaces will introduced, if necessary)
- *
- * @param out output stream
- * @param label label to be printed
- * @param width desired length
- */
- public void displayLabel(PrintWriter out, String label, int width)
- {
- int len = label.length();
-
- if (len == width)
- {
- // Print as is
- out.print(label);
- }
- else if (len < width)
- {
- // fill rest with spaces
- out.print(label);
- multiplePrint(out, ' ', width - len);
- }
- else
- {
- // Print first width characters
- for (int i = 0; i < width; i++)
- {
- out.print(label.charAt(i));
- }
- }
- }
-
- /**
- * print integer, aligned to a reference number,
- * (introducing space at the left side)
- *
- * @param out output stream
- * @param num number to be printed
- * @param maxNum reference number
- */
- public void displayInteger(PrintWriter out, int num, int maxNum)
- {
- int lenNum = Integer.toString(num).length();
- int lenMaxNum = Integer.toString(maxNum).length();
-
- if (lenNum < lenMaxNum)
- {
- multiplePrint(out, ' ', lenMaxNum - lenNum);
- }
- out.print(num);
- }
-
- /**
- * print whitespace of length of a string displaying a given integer
- *
- * @param output stream
- * @param maxNum number
- */
- public void displayIntegerWhite(PrintWriter out, int maxNum)
- {
- int lenMaxNum = Integer.toString(maxNum).length();
-
- multiplePrint(out, ' ', lenMaxNum);
- }
-
- /**
- * repeatedly print a character
- *
- * @param out output stream
- * @param c character
- * @param num number of repeats
- */
- public void multiplePrint(PrintWriter out, char c, int num)
- {
- for (int i = 0; i < num; i++)
- {
- out.print(c);
- }
- }
-
- /**
- * returns of string of a given length of a single character.
- *
- * @param size length of the string required
- * @param c character
- */
- public static String space(int size, char c) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < size; i++) {
- sb.append(c);
- }
- return new String(sb);
- }
-
-
- //
- // Private stuff
- //
-
- // private constructor
- private FormattedOutput()
- {
- nf = NumberFormat.getInstance(Locale.UK);
- nf.setGroupingUsed(false);
- }
-
- private static FormattedOutput singleton = null;
-
- private NumberFormat nf;
-}
-
-/**
- * helper class
- */
-class SFStringInfo
-{
- String string;
- boolean carry;
-
- public SFStringInfo(String s, boolean c)
- {
- this.string = s;
- this.carry = c;
- }
-}
-
diff --git a/LibrarySource/pal/io/InputSource.java b/LibrarySource/pal/io/InputSource.java
deleted file mode 100644
index 2c102fb..0000000
--- a/LibrarySource/pal/io/InputSource.java
+++ /dev/null
@@ -1,81 +0,0 @@
-// InputSource.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.io;
-
-import java.io.*;
-
-
-/**
- * convenience class to open input streams
- * linked to files, stdin, and strings
- *
- * @version $Id: InputSource.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class InputSource extends PushbackReader
-{
- //
- // Public stuff
- //
-
- /**
- * open file for reading
- *
- * @param name file name
- *
- * @return input stream
- */
- public static InputSource openFile(String name)
- throws FileNotFoundException
- {
- return new InputSource(
- new BufferedReader(
- new FileReader(name)));
- }
-
- /**
- * open standard input
- *
- * @return input stream
- */
- public static InputSource openStdIn()
- {
- return
- new InputSource(
- new BufferedReader(
- new InputStreamReader(System.in)));
- }
-
- /**
- * "open" string for reading
- *
- * @param input string serving as source
- *
- * @return input stream
- */
- public static InputSource openString(String input)
- {
- return new InputSource(new StringReader(input));
- }
-
-
- //
- // Private stuff
- //
-
-
- // Private constructor
-
- private InputSource(Reader in)
- {
- super(in);
- }
-}
-
diff --git a/LibrarySource/pal/io/OutputTarget.java b/LibrarySource/pal/io/OutputTarget.java
deleted file mode 100644
index 653df71..0000000
--- a/LibrarySource/pal/io/OutputTarget.java
+++ /dev/null
@@ -1,102 +0,0 @@
-// OutputTarget.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.io;
-
-import java.io.*;
-
-
-/**
- * convenience class to create output streams linked to
- * files, stdout, and strings
- *
- * @version $Id: OutputTarget.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class OutputTarget extends PrintWriter
-{
- //
- // Public stuff
- //
-
- /**
- * open file for writing
- *
- * @param name file name
- *
- * @return output stream
- */
- public static OutputTarget openFile(String name)
- throws IOException
- {
- return new OutputTarget(
- new PrintWriter(
- new BufferedWriter(
- new FileWriter(name))));
- }
-
- /**
- * open standard out
- *
- * @return output stream
- */
- public static OutputTarget openStdOut()
- {
- return new OutputTarget(new PrintWriter(System.out));
- }
-
- /**
- * "open" string to write into
- *
- * @return output stream
- */
- public static OutputTarget openString()
- {
- StringWriter sw = new StringWriter();
-
- return new OutputTarget(new PrintWriter(sw), sw);
- }
-
- /**
- * get string corresponding to current stream created by openString()
- *
- * @return string
- */
- public String getString()
- {
- if (stringWriter == null)
- {
- return "";
- }
- else
- {
- return stringWriter.toString();
- }
- }
-
-
- //
- // Private stuff
- //
-
- private StringWriter stringWriter;
-
- // Private constructor
- private OutputTarget(PrintWriter out)
- {
- super(out);
- }
-
- private OutputTarget(PrintWriter out, StringWriter sw)
- {
- super(out);
- stringWriter = sw;
- }
-}
-
diff --git a/LibrarySource/pal/io/makefile b/LibrarySource/pal/io/makefile
deleted file mode 100644
index dca8f11..0000000
--- a/LibrarySource/pal/io/makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-### VARIABLES ###
-
-JIKESOPTS := +P
-GCJOPTS :=
-
-# Always check dependencies
-JIKESOPTS += +M
-
-SRC := $(wildcard *.java)
-CLS := $(patsubst %.java, %.class, $(SRC))
-OBJ := $(patsubst %.class, %.o, $(wildcard *.class))
-
-
-### RULES ###
-
-# Compile Java sources into class files
-%.class: %.java
- jikes $(JIKESOPTS) $<
-
-# Alternative to using jikes: gcj -C
-
-# Compile class files into native code
-%.o: %.class
- gcj -c $(GCJOPTS) $<
-
-
-### TARGETS ###
-
-.PHONY: classes native clean
-
-classes: $(CLS)
-
-ifneq ($(OBJ),)
-native: $(OBJ)
- (ar -rv package.a *.o; ranlib package.a)
-else
-native: $(OBJ)
-endif
-
-clean:
- rm -f *.class *.o *.u *.a *~
-
diff --git a/LibrarySource/pal/io/package.html b/LibrarySource/pal/io/package.html
deleted file mode 100644
index b4d214f..0000000
--- a/LibrarySource/pal/io/package.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<html>
-<body>
-Classes for simple (formatted) input/output from/to files,
-strings and standard-in/out streams.
-</body>
-</html>
-
diff --git a/LibrarySource/pal/makefile b/LibrarySource/pal/makefile
deleted file mode 100644
index df5da00..0000000
--- a/LibrarySource/pal/makefile
+++ /dev/null
@@ -1,52 +0,0 @@
-### TARGETS ###
-
-.PHONY: classes native clean
-
-classes:
- (cd alignment; $(MAKE) classes)
- (cd distance; $(MAKE) classes)
- (cd eval; $(MAKE) classes)
- (cd gui; $(MAKE) classes)
- (cd io; $(MAKE) classes)
- (cd math; $(MAKE) classes)
- (cd mep; $(MAKE) classes)
- (cd misc; $(MAKE) classes)
- (cd statistics; $(MAKE) classes)
- (cd substmodel; $(MAKE) classes)
- (cd tree; $(MAKE) classes)
- (cd datatype; $(MAKE) classes)
- (cd util; $(MAKE) classes)
- (cd coalescent; $(MAKE) classes)
-
-native:
- (cd alignment; $(MAKE) native)
- (cd distance; $(MAKE) native)
- (cd eval; $(MAKE) native)
- #(cd gui; $(MAKE) native)
- (cd io; $(MAKE) native)
- (cd math; $(MAKE) native)
- (cd mep; $(MAKE) native)
- (cd misc; $(MAKE) native)
- (cd statistics; $(MAKE) native)
- (cd substmodel; $(MAKE) native)
- (cd tree; $(MAKE) native)
- (cd datatype; $(MAKE) native)
- (cd util; $(MAKE) native)
- (cd coalescent; $(MAKE) native)
-
-clean:
- (cd alignment; $(MAKE) clean)
- (cd distance; $(MAKE) clean)
- (cd eval; $(MAKE) clean)
- (cd gui; $(MAKE) clean)
- (cd io; $(MAKE) clean)
- (cd math; $(MAKE) clean)
- (cd mep; $(MAKE) clean)
- (cd misc; $(MAKE) clean)
- (cd statistics; $(MAKE) clean)
- (cd substmodel; $(MAKE) clean)
- (cd tree; $(MAKE) clean)
- (cd datatype; $(MAKE) clean)
- (cd util; $(MAKE) clean)
- (cd coalescent; $(MAKE) clean)
-
diff --git a/LibrarySource/pal/math/Binomial.java b/LibrarySource/pal/math/Binomial.java
deleted file mode 100644
index 31ef14c..0000000
--- a/LibrarySource/pal/math/Binomial.java
+++ /dev/null
@@ -1,81 +0,0 @@
-// Binomial.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.math;
-
-/**
- * Binomial coefficients
- *
- * @version $Id: Binomial.java,v 1.6 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class Binomial implements java.io.Serializable
-{
- //
- // Public stuff
- //
-
- /**
- * Binomial coefficient n choose k
- */
- public double choose(double n, double k)
- {
- n = Math.floor(n + 0.5);
- k = Math.floor(k + 0.5);
-
- double lchoose = GammaFunction.lnGamma(n + 1.0) -
- GammaFunction.lnGamma(k + 1.0) - GammaFunction.lnGamma(n - k + 1.0);
-
- return Math.floor(Math.exp(lchoose) + 0.5);
- }
-
- /**
- * get (precomputed) n choose 2
- */
- public double getNChoose2(int n)
- {
- return nChoose2[n];
- }
-
- /**
- * set capacity and precompute the n choose 2 values
- */
- public void setMax(int max)
- {
- if (nChoose2 == null)
- {
- precalculate(max);
- }
- else if (max >= nChoose2.length)
- {
- precalculate(Math.max(nChoose2.length * 2, max));
- }
- }
-
-
- //
- // private stuff
- //
-
- private double[] nChoose2 = null;
-
- /**
- * pre-calculates n choose 2 up to a given number of lineages, if
- * not already pre-calculated.
- */
- private void precalculate(int n) {
-
- nChoose2 = new double[n+1];
-
- for (int i=0; i < (n+1); i++) {
- nChoose2[i] = ((double) (i*(i-1))) * 0.5;
- }
- }
-}
-
diff --git a/LibrarySource/pal/math/BoundsCheckedFunction.java b/LibrarySource/pal/math/BoundsCheckedFunction.java
deleted file mode 100644
index da4e17b..0000000
--- a/LibrarySource/pal/math/BoundsCheckedFunction.java
+++ /dev/null
@@ -1,96 +0,0 @@
-// BoundsCheckedFunction.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.math;
-
-
-/**
- * returns a very large number instead of the function value
- * if arguments are out of bound (useful for minimization with
- * minimizers that don't check argument boundaries)
- *
- * @author Korbinian Strimmer
- */
-public class BoundsCheckedFunction implements MultivariateFunction
-{
- /**
- * construct bound-checked multivariate function
- * (a large number will be returned on function evaluation if argument
- * is out of bounds; default is 1000000)
- *
- * @param func unconstrained multivariate function
- * @param minArg lower constraint
- * @param maxArg upper constraint
- */
- public BoundsCheckedFunction(MultivariateFunction func)
- {
- this(func, 1000000);
- }
-
- /**
- * construct constrained multivariate function
- *
- * @param func unconstrained multivariate function
- * @param largeNumber value returned on function evaluation
- * if argument is out of bounds
- */
- public BoundsCheckedFunction(MultivariateFunction func, double largeNumber)
- {
- f = func;
- veryLarge = largeNumber;
- }
-
- /**
- * computes function value, taking into account the constraints on the
- * argument
- *
- * @param x function argument
- *
- * @return function value (if argument is not in the predefined constrained area
- * a very large number is returned instead of the true function value)
- */
- public double evaluate(double[] x)
- {
- int len = f.getNumArguments();
-
- for (int i = 0; i < len; i++)
- {
- if (x[i] < f.getLowerBound(i) ||
- x[i] > f.getUpperBound(i))
- {
- return veryLarge;
- }
- }
-
- return f.evaluate(x);
- }
-
- public int getNumArguments()
- {
- return f.getNumArguments();
- }
-
- public double getLowerBound(int n)
- {
- return f.getLowerBound(n);
- }
-
- public double getUpperBound(int n)
- {
- return f.getUpperBound(n);
- }
-
-
- //
- // Private stuff
- //
-
- private MultivariateFunction f;
- private double veryLarge;
-}
-
diff --git a/LibrarySource/pal/math/ConjugateDirectionSearch.java b/LibrarySource/pal/math/ConjugateDirectionSearch.java
deleted file mode 100644
index fbe6c42..0000000
--- a/LibrarySource/pal/math/ConjugateDirectionSearch.java
+++ /dev/null
@@ -1,953 +0,0 @@
-// ConjugateDirectionSearch.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-// - algorithm is based on Brent's modification of a conjugate direction
-// search method proposed by Powell (praxis)
-// Richard P. Brent. 1973. Algorithms for finding zeros and extrema
-// of functions without calculating derivatives. Prentice-Hall.
-
-
-package pal.math;
-
-
-/**
- * methods for minimization of a real-valued function of
- * several variables without using derivatives (Brent's modification
- * of a conjugate direction search method proposed by Powell)
- *
- * @author Korbinian Strimmer
- */
-public class ConjugateDirectionSearch extends MultivariateMinimum
-{
- //
- // Public stuff
- //
-
- /**
- * constructor
- */
- public ConjugateDirectionSearch()
- {
- // random number generator
- rng = new MersenneTwisterFast();
- }
-
-
- // Variables that control aspects of the inner workings of the
- // minimization algorithm. Setting them is optional, they
- // are all set to some reasonable default values given below.
-
- /**
- * controls the printed output from the routine
- * (0 -> no output, 1 -> print only starting and final values,
- * 2 -> detailed map of the minimization process,
- * 3 -> print also eigenvalues and vectors of the
- * search directions), the default value is 0
- */
- public int prin = 0;
-
- /**
- * step is a steplength parameter and should be set equal
- * to the expected distance from the solution.
- * exceptionally small or large values of step lead to
- * slower convergence on the first few iterations
- * the default value for step is 1.0
- */
- public double step = 1.0;
-
- /**
- * scbd is a scaling parameter. 1.0 is the default and
- * indicates no scaling. if the scales for the different
- * parameters are very different, scbd should be set to
- * a value of about 10.0.
- */
- public double scbd = 1.0;
-
- /**
- * illc should be set to true
- * if the problem is known to
- * be ill-conditioned. the default is false. this
- * variable is automatically set, when the problem
- * is found to to be ill-conditioned during iterations.
- */
- public boolean illc = false;
-
- // implementation of abstract method
-
- public void optimize(MultivariateFunction f, double[] xvector,
- double tolfx, double tolx)
- {
- t = tolx;
-
- fun = f;
- x = xvector;
-
- checkBounds(x);
- h = step;
-
- dim = fun.getNumArguments();;
-
- d = new double[dim];
- y = new double[dim];
- z = new double[dim];
- q0 = new double[dim];
- q1 = new double[dim];
- v = new double[dim][dim];
- tflin = new double[dim];
-
- small = MachineAccuracy.EPSILON*MachineAccuracy.EPSILON;
- vsmall = small*small;
- large = 1.0/small;
- vlarge = 1.0/vsmall;
- ldfac = (illc ? 0.1 : 0.01);
- nl = kt = 0;
- numFun = 1;
- fx = fun.evaluate(x);
-
- stopCondition(fx, x, tolfx, tolx, true);
-
- qf1 = fx;
- t2 = small + Math.abs(t);
- t = t2;
- dmin = small;
-
- if (h < 100.0*t) h = 100.0*t;
- ldt = h;
- for (i = 0; i < dim; i++)
- {
- for (j = 0; j < dim; j++)
- {
- v[i][j] = (i == j ? 1.0 : 0.0);
- }
- }
- d[0] = 0.0;
- qd0 = 0.0;
- for (i = 0; i < dim; i++)
- q1[i] = x[i];
-
- if (prin > 1)
- {
- System.out.println("\n------------- enter function praxis -----------\n");
- System.out.println("... current parameter settings ...");
- System.out.println("... scaling ... " + scbd);
- System.out.println("... tolx ... " + t);
- System.out.println("... tolfx ... " + tolfx);
- System.out.println("... maxstep ... " + h);
- System.out.println("... illc ... " + illc);
- System.out.println("... maxFun ... " + maxFun);
- }
- if (prin > 0)
- System.out.println();
-
- while(true)
- {
- sf = d[0];
- s = d[0] = 0.0;
-
- /* minimize along first direction */
-
- min1 = d[0];
- min2 = s;
- min(0, 2, fx, false);
- d[0] = min1;
- s = min2;
-
- if (s <= 0.0)
- for (i = 0; i < dim; i++)
- {
- v[i][0] = -v[i][0];
- }
- if ((sf <= (0.9 * d[0])) || ((0.9 * sf) >= d[0]))
- for (i=1; i < dim; i++)
- d[i] = 0.0;
-
- boolean gotoFret = false;
- for (k=1; k < dim; k++)
- {
- for (i=0; i< dim; i++)
- {
- y[i] = x[i];
- }
- sf = fx;
- illc = illc || (kt > 0);
-
- boolean gotoNext;
- do
- {
- kl = k;
- df = 0.0;
- if (illc)
- { /* random step to get off resolution valley */
- for (i=0; i < dim; i++)
- {
- z[i] = (0.1 * ldt + t2 * Math.pow(10.0,(double)kt)) * (rng.nextDouble() - 0.5);
- s = z[i];
- for (j=0; j < dim; j++)
- {
- x[j] += s * v[j][i];
- }
- }
-
- checkBounds(x);
-
- fx = fun.evaluate(x);
- numFun++;
- }
-
- /* minimize along non-conjugate directions */
- for (k2=k; k2 < dim; k2++)
- {
- sl = fx;
- s = 0.0;
-
- min1 = d[k2];
- min2 = s;
- min(k2, 2, fx, false);
- d[k2] = min1;
- s = min2;
-
- if (illc)
- {
- double szk = s + z[k2];
- s = d[k2] * szk*szk;
- }
- else
- s = sl - fx;
- if (df < s)
- {
- df = s;
- kl = k2;
- }
- }
-
- if (!illc && (df < Math.abs(100.0 * MachineAccuracy.EPSILON * fx)))
- {
- illc = true;
- gotoNext = true;
- }
- else
- gotoNext = false;
- } while (gotoNext);
-
-
-
- if ((k == 1) && (prin > 1))
- vecprint("\n... New Direction ...", d);
- /* minimize along conjugate directions */
- for (k2=0; k2<=k-1; k2++)
- {
- s = 0.0;
-
- min1 = d[k2];
- min2 = s;
- min(k2, 2, fx, false);
- d[k2] = min1;
- s = min2;
- }
- f1 = fx;
- fx = sf;
- lds = 0.0;
- for (i=0; i<dim; i++)
- {
- sl = x[i];
- x[i] = y[i];
- y[i] = sl - y[i];
- sl = y[i];
- lds = lds + sl*sl;
- }
- checkBounds(x);
-
- lds = Math.sqrt(lds);
- if (lds > small)
- {
- for (i=kl-1; i>=k; i--)
- {
- for (j=0; j < dim; j++)
- v[j][i+1] = v[j][i];
- d[i+1] = d[i];
- }
- d[k] = 0.0;
- for (i=0; i < dim; i++)
- v[i][k] = y[i] / lds;
-
- min1 = d[k];
- min2 = lds;
- min(k, 4, f1, true);
- d[k] = min1;
- lds = min2;
-
- if (lds <= 0.0)
- {
- lds = -lds;
- for (i=0; i< dim; i++)
- v[i][k] = -v[i][k];
- }
- }
- ldt = ldfac * ldt;
- if (ldt < lds)
- ldt = lds;
- if (prin > 1)
- print();
-
-
- if(stopCondition(fx, x, tolfx, tolx, false))
- {
- kt++;
- }
- else
- {
- kt = 0;
- }
- if (kt > 1)
- {
- gotoFret = true;
- break;
- }
-
- }
-
- if (gotoFret) break;
-
-
- /* try quadratic extrapolation in case */
- /* we are stuck in a curved valley */
- quadr();
- dn = 0.0;
- for (i=0; i < dim; i++)
- {
- d[i] = 1.0 / Math.sqrt(d[i]);
- if (dn < d[i])
- dn = d[i];
- }
- if (prin > 2)
- matprint("\n... New Matrix of Directions ...",v);
- for (j=0; j < dim; j++)
- {
- s = d[j] / dn;
- for (i=0; i < dim; i++)
- v[i][j] *= s;
- }
- if (scbd > 1.0)
- { /* scale axis to reduce condition number */
- s = vlarge;
- for (i=0; i < dim; i++)
- {
- sl = 0.0;
- for (j=0; j < dim; j++)
- sl += v[i][j]*v[i][j];
- z[i] = Math.sqrt(sl);
- if (z[i] < MachineAccuracy.SQRT_SQRT_EPSILON)
- z[i] = MachineAccuracy.SQRT_SQRT_EPSILON;
- if (s > z[i])
- s = z[i];
- }
- for (i=0; i < dim; i++)
- {
- sl = s / z[i];
- z[i] = 1.0 / sl;
- if (z[i] > scbd)
- {
- sl = 1.0 / scbd;
- z[i] = scbd;
- }
- }
- }
- for (i=1; i < dim; i++)
- for (j=0; j<=i-1; j++)
- {
- s = v[i][j];
- v[i][j] = v[j][i];
- v[j][i] = s;
- }
- minfit(dim, MachineAccuracy.EPSILON, vsmall, v, d);
- if (scbd > 1.0)
- {
- for (i=0; i < dim; i++)
- {
- s = z[i];
- for (j=0; j < dim; j++)
- v[i][j] *= s;
- }
- for (i=0; i < dim; i++)
- {
- s = 0.0;
- for (j=0; j < dim; j++)
- s += v[j][i]*v[j][i];
- s = Math.sqrt(s);
- d[i] *= s;
- s = 1.0 / s;
- for (j=0; j < dim; j++)
- v[j][i] *= s;
- }
- }
- for (i=0; i < dim; i++)
- {
- if ((dn * d[i]) > large)
- d[i] = vsmall;
- else if ((dn * d[i]) < small)
- d[i] = vlarge;
- else
- d[i] = Math.pow(dn * d[i],-2.0);
- }
- sort(); /* the new eigenvalues and eigenvectors */
- dmin = d[dim-1];
- if (dmin < small)
- dmin = small;
- illc = (MachineAccuracy.SQRT_EPSILON * d[0]) > dmin;
- if ((prin > 2) && (scbd > 1.0))
- vecprint("\n... Scale Factors ...",z);
- if (prin > 2)
- vecprint("\n... Eigenvalues of A ...",d);
- if (prin > 2)
- matprint("\n... Eigenvectors of A ...",v);
-
- if ((maxFun > 0) && (nl > maxFun))
- {
- if (prin > 0)
- System.out.println("\n... maximum number of function calls reached ...");
- break;
- }
- }
-
- if (prin > 0)
- {
- vecprint("\n... Final solution is ...", x);
- System.out.println("\n... Function value reduced to " + fx + " ...");
- System.out.println("... after " + numFun + " function calls.");
- }
-
- //return (fx);
- }
-
-
- //
- // Private stuff
- //
-
- // some global variables
- private int i, j, k, k2, nl, kl, kt;
- private double s, sl, dn, dmin,
- fx, f1, lds, ldt, sf, df,
- qf1, qd0, qd1, qa, qb, qc, small, vsmall, large,
- vlarge, ldfac, t2;
-
- // need to be initialised
- private double[] d;
- private double[] y;
- private double[] z;
- private double[] q0;
- private double[] q1;
- private double[][] v;
-
- private double[] tflin;
-
- private int dim;
- private double[] x;
- private MultivariateFunction fun;
-
- // these will be set by praxis to the global control parameters
- private double h, t;
-
- // Random number generator
- private MersenneTwisterFast rng;
-
- // sort d and v in descending order
- private void sort()
- {
- int k, i, j;
- double s;
-
- for (i=0; i < dim-1; i++)
- {
- k = i; s = d[i];
- for (j=i+1; j < dim; j++)
- {
- if (d[j] > s)
- {
- k = j;
- s = d[j];
- }
- }
- if (k > i)
- {
- d[k] = d[i];
- d[i] = s;
- for (j=0; j < dim; j++)
- {
- s = v[j][i];
- v[j][i] = v[j][k];
- v[j][k] = s;
- }
- }
- }
- }
-
- private void vecprint(String s, double[] x)
- {
- System.out.println(s);
- for (int i=0; i < x.length; i++)
- System.out.print(x[i] + " ");
- System.out.println();
- }
-
- private void print() /* print a line of traces */
- {
- System.out.println();
- System.out.println("... function value reduced to ... " + fx);
- System.out.println("... after " + numFun + " function calls ...");
- System.out.println("... including " + nl + " linear searches ...");
- vecprint("... current values of x ...", x);
- }
-
- private void matprint(String s, double[][] v)
- {
- System.out.println(s);
- for (int k=0; k<v.length; k++)
- {
- for (int i=0; i<v.length; i++)
- {
- System.out.print(v[k][i] + " ");
- }
- System.out.println();
- }
- }
-
- private double flin(double l, int j)
- {
- if (j != -1)
- { /* linear search */
- for (int i = 0; i < dim; i++)
- tflin[i] = x[i] + l*v[i][j];
- }
- else
- { /* search along parabolic space curve */
- qa = l*(l-qd1)/(qd0*(qd0+qd1));
- qb = (l+qd0)*(qd1-l)/(qd0*qd1);
- qc = l*(l+qd0)/(qd1*(qd0+qd1));
- for (int i = 0; i < dim; i++)
- {
- tflin[i] = qa*q0[i]+qb*x[i]+qc*q1[i];
- }
- }
-
- checkBounds(tflin);
-
- numFun++;
- return fun.evaluate(tflin);
- }
-
- private void checkBounds(double[] p)
- {
- for (int i = 0; i < dim; i++)
- {
- if (p[i] < fun.getLowerBound(i))
- {
- p[i] = fun.getLowerBound(i);
- }
- if (p[i] > fun.getUpperBound(i))
- {
- p[i] = fun.getUpperBound(i);
- }
- }
- }
-
- private double min1;
- private double min2;
-
- private void min(int j, int nits, double f1, boolean fk)
- {
- int k;
- double x2, xm, f0, f2, fm, d1, t2, s, sf1, sx1;
-
- sf1 = f1; sx1 = min2;
- k = 0; xm = 0.0; fm = f0 = fx;
- boolean dz = (min1 < MachineAccuracy.EPSILON);
-
- /* find step size */
- s = 0;
- for (int i=0; i < dim; i++)
- {
- s += x[i]*x[i];
- }
- s = Math.sqrt(s);
- if (dz)
- {
- t2 = MachineAccuracy.SQRT_SQRT_EPSILON*
- Math.sqrt(Math.abs(fx)/dmin + s*ldt) +
- MachineAccuracy.SQRT_EPSILON*ldt;
- }
- else
- {
- t2 = MachineAccuracy.SQRT_SQRT_EPSILON*
- Math.sqrt(Math.abs(fx)/(min1) + s*ldt) +
- MachineAccuracy.SQRT_EPSILON*ldt;
- }
- s = s*MachineAccuracy.SQRT_SQRT_EPSILON + t;
- if (dz && t2 > s)
- t2 = s;
- if (t2 < small)
- t2 = small;
- if (t2 > 0.01*h)
- t2 = 0.01 * h;
- if (fk && f1 <= fm)
- {
- xm = min2;
- fm = f1;
- }
- if (!fk || Math.abs(min2) < t2)
- {
- min2 = (min2 > 0 ? t2 : -t2);
- f1 = flin(min2, j);
- }
- if (f1 <= fm)
- {
- xm = min2;
- fm = f1;
- }
-
- boolean gotoNext;
- do
- {
- if (dz)
- {
- x2 = (f0 < f1 ? -(min2) : 2*(min2));
- f2 = flin(x2, j);
- if (f2 <= fm)
- {
- xm = x2;
- fm = f2;
- }
- min1 = (x2*(f1-f0) - (min2)*(f2-f0))/((min2)*x2*((min2)-x2));
- }
- d1 = (f1-f0)/(min2) - min2*min1;
- dz = true;
- if (min1 <= small)
- {
- x2 = (d1 < 0 ? h : -h);
- }
- else
- {
- x2 = - 0.5*d1/(min1);
- }
- if (Math.abs(x2) > h)
- x2 = (x2 > 0 ? h : -h);
-
- f2 = flin(x2, j);
-
- gotoNext = false;
-
- while ((k < nits) && (f2 > f0))
- {
- k++;
- if ((f0 < f1) && (min2*x2 > 0.0))
- {
- gotoNext = true;
- break;
- }
-
-
- x2 *= 0.5;
- f2 = flin(x2, j);
- }
- } while (gotoNext);
-
-
- nl++;
- if (f2 > fm)
- x2 = xm;
- else fm = f2;
- if (Math.abs(x2*(x2-min2)) > small)
- {
- min1 = (x2*(f1-f0) - min2*(fm-f0))/(min2*x2*(min2-x2));
- }
- else
- {
- if (k > 0) min1 = 0;
- }
- if (min1 <= small)
- min1 = small;
- min2 = x2; fx = fm;
- if (sf1 < fx)
- {
- fx = sf1;
- min2 = sx1;
- }
- if (j != -1)
- {
- for (i=0; i < dim; i++)
- {
- x[i] += (min2)*v[i][j];
- }
- checkBounds(x);
- }
- }
-
- // Look for a minimum along the curve q0, q1, q2
- private void quadr()
- {
- int i;
- double l, s;
-
- s = fx; fx = qf1; qf1 = s; qd1 = 0.0;
- for (i=0; i < dim; i++)
- {
- s = x[i]; l = q1[i]; x[i] = l; q1[i] = s;
- qd1 = qd1 + (s-l)*(s-l);
- }
- s = 0.0; qd1 = Math.sqrt(qd1); l = qd1;
- if (qd0>0.0 && qd1>0.0 &&nl>=3*dim*dim)
- {
- min1 = s;
- min2 = l;
- min(-1, 2, qf1, true);
- s = min1;
- l = min2;
-
- qa = l*(l-qd1)/(qd0*(qd0+qd1));
- qb = (l+qd0)*(qd1-l)/(qd0*qd1);
- qc = l*(l+qd0)/(qd1*(qd0+qd1));
- }
- else
- {
- fx = qf1; qa = qb = 0.0; qc = 1.0;
- }
- qd0 = qd1;
- for (i=0; i<dim; i++)
- {
- s = q0[i]; q0[i] = x[i];
- x[i] = qa*s + qb*x[i] + qc*q1[i];
- }
-
- checkBounds(x);
- }
-
- // Singular value decomposition
- private void minfit(int n, double eps, double tol, double[][] ab, double[] q)
- {
- int l=0, kt, l2, i, j, k;
- double c, f, g, h, s, x, y, z;
-
- double[] e = new double[dim];
-
-
- /* householder's reduction to bidiagonal form */
- x = g = 0.0;
- for (i=0; i<n; i++)
- {
- e[i] = g; s = 0.0; l = i+1;
- for (j=i; j<n; j++)
- s += ab[j][i] * ab[j][i];
- if (s < tol)
- {
- g = 0.0;
- }
- else
- {
- f = ab[i][i];
- if (f < 0.0)
- g = Math.sqrt(s);
- else
- g = -Math.sqrt(s);
- h = f*g - s; ab[i][i] = f - g;
- for (j=l; j<n; j++)
- {
- f = 0.0;
- for (k=i; k<n; k++)
- f += ab[k][i] * ab[k][j];
- f /= h;
- for (k=i; k<n; k++)
- ab[k][j] += f * ab[k][i];
- }
- }
- q[i] = g; s = 0.0;
- if (i < n)
- for (j=l; j<n; j++)
- s += ab[i][j] * ab[i][j];
- if (s < tol)
- {
- g = 0.0;
- }
- else
- {
- f = ab[i][i+1];
- if (f < 0.0)
- g = Math.sqrt(s);
- else
- g = - Math.sqrt(s);
- h = f*g - s;
- ab[i][i+1] = f - g;
- for (j=l; j<n; j++)
- e[j] = ab[i][j]/h;
- for (j=l; j<n; j++)
- {
- s = 0;
- for (k=l; k<n; k++)
- s += ab[j][k]*ab[i][k];
- for (k=l; k<n; k++)
- ab[j][k] += s * e[k];
- }
- }
- y = Math.abs(q[i]) + Math.abs(e[i]);
- if (y > x)
- x = y;
- }
- /* accumulation of right hand transformations */
- for (i=n-1; i >= 0; i--)
- {
- if (g != 0.0)
- {
- h = ab[i][i+1]*g;
- for (j=l; j<n; j++) ab[j][i] = ab[i][j] / h;
- for (j=l; j<n; j++)
- {
- s = 0.0;
- for (k=l; k<n; k++) s += ab[i][k] * ab[k][j];
- for (k=l; k<n; k++) ab[k][j] += s * ab[k][i];
- }
- }
- for (j=l; j<n; j++)
- ab[i][j] = ab[j][i] = 0.0;
- ab[i][i] = 1.0; g = e[i]; l = i;
- }
- /* diagonalization to bidiagonal form */
- eps *= x;
- boolean converged = false;
- for (k=n-1; k>= 0; k--)
- {
- kt = 0;
-
- do
- {
- kt++;
-
- boolean skipNext = false;
- for (l2=k; l2>=0; l2--)
- {
- l = l2;
- if (Math.abs(e[l]) <= eps)
- {
- skipNext = true;
- break;
- }
-
- if (Math.abs(q[l-1]) <= eps)
- break;
- }
-
- if (skipNext == false)
- {
-
- c = 0.0; s = 1.0;
- for (i=l; i<=k; i++)
- {
- f = s * e[i]; e[i] *= c;
- if (Math.abs(f) <= eps)
- break;
- g = q[i];
- if (Math.abs(f) < Math.abs(g))
- {
- double fg = f/g;
- h = Math.abs(g)*Math.sqrt(1.0+fg*fg);
- }
- else
- {
- double gf = g/f;
- h = (f!=0.0 ? Math.abs(f)*Math.sqrt(1.0+gf*gf) : 0.0);
- }
- q[i] = h;
- if (h == 0.0)
- {
- h = 1.0; g = 1.0;
- }
- c = g/h; s = -f/h;
- }
- }
-
- z = q[k];
- if (l == k)
- {
- converged = true;
- break;
- }
-
-
- /* shift from bottom 2x2 minor */
- x = q[l]; y = q[k-l]; g = e[k-1]; h = e[k];
- f = ((y-z)*(y+z) + (g-h)*(g+h)) / (2.0*h*y);
- g = Math.sqrt(f*f+1.0);
- if (f <= 0.0)
- f = ((x-z)*(x+z) + h*(y/(f-g)-h))/x;
- else
- f = ((x-z)*(x+z) + h*(y/(f+g)-h))/x;
- /* next qr transformation */
- s = c = 1.0;
- for (i=l+1; i<=k; i++)
- {
- g = e[i]; y = q[i]; h = s*g; g *= c;
- if (Math.abs(f) < Math.abs(h))
- {
- double fh = f/h;
- z = Math.abs(h) * Math.sqrt(1.0 + fh*fh);
- }
- else
- {
- double hf = h/f;
- z = (f!=0.0 ? Math.abs(f)*Math.sqrt(1.0+hf*hf) : 0.0);
- }
- e[i-1] = z;
- if (z == 0.0)
- f = z = 1.0;
- c = f/z; s = h/z;
- f = x*c + g*s; g = - x*s + g*c; h = y*s;
- y *= c;
- for (j=0; j<n; j++)
- {
- x = ab[j][i-1]; z = ab[j][i];
- ab[j][i-1] = x*c + z*s;
- ab[j][i] = - x*s + z*c;
- }
- if (Math.abs(f) < Math.abs(h))
- {
- double fh = f/h;
- z = Math.abs(h) * Math.sqrt(1.0 + fh*fh);
- }
- else
- {
- double hf = h/f;
- z = (f!=0.0 ? Math.abs(f)*Math.sqrt(1.0+hf*hf) : 0.0);
- }
- q[i-1] = z;
- if (z == 0.0)
- z = f = 1.0;
- c = f/z; s = h/z;
- f = c*g + s*y; x = - s*g + c*y;
- }
- e[l] = 0.0; e[k] = f; q[k] = x;
-
-
- } while (kt <= 30);
-
- if (!converged)
- {
- e[k] = 0.0;
- System.out.println("\n+++ qr failed\n");
- return;
- //System.exit(1); //how rude of a library!
- }
-
-
- if (z < 0.0)
- {
- q[k] = - z;
- for (j=0; j<n; j++)
- ab[j][k] = - ab[j][k];
- }
- }
- }
-}
-
diff --git a/LibrarySource/pal/math/ConjugateGradientSearch.java b/LibrarySource/pal/math/ConjugateGradientSearch.java
deleted file mode 100644
index 583215a..0000000
--- a/LibrarySource/pal/math/ConjugateGradientSearch.java
+++ /dev/null
@@ -1,492 +0,0 @@
-// ConjugateGradientSearch.java
-//
-// (c) 2000-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.math;
-
-
-/**
- * minimization of a real-valued function of
- * several variables using a the nonlinear
- * conjugate gradient method where several variants of the direction
- * update are available (Fletcher-Reeves, Polak-Ribiere,
- * Beale-Sorenson, Hestenes-Stiefel) and bounds are respected.
- * Gradients are computed numerically if they are not supplied by the
- * user. The line search is entirely based on derivative
- * evaluation, similar to the strategy used in macopt (Mackay).
- *
- * @version $Id: ConjugateGradientSearch.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class ConjugateGradientSearch extends MultivariateMinimum
-{
- //
- // Public stuff
- //
-
- public final static int FLETCHER_REEVES_UPDATE = 0;
- public final static int POLAK_RIBIERE_UPDATE = 1;
- public final static int BEALE_SORENSON_HESTENES_STIEFEL_UPDATE = 2;
-
- // Variables that control aspects of the inner workings of the
- // minimization algorithm. Setting them is optional, they
- // are all set to some reasonable default values given below.
-
- /**
- * controls the printed output from the routine
- * (0 -> no output, 1 -> print only starting and final values,
- * 2 -> detailed map of the minimisation process),
- * the default value is 0
- */
- public int prin = 0;
-
- /**
- * defaultStep is a steplength parameter and should be set equal
- * to the expected distance from the solution (in a line search)
- * exceptionally small or large values of defaultStep lead to
- * slower convergence on the first few iterations (the step length
- * itself is adapted during search), the default value is 1.0
- */
- public double defaultStep = 1.0;
-
-
- /**
- * conjugateGradientStyle determines the method for the
- * conjugate gradient direction update
- * update (0 -> Fletcher-Reeves, 1 -> Polak-Ribiere,
- * 2 -> Beale-Sorenson, Hestenes-Stiefel), the default is 2.
- */
- public int conjugateGradientStyle = BEALE_SORENSON_HESTENES_STIEFEL_UPDATE;
-
-
- public ConjugateGradientSearch() {
- }
-
- public ConjugateGradientSearch(int conGradStyle) {
- this.conjugateGradientStyle = conGradStyle;
- }
-
-
- // implementation of abstract method
-
- public void optimize(MultivariateFunction f, double[] x, double tolfx, double tolx)
- {
- xvec = x;
- numArgs = f.getNumArguments();
-
- boolean numericalGradient;
- if (f instanceof MFWithGradient)
- {
- numericalGradient = false;
- fgrad = (MFWithGradient) f;
- }
- else
- {
- numericalGradient = true;
- fgrad = null;
- }
-
-
- // line function
- LineFunction lf = new LineFunction(f);
-
- // xvec contains current guess for minimum
- lf.checkPoint(xvec);
- double[] xold = new double[numArgs];
- copy(xold, xvec);
-
- // function value and gradient at current guess
- numFun = 0;
- double fx;
- numGrad = 0;
- gvec = new double[numArgs];
- if (numericalGradient)
- {
- fx = f.evaluate(xvec);
- numFun++;
- NumericalDerivative.gradient(f, xvec, gvec);
- numFun += 2*numArgs;
- }
- else
- {
- fx = fgrad.evaluate(xvec, gvec);
- numFun++;
- numGrad++;
- }
- double[] gold = new double[numArgs];
- copy(gold, gvec);
-
- // init stop condition
- stopCondition(fx, xvec, tolfx, tolx, true);
-
- // currently active variables
- boolean[] active = new boolean[numArgs];
- double numActive = lf.checkVariables(xvec, gvec, active);
-
- // if no variables are active return
- if (numActive == 0)
- {
- return;
- }
-
- // initial search direction (steepest descent)
- sdir = new double[numArgs];
- steepestDescentDirection(sdir, gvec, active);
- lf.update(xvec, sdir);
-
- // slope at start point in initial direction
- double slope = gradientProjection(sdir, gvec);
-
-
- if (prin > 0)
- {
- System.out.println("--- starting minimization ---");
- System.out.println("... current parameter settings ...");
- System.out.println("... tolx ... " + tolx);
- System.out.println("... tolfx ... " + tolfx);
- System.out.println("... maxFun ... " + maxFun);
- System.out.println();
- printVec("... start vector ...", xvec);
- System.out.println();
- printVec("... start direction ...", sdir);
- }
-
-
- int numLin = 0;
- lastStep = defaultStep;
- while(true)
- {
- // determine an appropriate step length
- double step = findStep(lf, fx, slope, numericalGradient);
- lastStep = step;
- numLin++;
-
- // update xvec
- lf.getPoint(step, xvec);
- lf.checkPoint(xvec);
-
-
- // function value at current guess
- if (numericalGradient)
- {
- fx = f.evaluate(xvec);
- numFun++;
- }
- else
- {
- // compute gradient as well
- fx = fgrad.evaluate(xvec, gvec);
- numFun++;
- numGrad++;
- }
-
- // test for for convergence
- if (stopCondition(fx, xvec, tolfx, tolx, false)
- || (maxFun > 0 && numFun > maxFun))
- {
- break;
- }
-
- // Compute numerical gradient
- if (numericalGradient)
- {
- NumericalDerivative.gradient(f, xvec, gvec);
- numFun += 2*numArgs;
- }
-
-
- numActive = lf.checkVariables(xvec, gvec, active);
-
- // if all variables are inactive return
- if (numActive == 0)
- {
- break;
- }
-
- // determine new search direction
- conjugateGradientDirection(sdir, gvec, gold, active);
- lf.checkDirection(xvec, sdir);
-
- // compute slope in new direction
- slope = gradientProjection(sdir, gvec);
-
- if (slope >= 0)
- {
- //reset to steepest descent direction
- steepestDescentDirection(sdir, gvec, active);
-
- // compute slope in new direction
- slope = gradientProjection(sdir, gvec);
-
- // reset to default step length
- lastStep = defaultStep;
- }
-
-
- // other updates
- lf.update(xvec, sdir);
- copy(xold, xvec);
- copy(gold, gvec);
-
- if (prin > 1)
- {
- System.out.println();
- System.out.println("Function value: " +
- f.evaluate(xvec));
- System.out.println();
- printVec("... new vector ...", xvec);
- System.out.println();
- printVec("... new direction ...", sdir);
- System.out.println("... numFun ... " + numFun);
- if (!numericalGradient)
- {
- System.out.println("... numGrad ... " + numGrad);
- }
- System.out.println("... numLin ... " + numLin);
- System.out.println();
- }
- }
-
- if (prin > 0)
- {
- System.out.println();
- printVec("... final vector ...", xvec);
- System.out.println("... numFun ... " + numFun);
- System.out.println("... numLin ... " + numLin);
- System.out.println();
- System.out.println("--- end of minimization ---");
- }
- }
-
-
- //
- // Private stuff
- //
-
- private int numArgs, numGrad;
- private double lastStep;
- private double[] xvec, gvec, sdir;
- private MFWithGradient fgrad;
-
- private double findStep(LineFunction lf, double f0, double s0, boolean numericalGradient)
- {
- // f0 function value at step = 0
- // s0 slope at step = 0
-
- double step;
- double maxStep = lf.getUpperBound();
- if (maxStep <= 0 || s0 == 0)
- {
- return 0.0;
- }
-
- //step = Math.abs(lf.findMinimum());
-
-
- // growing/shrinking factors for bracketing
-
- double g1 = 2.0;
- double g2 = 1.25;
- double g3 = 0.5;
-
- // x1 and x2 try to bracket the minimum
-
- double x1 = 0;
- double s1 = s0;
- double x2 = lastStep*g2;
- if(x2 > maxStep)
- {
- x2 = maxStep*g3;
- }
- double s2 = computeDerivative(lf, x2, numericalGradient);
-
- // we need to go further to bracket minimum
- boolean boundReached = false;
- while (s2 <= 0 && !boundReached)
- {
- x1 = x2;
- s1 = s2;
- x2 = x2*g1;
- if (x2 > maxStep)
- {
- x2 = maxStep;
- boundReached = true;
- }
- s2 = computeDerivative(lf, x2, numericalGradient);
- }
-
- // determine step length by quadratic interpolation
- // for minimum in interval [x1,x2]
-
- if (s2 <= 0)
- {
- // true local minimum could NOT be bracketed
- // instead we have a local minimum on a boundary
-
- step = x2;
- }
- else
- {
- // minimum is bracketed
-
- step = (x1*s2-x2*s1)/(s2-s1);
- // note that nominator is always positive
- }
-
- // just to be safe - should not be necessary
- if (step >= maxStep)
- {
- step = maxStep;
- }
- if (step < 0)
- {
- step = 0;
- }
-
- return step;
- }
-
- private double computeDerivative(LineFunction lf, double lambda, boolean numericalGradient)
- {
- if (numericalGradient)
- {
- numFun += 2;
- return NumericalDerivative.firstDerivative(lf, lambda);
- }
- else
- {
- lf.getPoint(lambda, xvec);
- lf.checkPoint(xvec);
- fgrad.computeGradient(xvec, gvec);
- numGrad++;
- return gradientProjection(sdir, gvec);
- }
- }
-
- private void testStep(double f0, double s0, double f1, double s1, double step)
- {
- // f0 function value at x=0
- // s0 slope at x=0
-
- // f1 function value at x=step
- // f2 function value at x=step
-
- double mue = 0.0001;
- double eta = 0.9;
-
- // sufficent decrease in function value
- if (f1 <= mue*s0*step + f0)
- {
- System.out.println("<<< Sufficient decrease in function value");
- }
- else
- {
- System.out.println("<<< NO sufficient decrease in function value");
- }
-
- // sufficient decrease in slope
- if (Math.abs(s1) <= eta*Math.abs(s0))
- {
- System.out.println("<<< Sufficient decrease in slope");
- }
- else
- {
- System.out.println("<<< NO sufficient decrease in slope");
- }
- }
-
-
- private void conjugateGradientDirection(double[] sdir, double[] gvec, double[] gold,
- boolean[] active)
- {
- double gg = 0;
- double dgg = 0;
- for (int i = 0; i < numArgs; i++)
- {
- if (active[i])
- {
- switch (conjugateGradientStyle)
- {
- case 0:
- // Fletcher-Reeves
- dgg += gvec[i]*gvec[i];
- gg += gold[i]*gold[i];
- break;
-
- case 1:
- // Polak-Ribiere
- dgg += gvec[i]*(gvec[i]-gold[i]);
- gg += gold[i]*gold[i];
- break;
-
- case 2:
- // Beale-Sorenson
- // Hestenes-Stiefel
- dgg += gvec[i] * (gvec[i] - gold[i]);
- gg += sdir[i] * (gvec[i] - gold[i]);
- break;
- }
- }
- }
- double beta = dgg/gg;
- if (beta < 0 || gg == 0)
- {
- // better convergence (Gilbert and Nocedal)
- beta = 0;
- }
- for (int i = 0; i < numArgs; i++)
- {
- if (active[i])
- {
- sdir[i] = -gvec[i] + beta*sdir[i];
- }
- else
- {
- sdir[i] = 0;
- }
- }
- }
-
- private void steepestDescentDirection(double[] sdir, double[] gvec, boolean[] active)
- {
- for (int i = 0; i < numArgs; i++)
- {
- if (active[i])
- {
- sdir[i] = -gvec[i];
- }
- else
- {
- sdir[i] = 0;
- }
- }
- }
-
- private double gradientProjection(double[] sdir, double[] gvec)
- {
- double s = 0;
- double n = gvec.length;
- for (int i = 0; i < n; i++)
- {
- s += gvec[i]*sdir[i];
- }
-
- return s;
- }
-
- private void printVec(String s, double[] x)
- {
- System.out.println(s);
- for (int i=0; i < x.length; i++)
- {
- System.out.print(x[i] + " ");
- }
- System.out.println();
- }
-}
-
diff --git a/LibrarySource/pal/math/DifferentialEvolution.java b/LibrarySource/pal/math/DifferentialEvolution.java
deleted file mode 100644
index 85b6899..0000000
--- a/LibrarySource/pal/math/DifferentialEvolution.java
+++ /dev/null
@@ -1,371 +0,0 @@
-// DifferentialEvolution.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-// Price, K., and R. Storn. 1997. Differential evolution: a simple
-// strategy for fast optimization. Dr. Dobb's Journal 264(April), pp. 18-24.
-// Strategy used here: DE/rand-to-best/1/bin
-// http://www.icsi.berkeley.edu/~storn/code.html
-
-
-package pal.math;
-
-
-/**
- * <b>global</b> minimization of a real-valued function of several
- * variables without using derivatives using a genetic algorithm
- * (Differential Evolution)
- * @author Korbinian Strimmer
- */
-public class DifferentialEvolution extends MultivariateMinimum
-{
- //
- // Public stuff
- //
-
- // Variables that control aspects of the inner workings of the
- // minimization algorithm. Setting them is optional, they
- // are all set to some reasonable default values given below.
-
- /** weight factor (default 0.7) */
- public double F = 0.7 /* 0.5*/;
-
- /** Crossing over factor (default 0.9) */
- public double CR = 0.9 /*1.0*/;
-
- /**
- * variable controlling print out, default value = 0
- * (0 -> no output, 1 -> print final value,
- * 2 -> detailed map of optimization process)
- */
- public int prin = 0;
-
-
- /**
- * construct DE optimization modul (population size is
- * selected automatically)
- *
- * <p><em>DE web page:</em>
- * <a href="http://www.icsi.berkeley.edu/~storn/code.html"
- * >http://www.icsi.berkeley.edu/~storn/code.html</a>
- *
- * @param dim dimension of optimization vector
- */
- public DifferentialEvolution (int dim)
- {
- this(dim, 5*dim);
- }
-
- /**
- * construct optimization modul
- *
- * @param dim dimension of optimization vector
- * @param popSize population size
- */
- public DifferentialEvolution (int dim, int popSize)
- {
- // random number generator
- rng = new MersenneTwisterFast();
-
- // Dimension and Population size
- dimension = dim;
- populationSize = popSize;
-
- numFun = 0;
-
- // Allocate memory
- currentPopulation = new double[populationSize][dimension];
- nextPopulation = new double[populationSize][dimension];
- costs = new double[populationSize];
- trialVector = new double[dimension];
-
- // helper variable
- //numr = 5; // for strategy DE/best/2/bin
- numr = 3; // for stragey DE/rand-to-best/1/bin
- r = new int[numr];
- }
-
-
- // implementation of abstract method
-
- public void optimize(MultivariateFunction func, double[] xvec, double tolfx, double tolx)
- {
- f = func;
- x = xvec;
-
- // Create first generation
- firstGeneration ();
-
- stopCondition(fx, x, tolfx, tolx, true);
-
- while (true)
- {
- boolean xHasChanged;
- do
- {
- xHasChanged = nextGeneration ();
-
- if (maxFun > 0 && numFun > maxFun)
- {
- break;
- }
-
- if (prin > 1 && currGen % 20 == 0)
- {
- printStatistics();
- }
- }
- while (!xHasChanged);
-
-
- if (stopCondition(fx, x, tolfx, tolx, false) ||
- (maxFun > 0 && numFun > maxFun))
- {
- break;
- }
- }
-
- if (prin > 0) printStatistics();
- }
-
- //
- // Private stuff
- //
-
- private MultivariateFunction f;
- private int currGen;
- private double fx;
- private double[] x;
-
- // Dimension
- private int dimension;
-
- // Population size
- private int populationSize;
-
- // Population data
- private double trialCost;
- private double[] costs;
- private double[] trialVector;
- private double[][] currentPopulation;
- private double[][] nextPopulation;
-
- // Random number generator
- private MersenneTwisterFast rng;
-
- // Helper variable
- private int numr;
- private int[] r;
-
- private void printStatistics()
- {
- // Compute mean
- double meanCost = 0.0;
- for (int i = 0; i < populationSize; i++)
- {
- meanCost += costs[i];
- }
- meanCost = meanCost/populationSize;
-
- // Compute variance
- double varCost = 0.0;
- for (int i = 0; i < populationSize; i++)
- {
- double tmp = (costs[i]-meanCost);
- varCost += tmp*tmp;
- }
- varCost = varCost/(populationSize-1);
-
- System.out.println();
- System.out.println();
- System.out.println();
- System.out.println("Smallest value: " + fx);
- System.out.println();
- for (int k = 0; k < dimension; k++)
- {
- System.out.println("x[" + k + "] = " + x[k]);
- }
- System.out.println();
- System.out.println("Current Generation: " + currGen);
- System.out.println("Function evaluations: " + numFun);
- System.out.println("Populations size (populationSize): " + populationSize);
- System.out.println("Average value: " + meanCost);
- System.out.println("Variance: " + varCost);
-
- System.out.println("Weight factor (F): " + F);
- System.out.println("Crossing-over (CR): " + CR);
- System.out.println();
- }
-
- // Generate starting population
- private void firstGeneration()
- {
- currGen = 1;
-
- // Construct populationSize random start vectors
- for (int i = 0; i < populationSize; i++)
- {
- for (int j = 0; j < dimension; j++ )
- {
- double min = f.getLowerBound(j);
- double max = f.getUpperBound(j);
-
- double diff = max - min;
-
- // Uniformly distributed sample points
- currentPopulation[i][j] = min + diff*rng.nextDouble();
- }
- costs[i] = f.evaluate(currentPopulation[i]);
- }
- numFun += populationSize;
-
- findSmallestCost ();
- }
-
- // check whether a parameter is out of range
- private double checkBounds(double param, int numParam)
- {
- if (param < f.getLowerBound(numParam))
- {
- return f.getLowerBound(numParam);
- }
- else if (param > f.getUpperBound(numParam))
- {
- return f.getUpperBound(numParam);
- }
- else
- {
- return param;
- }
- }
-
- // Generate next generation
- private boolean nextGeneration()
- {
- boolean updateFlag = false;
- int best = 0; // to avoid compiler complaints
- double[][] swap;
-
- currGen++;
-
- // Loop through all population vectors
- for (int r0 = 0; r0 < populationSize; r0++)
- {
- // Choose ri so that r0 != r[1] != r[2] != r[3] != r[4] ...
-
- r[0] = r0;
- for (int k = 1; k < numr; k++)
- {
- r[k] = randomInteger (populationSize-k);
- for (int l = 0; l < k; l++)
- {
- if (r[k] >= r[l])
- {
- r[k]++;
- }
- }
- }
-
- copy(trialVector, currentPopulation[r0]);
- int n = randomInteger (dimension);
- for (int i = 0; i < dimension; i++) // perform binomial trials
- {
- // change at least one parameter
- if (rng.nextDouble() < CR || i == dimension - 1)
- {
- // DE/rand-to-best/1/bin
- // (change to 'numr=3' in constructor when using this strategy)
- trialVector[n] = trialVector[n] +
- F*(x[n] - trialVector[n]) +
- F*(currentPopulation[r[1]][n] - currentPopulation[r[2]][n]);
-
- //DE/rand-to-best/2/bin
- //double K = rng.nextDouble();
- //trialVector[n] = trialVector[n] +
- // K*(x[n] - trialVector[n]) +
- // F*(currentPopulation[r[1]][n] - currentPopulation[r[2]][n]);
-
-
- // DE/best/2/bin
- // (change to 'numr=5' in constructor when using this strategy)
- //trialVector[n] = x[n] +
- // (currentPopulation[r[1]][n]+currentPopulation[r[2]][n]
- // -currentPopulation[r[3]][n]-currentPopulation[r[4]][n])*F;
- }
- n = (n+1) % dimension;
- }
-
- // make sure that trial vector obeys boundaries
- for (int i = 0; i < dimension; i++)
- {
- trialVector[i] = checkBounds(trialVector[i], i);
- }
-
-
- // Test this choice
- trialCost = f.evaluate(trialVector);
- if (trialCost < costs[r0])
- {
- // Better than old vector
- costs[r0] = trialCost;
- copy(nextPopulation[r0], trialVector);
-
- // Check for new best vector
- if (trialCost < fx)
- {
- fx = trialCost;
- best = r0;
- updateFlag = true;
- }
- }
- else
- {
- // Keep old vector
- copy(nextPopulation[r0], currentPopulation[r0]);
- }
- }
- numFun += populationSize;
-
- // Update best vector
- if (updateFlag)
- {
- copy(x, nextPopulation[best]);
- }
-
- // Switch pointers
- swap = currentPopulation;
- currentPopulation = nextPopulation;
- nextPopulation = swap;
-
- return updateFlag;
- }
-
- // Determine vector with smallest cost in current population
- private void findSmallestCost()
- {
- int best = 0;
- fx = costs[0];
-
- for (int i = 1; i < populationSize; i++)
- {
- if (costs[i] < fx)
- {
- fx = costs[i];
- best = i;
- }
- }
- copy(x, currentPopulation[best]);
- }
-
- // draw random integer in the range from 0 to n-1
- private int randomInteger(int n)
- {
- return rng.nextInt(n);
- }
-}
-
-
diff --git a/LibrarySource/pal/math/ErrorFunction.java b/LibrarySource/pal/math/ErrorFunction.java
deleted file mode 100644
index b0b81f4..0000000
--- a/LibrarySource/pal/math/ErrorFunction.java
+++ /dev/null
@@ -1,104 +0,0 @@
-// ErrorFunction.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.math;
-
-
-/**
- * error function and related stuff
- *
- * @version $Id: ErrorFunction.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class ErrorFunction
-{
- //
- // Public stuff
- //
-
- /**
- * error function
- *
- * @param x argument
- *
- * @return function value
- */
- public static double erf(double x)
- {
- if (x > 0.0)
- {
- return GammaFunction.incompleteGammaP(0.5, x*x);
- }
- else if (x < 0.0)
- {
- return -GammaFunction.incompleteGammaP(0.5, x*x);
- }
- else
- {
- return 0.0;
- }
- }
-
- /**
- * complementary error function = 1-erf(x)
- *
- * @param x argument
- *
- * @return function value
- */
- public static double erfc(double x)
- {
- return 1.0-erf(x);
- }
-
-
- /**
- * inverse error function
- *
- * @param z argument
- *
- * @return function value
- */
- public static double inverseErf(double z)
- {
- return pointNormal(0.5*z+0.5)/Math.sqrt(2.0);
- }
-
-
- // Private
-
- // Returns z so that Prob{x<z}=prob where x ~ N(0,1) and (1e-12) < prob<1-(1e-12)
- private static double pointNormal(double prob)
- {
- // Odeh RE & Evans JO (1974) The percentage points of the normal distribution.
- // Applied Statistics 22: 96-97 (AS70)
-
- // Newer methods:
- // Wichura MJ (1988) Algorithm AS 241: the percentage points of the
- // normal distribution. 37: 477-484.
- // Beasley JD & Springer SG (1977). Algorithm AS 111: the percentage
- // points of the normal distribution. 26: 118-121.
-
- double a0 = -0.322232431088, a1 = -1, a2 = -0.342242088547, a3 = -0.0204231210245;
- double a4 = -0.453642210148e-4, b0 = 0.0993484626060, b1 = 0.588581570495;
- double b2 = 0.531103462366, b3 = 0.103537752850, b4 = 0.0038560700634;
- double y, z = 0, p = prob, p1;
-
- p1 = (p < 0.5 ? p : 1-p);
- if (p1 < 1e-20)
- {
- new IllegalArgumentException("Argument prob out of range");
- }
-
- y = Math.sqrt(Math.log(1/(p1*p1)));
- z = y + ((((y*a4+a3)*y+a2)*y+a1)*y+a0)/((((y*b4+b3)*y+b2)*y+b1)*y+b0);
- return (p < 0.5 ? -z : z);
- }
-}
-
diff --git a/LibrarySource/pal/math/GammaFunction.java b/LibrarySource/pal/math/GammaFunction.java
deleted file mode 100644
index f94c9b3..0000000
--- a/LibrarySource/pal/math/GammaFunction.java
+++ /dev/null
@@ -1,205 +0,0 @@
-// GammaFunction.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.math;
-
-
-/**
- * gamma function
- *
- * @version $Id: GammaFunction.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class GammaFunction
-{
- //
- // Public stuff
- //
-
-
- // Gamma function
-
- /**
- * log Gamma function: ln(gamma(alpha)) for alpha>0, accurate to 10 decimal places
- *
- * @param alpha argument
- *
- * @param function value
- */
- public static double lnGamma(double alpha)
- {
- // Pike MC & Hill ID (1966) Algorithm 291: Logarithm of the gamma function.
- // Communications of the Association for Computing Machinery, 9:684
-
- double x = alpha, f = 0.0, z;
-
- if (x < 7)
- {
- f = 1;
- z = x-1;
- while (++z < 7)
- {
- f *= z;
- }
- x = z;
- f = -Math.log(f);
- }
- z = 1/(x*x);
-
- return
- f + (x-0.5)*Math.log(x) - x + 0.918938533204673 +
- (((-0.000595238095238*z+0.000793650793651) *
- z-0.002777777777778)*z + 0.083333333333333)/x;
- }
-
- /**
- * Incomplete Gamma function Q(a,x)
- * (a cleanroom implementation of Numerical Recipes gammq(a,x);
- * in Mathematica this function is called GammaRegularized)
- *
- * @param a parameter
- * @param x argument
- *
- * @return function value
- */
- public static double incompleteGammaQ(double a, double x)
- {
- return 1.0 - incompleteGamma(x, a, lnGamma(a));
- }
-
- /**
- * Incomplete Gamma function P(a,x) = 1-Q(a,x)
- * (a cleanroom implementation of Numerical Recipes gammp(a,x);
- * in Mathematica this function is 1-GammaRegularized)
- *
- * @param a parameter
- * @param x argument
- *
- * @return function value
- */
- public static double incompleteGammaP(double a, double x)
- {
- return incompleteGamma(x, a, lnGamma(a));
- }
-
- /**
- * Incomplete Gamma function P(a,x) = 1-Q(a,x)
- * (a cleanroom implementation of Numerical Recipes gammp(a,x);
- * in Mathematica this function is 1-GammaRegularized)
- *
- * @param a parameter
- * @param x argument
- * @param double lnGammaA precomputed lnGamma(a)
- *
- * @return function value
- */
- public static double incompleteGammaP(double a, double x, double lnGammaA)
- {
- return incompleteGamma(x, a, lnGammaA);
- }
-
-
- /**
- * Returns the incomplete gamma ratio I(x,alpha) where x is the upper
- * limit of the integration and alpha is the shape parameter.
- */
- private static double incompleteGamma(double x, double alpha, double ln_gamma_alpha)
- {
- // (1) series expansion if (alpha>x || x<=1)
- // (2) continued fraction otherwise
- // RATNEST FORTRAN by
- // Bhattacharjee GP (1970) The incomplete gamma integral. Applied Statistics,
- // 19: 285-287 (AS32)
-
- int i;
- double p = alpha, g = ln_gamma_alpha;
- double accurate = 1e-8, overflow = 1e30;
- double factor, gin = 0, rn = 0, a = 0,b = 0,an = 0, dif = 0, term = 0;
- double pn0, pn1, pn2, pn3, pn4, pn5;
-
- if (x == 0.0)
- {
- return 0.0;
- }
- if ( x < 0.0 || p <= 0.0)
- {
- throw new IllegalArgumentException("Arguments out of bounds");
- }
-
- factor = Math.exp(p*Math.log(x)-x-g);
-
- if (x > 1 && x >= p)
- {
- // continued fraction
- a = 1-p;
- b = a+x+1;
- term = 0;
- pn0 = 1;
- pn1 = x;
- pn2 = x+1;
- pn3 = x*b;
- gin = pn2/pn3;
-
- do
- {
- a++;
- b += 2;
- term++;
- an = a*term;
- pn4 = b*pn2-an*pn0;
- pn5 = b*pn3-an*pn1;
-
- if (pn5 != 0)
- {
- rn = pn4/pn5;
- dif = Math.abs(gin-rn);
- if (dif <= accurate)
- {
- if (dif <= accurate*rn)
- {
- break;
- }
- }
-
- gin=rn;
- }
- pn0 = pn2;
- pn1 = pn3;
- pn2 = pn4;
- pn3 = pn5;
- if (Math.abs(pn4) >= overflow)
- {
- pn0 /= overflow;
- pn1 /= overflow;
- pn2 /= overflow;
- pn3 /= overflow;
- }
- } while (true);
- gin = 1-factor*gin;
- }
- else
- {
- // series expansion
- gin = 1;
- term = 1;
- rn = p;
- do
- {
- rn++;
- term *= x/rn;
- gin += term;
- }
- while (term > accurate);
- gin *= factor/p;
- }
- return gin;
- }
-
-}
-
diff --git a/LibrarySource/pal/math/GeneralizedDEOptimizer.java b/LibrarySource/pal/math/GeneralizedDEOptimizer.java
deleted file mode 100644
index f9731bc..0000000
--- a/LibrarySource/pal/math/GeneralizedDEOptimizer.java
+++ /dev/null
@@ -1,51 +0,0 @@
-// GeneralizedDEOptimizer.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.math;
-
-
-/**
- * Provides an general interface to the DifferentialEvolution class that is not
- * tied to a certain number of parameters (as DifferentialEvolution is). Works but
- * creating a new DiffentialEvolution engine when presented with a new number of
- * parameters. All the actual optimisation work is handled by DifferentialEvolution.,
- * @author Matthew Goode
- */
-
-
-public class GeneralizedDEOptimizer extends MultivariateMinimum {
-
- private DifferentialEvolution optimiser_;
-
- private int currentNumberOfParameters_ = 0;
-
- public GeneralizedDEOptimizer() {
- }
-
-
-
- /**
- * The actual optimization routine
- * It finds a minimum close to vector x when the
- * absolute tolerance for each parameter is specified.
- *
- * @param f multivariate function
- * @param xvec initial guesses for the minimum
- * (contains the location of the minimum on return)
- * @param tolfx absolute tolerance of function value
- * @param tolx absolute tolerance of each parameter
- */
- public void optimize(MultivariateFunction f, double[] xvec, double tolfx, double tolx) {
- if(optimiser_==null||xvec.length!=currentNumberOfParameters_) {
- optimiser_ = new DifferentialEvolution(xvec.length);
- this.currentNumberOfParameters_= xvec.length;
- }
- optimiser_.optimize(f,xvec,tolfx, tolx);
- }
-
-}
-
diff --git a/LibrarySource/pal/math/LineFunction.java b/LibrarySource/pal/math/LineFunction.java
deleted file mode 100644
index 871889b..0000000
--- a/LibrarySource/pal/math/LineFunction.java
+++ /dev/null
@@ -1,295 +0,0 @@
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.math;
-
-/**
- * converts a multivariate function into a univariate function
- *
- * @author Korbinian Strimmer
- */
-public class LineFunction implements UnivariateFunction
-{
- /**
- * construct univariate function from multivariate function
- *
- * @param func multivariate function
- * @param start start point
- * @param dir direction vector
- */
- public LineFunction(MultivariateFunction func)
- {
- f = func;
-
- dim = f.getNumArguments();
-
- x = new double[dim];
- }
-
- /**
- * update start point and direction
- * (bounds and search direction are NOT checked)
- *
- * @param start new start point
- * @param dir new direction vector
- */
- public void update(double[] start, double[] dir)
- {
- s = start;
- d = dir;
-
- computeBounds();
- }
-
-
- /**
- * get point associated with the one-dimensional parameter
- * (bounds of of multivariate function are NOT checked)
- *
- * @param lambda argument
- * @param p array for coordinates of corresponding point
- */
- public void getPoint(double lambda, double[] p)
- {
- for (int i = 0; i < dim; i++)
- {
- p[i] = s[i] + lambda*d[i];
- }
- }
-
-
- // implementation of UnivariateFunction
-
- /**
- * evaluate f(start+lambda*dir)
- */
- public double evaluate(double lambda)
- {
- getPoint(lambda, x);
-
- return f.evaluate(x);
- }
-
- public double getLowerBound()
- {
- return lowerBound;
- }
-
- public double getUpperBound()
- {
- return upperBound;
- }
-
- /**
- * find parameter lambda within the given bounds
- * that minimizes the univariate function
- * (due to numerical inaccuaries it may happen
- * that getPoint for the returned lambda produces
- * a point that lies
- * slightly out of bounds)
- *
- * @return lambda that achieves minimum
- */
- public double findMinimum()
- {
- if (um == null)
- {
- um = new UnivariateMinimum();
- }
- return um.findMinimum(this);
- }
-
-
- /**
- * get parameter that limits the upper bound
- *
- * @return parameter number
- */
- public int getUpperBoundParameter()
- {
- return upperBoundParam;
- }
-
- /**
- * get parameter that limits the lower bound
- *
- * @return parameter number
- */
- public int getLowerBoundParameter()
- {
- return lowerBoundParam;
- }
-
-
- /**
- * check (and modify, if necessary) whether a point lies properly
- * within the predefined bounds
- *
- * @param p coordinates of point
- *
- * @return true if p was modified, false otherwise
- */
- public boolean checkPoint(double[] p)
- {
- boolean modified = false;
- for (int i = 0; i < dim; i++)
- {
- if (p[i] < f.getLowerBound(i))
- {
- p[i] = f.getLowerBound(i);
- modified = true;
- }
- if (p[i] > f.getUpperBound(i))
- {
- p[i] = f.getUpperBound(i);
- modified = true;
- }
- }
-
- return modified;
- }
-
- /**
- * determine active variables at a point p and corresponding
- * gradient grad (if a component of p lies on a border and
- * the corresponding component of the gradient points
- * out of the border the variable is considered inactive)
- *
- * @param p coordinates of point
- * @param grad gradient at that point
- * @param list of active variables (on return)
- *
- * @return number of active variables
- */
- public int checkVariables(double[] p, double[] grad, boolean[] active)
- {
- // this seems to be a reasonable small value
- double EPS = MachineAccuracy.SQRT_EPSILON;
-
- int numActive = 0;
- for (int i = 0; i < dim; i++)
- {
- active[i] = true;
- if (p[i] <= f.getLowerBound(i)+EPS)
- {
- // no search towards lower boundary
- if (grad[i] > 0)
- {
- active[i] = false;
- }
- }
- else if (p[i] >= f.getUpperBound(i)-EPS)
- {
- // no search towards upper boundary
- if (grad[i] < 0)
- {
- active[i] = false;
- }
- }
- else
- {
- numActive++;
- }
- }
-
- return numActive;
- }
-
- /**
- * check direction vector. If it points out of the defined
- * area at a point at the boundary the corresponding component
- * of the direction vector is set to zero.
- *
- * @param p coordinates of point
- * @param dir direction vector at that point
- *
- * @return number of changed components in direction vector
- */
- public int checkDirection(double[] p, double[] dir)
- {
- // this seems to be a reasonable small value
- double EPS = MachineAccuracy.SQRT_EPSILON;
-
- int numChanged = 0;
- for (int i = 0; i < dim; i++)
- {
- if (p[i] <= f.getLowerBound(i)+EPS)
- {
- // no search towards lower boundary
- if (dir[i] < 0)
- {
- dir[i] = 0;
- numChanged++;
- }
- }
- else if (p[i] >= f.getUpperBound(i)-EPS)
- {
- // no search towards upper boundary
- if (dir[i] > 0)
- {
- dir[i] = 0;
- numChanged++;
- }
- }
- }
-
- return numChanged;
- }
-
-
- //
- // Private stuff
- //
-
- private MultivariateFunction f;
- private int lowerBoundParam, upperBoundParam;
- private int dim;
- private double lowerBound, upperBound;
- private double[] s, d, x, min, max;
- private UnivariateMinimum um = null;
-
- private void computeBounds()
- {
- boolean firstVisit = true;
- for (int i = 0; i < dim; i++)
- {
- if (d[i] != 0)
- {
- double upper = (f.getUpperBound(i) - s[i])/d[i];
- double lower = (f.getLowerBound(i) - s[i])/d[i];
- if (lower > upper)
- {
- double tmp = upper;
- upper = lower;
- lower = tmp;
- }
-
- if (firstVisit)
- {
- lowerBound = lower;
- lowerBoundParam = i;
- upperBound = upper;
- upperBoundParam = i;
- firstVisit = false;
- }
- else
- {
- if (lower > lowerBound)
- {
- lowerBound = lower;
- lowerBoundParam = i;
- }
- if (upper < upperBound)
- {
- upperBound = upper;
- upperBoundParam = i;
- }
- }
- }
- }
- }
-}
-
diff --git a/LibrarySource/pal/math/MFWithGradient.java b/LibrarySource/pal/math/MFWithGradient.java
deleted file mode 100644
index b07dc25..0000000
--- a/LibrarySource/pal/math/MFWithGradient.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// MFWithGradient.java
-//
-// (c) 2000-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.math;
-
-
-/**
- * interface for a function of several variables with a gradient
- *
- * @version $Id: MFWithGradient.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public interface MFWithGradient extends MultivariateFunction
-{
- /**
- * compute both function value and gradient at a point
- *
- * @param argument function argument (vector)
- * @param gradient gradient (on return)
- *
- * @return function value
- */
- double evaluate(double[] argument, double[] gradient);
-
- /**
- * compute gradient at a point
- *
- * @param argument function argument (vector)
- * @param gradient gradient (on return)
- */
- void computeGradient(double[] argument, double[] gradient);
-}
-
diff --git a/LibrarySource/pal/math/MachineAccuracy.java b/LibrarySource/pal/math/MachineAccuracy.java
deleted file mode 100644
index a3ad129..0000000
--- a/LibrarySource/pal/math/MachineAccuracy.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// MachineAccuracy.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.math;
-
-
-/**
- * determines machine accuracy
- *
- * @version $Id: MachineAccuracy.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class MachineAccuracy
-{
- //
- // Public stuff
- //
-
- /** machine accuracy constant */
- public static double EPSILON = 2.220446049250313E-16;
-
- public static double SQRT_EPSILON = 1.4901161193847656E-8;
- public static double SQRT_SQRT_EPSILON = 1.220703125E-4;
-
- /** compute EPSILON from scratch */
- public static double computeEpsilon()
- {
- double eps = 1.0;
-
- while( eps + 1.0 != 1.0 )
- {
- eps /= 2.0;
- }
- eps *= 2.0;
-
- return eps;
- }
-}
-
diff --git a/LibrarySource/pal/math/MathUtils.java b/LibrarySource/pal/math/MathUtils.java
deleted file mode 100644
index f8f1de1..0000000
--- a/LibrarySource/pal/math/MathUtils.java
+++ /dev/null
@@ -1,67 +0,0 @@
-// MathUtils.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.math;
-
-
-/**
- * Handy utility functions which have some Mathematical relavance.
- *
- * @author Matthew Goode
- * @author Alexei Drummon
- *
- * @version $Id: MathUtils.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- */
-
-
-public class MathUtils {
-
- public MathUtils() {}
-
- /**
- * A random number generator that is initialized with the clock when this
- * class is loaded into the JVM. Use this for all random numbers.
- */
- public static MersenneTwisterFast random = new MersenneTwisterFast();
-
- /**
- * @return a new double array where all the values sum to 1.
- * Relative ratios are preserved.
- */
- public static final double[] getNormalized(double[] array) {
- double[] newArray = new double[array.length];
- double total = getTotal(array);
- for(int i = 0 ; i < array.length ; i++) {
- newArray[i] = array[i]/total;
- }
- return newArray;
- }
-
- /**
- * @param end the index of the element after the last one to be included
- * @return the total of a the values in a range of an array
- */
- public static final double getTotal(double[] array, int start, int end) {
- double total = 0.0;
- for(int i = start ; i < array.length ; i++) {
- total+=array[i];
- }
- return total;
- }
-
- /**
- * @return the total of the values in an array
- */
- public static final double getTotal(double[] array) {
- return getTotal(array,0, array.length);
-
- }
-
-
-}
-
diff --git a/LibrarySource/pal/math/MersenneTwisterFast.java b/LibrarySource/pal/math/MersenneTwisterFast.java
deleted file mode 100644
index 9352c55..0000000
--- a/LibrarySource/pal/math/MersenneTwisterFast.java
+++ /dev/null
@@ -1,771 +0,0 @@
-// MersenneTwisterFast.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-
-// Original file MersenneTwisterFast.java
-// (c) 1999-2000 by Michael Lecuyer and Sean Luke
-// see also http://www.cs.umd.edu/users/seanl/
-
-
-package pal.math;
-
-import java.io.*;
-import java.util.*;
-
-
-/**
- * MersenneTwisterFast:
- *
- * A simulation quality fast random number generator (MT19937)
- * with the same public methods as java.util.Random.
-
- * <p>About the Mersenne Twister.
- * This is a Java version of the C-program for MT19937: Integer version.
- * next(32) generates one pseudorandom unsigned integer (32bit)
- * which is uniformly distributed among 0 to 2^32-1 for each
- * call. next(int bits) >>>'s by (32-bits) to get a value ranging
- * between 0 and 2^bits-1 long inclusive; hope that's correct.
- * setSeed(seed) set initial values to the working area
- * of 624 words. For setSeed(seed), seed is any 32-bit integer
- * except for 0.
- *<p>
- * Reference.
- * M. Matsumoto and T. Nishimura,
- * "Mersenne Twister: A 623-Dimensionally Equidistributed Uniform
- * Pseudo-Random Number Generator",
- * <i>ACM Transactions on Modeling and Computer Simulation,</i>
- * Vol. 8, No. 1, January 1998, pp 3--30.
- *
- * <p>Bug Fixes. This implementation implements the bug fixes made
- * in Java 1.2's version of Random, which means it can be used with
- * earlier versions of Java. See
- * <a href="http://www.javasoft.com/products/jdk/1.2/docs/api/java/util/Random.html">
- * the JDK 1.2 java.util.Random documentation</a> for further documentation
- * on the random-number generation contracts made. Additionally, there's
- * an undocumented bug in the JDK java.util.Random.nextBytes() method,
- * which this code fixes.
- *
- * <p> Important Note. Just like java.util.Random, this
- * generator accepts a long seed but doesn't use all of it. java.util.Random
- * uses 48 bits. The Mersenne Twister instead uses 32 bits (int size).
- * So it's best if your seed does not exceed the int range.
- *
- * <p><a href="http://www.cs.umd.edu/users/seanl/">Sean Luke's web page</a>
- *
- * <P>
- * - added shuffling method (Alexei Drummond)
- */
-public class MersenneTwisterFast implements Serializable
- {
- // Period parameters
- private static final int N = 624;
- private static final int M = 397;
- private static final int MATRIX_A = 0x9908b0df; // private static final * constant vector a
- private static final int UPPER_MASK = 0x80000000; // most significant w-r bits
- private static final int LOWER_MASK = 0x7fffffff; // least significant r bits
-
-
- // Tempering parameters
- private static final int TEMPERING_MASK_B = 0x9d2c5680;
- private static final int TEMPERING_MASK_C = 0xefc60000;
-
- // #define TEMPERING_SHIFT_U(y) (y >>> 11)
- // #define TEMPERING_SHIFT_S(y) (y << 7)
- // #define TEMPERING_SHIFT_T(y) (y << 15)
- // #define TEMPERING_SHIFT_L(y) (y >>> 18)
-
- private int mt[]; // the array for the state vector
- private int mti; // mti==N+1 means mt[N] is not initialized
- private int mag01[];
-
- // a good initial seed (of int size, though stored in a long)
- private static final long GOOD_SEED = 4357;
-
- private double nextNextGaussian;
- private boolean haveNextNextGaussian;
-
-
- /**
- * Constructor using the time of day as default seed.
- */
- public MersenneTwisterFast()
- {
- this((new Date()).getTime());
- }
-
- /**
- * Constructor using a given seed. Though you pass this seed in
- * as a long, it's best to make sure it's actually an integer.
- *
- * @param seed generator starting number, often the time of day.
- */
- public MersenneTwisterFast(long seed)
- {
- if (seed == 0)
- {
- setSeed(GOOD_SEED);
- }
- else
- {
- setSeed(seed);
- }
- }
-
- /**
- * Returns an array of shuffled indices of length l.
- * @param l length of the array required.
- */
- public int[] shuffled(int l) {
-
- int[] array = new int[l];
-
- // initialize array
- for (int i = 0; i < l; i++) {
- array[i] = i;
- }
-
- for (int i = 0; i < l; i++) {
- int index = nextInt(l-i) + i;
- int temp = array[index];
- array[index] = array[i];
- array[i] = temp;
- }
-
- return array;
- }
-
- /**
- * Initalize the pseudo random number generator.
- * The Mersenne Twister only uses an integer for its seed;
- * It's best that you don't pass in a long that's bigger
- * than an int.
- *
- * @param seed from constructor
- *
- */
- public final void setSeed(long seed)
- {
- haveNextNextGaussian = false;
-
- mt = new int[N];
-
- // setting initial seeds to mt[N] using
- // the generator Line 25 of Table 1 in
- // [KNUTH 1981, The Art of Computer Programming
- // Vol. 2 (2nd Ed.), pp102]
-
- // the 0xffffffff is commented out because in Java
- // ints are always 32 bits; hence i & 0xffffffff == i
-
- mt[0]= ((int)seed); // & 0xffffffff;
-
- for (mti = 1; mti < N; mti++)
- mt[mti] = (69069 * mt[mti-1]); //& 0xffffffff;
-
- // mag01[x] = x * MATRIX_A for x=0,1
- mag01 = new int[2];
- mag01[0] = 0x0;
- mag01[1] = MATRIX_A;
- }
-
- public final int nextInt()
- {
- int y;
-
- if (mti >= N) // generate N words at one time
- {
- int kk;
-
- for (kk = 0; kk < N - M; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- for (; kk < N-1; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (y >>> 1) ^ mag01[y & 0x1];
-
- mti = 0;
- }
-
- y = mt[mti++];
- y ^= y >>> 11; // TEMPERING_SHIFT_U(y)
- y ^= (y << 7) & TEMPERING_MASK_B; // TEMPERING_SHIFT_S(y)
- y ^= (y << 15) & TEMPERING_MASK_C; // TEMPERING_SHIFT_T(y)
- y ^= (y >>> 18); // TEMPERING_SHIFT_L(y)
-
- return y;
- }
-
-
-
- public final short nextShort()
- {
- int y;
-
- if (mti >= N) // generate N words at one time
- {
- int kk;
-
- for (kk = 0; kk < N - M; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- for (; kk < N-1; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (y >>> 1) ^ mag01[y & 0x1];
-
- mti = 0;
- }
-
- y = mt[mti++];
- y ^= y >>> 11; // TEMPERING_SHIFT_U(y)
- y ^= (y << 7) & TEMPERING_MASK_B; // TEMPERING_SHIFT_S(y)
- y ^= (y << 15) & TEMPERING_MASK_C; // TEMPERING_SHIFT_T(y)
- y ^= (y >>> 18); // TEMPERING_SHIFT_L(y)
-
- return (short)(y >>> 16);
- }
-
-
-
- public final char nextChar()
- {
- int y;
-
- if (mti >= N) // generate N words at one time
- {
- int kk;
-
- for (kk = 0; kk < N - M; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- for (; kk < N-1; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (y >>> 1) ^ mag01[y & 0x1];
-
- mti = 0;
- }
-
- y = mt[mti++];
- y ^= y >>> 11; // TEMPERING_SHIFT_U(y)
- y ^= (y << 7) & TEMPERING_MASK_B; // TEMPERING_SHIFT_S(y)
- y ^= (y << 15) & TEMPERING_MASK_C; // TEMPERING_SHIFT_T(y)
- y ^= (y >>> 18); // TEMPERING_SHIFT_L(y)
-
- return (char)(y >>> 16);
- }
-
-
- public final boolean nextBoolean()
- {
- int y;
-
- if (mti >= N) // generate N words at one time
- {
- int kk;
-
- for (kk = 0; kk < N - M; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- for (; kk < N-1; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (y >>> 1) ^ mag01[y & 0x1];
-
- mti = 0;
- }
-
- y = mt[mti++];
- y ^= y >>> 11; // TEMPERING_SHIFT_U(y)
- y ^= (y << 7) & TEMPERING_MASK_B; // TEMPERING_SHIFT_S(y)
- y ^= (y << 15) & TEMPERING_MASK_C; // TEMPERING_SHIFT_T(y)
- y ^= (y >>> 18); // TEMPERING_SHIFT_L(y)
-
- return (boolean)((y >>> 31) != 0);
- }
-
-
- public final byte nextByte()
- {
- int y;
-
- if (mti >= N) // generate N words at one time
- {
- int kk;
-
- for (kk = 0; kk < N - M; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- for (; kk < N-1; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (y >>> 1) ^ mag01[y & 0x1];
-
- mti = 0;
- }
-
- y = mt[mti++];
- y ^= y >>> 11; // TEMPERING_SHIFT_U(y)
- y ^= (y << 7) & TEMPERING_MASK_B; // TEMPERING_SHIFT_S(y)
- y ^= (y << 15) & TEMPERING_MASK_C; // TEMPERING_SHIFT_T(y)
- y ^= (y >>> 18); // TEMPERING_SHIFT_L(y)
-
- return (byte)(y >>> 24);
- }
-
-
- public final void nextBytes(byte[] bytes)
- {
- int y;
-
- for (int x=0;x<bytes.length;x++)
- {
- if (mti >= N) // generate N words at one time
- {
- int kk;
-
- for (kk = 0; kk < N - M; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- for (; kk < N-1; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (y >>> 1) ^ mag01[y & 0x1];
-
- mti = 0;
- }
-
- y = mt[mti++];
- y ^= y >>> 11; // TEMPERING_SHIFT_U(y)
- y ^= (y << 7) & TEMPERING_MASK_B; // TEMPERING_SHIFT_S(y)
- y ^= (y << 15) & TEMPERING_MASK_C; // TEMPERING_SHIFT_T(y)
- y ^= (y >>> 18); // TEMPERING_SHIFT_L(y)
-
- bytes[x] = (byte)(y >>> 24);
- }
- }
-
-
- public final long nextLong()
- {
- int y;
- int z;
-
- if (mti >= N) // generate N words at one time
- {
- int kk;
-
- for (kk = 0; kk < N - M; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- for (; kk < N-1; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (y >>> 1) ^ mag01[y & 0x1];
-
- mti = 0;
- }
-
- y = mt[mti++];
- y ^= y >>> 11; // TEMPERING_SHIFT_U(y)
- y ^= (y << 7) & TEMPERING_MASK_B; // TEMPERING_SHIFT_S(y)
- y ^= (y << 15) & TEMPERING_MASK_C; // TEMPERING_SHIFT_T(y)
- y ^= (y >>> 18); // TEMPERING_SHIFT_L(y)
-
- if (mti >= N) // generate N words at one time
- {
- int kk;
-
- for (kk = 0; kk < N - M; kk++)
- {
- z = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (z >>> 1) ^ mag01[z & 0x1];
- }
- for (; kk < N-1; kk++)
- {
- z = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (z >>> 1) ^ mag01[z & 0x1];
- }
- z = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (z >>> 1) ^ mag01[z & 0x1];
-
- mti = 0;
- }
-
- z = mt[mti++];
- z ^= z >>> 11; // TEMPERING_SHIFT_U(z)
- z ^= (z << 7) & TEMPERING_MASK_B; // TEMPERING_SHIFT_S(z)
- z ^= (z << 15) & TEMPERING_MASK_C; // TEMPERING_SHIFT_T(z)
- z ^= (z >>> 18); // TEMPERING_SHIFT_L(z)
-
- return (((long)y) << 32) + (long)z;
- }
-
-
- public final double nextDouble()
- {
- int y;
- int z;
-
- if (mti >= N) // generate N words at one time
- {
- int kk;
-
- for (kk = 0; kk < N - M; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- for (; kk < N-1; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (y >>> 1) ^ mag01[y & 0x1];
-
- mti = 0;
- }
-
- y = mt[mti++];
- y ^= y >>> 11; // TEMPERING_SHIFT_U(y)
- y ^= (y << 7) & TEMPERING_MASK_B; // TEMPERING_SHIFT_S(y)
- y ^= (y << 15) & TEMPERING_MASK_C; // TEMPERING_SHIFT_T(y)
- y ^= (y >>> 18); // TEMPERING_SHIFT_L(y)
-
- if (mti >= N) // generate N words at one time
- {
- int kk;
-
- for (kk = 0; kk < N - M; kk++)
- {
- z = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (z >>> 1) ^ mag01[z & 0x1];
- }
- for (; kk < N-1; kk++)
- {
- z = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (z >>> 1) ^ mag01[z & 0x1];
- }
- z = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (z >>> 1) ^ mag01[z & 0x1];
-
- mti = 0;
- }
-
- z = mt[mti++];
- z ^= z >>> 11; // TEMPERING_SHIFT_U(z)
- z ^= (z << 7) & TEMPERING_MASK_B; // TEMPERING_SHIFT_S(z)
- z ^= (z << 15) & TEMPERING_MASK_C; // TEMPERING_SHIFT_T(z)
- z ^= (z >>> 18); // TEMPERING_SHIFT_L(z)
-
- /* derived from nextDouble documentation in jdk 1.2 docs, see top */
- return ((((long)(y >>> 6)) << 27) + (z >>> 5)) / (double)(1L << 53);
- }
-
-
-
-
-
- public final double nextGaussian()
- {
- if (haveNextNextGaussian)
- {
- haveNextNextGaussian = false;
- return nextNextGaussian;
- }
- else
- {
- double v1, v2, s;
- do
- {
- int y;
- int z;
- int a;
- int b;
-
- if (mti >= N) // generate N words at one time
- {
- int kk;
-
- for (kk = 0; kk < N - M; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- for (; kk < N-1; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (y >>> 1) ^ mag01[y & 0x1];
-
- mti = 0;
- }
-
- y = mt[mti++];
- y ^= y >>> 11; // TEMPERING_SHIFT_U(y)
- y ^= (y << 7) & TEMPERING_MASK_B; // TEMPERING_SHIFT_S(y)
- y ^= (y << 15) & TEMPERING_MASK_C; // TEMPERING_SHIFT_T(y)
- y ^= (y >>> 18); // TEMPERING_SHIFT_L(y)
-
- if (mti >= N) // generate N words at one time
- {
- int kk;
-
- for (kk = 0; kk < N - M; kk++)
- {
- z = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (z >>> 1) ^ mag01[z & 0x1];
- }
- for (; kk < N-1; kk++)
- {
- z = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (z >>> 1) ^ mag01[z & 0x1];
- }
- z = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (z >>> 1) ^ mag01[z & 0x1];
-
- mti = 0;
- }
-
- z = mt[mti++];
- z ^= z >>> 11; // TEMPERING_SHIFT_U(z)
- z ^= (z << 7) & TEMPERING_MASK_B; // TEMPERING_SHIFT_S(z)
- z ^= (z << 15) & TEMPERING_MASK_C; // TEMPERING_SHIFT_T(z)
- z ^= (z >>> 18); // TEMPERING_SHIFT_L(z)
-
- if (mti >= N) // generate N words at one time
- {
- int kk;
-
- for (kk = 0; kk < N - M; kk++)
- {
- a = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (a >>> 1) ^ mag01[a & 0x1];
- }
- for (; kk < N-1; kk++)
- {
- a = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (a >>> 1) ^ mag01[a & 0x1];
- }
- a = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (a >>> 1) ^ mag01[a & 0x1];
-
- mti = 0;
- }
-
- a = mt[mti++];
- a ^= a >>> 11; // TEMPERING_SHIFT_U(a)
- a ^= (a << 7) & TEMPERING_MASK_B; // TEMPERING_SHIFT_S(a)
- a ^= (a << 15) & TEMPERING_MASK_C; // TEMPERING_SHIFT_T(a)
- a ^= (a >>> 18); // TEMPERING_SHIFT_L(a)
-
- if (mti >= N) // generate N words at one time
- {
- int kk;
-
- for (kk = 0; kk < N - M; kk++)
- {
- b = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (b >>> 1) ^ mag01[b & 0x1];
- }
- for (; kk < N-1; kk++)
- {
- b = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (b >>> 1) ^ mag01[b & 0x1];
- }
- b = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (b >>> 1) ^ mag01[b & 0x1];
-
- mti = 0;
- }
-
- b = mt[mti++];
- b ^= b >>> 11; // TEMPERING_SHIFT_U(b)
- b ^= (b << 7) & TEMPERING_MASK_B; // TEMPERING_SHIFT_S(b)
- b ^= (b << 15) & TEMPERING_MASK_C; // TEMPERING_SHIFT_T(b)
- b ^= (b >>> 18); // TEMPERING_SHIFT_L(b)
-
- /* derived from nextDouble documentation in jdk 1.2 docs, see top */
- v1 = 2 *
- (((((long)(y >>> 6)) << 27) + (z >>> 5)) / (double)(1L << 53))
- - 1;
- v2 = 2 * (((((long)(a >>> 6)) << 27) + (b >>> 5)) / (double)(1L << 53))
- - 1;
- s = v1 * v1 + v2 * v2;
- } while (s >= 1);
- double multiplier = Math.sqrt(-2 * Math.log(s)/s);
- nextNextGaussian = v2 * multiplier;
- haveNextNextGaussian = true;
- return v1 * multiplier;
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
- public final float nextFloat()
- {
- int y;
-
- if (mti >= N) // generate N words at one time
- {
- int kk;
-
- for (kk = 0; kk < N - M; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- for (; kk < N-1; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (y >>> 1) ^ mag01[y & 0x1];
-
- mti = 0;
- }
-
- y = mt[mti++];
- y ^= y >>> 11; // TEMPERING_SHIFT_U(y)
- y ^= (y << 7) & TEMPERING_MASK_B; // TEMPERING_SHIFT_S(y)
- y ^= (y << 15) & TEMPERING_MASK_C; // TEMPERING_SHIFT_T(y)
- y ^= (y >>> 18); // TEMPERING_SHIFT_L(y)
-
- return (y >>> 8) / ((float)(1 << 24));
- }
-
-
-
- /** Returns an integer drawn uniformly from 0 to n-1. Suffice it to say,
- n must be > 0, or an IllegalArgumentException is raised. */
- public int nextInt(int n)
- {
- if (n<=0)
- throw new IllegalArgumentException("n must be positive");
-
- if ((n & -n) == n) // i.e., n is a power of 2
- {
- int y;
-
- if (mti >= N) // generate N words at one time
- {
- int kk;
-
- for (kk = 0; kk < N - M; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- for (; kk < N-1; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (y >>> 1) ^ mag01[y & 0x1];
-
- mti = 0;
- }
-
- y = mt[mti++];
- y ^= y >>> 11; // TEMPERING_SHIFT_U(y)
- y ^= (y << 7) & TEMPERING_MASK_B; // TEMPERING_SHIFT_S(y)
- y ^= (y << 15) & TEMPERING_MASK_C; // TEMPERING_SHIFT_T(y)
- y ^= (y >>> 18); // TEMPERING_SHIFT_L(y)
-
- return (int)((n * (long) (y >>> 1) ) >> 31);
- }
-
- int bits, val;
- do
- {
- int y;
-
- if (mti >= N) // generate N words at one time
- {
- int kk;
-
- for (kk = 0; kk < N - M; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+M] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- for (; kk < N-1; kk++)
- {
- y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
- mt[kk] = mt[kk+(M-N)] ^ (y >>> 1) ^ mag01[y & 0x1];
- }
- y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
- mt[N-1] = mt[M-1] ^ (y >>> 1) ^ mag01[y & 0x1];
-
- mti = 0;
- }
-
- y = mt[mti++];
- y ^= y >>> 11; // TEMPERING_SHIFT_U(y)
- y ^= (y << 7) & TEMPERING_MASK_B; // TEMPERING_SHIFT_S(y)
- y ^= (y << 15) & TEMPERING_MASK_C; // TEMPERING_SHIFT_T(y)
- y ^= (y >>> 18); // TEMPERING_SHIFT_L(y)
-
- bits = (y >>> 1);
- val = bits % n;
- } while(bits - val + (n-1) < 0);
- return val;
- }
-
- }
-
diff --git a/LibrarySource/pal/math/MultivariateFunction.java b/LibrarySource/pal/math/MultivariateFunction.java
deleted file mode 100644
index 327118d..0000000
--- a/LibrarySource/pal/math/MultivariateFunction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// MultivariateFunction.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.math;
-
-
-/**
- * interface for a function of several variables
- *
- * @author Korbinian Strimmer
- */
-public interface MultivariateFunction
-{
- /**
- * compute function value
- *
- * @param argument function argument (vector)
- *
- * @return function value
- */
- double evaluate(double[] argument);
-
-
- /**
- * get number of arguments
- *
- * @return number of arguments
- */
- int getNumArguments();
-
- /**
- * get lower bound of argument n
- *
- * @param n argument number
- *
- * @return lower bound
- */
- double getLowerBound(int n);
-
- /**
- * get upper bound of argument n
- *
- * @param n argument number
- *
- * @return upper bound
- */
- double getUpperBound(int n);
-}
-
diff --git a/LibrarySource/pal/math/MultivariateMinimum.java b/LibrarySource/pal/math/MultivariateMinimum.java
deleted file mode 100644
index b242541..0000000
--- a/LibrarySource/pal/math/MultivariateMinimum.java
+++ /dev/null
@@ -1,218 +0,0 @@
-// MultivariateMinimum.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-
-package pal.math;
-
-
-/**
- * abstract base class for minimisation of a multivariate function
- *
- * @author Korbinian Strimmer
- */
-public abstract class MultivariateMinimum
-{
- //
- // Public stuff
- //
-
- /** total number of function evaluations necessary */
- public int numFun;
-
- /**
- * maxFun is the maximum number of calls to fun allowed.
- * the default value of 0 indicates no limit on the number
- * of calls.
- */
- public int maxFun = 0;
-
- /**
- * numFuncStops is the number of consecutive positive
- * evaluations of the stop criterion based on function evaluation
- * necessary to cause the abortion of the optimization
- * (default is 4)
- */
- public int numFuncStops = 4;
-
-
- /**
- * Find minimum close to vector x
- *
- * @param f multivariate function
- * @param xvec initial guesses for the minimum
- * (contains the location of the minimum on return)
- *
- * @return minimal function value
- */
- public double findMinimum(MultivariateFunction f, double[] xvec)
- {
- optimize(f, xvec, MachineAccuracy.EPSILON, MachineAccuracy.EPSILON);
-
- return f.evaluate(xvec);
- }
-
- /**
- * Find minimum close to vector x
- * (desired fractional digits for each parameter is specified)
- *
- * @param f multivariate function
- * @param xvec initial guesses for the minimum
- * (contains the location of the minimum on return)
- * @param fxFracDigits desired fractional digits in the function value
- * @param xFracDigits desired fractional digits in parameters x
- *
- * @return minimal function value
- */
- public double findMinimum(MultivariateFunction f, double[] xvec,
- int fxFracDigits, int xFracDigits)
- {
- double tolfx = Math.pow(10, -1-fxFracDigits);
- double tolx = Math.pow(10, -1-xFracDigits);
-
- optimize(f, xvec, tolfx, tolx);
-
- // trim x
- double m = Math.pow(10, xFracDigits);
- for (int i = 0; i < xvec.length; i++)
- {
- xvec[i] = Math.round(xvec[i]*m)/m;
- }
-
- // trim fx
- return Math.round(f.evaluate(xvec)*m)/m;
- }
-
- /**
- * The actual optimization routine
- * (needs to be implemented in a subclass of MultivariateMinimum).
- * It finds a minimum close to vector x when the
- * absolute tolerance for each parameter is specified.
- *
- * @param f multivariate function
- * @param xvec initial guesses for the minimum
- * (contains the location of the minimum on return)
- * @param tolfx absolute tolerance of function value
- * @param tolx absolute tolerance of each parameter
- */
- public abstract void optimize(MultivariateFunction f, double[] xvec, double tolfx, double tolx);
-
-
- /**
- * Checks whether optimization should stop
- *
- * @param fx current function value
- * @param x current values of function parameters
- * @param tolfx absolute tolerance of function value
- * @param tolx absolute tolerance of each parameter
- * @param firstCall needs to be set to true when this routine is first called
- * otherwise it should be set to false
- *
- * @return true if either x and its previous value are sufficiently similar
- * or if fx and its previous values are sufficiently similar
- * (test on function value has to be succesful numFuncStops consecutive
- * times)
- */
- public boolean stopCondition(double fx, double[] x, double tolfx,
- double tolx, boolean firstCall)
- {
- boolean stop = false;
-
- if (firstCall)
- {
- countFuncStops = 0;
- fxold = fx;
- xold = new double[x.length];
- copy(xold, x);
- }
- else
- {
- if (xStop(x, xold, tolx))
- {
- stop = true;
- }
- else
- {
- if (fxStop(fx, fxold, tolfx))
- {
- countFuncStops++;
- }
- else
- {
- countFuncStops = 0;
- }
-
- if (countFuncStops >= numFuncStops)
- {
- stop = true;
- }
- }
- }
-
- if (!stop)
- {
- fxold = fx;
- copy(xold, x);
- }
-
- return stop;
- }
-
-
- /**
- * Copy source vector into target vector
- *
- * @param target parameter array
- * @param source parameter array
- */
- public void copy(double[] target, double[] source)
- {
- for (int i = 0; i < source.length; i++)
- {
- target[i] = source[i];
- }
- }
-
- //
- // Private stuff
- //
-
- // number of fStops
- private int countFuncStops;
-
- // old function and parameter values
- private double fxold;
- private double[] xold;
-
- private boolean xStop(double[] x, double[] xold, double tolx)
- {
- boolean stop = true;
-
- for (int i = 0; i < x.length && stop == true; i++)
- {
- if (Math.abs(x[i]-xold[i]) > tolx)
- {
- stop = false;
- }
- }
-
- return stop;
- }
-
- private boolean fxStop(double fx, double fxold, double tolfx)
- {
- if (Math.abs(fx-fxold) > tolfx)
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-}
-
diff --git a/LibrarySource/pal/math/NumericalDerivative.java b/LibrarySource/pal/math/NumericalDerivative.java
deleted file mode 100644
index 3d829a4..0000000
--- a/LibrarySource/pal/math/NumericalDerivative.java
+++ /dev/null
@@ -1,138 +0,0 @@
-// NumericalDerivative.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-// Known bugs and limitations:
-// - the sparse number of function evaluations used can potentially
-// lead to strong inaccuracies if the function is ill-behaved
-
-
-package pal.math;
-
-
-/**
- * approximates numerically the first and second derivatives of a
- * function of a single variable and approximates gradient and
- * diagonal of Hessian for multivariate functions
- *
- * @author Korbinian Strimmer
- */
-public class NumericalDerivative
-{
- //
- // Public stuff
- //
-
-
- /**
- * determine first derivative
- *
- * @param f univariate function
- * @param x argument
- *
- * @return first derivate at x
- */
- public static double firstDerivative(UnivariateFunction f, double x)
- {
- double h = MachineAccuracy.SQRT_EPSILON*(Math.abs(x) + 1.0);
-
- // Centered first derivative
- return (f.evaluate(x + h) - f.evaluate(x - h))/(2.0*h);
- }
-
- /**
- * determine second derivative
- *
- * @param f univariate function
- * @param x argument
- *
- * @return second derivate at x
- */
- public static double secondDerivative(UnivariateFunction f, double x)
- {
- double h = MachineAccuracy.SQRT_SQRT_EPSILON*(Math.abs(x) + 1.0);
-
- // Centered second derivative
- return (f.evaluate(x + h) - 2.0*f.evaluate(x) + f.evaluate(x - h))/(h*h);
- }
-
-
- /**
- * determine gradient
- *
- * @param f multivariate function
- * @param x argument vector
- *
- * @return gradient at x
- */
- public static double[] gradient(MultivariateFunction f, double[] x)
- {
- double[] result = new double[x.length];
-
- gradient(f, x, result);
-
- return result;
- }
-
- /**
- * determine gradient
- *
- * @param f multivariate function
- * @param x argument vector
- * @param grad vector for gradient
- */
- public static void gradient(MultivariateFunction f, double[] x, double[] grad)
- {
- for (int i = 0; i < f.getNumArguments(); i++)
- {
- double h = MachineAccuracy.SQRT_EPSILON*(Math.abs(x[i]) + 1.0);
-
- double oldx = x[i];
- x[i] = oldx + h;
- double fxplus = f.evaluate(x);
- x[i] = oldx - h;
- double fxminus = f.evaluate(x);
- x[i] = oldx;
-
- // Centered first derivative
- grad[i] = (fxplus-fxminus)/(2.0*h);
- }
- }
-
- /**
- * determine diagonal of Hessian
- *
- * @param f multivariate function
- * @param x argument vector
- *
- * @return vector with diagonal entries of Hessian
- */
- public static double[] diagonalHessian(MultivariateFunction f, double[] x)
- {
- int len = f.getNumArguments();
- double[] result = new double[len];
-
- for (int i = 0; i < len; i++)
- {
- double h = MachineAccuracy.SQRT_SQRT_EPSILON*(Math.abs(x[i]) + 1.0);
-
- double oldx = x[i];
- x[i] = oldx + h;
- double fxplus = f.evaluate(x);
- x[i] = oldx - h;
- double fxminus = f.evaluate(x);
- x[i] = oldx;
- double fx = f.evaluate(x);
-
- // Centered second derivative
- result[i] = (fxplus - 2.0*fx + fxminus)/(h*h);
- }
-
- return result;
- }
-}
-
diff --git a/LibrarySource/pal/math/OrthogonalLineFunction.java b/LibrarySource/pal/math/OrthogonalLineFunction.java
deleted file mode 100644
index d0f27b5..0000000
--- a/LibrarySource/pal/math/OrthogonalLineFunction.java
+++ /dev/null
@@ -1,102 +0,0 @@
-// OrthogonalLineFunction.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.math;
-
-
-/**
- * converts a multivariate function into a univariate function
- * by keeping all but one argument constant
- *
- * @author Korbinian Strimmer
- */
-public class OrthogonalLineFunction implements UnivariateFunction
-{
- /**
- * construct univariate function from multivariate function
- *
- * @param func multivariate function
- */
- public OrthogonalLineFunction(MultivariateFunction func)
- {
- f = func;
- numArgs = f.getNumArguments();
- x = new double[numArgs];
- }
-
- /**
- * set (change) values of all arguments (start values)
- *
- * @param start start values
- */
- public void setAllArguments(double[] start)
- {
- for (int i = 0; i < numArgs; i++)
- {
- x[i] = start[i];
- }
- }
-
- /**
- * set (change) value of a single argument
- * (the one currently active)
- *
- * @param val value of argument
- */
- public void setArgument(double val)
- {
- x[n] = val;
- bak = x[n];
- }
-
-
- /**
- * use only the specified argument in the
- * constructed univariate function
- * and keep all others constant
- *
- * @param num argument number
- */
- public void selectArgument(int num)
- {
- n = num;
- bak = x[n];
- }
-
- // implementation of UnivariateFunction
-
- public double evaluate(double arg)
- {
- x[n] = arg;
- double v = f.evaluate(x);
- x[n] = bak;
-
- return v;
- }
-
- public double getLowerBound()
- {
- return f.getLowerBound(n);
- }
-
- public double getUpperBound()
- {
- return f.getUpperBound(n);
- }
-
-
- //
- // Private stuff
- //
-
- private MultivariateFunction f;
- private int numArgs, n;
- private double bak;
- private double[] s, x;
-}
-
diff --git a/LibrarySource/pal/math/OrthogonalSearch.java b/LibrarySource/pal/math/OrthogonalSearch.java
deleted file mode 100644
index 95100b0..0000000
--- a/LibrarySource/pal/math/OrthogonalSearch.java
+++ /dev/null
@@ -1,80 +0,0 @@
-// OrthogonalSearch.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.math;
-
-
-/**
- * minimization of a real-valued function of
- * several variables without using derivatives, using the simple
- * strategy of optimizing variables one by one.
- *
- * @author Korbinian Strimmer
- */
-public class OrthogonalSearch extends MultivariateMinimum
-{
- //
- // Public stuff
- //
-
- /**
- * Initialization
- */
- public OrthogonalSearch()
- {
- um = new UnivariateMinimum();
- }
-
-
- // implementation of abstract method
-
- public void optimize(MultivariateFunction f, double[] xvec, double tolfx, double tolx)
- {
- numArgs = f.getNumArguments();
-
- numFun = 1;
- double fx = f.evaluate(xvec);
-
- stopCondition(fx, xvec, tolfx, tolx, true);
-
- OrthogonalLineFunction olf = new OrthogonalLineFunction(f);
- olf.setAllArguments(xvec);
-
- while (true)
- {
- for (int i = 0; i < numArgs; i++)
- {
- olf.selectArgument(i);
-
- // Note that we don't use xvec as starting point
- // in the 1d line minimization.
- xvec[i] = um.optimize(olf, tolx);
- olf.setArgument(xvec[i]);
-
- numFun += um.numFun;
- }
- fx = um.fminx;
-
- if (stopCondition(fx, xvec, tolfx, tolx, false) ||
- (maxFun > 0 && numFun > maxFun) ||
- numArgs == 1)
- {
- break;
- }
- }
- }
-
-
- //
- // Private stuff
- //
-
- private UnivariateMinimum um;
- private int numArgs;
-}
-
diff --git a/LibrarySource/pal/math/UnivariateFunction.java b/LibrarySource/pal/math/UnivariateFunction.java
deleted file mode 100644
index 9629154..0000000
--- a/LibrarySource/pal/math/UnivariateFunction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// UnivariateFunction.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.math;
-
-
-/**
- * interface for a function of one variable
- *
- * @author Korbinian Strimmer
- */
-public interface UnivariateFunction
-{
- /**
- * compute function value
- *
- * @param function argument
- *
- * @return function value
- */
- double evaluate(double argument);
-
- /**
- * get lower bound of argument
- *
- * @return lower bound
- */
- double getLowerBound();
-
- /**
- * get upper bound of argument
- *
- * @return upper bound
- */
- double getUpperBound();
-}
-
diff --git a/LibrarySource/pal/math/UnivariateMinimum.java b/LibrarySource/pal/math/UnivariateMinimum.java
deleted file mode 100644
index df241e7..0000000
--- a/LibrarySource/pal/math/UnivariateMinimum.java
+++ /dev/null
@@ -1,479 +0,0 @@
-// UnivariateMinimum.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.math;
-
-
-/**
- * minimization of a real-valued function of one variable
- * without using derivatives.
- *
- * <p>algorithm: Brent's golden section method
- * (Richard P. Brent. 1973. Algorithms for finding zeros and extrema
- * of functions without calculating derivatives. Prentice-Hall.)
- *
- * @version $Id: UnivariateMinimum.java,v 1.7 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class UnivariateMinimum
-{
- //
- // Public stuff
- //
-
- /** last minimum */
- public double minx;
-
- /** function value at minimum */
- public double fminx;
-
- /** curvature at minimum */
- public double f2minx;
-
- /** total number of function evaluations neccessary */
- public int numFun;
-
- /**
- * maximum number of function evaluations
- * (default 0 indicates no limit on calls)
- */
- public int maxFun = 0;
-
- /**
- * Find minimum
- * (first estimate given)
- *
- * @param x first estimate
- * @param f function
- *
- * @return position of minimum
- */
- public double findMinimum(double x, UnivariateFunction f)
- {
- double tol = MachineAccuracy.EPSILON;
-
- return optimize(x, f, tol);
- }
-
- /**
- * Find minimum
- * (first estimate given, desired number of fractional digits specified)
- *
- * @param x first estimate
- * @param f function
- * @param fracDigits desired fractional digits
- *
- * @return position of minimum
- */
- public double findMinimum(double x, UnivariateFunction f, int fracDigits)
- {
- double tol = Math.pow(10, -1-fracDigits);
-
- double optx = optimize(x, f, tol);
-
- //return trim(optx, fracDigits);
- return optx;
- }
-
- /**
- * Find minimum
- * (no first estimate given)
- *
- * @param f function
- *
- * @return position of minimum
- */
- public double findMinimum(UnivariateFunction f)
- {
- double tol = MachineAccuracy.EPSILON;
-
- return optimize(f, tol);
- }
-
- /**
- * Find minimum
- * (no first estimate given, desired number of fractional digits specified)
- *
- * @param f function
- * @param fracDigits desired fractional digits
- *
- * @return position of minimum
- */
- public double findMinimum(UnivariateFunction f, int fracDigits)
- {
- double tol = Math.pow(10, -1-fracDigits);
-
- double optx = optimize(f, tol);
-
- //return trim(optx, fracDigits);
- return optx;
- }
-
- /**
- * The actual optimization routine (Brent's golden section method)
- *
- * @param f univariate function
- * @param tol absolute tolerance of each parameter
- *
- * @return position of minimum
- */
- public double optimize(UnivariateFunction f, double tol)
- {
- numFun = 2;
- double min = f.getLowerBound();
- double max = f.getUpperBound();
-
- return minin(min, max, f.evaluate(min), f.evaluate(max), f, tol);
- }
-
- /**
- * The actual optimization routine (Brent's golden section method)
- *
- * @param x initial guess
- * @param f univariate function
- * @param tol absolute tolerance of each parameter
- *
- * @return position of minimum
- */
- public double optimize(double x, UnivariateFunction f, double tol)
- {
- double[] range = bracketize(f.getLowerBound(), x, f.getUpperBound(), f);
-
- return minin(range[0], range[1], range[2], range[3], f, tol);
- }
-
- //
- // Private stuff
- //
-
- private static final double C = (3.0- Math.sqrt(5.0))/2.0; // = 0.38197
- private static final double GOLD = (Math.sqrt(5.0) + 1.0)/2.0; // = 1.61803
- private static final double delta = 0.01; // Determines second trial point
-
- // trim x to have a specified number of fractional digits
- private double trim(double x, int fracDigits)
- {
- double m = Math.pow(10, fracDigits);
-
- return Math.round(x*m)/m;
- }
-
- private double constrain(double x, boolean toMax, double min, double max)
- {
- if (toMax)
- {
- if (x > max)
- {
- return max;
- }
- else
- {
- return x;
- }
- }
- else
- {
- if (x < min)
- {
- return min;
- }
- else
- {
- return x;
- }
- }
- }
-
- private double[] bracketize(double min, double a, double max, UnivariateFunction f)
- {
- if (min > max)
- {
- throw new IllegalArgumentException("Argument min (" + min +
- ") larger than argument max (" + max + ")");
- }
-
- if (a < min)
- {
- a = min;
- }
- else if (a > max)
- {
- a = max;
- }
-
-
- if (a < min || a > max)
- {
- throw new IllegalArgumentException("Starting point not in given range ("
- + min + ", " + a + ", " + max + ")");
- }
-
-
- // Get second point
- double b;
- if (a - min < max - a)
- {
- b = a + delta*(max - a);
- }
- else
- {
- b = a - delta*(a - min);
- }
-
- numFun = 0;
-
- double fa = f.evaluate(a); numFun++;
- double fb = f.evaluate(b); numFun++;
-
- double tmp;
- if (fb > fa)
- {
- tmp = a; a = b; b = tmp;
- tmp = fa; fa = fb; fb = tmp;
- }
-
- // From here on we always have fa >= fb
- // Our aims is to determine a new point c with fc >= fb
-
- // Direction of search (towards min or towards max)
- boolean searchToMax;
- double ulim;
- if (b > a)
- {
- searchToMax = true;
- ulim = max;
- }
- else
- {
- searchToMax = false;
- ulim = min;
- }
-
- // First guess: default magnification
- double c = b + GOLD * (b - a);
- c = constrain(c, searchToMax, min, max);
- double fc = f.evaluate(c); numFun++;
-
- while (fb > fc)
- {
- // Compute u as minimum of a parabola through a, b, c
- double r = (b - a) * (fb - fc);
- double q = (b - c) * (fb - fa);
- if (q == r)
- {
- q += MachineAccuracy.EPSILON;
- }
- double u = b - ((b - c) * q - (b - a) * r) / 2.0 / (q - r);
- u = constrain(u, searchToMax, min, max);
- double fu = 0; // Don�t evaluate now
-
- boolean magnify = false;
-
- // Check out all possibilities
-
- // u is between b and c
- if ((b - u) * (u - c) > 0)
- {
- fu = f.evaluate(u); numFun++;
-
- // minimum between b and c
- if (fu < fc)
- {
- a = b; b = u;
- fa = fb; fb = fu;
-
- break;
- }
- // minimum between a and u
- else if (fu > fb)
- {
- c = u;
- fc = fu;
-
- break;
- }
-
- magnify = true;
- }
- // u is between c and limit
- else if ((c - u) * (u - ulim) > 0)
- {
- fu = f.evaluate(u); numFun++;
-
- // u is not a minimum
- if (fu < fc)
- {
- b = c; c = u;
- fb = fc; fc = fu;
-
- magnify = true;
- }
- }
- // u equals limit
- else if (u == ulim)
- {
- fu = f.evaluate(u); numFun++;
- }
- // All other cases
- else
- {
- magnify = true;
- }
-
- if (magnify)
- {
- // Next guess: default magnification
- u = c + GOLD * (c - b);
- u = constrain(u, searchToMax, min, max);
- fu = f.evaluate(u); numFun++;
- }
-
- a = b; b = c; c = u;
- fa = fb; fb = fc; fc = fu;
- }
-
- // Once we are here be have a minimum in [a, c]
- double[] result = new double[4];
- result[0] = a;
- result[1] = c;
- result[2] = fa;
- result[3] = fc;
- return result;
- }
-
-
- private double minin(double a, double b, double fa , double fb, UnivariateFunction f, double tol)
- {
- double z, d = 0, e, m, p, q, r, t, u, v, w, fu, fv, fw, fz, tmp;
-
- if (tol <= 0)
- {
- throw new IllegalArgumentException("Nonpositive absolute tolerance tol");
- }
-
- if (a == b)
- {
- minx = a;
- fminx = fa;
-
- f2minx = NumericalDerivative.secondDerivative(f, minx);
-
- return minx;
-
- //throw new IllegalArgumentException("Borders of range not distinct");
- }
-
- if (b < a)
- {
- tmp = a; a = b; b = tmp;
- tmp = fa; fa = fb; fb = tmp;
- }
-
- w = a; fw = fa;
- z = b; fz = fb;
- if (fz > fw) // Exchange z and w
- {
- v = z; z = w; w = v;
- v = fz; fz = fw; fw = v;
- }
- v = w;
- fv = fw;
- e = 0.0;
- while (maxFun == 0 || numFun <= maxFun)
- {
- m = (a + b)*0.5;
- double tol_act = MachineAccuracy.SQRT_EPSILON + tol; // Absolute tolerance
- //double tol_act = MachineAccuracy.SQRT_EPSILON*Math.abs(z) + tol/3; // Actual tolerance
- double tol_act2 = 2.0*tol_act;
- if (Math.abs(z-m) <= tol_act2-(b - a)*0.5)
- {
- break;
- }
- p = q = r = 0.0;
- if (Math.abs(e) > tol_act)
- {
- r = (z-w)*(fz-fv);
- q = (z-v)*(fz-fw);
- p = (z-v)*q-(z-w)*r;
- q = (q-r)*2.0;
- if (q > 0.0)
- {
- p = -p;
- }
- else
- {
- q = -q;
- }
- r = e;
- e = d;
- }
- if (Math.abs(p) < Math.abs(q*r*0.5) && p > (a-z)*q && p < (b-z)*q)
- {
- d = p/q;
- u = z+d;
- if (u-(a) < tol_act2 || (b)-u < tol_act2)
- {
- d = ((z < m) ? tol_act : -tol_act);
- }
- }
- else
- {
- e = ((z < m) ? b : a) - z;
- d = C*e;
- }
- u = z + ((Math.abs(d) >= tol_act) ? d : ((d > 0.0) ? tol_act : -tol_act));
- fu = f.evaluate(u); numFun++;
- if (fu <= fz)
- {
- if (u < z)
- {
- b = z;
- }
- else
- {
- a = z;
- }
- v = w;
- fv = fw;
- w = z;
- fw = fz;
- z = u;
- fz = fu;
- }
- else
- {
- if (u < z)
- {
- a = u;
- }
- else
- {
- b = u;
- }
- if (fu <= fw)
- {
- v = w; fv = fw;
- w = u; fw = fu;
- }
- else if (fu <= fv || v == w)
- {
- v = u;
- fv = fu;
- }
- }
- }
- minx = z;
- fminx = fz;
-
- f2minx = NumericalDerivative.secondDerivative(f, minx);
-
- return z;
- }
-}
-
diff --git a/LibrarySource/pal/math/UrnModel.java b/LibrarySource/pal/math/UrnModel.java
deleted file mode 100644
index a8133bc..0000000
--- a/LibrarySource/pal/math/UrnModel.java
+++ /dev/null
@@ -1,121 +0,0 @@
-// Urn.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.math;
-
-
-/**
- * class for drawing numbers from an urn with and
- * without laying back
- *
- * @version $Id: UrnModel.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class UrnModel implements java.io.Serializable
-{
- //
- // Public stuff
- //
-
- /**
- * create urn model
- *
- * @param n capacity (corresponding to numbers 0..n-1)
- */
- public UrnModel(int n)
- {
- capacity = n;
- isAvailable = new boolean[n];
-
- rng = new MersenneTwisterFast();
-
- reset();
- }
-
- /**
- * draw a number without putting back
- *
- * @return number drawn (random integer between 0..n-1, if empty return -1)
- */
- public int drawDontPutBack()
- {
- if (numNumbers == numDrawn)
- {
- next = -1;
- }
- else
- {
- draw();
-
- isAvailable[next] = false;
- numDrawn++;
- }
-
- return next;
- }
-
- /** refill urn */
- public void reset()
- {
- numNumbers = capacity;
- numDrawn = 0;
-
- for (int i = 0; i < capacity; i++)
- {
- isAvailable[i] = true;
- }
- }
-
- /**
- * draws a number with putting back
- *
- * @return number drawn (random integer between 0..n-1, if empty return -1)
- */
- public int drawPutBack()
- {
- if (numNumbers == numDrawn)
- {
- next = -1;
- }
- else
- {
- draw();
- }
-
- return next;
- }
-
-
- //
- // Private stuff
- //
-
- private int capacity, numNumbers, numDrawn, next;
- private boolean[] isAvailable;
- private MersenneTwisterFast rng;
-
- private void draw()
- {
- // Random integer 0..numNumbers-numDrawn-1
- int i = rng.nextInt(numNumbers-numDrawn);
-
- next = -1;
- int k = -1;
- do
- {
- next++;
- if (isAvailable[next] == true)
- {
- k++;
- }
- }
- while (k != i);
- }
-}
-
diff --git a/LibrarySource/pal/math/makefile b/LibrarySource/pal/math/makefile
deleted file mode 100644
index dca8f11..0000000
--- a/LibrarySource/pal/math/makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-### VARIABLES ###
-
-JIKESOPTS := +P
-GCJOPTS :=
-
-# Always check dependencies
-JIKESOPTS += +M
-
-SRC := $(wildcard *.java)
-CLS := $(patsubst %.java, %.class, $(SRC))
-OBJ := $(patsubst %.class, %.o, $(wildcard *.class))
-
-
-### RULES ###
-
-# Compile Java sources into class files
-%.class: %.java
- jikes $(JIKESOPTS) $<
-
-# Alternative to using jikes: gcj -C
-
-# Compile class files into native code
-%.o: %.class
- gcj -c $(GCJOPTS) $<
-
-
-### TARGETS ###
-
-.PHONY: classes native clean
-
-classes: $(CLS)
-
-ifneq ($(OBJ),)
-native: $(OBJ)
- (ar -rv package.a *.o; ranlib package.a)
-else
-native: $(OBJ)
-endif
-
-clean:
- rm -f *.class *.o *.u *.a *~
-
diff --git a/LibrarySource/pal/math/package.html b/LibrarySource/pal/math/package.html
deleted file mode 100644
index 4772222..0000000
--- a/LibrarySource/pal/math/package.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<html>
-<body>
-Classes for math stuff such as optimisation, numerical derivatives, matrix exponentials,
-random numbers, special function etc.
-</body>
-</html>
-
diff --git a/LibrarySource/pal/mep/ConstantMutationRate.java b/LibrarySource/pal/mep/ConstantMutationRate.java
deleted file mode 100644
index 131daa9..0000000
--- a/LibrarySource/pal/mep/ConstantMutationRate.java
+++ /dev/null
@@ -1,198 +0,0 @@
-// ConstantMutationRate.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.mep;
-
-import pal.math.*;
-import pal.misc.*;
-import pal.io.*;
-
-import java.io.*;
-
-/**
- * This class models a constant mutation rate
- * (parameter: mu = mutation rate). <BR>
- *
- * @version $Id: ConstantMutationRate.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class ConstantMutationRate extends MutationRateModel implements Report, Summarizable, Parameterized, Serializable
-{
-
- //
- // private stuff
- //
- /** The summary descriptor stuff for the public values of this
- class
- @see Summarizable, getSummaryDescriptors()
- */
- private static final String[] CP_SUMMARY_TYPES = {"mu", "muSE"}; //This is still 1.0 compliant...
-
- //
- // Public stuff
- //
-
- /** mutation rate */
- public double mu;
- public double muSE;
-
- /**
- * Construct demographic model with default settings
- */
- public ConstantMutationRate(int units) {
-
- super();
-
- setUnits(units);
-
- mu = getDefaultValue(0);
- }
-
-
- /**
- * Construct mutation rate model of a give rate in given units.
- */
- public ConstantMutationRate(double rate, int units) {
-
- super();
-
- mu = rate;
- setUnits(units);
- }
-
- public Object clone()
- {
- return new ConstantMutationRate(getMu(), getUnits());
- }
-
- public String[] getSummaryTypes() {
- return CP_SUMMARY_TYPES;
- }
-
- public double getSummaryValue(int summaryType) {
- switch(summaryType) {
- case 0 : {
- return mu;
- }
- case 1 : {
- return muSE;
- }
- }
- throw new RuntimeException("Assertion error: unknown summary type :"+summaryType);
- }
-
- /**
- * returns initial population size.
- */
- public double getMu()
- {
- return mu;
- }
-
-
- // Implementation of abstract methods
-
- public final double getMutationRate(double t)
- {
- return mu;
- }
-
- public final double getExpectedSubstitutions(double t)
- {
- return mu * t;
- }
-
- public final double getTime(double expectedSubs) {
- return expectedSubs / mu;
- }
-
- /**
- * Linearly scales this mutation rate model.
- * @param scale getExpectedSubstitutions should return scale instead of 1.0 at time t.
- */
- public final void scale(double scale) {
- mu *= scale;
- }
-
- // Parameterized interface
-
- public int getNumParameters()
- {
- return 1;
- }
-
- public double getParameter(int k)
- {
- return mu;
- }
-
- public double getUpperLimit(int k)
- {
- return 1e12;
- }
-
- public double getLowerLimit(int k)
- {
- return 1e-12;
- }
-
- public double getDefaultValue(int k)
- {
- //arbitrary default values
- if (getUnits() == GENERATIONS) {
- return 1e-6;
- } else {
- return 1e-6;
- }
- }
-
- public void setParameter(double value, int k)
- {
- mu = value;
- }
-
- public void setParameterSE(double value, int k) {
- muSE = value;
- }
-
- public String toString()
- {
- OutputTarget out = OutputTarget.openString();
- report(out);
- out.close();
-
- return out.getString();
- }
-
- public void report(PrintWriter out)
- {
- out.println("Mutation rate model: constant mutation rate ");
- out.println("Function: mu(t) = mu");
-
- out.print("Unit of time: ");
- if (getUnits() == GENERATIONS)
- {
- out.print("generations");
- }
- else
- {
- out.print("expected substitutions");
- }
- out.println();
- out.println();
- out.println("Parameters of function:");
- out.print(" mutation rate: ");
- fo.displayDecimal(out, mu, 6);
- out.println();
- }
-
- public String toSingleLine() {
- return "mu\t" + mu;
- }
-}
-
diff --git a/LibrarySource/pal/mep/MutationRateModel.java b/LibrarySource/pal/mep/MutationRateModel.java
deleted file mode 100644
index 6fc2dd5..0000000
--- a/LibrarySource/pal/mep/MutationRateModel.java
+++ /dev/null
@@ -1,113 +0,0 @@
-// MutationRateModel.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.mep;
-
-import pal.math.*;
-import pal.misc.*;
-import pal.io.*;
-import java.io.*;
-
-
-/**
- * This abstract class contains methods that are of general use for
- * modelling mutation rate changes over time.
- *
- * @version $Id: MutationRateModel.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public abstract class MutationRateModel implements Units,
- Parameterized, Report, Cloneable, Serializable, Summarizable
-{
-
- //
- // Public stuff
- //
-
- public MutationRateModel()
- {
- units = GENERATIONS;
-
- fo = FormattedOutput.getInstance();
- }
-
- public abstract Object clone();
-
- //
- // functions that define a demographic model (left for subclass)
- //
-
- /**
- * Gets the mutation rate, value of mu(t) at time t.
- */
- public abstract double getMutationRate(double t);
-
- /**
- * Returns integral of mutation rate function
- * (= integral mu(x) dx from 0 to t).
- */
- public abstract double getExpectedSubstitutions(double t);
-
- /**
- * Return the time at which expected substitutions has occurred.
- */
- public abstract double getTime(double expectedSubs);
-
-
- /**
- * Linearly scales this mutation rate model.
- * @param scale getExpectedSubstitutions should return scale instead of 1.0 at time t.
- */
- public abstract void scale(double scale);
-
- // Parameterized and Report interface is also left for subclass
-
-
- // general functions
-
- /**
- * Calculates the integral 1/mu(x) dx between start and finish.
- */
- public double getExpectedSubstitutions(double start, double finish)
- {
- return getExpectedSubstitutions(finish) - getExpectedSubstitutions(start);
- }
-
- /**
- * Units in which time units are measured.
- */
- private int units;
-
- /**
- * sets units of measurement.
- *
- * @param u units
- */
- public void setUnits(int u)
- {
- units = u;
- }
-
- /**
- * returns units of measurement.
- */
- public int getUnits()
- {
- return units;
- }
-
- public abstract String toSingleLine();
-
- //
- // Private and protected stuff
- //
-
- protected FormattedOutput fo;
-}
-
diff --git a/LibrarySource/pal/mep/SteppedMutationRate.java b/LibrarySource/pal/mep/SteppedMutationRate.java
deleted file mode 100644
index 85bf52f..0000000
--- a/LibrarySource/pal/mep/SteppedMutationRate.java
+++ /dev/null
@@ -1,374 +0,0 @@
-// SteppedMutationRate.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.mep;
-
-import pal.math.*;
-import pal.misc.*;
-import pal.io.*;
-
-import java.io.*;
-
-/**
- * This class models a step-wise mutation rate. <BR>
- * parameters: <BR>
- * mus[] = vector of mutation rates <BR>
- * muChanges[] = vector of change times <P>
- * Drummond, Forsberg and Rodrigo (2001). The inference of step-wise changes in substitution rates using serial sequence samples. accepted in MBE.
- *
- * @version $Id: SteppedMutationRate.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class SteppedMutationRate extends MutationRateModel implements Report, Summarizable, Parameterized, Serializable
-{
- //
- // Public stuff
- //
-
- /** mutation rates */
- public double[] mus;
-
- /** mutation rate SEs */
- public double[] muSEs;
-
- /** mutation rate change times */
- public double[] muChanges;
-
- /** whether or not the mu values are optimizable */
- public boolean fixedMus = false;
-
- /**
- * Construct demographic model with default settings
- */
- public SteppedMutationRate(double[] muChanges, int units) {
-
- super();
-
- setUnits(units);
-
- this.muChanges = muChanges;
-
- mus = new double[muChanges.length + 1];
- muSEs = new double[muChanges.length + 1];
- for (int i = 0; i < mus.length; i++) {
- mus[i] = getDefaultValue(0);
- }
- }
-
- /**
- * Construct mutation rate model of a give rate in given units.
- */
- public SteppedMutationRate(double[] rates, double[] muChanges, int units) {
- this(rates, muChanges, units, false);
- }
-
- /**
- * Construct mutation rate model of a give rate in given units.
- */
- public SteppedMutationRate(double[] rates, double[] muChanges, int units, boolean fixed) {
-
- super();
-
- fixedMus = fixed;
- mus = rates;
- muSEs = new double[rates.length];
- this.muChanges = muChanges;
- setUnits(units);
- }
-
- public Object clone()
- {
- return new SteppedMutationRate(getMus(), getMuChanges(), getUnits(), fixedMus);
- }
-
- public String[] getSummaryTypes() {
- if (summaryTypes == null) {
- summaryTypes = new String[mus.length];
- for (int i = 0; i < summaryTypes.length; i++) {
- summaryTypes[i] = "mu " + i;
- }
- }
- return summaryTypes;
- }
-
- public double getSummaryValue(int summaryType) {
-
- if (summaryType < mus.length) {
- return mus[summaryType];
- }
- throw new RuntimeException("Assertion error: unknown summary type :"+summaryType);
- }
-
- /**
- * returns current day mutation rate.
- */
- public double getMu()
- {
- return mus[0];
- }
-
-
- // Implementation of abstract methods
-
- public final double getMutationRate(double t)
- {
- int muIndex = 0;
- while ((muIndex < muChanges.length) && (t > muChanges[muIndex])) {
- muIndex += 1;
- }
- return mus[muIndex];
- }
-
- public final double getExpectedSubstitutions(double time)
- {
- double currentTime = 0.0;
- double height = 0.0;
- int muIndex = 0;
- double timeInterval = 0.0;
-
- while (time > currentTime) {
-
- // if no more changes in mu go straight to the end
- if (muIndex >= muChanges.length) {
- timeInterval = time - currentTime;
-
- //update current time
- currentTime = time;
-
- } else {
- //find out the next time interval
- timeInterval = muChanges[muIndex] - currentTime;
-
- //truncate time interval if it exceeds node height.
- if ((currentTime + timeInterval) > time) {
- timeInterval = time - currentTime;
-
- //update current time
- currentTime = time;
- } else {
- //update current time
- currentTime = muChanges[muIndex];
- }
-
- }
-
-
- // update total height in substitutions
- height += mus[muIndex] * timeInterval;
-
- //update mu index
- muIndex += 1;
-
- }
- return height;
- }
-
- public final double getTime(double expectedSubs) {
-
- int changePoint = 0;
- while ((changePoint < muChanges.length) &&
- (expectedSubs < getExpectedSubstitutions(muChanges[changePoint]))) {
- changePoint += 1;
- }
-
- if (changePoint == 0) {
- // before first change point
- return expectedSubs / mus[changePoint];
- } else {
- double time = muChanges[changePoint-1];
- double expectedSoFar = getExpectedSubstitutions(time);
- time += (expectedSubs - expectedSoFar) / mus[changePoint];
- return time;
- }
- }
-
- /**
- * Linearly scales this mutation rate model.
- * @param scale getExpectedSubstitutions should return scale instead of 1.0 at time t.
- */
- public final void scale(double scale) {
- for (int i =0 ; i < mus.length; i++) {
- mus[i] *= scale;
- }
- }
-
- public static double[] getTimeIntervals(double[] muChanges, double smallTime, double bigTime) {
-
- double[] intervals = new double[muChanges.length + 1];
-
- double currentTime = smallTime;
- double height = 0.0;
-
- int muIndex = 0;
- while((muIndex < muChanges.length) && (muChanges[muIndex] < smallTime)) {
- muIndex += 1;
- }
-
- double timeInterval = 0.0;
-
- while (bigTime > currentTime) {
-
- // if no more changes in mu go straight to the end
- if (muIndex >= muChanges.length) {
- intervals[muIndex] = bigTime - currentTime;
-
- //update current time
- currentTime = bigTime;
- } else {
- //find out the next time interval
- intervals[muIndex] = muChanges[muIndex] - currentTime;
-
- //truncate time interval if it exceeds node height.
- if ((currentTime + intervals[muIndex]) > bigTime) {
- intervals[muIndex] = bigTime - currentTime;
-
- //update current time
- currentTime = bigTime;
- } else {
- //update current time
- currentTime = muChanges[muIndex];
- }
- }
-
- //update mu index
- muIndex += 1;
- }
-
- return intervals;
- }
-
-
- public double[] getDeltas(double[] times) {
- double height = 0.0;
- double[] deltas = new double[times.length-1];
- for (int i = 0; i < deltas.length; i++) {
- deltas[i] = getExpectedSubstitutions(times[i+1]) - height;
- height += deltas[i];
- }
- return deltas;
- }
-
- // Parameterized interface
-
- public int getNumParameters()
- {
- if (fixedMus)
- return 0;
- else return mus.length;
- }
-
- public double getParameter(int k)
- {
- return mus[k];
- }
-
- public double getUpperLimit(int k)
- {
- return 1e12;
- }
-
- public double getLowerLimit(int k)
- {
- return 0.0;
- }
-
- public double getDefaultValue(int k)
- {
- //arbitrary default values
- if (getUnits() == GENERATIONS) {
- return 1e-6;
- } else {
- return 1e-6;
- }
- }
-
- public void setParameter(double value, int k)
- {
- mus[k] = value;
- }
-
- public void setParameterSE(double value, int k) {
- muSEs[k] = value;
- }
-
- public String toString()
- {
- OutputTarget out = OutputTarget.openString();
- report(out);
- out.close();
-
- return out.getString();
- }
-
- public void report(PrintWriter out)
- {
- out.println("Mutation rate model: stepped mutation rate ");
-
- out.print("Unit of time: ");
- if (getUnits() == GENERATIONS)
- {
- out.print("generations");
- }
- else
- {
- out.print("expected substitutions");
- }
- out.println();
- out.println();
- out.println("Parameters of demographic function:");
- out.println(" mu\tinterval");
- for (int i = 0; i < mus.length; i++) {
- fo.displayDecimal(out, mus[i], 6);
- if (i == 0) {
- out.print("\t0.0 to ");
- fo.displayDecimal(out, muChanges[i], 6);
- out.println();
- } else {
- out.print("\t");
- fo.displayDecimal(out, muChanges[i-1], 6);
- out.print(" to ");
- if (i < muChanges.length) {
- fo.displayDecimal(out, muChanges[i], 6);
- out.println();
- } else {
- out.println("infinity");
- }
- }
- }
- }
-
- public double[] getMus() {
- double[] newMus = new double[mus.length];
- for (int i = 0; i < newMus.length; i++) {
- newMus[i] = mus[i];
- }
- return newMus;
- }
-
- private double[] getMuChanges() {
- double[] newMCs = new double[muChanges.length];
- for (int i = 0; i < newMCs.length; i++) {
- newMCs[i] = muChanges[i];
- }
- return newMCs;
- }
-
- public String toSingleLine() {
- String line = "";
- for (int i = 0; i < mus.length; i++) {
- line += "mu[" + i + "]\t" + mus[i];
- if (i < (mus.length - 1)) {
- line += "\t";
- }
- }
- return line;
- }
-
- String[] summaryTypes = null;
-}
-
diff --git a/LibrarySource/pal/mep/WindowedMutationRate.java b/LibrarySource/pal/mep/WindowedMutationRate.java
deleted file mode 100644
index a19dc22..0000000
--- a/LibrarySource/pal/mep/WindowedMutationRate.java
+++ /dev/null
@@ -1,310 +0,0 @@
-// WindowedMutationRate.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.mep;
-
-import pal.math.*;
-import pal.misc.*;
-import pal.io.*;
-
-import java.io.*;
-
-/**
- * This class models a windowed mutation rate
- * (parameter: mu = mutation rate). <BR>
- *
- * @version $Id: WindowedMutationRate.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class WindowedMutationRate extends MutationRateModel implements Report, Summarizable, Parameterized, Serializable
-{
- //
- // Public stuff
- //
-
- /** mutation rates */
- public double muBackground;
- public double muWindow;
-
- /** mutation rate SEs */
- public double muBackgroundSE;
- public double muWindowSE;
-
- /** mutation rate change times */
- public double windowCenter;
- public double windowWidth;
-
- public boolean backgroundFixed = false;
-
- /**
- * Construct demographic model with default settings
- */
- public WindowedMutationRate(double windowCenter, double windowWidth, int units) {
-
- super();
-
- setUnits(units);
-
- this.windowCenter = windowCenter;
- this.windowWidth = windowWidth;
-
- muBackground = getDefaultValue(0);
- muWindow = getDefaultValue(0);
- }
-
-
- /**
- * Construct mutation rate model of a give rate in given units.
- */
- public WindowedMutationRate(double muBackground,
- double windowCenter, double windowWidth, int units) {
-
- super();
-
- this.muBackground = muBackground;
- backgroundFixed = true;
-
- this.windowCenter = windowCenter;
- this.windowWidth = windowWidth;
-
- muWindow = getDefaultValue(0);
- setUnits(units);
- }
-
- /**
- * Construct mutation rate model of a give rate in given units.
- */
- public WindowedMutationRate(double muWindow, double muBackground,
- double windowCenter, double windowWidth, int units, boolean fixedb) {
-
- super();
-
- this.muWindow = muWindow;
- this.muBackground = muBackground;
- backgroundFixed = fixedb;
-
- this.windowCenter = windowCenter;
- this.windowWidth = windowWidth;
-
- setUnits(units);
- }
-
- /**
- * Construct mutation rate model of a give rate in given units.
- */
- public WindowedMutationRate(double muWindow, double muBackground,
- double windowCenter, double windowWidth, int units) {
-
- this(muWindow, muBackground, windowCenter, windowWidth, units, false);
- }
-
-
- public Object clone()
- {
- return new WindowedMutationRate(muWindow, muBackground,
- windowCenter, windowWidth, getUnits(), backgroundFixed);
- }
-
- public String[] getSummaryTypes() {
- if (summaryTypes == null) {
- summaryTypes = new String[4];
- summaryTypes[0] = "window mu";
- summaryTypes[1] = "background mu";
- summaryTypes[2] = "window center";
- summaryTypes[3] = "window width";
- }
- return summaryTypes;
- }
-
- public double getSummaryValue(int summaryType) {
-
- switch (summaryType) {
- case 0: return muWindow;
- case 1: return muBackground;
- case 2: return windowCenter;
- case 3: return windowWidth;
- }
- throw new RuntimeException("Assertion error: unknown summary type :"+summaryType);
- }
-
- /**
- * returns current day mutation rate.
- */
- public double getMu()
- {
- return getMutationRate(0.0);
- }
-
-
- // Implementation of abstract methods
-
- public final double getMutationRate(double t)
- {
- if ((t > windowCenter - (windowWidth / 2.0)) &&
- (t <= windowCenter + (windowWidth / 2.0))) {
-
- return muWindow;
- }
-
- return muBackground;
- }
-
- /**
- * Window must not span zero!
- */
- public final double getExpectedSubstitutions(double time)
- {
- double height = 0.0;
-
- // bit before window
- double totalTime = windowCenter - (windowWidth / 2.0);
- if (totalTime > time) return muBackground * time;
- if (totalTime >= 0.0)
- height += muBackground * totalTime;
- else System.err.println("Mutation window spans time zero!");
-
- // window
- if ((totalTime + windowWidth) > time) {
- return height + (muWindow * (time - totalTime));
- }
- height += muWindow * windowWidth;
-
- totalTime += windowWidth;
-
- // bit after window
- return height + (muBackground * (time - totalTime));
- }
-
- /**
- * Window must not span zero!
- */
- public final double getTime(double expected)
- {
- //NOTE: VERY APPROXIMATE!!! SHOULD BE IMPLEMENTED PROPERLY
-
- return expected / muBackground;
- }
-
- /**
- * Linearly scales this mutation rate model.
- * @param scale getExpectedSubstitutions should return scale instead of 1.0 at time t.
- */
- public final void scale(double scale) {
- muBackground *= scale;
- muWindow *= scale;
- }
-
- // Parameterized interface
-
- public int getNumParameters()
- {
- if (backgroundFixed) return 1;
- return 2;
- }
-
- public double getParameter(int k)
- {
- switch (k) {
- case 0: return muWindow;
- case 1: return muBackground;
- }
- return muWindow;
- }
-
- public double getUpperLimit(int k)
- {
- return 1e12;
- }
-
- public double getLowerLimit(int k)
- {
- return 1e-12;
- }
-
- public double getDefaultValue(int k)
- {
- //arbitrary default values
- if (getUnits() == GENERATIONS) {
- return 1e-6;
- } else {
- return 1e-6;
- }
- }
-
- public void setParameter(double value, int k)
- {
- switch (k) {
- case 0: muWindow = value; break;
- case 1: muBackground = value; break;
- }
- }
-
- public void setParameterSE(double value, int k) {
- switch (k) {
- case 0: muWindowSE = value; break;
- case 1: muBackgroundSE = value; break;
- }
- }
-
- public String toString()
- {
- OutputTarget out = OutputTarget.openString();
- report(out);
- out.close();
-
- return out.getString();
- }
-
- public void report(PrintWriter out)
- {
- out.println("Mutation rate model: windowed mutation rate ");
-
- out.print("Unit of time: ");
- if (getUnits() == GENERATIONS)
- {
- out.print("generations");
- }
- else
- {
- out.print("expected substitutions");
- }
- out.println();
- out.println();
- out.println("Parameters of demographic function:");
- out.print("window = ");
- fo.displayDecimal(out, windowCenter - (windowWidth / 2.0), 6);
- out.print(" - ");
- fo.displayDecimal(out, windowCenter + (windowWidth / 2.0), 6);
- out.println();
- out.print("window mutation rate = ");
- fo.displayDecimal(out, muWindow, 9);
- out.println();
- out.print("background mutation rate = ");
- fo.displayDecimal(out, muBackground, 9);
- out.println();
- if (backgroundFixed) {
- out.println("background mutation rate fixed.");
- } else {
- out.println("background mutation rate free to vary.");
- }
- }
-
- public String toSingleLine() {
- String line = "";
- line += "win mu\t" + muWindow + "\t";
- line += "bg mu\t" + muBackground + "\t";
- line += "win cen\t" + windowCenter + "\t";
- line += "win wid\t" + windowWidth + "\t";
- return line;
- }
-
-
-
- String[] summaryTypes = null;
-}
-
diff --git a/LibrarySource/pal/mep/makefile b/LibrarySource/pal/mep/makefile
deleted file mode 100644
index dca8f11..0000000
--- a/LibrarySource/pal/mep/makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-### VARIABLES ###
-
-JIKESOPTS := +P
-GCJOPTS :=
-
-# Always check dependencies
-JIKESOPTS += +M
-
-SRC := $(wildcard *.java)
-CLS := $(patsubst %.java, %.class, $(SRC))
-OBJ := $(patsubst %.class, %.o, $(wildcard *.class))
-
-
-### RULES ###
-
-# Compile Java sources into class files
-%.class: %.java
- jikes $(JIKESOPTS) $<
-
-# Alternative to using jikes: gcj -C
-
-# Compile class files into native code
-%.o: %.class
- gcj -c $(GCJOPTS) $<
-
-
-### TARGETS ###
-
-.PHONY: classes native clean
-
-classes: $(CLS)
-
-ifneq ($(OBJ),)
-native: $(OBJ)
- (ar -rv package.a *.o; ranlib package.a)
-else
-native: $(OBJ)
-endif
-
-clean:
- rm -f *.class *.o *.u *.a *~
-
diff --git a/LibrarySource/pal/mep/package.html b/LibrarySource/pal/mep/package.html
deleted file mode 100644
index 3ec8ce6..0000000
--- a/LibrarySource/pal/mep/package.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<html>
-<body>
-Classes for the analysis of "measurably evolving populations" (mep).
-</body>
-</html>
-
diff --git a/LibrarySource/pal/misc/BranchLimits.java b/LibrarySource/pal/misc/BranchLimits.java
deleted file mode 100644
index 48a1545..0000000
--- a/LibrarySource/pal/misc/BranchLimits.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// BranchLimits.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.misc;
-
-
-/**
- * limits for branch lengths
- *
- * @version $Id: BranchLimits.java,v 1.8 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public interface BranchLimits
-{
- //
- // Public stuff
- //
-
- /** minimum branch length */
- double MINARC = 1.0e-6;
-
- /** maximum branch length */
- double MAXARC = 6.0;
-
- /** default branch length */
- double DEFAULT_LENGTH = 0.04;
-
- /** maximum tolerated error when determining branch lengths */
- double ABSTOL = 5.0e-07;
-
- /** desired fractional digits when determining branch lengths */
- int FRACDIGITS = 6;
-}
-
diff --git a/LibrarySource/pal/misc/GeneralFunction.java b/LibrarySource/pal/misc/GeneralFunction.java
deleted file mode 100644
index 0c451e8..0000000
--- a/LibrarySource/pal/misc/GeneralFunction.java
+++ /dev/null
@@ -1,22 +0,0 @@
-// GeneralFunction.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.misc;
-
-/**
- * interface for classes which provide general function mechanisms. Essentially mappings from a n-dimensional space to a scalar value
- *
- * @version $Id: GeneralFunction.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Matthew Goode
- */
-
-public interface GeneralFunction {
- double compute(double[] parameters);
- GeneralFunction getGeneralFunctionCopy();
-}
-
diff --git a/LibrarySource/pal/misc/IdGenerator.java b/LibrarySource/pal/misc/IdGenerator.java
deleted file mode 100644
index 39e38cc..0000000
--- a/LibrarySource/pal/misc/IdGenerator.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// IdGenerator.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.misc;
-
-import java.math.*;
-import pal.io.*;
-
-/**
- * Generates IdGroup objects given certain parameters.
- *
- * @version $Id: IdGenerator.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class IdGenerator {
-
- /**
- * generates a group of unique identifiers numbered from zero.
- */
- public static IdGroup createIdGroup(int size) {
-
- int width = (int)Math.ceil(Math.log(size) / Math.log(10.0));
-
- IdGroup idGroup = new SimpleIdGroup(size);
-
- String name;
- for (int i = 0; i < size; i++) {
- name = (new Integer(i)).toString();
- name = FormattedOutput.space(width - name.length(), '0') + name;
- idGroup.setIdentifier(i, new Identifier(name));
- }
-
- return idGroup;
- }
-}
-
-
diff --git a/LibrarySource/pal/misc/IdGroup.java b/LibrarySource/pal/misc/IdGroup.java
deleted file mode 100644
index 7787125..0000000
--- a/LibrarySource/pal/misc/IdGroup.java
+++ /dev/null
@@ -1,41 +0,0 @@
-// IdGroup.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.misc;
-
-/**
- * An indexed group of identifiers. For example of group of taxa
- * related by a phylogenetic tree.
- * <BR><B>NOTE:</B> Was called Taxa but not general enough.
- *
- * @version $Id: IdGroup.java,v 1.8 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public interface IdGroup extends java.io.Serializable {
-
- /**
- * Returns the number of identifiers in this group
- */
- int getIdCount();
-
- /**
- * Returns the ith identifier.
- */
- Identifier getIdentifier(int i);
-
- /**
- * Sets the ith identifier.
- */
- void setIdentifier(int i, Identifier id);
-
- /**
- * returns the index of the identifier with the given name.
- */
- int whichIdNumber(String name);
-}
-
diff --git a/LibrarySource/pal/misc/Identifier.java b/LibrarySource/pal/misc/Identifier.java
deleted file mode 100644
index 327ad22..0000000
--- a/LibrarySource/pal/misc/Identifier.java
+++ /dev/null
@@ -1,67 +0,0 @@
-// Identifier.java
-//
-// (c) 1999-2000 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.misc;
-
-import java.io.*;
-import pal.util.Comparable;
-
-/**
- * An identifier for some sampled data. This will most often be
- * for example, the accession number of a DNA sequence, or the
- * taxonomic name that the sequence represents, et cetera.
- *
- * @version $Id: Identifier.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-
-
-public class Identifier implements Serializable,
- pal.util.Comparable, Nameable {
-
- private String name = null;
-
- public static Identifier ANONYMOUS = new Identifier("");
-
- public Identifier() {}
-
- public Identifier(String name) {
- setName(name);
- }
-
- public String toString() {
- return getName();
- }
-
- // implements Comparable interface
-
- public int compareTo(Object c) {
-
- return getName().compareTo(((Identifier)c).getName());
- }
-
- public boolean equals(Object c) {
-
- if (c instanceof Identifier) {
- return getName().equals(((Identifier)c).getName());
- } else return false;
- }
-
- // implements Nameable interface
-
- public String getName() {
- return name;
- }
-
- public void setName(String s) {
- name = s;
- }
-
-}
-
-
diff --git a/LibrarySource/pal/misc/Nameable.java b/LibrarySource/pal/misc/Nameable.java
deleted file mode 100644
index bdfa915..0000000
--- a/LibrarySource/pal/misc/Nameable.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// Nameable.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.misc;
-
-import java.io.*;
-
-/**
- * interface for classes that can be named.
- *
- * @version $Id: Nameable.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public interface Nameable
-{
- /**
- * get the name of this object.
- *
- * @return name of this object.
- */
- String getName();
-
- /**
- * set the name of this object.
- *
- * @param name the new name.
- */
- void setName(String name);
-}
-
diff --git a/LibrarySource/pal/misc/Parameterized.java b/LibrarySource/pal/misc/Parameterized.java
deleted file mode 100644
index 2215ca1..0000000
--- a/LibrarySource/pal/misc/Parameterized.java
+++ /dev/null
@@ -1,85 +0,0 @@
-// Parameterized.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.misc;
-
-import java.io.*;
-
-
-/**
- * interface for class with (optimizable) parameters
- *
- * @version $Id: Parameterized.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public interface Parameterized
-{
- /**
- * get number of parameters
- *
- * @return number of parameters
- */
- int getNumParameters();
-
- /**
- * set model parameter
- *
- * @param param parameter value
- * @param n parameter number
- */
- void setParameter(double param, int n);
-
- /**
- * get model parameter
- *
- * @param n parameter number
- *
- * @return parameter value
- */
- double getParameter(int n);
-
-
- /**
- * set standard errors for model parameter
- *
- * @param paramSE standard error of parameter value
- * @param n parameter number
- */
- void setParameterSE(double paramSE, int n);
-
-
- /**
- * get lower parameter limit
- *
- * @param n parameter number
- *
- * @return lower bound
- */
- double getLowerLimit(int n);
-
- /**
- * get upper parameter limit
- *
- * @param n parameter number
- *
- * @return upper bound
- */
- double getUpperLimit(int n);
-
-
- /**
- * get default value of parameter
- *
- * @param n parameter number
- *
- * @return default value
- */
- double getDefaultValue(int n);
-}
-
diff --git a/LibrarySource/pal/misc/ParameterizedDouble.java b/LibrarySource/pal/misc/ParameterizedDouble.java
deleted file mode 100644
index 62f49ed..0000000
--- a/LibrarySource/pal/misc/ParameterizedDouble.java
+++ /dev/null
@@ -1,144 +0,0 @@
-// ParameterizedDouble.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.misc;
-
-import java.io.*;
-
-
-/**
- * interface for a double that might be used as a parameter
- *
- * @version $Id: ParameterizedDouble.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Matthew Goode
- */
-public class ParameterizedDouble implements Parameterized{
- double defaultValue_;
- double currentValue_;
- double minimumValue_;
- double maximumValue_;
- double se_;
-
- /** The default value is also the initial value.
- */
- public ParameterizedDouble(double defaultValue, double minimumValue, double maximumValue) {
- this.currentValue_ = defaultValue;
- this.defaultValue_ = defaultValue;
- this.minimumValue_ = minimumValue;
- this.maximumValue_ = maximumValue;
- }
-
- /** Set the current value of this double */
- public final void setValue(double value) {
- this.currentValue_ = value;
- }
-
- /** Get the current value of this double */
- public final double getValue() {
- return currentValue_;
- }
-
- public final double getLowerLimit() {
- return minimumValue_;
- }
-
- public final double getUpperLimit() {
- return maximumValue_;
- }
-
- public final double getDefaultValue() {
- return defaultValue_;
- }
-
- public final double getSE() {
- return se_;
- }
-
- public final void setSE(double value) {
- se_ = value;
- }
-
-
-
- /**
- *
- * @return 1
- */
- public int getNumParameters() {
- return 1;
- }
-
- /**
- * set model parameter
- *
- * @param param parameter value
- * @param n parameter number (ignored)
- */
- public void setParameter(double param, int n) {
- this.currentValue_ = param;
- }
-
- /**
- * get model parameter
- *
- * @param n parameter number
- *
- * @return parameter value
- */
- public double getParameter(int n) {
- return currentValue_;
- }
-
-
- /**
- * set standard errors for model parameter
- *
- * @param paramSE standard error of parameter value
- * @param n parameter number
- */
- public void setParameterSE(double paramSE, int n) {
- this.se_ = paramSE;
- }
-
-
- /**
- * get lower parameter limit
- *
- * @param n parameter number
- *
- * @return lower bound
- */
- public double getLowerLimit(int n) {
- return minimumValue_;
- }
-
- /**
- * get upper parameter limit
- *
- * @param n parameter number
- *
- * @return upper bound
- */
- public double getUpperLimit(int n) {
- return maximumValue_;
- }
-
-
- /**
- * get default value of parameter
- *
- * @param n parameter number
- *
- * @return default value
- */
- public double getDefaultValue(int n) {
- return defaultValue_;
- }
-}
-
diff --git a/LibrarySource/pal/misc/Product.java b/LibrarySource/pal/misc/Product.java
deleted file mode 100644
index 2bd8f41..0000000
--- a/LibrarySource/pal/misc/Product.java
+++ /dev/null
@@ -1,32 +0,0 @@
-// Product.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.misc;
-
-/**
- * A GeneralFucnction that multiplies all the input values.
- *
- * @version $Id: Product.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Matthew Goode
- */
-
-public class Product implements GeneralFunction {
- public double compute(double[] parameters) {
- double product = 1.0;
- for(int i = 0 ; i < parameters.length ; i++) {
- product *= parameters[i];
- }
- return product;
- }
- /** No actual cloning is performed (returns self), as no state is
- kept */
- public GeneralFunction getGeneralFunctionCopy() {
- return this;
- }
-}
-
diff --git a/LibrarySource/pal/misc/ReleaseInfo.java b/LibrarySource/pal/misc/ReleaseInfo.java
deleted file mode 100644
index 169aefd..0000000
--- a/LibrarySource/pal/misc/ReleaseInfo.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// ReleaseInfo.java
-//
-// (c) 1999-2001 Korbinian Strimmer
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.misc;
-
-
-/**
- * release information
- *
- * @version $Id: ReleaseInfo.java,v 1.5 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class ReleaseInfo
-{
- //
- // Public stuff
- //
-
- /** version */
- public final static String VERSION = "PAL 1.3";
-
- /** release date */
- public final static String RELEASE_DATE = "July 14, 2001";
-}
-
diff --git a/LibrarySource/pal/misc/Report.java b/LibrarySource/pal/misc/Report.java
deleted file mode 100644
index 1493f71..0000000
--- a/LibrarySource/pal/misc/Report.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// Report.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.misc;
-
-import java.io.*;
-
-
-/**
- * interface for classes that can print out a human readable report of itself
- *
- * @version $Id: Report.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public interface Report
-{
- /**
- * print human readable report (e.g., on parameters and associated model)
- *
- * @param out output stream
- */
- void report(PrintWriter out);
-}
-
diff --git a/LibrarySource/pal/misc/SimpleIdGroup.java b/LibrarySource/pal/misc/SimpleIdGroup.java
deleted file mode 100644
index e111bf6..0000000
--- a/LibrarySource/pal/misc/SimpleIdGroup.java
+++ /dev/null
@@ -1,169 +0,0 @@
-// SimpleIdGroup.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.misc;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Default implementation of IdGroup interface.
- * Memory-inefficient to allow fast whichIdNumber calls.
- *
- * @version $Id: SimpleIdGroup.java,v 1.5 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class SimpleIdGroup implements IdGroup, Serializable, Nameable {
-
- private String name;
- private Identifier[] ids;
- private Hashtable indices;
-
- /**
- * Constructor taking the size of the group.
- */
- public SimpleIdGroup(int size) {
- this(size,false);
-
- }
-
- /**
- * Constructor taking an array of strings.
- */
- public SimpleIdGroup(String[] labels) {
- this(labels.length);
- for (int i = 0; i < labels.length; i++) {
- setIdentifier(i, new Identifier(labels[i]));
- }
- }
-
-
- /**
- * Constructor taking the size of the group.
- * @param size - the number of ids
- * @param createIDs - if true creates default Indetifiers.
- Otherwise leaves blank (for user to fill in)
- */
- public SimpleIdGroup(int size, boolean createIDs) {
-
- ids = new Identifier[size];
- indices = new Hashtable(size);
- if(createIDs) {
- for(int i = 0 ; i < size ; i++ ) {
- setIdentifier(i, new Identifier(""+i));
- }
- }
- }
-
- /**
- * Constructor taking an array of identifiers.
- */
- public SimpleIdGroup(Identifier[] id) {
- this(id.length);
- for (int i = 0; i < id.length; i++) {
- setIdentifier(i, id[i]);
- }
- }
-
- /**
- * Constructor taking two separate id groups and merging them.
- */
- public SimpleIdGroup(IdGroup a, IdGroup b) {
- this(a.getIdCount() + b.getIdCount());
-
- for (int i = 0; i < a.getIdCount(); i++) {
- setIdentifier(i, a.getIdentifier(i));
- }
- for (int i = 0; i < b.getIdCount(); i++) {
- setIdentifier(i + a.getIdCount(), b.getIdentifier(i));
- }
- }
- /**
- * Impersonating Constructor.
- */
- public SimpleIdGroup(IdGroup a) {
- this(a.getIdCount());
-
- for (int i = 0; i < a.getIdCount(); i++) {
- setIdentifier(i, a.getIdentifier(i));
- }
- }
- /**
- * Returns the number of identifiers in this group
- */
- public int getIdCount() {
- return ids.length;
- }
-
- /**
- * Returns the ith identifier.
- */
- public Identifier getIdentifier(int i) {
- return ids[i];
- }
-
- /**
- * Convenience method to return the name of identifier i
- */
- public final String getName(int i) {
- return ids[i].getName();
- }
-
- /**
- * Sets the ith identifier.
- */
- public void setIdentifier(int i, Identifier id) {
- ids[i] = id;
- indices.put(id.getName(), new Integer(i));
- }
-
- /**
- * Return index of identifier with name or -1 if not found
- */
- public int whichIdNumber(String name) {
-
- Integer index = (Integer)indices.get(name);
- if (index != null) {
- return index.intValue();
- }
- return -1;
- }
-
- /**
- * Returns a string representation of this IdGroup in the form of
- * a bracketed list.
- */
- public String toString() {
-
- StringBuffer sb = new StringBuffer();
- sb.append("[ ");
- for (int i = 0; i < getIdCount(); i++) {
- sb.append(getIdentifier(i) + " ");
- }
- sb.append("]");
- return new String(sb);
- }
-
- // implement Nameable interface
-
- /**
- * Return the name of this IdGroup.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the name of this IdGroup.
- */
- public void setName(String n) {
- name = n;
- }
-}
-
-
diff --git a/LibrarySource/pal/misc/SimpleSummarizable.java b/LibrarySource/pal/misc/SimpleSummarizable.java
deleted file mode 100644
index 5a199cc..0000000
--- a/LibrarySource/pal/misc/SimpleSummarizable.java
+++ /dev/null
@@ -1,56 +0,0 @@
-// SimpleSummarizable.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-/**
- * A simple implementation of a Summarizable object. Can be used to provide a
- * summarizable object based upon another summarizable object but with the
- * minimum storage requirement (see SimpleSummarizable(Summarizable) constructor.
- *
- *
- * @version $Id: SimpleSummarizable.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Matthew Goode
- */
-package pal.misc;
-
-public class SimpleSummarizable implements Summarizable, java.io.Serializable {
- private String[] types_;
- private double[] values_;
-
- /**
- The simple constructor
- @note param types and param values should be of the same length
- */
- public SimpleSummarizable(String[] types, double[] values) {
- this.types_ = types;
- this.values_ = values;
- }
-
- /** The Imitation constructor - for immitating another Summarizable object with
- minimum memory requirements
- @param toImitiate - the Summarizable to imitate. This summarizable with contatin
- the same types and values as toImitate (at the time of construction)
- @note No reference to toImitate is maintained.
- */
- public SimpleSummarizable(Summarizable toImitate) {
- this.types_ = toImitate.getSummaryTypes();
- this.values_ = new double[this.types_.length];
- for(int i = 0 ; i < values_.length ; i++) {
- this.values_[i] = toImitate.getSummaryValue(i);
- }
- }
-
- public String[] getSummaryTypes() {
- return this.types_;
- }
-
- public double getSummaryValue(int type) {
- return this.values_[type];
- }
-
-}
-
diff --git a/LibrarySource/pal/misc/Sum.java b/LibrarySource/pal/misc/Sum.java
deleted file mode 100644
index b7907e9..0000000
--- a/LibrarySource/pal/misc/Sum.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// Sum.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.misc;
-
-/**
- * A GeneralFucnction that sums all the input values.
- *
- * @version $Id: Sum.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Matthew Goode
- */
-
-public class Sum implements GeneralFunction {
- public double compute(double[] parameters) {
- double sum = 0.0;
- for(int i = 0 ; i < parameters.length ; i++) {
- sum += parameters[i];
- }
- return sum;
- }
-
- /** No actual cloning is performed (returns self), as no state is
- kept */
- public GeneralFunction getGeneralFunctionCopy() {
- return this;
- }
-}
-
diff --git a/LibrarySource/pal/misc/SumToOneWeighting.java b/LibrarySource/pal/misc/SumToOneWeighting.java
deleted file mode 100644
index cb88323..0000000
--- a/LibrarySource/pal/misc/SumToOneWeighting.java
+++ /dev/null
@@ -1,198 +0,0 @@
-// Weighting.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.misc;
-import java.io.*;
-
-/**
- * A weighting for n values. Has n-1 parameters. Weightings sum to 1.
- *
- * @version $Id: SumToOneWeighting.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Matthew Goode
- */
-
-public class SumToOneWeighting implements Weighting {
- double[] parameters_; /** The parameters */
- double[] parametersSE_; /** The parameters' SE*/
- double[] defaultValues_; /** The default values for the parameters */
- double[] weightings_; /** The weightings (dependent on p0, p1) */
- boolean rigidParameters_;
-
- /**
- * @param defaultValues The default, and initial, parameters (n is determined by the number of parameters + 1)
- */
- public SumToOneWeighting(double[] defaultParameters) {
- this(defaultParameters,defaultParameters.length+1);
- }
- /**
- * @param defaultValues The default, and initial, parameters and n the number of weights (ignores extra parameters)
- * @param n The number of weights (not the number of parameters!)
- * @note Parameters are not rigid and can be adjusted.
- */
- public SumToOneWeighting(double[] defaultParameters, int n) {
- this(defaultParameters,n,false);
- }
- /**
- * @param defaultValues The default, and initial, parameters and n the number of weights (ignores extra parameters)
- * @param n The number of weights (not the number of parameters!)
- * @param rigidParam If true than this weighting has not adjustable paramters (that is, is reported is as having zero parameters in the Paraterizable interface)
- */
- public SumToOneWeighting(double[] defaultParameters, int n, boolean rigidParameters) {
- this.rigidParameters_ = rigidParameters;
- weightings_ = new double[n];
- defaultValues_ = new double[n-1];
- parameters_ = new double[n-1];
- parametersSE_ = new double[n-1];
- for(int i = 0 ; i < n ; i++) {
- defaultValues_[i] = defaultParameters[i];
- parameters_[i] = defaultParameters[i];
- }
- recalculateWeightings();
-
- }
- public SumToOneWeighting(SumToOneWeighting toCopy) {
- int n = toCopy.weightings_.length;
- weightings_ = new double[n];
- defaultValues_ = new double[n-1];
- parameters_ = new double[n-1];
- parametersSE_ = new double[n-1];
- for(int i = 0 ; i < (n-1) ; i++) {
- this.defaultValues_[i] = toCopy.defaultValues_[i];
- this.parameters_[i] = toCopy.parameters_[i];
- this.parametersSE_[i] = toCopy.parametersSE_[i];
- }
- recalculateWeightings();
- }
-
- public double getWeight(int weightNumber) {
- return weightings_[weightNumber];
- }
-
- public double[] getWeights() {
- return weightings_;
- }
- /** For people who don't like casting...*/
- public Weighting getWeightingCopy() {
- return new SumToOneWeighting(this);
- }
- /**
- * get number of parameters
- *
- * @return number of parameters
- */
- public int getNumParameters() {
- return (rigidParameters_ ? 0 : parameters_.length);
- }
-
- /** Calculate the weightings from the current parameter values */
- private void recalculateWeightings() {
- double total = 1;
- for(int i = 0 ; i < parameters_.length ; i++) {
- total+=parameters_[i];
- }
- for(int i = 0 ; i < parameters_.length ; i++) {
- weightings_[i] = parameters_[i]/total;
- }
- weightings_[parameters_.length] = 1/total;
- }
-
- /**
- * set model parameter
- *
- * @param param parameter value
- * @param n parameter number
- */
- public void setParameter(double param, int n) {
- if(rigidParameters_) {
- throw new RuntimeException("Assertion error - Attempting to set rigid paramters");
- }
- parameters_[n] = param;
- recalculateWeightings();
- }
-
- /**
- * get model parameter
- *
- * @param n parameter number
- *
- * @return parameter value
- */
- public double getParameter(int n) {
- return parameters_[n];
- }
-
-
- /**
- * set standard errors for model parameter
- *
- * @param paramSE standard error of parameter value
- * @param n parameter number
- */
- public void setParameterSE(double paramSE, int n) {
- parametersSE_[n] = paramSE;
- }
-
-
- /**
- * get lower parameter limit
- *
- * @param n parameter number
- *
- * @return lower bound
- */
- public double getLowerLimit(int n) {
- return 0;
- }
-
- /**
- * get upper parameter limit
- *
- * @param n parameter number
- *
- * @return upper bound
- */
- public double getUpperLimit(int n) {
- return Double.MAX_VALUE;
- }
-
-
- /**
- * get default value of parameter
- *
- * @param n parameter number
- *
- * @return default value
- */
- public double getDefaultValue(int n) {
- return defaultValues_[n];
- }
-
- public void report(PrintWriter out) {
- out.print("Sum To One Weighting");
- if(rigidParameters_) {
- out.println("(Rigid Parameters)");
- } else {
- out.println("");
- }
- out.print("Weights:");
- for(int i = 0 ; i < weightings_.length ; i++) {
- out.print(weightings_[i]+" ");
- }
- out.println();
- out.println("Parameters:");
- for(int i = 0 ; i < parameters_.length ; i++) {
- out.print(parameters_[i]+" ");
- }
- out.println();
- out.println("Parameters SE:");
- for(int i = 0 ; i < parametersSE_.length ; i++) {
- out.print(parametersSE_[i]+" ");
- }
- }
-}
-
diff --git a/LibrarySource/pal/misc/Summarizable.java b/LibrarySource/pal/misc/Summarizable.java
deleted file mode 100644
index b590074..0000000
--- a/LibrarySource/pal/misc/Summarizable.java
+++ /dev/null
@@ -1,23 +0,0 @@
-// Parameterized.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.misc;
-
-/**
- * interface for classes that can provide summaries
- *
- * @version $Id: Summarizable.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public interface Summarizable extends java.io.Serializable
-{
- String[] getSummaryTypes();
- double getSummaryValue(int summaryType);
-}
-
diff --git a/LibrarySource/pal/misc/TimeOrderCharacterData.java b/LibrarySource/pal/misc/TimeOrderCharacterData.java
deleted file mode 100644
index 96f4cc7..0000000
--- a/LibrarySource/pal/misc/TimeOrderCharacterData.java
+++ /dev/null
@@ -1,387 +0,0 @@
-// TimeOrderCharacterData.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.misc;
-
-import java.io.*;
-import pal.util.*;
-import pal.math.*;
-
-/**
- * Character data that expresses an order through time.
- *
- * @version $Id: TimeOrderCharacterData.java,v 1.9 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class TimeOrderCharacterData implements Serializable, BranchLimits, IdGroup {
-
- /** Order of times */
- protected int[] timeOrdinals = null;
-
- /** Actual times of each sample */
- protected double[] times = null;
-
- /** the identifier group */
- protected IdGroup taxa;
-
- protected int units = Units.GENERATIONS;
-
- /**
- * Parameterless constructor for superclasses.
- */
- protected TimeOrderCharacterData() {}
-
- /**
- * Constructor taking only IdGroup.
- * Beware! This constructor does not initialize
- * any time ordinals or times.
- */
- public TimeOrderCharacterData(IdGroup taxa, int units) {
- this.taxa = taxa;
- }
-
- /**
- * Constructs a TimeOrderCharacterData.
- */
- public TimeOrderCharacterData(int numSeqsPerSample, int numSamples,
- double timeBetweenSamples, int units) {
-
- int n = numSeqsPerSample * numSamples;
-
- taxa = IdGenerator.createIdGroup(n);
-
- // create times and ordinals
- timeOrdinals = new int[taxa.getIdCount()];
- times = new double[taxa.getIdCount()];
-
-
- int index = 0;
- for (int i = 0; i < numSamples; i++) {
- for (int j = 0; j < numSeqsPerSample; j++) {
- times[index] = timeBetweenSamples * (double)i;
- timeOrdinals[index] = i;
- index += 1;
- }
- }
-
- this.units = units;
- }
-
- /**
- * Returns a clone of the specified TimeOrderCharacterData
- */
- public static TimeOrderCharacterData clone(TimeOrderCharacterData tocd) {
- return tocd.subset(tocd);
- }
-
- /**
- * Extracts a subset of a TimeOrderCharacterData.
- */
- public TimeOrderCharacterData subset(IdGroup staxa) {
-
- TimeOrderCharacterData subset =
- new TimeOrderCharacterData(staxa, getUnits());
-
- subset.timeOrdinals = new int[staxa.getIdCount()];
- if (hasTimes()) {
- subset.times = new double[staxa.getIdCount()];
- }
-
- for (int i = 0; i < subset.timeOrdinals.length; i++) {
- int index = taxa.whichIdNumber(staxa.getIdentifier(i).getName());
- subset.timeOrdinals[i] = timeOrdinals[index];
-
- if (hasTimes()) {
- subset.times[i] = times[index];
- }
- }
- return subset;
- }
-
- public int getUnits() {
- return units;
- }
-
- /**
- * Sets the times, and works out what the ordinals should be.
- */
- public void setTimes(double[] times, int units) {
- setTimes(times, units, true);
- }
-
- /**
- * Sets the times.
- * @param recalculateOrdinals true if ordinals should be
- * recalculated from the times.
- */
- public void setTimes(double[] times, int units, boolean recalculateOrdinals) {
- this.times = times;
- this.units = units;
- if (recalculateOrdinals) {
- setOrdinalsFromTimes();
- }
- }
-
- public TimeOrderCharacterData scale(double rate, int newUnits) {
-
- TimeOrderCharacterData scaled = clone(this);
-
- scaled.units = newUnits;
- for (int i = 0; i < times.length; i++) {
- scaled.times[i] = times[i] * rate;
- }
-
- return scaled;
- }
-
- /**
- * Sets ordinals.
- */
- public void setOrdinals(int[] ordinals) {
- timeOrdinals = ordinals;
- }
-
- /**
- * Gets ordinals.
- */
- public int[] getOrdinals() {
- return timeOrdinals;
- }
-
- /**
- * Returns a copy of the times in the form of an array.
- */
- public double[] getCopyOfTimes() {
- double[] copyTimes = new double[times.length];
- System.arraycopy(times, 0, copyTimes, 0, times.length);
-
- return copyTimes;
- }
-
- /**
- * Remove time character data.
- */
- public void removeTimes() {
- times = null;
- }
-
- /**
- * Set time ordinals from another TimeOrderCharacterData.
- * Select ordinals by matching names.
- * @param tocd to take ordinals from.
- */
- public void setOrdinals(TimeOrderCharacterData tocd) {
- setOrdinals(tocd, null, false);
- }
-
- public void setTimesAndOrdinals(TimeOrderCharacterData tocd) {
- setOrdinals(tocd, null, true);
- }
-
- /**
- * Set time ordinals from another TimeOrderCharacterData.
- * Select ordinals by matching names.
- * @param tocd to take ordinals from
- * @param idgroup use these labels to match indices in given tocd.
- * @param doTimes if set then sets times as well
- */
- public void setOrdinals(TimeOrderCharacterData tocd, IdGroup standard, boolean doTimes) {
-
- if (timeOrdinals == null) {
- timeOrdinals = new int[taxa.getIdCount()];
- }
-
- if (doTimes && tocd.hasTimes()) {
- times = new double[taxa.getIdCount()];
- }
-
- if (standard == null) {
- standard = tocd;
- }
-
- for (int i = 0; i < taxa.getIdCount(); i++) {
-
- String name = taxa.getIdentifier(i).getName();
- int index = standard.whichIdNumber(name);
- if (index == -1) {
- System.err.println("Identifiers don't match!");
- System.err.println("Trying to find: '" + name + "' in:");
- System.err.println(standard);
- //System.exit(1);
- }
-
- timeOrdinals[i] = tocd.getTimeOrdinal(index);
- if (doTimes && tocd.hasTimes()) {
- times[i] = tocd.getTime(index);
- }
- }
- }
-
- private void setOrdinalsFromTimes() {
-
- int[] indices = new int[times.length];
- timeOrdinals = new int[times.length];
- HeapSort.sort(times, indices);
-
- int ordinal = 0;
- int lastIndex = 0;
- timeOrdinals[indices[0]] = ordinal;
-
- for (int i = 1; i < indices.length; i++) {
- if (Math.abs(times[indices[i]] - times[indices[lastIndex]]) <= ABSTOL) {
- // this time is still within the tolerated error
- } else {
- // this is definitely a new time
- lastIndex = i;
- ordinal += 1;
- }
- timeOrdinals[indices[i]] = ordinal;
- }
- }
-
- /**
- * Returns the number of characters per identifier
- */
- public int getNumChars() {
- if (hasTimes()) {
- return 2;
- } else return 1;
- }
-
- /**
- * Returns a name for this character data.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the name of this character data.
- */
- public void setName(String name) {
- this.name = name;
- }
-
- public double getTime(int taxon) {
- return times[taxon];
- }
-
- /**
- * NOTE: currently assumes times exist!
- */
- public double getHeight(int taxon, double rate) {
- return times[taxon] * rate;
- }
-
- public int getTimeOrdinal(int taxon) {
- return timeOrdinals[taxon];
- }
-
- public boolean hasTimes() {
- return times != null;
- }
-
- /**
- * Returns an ordered vector of unique times in this
- * time order character data.
- */
- public double[] getUniqueTimeArray() {
- int count = getSampleCount();
-
- double[] utimes = new double[count];
- for (int i = 0; i < times.length; i++) {
- utimes[getTimeOrdinal(i)] = times[i];
- }
-
- return utimes;
- }
-
- /**
- * Returns a matrix of times between samples. A
- * sample is any set of identifiers that have the same times.
- */
- public double[][] getUniqueTimeMatrix() {
-
-
- double[] utimes = getUniqueTimeArray();
- int count = utimes.length;
-
- double[][] stimes = new double[count][count];
- for (int i = 0; i < count; i++) {
- for (int j = 0; j < count; j++) {
- stimes[i][j] = Math.abs(utimes[i] - utimes[j]);
- }
- }
-
- return stimes;
- }
-
- /**
- * Returns the number of unique times in this data.
- * A sample is any set of identifiers that have the same times.
- */
- public int getSampleCount() {
- int max = 0;
- for (int i = 0; i < timeOrdinals.length; i++) {
- if (timeOrdinals[i] > max) max = timeOrdinals[i];
- }
- return max + 1;
- }
-
- /**
- * Returns a string representation of this time order character data.
- */
- public String toString() {
- StringBuffer sb = new StringBuffer();
-
- sb.append("Identifier\t"+ (hasTimes() ? "Times\t" : "") + "Sample\n");
- for (int i = 0; i < taxa.getIdCount(); i++) {
- sb.append(taxa.getIdentifier(i) + "\t" +
- (hasTimes() ? getTime(i) + "\t" : "") +
- getTimeOrdinal(i)+"\n");
- }
- return new String(sb);
- }
-
- public void shuffleTimes() {
- MersenneTwisterFast mtf = new MersenneTwisterFast();
-
- int[] indices = mtf.shuffled(timeOrdinals.length);
-
- int[] newOrdinals = new int[timeOrdinals.length];
- double[] newTimes = null;
- if (hasTimes()) {
- newTimes = new double[times.length];
- }
- for (int i = 0; i < timeOrdinals.length; i++) {
- newOrdinals[i] = timeOrdinals[indices[i]];
- if (hasTimes()) { newTimes[i] = times[indices[i]]; }
- }
-
- timeOrdinals = newOrdinals;
- if (hasTimes()) times = newTimes;
- }
-
- //IdGroup interface
- public Identifier getIdentifier(int i) {return taxa.getIdentifier(i);}
- public void setIdentifier(int i, Identifier ident) { taxa.setIdentifier(i, ident); }
- public int getIdCount() { return taxa.getIdCount(); }
- public int whichIdNumber(String name) { return taxa.whichIdNumber(name); }
-
- /**
- * Return id group of this alignment.
- * @deprecated TimeOrderCharacterData now implements IdGroup
- */
- public IdGroup getIdGroup() { return taxa; }
-
- // PRIVATE STUFF
-
- /** Name of this character data */
- private String name = "Time/order character data";
-}
-
diff --git a/LibrarySource/pal/misc/TimeStamp.java b/LibrarySource/pal/misc/TimeStamp.java
deleted file mode 100644
index 5341f5d..0000000
--- a/LibrarySource/pal/misc/TimeStamp.java
+++ /dev/null
@@ -1,66 +0,0 @@
-// TimeStamp.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.misc;
-
-import java.util.*;
-import java.io.*;
-
-
-/**
- * keeps track of program runtime
- *
- * @author Korbinian Strimmer
- */
-public class TimeStamp
-{
- //
- // Public stuff
- //
-
- /** create object and start timer */
- public TimeStamp()
- {
- startDate = new Date();
- startTime = startDate.getTime();
- stopDate = null;
- }
-
- /** stop timer */
- public void stop()
- {
- stopDate = new Date();
- stopTime = stopDate.getTime();
-
- runSecs = Math.round((stopTime - startTime)/100.0)/10.0;
-
- }
-
- /**
- * report on runtime
- *
- * @param out output stream
- */
- public void report(PrintWriter out)
- {
- if (stopDate == null) return;
-
- out.println("Date: " + startDate.toString());
- out.println("Runtime: " + runSecs + " seconds");
- }
-
- //
- // Private stuff
- //
-
- private double runSecs;
- private int status;
- private Date startDate, stopDate;
- private long startTime, stopTime;
-}
-
diff --git a/LibrarySource/pal/misc/UniformWeighting.java b/LibrarySource/pal/misc/UniformWeighting.java
deleted file mode 100644
index 553844c..0000000
--- a/LibrarySource/pal/misc/UniformWeighting.java
+++ /dev/null
@@ -1,124 +0,0 @@
-// UniformWeighting.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.misc;
-import java.io.*;
-
-/**
- * A uniform weighting for n values (where each weighting is 1/n)
- * @version $Id: UniformWeighting.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Matthew Goode
- */
-
-public class UniformWeighting implements Weighting {
- private double[] weightings_;
- /**
- * @param The number of weightings
- */
- public UniformWeighting(int n) {
- this.weightings_ = new double[n];
- for(int i = 0 ; i < n ; i++) {
- weightings_[i] = 1.0/(double)n;
- }
- }
-
- public UniformWeighting(UniformWeighting toCopy) {
- weightings_ = pal.misc.Utils.getCopy(toCopy.weightings_);
- }
-
- public double getWeight(int weightNumber) {
- return weightings_[weightNumber];
- }
-
- public double[] getWeights() {
- return weightings_;
- }
- /** For people who don't like casting...*/
- public Weighting getWeightingCopy() {
- return new UniformWeighting(this);
- }
- /**
- * get number of parameters
- *
- * @return number of parameters
- */
- public int getNumParameters() {
- return 0;
- }
- /**
- * set model parameter
- *
- * @param param parameter value
- * @param n parameter number
- */
- public void setParameter(double param, int n) {
- throw new RuntimeException("Assertion error - Attempting to set paramters");
- }
-
- /**
- * get model parameter
- *
- * @param n parameter number
- *
- * @return parameter value
- */
- public double getParameter(int n) {
- throw new RuntimeException("Assertion error - Attempting to get paramters");
- }
-
-
- /**
- * set standard errors for model parameter
- *
- * @param paramSE standard error of parameter value
- * @param n parameter number
- */
- public void setParameterSE(double paramSE, int n) {
- throw new RuntimeException("Assertion error - Illegal paramter usage");
- }
-
-
- /**
- * get lower parameter limit
- *
- * @param n parameter number
- *
- * @return lower bound
- */
- public double getLowerLimit(int n) {
- throw new RuntimeException("Assertion error - Illegal paramter usage");
- }
-
- /**
- * get upper parameter limit
- *
- * @param n parameter number
- *
- * @return upper bound
- */
- public double getUpperLimit(int n) {
- throw new RuntimeException("Assertion error - Illegal paramter usage");
- }
-
-
- /**
- * get default value of parameter
- *
- * @param n parameter number
- *
- * @return default value
- */
- public double getDefaultValue(int n) {
- throw new RuntimeException("Assertion error - Illegal paramter usage");
- }
-
- public void report(PrintWriter out) {
- out.print("Uniform Weighting");
- }
-}
-
diff --git a/LibrarySource/pal/misc/Units.java b/LibrarySource/pal/misc/Units.java
deleted file mode 100644
index ac7be17..0000000
--- a/LibrarySource/pal/misc/Units.java
+++ /dev/null
@@ -1,24 +0,0 @@
-// Units.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.misc;
-
-/**
- * interface holding unit constants
- *
- * @version $Id: Units.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public interface Units
-{
- int EXPECTED_SUBSTITUTIONS = 0;
- int GENERATIONS = 1;
- int DAYS = 2;
- int YEARS = 3;
-}
-
diff --git a/LibrarySource/pal/misc/Utils.java b/LibrarySource/pal/misc/Utils.java
deleted file mode 100644
index 1349f73..0000000
--- a/LibrarySource/pal/misc/Utils.java
+++ /dev/null
@@ -1,118 +0,0 @@
-// Utils.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.misc;
-
-import pal.math.*;
-
-/**
- * Provides some miscellaneous methods.
- *
- * @version $Id: Utils.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Matthew Goode
- */
-public class Utils {
-
- /** Clones an array of doubles
- * @return null if input is null, otherwise return complete copy.
- */
- public static final double[] getCopy(double[] array) {
- if(array == null) {
- return null;
- }
- double[] copy = new double[array.length];
- for(int i = 0 ; i < copy.length ; i++) {
- copy[i] = array[i];
- }
- return copy;
- }
-
- /** A simple toString method for an array of doubles.
- * No fancy formating.
- * Puts spaces between each value
- */
- public static final String toString(double[] array) {
- StringBuffer sb = new StringBuffer(array.length*7);
- for(int i = 0 ; i < array.length ; i++) {
- sb.append(array[i]);
- sb.append(' ');
- }
- return sb.toString();
- }
-
- /** Creates an interface between a parameterised object to allow it to act as
- a multivariate minimum.
- */
- public static final MultivariateFunction combineMultivariateFunction(MultivariateFunction base, Parameterized[] additionalParameters) {
- return new U_CombineMultiParam(base,additionalParameters);
- }
-}
-
-class U_CombineMultiParam implements MultivariateFunction {
- Parameterized[] additionalParameters_;
- MultivariateFunction base_;
-
- double[] baseArgumentStorage_;
- double[] lowerBounds_;
- double[] upperBounds_;
-
- public U_CombineMultiParam(MultivariateFunction base, Parameterized[] additionalParameters) {
- this.additionalParameters_ = additionalParameters;
- this.base_ = base;
- int numberOfArguments = base_.getNumArguments();
- baseArgumentStorage_ = new double[numberOfArguments];
-
- for(int i = 0 ; i < additionalParameters.length ; i++) {
- numberOfArguments+=additionalParameters[i].getNumParameters();
- }
- lowerBounds_ = new double[numberOfArguments];
- upperBounds_ = new double[numberOfArguments];
- int argumentNumber = 0;
- for(int i = 0 ; i < base_.getNumArguments() ; i++) {
- lowerBounds_[argumentNumber] = base_.getLowerBound(i);
- upperBounds_[argumentNumber] = base_.getUpperBound(i);
- argumentNumber++;
- }
- for(int i = 0 ; i < additionalParameters.length ; i++) {
- for(int j = 0 ; j < additionalParameters[i].getNumParameters() ; j++) {
- lowerBounds_[argumentNumber] = additionalParameters[i].getLowerLimit(j);
- upperBounds_[argumentNumber] = additionalParameters[i].getUpperLimit(j);
- argumentNumber++;
- }
- }
-
- }
-
-
- public double evaluate(double[] argument) {
- int argumentNumber = 0;
- for(int i = 0 ; i < baseArgumentStorage_.length ; i++) {
- baseArgumentStorage_[i] = argument[argumentNumber];
- argumentNumber++;
- }
- for(int i = 0 ; i < additionalParameters_.length ; i++) {
- int numParam = additionalParameters_[i].getNumParameters();
- for(int j = 0 ; j < numParam ; j++) {
- additionalParameters_[i].setParameter(argument[argumentNumber], j);
- argumentNumber++;
- }
- }
- return base_.evaluate(baseArgumentStorage_);
- }
- public int getNumArguments() {
- return lowerBounds_.length;
- }
- public double getLowerBound(int n) {
- return lowerBounds_[n];
- }
-
- public double getUpperBound(int n) {
- return upperBounds_[n];
- }
-}
-
diff --git a/LibrarySource/pal/misc/WeightedFunction.java b/LibrarySource/pal/misc/WeightedFunction.java
deleted file mode 100644
index 928bf6d..0000000
--- a/LibrarySource/pal/misc/WeightedFunction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-// Product.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.misc;
-
-/**
- * A GeneralFucnction that multiplies all the input values.
- *
- * @version $Id: WeightedFunction.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Matthew Goode
- */
-
-public class WeightedFunction implements GeneralFunction {
- GeneralFunction toWeight_;
- Weighting weighting_;
- double[] parameterStore_ = null;
-
- public WeightedFunction(GeneralFunction toWeight, Weighting weighting) {
- this.toWeight_ = toWeight;
- this.weighting_ = weighting;
- }
-
- protected WeightedFunction(WeightedFunction toCopy) {
- this.toWeight_ = toCopy.toWeight_.getGeneralFunctionCopy();
- this.weighting_ = toCopy.weighting_.getWeightingCopy();
- this.parameterStore_ = Utils.getCopy(toCopy.parameterStore_);
- }
-
- /** Assumes number of weights returned by weighting matches number of parameters (ignores additional parameters if not the case)
- */
- public double compute(double[] parameters) {
- double[] weights = weighting_.getWeights();
- if(parameterStore_ == null || parameterStore_.length != weights.length) {
- parameterStore_ = new double[weights.length];
- }
- for(int i = 0 ; i < parameterStore_.length ; i++) {
- parameterStore_[i] = weights[i]*parameters[i];
- }
- return toWeight_.compute(parameterStore_);
- }
-
- public GeneralFunction getGeneralFunctionCopy() {
- return new WeightedFunction(this);
- }
-}
-
diff --git a/LibrarySource/pal/misc/Weighting.java b/LibrarySource/pal/misc/Weighting.java
deleted file mode 100644
index 39251dc..0000000
--- a/LibrarySource/pal/misc/Weighting.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// Weighting.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.misc;
-
-/**
- * interface for classes which provide weighting mechanisms
- *
- * @version $Id: Weighting.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Matthew Goode
- */
-public interface Weighting extends Parameterized, Report, java.io.Serializable {
-
- /** @return an array of weights.
- * @note Users of this array should not alter it in anyway as it may be the array that is used internally by a weighting.
- */
- double[] getWeights();
- /** For people who don't like casting...*/
- Weighting getWeightingCopy();
-}
-
diff --git a/LibrarySource/pal/misc/makefile b/LibrarySource/pal/misc/makefile
deleted file mode 100644
index dca8f11..0000000
--- a/LibrarySource/pal/misc/makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-### VARIABLES ###
-
-JIKESOPTS := +P
-GCJOPTS :=
-
-# Always check dependencies
-JIKESOPTS += +M
-
-SRC := $(wildcard *.java)
-CLS := $(patsubst %.java, %.class, $(SRC))
-OBJ := $(patsubst %.class, %.o, $(wildcard *.class))
-
-
-### RULES ###
-
-# Compile Java sources into class files
-%.class: %.java
- jikes $(JIKESOPTS) $<
-
-# Alternative to using jikes: gcj -C
-
-# Compile class files into native code
-%.o: %.class
- gcj -c $(GCJOPTS) $<
-
-
-### TARGETS ###
-
-.PHONY: classes native clean
-
-classes: $(CLS)
-
-ifneq ($(OBJ),)
-native: $(OBJ)
- (ar -rv package.a *.o; ranlib package.a)
-else
-native: $(OBJ)
-endif
-
-clean:
- rm -f *.class *.o *.u *.a *~
-
diff --git a/LibrarySource/pal/misc/package.html b/LibrarySource/pal/misc/package.html
deleted file mode 100644
index 6a4adf0..0000000
--- a/LibrarySource/pal/misc/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body>
-Classes that don't fit elsewhere ;^)
-</body>
-</html>
diff --git a/LibrarySource/pal/statistics/BootstrapStatistics.java b/LibrarySource/pal/statistics/BootstrapStatistics.java
deleted file mode 100644
index 01a440f..0000000
--- a/LibrarySource/pal/statistics/BootstrapStatistics.java
+++ /dev/null
@@ -1,172 +0,0 @@
-// BootstrapStatistics.java
-//
-// (c) 2000-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.statistics;
-
-import pal.util.*;
-
-
-/**
- * computation of bootstrap estimators (BIAS, SD, VAR, CI)
- * given a statistic theta and corresponding bootstrap replicates.
- *
- * See for background theory:
- * i) B. Efron and R. J.Tibshirani. 1993. An introduction
- * to the bootstrap. Chapman and Hall, New York
- * ii) P. Hall. 1992. The bootstrap and Edgeworth expansion.
- * Springer, New York
- *
- * @version $Id: BootstrapStatistics.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class BootstrapStatistics
-{
- //
- // Public stuff
- //
-
- /**
- * compute bias of a statistic thetaHat in estimating the true theta
- *
- * @param thetaHat the statistic
- * @param thetaHatStar bootstrap replicates of thetaHat
- *
- * @return estimate of bias (notation: BIAS with hat)
- */
- public static double computeBIAS(double thetaHat, double[] thetaHatStar)
- {
- double thetaHatStarMean = DiscreteStatistics.mean(thetaHatStar);
-
- return thetaHatStarMean - thetaHat;
- }
-
- /**
- * correct a statistic thetaHat for its bias
- *
- * @param thetaHat the statistic
- * @param thetaHatStar bootstrap replicates of thetaHat
- *
- * @return bias-corrected estimate
- */
- public static double biasCorrectedEstimate(double thetaHat, double[] thetaHatStar)
- {
- return thetaHat - computeBIAS(thetaHat, thetaHatStar);
- }
-
- /**
- * compute variance of a statistic thetaHat
- *
- * @param thetaHatStar bootstrap replicates of statistic thetaHat
- *
- * @return estimate of variance of thetaHat (notation: VAR with hat)
- */
- public static double computeVAR(double[] thetaHatStar)
- {
- return DiscreteStatistics.variance(thetaHatStar);
- }
-
- /**
- * compute standard error (accuracy) of a statistic thetaHat
- *
- * @param thetaHatStar bootstrap replicates of statistic thetaHat
- *
- * @return estimate of standard error of thetaHat (notation: SD with hat)
- */
- public static double computeSD(double[] thetaHatStar)
- {
- return DiscreteStatistics.stdev(thetaHatStar);
- }
-
-
- /**
- * compute approximate central confidence interval for thetaHat
- * (Efron percentile method)
- *
- * @param level confidence level (e.g., 0.95)
- * @param thetaHatStar bootstrap replicates of statistic thetaHat
- *
- * @return confidence set (array of two doubles)
- */
- public static double[] efronCI(double level, double[] thetaHatStar)
- {
- int[] indices = new int[thetaHatStar.length];
-
- return efronCI(level, thetaHatStar, indices);
- }
-
- /**
- * compute approximate central confidence interval for thetaHat
- * (Efron percentile method)
- *
- * @param level confidence level (e.g., 0.95)
- * @param thetaHatStar bootstrap replicates of statistic thetaHat
- * @param array helper integer array (same length as thetaHatStar)
- *
- * @return confidence set (array of two doubles)
- */
- public static double[] efronCI(double level, double[] thetaHatStar, int[] array)
- {
- HeapSort.sort(thetaHatStar, array);
-
- double alpha = (1.0-level)/2.0;
- double[] result = new double[2];
-
- result[0] = DiscreteStatistics.quantile(alpha, thetaHatStar, array);
- result[1] = DiscreteStatistics.quantile(1.0-alpha, thetaHatStar, array);
-
- return result;
- }
-
- /**
- * compute approximate central confidence interval for thetaHat
- * (Hall percentile method)
- *
- * @param level confidence level (e.g., 0.95)
- * @param thetaHat the statistic
- * @param thetaHatStar bootstrap replicates of statistic thetaHat
- *
- * @return confidence set (array of two doubles)
- */
- public static double[] hallCI(double level, double thetaHat, double[] thetaHatStar)
- {
- int[] indices = new int[thetaHatStar.length];
-
- return hallCI(level, thetaHat, thetaHatStar, indices);
- }
-
- /**
- * compute approximate central confidence interval for thetaHat
- * (Hall percentile method)
- *
- * @param level confidence level (e.g., 0.95)
- * @param thetaHat the statistic
- * @param thetaHatStar bootstrap replicates of statistic thetaHat
- * @param array helper integer array (same length as thetaHatStar)
- *
- * @return confidence set (array of two doubles)
- */
- public static double[] hallCI(double level, double thetaHat, double[] thetaHatStar, int[] array)
- {
- HeapSort.sort(thetaHatStar, array);
-
- double alpha = (1.0-level)/2.0;
- double[] result = new double[2];
-
- // confidence set for the bias (=thetaHatStar-thetaHat)
- double t1 = DiscreteStatistics.quantile(alpha, thetaHatStar, array)-thetaHat;
- double t2 = DiscreteStatistics.quantile(1.0-alpha, thetaHatStar, array)-thetaHat;
-
- // confidence set for the theta
- result[0] = thetaHat-t2;
- result[1] = thetaHat-t1;
-
- return result;
- }
-}
-
diff --git a/LibrarySource/pal/statistics/ChiSquareDistribution.java b/LibrarySource/pal/statistics/ChiSquareDistribution.java
deleted file mode 100644
index c5d77ab..0000000
--- a/LibrarySource/pal/statistics/ChiSquareDistribution.java
+++ /dev/null
@@ -1,97 +0,0 @@
-// ChiSquareDistribution.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.statistics;
-
-import pal.math.*;
-
-
-/**
- * chi-square distribution
- * (distribution of sum of squares of n uniform random variables)
- *
- * (Parameter: n; mean: n; variance: 2*n)
- *
- * The chi-square distribution is a special case of the Gamma distribution
- * (shape parameter = n/2.0, scale = 2.0).
- *
- * @version $Id: ChiSquareDistribution.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class ChiSquareDistribution extends GammaDistribution
-{
- //
- // Public stuff
- //
-
- /**
- * probability density function of the chi-square distribution
- *
- * @param x argument
- * @param n degrees of freedom
- *
- * @return pdf value
- */
- public static double pdf(double x, double n)
- {
- return pdf(x, n/2.0, 2.0);
- }
-
- /**
- * cumulative density function of the chi-square distribution
- *
- * @param x argument
- * @param n degrees of freedom
- *
- * @return cdf value
- */
- public static double cdf(double x, double n)
- {
- return cdf(x, n/2.0, 2.0);
- }
-
-
- /**
- * quantile (inverse cumulative density function) of the chi-square distribution
- *
- * @param x argument
- * @param n degrees of freedom
- *
- * @return icdf value
- */
- public static double quantile(double y, double n)
- {
- return quantile(y, n/2.0, 2.0);
- }
-
- /**
- * mean of the chi-square distribution
- *
- * @param n degrees of freedom
- *
- * @return mean
- */
- public static double mean(double n)
- {
- return n;
- }
-
- /**
- * variance of the chi-square distribution
- *
- * @param n degrees of freedom
- *
- * @return variance
- */
- public static double variance(double n)
- {
- return 2.0*n;
- }
-}
-
diff --git a/LibrarySource/pal/statistics/ChiSquareTest.java b/LibrarySource/pal/statistics/ChiSquareTest.java
deleted file mode 100644
index c8d086f..0000000
--- a/LibrarySource/pal/statistics/ChiSquareTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-// ChiSquareTest.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.statistics;
-
-import pal.math.*;
-
-
-/**
- * chi-square test
- *
- * @version $Id: ChiSquareTest.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class ChiSquareTest
-{
- //
- // Public stuff
- //
-
- /**
- * chi square test
- *
- * @param ef expected frequencies (sum up to 1 !!)
- * @param of observed frequencies (sum up to the number of samples)
- *
- * @return critical significance level (negative if in chi2 test may be invalid)
- */
- public static double compare(double[] ef, int[] of)
- {
- int samples;
- boolean chi2failed = false;
-
- /* compute number of samples */
- samples = 0;
- for (int i = 0; i <of.length; i++)
- {
- samples = samples + of[i];
- }
-
- /* compute chi square */
- double chi2 = 0;
- int below1 = 0;
- int below5 = 0;
- for (int i = 0; i < of.length; i++)
- {
- double efn = ef[i]*((double) samples);
- if (efn < 1.0)
- {
- below1++;
- }
- if (efn < 5.0)
- {
- below5++;
- }
- chi2 = chi2 + ((double) of[i]-efn)*((double) of[i]-efn)/efn;
- }
-
- /* compute significance */
- double criticals = chi2prob(of.length-1, chi2);
-
- /* no expected frequency category (sum up to # samples) below 1.0 */
- if (below1 > 0)
- {
- chi2failed = true;
- }
- /* no more than 1/5 of the frequency categories below 5.0 */
- if (below5 > (int) Math.floor(samples/5.0))
- {
- chi2failed = true;
- }
-
- if (chi2failed)
- {
- return -criticals;
- }
- else
- {
- return criticals;
- }
- }
-
- /**
- * probability that the observed chi-square
- * exceeds chi2 even if model is correct
- *
- * @param deg degrees of freedom
- * @param chi2 chi-square
- *
- * @return probability
- */
- private static double chi2prob (int deg, double chi2)
- {
- return 1.0-ChiSquareDistribution.cdf(chi2, deg);
- }
-}
-
diff --git a/LibrarySource/pal/statistics/DiscreteStatistics.java b/LibrarySource/pal/statistics/DiscreteStatistics.java
deleted file mode 100644
index 017000c..0000000
--- a/LibrarySource/pal/statistics/DiscreteStatistics.java
+++ /dev/null
@@ -1,234 +0,0 @@
-// DiscreteStatistics.java
-//
-// (c) 2000-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.statistics;
-
-import pal.util.*;
-
-
-/**
- * simple discrete statistics (mean, variance, cumulative probability, quantiles etc.)
- *
- * @version $Id: DiscreteStatistics.java,v 1.5 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class DiscreteStatistics
-{
- //
- // Public stuff
- //
-
- /**
- * compute mean
- *
- * @param x list of numbers
- *
- * @return mean
- */
- public static double mean(double[] x)
- {
- double m = 0;
- int len = x.length;
- for (int i = 0; i < len; i++)
- {
- m += x[i];
- }
-
- return m/(double) len;
- }
-
- /**
- * compute variance (ML estimator)
- *
- * @param x list of numbers
- * @param mean assumed mean of x
- *
- * @return variance of x (ML estimator)
- */
- public static double variance(double[] x, double mean)
- {
- double var = 0;
- int len = x.length;
- for (int i = 0; i < len; i++)
- {
- double diff = x[i]-mean;
- var += diff*diff;
- }
-
- int n;
- if (len < 2)
- {
- n = 1; // to avoid division by zero
- }
- else
- {
- n = len-1; // for ML estimate
- }
-
- return var/ (double) n;
- }
-
- /**
- * compute fisher skewness
- *
- * @param x list of numbers
- *
- * @return skewness of x
- */
- public static double skewness(double[] x) {
-
- double mean = mean(x);
- double stdev = stdev(x);
- double skew = 0.0;
- double len = x.length;
-
- for (int i = 0; i < x.length; i++)
- {
- double diff = x[i]-mean;
- diff /= stdev;
-
- skew += (diff*diff*diff);
- }
-
- skew *= (len / ((len - 1) * (len - 2)));
-
- return skew;
- }
-
- /**
- * compute standard deviation
- *
- * @param x list of numbers
- *
- * @return standard deviation of x
- */
- public static double stdev(double[] x) {
- return Math.sqrt(variance(x));
- }
-
- /**
- * compute variance (ML estimator)
- *
- * @param x list of numbers
- *
- * @return variance of x (ML estimator)
- */
- public static double variance(double[] x)
- {
- double m = mean(x);
- return variance(x, m);
- }
-
-
- /**
- * compute variance of sample mean (ML estimator)
- *
- * @param x list of numbers
- * @param mean assumed mean of x
- *
- * @return variance of x (ML estimator)
- */
- public static double varianceSampleMean(double[] x, double mean)
- {
- return variance(x, mean)/(double) x.length;
- }
-
- /**
- * compute variance of sample mean (ML estimator)
- *
- * @param x list of numbers
- *
- * @return variance of x (ML estimator)
- */
- public static double varianceSampleMean(double[] x)
- {
- return variance(x)/(double) x.length;
- }
-
-
- /**
- * compute the q-th quantile for a distribution of x
- * (= inverse cdf)
- *
- * @param q quantile (0 < q <= 1)
- * @param x discrete distribution (an unordered list of numbers)
- * @param indices index sorting x
- *
- * @return q-th quantile
- */
- public static double quantile(double q, double[] x, int[] indices)
- {
- if (q < 0.0 || q > 1.0) throw new IllegalArgumentException("Quantile out of range");
-
- if (q == 0.0)
- {
- // for q==0 we have to "invent" an entry smaller than the smallest x
-
- return x[indices[0]] - 1.0;
- }
-
- return x[indices[(int) Math.ceil(q*x.length)-1]];
- }
-
- /**
- * compute the q-th quantile for a distribution of x
- * (= inverse cdf)
- *
- * @param q quantile (0 <= q <= 1)
- * @param x discrete distribution (an unordered list of numbers)
- *
- * @return q-th quantile
- */
- public static double quantile(double q, double[] x)
- {
- int[] indices = new int[x.length];
- HeapSort.sort(x, indices);
-
- return quantile(q, x, indices);
- }
-
- /**
- * compute the cumulative probability Pr(x <= z) for a given z
- * and a distribution of x
- *
- * @param z threshold value
- * @param x discrete distribution (an unordered list of numbers)
- * @param indices index sorting x
- *
- * @return cumulative probability
- */
- public static double cdf(double z, double[] x, int[] indices)
- {
- int i;
- for (i = 0; i < x.length; i++)
- {
- if (x[indices[i]] > z) break;
- }
-
- return (double) i/ (double) x.length;
- }
-
- /**
- * compute the cumulative probability Pr(x <= z) for a given z
- * and a distribution of x
- *
- * @param z threshold value
- * @param x discrete distribution (an unordered list of numbers)
- *
- * @return cumulative probability
- */
- public static double cdf(double z, double[] x)
- {
- int[] indices = new int[x.length];
- HeapSort.sort(x, indices);
-
- return cdf(z, x, indices);
- }
-}
-
diff --git a/LibrarySource/pal/statistics/ExponentialDistribution.java b/LibrarySource/pal/statistics/ExponentialDistribution.java
deleted file mode 100644
index 903de96..0000000
--- a/LibrarySource/pal/statistics/ExponentialDistribution.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// ExponentialDistribution.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.statistics;
-
-import pal.math.*;
-
-
-/**
- * exponential distribution.
- *
- * (Parameter: lambda; mean: 1/lambda; variance: 1/lambda^2)
- *
- * The exponential distribution is a special case of the Gamma distribution
- * (shape parameter = 1.0, scale = 1/lambda).
- *
- * @version $Id: ExponentialDistribution.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class ExponentialDistribution extends GammaDistribution
-{
- //
- // Public stuff
- //
-
- /**
- * probability density function of the exponential distribution
- * (mean = 1/lambda)
- *
- * @param x argument
- * @param lambda parameter of exponential distribution
- *
- * @return pdf value
- */
- public static double pdf(double x, double lambda)
- {
- return lambda*Math.exp(-lambda*x);
- //return pdf(x, 1.0, 1/lambda);
- }
-
- /**
- * cumulative density function of the exponential distribution
- *
- * @param x argument
- * @param lambda parameter of exponential distribution
- *
- * @return cdf value
- */
- public static double cdf(double x, double lambda)
- {
- return 1.0-Math.exp(-lambda*x);
- //return cdf(x, 1.0, 1/lambda);
- }
-
-
- /**
- * quantile (inverse cumulative density function) of the exponential distribution
- *
- * @param y argument
- * @param lambda parameter of exponential distribution
- *
- * @return icdf value
- */
- public static double quantile(double y, double lambda)
- {
- return -(1.0/lambda)*Math.log(1.0-y);
- //return quantile(y, 1.0, 1/lambda);
- }
-
- /**
- * mean of the exponential distribution
- *
- * @param lambda parameter of exponential distribution
- *
- * @return mean
- */
- public static double mean(double lambda)
- {
- return 1.0/(lambda);
- }
-
- /**
- * variance of the exponential distribution
- *
- * @param lambda parameter of exponential distribution
- *
- * @return variance
- */
- public static double variance(double lambda)
- {
- return 1.0/(lambda*lambda);
- }
-}
-
diff --git a/LibrarySource/pal/statistics/GammaDistribution.java b/LibrarySource/pal/statistics/GammaDistribution.java
deleted file mode 100644
index df933bc..0000000
--- a/LibrarySource/pal/statistics/GammaDistribution.java
+++ /dev/null
@@ -1,180 +0,0 @@
-// GammaDistribution.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.statistics;
-
-import pal.math.*;
-
-
-/**
- * gamma distribution.
- *
- * (Parameters: shape, scale; mean: scale*shape; variance: scale^2*shape)
- *
- * @version $Id: GammaDistribution.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class GammaDistribution
-{
- //
- // Public stuff
- //
-
- /**
- * probability density function of the Gamma distribution
- *
- * @param x argument
- * @param shape shape parameter
- * @param scale scale parameter
- *
- * @return pdf value
- */
- public static double pdf(double x, double shape, double scale)
- {
- return Math.pow(scale,-shape)*Math.pow(x, shape-1.0)/
- Math.exp(x/scale + GammaFunction.lnGamma(shape));
- }
-
- /**
- * cumulative density function of the Gamma distribution
- *
- * @param x argument
- * @param shape shape parameter
- * @param scale scale parameter
- *
- * @return cdf value
- */
- public static double cdf(double x, double shape, double scale)
- {
- return GammaFunction.incompleteGammaP(shape, x/scale);
- }
-
-
- /**
- * quantile (inverse cumulative density function) of the Gamma distribution
- *
- * @param y argument
- * @param shape shape parameter
- * @param scale scale parameter
- *
- * @return icdf value
- */
- public static double quantile(double y, double shape, double scale)
- {
- return 0.5*scale*pointChi2(y, 2.0*shape);
- }
-
- /**
- * mean of the Gamma distribution
- *
- * @param shape shape parameter
- * @param scale scale parameter
- *
- * @return mean
- */
- public static double mean(double shape, double scale)
- {
- return scale*shape;
- }
-
- /**
- * variance of the Gamma distribution
- *
- * @param shape shape parameter
- * @param scale scale parameter
- *
- * @return variance
- */
- public static double variance(double shape, double scale)
- {
- return scale*scale * shape;
- }
-
- // Private
-
- private static double pointChi2(double prob, double v)
- {
- // Returns z so that Prob{x<z}=prob where x is Chi2 distributed with df = v
- // RATNEST FORTRAN by
- // Best DJ & Roberts DE (1975) The percentage points of the
- // Chi2 distribution. Applied Statistics 24: 385-388. (AS91)
-
- double e = 0.5e-6, aa = 0.6931471805, p = prob, g;
- double xx, c, ch, a = 0, q = 0, p1 = 0, p2 = 0, t = 0, x = 0, b = 0, s1, s2, s3, s4, s5, s6;
-
- if (p < 0.000002 || p > 0.999998 || v <= 0)
- {
- throw new IllegalArgumentException("Arguments out of range");
- }
- g = GammaFunction.lnGamma(v/2);
- xx = v/2;
- c = xx-1;
- if (v < -1.24*Math.log(p))
- {
- ch = Math.pow((p*xx*Math.exp(g+xx*aa)), 1/xx);
- if (ch-e < 0)
- {
- return ch;
- }
- }
- else
- {
- if (v > 0.32)
- {
- x = NormalDistribution.quantile(p, 0, 1);
- p1 = 0.222222/v;
- ch = v*Math.pow((x*Math.sqrt(p1)+1-p1), 3.0);
- if(ch>2.2*v+6)
- {
- ch=-2*(Math.log(1-p)-c*Math.log(.5*ch)+g);
- }
- }
- else
- {
- ch = 0.4;
- a = Math.log(1-p);
-
- do
- {
- q = ch;
- p1 = 1+ch*(4.67+ch);
- p2 = ch*(6.73+ch*(6.66+ch));
- t = -0.5+(4.67+2*ch)/p1 - (6.73+ch*(13.32+3*ch))/p2;
- ch -= (1-Math.exp(a+g+.5*ch+c*aa)*p2/p1)/t;
- }
- while (Math.abs(q/ch-1)-.01 > 0);
- }
- }
- do
- {
- q = ch;
- p1 = 0.5*ch;
- if ((t = GammaFunction.incompleteGammaP(xx, p1, g)) < 0)
- {
- throw new IllegalArgumentException("Arguments out of range: t < 0");
- }
- p2 = p-t;
- t = p2*Math.exp(xx*aa+g+p1-c*Math.log(ch));
- b = t/ch;
- a = 0.5*t-b*c;
-
- s1 = (210+a*(140+a*(105+a*(84+a*(70+60*a)))))/420;
- s2 = (420+a*(735+a*(966+a*(1141+1278*a))))/2520;
- s3 = (210+a*(462+a*(707+932*a)))/2520;
- s4 = (252+a*(672+1182*a)+c*(294+a*(889+1740*a)))/5040;
- s5 = (84+264*a+c*(175+606*a))/2520;
- s6 = (120+c*(346+127*c))/5040;
- ch += t*(1+0.5*t*s1-b*c*(s1-b*(s2-b*(s3-b*(s4-b*(s5-b*s6))))));
- }
- while (Math.abs(q/ch-1) > e);
-
- return (ch);
- }
-}
-
diff --git a/LibrarySource/pal/statistics/KishinoHasegawaTest.java b/LibrarySource/pal/statistics/KishinoHasegawaTest.java
deleted file mode 100644
index 2e4a7aa..0000000
--- a/LibrarySource/pal/statistics/KishinoHasegawaTest.java
+++ /dev/null
@@ -1,202 +0,0 @@
-// KishinoHasegawaTest.java
-//
-// (c) 1999-2001 PAL Core Development Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.statistics;
-
-import pal.math.*;
-import pal.misc.*;
-import pal.io.*;
-
-import java.io.*;
-
-/**
- * Kishino-Hasegawa-(Templeton)-Test (1989, 1983) to
- * compare a set of evolutionary hypotheses
- *
- * @version $Id: KishinoHasegawaTest.java,v 1.5 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class KishinoHasegawaTest implements Report
-{
- //
- // Public stuff
- //
-
- /**
- * number of maximum likelihood hypothesis
- */
- public int bestH;
-
- /**
- * log-likelihood difference to maximum likelihood hypothesis
- */
- public double[] delta;
-
- /**
- * estimated error of log-likelihood differences
- */
- public double[] deltaSE;
-
- /**
- * corresponding p-value (two-sided test on normal distribution)
- */
- public double[] pval;
-
- /**
- * Compare all given hypotheses to the best (ML) hypothesis
- * and store results in public arrays delta, deltaSE, pval
- * (which will automatically be created by this procedure).
- *
- * @param sLogL log-likelihoods of each site
- */
- public void compare(double[][] sLogL)
- {
- khtest(sLogL, null);
- }
-
- /**
- * Compare all given hypotheses to the best (ML) hypothesis
- * and store results in public arrays delta, deltaSE, pval
- * (which will automatically be created by this procedure).
- *
- * @param pLogL log-likelihoods of each pattern
- * @param alias map of patterns to sites in sequence
- */
- public void compare(double[][] pLogL, int[] alias)
- {
- khtest(pLogL, alias);
- }
-
- public void report(PrintWriter out)
- {
- FormattedOutput fo = FormattedOutput.getInstance();
- out.println("KISHINO-HASEGAWA TEST:");
- out.println();
- out.println("tree\tdeltaL\tS.E.\tpval (two-sided)");
- out.println("----------------------------------------");
- for (int i = 0; i < pval.length; i++)
- {
- out.print((i+1) + "\t");
- fo.displayDecimal(out, delta[i], 2);
- out.print("\t");
- fo.displayDecimal(out, deltaSE[i], 2);
- out.print("\t");
- fo.displayDecimal(out, pval[i], 4);
- if (pval[i] < 0.05)
- {
- out.println(" **");
- }
- else
- {
- out.println();
- }
- }
- out.println();
- out.println("** indicates a tree that is significantly worse than the ML tree (5% level)");
- }
-
- //
- // Private stuff
- //
-
- private void khtest(double[][] pLogL, int[] alias)
- {
- // number of hypotheses
- int numH = pLogL.length;
-
- // allocate memory for results
- delta = new double[numH];
- deltaSE = new double[numH];
- pval = new double[numH];
-
- // number of sites
- // if alias==null assume one-to-one mapping of sites and patterns
- int numSites;
- if (alias == null)
- {
- numSites = pLogL[0].length;
- }
- else
- {
- numSites = alias.length;
- }
-
- // log likelihood of each hypothesis
- double[] logL = new double[numH];
- for (int i = 0; i < numSites; i++)
- {
- int p;
- if (alias == null)
- {
- p = i;
- }
- else
- {
- p = alias[i];
- }
-
- for (int j = 0; j < numH; j++)
- {
- logL[j] += pLogL[j][p];
- }
- }
-
- // find maximum-likelihood hypothesis
- bestH = 0;
- double maxLogL = logL[0];
- for (int i = 1; i < numH; i++)
- {
- if (logL[i] > maxLogL)
- {
- bestH = i;
- maxLogL = logL[i];
- }
- }
-
- // compute log-likelihood differences to best hypothesis
- for (int i = 0; i < numH; i++)
- {
- delta[i] = logL[bestH]-logL[i];
- }
-
- // estimate standard error of log-likelihood differences
- for (int i = 0; i < numH; i++)
- {
- double mean = delta[i]/numSites;
- double var = 0.0;
- for (int j = 0; j < numSites; j++)
- {
- int p;
- if (alias == null)
- {
- p = j;
- }
- else
- {
- p = alias[j];
- }
-
- double diff = pLogL[bestH][p]-pLogL[i][p]-mean;
- var += diff*diff;
- }
-
- deltaSE[i] = Math.sqrt(numSites*var/(numSites-1));
- }
-
- // compute corresponding p-values
- for (int i = 0; i < numH; i++)
- {
- pval[i] = ErrorFunction.erfc(delta[i]/deltaSE[i]/Math.sqrt(2.0));
- }
-
- // free memory
- logL = null;
- }
-}
-
diff --git a/LibrarySource/pal/statistics/LikelihoodRatioTest.java b/LibrarySource/pal/statistics/LikelihoodRatioTest.java
deleted file mode 100644
index 337cc1e..0000000
--- a/LibrarySource/pal/statistics/LikelihoodRatioTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-// LikelihoodRatioTest.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.statistics;
-
-import pal.math.*;
-
-
-/**
- * Likelihood ratio test based on chi-square statistics
- *
- * @version $Id: LikelihoodRatioTest.java,v 1.5 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class LikelihoodRatioTest
-{
- //
- // Public stuff
- //
-
- /**
- * compute significance level for the differences
- * in log-likelihood (based on chi-square distribution)
- *
- * @param deltaL difference of Log Likelihood values (>=0)
- * @param df degrees of freedom
- *
- * @return significance level
- */
- public static double getSignificance(double deltaL, int df)
- {
- return 1.0-ChiSquareDistribution.cdf(2.0*deltaL, df);
- }
-}
-
diff --git a/LibrarySource/pal/statistics/ModelSupport.java b/LibrarySource/pal/statistics/ModelSupport.java
deleted file mode 100644
index bac3442..0000000
--- a/LibrarySource/pal/statistics/ModelSupport.java
+++ /dev/null
@@ -1,341 +0,0 @@
-// ModelSupport.java
-//
-// (c) 2001 PAL Core Development Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.statistics;
-
-import pal.math.*;
-import pal.util.*;
-import pal.io.*;
-import pal.misc.*;
-
-import java.io.*;
-
-/**
- * Computes Akaike weights and expected Akaike weights
- * (relative evidence, expected relative evidence)
- * for a set of models and computes corresponding confidence sets
- *
- * @version $Id: ModelSupport.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class ModelSupport implements Report
-{
- //
- // Public stuff
- //
-
- /**
- * likelhood order of the tree hypotheses
- */
- public int[] likelihoodOrder;
-
- /**
- * support order of the tree hypotheses
- */
- public int[] supportOrder;
-
- /**
- * log-likelihood differences to the best tree
- */
- public double[] deltaL;
-
- /**
- * posterior probabilities for each hypothesis
- */
- public double[] posterior;
-
- /**
- * support in each hypothesis
- */
- public double[] support;
-
- /**
- * number of bootstrap replicates
- */
- public int numBootstraps;
-
- /**
- * Determine posterior probabilties and support values
- * for each hypothesis and store results in public arrays
- * posterior, support etc which will automatically be
- * created by this procedure.
- *
- * @param sLogL log-likelihoods of each site
- * @param numBoot number of bootstraps
- */
- public void compare(double[][] sLogL, int numBoot)
- {
- srtest(sLogL, null, numBoot);
- }
-
- /**
- * Determine posterior probabilties and support values
- * for each hypothesis and store results in public arrays
- * posterior, support etc which will automatically be
- * created by this procedure.
- *
- * @param pLogL log-likelihoods of each pattern
- * @param alias map of patterns to sites in sequence
- * @param numBoot number of bootstraps
- */
- public void compare(double[][] pLogL, int[] alias, int numBoot)
- {
- srtest(pLogL, alias, numBoot);
- }
-
- public void report(PrintWriter out)
- {
- FormattedOutput fo = FormattedOutput.getInstance();
-
- out.println("CREDIBLE SET " + numBootstraps + " bootstraps):");
- out.println();
- out.println("tree\tdeltaL\tpost\tsupp");
- out.println("--------------------------------");
-
- for (int i = 0; i < deltaL.length; i++)
- {
- out.print((i+1) + "\t");
- fo.displayDecimal(out, deltaL[i], 2);
- out.print("\t");
- fo.displayDecimal(out, posterior[i], 4);
- out.print("\t");
- fo.displayDecimal(out, support[i], 4);
- out.println();
- }
- out.println();
- out.println("prob = Akaike weight (non-informative posterior probability)");
- out.println("supp = expected Akaike weight");
-
- out.println();
- out.println();
- out.println("supp\toptimal 95% credible sets (expected Akaike weights)");
- out.println("------------------------------------------------------------");
- printSets(out, supportOrder, 0.95);
-
- /*out.println();
- out.println();
- out.println("supp\talternative 95% confidence sets (using deltaL order)");
- out.println("------------------------------------------------------------");
- printSets(out, likelihoodOrder, 0.95);*/
-
- out.println();
- }
-
- //
- // Private stuff
- //
-
- private void printSets(PrintWriter out, int[] order, double level)
- {
- FormattedOutput fo = FormattedOutput.getInstance();
-
- double conf = 0.0;
- double conf2;
- int pos = 0;
-
- while (conf < level)
- {
- conf += support[order[pos]];
-
- if (pos+1 < order.length)
- {
- conf2 = conf + support[order[pos+1]];
- }
- else
- {
- conf2 = conf;
- }
-
- if (conf2 >= level)
- {
- fo.displayDecimal(out, conf, 4);
- out.print("\t{" + (order[0]+1));
- for (int i = 0; i < pos; i++)
- {
- out.print(", " + (order[i+1]+1));
- }
- out.println("}");
- }
-
- pos++;
- }
- }
-
- private void srtest(double[][] pLogL, int[] alias, int numBoot)
- {
- // number of hypothesis
- int numH = pLogL.length;
-
- // allocate public arrays
- deltaL = new double[numH];
- support = new double[numH];
- posterior = new double[numH];
- likelihoodOrder = new int[numH];
- supportOrder = new int[numH];
-
- // number of bootstrap replicates
- numBootstraps = numBoot;
-
- // number of sites
- // if alias==null assume one-to-one mapping of sites and patterns
- int numSites;
- if (alias == null)
- {
- numSites = pLogL[0].length;
- }
- else
- {
- numSites = alias.length;
- }
-
-
- // Compute log-likelihoods, their order,
- // their deltas and their posteriors
- for (int j = 0; j < numSites; j++)
- {
- int p;
- if (alias == null)
- {
- p = j;
- }
- else
- {
- p = alias[j];
- }
-
- for (int k = 0; k < numH; k++)
- {
- deltaL[k] -= pLogL[k][p];
- }
- }
- HeapSort.sort(deltaL, likelihoodOrder);
-
- // Compute deltas
- double maxL= -deltaL[likelihoodOrder[0]];
- for (int j = 0; j < numH; j++)
- {
- deltaL[j] = -(deltaL[j]+maxL);
- }
-
- // compute posterior probabilities
- double sum1 = 0;
- for (int j = 0; j < numH; j++)
- {
- posterior[j] = Math.exp(deltaL[j]);
- sum1 += posterior[j];
- }
- for (int j = 0; j < numH; j++)
- {
- posterior[j] = posterior[j]/sum1;
- }
-
- // reverse sign of delta L
- for (int j = 0; j < numH; j++)
- {
- deltaL[j] = -deltaL[j];
- }
- deltaL[likelihoodOrder[0]] = 0.0;
-
-
- // Resample data
-
- // temporary memory
- double[] rs = new double[numH];
-
- MersenneTwisterFast mt = new MersenneTwisterFast();
- for (int i = 0; i < numBoot; i++)
- {
- for (int k = 0; k < numH; k++)
- {
- rs[k] = 0;
- }
-
- for (int j = 0; j < numSites; j++)
- {
- int s = mt.nextInt(numSites);
-
- int p;
- if (alias == null)
- {
- p = s;
- }
- else
- {
- p = alias[s];
- }
-
- for (int k = 0; k < numH; k++)
- {
- rs[k] += pLogL[k][p];
- }
- }
-
- // find ml hypothesis
- double maxLogL = findMax(rs);
-
- // compute log-likelihood difference
- for (int k = 0; k < numH; k++)
- {
- rs[k] = rs[k] - maxLogL;
- }
-
- // compute posteriors and sum over resampleds data set
- double sum = 0;
- for (int k = 0; k < numH; k++)
- {
- rs[k] = Math.exp(rs[k]);
- sum += rs[k];
- }
- for (int k = 0; k < numH; k++)
- {
- support[k] += rs[k]/sum;
- }
- }
-
- // compute support values
- for (int j = 0; j < numH; j++)
- {
- support[j] = support[j]/numBoot;
- }
-
- // determine order of support (smallest->largest)
- HeapSort.sort(support, supportOrder);
-
- // reversing the order
- int len = supportOrder.length;
- for (int i = 0; i < len/2; i++)
- {
- int tmp = supportOrder[i];
- supportOrder[i] = supportOrder[len-i-1];
- supportOrder[len-i-1] = tmp;
- }
-
- // free temporary memory
- rs = null;
- }
-
- private double findMax(double[] array)
- {
- int len = array.length;
-
- int best = 0;
- double max = array[0];
- for (int i = 1; i < len; i++)
- {
- if (array[i] > max)
- {
- best = i;
- max = array[i];
- }
- }
-
- return max;
- }
-}
-
diff --git a/LibrarySource/pal/statistics/NormalDistribution.java b/LibrarySource/pal/statistics/NormalDistribution.java
deleted file mode 100644
index ef62680..0000000
--- a/LibrarySource/pal/statistics/NormalDistribution.java
+++ /dev/null
@@ -1,99 +0,0 @@
-// NormalDistribution.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.statistics;
-
-import pal.math.*;
-
-/**
- * normal distribution (pdf, cdf, quantile)
- *
- * @version $Id: NormalDistribution.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class NormalDistribution
-{
- //
- // Public stuff
- //
-
- /**
- * probability density function
- *
- * @param x argument
- * @param m mean
- * @param sd standard deviation
- *
- * @return pdf at x
- */
- public static double pdf(double x, double m, double sd)
- {
- double a = 1.0/(Math.sqrt(2.0*Math.PI)*sd);
- double b = -(x-m)*(x-m)/(2.0*sd*sd);
-
- return a*Math.exp(b);
- }
-
- /**
- * cumulative density function
- *
- * @param x argument
- * @param m mean
- * @param sd standard deviation
- *
- * @return cdf at x
- */
- public static double cdf(double x, double m, double sd)
- {
- double a = (x-m)/(Math.sqrt(2.0)*sd);
-
- return 0.5*(1.0+ErrorFunction.erf(a));
- }
-
- /**
- * quantiles (=inverse cumulative density function)
- *
- * @param z argument
- * @param m mean
- * @param sd standard deviation
- *
- * @return icdf at z
- */
- public static double quantile(double z, double m, double sd)
- {
- return m + Math.sqrt(2.0)*sd*ErrorFunction.inverseErf(2.0*z-1.0);
- }
-
- /**
- * mean
- *
- * @param m mean
- * @param sd standard deviation
- *
- * @return mean
- */
- public static double mean(double m, double sd)
- {
- return m;
- }
-
- /**
- * variance
- *
- * @param m mean
- * @param sd standard deviation
- *
- * @return variance
- */
- public static double variance(double m, double sd)
- {
- return sd*sd;
- }
-}
-
diff --git a/LibrarySource/pal/statistics/ParetoDistribution.java b/LibrarySource/pal/statistics/ParetoDistribution.java
deleted file mode 100644
index bd7ca1f..0000000
--- a/LibrarySource/pal/statistics/ParetoDistribution.java
+++ /dev/null
@@ -1,122 +0,0 @@
-// ParetoDistribution.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.statistics;
-
-import pal.math.*;
-
-
-/**
- * Pareto distribution
- * (scale-free distribution without characteristic length scale).
- *
- * Parameters: shape parameter k>0, scale parameter m>0 ("minimum income")
- *
- * @version $Id: ParetoDistribution.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class ParetoDistribution
-{
- //
- // Public stuff
- //
-
- /**
- * probability density function of the Pareto distribution
- *
- * @param x argument (>=m)
- * @param k shape parameter (>0)
- * @param m scale parameter (>0, "minimum income")
- *
- * @return pdf value
- */
- public static double pdf(double x, double k, double m)
- {
- return k*Math.pow(m,k)*Math.pow(x,-(k+1));
- }
-
- /**
- * cumulative density function of the Pareto distribution
- *
- * @param x argument (>=m)
- * @param k shape parameter (>0)
- * @param m scale parameter (>0, "minimum income")
- *
- * @return cdf value
- */
- public static double cdf(double x, double k, double m)
- {
- return 1.0-Math.pow(m/x, k);
- }
-
-
- /**
- * quantile (inverse cumulative density function) of the Pareto distribution
- *
- * @param p argument (0 < p < 1)
- * @param k shape parameter (>0)
- * @param m scale parameter (>0, "minimum income")
- *
- * @return icdf value
- */
- public static double quantile(double p, double k, double m)
- {
- return m/Math.pow(1.0-p,1.0/k);
- }
-
- /**
- * mean of the Pareto distribution
- *
- * @param k shape parameter (>0)
- * @param m scale parameter (>0, "minimum income")
- *
- * @return mean
- */
- public static double mean(double k, double m)
- {
- if (k > 1.0)
- return m*k/(k-1.0);
- else
- return Double.POSITIVE_INFINITY;
- }
-
- /**
- * variance of the Pareto distribution
- *
- * @param k shape parameter (>0)
- * @param m scale parameter (>0, "minimum income")
- *
- * @return variance
- */
- public static double variance(double k, double m)
- {
- if (k > 2.0)
- return m*m*k/((k-1.0)*(k-1.0)*(k-2.0));
- else
- return Double.POSITIVE_INFINITY;
- }
-
- /**
- * moments E(X^n) of the Pareto distribution
- *
- * @param n moment
- * @param k shape parameter (>0)
- * @param m scale parameter (>0, "minimum income")
- *
- * @return variance
- */
- public static double moment(int n, double k, double m)
- {
- if (k > n)
- return Math.pow(m,n)*k/(k-n);
- else
- return Double.POSITIVE_INFINITY;
- }
-}
-
diff --git a/LibrarySource/pal/statistics/PenalizedLikelihood.java b/LibrarySource/pal/statistics/PenalizedLikelihood.java
deleted file mode 100644
index cdadb50..0000000
--- a/LibrarySource/pal/statistics/PenalizedLikelihood.java
+++ /dev/null
@@ -1,71 +0,0 @@
-// PenalizedLikelihood.java
-//
-// (c) 20001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.statistics;
-
-import pal.math.*;
-
-
-/**
- * Penalized likelihood criteria
- *
- * @version $Id: PenalizedLikelihood.java,v 1.1 2001/07/10 09:16:29 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class PenalizedLikelihood
-{
- //
- // Public stuff
- //
-
- /**
- * Akaike (AIC) correction (Akaike 1974)
- *
- * @param l log-likelihood
- * @param k number of inferred parameters
- *
- * @return l - k
- */
- public static double AIC(double l, int k)
- {
- return l - (double) k;
- }
-
- /**
- * BIC correction (Schwarz 1978)
- *
- * @param l log-likelihood
- * @param k number of inferred parameters
- * @param n sample size
- *
- * @return l - k/2 log(n)
- */
- public static double BIC(double l, int k, int n)
- {
- return l - (double)k/2.0* Math.log(n);
- }
-
- /**
- * Second-order Akaike (AICC) correction (Hurvich and Tsai 1989)
- *
- * @param l log-likelihood
- * @param k number of inferred parameters
- * @param n sample size
- *
- * @return l - k - (k(k+1))/(n - k - 1)
- */
- public static double AICC(double l, int k, int n)
- {
- if (k > n-2) throw new IllegalArgumentException("k must be smaller than n-1");
-
- return l - k - (double) (k*(k+1.0))/ (double) (n - k - 1.0) ;
- }
-
-}
-
diff --git a/LibrarySource/pal/statistics/ShimodairaHasegawaTest.java b/LibrarySource/pal/statistics/ShimodairaHasegawaTest.java
deleted file mode 100644
index 4d9666d..0000000
--- a/LibrarySource/pal/statistics/ShimodairaHasegawaTest.java
+++ /dev/null
@@ -1,262 +0,0 @@
-// ShimodairaHasegawaTest.java
-//
-// (c) 1999-2001 PAL Core Development Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.statistics;
-
-import pal.math.*;
-import pal.io.*;
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * Shimodaira-Hasegawa-Test (1999) to
- * compare a set of evolutionary hypotheses
- *
- * @version $Id: ShimodairaHasegawaTest.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class ShimodairaHasegawaTest implements Report
-{
- //
- // Public stuff
- //
-
- /**
- * number of maximum likelihood hypothesis
- */
- public int bestH;
-
- /**
- * log-likelihood difference to maximum likelihood hypothesis
- */
- public double[] delta;
-
- /**
- * corresponding p-value
- */
- public double[] pval;
-
- /**
- * number of bootstrap replicates
- */
- public int numBootstraps;
-
-
- /**
- * Compare all given hypotheses to the best (ML) hypothesis
- * and store results in public arrays delta, pval
- * (which will automatically be created by this procedure).
- *
- * @param sLogL log-likelihoods of each site
- * @param numBoot number of bootstraps
- */
- public void compare(double[][] sLogL, int numBoot)
- {
- shtest(sLogL, null, numBoot);
- }
-
- /**
- * Compare all given hypotheses to the best (ML) hypothesis
- * and store results in public arrays delta, pval
- * (which will automatically be created by this procedure).
- *
- * @param pLogL log-likelihoods of each pattern
- * @param alias map of patterns to sites in sequence
- * @param numBoot number of bootstraps
- */
- public void compare(double[][] pLogL, int[] alias, int numBoot)
- {
- shtest(pLogL, alias, numBoot);
- }
-
- public void report(PrintWriter out)
- {
- FormattedOutput fo = FormattedOutput.getInstance();
- out.println("SHIMODAIRA-HASEGAWA TEST (" + numBootstraps + " bootstraps):");
- out.println();
- out.println("tree\tdeltaL\tpval");
- out.println("--------------------------");
-
- for (int i = 0; i < pval.length; i++)
- {
- out.print((i+1) + "\t");
- fo.displayDecimal(out, delta[i], 2);
- out.print("\t");
- fo.displayDecimal(out, pval[i], 4);
- if (pval[i] < 0.05)
- {
- out.println(" **");
- }
- else
- {
- out.println();
- }
- }
-
- out.println();
- out.println("** indicates a tree that is significantly worse than the ML tree (5% level)");
- }
-
- //
- // Private stuff
- //
-
- private void shtest(double[][] pLogL, int[] alias, int numBoot)
- {
- // number of hypothesis
- int numH = pLogL.length;
-
- // number of bootstrap replicates
- numBootstraps = numBoot;
-
- // allocate memory for results
- delta = new double[numH];
- pval = new double[numH];
-
- // number of sites
- // if alias==null assume one-to-one mapping of sites and patterns
- int numSites;
- if (alias == null)
- {
- numSites = pLogL[0].length;
- }
- else
- {
- numSites = alias.length;
- }
-
- // log likelihood of each hypothesis
- double[] logL = new double[numH];
- for (int i = 0; i < numSites; i++)
- {
- int p;
- if (alias == null)
- {
- p = i;
- }
- else
- {
- p = alias[i];
- }
-
- for (int j = 0; j < numH; j++)
- {
- logL[j] += pLogL[j][p];
- }
- }
-
- // find maximum-likelihood hypothesis
- bestH = 0;
- double maxLogL = logL[0];
- for (int i = 1; i < numH; i++)
- {
- if (logL[i] > maxLogL)
- {
- bestH = i;
- maxLogL = logL[i];
- }
- }
-
- // compute log-likelihood differences to best hypothesis
- for (int i = 0; i < numH; i++)
- {
- delta[i] = logL[bestH]-logL[i];
- }
-
- // allocate temporary memory for resampling procedure
- double[][] rs = new double[numH][numBoot];
-
- // Resample data
- MersenneTwisterFast mt = new MersenneTwisterFast();
- for (int i = 0; i < numBoot; i++)
- {
- for (int j = 0; j < numSites; j++)
- {
- int s = mt.nextInt(numSites);
-
- int p;
- if (alias == null)
- {
- p = s;
- }
- else
- {
- p = alias[s];
- }
-
- for (int k = 0; k < numH; k++)
- {
- rs[k][i] += pLogL[k][p];
- }
- }
- }
-
- // center resampled log-likelihoods
- for (int i = 0; i < numH; i++)
- {
- double m = DiscreteStatistics.mean(rs[i]);
-
- for (int j = 0; j < numBoot; j++)
- {
- rs[i][j] = rs[i][j]-m;
- }
- }
-
- // compute resampled log-likelihood differences
- for (int i = 0; i < numBoot; i++)
- {
- double max = findMaxInColumn(rs, i);
-
- for (int j = 0; j < numH; j++)
- {
- rs[j][i] = max - rs[j][i];
- }
- }
-
- // compute p-values for each hypothesis
- for (int i = 0; i < numH; i++)
- {
- int count = 0;
- for (int j = 0; j < numBoot; j++)
- {
- if (rs[i][j] >= delta[i])
- {
- count++;
- }
- }
-
- pval[i] = (double) count/(double) numBoot;
- }
-
- // free memory
- rs = null;
- logL = null;
- }
-
- private double findMaxInColumn(double[][] array, int column)
- {
- int len = array.length;
-
- int best = 0;
- double max = array[0][column];
- for (int i = 1; i < len; i++)
- {
- if (array[i][column] > max)
- {
- best = i;
- max = array[i][column];
- }
- }
-
- return max;
- }
-}
-
diff --git a/LibrarySource/pal/statistics/makefile b/LibrarySource/pal/statistics/makefile
deleted file mode 100644
index dca8f11..0000000
--- a/LibrarySource/pal/statistics/makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-### VARIABLES ###
-
-JIKESOPTS := +P
-GCJOPTS :=
-
-# Always check dependencies
-JIKESOPTS += +M
-
-SRC := $(wildcard *.java)
-CLS := $(patsubst %.java, %.class, $(SRC))
-OBJ := $(patsubst %.class, %.o, $(wildcard *.class))
-
-
-### RULES ###
-
-# Compile Java sources into class files
-%.class: %.java
- jikes $(JIKESOPTS) $<
-
-# Alternative to using jikes: gcj -C
-
-# Compile class files into native code
-%.o: %.class
- gcj -c $(GCJOPTS) $<
-
-
-### TARGETS ###
-
-.PHONY: classes native clean
-
-classes: $(CLS)
-
-ifneq ($(OBJ),)
-native: $(OBJ)
- (ar -rv package.a *.o; ranlib package.a)
-else
-native: $(OBJ)
-endif
-
-clean:
- rm -f *.class *.o *.u *.a *~
-
diff --git a/LibrarySource/pal/statistics/package.html b/LibrarySource/pal/statistics/package.html
deleted file mode 100644
index 69311da..0000000
--- a/LibrarySource/pal/statistics/package.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
-<body>
-Classes with useful for statistics (normal distribution,
-Gamma distribution, chi-square distribution, exponential distribution,
-likelihood-ratio test, chi-square test, descriptive statistics, bootstrap estimators etc.)
-</body>
-</html>
-
diff --git a/LibrarySource/pal/substmodel/AbstractRateMatrix.java b/LibrarySource/pal/substmodel/AbstractRateMatrix.java
deleted file mode 100644
index 7f69bbf..0000000
--- a/LibrarySource/pal/substmodel/AbstractRateMatrix.java
+++ /dev/null
@@ -1,278 +0,0 @@
-// RateMatrix.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-import pal.io.*;
-import pal.datatype.*;
-
-import java.io.*;
-
-
-/**
- * abstract base class for all rate matrices
- *
- * @version $Id: AbstractRateMatrix.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-abstract public class AbstractRateMatrix implements RateMatrix
-{
- //
- // Public stuff
- //
-
- // Constraints and conventions:
- // - first argument: row
- // - second argument: column
- // - transition: from row to column
- // - sum of every row = 0
- // - sum of frequencies = 1
- // - frequencies * rate matrix = 0 (stationarity)
- // - expected number of substitutions = 1 (Sum_i pi_i*R_ii = 0)
-
- /** dimension */
- public int dimension;
-
- /** stationary frequencies (sum = 1.0) */
- public double[] frequency;
-
- /**
- * rate matrix (transition: from 1st index to 2nd index)
- */
- public double[][] rate;
-
- /** data type */
- public DataType dataType;
-
- /**
- * get numerical code describing the data type
- *
- * @return integer code identifying a data type
- */
- public int getTypeID() {
- return dataType.getTypeID();
- }
-
- /**
- * get numerical code describing the model type
- *
- * @return integer code identifying a substitution model
- */
- abstract public int getModelID();
-
- public int getDimension() {
- return dimension;
- }
-
- /**
- * @return stationary frequencies (sum = 1.0)
- */
- public double[] getEqulibriumFrequencies() {
- return frequency;
- }
-
- /**
- * @return stationary frequencie (sum = 1.0) for ith state
- */
- public double getEqulibriumFrequency(int i) {
- return frequency[i];
- }
-
-
- /** For those that like Getter/Setters */
- public DataType getDataType() {
- return dataType;
- }
-
- /**
- Return a matrix exponential appropriate to this ratematrix (generally returns SimpleRateMatrix())
- */
- public TransitionProbability getTransitionProbability() {
- return new MatrixExponential(this);
- }
-
- /**
- Return a matrix exponential appropriate to this ratematrix (generally returns SimpleRateMatrix())
- given an old matrix exponential (may reuse old matrix exponential)
- */
- public TransitionProbability getTransitionProbability(TransitionProbability old) {
- if(old instanceof MatrixExponential) {
- ((MatrixExponential)old).setMatrix(this);
- return old;
- }
- return getTransitionProbability();
- }
-
- /**
- * @return rate matrix (transition: from 1st index to 2nd index)
- */
- public double[][] getRelativeRates() {
- return rate;
- }
-
- // interface Report (remains abstract)
-
- // interface Parameterized (remains abstract)
-
-
- //
- // Protected stuff (for use in derived classes)
- //
-
- // Constructor
- protected AbstractRateMatrix(int dim)
- {
- format = FormattedOutput.getInstance();
-
- dimension = dim;
- frequency = new double[dim];
- rate = new double[dim][dim];
- }
-
- protected FormattedOutput format;
-
- protected void printFrequencies(PrintWriter out)
- {
- for (int i = 0; i < dimension; i++)
- {
- out.print("pi(" + dataType.getChar(i) + ") = ");
- format.displayDecimal(out, frequency[i], 5);
- out.println();
- }
- out.println();
- }
-
- protected void setFrequencies(double[] f)
- {
- for (int i = 0; i < dimension; i++)
- {
- frequency[i] = f[i];
- }
- checkFrequencies();
- }
-
- // Computes normalized rate matrix from Q matrix (general reversible model)
- // - Q_ii = 0
- // - Q_ij = Q_ji
- // - Q_ij is stored in R_ij (rate)
- // - only upper triangular is used
- protected void fromQToR()
- {
- double q;
-
- for (int i = 0; i < dimension; i++)
- {
- for (int j = i + 1; j < dimension; j++)
- {
- q = rate[i][j];
- rate[i][j] = q*frequency[j];
- rate[j][i] = q*frequency[i];
- }
- }
-
- makeValid();
- normalize();
- }
-
-
- //
- // Private stuff
- //
-
- // Make it a valid rate matrix (make sum of rows = 0)
- private void makeValid()
- {
- for (int i = 0; i < dimension; i++)
- {
- double sum = 0.0;
- for (int j = 0; j < dimension; j++)
- {
- if (i != j)
- {
- sum += rate[i][j];
- }
- }
- rate[i][i] = -sum;
- }
- }
-
- // Normalize rate matrix to one expected substitution per unit time
- private void normalize()
- {
- double subst = 0.0;
-
- for (int i = 0; i < dimension; i++)
- {
- subst += -rate[i][i]*frequency[i];
- }
- for (int i = 0; i < dimension; i++)
- {
- for (int j = 0; j < dimension; j++)
- {
- rate[i][j] = rate[i][j]/subst;
- }
- }
- }
-
- /**
- * ensures that frequencies are not smaller than MINFREQ and
- * that two frequencies differ by at least 2*MINFDIFF.
- * This avoids potentiak problems later when eigenvalues
- * are computed.
- */
- private void checkFrequencies()
- {
- // required frequency difference
- double MINFDIFF = 1e-10;
-
- // lower limit on frequency
- double MINFREQ = 1e-10;
-
- int maxi = 0;
- double sum = 0.0;
- double maxfreq = 0.0;
- for (int i = 0; i < dimension; i++)
- {
- double freq = frequency[i];
- if (freq < MINFREQ) frequency[i] = MINFREQ;
- if (freq > maxfreq)
- {
- maxfreq = freq;
- maxi = i;
- }
- sum += frequency[i];
- }
- frequency[maxi] += 1.0 - sum;
-
- for (int i = 0; i < dimension - 1; i++)
- {
- for (int j = i+1; j < dimension; j++)
- {
- if (frequency[i] == frequency[j])
- {
- frequency[i] += MINFDIFF;
- frequency[j] -= MINFDIFF;
- }
- }
- }
- }
-
- public Object clone() {
- try {
- RateMatrix matrix = (RateMatrix)super.clone();
- return matrix;
- } catch (CloneNotSupportedException e) {
- // this shouldn't happen
- throw new InternalError();
- }
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/AminoAcidModel.java b/LibrarySource/pal/substmodel/AminoAcidModel.java
deleted file mode 100644
index 96219f3..0000000
--- a/LibrarySource/pal/substmodel/AminoAcidModel.java
+++ /dev/null
@@ -1,192 +0,0 @@
-// AminoAcidModel.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.substmodel;
-
-import pal.misc.*;
-import pal.datatype.*;
-
-import java.io.*;
-
-
-/**
- * base class of rate matrices for amino acids
- *
- * @version $Id: AminoAcidModel.java,v 1.6 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public abstract class AminoAcidModel extends AbstractRateMatrix implements RateMatrix
-{
-
- /**
- * Create amino acid model according to model type
- *
- * @param modelID model code
- * @param freq model frequencies
- *
- * @return amino acid rate matrix
- */
- public static AminoAcidModel getInstance(int modelID, double[] freq)
- {
- if (modelID == AminoAcidModelID.DAYHOFF)
- {
- return new Dayhoff(freq);
- }
- else if (modelID == AminoAcidModelID.JTT)
- {
- return new JTT(freq);
- }
- else if (modelID == AminoAcidModelID.MTREV24)
- {
- return new MTREV24(freq);
- }
- else if (modelID == AminoAcidModelID.BLOSUM62)
- {
- return new BLOSUM62(freq);
- }
- else if (modelID == AminoAcidModelID.VT)
- {
- return new VT(freq);
- }
- else if (modelID == AminoAcidModelID.WAG)
- {
- return new WAG(freq);
- }
- else if (modelID == AminoAcidModelID.CPREV)
- {
- return new CPREV(freq);
- }
- else
- {
- return new Dayhoff(freq);
- }
- }
-
- /**
- * get numerical code of amino acid model that would probably
- * be suitable for a given sequence data set
- *
- * @param freq amino acid frequencies of the data set
- *
- * @return numerical code of suitable AminoAcidModel
- */
- public static int getSuitableModelID(double[] freq)
- {
- int NUMMODELS = AminoAcidModelID.MODELCOUNT;
- double[] ofreq = new double[20];
- double[] dist = new double[NUMMODELS];
-
- Dayhoff.getOriginalFrequencies(ofreq);
- dist[0] = getDist(freq, ofreq);
- JTT.getOriginalFrequencies(ofreq);
- dist[1] = getDist(freq, ofreq);
- MTREV24.getOriginalFrequencies(ofreq);
- dist[2] = getDist(freq, ofreq);
- BLOSUM62.getOriginalFrequencies(ofreq);
- dist[3] = getDist(freq, ofreq);
- VT.getOriginalFrequencies(ofreq);
- dist[4] = getDist(freq, ofreq);
- WAG.getOriginalFrequencies(ofreq);
- dist[5] = getDist(freq, ofreq);
- CPREV.getOriginalFrequencies(ofreq);
- dist[6] = getDist(freq, ofreq);
-
- int bestModel = 0;
- double minDist = dist[0];
-
- for (int i = 1; i < NUMMODELS; i++)
- {
- if (dist[i] < minDist)
- {
- minDist = dist[i];
- bestModel = i;
- }
- }
-
- return bestModel;
- }
-
- // interface Report
-
- public abstract void report(PrintWriter out);
-
- // interface Parameterized
-
- public int getNumParameters()
- {
- return 0;
- }
-
- public void setParameter(double param, int n)
- {
- return;
- }
-
- public double getParameter(int n)
- {
- return 0.0;
- }
-
- public void setParameterSE(double paramSE, int n)
- {
- return;
- }
-
- public double getLowerLimit(int n)
- {
- return 0.0;
- }
-
- public double getUpperLimit(int n)
- {
- return 0.0;
- }
-
- public double getDefaultValue(int n)
- {
- return 0.0;
- }
-
-
-
- //
- // Protected stuff
- //
-
- // Constructor
- protected AminoAcidModel(double[] f)
- {
- // Dimension = 20
- super(20);
-
- dataType = new AminoAcids();
- setFrequencies(f);
- }
-
- protected void printFrequencies(PrintWriter out)
- {
- out.println("Amino acid frequencies:");
- super.printFrequencies(out);
- }
-
- //
- // Private stuff
- //
-
- private static double getDist(double[] f1, double[] f2)
- {
- double sum = 0.0;
- for (int i = 0; i < f1.length; i++)
- {
- double diff = f1[i]-f2[i];
- sum += diff*diff;
- }
- return sum;
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/AminoAcidModelID.java b/LibrarySource/pal/substmodel/AminoAcidModelID.java
deleted file mode 100644
index 880b63c..0000000
--- a/LibrarySource/pal/substmodel/AminoAcidModelID.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// AminoAcidModelID.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.substmodel;
-
-import java.io.Serializable;
-
-/**
- * interface for IDs of amino acid models
- *
- * @version $Id: AminoAcidModelID.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public interface AminoAcidModelID extends Serializable
-{
- //
- // Public stuff
- //
-
- int DAYHOFF = 0;
- int JTT = 1;
- int MTREV24 = 2;
- int BLOSUM62 = 3;
- int VT = 4;
- int WAG = 5;
- int CPREV = 6;
-
- int MODELCOUNT = 7;
-
-}
-
diff --git a/LibrarySource/pal/substmodel/BLOSUM62.java b/LibrarySource/pal/substmodel/BLOSUM62.java
deleted file mode 100644
index 946492a..0000000
--- a/LibrarySource/pal/substmodel/BLOSUM62.java
+++ /dev/null
@@ -1,195 +0,0 @@
-// BLOSUM62.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * BLOSUM62 model of amino acid evolution
- *
- * @version $Id: BLOSUM62.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class BLOSUM62 extends AminoAcidModel
-{
- /**
- * constructor
- *
- * @param f amino acid frequencies
- */
- public BLOSUM62(double[] f)
- {
- super(f);
-
- makeBLOSUM62();
- fromQToR();
- }
-
- // Get numerical code describing the model type
- public int getModelID()
- {
- return 3;
- }
-
- public void report(PrintWriter out)
- {
- out.println("Model of substitution: BLOSUM62 (Henikoff-Henikoff 1992)");
- out.println();
- printFrequencies(out);
- }
-
- /**
- * get the frequencies of the original data set that
- * formed the basis for the estimation of the rate matrix
- *
- * @param f array where amino acid frequencies will be stored
- */
- public static void getOriginalFrequencies(double[] f)
- {
- f[0]=0.074; f[1]=0.052; f[2]=0.045; f[3]=0.054;
- f[4]=0.025; f[5]=0.034; f[6]=0.054; f[7]=0.074;
- f[8]=0.026; f[9]=0.068; f[10]=0.099; f[11]=0.058;
- f[12]=0.025; f[13]=0.047; f[14]=0.039; f[15]=0.057;
- f[16]=0.051; f[17]=0.013; f[18]=0.032; f[19]=0.073;
- }
-
- //
- // Private stuff
- //
-
- // BLOSUM62 model of amino acid evolution
- // Henikoff, S., and J. G. Henikoff. 1992. PNAS USA 89:10915-10919.
- private void makeBLOSUM62()
- {
- // Q matrix
- rate[0][1]=7.3579038969751e-01; rate[0][2]=4.8539105546575e-01;
- rate[0][3]=5.4316182089867e-01; rate[0][4]=1.4599953104700e+00;
- rate[0][5]=1.1997057046020e+00; rate[0][6]=1.1709490427999e+00;
- rate[0][7]=1.9558835749595e+00; rate[0][8]=7.1624144499779e-01;
- rate[0][9]=6.0589900368677e-01; rate[0][10]=8.0001653051838e-01;
- rate[0][11]=1.2952012667833e+00; rate[0][12]=1.2537582666635e+00;
- rate[0][13]=4.9296467974759e-01; rate[0][14]=1.1732759009239e+00;
- rate[0][15]=4.3250926870566e+00; rate[0][16]=1.7291780194850e+00;
- rate[0][17]=4.6583936772479e-01; rate[0][18]=7.1820669758623e-01;
- rate[0][19]=2.1877745220045e+00;
-
- rate[1][2]=1.2974467051337e+00; rate[1][3]=5.0096440855513e-01;
- rate[1][4]=2.2782657420895e-01; rate[1][5]=3.0208336100636e+00;
- rate[1][6]=1.3605741904203e+00; rate[1][7]=4.1876330851753e-01;
- rate[1][8]=1.4561411663360e+00; rate[1][9]=2.3203644514174e-01;
- rate[1][10]=6.2271166969249e-01; rate[1][11]=5.4111151414889e+00;
- rate[1][12]=9.8369298745695e-01; rate[1][13]=3.7164469320875e-01;
- rate[1][14]=4.4813366171831e-01; rate[1][15]=1.1227831042096e+00;
- rate[1][16]=9.1466595456337e-01; rate[1][17]=4.2638231012175e-01;
- rate[1][18]=7.2051744121611e-01; rate[1][19]=4.3838834377202e-01;
-
- rate[2][3]=3.1801000482161e+00; rate[2][4]=3.9735894989702e-01;
- rate[2][5]=1.8392161469920e+00; rate[2][6]=1.2404885086396e+00;
- rate[2][7]=1.3558723444845e+00; rate[2][8]=2.4145014342081e+00;
- rate[2][9]=2.8301732627800e-01; rate[2][10]=2.1188815961519e-01;
- rate[2][11]=1.5931370434574e+00; rate[2][12]=6.4844127878707e-01;
- rate[2][13]=3.5486124922252e-01; rate[2][14]=4.9488704370192e-01;
- rate[2][15]=2.9041016564560e+00; rate[2][16]=1.8981736345332e+00;
- rate[2][17]=1.9148204624678e-01; rate[2][18]=5.3822251903674e-01;
- rate[2][19]=3.1285879799342e-01;
-
- rate[3][4]=2.4083661480204e-01; rate[3][5]=1.1909457033960e+00;
- rate[3][6]=3.7616252083685e+00; rate[3][7]=7.9847324896839e-01;
- rate[3][8]=7.7814266402188e-01; rate[3][9]=4.1855573246161e-01;
- rate[3][10]=2.1813157759360e-01; rate[3][11]=1.0324479249521e+00;
- rate[3][12]=2.2262189795786e-01; rate[3][13]=2.8173069420651e-01;
- rate[3][14]=7.3062827299842e-01; rate[3][15]=1.5827541420653e+00;
- rate[3][16]=9.3418750943056e-01; rate[3][17]=1.4534504627853e-01;
- rate[3][18]=2.6142220896504e-01; rate[3][19]=2.5812928941763e-01;
-
- rate[4][5]=3.2980150463028e-01; rate[4][6]=1.4074889181440e-01;
- rate[4][7]=4.1820319228376e-01; rate[4][8]=3.5405810983129e-01;
- rate[4][9]=7.7489402279418e-01; rate[4][10]=8.3184264014158e-01;
- rate[4][11]=2.8507880090648e-01; rate[4][12]=7.6768882347954e-01;
- rate[4][13]=4.4133747118660e-01; rate[4][14]=3.5600849876863e-01;
- rate[4][15]=1.1971884150942e+00; rate[4][16]=1.1198313585160e+00;
- rate[4][17]=5.2766441887169e-01; rate[4][18]=4.7023773369610e-01;
- rate[4][19]=1.1163524786062e+00;
-
- rate[5][6]=5.5289191779282e+00; rate[5][7]=6.0984630538281e-01;
- rate[5][8]=2.4353411311401e+00; rate[5][9]=2.3620245120365e-01;
- rate[5][10]=5.8073709318144e-01; rate[5][11]=3.9452776745146e+00;
- rate[5][12]=2.4948960771127e+00; rate[5][13]=1.4435695975031e-01;
- rate[5][14]=8.5857057567418e-01; rate[5][15]=1.9348709245965e+00;
- rate[5][16]=1.2774802945956e+00; rate[5][17]=7.5865380864172e-01;
- rate[5][18]=9.5898974285014e-01; rate[5][19]=5.3078579012486e-01;
-
- rate[6][7]=4.2357999217628e-01; rate[6][8]=1.6268910569817e+00;
- rate[6][9]=1.8684804693170e-01; rate[6][10]=3.7262517508685e-01;
- rate[6][11]=2.8024271516787e+00; rate[6][12]=5.5541539747043e-01;
- rate[6][13]=2.9140908416530e-01; rate[6][14]=9.2656393484598e-01;
- rate[6][15]=1.7698932389373e+00; rate[6][16]=1.0710972360073e+00;
- rate[6][17]=4.0763564893830e-01; rate[6][18]=5.9671930034577e-01;
- rate[6][19]=5.2425384633796e-01;
-
- rate[7][8]=5.3985912495418e-01; rate[7][9]=1.8929629237636e-01;
- rate[7][10]=2.1772115923623e-01; rate[7][11]=7.5204244030271e-01;
- rate[7][12]=4.5943617357855e-01; rate[7][13]=3.6816646445253e-01;
- rate[7][14]=5.0408659952683e-01; rate[7][15]=1.5093262532236e+00;
- rate[7][16]=6.4143601140497e-01; rate[7][17]=5.0835892463812e-01;
- rate[7][18]=3.0805573703500e-01; rate[7][19]=2.5334079019018e-01;
-
- rate[8][9]=2.5271844788492e-01; rate[8][10]=3.4807220979697e-01;
- rate[8][11]=1.0225070358890e+00; rate[8][12]=9.8431152535870e-01;
- rate[8][13]=7.1453370392764e-01; rate[8][14]=5.2700733915060e-01;
- rate[8][15]=1.1170297629105e+00; rate[8][16]=5.8540709022472e-01;
- rate[8][17]=3.0124860078016e-01; rate[8][18]=4.2189539693890e+00;
- rate[8][19]=2.0155597175031e-01;
-
- rate[9][10]=3.8909637733035e+00; rate[9][11]=4.0619358664202e-01;
- rate[9][12]=3.3647977631042e+00; rate[9][13]=1.5173593259539e+00;
- rate[9][14]=3.8835540920564e-01; rate[9][15]=3.5754441245967e-01;
- rate[9][16]=1.1790911972601e+00; rate[9][17]=3.4198578754023e-01;
- rate[9][18]=6.7461709322842e-01; rate[9][19]=8.3118394054582e+00;
-
- rate[10][11]=4.4557027426059e-01; rate[10][12]=6.0305593795716e+00;
- rate[10][13]=2.0648397032375e+00; rate[10][14]=3.7455568747097e-01;
- rate[10][15]=3.5296918452729e-01; rate[10][16]=9.1525985769421e-01;
- rate[10][17]=6.9147463459998e-01; rate[10][18]=8.1124585632307e-01;
- rate[10][19]=2.2314056889131e+00;
-
- rate[11][12]=1.0730611843319e+00; rate[11][13]=2.6692475051102e-01;
- rate[11][14]=1.0473834507215e+00; rate[11][15]=1.7521659178195e+00;
- rate[11][16]=1.3038752007987e+00; rate[11][17]=3.3224304063396e-01;
- rate[11][18]=7.1799348690032e-01; rate[11][19]=4.9813847530407e-01;
-
- rate[12][13]=1.7738551688305e+00; rate[12][14]=4.5412362510273e-01;
- rate[12][15]=9.1872341574605e-01; rate[12][16]=1.4885480537218e+00;
- rate[12][17]=8.8810109815193e-01; rate[12][18]=9.5168216224591e-01;
- rate[12][19]=2.5758507553153e+00;
-
- rate[13][14]=2.3359790962888e-01; rate[13][15]=5.4002764482413e-01;
- rate[13][16]=4.8820611879305e-01; rate[13][17]=2.0743248934965e+00;
- rate[13][18]=6.7472604308008e+00; rate[13][19]=8.3811961017754e-01;
-
- rate[14][15]=1.1691295777157e+00; rate[14][16]=1.0054516831488e+00;
- rate[14][17]=2.5221483002727e-01; rate[14][18]=3.6940531935451e-01;
- rate[14][19]=4.9690841067567e-01;
-
- rate[15][16]=5.1515562922704e+00; rate[15][17]=3.8792562209837e-01;
- rate[15][18]=7.9675152076106e-01; rate[15][19]=5.6192545744165e-01;
-
- rate[16][17]=5.1312812689059e-01; rate[16][18]=8.0101024319939e-01;
- rate[16][19]=2.2530740511763e+00;
-
- rate[17][18]=4.0544190065580e+00; rate[17][19]=2.6650873142646e-01;
-
- rate[18][19]=1.0000000000000e+00;
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/CPREV.java b/LibrarySource/pal/substmodel/CPREV.java
deleted file mode 100644
index 66d70dc..0000000
--- a/LibrarySource/pal/substmodel/CPREV.java
+++ /dev/null
@@ -1,210 +0,0 @@
-// CPREV.java
-//
-// (c) 2000-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * CPREV model of amino acid evolution (J.Adachi et al. 2000)
- *
- * @version $Id: CPREV.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class CPREV extends AminoAcidModel
-{
- /**
- * constructor
- *
- * @param f amino acid frequencies
- */
- public CPREV(double[] f)
- {
- super(f);
-
- makeCPREV();
- fromQToR();
- }
-
- // Get numerical code describing the model type
- public int getModelID()
- {
- return 6;
- }
-
- public void report(PrintWriter out)
- {
- out.println("Model of substitution: CPREV (Adachi et al. 2000)");
- out.println();
- printFrequencies(out);
- }
-
- /**
- * get the frequencies of the original data set that
- * formed the basis for the estimation of the rate matrix
- *
- * @param f array where amino acid frequencies will be stored
- */
- public static void getOriginalFrequencies(double[] f)
- {
- f[0] = 0.076;
- f[1] = 0.062;
- f[2] = 0.041;
- f[3] = 0.037;
- f[4] = 0.009;
- f[5] = 0.038;
- f[6] = 0.049;
- f[7] = 0.084;
- f[8] = 0.025;
- f[9] = 0.081;
- f[10] = 0.101;
- f[11] = 0.050;
- f[12] = 0.022;
- f[13] = 0.051;
- f[14] = 0.043;
- f[15] = 0.062;
- f[16] = 0.054;
- f[17] = 0.018;
- f[18] = 0.031;
- f[19] = 0.066;
- }
-
- //
- // Private stuff
- //
-
- // CPREV 45 model of amino acid evolution
- // Adachi, J., P.J. Waddell, W. Martin, and M. Hasegawa. 2000. JME 50:348-358
- private void makeCPREV()
- {
- // Q matrix
- rate[0][1] = 105; rate[0][2] = 227;
- rate[0][3] = 175; rate[0][4] = 669;
- rate[0][5] = 157; rate[0][6] = 499;
- rate[0][7] = 665; rate[0][8] = 66;
- rate[0][9] = 145; rate[0][10] = 197;
- rate[0][11] = 236; rate[0][12] = 185;
- rate[0][13] = 68; rate[0][14] = 490;
- rate[0][15] = 2440; rate[0][16] = 1340;
- rate[0][17] = 14; rate[0][18] = 56;
- rate[0][19] = 968;
-
- rate[1][2] = 357; rate[1][3] = 43;
- rate[1][4] = 823; rate[1][5] = 1745;
- rate[1][6] = 152; rate[1][7] = 243;
- rate[1][8] = 715; rate[1][9] = 136;
- rate[1][10] = 203; rate[1][11] = 4482;
- rate[1][12] = 125; rate[1][13] = 53;
- rate[1][14] = 87; rate[1][15] = 385;
- rate[1][16] = 314; rate[1][17] = 230;
- rate[1][18] = 323; rate[1][19] = 92;
-
- rate[2][3] = 4435; rate[2][4] = 538;
- rate[2][5] = 768; rate[2][6] = 1055;
- rate[2][7] = 653; rate[2][8] = 1405;
- rate[2][9] = 168; rate[2][10] = 113;
- rate[2][11] = 2430; rate[2][12] = 61;
- rate[2][13] = 97; rate[2][14] = 173;
- rate[2][15] = 2085; rate[2][16] = 1393;
- rate[2][17] = 40; rate[2][18] = 754;
- rate[2][19] = 83;
-
- rate[3][4] = 10; rate[3][5] = 400;
- rate[3][6] = 3691; rate[3][7] = 431;
- rate[3][8] = 331; rate[3][9] = 10;
- rate[3][10] = 10; rate[3][11] = 412;
- rate[3][12] = 47; rate[3][13] = 22;
- rate[3][14] = 170; rate[3][15] = 590;
- rate[3][16] = 266; rate[3][17] = 18;
- rate[3][18] = 281; rate[3][19] = 75;
-
- rate[4][5] = 10; rate[4][6] = 10;
- rate[4][7] = 303; rate[4][8] = 441;
- rate[4][9] = 280; rate[4][10] = 396;
- rate[4][11] = 48; rate[4][12] = 159;
- rate[4][13] = 726; rate[4][14] = 285;
- rate[4][15] = 2331; rate[4][16] = 576;
- rate[4][17] = 435; rate[4][18] = 1466;
- rate[4][19] = 592;
-
- rate[5][6] = 3122; rate[5][7] = 133;
- rate[5][8] = 1269; rate[5][9] = 92;
- rate[5][10] = 286; rate[5][11] = 3313;
- rate[5][12] = 202; rate[5][13] = 10;
- rate[5][14] = 323; rate[5][15] = 396;
- rate[5][16] = 241; rate[5][17] = 53;
- rate[5][18] = 391; rate[5][19] = 54;
-
- rate[6][7] = 379; rate[6][8] = 162;
- rate[6][9] = 148; rate[6][10] = 82;
- rate[6][11] = 2629; rate[6][12] = 113;
- rate[6][13] = 145; rate[6][14] = 185;
- rate[6][15] = 568; rate[6][16] = 369;
- rate[6][17] = 63; rate[6][18] = 142;
- rate[6][19] = 200;
-
- rate[7][8] = 19; rate[7][9] = 40;
- rate[7][10] = 20; rate[7][11] = 263;
- rate[7][12] = 21; rate[7][13] = 25;
- rate[7][14] = 28; rate[7][15] = 691;
- rate[7][16] = 92; rate[7][17] = 82;
- rate[7][18] = 10; rate[7][19] = 91;
-
- rate[8][9] = 29; rate[8][10] = 66;
- rate[8][11] = 305; rate[8][12] = 10;
- rate[8][13] = 127; rate[8][14] = 152;
- rate[8][15] = 303; rate[8][16] = 32;
- rate[8][17] = 69; rate[8][18] = 1971;
- rate[8][19] = 25;
-
- rate[9][10] = 1745; rate[9][11] = 345;
- rate[9][12] = 1772; rate[9][13] = 454;
- rate[9][14] = 117; rate[9][15] = 216;
- rate[9][16] = 1040; rate[9][17] = 42;
- rate[9][18] = 89; rate[9][19] = 4797;
-
- rate[10][11] = 218; rate[10][12] = 1351;
- rate[10][13] = 1268; rate[10][14] = 219;
- rate[10][15] = 516; rate[10][16] = 156;
- rate[10][17] = 159; rate[10][18] = 189;
- rate[10][19] = 865;
-
- rate[11][12] = 193; rate[11][13] = 72;
- rate[11][14] = 302; rate[11][15] = 868;
- rate[11][16] = 918; rate[11][17] = 10;
- rate[11][18] = 247; rate[11][19] = 249;
-
- rate[12][13] = 327; rate[12][14] = 100;
- rate[12][15] = 93; rate[12][16] = 645;
- rate[12][17] = 86; rate[12][18] = 215;
- rate[12][19] = 475;
-
- rate[13][14] = 43; rate[13][15] = 487;
- rate[13][16] = 148; rate[13][17] = 468;
- rate[13][18] = 2370; rate[13][19] = 317;
-
- rate[14][15] = 1202; rate[14][16] = 260;
- rate[14][17] = 49; rate[14][18] = 97;
- rate[14][19] = 122;
-
- rate[15][16] = 2151; rate[15][17] = 73;
- rate[15][18] = 522; rate[15][19] = 167;
-
- rate[16][17] = 29; rate[16][18] = 71;
- rate[16][19] = 760;
-
- rate[17][18] = 346; rate[17][19] = 10;
-
- rate[18][19] = 119;
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/CodonModel.java b/LibrarySource/pal/substmodel/CodonModel.java
deleted file mode 100644
index b9f9b60..0000000
--- a/LibrarySource/pal/substmodel/CodonModel.java
+++ /dev/null
@@ -1,89 +0,0 @@
-// CodonModel.java
-//
-// (c) 1999-2001 PAL Development Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-import pal.datatype.*;
-
-import java.io.*;
-
-
-/**
- * base class for nucleotide rate matrices
- *
- * @version $Id: CodonModel.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Andrew Rambaut
- */
-abstract public class CodonModel extends AbstractRateMatrix implements RateMatrix, Serializable
-{
- //
- // Public stuff
- //
-
- /**
- * Create codon substitution model according to model type
- *
- * @param modelID model code
- * @param params model parameters
- * @param freq model frequencies
- *
- * @return codon rate matrix
- */
- public static CodonModel getInstance(int modelID, double[] params, double[] freq)
- {
- if (modelID == 0)
- {
- return new YangCodonModel(params, freq);
- }
- else
- {
-// Throw error?
- return new YangCodonModel(params, freq);
- }
- }
-
- // interface Report (inherited, remains abstract)
-
- // interface Parameterized (inherited, remains abstract)
-
-
- //
- // Protected stuff (for use in derived classes)
- //
-
- // Constructor
- protected CodonModel(double[] f)
- {
- // Dimension = 64
- super(64);
-
- dataType = new Codons();
- setFrequencies(f);
- }
-
- protected void printFrequencies(PrintWriter out)
- {
- out.println("Codon frequencies:");
- super.printFrequencies(out);
- }
-
- protected void printRatios(PrintWriter out)
- {
- }
-
- //
- // Private stuff
- //
-
- private void computeRatios()
- {
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/Dayhoff.java b/LibrarySource/pal/substmodel/Dayhoff.java
deleted file mode 100644
index a1ca3d3..0000000
--- a/LibrarySource/pal/substmodel/Dayhoff.java
+++ /dev/null
@@ -1,198 +0,0 @@
-// Dayhoff.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * Dayhoff model for amino acid evolution
- *
- * @version $Id: Dayhoff.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class Dayhoff extends AminoAcidModel
-{
- /**
- * constructor
- *
- * @param f amino acid frequencies
- */
- public Dayhoff(double[] f)
- {
- super(f);
-
- makeDayhoff();
- fromQToR();
- }
-
- // Get numerical code describing the model type
- public int getModelID()
- {
- return 0;
- }
-
- public void report(PrintWriter out)
- {
- out.println("Model of substitution: Dayhoff (Dayhoff et al. 1978)");
- out.println();
- printFrequencies(out);
- }
-
- /**
- * get the frequencies of the original data set that
- * formed the basis for the estimation of the rate matrix
- *
- * @param f array where amino acid frequencies will be stored
- */
- public static void getOriginalFrequencies(double[] f)
- {
- f[0] = 0.087; f[1] = 0.041; f[2] = 0.040; f[3] = 0.047;
- f[4] = 0.033; f[5] = 0.038; f[6] = 0.05; f[7] = 0.089;
- f[8] = 0.034; f[9] = 0.037; f[10] = 0.085; f[11] = 0.08;
- f[12] = 0.015; f[13] = 0.04; f[14] = 0.051; f[15] = 0.07;
- f[16] = 0.058; f[17] = 0.01; f[18] = 0.03; f[19] = 0.065;
- }
-
- //
- // Private stuff
- //
-
- // Dayhoff model for amino acid evolution
- // Dayhoff, M.O., Schwartz, R.M., Orcutt, B.C. (1978)
- // A model of evolutionary change in proteins.
- // Dayhoff, M.O. (ed.) Atlas of Protein Sequence Structur., Vol5, Suppl. 3,
- // National Biomedical Research Foundation, Washington DC, pp. 345-352.
- private void makeDayhoff()
- {
- // Q matrix
- rate[0][1]=9.6472567159749e-01; rate[0][2]=3.5927991886410e+00;
- rate[0][3]=4.3200552414656e+00; rate[0][4]=1.3184584178499e+00;
- rate[0][5]=3.2267534963169e+00; rate[0][6]=7.0141987829615e+00;
- rate[0][7]=8.5773867857875e+00; rate[0][8]=8.1434196396611e-01;
- rate[0][9]=2.3518447453539e+00; rate[0][10]=1.4735711728911e+00;
- rate[0][11]=9.3940162271805e-01; rate[0][12]=2.5490196078431e+00;
- rate[0][13]=6.5922920892495e-01; rate[0][14]=8.9189834148670e+00;
- rate[0][15]=1.4540712836859e+01; rate[0][16]=1.3411904595370e+01;
- rate[0][17]=3.8517964118027e-02; rate[0][18]=8.7897227856660e-01;
- rate[0][19]=7.4036511156187e+00;
-
- rate[1][2]=1.1890243902439e+00; rate[1][3]=5.9525626545377e-02;
- rate[1][4]=8.4778922655537e-01; rate[1][5]=8.8348561504191e+00;
- rate[1][6]=5.5954088952654e-02; rate[1][7]=3.1434881434075e-01;
- rate[1][8]=8.4753987678285e+00; rate[1][9]=2.2684090115941e+00;
- rate[1][10]=5.5954088952654e-01; rate[1][11]=1.6681312769010e+01;
- rate[1][12]=3.1707317073171e+00; rate[1][13]=4.8959827833572e-01;
- rate[1][14]=3.6754156468900e+00; rate[1][15]=5.4755072760812e+00;
- rate[1][16]=9.6472567159749e-01; rate[1][17]=7.5538020086083e+00;
- rate[1][18]=2.7977044476327e-01; rate[1][19]=8.6083213773314e-01;
-
- rate[2][3]=3.2459324155194e+01; rate[2][4]=7.3852625416383e-02;
- rate[2][5]=3.7732198142415e+00; rate[2][6]=5.3911764705882e+00;
- rate[2][7]=5.0264375413087e+00; rate[2][8]=1.9061418685121e+01;
- rate[2][9]=2.7901430842607e+00; rate[2][10]=1.2482698961938e+00;
- rate[2][11]=1.1542279411765e+01; rate[2][12]=1.9117647058824e-01;
- rate[2][13]=5.0183823529412e-01; rate[2][14]=1.5181660899654e+00;
- rate[2][15]=1.7697478991597e+01; rate[2][16]=8.3557302231237e+00;
- rate[2][17]=8.6029411764706e-01; rate[2][18]=3.4411764705882e+00;
- rate[2][19]=5.7352941176471e-01;
-
- rate[3][4]=2.5534152404601e-02; rate[3][5]=4.8811013767209e+00;
- rate[3][6]=4.0561952440551e+01; rate[3][7]=4.4423506911730e+00;
- rate[3][8]=3.0865788117500e+00; rate[3][9]=8.5749078239692e-01;
- rate[3][10]=2.5926985518518e-02; rate[3][11]=2.5930851063830e+00;
- rate[3][12]=1.1667143483333e-01; rate[3][13]=1.2963492759259e-02;
- rate[3][14]=4.7853935065891e-01; rate[3][15]=3.4167709637046e+00;
- rate[3][16]=2.3984722282163e+00; rate[3][17]=3.2408731898147e-02;
- rate[3][18]=8.1351689612015e-02; rate[3][19]=6.3829787234043e-01;
-
- rate[4][5]=2.1864264103535e-02; rate[4][6]=1.4770525083277e-02;
- rate[4][7]=3.9055458751427e-01; rate[4][8]=1.0223340673168e+00;
- rate[4][9]=1.5970515970516e+00; rate[4][10]=3.9098448749850e-02;
- rate[4][11]=8.0776309049169e-03; rate[4][12]=1.4155086538140e-01;
- rate[4][13]=8.6898395721925e-02; rate[4][14]=6.8155604487784e-01;
- rate[4][15]=5.8097784568373e+00; rate[4][16]=5.9929928084086e-01;
- rate[4][17]=3.4759358288770e-01; rate[4][18]=3.4759358288770e+00;
- rate[4][19]=1.7647058823529e+00;
-
- rate[5][6]=2.5476780185759e+01; rate[5][7]=1.0174974779977e+00;
- rate[5][8]=2.1573939173192e+01; rate[5][9]=6.5266504894988e-01;
- rate[5][10]=2.6634492806410e+00; rate[5][11]=5.5466331269350e+00;
- rate[5][12]=4.0247678018576e+00; rate[5][13]=1.8038017885416e-02;
- rate[5][14]=5.5044618466582e+00; rate[5][15]=2.0267580716497e+00;
- rate[5][16]=1.9256432155439e+00; rate[5][17]=9.6202762055552e-02;
- rate[5][18]=1.0061919504644e-01; rate[5][19]=1.2538699690402e+00;
-
- rate[6][7]=2.8869795109055e+00; rate[6][8]=1.5519031141869e+00;
- rate[6][9]=2.1701112877583e+00; rate[6][10]=4.0484429065744e-01;
- rate[6][11]=2.9823529411765e+00; rate[6][12]=1.0705882352941e+00;
- rate[6][13]=1.9801735189768e-02; rate[6][14]=1.7993079584775e+00;
- rate[6][15]=2.8184873949580e+00; rate[6][16]=1.2261663286004e+00;
- rate[6][17]=7.3114099162219e-02; rate[6][18]=7.6470588235294e-01;
- rate[6][19]=1.3058823529412e+00;
-
- rate[7][8]=3.7906768788150e-01; rate[7][9]=2.3128004846840e-02;
- rate[7][10]=2.5776602775942e-01; rate[7][11]=9.6662260409782e-01;
- rate[7][12]=6.0145406477198e-01; rate[7][13]=5.4775280898876e-01;
- rate[7][14]=1.2382877804129e+00; rate[7][15]=8.2853366065527e+00;
- rate[7][16]=1.1110604644803e+00; rate[7][17]=1.2888301387971e-01;
- rate[7][18]=1.7114723586662e-02; rate[7][19]=1.9233311302049e+00;
-
- rate[8][9]=2.7354343963341e-01; rate[8][10]=1.5876246692449e+00;
- rate[8][11]=9.6993944636678e-01; rate[8][12]=1.2544085640577e-01;
- rate[8][13]=1.6868512110727e+00; rate[8][14]=3.3075513942601e+00;
- rate[8][15]=1.2530894710826e+00; rate[8][16]=8.1434196396611e-01;
- rate[8][17]=1.0121107266436e+00; rate[8][18]=4.4982698961938e+00;
- rate[8][19]=1.5570934256055e+00;
-
- rate[9][10]=9.2275320303002e+00; rate[9][11]=1.6663354531002e+00;
- rate[9][12]=1.1780604133545e+01; rate[9][13]=6.9753577106518e+00;
- rate[9][14]=4.2551201720752e-01; rate[9][15]=8.8575970928912e-01;
- rate[9][16]=6.8951811852420e+00; rate[9][17]=9.8802836705702e-02;
- rate[9][18]=1.3434022257552e+00; rate[9][19]=3.1526232114467e+01;
-
- rate[10][11]=6.5787197231834e-01; rate[10][12]=1.8622837370242e+01;
- rate[10][13]=5.6340830449827e+00; rate[10][14]=1.1377976796255e+00;
- rate[10][15]=6.1690558576372e-01; rate[10][16]=1.2098794893211e+00;
- rate[10][17]=1.7543252595156e+00; rate[10][18]=1.0346020761246e+00;
- rate[10][19]=6.2906574394464e+00;
-
- rate[11][12]=8.6029411764706e+00; rate[11][13]=6.6640454965565e-03;
- rate[11][14]=1.2089100346021e+00; rate[11][15]=3.4411764705882e+00;
- rate[11][16]=4.9442190669371e+00; rate[11][17]=3.4272233982290e-02;
- rate[11][18]=4.7794117647059e-01; rate[11][19]=3.7500000000000e-01;
-
- rate[12][13]=3.2500000000000e+00; rate[12][14]=5.9976931949250e-01;
- rate[12][15]=2.1848739495798e+00; rate[12][16]=3.6916835699797e+00;
- rate[12][17]=1.6247577591604e-01; rate[12][18]=1.1508700794053e-01;
- rate[12][19]=9.0588235294118e+00;
-
- rate[13][14]=3.9359861591695e-01; rate[13][15]=1.6386554621849e+00;
- rate[13][16]=4.9442190669371e-01; rate[13][17]=2.8676470588235e+00;
- rate[13][18]=2.4852941176471e+01; rate[13][19]=4.4117647058824e-01;
-
- rate[14][15]=8.6431043005437e+00; rate[14][16]=2.8308077795013e+00;
- rate[14][17]=3.5840244687362e-02; rate[14][18]=4.3804743506776e-02;
- rate[14][19]=1.7301038062284e+00;
-
- rate[15][16]=1.9663865546218e+01; rate[15][17]=2.7857142857143e+00;
- rate[15][18]=1.2016806722689e+00; rate[15][19]=1.0840336134454e+00;
-
- rate[16][17]=4.2019597219666e-02; rate[16][18]=1.5162271805274e+00;
- rate[16][19]=5.6592292089249e+00;
-
- rate[17][18]=2.2941176470588e+00; rate[17][19]=1.2654363316538e-01;
-
- rate[18][19]=1.0000000000000e+00;
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/F81.java b/LibrarySource/pal/substmodel/F81.java
deleted file mode 100644
index a3b054f..0000000
--- a/LibrarySource/pal/substmodel/F81.java
+++ /dev/null
@@ -1,104 +0,0 @@
-// F81.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * Felsenstein 1981 model of nucleotide evolution
- *
- * @version $Id: F81.java,v 1.5 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class F81 extends NucleotideModel implements Serializable
-{
- /**
- * constructor
- *
- * @param freq nucleotide frequencies
- */
- public F81(double[] freq)
- {
- super(freq);
-
- makeF81();
- fromQToR();
- }
-
- // Get numerical code describing the model type
- public int getModelID()
- {
- return 4;
- }
-
- // interface Report
-
- public void report(PrintWriter out)
- {
- out.println("Model of substitution: F81 (Felsenstein 1981)");
- printFrequencies(out);
- printRatios(out);
- }
-
- // interface Parameterized
-
- public int getNumParameters()
- {
- return 0;
- }
-
- public void setParameter(double param, int n)
- {
- return;
- }
-
- public double getParameter(int n)
- {
- return 0.0;
- }
-
- public void setParameterSE(double paramSE, int n)
- {
- return;
- }
-
- public double getLowerLimit(int n)
- {
- return 0.0;
- }
-
- public double getUpperLimit(int n)
- {
- return 0.0;
- }
-
- public double getDefaultValue(int n)
- {
- return 0.0;
- }
-
-
- //
- // Private stuff
- //
-
- // Make F81 model
- private void makeF81()
- {
- // Q matrix
- rate[0][1] = 1; rate[0][2] = 1.0; rate[0][3] = 1;
- rate[1][2] = 1; rate[1][3] = 1.0;
- rate[2][3] = 1;
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/F84.java b/LibrarySource/pal/substmodel/F84.java
deleted file mode 100644
index 3ab6ad6..0000000
--- a/LibrarySource/pal/substmodel/F84.java
+++ /dev/null
@@ -1,168 +0,0 @@
-// F84.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * Felsenstein 1984 (PHYLIP) model of nucleotide evolution
- *
- * @version $Id: F84.java,v 1.5 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class F84 extends NucleotideModel implements Serializable
-{
- /**
- * constructor 1
- *
- * @param expectedTsTv expected transition-transversion ratio
- * @param freq nucleotide frequencies
- */
- public F84(double expectedTsTv, double[] freq)
- {
- super(freq);
-
- this.expectedTsTv = expectedTsTv;
-
- convertToTN();
- makeTN();
- fromQToR();
-
- showSE = false;
- }
-
- /**
- * Constructor 2
- *
- * @param params parameter list
- * @param freq nucleotide frequencies
- */
- public F84(double[] params, double[] freq)
- {
- this(params[0], freq);
- }
-
- // Get numerical code describing the model type
- public int getModelID()
- {
- return 3;
- }
-
- // interface Report
-
- public void report(PrintWriter out)
- {
- out.println("Model of substitution: F84 (Felsenstein 1984, PHYLIP)");
- out.print("PHYLIP Transition/transversion parameter: ");
- format.displayDecimal(out, expectedTsTv, 2);
- if (showSE)
- {
- out.print(" (S.E. ");
- format.displayDecimal(out, expectedTsTvSE, 2);
- out.print(")");
- }
- out.println();
-
- out.println();
- printFrequencies(out);
- printRatios(out);
- out.println();
- out.println("This model corresponds to a Tamura-Nei (1993) model with");
- out.print(" Transition/transversion rate ratio kappa: ");
- format.displayDecimal(out, kappa, 2);
- out.println();
- out.print(" Y/R transition rate ratio: ");
- format.displayDecimal(out, r, 2);
- out.println();
- out.println("and the above nucleotide frequencies.");
- out.println();
- }
-
- // interface Parameterized
-
- public int getNumParameters()
- {
- return 1;
- }
-
- public void setParameter(double param, int n)
- {
- expectedTsTv = param;
-
- convertToTN();
- makeTN();
- fromQToR();
- }
-
- public double getParameter(int n)
- {
- return expectedTsTv;
- }
-
- public void setParameterSE(double paramSE, int n)
- {
- expectedTsTvSE = paramSE;
-
- showSE = true;
- }
-
- public double getLowerLimit(int n)
- {
- return 0.0001;
- }
-
- public double getUpperLimit(int n)
- {
- return 100.0;
- }
-
- public double getDefaultValue(int n)
- {
- return 2.0;
- }
-
-
- //
- // Private stuff
- //
-
- private boolean showSE;
- private double kappa, r;
- private double expectedTsTv, expectedTsTvSE;
-
- private void convertToTN()
- {
- double piA = frequency[0];
- double piC = frequency[1];
- double piG = frequency[2];
- double piT = frequency[3];
- double piR = piA + piG;
- double piY = piC + piT;
-
- double rho = (piR*piY*(piR*piY*expectedTsTv - (piA*piG + piC*piT)))/
- (piC*piT*piR + piA*piG*piY);
-
- kappa = 1.0 + 0.5*rho*(1.0/piR + 1.0/piY);
- r = (piY + rho)/piY * piR/(piR + rho);
- }
-
- // Make TN model
- private void makeTN()
- {
- // Q matrix
- rate[0][1] = 1; rate[0][2] = 2.0*kappa/(r+1.0); rate[0][3] = 1;
- rate[1][2] = 1; rate[1][3] = 2.0*kappa*r/(r+1.0);
- rate[2][3] = 1;
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/GTR.java b/LibrarySource/pal/substmodel/GTR.java
deleted file mode 100644
index c5c9b0f..0000000
--- a/LibrarySource/pal/substmodel/GTR.java
+++ /dev/null
@@ -1,227 +0,0 @@
-// GTR.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * GTR (general time reversible) model of nucleotide evolution
- *
- * @version $Id: GTR.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class GTR extends NucleotideModel implements Serializable
-{
- /**
- * constructor 1
- *
- * @param a entry in rate matrix
- * @param b entry in rate matrix
- * @param c entry in rate matrix
- * @param d entry in rate matrix
- * @param e entry in rate matrix
- * @param freq nucleotide frequencies
- */
- public GTR(double a, double b, double c, double d, double e, double[] freq)
- {
- super(freq);
-
- this.a = a;
- this.b = b;
- this.c = c;
- this.d = d;
- this.e = e;
-
- makeGTR();
- fromQToR();
-
- showSE = false;
- }
-
- /**
- * constructor 2
- *
- * @param params parameter list
- * @param freq nucleotide frequencies
- */
- public GTR(double[] params, double[] freq)
- {
- this(params[0], params[1], params[2],
- params[3], params[4], freq);
- }
-
- // Get numerical code describing the model type
- public int getModelID()
- {
- return 0;
- }
-
- // interface Report
-
- public void report(PrintWriter out)
- {
- out.println("Model of substitution: GTR (Lanave et al. 1984)");
-
- out.print("Parameter a: ");
- format.displayDecimal(out, a, 2);
- if (showSE)
- {
- out.print(" (S.E. ");
- format.displayDecimal(out, aSE, 2);
- out.print(")");
- }
- out.println();
-
- out.print("Parameter b: ");
- format.displayDecimal(out, b, 2);
- if (showSE)
- {
- out.print(" (S.E. ");
- format.displayDecimal(out, bSE, 2);
- out.print(")");
- }
- out.println();
-
- out.print("Parameter c: ");
- format.displayDecimal(out, c, 2);
- if (showSE)
- {
- out.print(" (S.E. ");
- format.displayDecimal(out, cSE, 2);
- out.print(")");
- }
- out.println();
-
- out.print("Parameter d: ");
- format.displayDecimal(out, d, 2);
- if (showSE)
- {
- out.print(" (S.E. ");
- format.displayDecimal(out, dSE, 2);
- out.print(")");
- }
- out.println();
-
- out.print("Parameter e: ");
- format.displayDecimal(out, e, 2);
- if (showSE)
- {
- out.print(" (S.E. ");
- format.displayDecimal(out, eSE, 2);
- out.print(")");
- }
- out.println();
-
- out.println(" A C G T");
- out.println("Corresponding rate matrix ----------------");
- out.println("(shown without frequencies): A a b c");
- out.println(" C d e");
- out.println(" G 1");
-
- out.println();
- printFrequencies(out);
- printRatios(out);
- }
-
- // interface Parameterized
-
- public int getNumParameters()
- {
- return 5;
- }
-
- public void setParameter(double param, int n)
- {
- switch(n)
- {
- case 0: a = param; break;
- case 1: b = param; break;
- case 2: c = param; break;
- case 3: d = param; break;
- case 4: e = param; break;
-
- default: throw new IllegalArgumentException();
- }
-
- makeGTR();
- fromQToR();
- }
-
- public double getParameter(int n)
- {
- double value;
-
- switch(n)
- {
- case 0: value = a; break;
- case 1: value = b; break;
- case 2: value = c; break;
- case 3: value = d; break;
- case 4: value = e; break;
-
- default: throw new IllegalArgumentException();
- }
-
- return value;
- }
-
- public void setParameterSE(double paramSE, int n)
- {
- switch(n)
- {
- case 0: aSE = paramSE; break;
- case 1: bSE = paramSE; break;
- case 2: cSE = paramSE; break;
- case 3: dSE = paramSE; break;
- case 4: eSE = paramSE; break;
-
- default: throw new IllegalArgumentException();
- }
-
- showSE = true;
- }
-
- public double getLowerLimit(int n)
- {
- return 0.0001;
- }
-
- public double getUpperLimit(int n)
- {
- return 10000.0;
- }
-
- public double getDefaultValue(int n)
- {
- return 1.0;
- }
-
-
- //
- // Private stuff
- //
-
- private boolean showSE;
- private double a, b, c, d, e;
- private double aSE, bSE, cSE, dSE, eSE;
-
- // Make REV model
- private void makeGTR()
- {
- // Q matrix
- rate[0][1] = a; rate[0][2] = b; rate[0][3] = c;
- rate[1][2] = d; rate[1][3] = e;
- rate[2][3] = 1;
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/GammaRates.java b/LibrarySource/pal/substmodel/GammaRates.java
deleted file mode 100644
index 1b46413..0000000
--- a/LibrarySource/pal/substmodel/GammaRates.java
+++ /dev/null
@@ -1,133 +0,0 @@
-// GammaRates.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-import pal.statistics.*;
-
-import java.io.*;
-
-
-/**
- * discrete Gamma distribution (Z. Yang. 1994. JME 39:306-314)
- *
- * @version $Id: GammaRates.java,v 1.6 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class GammaRates extends RateDistribution implements Serializable
-{
- //
- // Public stuff
- //
-
- /**
- * construct discrete Gamma distribution (mean = 1.0)
- *
- * @param n number of categories
- * @param a shape parameter (alpha)
- */
- public GammaRates(int n, double a)
- {
- super(n);
- alpha = a;
- showSE = false;
-
- makeGamma(alpha);
- }
-
- // interface Report
-
- public void report(PrintWriter out)
- {
- out.println("Model of rate heterogeneity: Discrete Gamma");
- out.println("Number of rate categories: " + numRates);
- out.print("Gamma distribution parameter alpha: ");
- format.displayDecimal(out, alpha, 2);
- if (showSE)
- {
- out.print(" (S.E. ");
- format.displayDecimal(out, alphaSE, 2);
- out.println(")");
- }
- else
- {
- out.println();
- }
- out.println();
- printRates(out);
- }
-
- // interface Parameterized
-
- public int getNumParameters()
- {
- return 1;
- }
-
- public void setParameter(double param, int n)
- {
- alpha = param;
- makeGamma(alpha);
- }
-
- public double getParameter(int n)
- {
- return alpha;
- }
-
- public void setParameterSE(double paramSE, int n)
- {
- alphaSE = paramSE;
- showSE = true;
- }
-
- public double getLowerLimit(int n)
- {
- return 0.0001;
- }
-
- public double getUpperLimit(int n)
- {
- return 100.0;
- }
-
- public double getDefaultValue(int n)
- {
- return 0.5;
- }
-
-
- //
- // Private stuff
- //
-
- private boolean showSE;
-
- // Shape parameter
- private double alpha;
- private double alphaSE;
-
- private void makeGamma(double a)
- {
- double mean = 0.0;
- for (int i = 0; i < numRates; i++)
- {
- rate[i] = GammaDistribution.quantile((2.0*i+1.0)/(2.0*numRates), a, 1.0/a);
- mean += rate[i];
- }
- mean = mean/(double) numRates;
- for (int i = 0; i < numRates; i++)
- {
- rate[i] /= mean;
- probability[i] = 1.0/(double) numRates;
- }
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/HKY.java b/LibrarySource/pal/substmodel/HKY.java
deleted file mode 100644
index df91bc4..0000000
--- a/LibrarySource/pal/substmodel/HKY.java
+++ /dev/null
@@ -1,140 +0,0 @@
-// HKY.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * Hasegawa-Kishino-Yano model of nucleotide evolution
- *
- * @version $Id: HKY.java,v 1.5 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class HKY extends NucleotideModel implements Serializable
-{
- /**
- * Constructor 1
- *
- * @param kappa transition/transversion rate ratio
- * @param freq nucleotide frequencies
- */
- public HKY(double kappa, double[] freq)
- {
- super(freq);
-
- this.kappa = kappa;
-
- makeHKY();
- fromQToR();
-
- showSE = false;
- }
-
- /**
- * Constructor 2
- *
- * @param params parameter list
- * @param freq nucleotide frequencies
- */
- public HKY(double[] params, double[] freq)
- {
- this(params[0], freq);
- }
-
- // Get numerical code describing the model type
- public int getModelID()
- {
- return 2;
- }
-
-
- // interface Report
-
- public void report(PrintWriter out)
- {
- out.println("Model of substitution: HKY (Hasegawa et al. 1985)");
- out.print("Transition/transversion rate ratio kappa: ");
- format.displayDecimal(out, kappa, 2);
- if (showSE)
- {
- out.print(" (S.E. ");
- format.displayDecimal(out, kappaSE, 2);
- out.print(")");
- }
- out.println();
-
- out.println();
- printFrequencies(out);
- printRatios(out);
- }
-
- // interface Parameterized
-
- public int getNumParameters()
- {
- return 1;
- }
-
- public void setParameter(double param, int n)
- {
- kappa = param;
-
- makeHKY();
- fromQToR();
- }
-
- public double getParameter(int n)
- {
- return kappa;
- }
-
- public void setParameterSE(double paramSE, int n)
- {
- kappaSE = paramSE;
-
- showSE = true;
- }
-
- public double getLowerLimit(int n)
- {
- return 0.0001;
- }
-
- public double getUpperLimit(int n)
- {
- return 100.0;
- }
-
- public double getDefaultValue(int n)
- {
- return 4.0;
- }
-
-
- //
- // Private stuff
- //
-
- private boolean showSE;
- private double kappa, kappaSE;
-
- // Make HKY model
- private void makeHKY()
- {
- // Q matrix
- rate[0][1] = 1; rate[0][2] = kappa; rate[0][3] = 1;
- rate[1][2] = 1; rate[1][3] = kappa;
- rate[2][3] = 1;
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/InvariableSites.java b/LibrarySource/pal/substmodel/InvariableSites.java
deleted file mode 100644
index e69e1e8..0000000
--- a/LibrarySource/pal/substmodel/InvariableSites.java
+++ /dev/null
@@ -1,126 +0,0 @@
-// InvariableSites.java
-//
-// (c) 2000--2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-import pal.math.*;
-
-import java.io.*;
-
-
-/**
- * invariable sites model (two-rate model with mean rate = 1.0)
- *
- * @version $Id: InvariableSites.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class InvariableSites extends RateDistribution implements Serializable
-{
- //
- // Public stuff
- //
-
- /**
- * construct discrete rate distribution with two rates
- * (one invariable and one variable)
- *
- * @param f fraction of invariable sites
- */
- public InvariableSites(double f)
- {
- super(2);
- frac = f;
- showSE = false;
-
- makeDistrib(frac);
- }
-
- // interface Report
-
- public void report(PrintWriter out)
- {
- out.println("Model of rate heterogeneity: Invariable sites model");
- out.println("Number of rate categories: " + numRates);
- out.print("Fraction of invariable sites: ");
- format.displayDecimal(out, frac, 2);
- if (showSE)
- {
- out.print(" (S.E. ");
- format.displayDecimal(out, fracSE, 2);
- out.println(")");
- }
- else
- {
- out.println();
- }
- out.println();
- printRates(out);
- }
-
- // interface Parameterized
-
- public int getNumParameters()
- {
- return 1;
- }
-
- public void setParameter(double param, int n)
- {
- frac = param;
- makeDistrib(frac);
- }
-
- public double getParameter(int n)
- {
- return frac;
- }
-
- public void setParameterSE(double paramSE, int n)
- {
- fracSE = paramSE;
- showSE = true;
- }
-
- public double getLowerLimit(int n)
- {
- return 0.0;
- }
-
- public double getUpperLimit(int n)
- {
- return 1.0;
- }
-
- public double getDefaultValue(int n)
- {
- return 0.0;
- }
-
-
- //
- // Private stuff
- //
-
- private boolean showSE;
-
- // fraction of invariable sites
- private double frac;
- private double fracSE;
-
- private void makeDistrib(double f)
- {
- rate[0] = 0.0;
- rate[1] = 1.0/(1.0-f); // ensures that mean rate = 1.0
-
- probability[0] = f;
- probability[1] = 1.0-f;
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/JTT.java b/LibrarySource/pal/substmodel/JTT.java
deleted file mode 100644
index e6b16ed..0000000
--- a/LibrarySource/pal/substmodel/JTT.java
+++ /dev/null
@@ -1,197 +0,0 @@
-// JTT.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * JTT model of amino acid evolution
- *
- * @version $Id: JTT.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class JTT extends AminoAcidModel
-{
- /**
- * constructor
- *
- * @param f amino acid frequencies
- */
- public JTT(double[] f)
- {
- super(f);
-
- makeJTT();
- fromQToR();
- }
-
- // Get numerical code describing the model type
- public int getModelID()
- {
- return 1;
- }
-
- public void report(PrintWriter out)
- {
- out.println("Model of substitution: JTT (Jones et al. 1992)");
- out.println();
- printFrequencies(out);
- }
-
- /**
- * get the frequencies of the original data set that
- * formed the basis for the estimation of the rate matrix
- *
- * @param f array where amino acid frequencies will be stored
- */
- public static void getOriginalFrequencies(double[] f)
- {
- f[0] = 0.077; f[1] = 0.051; f[2] = 0.043; f[3] = 0.052;
- f[4] = 0.02; f[5] = 0.041; f[6] = 0.062; f[7] = 0.074;
- f[8] = 0.023; f[9] = 0.052; f[10] = 0.091; f[11] = 0.059;
- f[12] = 0.024; f[13] = 0.04; f[14] = 0.051; f[15] = 0.069;
- f[16] = 0.059; f[17] = 0.014; f[18] = 0.032; f[19] = 0.066;
- }
-
- //
- // Private stuff
- //
-
- // JTT model for amino acid evolution
- // D.T. Jones, W.R. Taylor, and J.M. Thornton
- // The rapid generation of mutation data matrices from protein sequences
- // CABIOS vol. 8 no. 3 1992 pp. 275-282
- private void makeJTT()
- {
- // Q matrix
- rate[0][1]=3.1628651460584e+00; rate[0][2]=3.2804935927860e+00;
- rate[0][3]=4.8477237048666e+00; rate[0][4]=3.4612244897959e+00;
- rate[0][5]=3.3130910900946e+00; rate[0][6]=6.3199473337722e+00;
- rate[0][7]=1.0440154440154e+01; rate[0][8]=1.3061224489796e+00;
- rate[0][9]=2.1726844583987e+00; rate[0][10]=1.8443597219107e+00;
- rate[0][11]=2.2137668626773e+00; rate[0][12]=2.7210884353741e+00;
- rate[0][13]=8.3265306122449e-01; rate[0][14]=1.1537414965986e+01;
- rate[0][15]=2.2838213546288e+01; rate[0][16]=2.7007955724663e+01;
- rate[0][17]=5.1311953352770e-01; rate[0][18]=8.3673469387755e-01;
- rate[0][19]=1.7474335188621e+01;
-
- rate[1][2]=2.6598918637222e+00; rate[1][3]=9.1014867485456e-01;
- rate[1][4]=6.1624649859944e+00; rate[1][5]=1.8036482885837e+01;
- rate[1][6]=1.8924731182796e+00; rate[1][7]=8.1810886516769e+00;
- rate[1][8]=1.9119717452198e+01; rate[1][9]=1.4410687351864e+00;
- rate[1][10]=2.2211961707760e+00; rate[1][11]=3.9239234676922e+01;
- rate[1][12]=2.5060690943044e+00; rate[1][13]=3.9439775910364e-01;
- rate[1][14]=4.1953094963476e+00; rate[1][15]=5.9016766126741e+00;
- rate[1][16]=3.8437069743152e+00; rate[1][17]=7.6766706682673e+00;
- rate[1][18]=1.4173669467787e+00; rate[1][19]=1.0308123249300e+00;
-
- rate[2][3]=3.2226935854843e+01; rate[2][4]=1.8710963455150e+00;
- rate[2][5]=4.5351268130622e+00; rate[2][6]=3.3951344979102e+00;
- rate[2][7]=4.5987249708180e+00; rate[2][8]=2.3693774375271e+01;
- rate[2][9]=2.9235880398671e+00; rate[2][10]=8.0960899565551e-01;
- rate[2][11]=1.5024269384537e+01; rate[2][12]=1.9003322259136e+00;
- rate[2][13]=4.3853820598007e-01; rate[2][14]=7.1083317047749e-01;
- rate[2][15]=2.9456208772690e+01; rate[2][16]=1.3735908553410e+01;
- rate[2][17]=1.6706217370669e-01; rate[2][18]=4.1661129568106e+00;
- rate[2][19]=9.7452934662237e-01;
-
- rate[3][4]=6.2857142857143e-01; rate[3][5]=3.0662020905923e+00;
- rate[3][6]=4.5450549450549e+01; rate[3][7]=7.5402435402435e+00;
- rate[3][8]=6.0544672718586e+00; rate[3][9]=6.8808114961961e-01;
- rate[3][10]=3.6130902064968e-01; rate[3][11]=1.6718197057180e+00;
- rate[3][12]=1.0879120879121e+00; rate[3][13]=1.9340659340659e-01;
- rate[3][14]=7.3949579831933e-01; rate[3][15]=3.4196528109572e+00;
- rate[3][16]=2.4749487800335e+00; rate[3][17]=3.4536891679749e-01;
- rate[3][18]=2.6895604395604e+00; rate[3][19]=1.8608058608059e+00;
-
- rate[4][5]=5.5191637630662e-01; rate[4][6]=3.2442396313364e-01;
- rate[4][7]=3.3297297297297e+00; rate[4][8]=4.3726708074534e+00;
- rate[4][9]=9.1868131868132e-01; rate[4][10]=9.9466248037677e-01;
- rate[4][11]=2.9830508474576e-01; rate[4][12]=2.4095238095238e+00;
- rate[4][13]=4.1485714285714e+00; rate[4][14]=7.3949579831933e-01;
- rate[4][15]=1.2862939958592e+01; rate[4][16]=2.8125907990315e+00;
- rate[4][17]=6.8244897959184e+00; rate[4][18]=1.2885714285714e+01;
- rate[4][19]=3.7714285714286e+00;
-
- rate[5][6]=2.0316061593796e+01; rate[5][7]=1.3922214897825e+00;
- rate[5][8]=3.3861536130889e+01; rate[5][9]=4.7172339855267e-01;
- rate[5][10]=4.2320327755868e+00; rate[5][11]=1.7835941652395e+01;
- rate[5][12]=2.6573751451800e+00; rate[5][13]=2.7595818815331e-01;
- rate[5][14]=9.4992143198743e+00; rate[5][15]=3.2350653941322e+00;
- rate[5][16]=3.0973838067678e+00; rate[5][17]=1.0512692882031e+00;
- rate[5][18]=1.5331010452962e+00; rate[5][19]=1.0778164924506e+00;
-
- rate[6][7]=6.6857641051189e+00; rate[6][8]=1.4458024443999e+00;
- rate[6][9]=6.7068415455512e-01; rate[6][10]=5.7932850559579e-01;
- rate[6][11]=1.0365070686558e+01; rate[6][12]=1.0138248847926e+00;
- rate[6][13]=2.6359447004608e-01; rate[6][14]=1.1291226167887e+00;
- rate[6][15]=1.8337006611901e+00; rate[6][16]=1.9520424900414e+00;
- rate[6][17]=6.9519420671494e-01; rate[6][18]=3.8018433179723e-01;
- rate[6][19]=2.7772657450077e+00;
-
- rate[7][8]=1.2113479939567e+00; rate[7][9]=3.2670032670033e-01;
- rate[7][10]=4.1817641817642e-01; rate[7][11]=1.6354950592239e+00;
- rate[7][12]=7.6447876447876e-01; rate[7][13]=3.0579150579151e-01;
- rate[7][14]=1.2391551215081e+00; rate[7][15]=1.1138492529797e+01;
- rate[7][16]=1.8888816176952e+00; rate[7][17]=3.3491450634308e+00;
- rate[7][18]=3.1853281853282e-01; rate[7][19]=2.8416988416988e+00;
-
- rate[8][9]=1.0931677018634e+00; rate[8][10]=3.2194389461470e+00;
- rate[8][11]=3.1498052426571e+00; rate[8][12]=1.9130434782609e+00;
- rate[8][13]=2.7329192546584e+00; rate[8][14]=6.7304834977469e+00;
- rate[8][15]=4.3726708074534e+00; rate[8][16]=2.8162964522581e+00;
- rate[8][17]=7.8083407275954e-01; rate[8][18]=3.5118012422360e+01;
- rate[8][19]=7.2877846790890e-01;
-
- rate[9][10]=1.4069798333535e+01; rate[9][11]=1.2292791953809e+00;
- rate[9][12]=2.8366300366300e+01; rate[9][13]=4.7384615384615e+00;
- rate[9][14]=5.8780435251023e-01; rate[9][15]=2.4105749323141e+00;
- rate[9][16]=1.5243062022723e+01; rate[9][17]=8.2888540031397e-01;
- rate[9][18]=1.8434065934066e+00; rate[9][19]=5.7699633699634e+01;
-
- rate[10][11]=8.8039805231089e-01; rate[10][12]=2.2425954997384e+01;
- rate[10][13]=1.5099529042386e+01; rate[10][14]=6.2626896912611e+00;
- rate[10][15]=3.4917298022888e+00; rate[10][16]=1.6109411169944e+00;
- rate[10][17]=3.2366001345593e+00; rate[10][18]=1.4505494505495e+00;
- rate[10][19]=1.0557823129252e+01;
-
- rate[11][12]=3.6577885391445e+00; rate[11][13]=1.4915254237288e-01;
- rate[11][14]=1.2868062479229e+00; rate[11][15]=2.8162964522581e+00;
- rate[11][16]=5.7494151926786e+00; rate[11][17]=5.4790729851263e-01;
- rate[11][18]=5.3268765133172e-01; rate[11][19]=7.4899112187248e-01;
-
- rate[12][13]=2.5666666666667e+00; rate[12][14]=9.4491129785247e-01;
- rate[12][15]=1.6397515527950e+00; rate[12][16]=1.2180790960452e+01;
- rate[12][17]=1.1972789115646e+00; rate[12][18]=1.1130952380952e+00;
- rate[12][19]=1.7746031746032e+01;
-
- rate[13][14]=8.8739495798319e-01; rate[13][15]=5.6298136645963e+00;
- rate[13][16]=8.3099273607748e-01; rate[13][17]=3.3224489795918e+00;
- rate[13][18]=3.3392857142857e+01; rate[13][19]=3.6000000000000e+00;
-
- rate[14][15]=1.6261762676085e+01; rate[14][16]=6.8852490148602e+00;
- rate[14][17]=4.2256902761104e-01; rate[14][18]=6.7787114845938e-01;
- rate[14][19]=1.2549019607843e+00;
-
- rate[15][16]=2.7891216619293e+01; rate[15][17]=1.8740017746229e+00;
- rate[15][18]=3.7349896480331e+00; rate[15][19]=2.4182194616977e+00;
-
- rate[16][17]=4.8702870978900e-01; rate[16][18]=1.1985472154964e+00;
- rate[16][19]=6.7925746569814e+00;
-
- rate[17][18]=4.6020408163265e+00; rate[17][19]=1.4693877551020e+00;
-
- rate[18][19]=1.0000000000000e+00;
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/MTREV24.java b/LibrarySource/pal/substmodel/MTREV24.java
deleted file mode 100644
index 70460d5..0000000
--- a/LibrarySource/pal/substmodel/MTREV24.java
+++ /dev/null
@@ -1,196 +0,0 @@
-// MTREV24.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * MTREV24 model of amino acid evolution
- *
- * @version $Id: MTREV24.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class MTREV24 extends AminoAcidModel
-{
- /**
- * constructor
- *
- * @param f amino acid frequencies
- */
- public MTREV24(double[] f)
- {
- super(f);
-
- makeMTREV24();
- fromQToR();
- }
-
- // Get numerical code describing the model type
- public int getModelID()
- {
- return 2;
- }
-
- public void report(PrintWriter out)
- {
- out.println("Model of substitution: MTREV24 (Adachi-Hasegawa 1996)");
- out.println();
- printFrequencies(out);
- }
-
- /**
- * get the frequencies of the original data set that
- * formed the basis for the estimation of the rate matrix
- *
- * @param f array where amino acid frequencies will be stored
- */
- public static void getOriginalFrequencies(double[] f)
- {
- f[0]=0.072; f[1]=0.019; f[2]=0.039; f[3]=0.019; f[4]=0.006;
- f[5]=0.025; f[6]=0.024; f[7]=0.056; f[8]=0.028; f[9]=0.088;
- f[10]=0.168; f[11]=0.023; f[12]=0.054; f[13]=0.061; f[14]=0.054;
- f[15]=0.072; f[16]=0.086; f[17]=0.029; f[18]=0.033; f[19]=0.043;
- }
-
- //
- // Private stuff
- //
-
- // MTREV24 model of amino acid evolution
- // (complete sequence data of mtDNA from 24 vertebrate species)
- // Adachi, J., and Hasegawa, M. 1996. J. Mol. Evol. 42:459-468.
- public void makeMTREV24()
- {
- // Q matrix
- rate[0][1]=1.2199217606346e+01; rate[0][2]=1.4182139942122e+01;
- rate[0][3]=9.2985091873208e+00; rate[0][4]=3.1542792981957e+01;
- rate[0][5]=1.0025852846688e+00; rate[0][6]=5.1418866803338e+00;
- rate[0][7]=6.3531246495131e+01; rate[0][8]=7.3137132861715e+00;
- rate[0][9]=5.0782382656186e+01; rate[0][10]=1.3399741808481e+01;
- rate[0][11]=4.4021672780560e+00; rate[0][12]=7.4673480520104e+01;
- rate[0][13]=3.3513021631978e+00; rate[0][14]=2.8582502221773e+01;
- rate[0][15]=2.0413623195312e+02; rate[0][16]=2.5301305153906e+02;
- rate[0][17]=1.0000000000000e+00; rate[0][18]=3.4084158197615e+00;
- rate[0][19]=1.0266468401249e+02;
-
- rate[1][2]=6.9661274444534e+00; rate[1][3]=1.0000000000000e+00;
- rate[1][4]=5.4384584796568e+01; rate[1][5]=1.1631134513343e+02;
- rate[1][6]=1.0000000000000e+00; rate[1][7]=1.2122831341194e+01;
- rate[1][8]=8.6961067087353e+01; rate[1][9]=1.0000000000000e+00;
- rate[1][10]=8.1976829394538e+00; rate[1][11]=7.4423215395318e+01;
- rate[1][12]=1.0000000000000e+00; rate[1][13]=2.4659158338099e+00;
- rate[1][14]=1.2439947713615e+01; rate[1][15]=3.1791814866372e+00;
- rate[1][16]=1.0935327216119e+00; rate[1][17]=1.1550775790126e+01;
- rate[1][18]=1.0000000000000e+00; rate[1][19]=4.0211417480338e+00;
-
- rate[2][3]=4.1809325468160e+02; rate[2][4]=3.1020979842967e+01;
- rate[2][5]=9.1349622725361e+01; rate[2][6]=3.3185663516310e+01;
- rate[2][7]=2.8052324651124e+01; rate[2][8]=2.6112087577885e+02;
- rate[2][9]=1.4261453863336e+01; rate[2][10]=7.9775653461977e+00;
- rate[2][11]=3.2036829276162e+02; rate[2][12]=3.4424354918739e+01;
- rate[2][13]=7.9996445145608e+00; rate[2][14]=3.8586541461044e+01;
- rate[2][15]=2.6020426225852e+02; rate[2][16]=1.2550758780474e+02;
- rate[2][17]=5.6207759736659e+00; rate[2][18]=1.0071406219571e+02;
- rate[2][19]=1.0000000000000e+00;
-
- rate[3][4]=1.0000000000000e+00; rate[3][5]=2.9097352675564e+01;
- rate[3][6]=3.0713149855302e+02; rate[3][7]=2.9877072751897e+01;
- rate[3][8]=5.9995408885817e+01; rate[3][9]=2.2827096245105e+00;
- rate[3][10]=1.0000000000000e+00; rate[3][11]=1.2183938185384e+00;
- rate[3][12]=1.0000000000000e+00; rate[3][13]=2.6221929413096e+00;
- rate[3][14]=7.0708004204733e+00; rate[3][15]=3.6327934317139e+01;
- rate[3][16]=1.4743408713748e+01; rate[3][17]=1.0453246057102e+01;
- rate[3][18]=1.1165627147496e+01; rate[3][19]=1.0000000000000e+00;
-
- rate[4][5]=3.9599394038972e+01; rate[4][6]=1.0000000000000e+00;
- rate[4][7]=1.6163581056674e+01; rate[4][8]=7.4467985406234e+01;
- rate[4][9]=3.3018175376623e+01; rate[4][10]=1.3500725995091e+01;
- rate[4][11]=1.0000000000000e+00; rate[4][12]=3.2504095376923e+00;
- rate[4][13]=3.7264767083096e+01; rate[4][14]=1.6454136037822e+01;
- rate[4][15]=1.4581783243113e+02; rate[4][16]=9.4720031458442e+01;
- rate[4][17]=1.7684087896962e+01; rate[4][18]=1.3409157685926e+02;
- rate[4][19]=1.0000000000000e+00;
-
- rate[5][6]=1.6503249008836e+02; rate[5][7]=3.5530760735494e+00;
- rate[5][8]=3.0652523140859e+02; rate[5][9]=4.3905393139325e+00;
- rate[5][10]=2.0895470525345e+01; rate[5][11]=2.4504076430724e+02;
- rate[5][12]=2.4931300477797e+01; rate[5][13]=1.0059428264289e+01;
- rate[5][14]=7.2256314165467e+01; rate[5][15]=2.8480937892158e+01;
- rate[5][16]=4.9962974409828e+01; rate[5][17]=1.0000000000000e+00;
- rate[5][18]=2.0430790980529e+01; rate[5][19]=9.9986289000676e+00;
-
- rate[6][7]=1.4884496769963e+01; rate[6][8]=2.5853576435567e+01;
- rate[6][9]=1.7418201388328e+00; rate[6][10]=1.0000000000000e+00;
- rate[6][11]=1.6519126809071e+02; rate[6][12]=1.0000000000000e+00;
- rate[6][13]=1.4067850525292e+00; rate[6][14]=6.7547121641947e+00;
- rate[6][15]=2.8794794140840e+01; rate[6][16]=7.8001372062558e+00;
- rate[6][17]=1.0000000000000e+00; rate[6][18]=6.9067239183061e+00;
- rate[6][19]=1.1127702362585e+01;
-
- rate[7][8]=1.0000000000000e+00; rate[7][9]=3.1466649021550e+00;
- rate[7][10]=1.2699794194865e+00; rate[7][11]=1.1962111069278e+01;
- rate[7][12]=1.0000000000000e+00; rate[7][13]=1.0000000000000e+00;
- rate[7][14]=1.0000000000000e+00; rate[7][15]=6.6277950574411e+01;
- rate[7][16]=5.8800079133028e+00; rate[7][17]=5.7494182626674e+00;
- rate[7][18]=1.6887657206208e+00; rate[7][19]=1.3320553471351e+00;
-
- rate[8][9]=6.4536986087271e+00; rate[8][10]=6.0472584534958e+00;
- rate[8][11]=6.7197196398961e+01; rate[8][12]=6.2977633277779e+00;
- rate[8][13]=2.5347805183364e+01; rate[8][14]=3.2089868698728e+01;
- rate[8][15]=4.0766987134407e+01; rate[8][16]=2.3570850628539e+01;
- rate[8][17]=3.7286635325194e+00; rate[8][18]=3.5270764890474e+02;
- rate[8][19]=1.0000000000000e+00;
-
- rate[9][10]=1.7320653206333e+02; rate[9][11]=1.0298655619743e+01;
- rate[9][12]=2.7262244199514e+02; rate[9][13]=4.4561065036310e+01;
- rate[9][14]=1.0856482766156e+01; rate[9][15]=2.5107659603898e+01;
- rate[9][16]=1.9391167162525e+02; rate[9][17]=1.0000000000000e+00;
- rate[9][18]=1.3161329199391e+01; rate[9][19]=6.4365086389428e+02;
-
- rate[10][11]=7.8314019154706e+00; rate[10][12]=2.8290920517725e+02;
- rate[10][13]=1.1371735519833e+02; rate[10][14]=2.1105885757279e+01;
- rate[10][15]=3.8741359395934e+01; rate[10][16]=6.6524559321657e+01;
- rate[10][17]=1.7071378554833e+01; rate[10][18]=2.3234516108847e+01;
- rate[10][19]=4.8247261078055e+01;
-
- rate[11][12]=4.8092094826036e+01; rate[11][13]=3.3887559483420e+00;
- rate[11][14]=2.6368577564199e+01; rate[11][15]=5.5679895711418e+01;
- rate[11][16]=7.1750284708933e+01; rate[11][17]=1.2631893872825e+01;
- rate[11][18]=2.6932728996777e+01; rate[11][19]=1.0000000000000e+00;
-
- rate[12][13]=4.7798798034572e+01; rate[12][14]=9.9165053447429e+00;
- rate[12][15]=5.8505442466161e+01; rate[12][16]=2.7798190504760e+02;
- rate[12][17]=1.1427000119701e+01; rate[12][18]=2.1029990530586e+01;
- rate[12][19]=2.0397078683768e+02;
-
- rate[13][14]=9.1089574817139e+00; rate[13][15]=3.3835737720574e+01;
- rate[13][16]=1.7815549567056e+01; rate[13][17]=4.1272404968214e+00;
- rate[13][18]=2.4504156395152e+02; rate[13][19]=3.3435675442163e+00;
-
- rate[14][15]=8.9421193040709e+01; rate[14][16]=6.7485067008375e+01;
- rate[14][17]=2.2161693733113e+00; rate[14][18]=8.5338209390745e+00;
- rate[14][19]=4.3342126659660e+00;
-
- rate[15][16]=3.1432036618746e+02; rate[15][17]=2.0305343047059e+01;
- rate[15][18]=3.4167877957799e+01; rate[15][19]=1.0000000000000e+00;
-
- rate[16][17]=5.2559565123081e+00; rate[16][18]=2.0382362288681e+01;
- rate[16][19]=1.0765527137500e+02;
-
- rate[17][18]=1.3814733274637e+01; rate[17][19]=2.8259139240676e+00;
-
- rate[18][19]=1.0000000000000e+00;
- }
-
-}
-
diff --git a/LibrarySource/pal/substmodel/MatrixExponential.java b/LibrarySource/pal/substmodel/MatrixExponential.java
deleted file mode 100644
index 644b763..0000000
--- a/LibrarySource/pal/substmodel/MatrixExponential.java
+++ /dev/null
@@ -1,894 +0,0 @@
-// MatrixExponential.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.substmodel;
-
-import pal.math.*;
-
-
-/**
- * compute matrix exponential and, subsequently, transition probabilities
- * for a given rate matrix
- *
- * @version $Id: MatrixExponential.java,v 1.5 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class MatrixExponential implements TransitionProbability, Cloneable, java.io.Serializable
-{
- //
- // Public stuff
- //
-
- // Constraints and conventions:
- // - first argument: row
- // - second argument: column
- // - transition: from row to column
- // - sum of every row = 1
- // - sum of frequencies = 1
- // - frequencies * rate matrix = 1 (stationarity)
-
- /** dimension of rate matrix */
- public int dimension;
-
- /** transition probability matrix */
- public double[][] transProb;
-
- /**
- * create module
- *
- * @param r rate matrix
- */
- public MatrixExponential(RateMatrix r)
- {
- dimension = r.getDimension();
- transProb = new double[dimension][dimension];
- Eval = new double[dimension];
- Evec = new double[dimension][dimension];
- Ievc = new double[dimension][dimension];
- iexp = new double[dimension][dimension];
- amat = new double[dimension][dimension];
-
- ordr = new int[dimension];
- evali = new double[dimension];
-
- setMatrix(r);
- }
-
- public double getTransitionProbability(int row, int column) {
- return transProb[row][column];
- }
-
- public int getDimension() {
- return dimension;
- }
-
- /**
- * update rate matrix used in present module
- *
- * @param r rate matrix
- */
- public void setMatrix(RateMatrix r)
- {
- /* compute eigenvalues and eigenvectors */
- double[][] rate = r.getRelativeRates();
- for (int i = 0; i < dimension; i++)
- {
- for (int j = 0; j < dimension; j++)
- {
- amat[i][j] = rate[i][j];
- }
- }
-
- elmhes(amat, ordr, dimension);
- eltran(amat, Evec, ordr, dimension);
- hqr2(dimension, 1, dimension, amat, Evec, Eval, evali);
- luinverse(Evec, Ievc, dimension);
- }
- /**
- * compute transition probabilities for a expected distance
- * using the prespecified rate matrix
- *
- * @param arc expected distance
- */
- public void setTime(double start, double end) {
- setDistance(end-start);
- }
- /**
- * compute transition probabilities for a expected distance
- * using the prespecified rate matrix
- *
- * @param arc expected distance
- */
- public void setDistance(double arc)
- {
- int i, j, k;
- double temp;
-
- for (k = 0; k < dimension; k++)
- {
- temp = Math.exp(arc * Eval[k]);
- for (j = 0; j < dimension; j++)
- {
- iexp[k][j] = Ievc[k][j] * temp;
- }
- }
- for (i = 0; i < dimension; i++)
- {
- for (j = 0; j < dimension; j++)
- {
- temp = 0.0;
- for (k = 0; k < dimension; k++)
- {
- temp += Evec[i][k] * iexp[k][j];
- }
- transProb[i][j] = Math.abs(temp);
- }
- }
- }
-
- //
- // Private stuff
- //
-
- // Eigenvalues, eigenvectors, and inverse eigenvectors
- private double[] Eval;
- private double[][] Evec;
- private double[][] Ievc;
- private double[][] iexp;
- private int[] ordr;
- private double[] evali;
- private double amat[][];
-
-
- private void elmhes(double[][] a, int[] ordr, int n)
- {
- int m, j, i;
- double y, x;
-
- for (i = 0; i < n; i++)
- {
- ordr[i] = 0;
- }
- for (m = 2; m < n; m++)
- {
- x = 0.0;
- i = m;
- for (j = m; j <= n; j++)
- {
- if (Math.abs(a[j - 1][m - 2]) > Math.abs(x))
- {
- x = a[j - 1][m - 2];
- i = j;
- }
- }
- ordr[m - 1] = i;
- if (i != m)
- {
- for (j = m - 2; j < n; j++)
- {
- y = a[i - 1][j];
- a[i - 1][j] = a[m - 1][j];
- a[m - 1][j] = y;
- }
- for (j = 0; j < n; j++)
- {
- y = a[j][i - 1];
- a[j][i - 1] = a[j][m - 1];
- a[j][m - 1] = y;
- }
- }
- if (x != 0.0)
- {
- for (i = m; i < n; i++)
- {
- y = a[i][m - 2];
- if (y != 0.0)
- {
- y /= x;
- a[i][m - 2] = y;
- for (j = m - 1; j < n; j++)
- {
- a[i][j] -= y * a[m - 1][j];
- }
- for (j = 0; j < n; j++)
- {
- a[j][m - 1] += y * a[j][i];
- }
- }
- }
- }
- }
- }
-
- // Helper variables for mcdiv
- private double cr, ci;
-
- private void mcdiv(double ar, double ai, double br, double bi)
- {
- double s, ars, ais, brs, bis;
-
- s = Math.abs(br) + Math.abs(bi);
- ars = ar/s;
- ais = ai/s;
- brs = br/s;
- bis = bi/s;
- s = brs * brs + bis * bis;
- cr = (ars * brs + ais * bis)/s;
- ci = (ais * brs - ars * bis)/s;
- }
-
- void hqr2(int n, int low, int hgh, double[][] h, double[][] zz,
- double[] wr, double[] wi) throws ArithmeticException
- {
- int i, j, k, l=0, m, en, na, itn, its;
- double p=0, q=0, r=0, s=0, t, w, x=0, y, ra, sa, vi, vr, z=0, norm, tst1, tst2;
- boolean notLast;
-
-
- norm = 0.0;
- k = 1;
- /* store isolated roots and compute matrix norm */
- for (i = 0; i < n; i++)
- {
- for (j = k - 1; j < n; j++)
- {
- norm += Math.abs(h[i][j]);
- }
- k = i + 1;
- if (i + 1 < low || i + 1 > hgh)
- {
- wr[i] = h[i][i];
- wi[i] = 0.0;
- }
- }
- en = hgh;
- t = 0.0;
- itn = n * 30;
- while (en >= low)
- { /* search for next eigenvalues */
- its = 0;
- na = en - 1;
- while (en >= 1)
- {
- /* look for single small sub-diagonal element */
- boolean fullLoop = true;
- for (l = en; l > low; l--)
- {
- s = Math.abs(h[l - 2][l - 2]) + Math.abs(h[l - 1][l - 1]);
- if (s == 0.0)
- {
- s = norm;
- }
- tst1 = s;
- tst2 = tst1 + Math.abs(h[l - 1][l - 2]);
- if (tst2 == tst1)
- {
- fullLoop = false;
- break;
- }
- }
- if (fullLoop)
- {
- l = low;
- }
-
- x = h[en - 1][en - 1]; /* form shift */
- if (l == en || l == na)
- {
- break;
- }
- if (itn == 0)
- {
- /* eigenvalues have not converged */
- System.out.println("Eigenvalues not converged");
- throw new ArithmeticException();
- }
- y = h[na - 1][na - 1];
- w = h[en - 1][na - 1] * h[na - 1][en - 1];
- /* form exceptional shift */
- if (its == 10 || its == 20)
- {
- t += x;
- for (i = low - 1; i < en; i++)
- {
- h[i][i] -= x;
- }
- s = Math.abs(h[en - 1][na - 1]) + Math.abs(h[na - 1][en - 3]);
- x = 0.75 * s;
- y = x;
- w = -0.4375 * s * s;
- }
- its++;
- itn--;
- /* look for two consecutive small sub-diagonal elements */
- for (m = en - 2; m >= l; m--)
- {
- z = h[m - 1][m - 1];
- r = x - z;
- s = y - z;
- p = (r * s - w) / h[m][m - 1] + h[m - 1][m];
- q = h[m][m] - z - r - s;
- r = h[m + 1][m];
- s = Math.abs(p) + Math.abs(q) + Math.abs(r);
- p /= s;
- q /= s;
- r /= s;
- if (m == l)
- {
- break;
- }
- tst1 = Math.abs(p) * (Math.abs(h[m - 2][m - 2]) + Math.abs(z) + Math.abs(h[m][m]));
- tst2 = tst1 + Math.abs(h[m - 1][m - 2]) * (Math.abs(q) + Math.abs(r));
- if (tst2 == tst1)
- {
- break;
- }
- }
- for (i = m + 2; i <= en; i++)
- {
- h[i - 1][i - 3] = 0.0;
- if (i != m + 2)
- {
- h[i - 1][i - 4] = 0.0;
- }
- }
- for (k = m; k <= na; k++)
- {
- if (k == na)
- {
- notLast = false;
- }
- else
- {
- notLast = true;
- }
- if (k != m)
- {
- p = h[k - 1][k - 2];
- q = h[k][k - 2];
- r = 0.0;
- if (notLast)
- {
- r = h[k + 1][k - 2];
- }
- x = Math.abs(p) + Math.abs(q) + Math.abs(r);
- if (x != 0.0)
- {
- p /= x;
- q /= x;
- r /= x;
- }
- }
- if (x != 0.0)
- {
- if (p < 0.0)
- { /* sign */
- s = - Math.sqrt(p * p + q * q + r * r);
- }
- else
- {
- s = Math.sqrt(p * p + q * q + r * r);
- }
- if (k != m)
- {
- h[k - 1][k - 2] = -s * x;
- }
- else if (l != m)
- {
- h[k - 1][k - 2] = -h[k - 1][k - 2];
- }
- p += s;
- x = p / s;
- y = q / s;
- z = r / s;
- q /= p;
- r /= p;
- if (!notLast)
- {
- for (j = k - 1; j < n; j++)
- { /* row modification */
- p = h[k - 1][j] + q * h[k][j];
- h[k - 1][j] -= p * x;
- h[k][j] -= p * y;
- }
- j = (en < (k + 3)) ? en : (k + 3); /* min */
- for (i = 0; i < j; i++)
- { /* column modification */
- p = x * h[i][k - 1] + y * h[i][k];
- h[i][k - 1] -= p;
- h[i][k] -= p * q;
- }
- /* accumulate transformations */
- for (i = low - 1; i < hgh; i++)
- {
- p = x * zz[i][k - 1] + y * zz[i][k];
- zz[i][k - 1] -= p;
- zz[i][k] -= p * q;
- }
- }
- else
- {
- for (j = k - 1; j < n; j++)
- { /* row modification */
- p = h[k - 1][j] + q * h[k][j] + r * h[k + 1][j];
- h[k - 1][j] -= p * x;
- h[k][j] -= p * y;
- h[k + 1][j] -= p * z;
- }
- j = (en < (k + 3)) ? en : (k + 3); /* min */
- for (i = 0; i < j; i++)
- { /* column modification */
- p = x * h[i][k - 1] + y * h[i][k] + z * h[i][k + 1];
- h[i][k - 1] -= p;
- h[i][k] -= p * q;
- h[i][k + 1] -= p * r;
- }
- /* accumulate transformations */
- for (i = low - 1; i < hgh; i++)
- {
- p = x * zz[i][k - 1] + y * zz[i][k] +
- z * zz[i][k + 1];
- zz[i][k - 1] -= p;
- zz[i][k] -= p * q;
- zz[i][k + 1] -= p * r;
- }
- }
- }
- } /* for k */
- } /* while infinite loop */
- if (l == en)
- { /* one root found */
- h[en - 1][en - 1] = x + t;
- wr[en - 1] = h[en - 1][en - 1];
- wi[en - 1] = 0.0;
- en = na;
- continue;
- }
- y = h[na - 1][na - 1];
- w = h[en - 1][na - 1] * h[na - 1][en - 1];
- p = (y - x) / 2.0;
- q = p * p + w;
- z = Math.sqrt(Math.abs(q));
- h[en - 1][en - 1] = x + t;
- x = h[en - 1][en - 1];
- h[na - 1][na - 1] = y + t;
- if (q >= 0.0)
- { /* real pair */
- if (p < 0.0)
- { /* sign */
- z = p - Math.abs(z);
- }
- else
- {
- z = p + Math.abs(z);
- }
- wr[na - 1] = x + z;
- wr[en - 1] = wr[na - 1];
- if (z != 0.0)
- {
- wr[en - 1] = x - w / z;
- }
- wi[na - 1] = 0.0;
- wi[en - 1] = 0.0;
- x = h[en - 1][na - 1];
- s = Math.abs(x) + Math.abs(z);
- p = x / s;
- q = z / s;
- r = Math.sqrt(p * p + q * q);
- p /= r;
- q /= r;
- for (j = na - 1; j < n; j++)
- { /* row modification */
- z = h[na - 1][j];
- h[na - 1][j] = q * z + p * h[en - 1][j];
- h[en - 1][j] = q * h[en - 1][j] - p * z;
- }
- for (i = 0; i < en; i++)
- { /* column modification */
- z = h[i][na - 1];
- h[i][na - 1] = q * z + p * h[i][en - 1];
- h[i][en - 1] = q * h[i][en - 1] - p * z;
- }
- /* accumulate transformations */
- for (i = low - 1; i < hgh; i++)
- {
- z = zz[i][na - 1];
- zz[i][na - 1] = q * z + p * zz[i][en - 1];
- zz[i][en - 1] = q * zz[i][en - 1] - p * z;
- }
- }
- else
- { /* complex pair */
- wr[na - 1] = x + p;
- wr[en - 1] = x + p;
- wi[na - 1] = z;
- wi[en - 1] = -z;
- }
- en -= 2;
- } /* while en >= low */
- /* backsubstitute to find vectors of upper triangular form */
- if (norm != 0.0)
- {
- for (en = n; en >= 1; en--)
- {
- p = wr[en - 1];
- q = wi[en - 1];
- na = en - 1;
- if (q == 0.0)
- {/* real vector */
- m = en;
- h[en - 1][en - 1] = 1.0;
- if (na != 0)
- {
- for (i = en - 2; i >= 0; i--)
- {
- w = h[i][i] - p;
- r = 0.0;
- for (j = m - 1; j < en; j++)
- {
- r += h[i][j] * h[j][en - 1];
- }
- if (wi[i] < 0.0)
- {
- z = w;
- s = r;
- }
- else
- {
- m = i + 1;
- if (wi[i] == 0.0)
- {
- t = w;
- if (t == 0.0)
- {
- tst1 = norm;
- t = tst1;
- do
- {
- t = 0.01 * t;
- tst2 = norm + t;
- }
- while (tst2 > tst1);
- }
- h[i][en - 1] = -(r / t);
- }
- else
- { /* solve real equations */
- x = h[i][i + 1];
- y = h[i + 1][i];
- q = (wr[i] - p) * (wr[i] - p) + wi[i] * wi[i];
- t = (x * s - z * r) / q;
- h[i][en - 1] = t;
- if (Math.abs(x) > Math.abs(z))
- h[i + 1][en - 1] = (-r - w * t) / x;
- else
- h[i + 1][en - 1] = (-s - y * t) / z;
- }
- /* overflow control */
- t = Math.abs(h[i][en - 1]);
- if (t != 0.0)
- {
- tst1 = t;
- tst2 = tst1 + 1.0 / tst1;
- if (tst2 <= tst1)
- {
- for (j = i; j < en; j++)
- {
- h[j][en - 1] /= t;
- }
- }
- }
- }
- }
- }
- }
- else if (q > 0.0)
- {
- m = na;
- if (Math.abs(h[en - 1][na - 1]) > Math.abs(h[na - 1][en - 1]))
- {
- h[na - 1][na - 1] = q / h[en - 1][na - 1];
- h[na - 1][en - 1] = (p - h[en - 1][en - 1])/h[en - 1][na - 1];
- }
- else
- {
- mcdiv(0.0, -h[na - 1][en - 1], h[na - 1][na - 1] - p, q);
- h[na - 1][na - 1] = cr;
- h[na - 1][en - 1] = ci;
- }
- h[en - 1][na - 1] = 0.0;
- h[en - 1][en - 1] = 1.0;
- if (en != 2)
- {
- for (i = en - 3; i >= 0; i--)
- {
- w = h[i][i] - p;
- ra = 0.0;
- sa = 0.0;
- for (j = m - 1; j < en; j++)
- {
- ra += h[i][j] * h[j][na - 1];
- sa += h[i][j] * h[j][en - 1];
- }
- if (wi[i] < 0.0)
- {
- z = w;
- r = ra;
- s = sa;
- }
- else
- {
- m = i + 1;
- if (wi[i] == 0.0)
- {
- mcdiv(-ra, -sa, w, q);
- h[i][na - 1] = cr;
- h[i][en - 1] = ci;
- }
- else
- { /* solve complex equations */
- x = h[i][i + 1];
- y = h[i + 1][i];
- vr = (wr[i] - p) * (wr[i] - p);
- vr = vr + wi[i] * wi[i] - q * q;
- vi = (wr[i] - p) * 2.0 * q;
- if (vr == 0.0 && vi == 0.0)
- {
- tst1 = norm * (Math.abs(w) + Math.abs(q) + Math.abs(x) +
- Math.abs(y) + Math.abs(z));
- vr = tst1;
- do
- {
- vr = 0.01 * vr;
- tst2 = tst1 + vr;
- }
- while (tst2 > tst1);
- }
- mcdiv(x * r - z * ra + q * sa, x * s - z * sa - q * ra, vr, vi);
- h[i][na - 1] = cr;
- h[i][en - 1] = ci;
- if (Math.abs(x) > Math.abs(z) + Math.abs(q))
- {
- h[i + 1]
- [na - 1] = (q * h[i][en - 1] -
- w * h[i][na - 1] - ra) / x;
- h[i + 1][en - 1] = (-sa - w * h[i][en - 1] -
- q * h[i][na - 1]) / x;
- }
- else
- {
- mcdiv(-r - y * h[i][na - 1], -s - y * h[i][en - 1], z, q);
- h[i + 1][na - 1] = cr;
- h[i + 1][en - 1] = ci;
- }
- }
- /* overflow control */
- t = (Math.abs(h[i][na - 1]) > Math.abs(h[i][en - 1])) ?
- Math.abs(h[i][na - 1]) : Math.abs(h[i][en - 1]);
- if (t != 0.0)
- {
- tst1 = t;
- tst2 = tst1 + 1.0 / tst1;
- if (tst2 <= tst1)
- {
- for (j = i; j < en; j++)
- {
- h[j][na - 1] /= t;
- h[j][en - 1] /= t;
- }
- }
- }
- }
- }
- }
- }
- }
- /* end back substitution. vectors of isolated roots */
- for (i = 0; i < n; i++)
- {
- if (i + 1 < low || i + 1 > hgh)
- {
- for (j = i; j < n; j++)
- {
- zz[i][j] = h[i][j];
- }
- }
- }
- /* multiply by transformation matrix to give vectors of
- * original full matrix. */
- for (j = n - 1; j >= low - 1; j--)
- {
- m = ((j + 1) < hgh) ? (j + 1) : hgh; /* min */
- for (i = low - 1; i < hgh; i++)
- {
- z = 0.0;
- for (k = low - 1; k < m; k++)
- {
- z += zz[i][k] * h[k][j];
- }
- zz[i][j] = z;
- }
- }
- }
- }
-
- private void eltran(double[][] a, double[][] zz, int[] ordr, int n)
- {
- int i, j, m;
-
- for (i = 0; i < n; i++)
- {
- for (j = i + 1; j < n; j++)
- {
- zz[i][j] = 0.0;
- zz[j][i] = 0.0;
- }
- zz[i][i] = 1.0;
- }
- if (n <= 2)
- {
- return;
- }
- for (m = n - 1; m >= 2; m--)
- {
- for (i = m; i < n; i++)
- {
- zz[i][m - 1] = a[i][m - 2];
- }
- i = ordr[m - 1];
- if (i != m)
- {
- for (j = m - 1; j < n; j++)
- {
- zz[m - 1][j] = zz[i - 1][j];
- zz[i - 1][j] = 0.0;
- }
- zz[i - 1][m - 1] = 1.0;
- }
- }
- }
-
- void luinverse(double[][] inmat, double[][] imtrx, int size) throws IllegalArgumentException
- {
- int i, j, k, l, maxi=0, idx, ix, jx;
- double sum, tmp, maxb, aw;
- int[] index;
- double[] wk;
- double[][] omtrx;
-
-
- index = new int[size];
- omtrx = new double[size][size];
-
- /* copy inmat to omtrx */
- for (i = 0; i < size; i++)
- {
- for (j = 0; j < size; j++)
- {
- omtrx[i][j] = inmat[i][j];
- }
- }
-
- wk = new double[size];
- aw = 1.0;
- for (i = 0; i < size; i++)
- {
- maxb = 0.0;
- for (j = 0; j < size; j++)
- {
- if (Math.abs(omtrx[i][j]) > maxb)
- {
- maxb = Math.abs(omtrx[i][j]);
- }
- }
- if (maxb == 0.0)
- {
- /* Singular matrix */
- System.out.println("Singular matrix encountered");
- throw new IllegalArgumentException("Singular matrix");
- }
- wk[i] = 1.0/maxb;
- }
- for (j = 0; j < size; j++)
- {
- for (i = 0; i < j; i++)
- {
- sum = omtrx[i][j];
- for (k = 0; k < i; k++)
- {
- sum -= omtrx[i][k] * omtrx[k][j];
- }
- omtrx[i][j] = sum;
- }
- maxb = 0.0;
- for (i = j; i < size; i++)
- {
- sum = omtrx[i][j];
- for (k = 0; k < j; k++)
- {
- sum -= omtrx[i][k] * omtrx[k][j];
- }
- omtrx[i][j] = sum;
- tmp = wk[i] * Math.abs(sum);
- if (tmp >= maxb)
- {
- maxb = tmp;
- maxi = i;
- }
- }
- if (j != maxi)
- {
- for (k = 0; k < size; k++)
- {
- tmp = omtrx[maxi][k];
- omtrx[maxi][k] = omtrx[j][k];
- omtrx[j][k] = tmp;
- }
- aw = -aw;
- wk[maxi] = wk[j];
- }
- index[j] = maxi;
- if (omtrx[j][j] == 0.0)
- {
- omtrx[j][j] = MachineAccuracy.EPSILON;
- }
- if (j != size - 1)
- {
- tmp = 1.0 / omtrx[j][j];
- for (i = j + 1; i < size; i++)
- {
- omtrx[i][j] *= tmp;
- }
- }
- }
- for (jx = 0; jx < size; jx++)
- {
- for (ix = 0; ix < size; ix++)
- {
- wk[ix] = 0.0;
- }
- wk[jx] = 1.0;
- l = -1;
- for (i = 0; i < size; i++)
- {
- idx = index[i];
- sum = wk[idx];
- wk[idx] = wk[i];
- if (l != -1)
- {
- for (j = l; j < i; j++)
- {
- sum -= omtrx[i][j] * wk[j];
- }
- }
- else if (sum != 0.0)
- {
- l = i;
- }
- wk[i] = sum;
- }
- for (i = size - 1; i >= 0; i--)
- {
- sum = wk[i];
- for (j = i + 1; j < size; j++)
- {
- sum -= omtrx[i][j] * wk[j];
- }
- wk[i] = sum/omtrx[i][i];
- }
- for (ix = 0; ix < size; ix++)
- {
- imtrx[ix][jx] = wk[ix];
- }
- }
- wk = null;
- index = null;
- omtrx = null;
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/NucleotideModel.java b/LibrarySource/pal/substmodel/NucleotideModel.java
deleted file mode 100644
index 5d52c1d..0000000
--- a/LibrarySource/pal/substmodel/NucleotideModel.java
+++ /dev/null
@@ -1,132 +0,0 @@
-// NucleotideModel.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-import pal.datatype.*;
-
-import java.io.*;
-
-
-/**
- * base class for nucleotide rate matrices
- *
- * @version $Id: NucleotideModel.java,v 1.7 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-abstract public class NucleotideModel extends AbstractRateMatrix implements RateMatrix, Serializable {
- //
- // Public stuff
- //
-
- /**
- * Create nucleotide substitution model according to model type
- *
- * @param modelID model code
- * @param params model parameters
- * @param freq model frequencies
- *
- * @return nucleotide rate matrix
- */
- public static NucleotideModel getInstance(int modelID, double[] params, double[] freq)
- {
- if (modelID == NucleotideModelID.GTR)
- {
- return new GTR(params, freq);
- }
- else if (modelID == NucleotideModelID.TN)
- {
- return new TN(params, freq);
- }
- else if (modelID == NucleotideModelID.HKY)
- {
- return new HKY(params, freq);
- }
- else if (modelID == NucleotideModelID.F84)
- {
- return new F84(params, freq);
- }
- else if (modelID == NucleotideModelID.F81)
- {
- return new F81(freq);
- }
- else
- {
- return new F81(freq);
- }
- }
-
- // interface Report (inherited, remains abstract)
-
- // interface Parameterized (inherited, remains abstract)
-
-
- //
- // Protected stuff (for use in derived classes)
- //
-
- // Constructor
- protected NucleotideModel(double[] f)
- {
- // Dimension = 4
- super(4);
-
- dataType = new Nucleotides();
- setFrequencies(f);
- }
-
- protected void printFrequencies(PrintWriter out)
- {
- out.println("Nucleotide frequencies:");
- super.printFrequencies(out);
- }
-
- protected void printRatios(PrintWriter out)
- {
- computeRatios();
- out.print("Expected transition/transversion ratio: ");
- format.displayDecimal(out, expectedTsTvRatio, 2);
- out.println();
- out.print("Expected pyrimidine transition/purine transition ratio: ");
- format.displayDecimal(out, expectedYRTsRatio, 2);
- out.println();
- }
-
- //
- // Private stuff
- //
-
- private void computeRatios()
- {
- // Compute expectation ratios
- int A = 0; double piA = frequency[0];
- int C = 1; double piC = frequency[1];
- int G = 2; double piG = frequency[2];
- int T = 3; double piT = frequency[3];
-
- double numYTs = piC*rate[C][T] + piT*rate[T][C];
- double numRTs = piA*rate[A][G] + piG*rate[G][A];
- double numTv =
- piA*rate[A][C] + piC*rate[C][A] +
- piA*rate[A][T] + piT*rate[T][A] +
- piC*rate[C][G] + piG*rate[G][C] +
- piG*rate[G][T] + piT*rate[T][G];
-
- expectedTsTvRatio = (numYTs + numRTs)/numTv;
- expectedYRTsRatio = numYTs/numRTs;
- }
-
- // Expected transition-transversion ratio
- private double expectedTsTvRatio;
-
- // Expected ratio of pyrimidine and purine transitions
- private double expectedYRTsRatio;
-}
-
diff --git a/LibrarySource/pal/substmodel/NucleotideModelID.java b/LibrarySource/pal/substmodel/NucleotideModelID.java
deleted file mode 100644
index ec2cb61..0000000
--- a/LibrarySource/pal/substmodel/NucleotideModelID.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// NucleotideModelID.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.substmodel;
-
-import java.io.Serializable;
-
-/**
- * interface for IDs of nucleotide models
- *
- * @version $Id: NucleotideModelID.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public interface NucleotideModelID extends Serializable
-{
- //
- // Public stuff
- //
-
- int GTR = 0;
- int TN = 1;
- int HKY = 2;
- int F84 = 3;
- int F81 = 4;
-
- int MODELCOUNT = 5;
-
-}
-
diff --git a/LibrarySource/pal/substmodel/RateDistribution.java b/LibrarySource/pal/substmodel/RateDistribution.java
deleted file mode 100644
index 4fdbe9f..0000000
--- a/LibrarySource/pal/substmodel/RateDistribution.java
+++ /dev/null
@@ -1,92 +0,0 @@
-// RateDistribution.java
-//
-// (c) 1999-2000 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-import pal.io.*;
-
-import java.io.*;
-
-
-/**
- * abstract base class for models of rate variation over sites
- * employing a discrete rate distribution
- *
- * @version $Id: RateDistribution.java,v 1.7 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-
-public abstract class RateDistribution implements Parameterized, Report, Cloneable, Serializable
-{
- //
- // Public stuff
- //
-
- /** number of rate categories*/
- public int numRates;
-
- /** rates of each rate category */
- public double[] rate;
-
- /** probability of each rate */
- public double[] probability;
-
- /**
- * construct discrete distribution
- *
- * @param n number of rate categories
- */
- public RateDistribution(int n)
- {
- format = FormattedOutput.getInstance();
-
- numRates = n;
- rate = new double[n];
- probability = new double[n];
- }
-
- // interface Report (remains abstract)
-
- // interface Parameterized (remains abstract)
-
- //
- // Protected stuff
- //
-
- protected FormattedOutput format;
-
- protected void printRates(PrintWriter out)
- {
- out.println("Relative rates and their probabilities:\n");
- format.displayIntegerWhite(out, numRates);
- out.println(" Rate Probability");
- for (int i = 0; i < numRates; i++)
- {
- format.displayInteger(out, i+1, numRates);
- out.print(" ");
- format.displayDecimal(out, rate[i], 5);
- out.print(" ");
- format.displayDecimal(out, probability[i], 5);
- out.println();
- }
- }
-
- public Object clone() {
- try {
- RateDistribution rd = (RateDistribution)super.clone();
- return rd;
- } catch (CloneNotSupportedException e) {
- // this shouldn't happen
- throw new InternalError();
- }
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/RateMatrix.java b/LibrarySource/pal/substmodel/RateMatrix.java
deleted file mode 100644
index d91d4a8..0000000
--- a/LibrarySource/pal/substmodel/RateMatrix.java
+++ /dev/null
@@ -1,86 +0,0 @@
-// RateMatrix.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-import pal.io.*;
-import pal.datatype.*;
-
-import java.io.*;
-
-
-/**
- * abstract base class for all rate matrices
- *
- * @version $Id: RateMatrix.java,v 1.14 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public interface RateMatrix
- extends Parameterized, Report, Cloneable, Serializable {
-
- /**
- * get numerical code describing the data type
- *
- * @return integer code identifying a data type
- */
- int getTypeID();
-
- int getDimension();
-
- /**
- * @return stationary frequencies (sum = 1.0)
- */
- double[] getEqulibriumFrequencies();
-
- /**
- * @return stationary frequencie (sum = 1.0) for ith state
- * Preferred method for infrequent use.
- */
- double getEqulibriumFrequency(int i);
-
- /**
- * get numerical code describing the model type
- *
- * @return integer code identifying a substitution model
- */
- int getModelID();
-
-
-
- /** For those that like Getter/Setters */
- DataType getDataType();
-
- /**
- * @return rate matrix (transition: from 1st index to 2nd index)
- * @note should be deprecated. Try not to use!
- */
- double[][] getRelativeRates();
-
-
- /**
- Return a transitionProbability calculting thing appropriate to this ratematrix (generally returns SimpleRateMatrix())
- */
- TransitionProbability getTransitionProbability();
-
- /**
- Return a matrix exponential appropriate to this ratematrix (generally returns SimpleRateMatrix())
- given an old matrix exponential (may reuse old matrix exponential)
- */
- TransitionProbability getTransitionProbability(TransitionProbability old);
-
- // interface Report (remains abstract)
-
- // interface Parameterized (remains abstract)
-
- Object clone();
-
-}
-
diff --git a/LibrarySource/pal/substmodel/RateMatrixUtils.java b/LibrarySource/pal/substmodel/RateMatrixUtils.java
deleted file mode 100644
index e730073..0000000
--- a/LibrarySource/pal/substmodel/RateMatrixUtils.java
+++ /dev/null
@@ -1,64 +0,0 @@
-// RateMatrixUtils.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.substmodel;
-
-import pal.datatype.*;
-
-/**
- * @version $Id: RateMatrixUtils.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- * @author Matthew Goode
- */
-
-public class RateMatrixUtils {
-
- /**
- * Create rate matrix given model and data type codes
- *
- * @param typeID code for data type
- * @param modelID code for model of substitution
- * @param params model parameters
- * @param freq model frequencies
- *
- * @return rate matrix
- */
- public static RateMatrix getInstance(int typeID, int modelID,
- double[] params, double[] freq)
- {
- if (typeID == DataType.NUCLEOTIDES)
- {
- return NucleotideModel.getInstance(modelID, params, freq);
- }
- else if (typeID == DataType.AMINOACIDS)
- {
- return AminoAcidModel.getInstance(modelID, freq);
- }
- else if (typeID == DataType.TWOSTATES)
- {
- return TwoStateModel.getInstance(freq);
- }
- else
- {
- return NucleotideModel.getInstance(modelID, params, freq);
- }
- }
-
- public static final RateMatrix[] getCopy(RateMatrix[] toCopy) {
- if(toCopy==null) {
- return null;
- }
- RateMatrix[] copy = new RateMatrix[toCopy.length];
- for(int i = 0 ; i < copy.length ; i++) {
- copy[i] = (RateMatrix)toCopy[i].clone();
- }
- return copy;
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/SubstitutionModel.java b/LibrarySource/pal/substmodel/SubstitutionModel.java
deleted file mode 100644
index c40cbf7..0000000
--- a/LibrarySource/pal/substmodel/SubstitutionModel.java
+++ /dev/null
@@ -1,288 +0,0 @@
-// SubstitutionModel.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-import pal.math.*;
-
-import java.io.*;
-
-
-/**
- * <b>model of sequence substitution (rate matrix + rate variation)</b>.
- * provides a convenient interface for the computation of transition probabilities
- *
- * @version $Id: SubstitutionModel.java,v 1.9 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class SubstitutionModel implements Parameterized, Report, java.io.Serializable, Cloneable {
- //
- // Public stuff
- //
-
- /** rate matrix */
- public RateMatrix rateMatrix;
-
- /** rate distribution */
- public RateDistribution rateDistribution;
-
- /** dimension of rate matrix */
- public int dimension;
-
- /** number of categories in discrete rate distribution */
- public int numRates;
-
- /**
- * constructor 1 (uniform rate distribution)
- *
- * @param rmat rate matrix
- */
- public SubstitutionModel(RateMatrix rmat)
- {
- this(rmat, new UniformRate());
- }
-
- /**
- * constructor 2 (gamma rate distribution)
- *
- * @param rmat rate matrix
- * @param n number of rate categories
- * @param a shape parameter
- */
- public SubstitutionModel(RateMatrix rmat, int n, double a)
- {
- this(rmat, new GammaRates(n, a));
- }
-
- /**
- * constructor 3 (arbitrary rate distribution)
- *
- * @param rmat rate matrix
- * @param rdist rate distribution
- */
- public SubstitutionModel(RateMatrix rmat, RateDistribution rdist)
- {
- dimension = rmat.getDimension();
- numRates = rdist.numRates;
-
- rateMatrix = rmat;
- rateDistribution = rdist;
-
- tpm = rmat.getTransitionProbability();
- probs = new double[numRates][dimension][dimension];
-
- numRmatParams = rmat.getNumParameters();
- numRdistParams = rdist.getNumParameters();
- numParams = numRmatParams + numRdistParams;
- }
-
- /**
- * Return a copy of this substitution model.
- */
- public SubstitutionModel(SubstitutionModel model) {
-
- dimension = model.rateMatrix.getDimension();
- numRates = model.rateDistribution.numRates;
- numRmatParams = model.rateMatrix.getNumParameters();
- numRdistParams = model.rateDistribution.getNumParameters();
-
- rateMatrix = (RateMatrix)model.rateMatrix.clone();
- rateDistribution =
- (RateDistribution)model.rateDistribution.clone();
-
- tpm = rateMatrix.getTransitionProbability();
- probs = new double[numRates][dimension][dimension];
-
- numParams = numRmatParams + numRdistParams;
- }
-
- // interface Report
- public void report(PrintWriter out)
- {
- rateMatrix.report(out);
- out.println();
- rateDistribution.report(out);
- }
-
- /**
- * Return string representation of substitution model.
- */
- public String toString() {
- StringWriter sw = new StringWriter();
- report(new PrintWriter(sw));
- return sw.toString();
- }
-
- // interface Parameterized
-
- public int getNumParameters()
- {
- return numParams;
- }
-
- public void setParameter(double param, int n)
- {
- if (n < numRmatParams)
- {
- rateMatrix.setParameter(param, n);
- tpm = rateMatrix.getTransitionProbability(tpm);
- }
- else
- {
- rateDistribution.setParameter(param, n-numRmatParams);
- }
- }
-
- public double getParameter(int n)
- {
- if (n < numRmatParams)
- {
- return rateMatrix.getParameter(n);
- }
- else
- {
- return rateDistribution.getParameter(n-numRmatParams);
- }
- }
-
- public void setParameterSE(double paramSE, int n)
- {
- if (n < numRmatParams)
- {
- rateMatrix.setParameterSE(paramSE, n);
- }
- else
- {
- rateDistribution.setParameterSE(paramSE, n-numRmatParams);
- }
- }
-
- public double getLowerLimit(int n)
- {
- if (n < numRmatParams)
- {
- return rateMatrix.getLowerLimit(n);
- }
- else
- {
- return rateDistribution.getLowerLimit(n-numRmatParams);
- }
- }
-
- public double getUpperLimit(int n)
- {
- if (n < numRmatParams)
- {
- return rateMatrix.getUpperLimit(n);
- }
- else
- {
- return rateDistribution.getUpperLimit(n-numRmatParams);
- }
- }
-
- public double getDefaultValue(int n)
- {
- if (n < numRmatParams)
- {
- return rateMatrix.getDefaultValue(n);
- }
- else
- {
- return rateDistribution.getDefaultValue(n-numRmatParams);
- }
- }
-
-
- /**
- * set distance and corresponding computation transition probabilities
- *
- * @param k distance
- */
- public void setDistance(double k)
- {
- for (int r = 0; r < numRates; r++)
- {
- double kk = k*rateDistribution.rate[r];
-
- if (kk < BranchLimits.MINARC)
- {
- kk = BranchLimits.MINARC;
- }
- if (kk > BranchLimits.MAXARC)
- {
- kk = BranchLimits.MAXARC;
- }
-
- tpm.setDistance(kk);
-
- for (int i = 0; i < dimension; i++)
- {
- for (int j = 0; j < dimension; j++)
- {
- probs[r][i][j] = tpm.getTransitionProbability(i,j);
- }
- }
- }
- }
-
- /**
- * get transition probability for the preselected model and
- * the previously specified distance
- *
- * @param r rate category
- * @param i start state
- * @param j end state
- *
- * @return transition probability
- */
- public double transProb(int r, int i, int j)
- {
- return probs[r][i][j];
- }
-
- public boolean isSimpleJukesCantor() {
-
- // if more then one rate the not a simple jukes cantor
- if (numRates > 1) return false;
-
- // NOT if frequencies are different
- double[] frequencies = rateMatrix.getEqulibriumFrequencies();
- double freq = frequencies[0];
- for (int i = 1; i < frequencies.length; i++) {
- if (frequencies[i] != freq) {
- return false;
- }
- }
-
- double[][] relRates = rateMatrix.getRelativeRates();
- // NOT if rates are different
- double rate = relRates[0][1];
- for (int i = 0; i < relRates.length; i++) {
- for (int j = 0; j < relRates[i].length; j++) {
- if ((i != j) && (relRates[i][j] != rate)) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- //
- // Private stuff
- //
-
- private TransitionProbability tpm;
- private double[][][] probs;
- private int numRmatParams, numRdistParams, numParams;
-}
-
diff --git a/LibrarySource/pal/substmodel/TN.java b/LibrarySource/pal/substmodel/TN.java
deleted file mode 100644
index dfdae00..0000000
--- a/LibrarySource/pal/substmodel/TN.java
+++ /dev/null
@@ -1,183 +0,0 @@
-// TN.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * Tamura-Nei model of nucleotide evolution
- *
- * @version $Id: TN.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class TN extends NucleotideModel
-{
- /**
- * constructor 1
- *
- * @param kappa transition/transversion rate ratio
- * @param r pyrimidine/purin transition rate ratio
- * @param freq nucleotide frequencies
- */
- public TN(double kappa, double r, double[] freq)
- {
- super(freq);
-
- this.kappa = kappa;
- this.r = r;
-
- makeTN();
- fromQToR();
-
- showSE = false;
- }
-
- /**
- * constructor 2
- *
- * @param params parameter list
- * @param freq nucleotode frequencies
- */
- public TN(double[] params, double[] freq)
- {
- this(params[0], params[1], freq);
- }
-
- // Get numerical code describing the model type
- public int getModelID()
- {
- return 1;
- }
-
- // interface Parameterized
-
- public void report(PrintWriter out)
- {
- out.println("Model of substitution: TN (Tamura-Nei 1993)");
- out.print("Transition/transversion rate ratio kappa: ");
- format.displayDecimal(out, kappa, 2);
- if (showSE)
- {
- out.print(" (S.E. ");
- format.displayDecimal(out, kappaSE, 2);
- out.print(")");
- }
- out.println();
-
- out.print("Y/R transition rate ratio: ");
- format.displayDecimal(out, r, 2);
- if (showSE)
- {
- out.print(" (S.E. ");
- format.displayDecimal(out, rSE, 2);
- out.print(")");
- }
- out.println();
-
- out.println();
- printFrequencies(out);
- printRatios(out);
- }
-
- // interface Parameterized
-
- public int getNumParameters()
- {
- return 2;
- }
-
- public void setParameter(double param, int n)
- {
- switch(n)
- {
- case 0: kappa = param; break;
- case 1: r = param; break;
-
- default: throw new IllegalArgumentException();
- }
-
- makeTN();
- fromQToR();
- }
-
- public double getParameter(int n)
- {
- double value;
-
- switch(n)
- {
- case 0: value = kappa; break;
- case 1: value = r; break;
-
- default: throw new IllegalArgumentException();
- }
-
- return value;
- }
-
- public void setParameterSE(double paramSE, int n)
- {
- switch(n)
- {
- case 0: kappaSE = paramSE; break;
- case 1: rSE = paramSE; break;
-
- default: throw new IllegalArgumentException();
- }
-
- showSE = true;
- }
-
- public double getLowerLimit(int n)
- {
- return 0.0001;
- }
-
- public double getUpperLimit(int n)
- {
- return 100.0;
- }
-
- public double getDefaultValue(int n)
- {
- double value;
-
- switch(n)
- {
- case 0: value = 4.0; break;
- case 1: value = 0.5; break;
-
- default: throw new IllegalArgumentException();
- }
-
- return value;
- }
-
-
- //
- // Private stuff
- //
-
- private boolean showSE;
- private double kappa, kappaSE, r, rSE;
-
- // Make TN model
- private void makeTN()
- {
- // Q matrix
- rate[0][1] = 1; rate[0][2] = 2.0*kappa/(r+1.0); rate[0][3] = 1;
- rate[1][2] = 1; rate[1][3] = 2.0*kappa*r/(r+1.0);
- rate[2][3] = 1;
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/TransitionProbability.java b/LibrarySource/pal/substmodel/TransitionProbability.java
deleted file mode 100644
index a00809c..0000000
--- a/LibrarySource/pal/substmodel/TransitionProbability.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// TransistionProbability.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.substmodel;
-
-import pal.math.*;
-
-
-/**
- * For objects that represent a source of transition probabilities
- *
- * TransitionProbability.java,v 1.3 2000/08/08 22:58:29 alexi Exp $
- *
- * @author Matthew Goode
- */
-public interface TransitionProbability extends Cloneable, java.io.Serializable {
-
- /**
- * compute transition probabilities for a expected distance
- * using the prespecified rate matrix
- *
- * @param arc expected distance
- */
- void setDistance(double arc);
- /**
- * compute transition probabilities for a expected time span
- * using the prespecified rate matrix
- *
- * @param start start time
- * @param end end time
- */
- void setTime(double start, double end);
-
- /**
- * Returns the transition probability for changing from
- * startState into endState
- * @param startState - the starting state
- * @param endState - the resulting state
- */
- double getTransitionProbability(int startState, int endState);
-
- int getDimension();
-}
-
diff --git a/LibrarySource/pal/substmodel/TwoStateModel.java b/LibrarySource/pal/substmodel/TwoStateModel.java
deleted file mode 100644
index d6ee4f8..0000000
--- a/LibrarySource/pal/substmodel/TwoStateModel.java
+++ /dev/null
@@ -1,115 +0,0 @@
-// TwoStateModel.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-import pal.datatype.*;
-
-import java.io.*;
-
-
-/**
- * implements the most general reversible rate matrix for two-state data
- *
- * @version $Id: TwoStateModel.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class TwoStateModel extends AbstractRateMatrix implements RateMatrix
-{
- /**
- * constructor
- *
- * @param f frequencies
- *
- * @return rate matrix
- */
- public TwoStateModel(double[] f)
- {
- // Dimension = 2
- super(2);
-
- dataType = new TwoStates();
-
- setFrequencies(f);
- // Q matrix
- rate[0][1] = 1;
- fromQToR();
- }
-
- /**
- * get numerical code describing the model type
- *
- * @return 0 (there is only one model)
- */
- public int getModelID()
- {
- return 0;
- }
-
- /**
- * create object using an instance method
- *
- * @param freq model frequencies
- *
- * @return rate matrix
- */
- public static TwoStateModel getInstance(double[] freq)
- {
- return new TwoStateModel(freq);
- }
-
- // interface Report
-
- public void report(PrintWriter out)
- {
- out.println("Model of substitution: Proportional Model (F81)");
- out.println();
- out.println("Frequencies of the two states:");
- printFrequencies(out);
- }
-
- // interface Parameterized
-
- public int getNumParameters()
- {
- return 0;
- }
-
- public void setParameter(double param, int n)
- {
- return;
- }
-
- public double getParameter(int n)
- {
- return 0.0;
- }
-
- public void setParameterSE(double paramSE, int n)
- {
- return;
- }
-
- public double getLowerLimit(int n)
- {
- return 0.0;
- }
-
- public double getUpperLimit(int n)
- {
- return 0.0;
- }
-
- public double getDefaultValue(int n)
- {
- return 0.0;
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/UniformRate.java b/LibrarySource/pal/substmodel/UniformRate.java
deleted file mode 100644
index 1887c88..0000000
--- a/LibrarySource/pal/substmodel/UniformRate.java
+++ /dev/null
@@ -1,84 +0,0 @@
-// UniformRate.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * uniform rate distribution
- *
- * @version $Id: UniformRate.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class UniformRate extends RateDistribution implements Serializable
-{
- //
- // Public stuff
- //
-
- /**
- * construct uniform rate distribution
- */
- public UniformRate()
- {
- super(1);
-
- rate[0] = 1.0;
- probability[0] = 1.0;
- }
-
- // interface Report
-
- public void report(PrintWriter out)
- {
- out.println("Model of rate heterogeneity: Uniform rate at all sites");
- }
-
- // interface Parameterized
-
- public int getNumParameters()
- {
- return 0;
- }
-
- public void setParameter(double param, int n)
- {
- return;
- }
-
- public double getParameter(int n)
- {
- return 0.0;
- }
-
- public void setParameterSE(double paramSE, int n)
- {
- return;
- }
-
- public double getLowerLimit(int n)
- {
- return 0.0;
- }
-
- public double getUpperLimit(int n)
- {
- return 0.0;
- }
-
- public double getDefaultValue(int n)
- {
- return 0.0;
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/VT.java b/LibrarySource/pal/substmodel/VT.java
deleted file mode 100644
index f6d57da..0000000
--- a/LibrarySource/pal/substmodel/VT.java
+++ /dev/null
@@ -1,210 +0,0 @@
-// VT.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * VT (variable time matrix) model of amino acid evolution
- *
- * @version $Id: VT.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class VT extends AminoAcidModel
-{
- /**
- * constructor
- *
- * @param f amino acid frequencies
- */
- public VT(double[] f)
- {
- super(f);
-
- makeVT();
- fromQToR();
- }
-
- // Get numerical code describing the model type
- public int getModelID()
- {
- return 4;
- }
-
- public void report(PrintWriter out)
- {
- out.println("Model of substitution: VT (Mueller-Vingron 2000)");
- out.println();
- printFrequencies(out);
- }
-
- /**
- * get the frequencies of the original data set that
- * formed the basis for the estimation of the rate matrix
- *
- * @param f array where amino acid frequencies will be stored
- */
- public static void getOriginalFrequencies(double[] f)
- {
- f[0]=0.078837 ;
- f[1]=0.051238 ;
- f[2]=0.042313 ;
- f[3]=0.053066 ;
- f[4]=0.015175 ;
- f[5]=0.036713 ;
- f[6]=0.061924 ;
- f[7]=0.070852 ;
- f[8]=0.023082 ;
- f[9]=0.062056 ;
- f[10]=0.096371 ;
- f[11]=0.057324 ;
- f[12]=0.023771 ;
- f[13]=0.043296 ;
- f[14]=0.043911 ;
- f[15]=0.063403 ;
- f[16]=0.055897 ;
- f[17]=0.013272 ;
- f[18]=0.034399 ;
- f[19]=0.073101 ;
- }
-
- //
- // Private stuff
- //
-
- // VT model of amino acid evolution
- // Mueller, T. and Vingron, M. 2000. J. Comp. Biol.?:?-?.
- private void makeVT()
- {
- // Q matrix
- rate[0][1] = 0.233108 ; rate[0][2] = 0.199097 ;
- rate[0][3] = 0.265145 ; rate[0][4] = 0.227333 ;
- rate[0][5] = 0.310084 ; rate[0][6] = 0.567957 ;
- rate[0][7] = 0.876213 ; rate[0][8] = 0.078692 ;
- rate[0][9] = 0.222972 ; rate[0][10] = 0.424630 ;
- rate[0][11] = 0.393245 ; rate[0][12] = 0.211550 ;
- rate[0][13] = 0.116646 ; rate[0][14] = 0.399143 ;
- rate[0][15] = 1.817198 ; rate[0][16] = 0.877877 ;
- rate[0][17] = 0.030309 ; rate[0][18] = 0.087061 ;
- rate[0][19] = 1.230985 ;
-
- rate[1][2] = 0.210797 ; rate[1][3] = 0.105191 ;
- rate[1][4] = 0.031726 ; rate[1][5] = 0.493763 ;
- rate[1][6] = 0.255240 ; rate[1][7] = 0.156945 ;
- rate[1][8] = 0.213164 ; rate[1][9] = 0.081510 ;
- rate[1][10] = 0.192364 ; rate[1][11] = 1.755838 ;
- rate[1][12] = 0.087930 ; rate[1][13] = 0.042569 ;
- rate[1][14] = 0.128480 ; rate[1][15] = 0.292327 ;
- rate[1][16] = 0.204109 ; rate[1][17] = 0.046417 ;
- rate[1][18] = 0.097010 ; rate[1][19] = 0.113146 ;
-
- rate[2][3] = 0.883422 ; rate[2][4] = 0.027495 ;
- rate[2][5] = 0.275700 ; rate[2][6] = 0.270417 ;
- rate[2][7] = 0.362028 ; rate[2][8] = 0.290006 ;
- rate[2][9] = 0.087225 ; rate[2][10] = 0.069245 ;
- rate[2][11] = 0.503060 ; rate[2][12] = 0.057420 ;
- rate[2][13] = 0.039769 ; rate[2][14] = 0.083956 ;
- rate[2][15] = 0.847049 ; rate[2][16] = 0.471268 ;
- rate[2][17] = 0.010459 ; rate[2][18] = 0.093268 ;
- rate[2][19] = 0.049824 ;
-
- rate[3][4] = 0.010313 ; rate[3][5] = 0.205842 ;
- rate[3][6] = 1.599461 ; rate[3][7] = 0.311718 ;
- rate[3][8] = 0.134252 ; rate[3][9] = 0.011720 ;
- rate[3][10] = 0.060863 ; rate[3][11] = 0.261101 ;
- rate[3][12] = 0.012182 ; rate[3][13] = 0.016577 ;
- rate[3][14] = 0.160063 ; rate[3][15] = 0.461519 ;
- rate[3][16] = 0.178197 ; rate[3][17] = 0.011393 ;
- rate[3][18] = 0.051664 ; rate[3][19] = 0.048769 ;
-
- rate[4][5] = 0.004315 ; rate[4][6] = 0.005321 ;
- rate[4][7] = 0.050876 ; rate[4][8] = 0.016695 ;
- rate[4][9] = 0.046398 ; rate[4][10] = 0.091709 ;
- rate[4][11] = 0.004067 ; rate[4][12] = 0.023690 ;
- rate[4][13] = 0.051127 ; rate[4][14] = 0.011137 ;
- rate[4][15] = 0.175270 ; rate[4][16] = 0.079511 ;
- rate[4][17] = 0.007732 ; rate[4][18] = 0.042823 ;
- rate[4][19] = 0.163831 ;
-
- rate[5][6] = 0.960976 ; rate[5][7] = 0.128660 ;
- rate[5][8] = 0.315521 ; rate[5][9] = 0.054602 ;
- rate[5][10] = 0.243530 ; rate[5][11] = 0.738208 ;
- rate[5][12] = 0.120801 ; rate[5][13] = 0.026235 ;
- rate[5][14] = 0.156570 ; rate[5][15] = 0.358017 ;
- rate[5][16] = 0.248992 ; rate[5][17] = 0.021248 ;
- rate[5][18] = 0.062544 ; rate[5][19] = 0.112027 ;
-
- rate[6][7] = 0.250447 ; rate[6][8] = 0.104458 ;
- rate[6][9] = 0.046589 ; rate[6][10] = 0.151924 ;
- rate[6][11] = 0.888630 ; rate[6][12] = 0.058643 ;
- rate[6][13] = 0.028168 ; rate[6][14] = 0.205134 ;
- rate[6][15] = 0.406035 ; rate[6][16] = 0.321028 ;
- rate[6][17] = 0.018844 ; rate[6][18] = 0.055200 ;
- rate[6][19] = 0.205868 ;
-
- rate[7][8] = 0.058131 ; rate[7][9] = 0.051089 ;
- rate[7][10] = 0.087056 ; rate[7][11] = 0.193243 ;
- rate[7][12] = 0.046560 ; rate[7][13] = 0.050143 ;
- rate[7][14] = 0.124492 ; rate[7][15] = 0.612843 ;
- rate[7][16] = 0.136266 ; rate[7][17] = 0.023990 ;
- rate[7][18] = 0.037568 ; rate[7][19] = 0.082579 ;
-
- rate[8][9] = 0.020039 ; rate[8][10] = 0.103552 ;
- rate[8][11] = 0.153323 ; rate[8][12] = 0.021157 ;
- rate[8][13] = 0.079807 ; rate[8][14] = 0.078892 ;
- rate[8][15] = 0.167406 ; rate[8][16] = 0.101117 ;
- rate[8][17] = 0.020009 ; rate[8][18] = 0.286027 ;
- rate[8][19] = 0.068575 ;
-
- rate[9][10] = 2.089890 ; rate[9][11] = 0.093181 ;
- rate[9][12] = 0.493845 ; rate[9][13] = 0.321020 ;
- rate[9][14] = 0.054797 ; rate[9][15] = 0.081567 ;
- rate[9][16] = 0.376588 ; rate[9][17] = 0.034954 ;
- rate[9][18] = 0.086237 ; rate[9][19] = 3.654430 ;
-
- rate[10][11] = 0.201204 ; rate[10][12] = 1.105667 ;
- rate[10][13] = 0.946499 ; rate[10][14] = 0.169784 ;
- rate[10][15] = 0.214977 ; rate[10][16] = 0.243227 ;
- rate[10][17] = 0.083439 ; rate[10][18] = 0.189842 ;
- rate[10][19] = 1.337571 ;
-
- rate[11][12] = 0.096474 ; rate[11][13] = 0.038261 ;
- rate[11][14] = 0.212302 ; rate[11][15] = 0.400072 ;
- rate[11][16] = 0.446646 ; rate[11][17] = 0.023321 ;
- rate[11][18] = 0.068689 ; rate[11][19] = 0.144587 ;
-
- rate[12][13] = 0.173052 ; rate[12][14] = 0.010363 ;
- rate[12][15] = 0.090515 ; rate[12][16] = 0.184609 ;
- rate[12][17] = 0.022019 ; rate[12][18] = 0.073223 ;
- rate[12][19] = 0.307309 ;
-
- rate[13][14] = 0.042564 ; rate[13][15] = 0.138119 ;
- rate[13][16] = 0.085870 ; rate[13][17] = 0.128050 ;
- rate[13][18] = 0.898663 ; rate[13][19] = 0.247329 ;
-
- rate[14][15] = 0.430431 ; rate[14][16] = 0.207143 ;
- rate[14][17] = 0.014584 ; rate[14][18] = 0.032043 ;
- rate[14][19] = 0.129315 ;
-
- rate[15][16] = 1.767766 ; rate[15][17] = 0.035933 ;
- rate[15][18] = 0.121979 ; rate[15][19] = 0.127700 ;
-
- rate[16][17] = 0.020437 ; rate[16][18] = 0.094617 ;
- rate[16][19] = 0.740372 ;
-
- rate[17][18] = 0.124746 ; rate[17][19] = 0.022134 ;
-
- rate[18][19] = 0.125733 ;
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/WAG.java b/LibrarySource/pal/substmodel/WAG.java
deleted file mode 100644
index d5feb2f..0000000
--- a/LibrarySource/pal/substmodel/WAG.java
+++ /dev/null
@@ -1,210 +0,0 @@
-// WAG.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * WAG model of amino acid evolution (S. Whelan and N. Goldman 2000)
- *
- * @version $Id: WAG.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class WAG extends AminoAcidModel
-{
- /**
- * constructor
- *
- * @param f amino acid frequencies
- */
- public WAG(double[] f)
- {
- super(f);
-
- makeWAG();
- fromQToR();
- }
-
- // Get numerical code describing the model type
- public int getModelID()
- {
- return 5;
- }
-
- public void report(PrintWriter out)
- {
- out.println("Model of substitution: WAG (Whelan-Goldman 2000)");
- out.println();
- printFrequencies(out);
- }
-
- /**
- * get the frequencies of the original data set that
- * formed the basis for the estimation of the rate matrix
- *
- * @param f array where amino acid frequencies will be stored
- */
- public static void getOriginalFrequencies(double[] f)
- {
- f[0] = 0.0866;
- f[1] = 0.0440;
- f[2] = 0.0391;
- f[3] = 0.0570;
- f[4] = 0.0193;
- f[5] = 0.0367;
- f[6] = 0.0581;
- f[7] = 0.0833;
- f[8] = 0.0244;
- f[9] = 0.0485;
- f[10] = 0.0862;
- f[11] = 0.0620;
- f[12] = 0.0195;
- f[13] = 0.0384;
- f[14] = 0.0458;
- f[15] = 0.0695;
- f[16] = 0.0610;
- f[17] = 0.0144;
- f[18] = 0.0353;
- f[19] = 0.0709;
- }
-
- //
- // Private stuff
- //
-
- // WAG model of amino acid evolution
- // Whelan, S. and N. Goldman. 2000. in prep.
- private void makeWAG()
- {
- // Q matrix
- rate[0][1] = 0.610810; rate[0][2] = 0.569079;
- rate[0][3] = 0.821500; rate[0][4] = 1.141050;
- rate[0][5] = 1.011980; rate[0][6] = 1.756410;
- rate[0][7] = 1.572160; rate[0][8] = 0.354813;
- rate[0][9] = 0.219023; rate[0][10] = 0.443935;
- rate[0][11] = 1.005440; rate[0][12] = 0.989475;
- rate[0][13] = 0.233492; rate[0][14] = 1.594890;
- rate[0][15] = 3.733380; rate[0][16] = 2.349220;
- rate[0][17] = 0.125227; rate[0][18] = 0.268987;
- rate[0][19] = 2.221870;
-
- rate[1][2] = 0.711690; rate[1][3] = 0.165074;
- rate[1][4] = 0.585809; rate[1][5] = 3.360330;
- rate[1][6] = 0.488649; rate[1][7] = 0.650469;
- rate[1][8] = 2.362040; rate[1][9] = 0.206722;
- rate[1][10] = 0.551450; rate[1][11] = 5.925170;
- rate[1][12] = 0.758446; rate[1][13] = 0.116821;
- rate[1][14] = 0.753467; rate[1][15] = 1.357640;
- rate[1][16] = 0.613776; rate[1][17] = 1.294610;
- rate[1][18] = 0.423612; rate[1][19] = 0.280336;
-
- rate[2][3] = 6.013660; rate[2][4] = 0.296524;
- rate[2][5] = 1.716740; rate[2][6] = 1.056790;
- rate[2][7] = 1.253910; rate[2][8] = 4.378930;
- rate[2][9] = 0.615636; rate[2][10] = 0.147156;
- rate[2][11] = 3.334390; rate[2][12] = 0.224747;
- rate[2][13] = 0.110793; rate[2][14] = 0.217538;
- rate[2][15] = 4.394450; rate[2][16] = 2.257930;
- rate[2][17] = 0.078463; rate[2][18] = 1.208560;
- rate[2][19] = 0.221176;
-
- rate[3][4] = 0.033379; rate[3][5] = 0.691268;
- rate[3][6] = 6.833400; rate[3][7] = 0.961142;
- rate[3][8] = 1.032910; rate[3][9] = 0.043523;
- rate[3][10] = 0.093930; rate[3][11] = 0.533362;
- rate[3][12] = 0.116813; rate[3][13] = 0.052004;
- rate[3][14] = 0.472601; rate[3][15] = 1.192810;
- rate[3][16] = 0.417372; rate[3][17] = 0.146348;
- rate[3][18] = 0.363243; rate[3][19] = 0.169417;
-
- rate[4][5] = 0.109261; rate[4][6] = 0.023920;
- rate[4][7] = 0.341086; rate[4][8] = 0.275403;
- rate[4][9] = 0.189890; rate[4][10] = 0.428414;
- rate[4][11] = 0.083649; rate[4][12] = 0.437393;
- rate[4][13] = 0.441300; rate[4][14] = 0.122303;
- rate[4][15] = 1.560590; rate[4][16] = 0.570186;
- rate[4][17] = 0.795736; rate[4][18] = 0.604634;
- rate[4][19] = 1.114570;
-
- rate[5][6] = 6.048790; rate[5][7] = 0.366510;
- rate[5][8] = 4.749460; rate[5][9] = 0.131046;
- rate[5][10] = 0.964886; rate[5][11] = 4.308310;
- rate[5][12] = 1.705070; rate[5][13] = 0.110744;
- rate[5][14] = 1.036370; rate[5][15] = 1.141210;
- rate[5][16] = 0.954144; rate[5][17] = 0.243615;
- rate[5][18] = 0.252457; rate[5][19] = 0.333890;
-
- rate[6][7] = 0.630832; rate[6][8] = 0.635025;
- rate[6][9] = 0.141320; rate[6][10] = 0.172579;
- rate[6][11] = 2.867580; rate[6][12] = 0.353912;
- rate[6][13] = 0.092310; rate[6][14] = 0.755791;
- rate[6][15] = 0.782467; rate[6][16] = 0.914814;
- rate[6][17] = 0.172682; rate[6][18] = 0.217549;
- rate[6][19] = 0.655045;
-
- rate[7][8] = 0.276379; rate[7][9] = 0.034151;
- rate[7][10] = 0.068651; rate[7][11] = 0.415992;
- rate[7][12] = 0.194220; rate[7][13] = 0.055288;
- rate[7][14] = 0.273149; rate[7][15] = 1.486700;
- rate[7][16] = 0.251477; rate[7][17] = 0.374321;
- rate[7][18] = 0.114187; rate[7][19] = 0.209108;
-
- rate[8][9] = 0.152215; rate[8][10] = 0.555096;
- rate[8][11] = 0.992083; rate[8][12] = 0.450867;
- rate[8][13] = 0.756080; rate[8][14] = 0.771387;
- rate[8][15] = 0.822459; rate[8][16] = 0.525511;
- rate[8][17] = 0.289998; rate[8][18] = 4.290350;
- rate[8][19] = 0.131869;
-
- rate[9][10] = 3.517820; rate[9][11] = 0.360574;
- rate[9][12] = 4.714220; rate[9][13] = 1.177640;
- rate[9][14] = 0.111502; rate[9][15] = 0.353443;
- rate[9][16] = 1.615050; rate[9][17] = 0.234326;
- rate[9][18] = 0.468951; rate[9][19] = 8.659740;
-
- rate[10][11] = 0.287583; rate[10][12] = 5.375250;
- rate[10][13] = 2.348200; rate[10][14] = 0.462018;
- rate[10][15] = 0.382421; rate[10][16] = 0.364222;
- rate[10][17] = 0.740259; rate[10][18] = 0.443205;
- rate[10][19] = 1.997370;
-
- rate[11][12] = 1.032220; rate[11][13] = 0.098843;
- rate[11][14] = 0.619503; rate[11][15] = 1.073780;
- rate[11][16] = 1.537920; rate[11][17] = 0.152232;
- rate[11][18] = 0.147411; rate[11][19] = 0.342012;
-
- rate[12][13] = 1.320870; rate[12][14] = 0.194864;
- rate[12][15] = 0.556353; rate[12][16] = 1.681970;
- rate[12][17] = 0.570369; rate[12][18] = 0.473810;
- rate[12][19] = 2.282020;
-
- rate[13][14] = 0.179896; rate[13][15] = 0.606814;
- rate[13][16] = 0.191467; rate[13][17] = 1.699780;
- rate[13][18] = 7.154480; rate[13][19] = 0.725096;
-
- rate[14][15] = 1.786490; rate[14][16] = 0.885349;
- rate[14][17] = 0.156619; rate[14][18] = 0.239607;
- rate[14][19] = 0.351250;
-
- rate[15][16] = 4.847130; rate[15][17] = 0.578784;
- rate[15][18] = 0.872519; rate[15][19] = 0.258861;
-
- rate[16][17] = 0.126678; rate[16][18] = 0.325490;
- rate[16][19] = 1.547670;
-
- rate[17][18] = 2.763540; rate[17][19] = 0.409817;
-
- rate[18][19] = 0.347826;
- }
-}
-
diff --git a/LibrarySource/pal/substmodel/YangCodonModel.java b/LibrarySource/pal/substmodel/YangCodonModel.java
deleted file mode 100644
index 86879b8..0000000
--- a/LibrarySource/pal/substmodel/YangCodonModel.java
+++ /dev/null
@@ -1,276 +0,0 @@
-// YangCodonModel.java
-//
-// (c) 1999-2001 PAL Development Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.substmodel;
-
-import pal.misc.*;
-import pal.datatype.*;
-
-import java.io.*;
-
-
-/**
- * Yang's model of codon evolution
- *
- * @version $Id: YangCodonModel.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Andrew Rambaut
- */
-public class YangCodonModel extends CodonModel implements Serializable
-{
- /**
- * constructor 1
- *
- * @param omega N/S rate ratio
- * @param kappa transition/transversion rate ratio
- * @param freq codon frequencies
- * @param codonTable codon table
- */
- public YangCodonModel(double omega, double kappa, double[] freq,
- CodonTable codonTable)
- {
- super(freq);
-
- this.kappa = kappa;
- this.omega = omega;
- this.codonTable = codonTable;
-
- makeYangModel();
- fromQToR();
-
- showSE = false;
- }
-
- /**
- * constructor 2 (universal codon table)
- *
- * @param omega N/S rate ratio
- * @param kappa transition/transversion rate ratio
- * @param freq codon frequencies
- */
- public YangCodonModel(double omega, double kappa, double[] freq)
- {
- this(omega, kappa, freq, CodonTableFactory.createUniversalTranslator());
- }
-
- /**
- * constructor 4 (universal codon table)
- *
- * @param params parameter list
- * @param freq nucleotide frequencies
- */
- public YangCodonModel(double[] params, double[] freq)
- {
- this(params[0], params[1], freq, CodonTableFactory.createUniversalTranslator());
- }
-
- /**
- * constructor 3
- *
- * @param params parameter list
- * @param freq nucleotide frequencies
- * @param codonTable codon table
- */
- public YangCodonModel(double[] params, double[] freq,
- CodonTable codonTable)
- {
- this(params[0], params[1], freq, codonTable);
- }
-
-
- // Get numerical code describing the model type
- public int getModelID()
- {
- return 0;
- }
-
- // interface Report
-
- public void report(PrintWriter out)
- {
- out.println("Model of substitution: YANG (Yang, ????)");
-
- out.print("Parameter kappa: ");
- format.displayDecimal(out, kappa, 2);
- if (showSE)
- {
- out.print(" (S.E. ");
- format.displayDecimal(out, kappaSE, 2);
- out.print(")");
- }
- out.println();
-
- out.print("Parameter omega: ");
- format.displayDecimal(out, omega, 2);
- if (showSE)
- {
- out.print(" (S.E. ");
- format.displayDecimal(out, omegaSE, 2);
- out.print(")");
- }
- out.println();
-
- printFrequencies(out);
- printRatios(out);
- }
-
- // interface Parameterized
-
- public int getNumParameters()
- {
- return 2;
- }
-
- public void setParameter(double param, int n)
- {
- switch(n)
- {
- case 0: kappa = param; break;
- case 1: omega = param; break;
-
- default: throw new IllegalArgumentException();
- }
-
- makeYangModel();
- fromQToR();
- }
-
- public double getParameter(int n)
- {
- double value;
-
- switch(n)
- {
- case 0: value = kappa; break;
- case 1: value = omega; break;
-
- default: throw new IllegalArgumentException();
- }
-
- return value;
- }
-
- public void setParameterSE(double paramSE, int n)
- {
- switch(n)
- {
- case 0: kappaSE = paramSE; break;
- case 1: omegaSE = paramSE; break;
-
- default: throw new IllegalArgumentException();
- }
-
- showSE = true;
- }
-
- public double getLowerLimit(int n)
- {
- return 0.0001;
- }
-
- public double getUpperLimit(int n)
- {
- return 100.0;
- }
-
- public double getDefaultValue(int n)
- {
- return 1.0;
- }
-
-
- //
- // Private stuff
- //
-
- private boolean showSE;
- private double kappa, omega;
- private double kappaSE, omegaSE;
- private byte[] rateMap;
-
- // Make REV model
- private void makeYangModel()
- {
- int numRates = ( dimension * (dimension - 1) ) / 2;
- rateMap = new byte[numRates];
-
-// NewArray(rateMap, char, numRates);
-
- int u, v, rateClass;
- char aa1, aa2;
- char[] codon1, codon2;
- GeneralizedCodons generalizedCodons = new GeneralizedCodons();
-
- for (u = 0; u < dimension; u++) {
- codon1 = generalizedCodons.getCodonFromCodonIndex(u);
-
- for (v = u+1; v < dimension; v++) {
- codon2 = generalizedCodons.getCodonFromCodonIndex(v);
-
- rateClass = -1;
- if (codon1[0] != codon2[0]) {
- if ( (codon1[0] == 'A' && codon2[0] == 'G') ||
- (codon1[0] == 'G' && codon2[0] == 'A') || // A <-> G
- (codon1[0] == 'C' && codon2[0] == 'T') ||
- (codon1[0] == 'T' && codon2[0] == 'C') ) // C <-> T
- rateClass = 1; // Transition
- else
- rateClass = 2; // Transversion
- }
- if (codon1[1] != codon2[1]) {
- if (rateClass == -1) {
- if ( (codon1[1] == 'A' && codon2[1] == 'G') ||
- (codon1[1] == 'G' && codon2[1] == 'A') || // A <-> G
- (codon1[1] == 'C' && codon2[1] == 'T') ||
- (codon1[1] == 'T' && codon2[1] == 'C') ) // C <-> T
- rateClass = 1; // Transition
- else
- rateClass = 2; // Transversion
- } else
- rateClass = 0; // Codon changes at more than one position
- }
- if (codon1[2] != codon2[2]) {
- if (rateClass == -1) {
- if ( (codon1[2] == 'A' && codon2[2] == 'G') ||
- (codon1[2] == 'G' && codon2[2] == 'A') || // A <-> G
- (codon1[2] == 'C' && codon2[2] == 'T') ||
- (codon1[2] == 'T' && codon2[2] == 'C') ) // C <-> T
- rateClass = 1; // Transition
- else
- rateClass = 2; // Transversion
- } else
- rateClass = 0; // Codon changes at more than one position
- }
-
- if (rateClass != 0) {
- aa1 = codonTable.getAminoAcidChar(codon1);
- aa2 = codonTable.getAminoAcidChar(codon2);
- if (aa1 == AminoAcids.TERMINATE_CHARACTER || aa2 == AminoAcids.TERMINATE_CHARACTER)
- rateClass = 0; // Can't change to a stop codon
- else if (aa1 != aa2)
- rateClass += 2; // Is a non-synonymous change
- }
-
- switch (rateClass) {
- case 0: rate[u][v] = 0.0; break; // codon changes in more than one codon position
- case 1: rate[u][v] = kappa; break; // synonymous transition
- case 2: rate[u][v] = 1.0; break; // synonymous transversion
- case 3: rate[u][v] = kappa * omega; break; // non-synonymous transition
- case 4: rate[u][v] = omega; break; // non-synonymous transversion
- }
- rate[v][u] = rate[u][v];
- }
- rate[u][u] = 0.0;
- }
- }
-
- // genetic code used to figure out stop codons
- private CodonTable codonTable;
-
-}
-
diff --git a/LibrarySource/pal/substmodel/makefile b/LibrarySource/pal/substmodel/makefile
deleted file mode 100644
index dca8f11..0000000
--- a/LibrarySource/pal/substmodel/makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-### VARIABLES ###
-
-JIKESOPTS := +P
-GCJOPTS :=
-
-# Always check dependencies
-JIKESOPTS += +M
-
-SRC := $(wildcard *.java)
-CLS := $(patsubst %.java, %.class, $(SRC))
-OBJ := $(patsubst %.class, %.o, $(wildcard *.class))
-
-
-### RULES ###
-
-# Compile Java sources into class files
-%.class: %.java
- jikes $(JIKESOPTS) $<
-
-# Alternative to using jikes: gcj -C
-
-# Compile class files into native code
-%.o: %.class
- gcj -c $(GCJOPTS) $<
-
-
-### TARGETS ###
-
-.PHONY: classes native clean
-
-classes: $(CLS)
-
-ifneq ($(OBJ),)
-native: $(OBJ)
- (ar -rv package.a *.o; ranlib package.a)
-else
-native: $(OBJ)
-endif
-
-clean:
- rm -f *.class *.o *.u *.a *~
-
diff --git a/LibrarySource/pal/substmodel/package.html b/LibrarySource/pal/substmodel/package.html
deleted file mode 100644
index 9d91c60..0000000
--- a/LibrarySource/pal/substmodel/package.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<html>
-<body>
-Classes describing substitution models, i.e. rate matrices (e.g., the HKY
-matrix) and rate heterogeneity distributions (e.g., the discrete Gamma
-distribution), as well as a class for conveniently computing transition
-probabilities.
-</body>
-</html>
-
diff --git a/LibrarySource/pal/tree/ClockTree.java b/LibrarySource/pal/tree/ClockTree.java
deleted file mode 100644
index 0175826..0000000
--- a/LibrarySource/pal/tree/ClockTree.java
+++ /dev/null
@@ -1,143 +0,0 @@
-// ClockTree.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.tree;
-
-import pal.misc.*;
-
-
-/**
- * provides parameter interface to a clock tree
- * (parameters are the minimal node height differences
- * at each internal node)
- *
- * @version $Id: ClockTree.java,v 1.10 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class ClockTree extends ParameterizedTree
-{
- //
- // Public stuff
- //
-
- public ClockTree() {}
-
- /**
- * take any tree and afford it with an interface
- * suitable for a clock-like tree (parameters
- * are the minimal node height differences at each internal node).
- * <p>
- * <em>This parameterisation of a clock-tree, ensuring that
- * all parameters are independent of each other is due to
- * Andrew Rambaut (personal communication).</em>
- */
- public ClockTree(Tree t)
- {
- setBaseTree(t);
-
- if (getRoot().getChildCount() < 2)
- {
- throw new IllegalArgumentException(
- "The root node must have at least two childs!");
- }
-
- parameter = new double[getNumParameters()];
-
- for (int i = 0; i < parameter.length; i++)
- {
- parameter[i] = getDefaultValue(i);
- }
-
-
- // init
- parameters2Heights();
- NodeUtils.heights2Lengths(getRoot());
- }
-
- /** make clocktree consistent with branch lengths */
- public void update()
- {
- createNodeList();
- NodeUtils.lengths2Heights(getRoot());
- heights2parameters();
- }
-
- // interface Parameterized
-
- public int getNumParameters()
- {
- return getInternalNodeCount();
- }
-
- public void setParameter(double param, int n)
- {
- parameter[n] = param;
-
- parameters2Heights();
- NodeUtils.heights2Lengths(getRoot());
- }
-
- public double getParameter(int n)
- {
- return parameter[n];
- }
-
- public void setParameterSE(double paramSE, int n)
- {
- return; // we are not interested in these SEs
- }
-
- public double getLowerLimit(int n)
- {
- return BranchLimits.MINARC;
- }
-
- public double getUpperLimit(int n)
- {
- return BranchLimits.MAXARC;
- }
-
- public double getDefaultValue(int n)
- {
- return BranchLimits.DEFAULT_LENGTH;
- }
-
- //
- // Private stuff
- //
-
- protected void parameters2Heights()
- {
- // nodes have been stored by a post-order traversal
-
- for (int i = 0; i < getExternalNodeCount(); i++)
- {
- getExternalNode(i).setNodeHeight(0.0);
- }
-
- for (int i = 0; i < getInternalNodeCount(); i++)
- {
- Node node = getInternalNode(i);
- node.setNodeHeight(parameter[i] + NodeUtils.findLargestChild(node));
- }
- }
-
- protected void heights2parameters()
- {
- for (int i = 0; i < getInternalNodeCount(); i++)
- {
- Node node = getInternalNode(i);
- parameter[i] = node.getNodeHeight()-NodeUtils.findLargestChild(node);
- }
- }
-
- protected double[] parameter;
-}
-
diff --git a/LibrarySource/pal/tree/DatedTipsClockTree.java b/LibrarySource/pal/tree/DatedTipsClockTree.java
deleted file mode 100644
index dc7bead..0000000
--- a/LibrarySource/pal/tree/DatedTipsClockTree.java
+++ /dev/null
@@ -1,446 +0,0 @@
-// DatedTipsClockTree.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.tree;
-
-import pal.misc.*;
-
-
-/**
- * provides parameter interface to a clock tree with dated tips,
- * following A. Rambaut. 2000. Bioinformatics 16:395-399.
- * (parameters are the minimal node height differences
- * at each internal node and the evolutionary rate)
- *
- * @version $Id: DatedTipsClockTree.java,v 1.12 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class DatedTipsClockTree extends ParameterizedTree
- implements java.io.Serializable {
-
- //
- // Public stuff
- //
-
-
- /**
- * Constructor without TimeOrderCharacterData.
- * Dates are extracted from labels.
- */
- public DatedTipsClockTree(Tree t) {
- this(t, null, true);
- }
-
- /**
- * take any tree and afford it with an interface
- * suitable for a clock-like tree with dated tips (parameters
- * are the minimal node height differences at each internal node
- * and the rate).
- *
- * This constructor uses the standard definition of a rate (default value = 0, min value = 0, max value = 1)
- * and does include the rate as the parameter
- * <p>
- * <em>This parameterisation of a clock-tree, ensuring that
- * all parameters are independent of each other is due to
- * Andrew Rambaut (personal communication).</em>
- */
- public DatedTipsClockTree(Tree t, TimeOrderCharacterData tocd, boolean useDefaultParameters)
- {
- this(t,new ParameterizedDouble(0,0,1),tocd,useDefaultParameters,true);
- }
-
- /**
- * take any tree and afford it with an interface
- * suitable for a clock-like tree with dated tips (parameters
- * are the minimal node height differences at each internal node
- * and the rate).
- * This constructor does not include the rate as the parameter
- * <p>
- * <em>This parameterisation of a clock-tree, ensuring that
- * all parameters are independent of each other is due to
- * Andrew Rambaut (personal communication).</em>
- */
- public DatedTipsClockTree(Tree t, ParameterizedDouble rate, TimeOrderCharacterData tocd, boolean useDefaultParameters)
- {
- this(t,rate,tocd,useDefaultParameters,false);
- }
- /**
- * take any tree and afford it with an interface
- * suitable for a clock-like tree with dated tips (parameters
- * are the minimal node height differences at each internal node
- * and the rate).
- * <p>
- * <em>This parameterisation of a clock-tree, ensuring that
- * all parameters are independent of each other is due to
- * Andrew Rambaut (personal communication).</em>
- */
- public DatedTipsClockTree(Tree t, ParameterizedDouble rate, TimeOrderCharacterData tocd, boolean useDefaultParameters, boolean includeRateAsParameter)
- {
- this.includeRateAsParameter_ = includeRateAsParameter;
- this.rate = rate;
- setBaseTree(t);
- this.tocd = tocd;
-
- if (getRoot().getChildCount() < 2)
- {
- throw new IllegalArgumentException(
- "The root node must have at least two childs!");
- }
-
- parameter = new double[getInternalNodeCount()];
-
- date = new double[t.getExternalNodeCount()];
- getDates();
-
- if (useDefaultParameters) {
- for (int i = 0; i < parameter.length; i++) {
- parameter[i] = getDefaultValue(i);
- }
- } else {
- // assumes that the tree heights are already valid
- // DatedTipClockTree heights.
- // extracts rate on this assumption with aid of
- // TimeOrderCharacterData.
-
- heights2parameters();
-
- boolean found = false;
- int i = 0;
- while ((i < getExternalNodeCount()) && !found) {
-
- String name = getExternalNode(i).getIdentifier().getName();
-
- int index = tocd.getIdGroup().whichIdNumber(name);
-
- double time = tocd.getTime(index);
-
- if (time > 0.0) {
- double height = getExternalNode(i).getNodeHeight();
-
- rate.setValue(height / time);
- System.out.println("rate = " + rate);
- found = true;
- }
- i += 1;
- }
- if (!found) {
- rate.setValue(0.0);
- }
- }
-
-
- // init
- parameters2Heights();
- NodeUtils.heights2Lengths(getRoot());
- }
-
- /** make parameters consistent with branch lengths and rate parameter */
- public void update()
- {
- createNodeList();
- getDates(); // order of tips may have changed!
- NodeUtils.lengths2Heights(getRoot());
- heights2parameters();
- }
-
- // interface Parameterized (Rambaut paremeterisation)
-
- public int getNumParameters()
- {
- return getInternalNodeCount()+(includeRateAsParameter_ ? 1 : 0);
- }
-
- public void setParameter(double param, int n)
- {
- if (n < getInternalNodeCount())
- {
- parameter[n] = param;
- }
- else
- {
- rate.setValue(param);
- }
-
- parameters2Heights();
- NodeUtils.heights2Lengths(getRoot());
- }
-
- public double getParameter(int n)
- {
- if (n < getInternalNodeCount())
- {
- return parameter[n];
- }
- else
- {
- return rate.getValue();
- }
- }
-
- public void setParameterSE(double paramSE, int n)
- {
- // we are only interested in SE of rate
- if (n < getInternalNodeCount())
- {
- // do nothing
- }
- else
- {
- rate.setSE(paramSE);
- }
- return;
- }
-
- /** return standard error of parameter */
- public double getParameterSE(int n)
- {
- // we are only interested in SE of rate
- if (n < getInternalNodeCount())
- {
- return 0.0;
- }
- else
- {
- return rate.getSE();
- }
- }
-
-
- public double getLowerLimit(int n)
- {
- if (n < getInternalNodeCount())
- {
- return BranchLimits.MINARC;
- }
- else
- {
- return rate.getLowerLimit();
- }
- }
-
- public double getUpperLimit(int n)
- {
- if (n < getInternalNodeCount())
- {
- return BranchLimits.MAXARC;
- }
- else
- {
- return rate.getUpperLimit(); // subst. per unit time
- }
- }
-
- public double getDefaultValue(int n)
- {
- if (n < getInternalNodeCount())
- {
- return BranchLimits.DEFAULT_LENGTH;
- }
- else
- {
- return rate.getDefaultValue(); // contemporaneous tips
- }
- }
-
- /**
- * set rate (and thus node heights and branch lengths of leaves) without
- * changing all other node heights and branch lengths
- */
- public void setRate(double r)
- {
- rate.setValue(r);
- for (int i = 0; i < getExternalNodeCount(); i++)
- {
- Node leaf = getExternalNode(i);
- double h = (maxDate-date[i])*rate.getValue();
- leaf.setNodeHeight(Math.abs(h));
- double hp = leaf.getParent().getNodeHeight();
- leaf.setBranchLength(Math.abs(hp-h));
- }
- }
-
- /**
- * get rate
- */
- public double getRate()
- {
- return rate.getValue();
- }
-
-
- /**
- * set rate SE
- */
- public void setRateSE(double rSE)
- {
- rate.setSE(rSE);
- }
-
-
- /**
- * find max. rate (for setRate) allowed by current node heights
- */
- public double getMaxRate()
- {
- double maxRate = 0;
-
- for (int i = 0; i < getExternalNodeCount(); i++)
- {
- Node leaf = getExternalNode(i);
-
- // maximum rate for this leaf
- double maxRateLeaf = (leaf.getParent().getNodeHeight()-BranchLimits.MINARC)/(maxDate-date[i]);
-
- if (i == 0 || maxRateLeaf < maxRate)
- {
- maxRate = maxRateLeaf;
- }
- }
-
- return maxRate;
- }
-
- /**
- * Gets the TimeOrderCharacterData
- */
- public TimeOrderCharacterData getTimeOrderCharacterData() {
- if (tocd != null) {
- return tocd;
- } else {
- //extract from tree.
- //WHAT UNITS TO USE!? Defaulting to EXPECTED_SUBSTITUTIONS
-
- TimeOrderCharacterData tempTOCD =
- new TimeOrderCharacterData(TreeUtils.getLeafIdGroup(this),
- Units.EXPECTED_SUBSTITUTIONS);
- tempTOCD.setTimes(date, Units.EXPECTED_SUBSTITUTIONS, true);
-
- return tempTOCD;
- }
- }
-
- //
- // Private stuff
- //
-
- private void parameters2Heights()
- {
- // nodes have been stored by a post-order traversal
-
- for (int i = 0; i < getExternalNodeCount(); i++)
- {
- getExternalNode(i).setNodeHeight( (maxDate-date[i])*rate.getValue() );
- }
-
- for (int i = 0; i < getInternalNodeCount(); i++)
- {
- Node node = getInternalNode(i);
- node.setNodeHeight(parameter[i] + NodeUtils.findLargestChild(node));
- }
- }
-
- private void heights2parameters()
- {
- for (int i = 0; i < getInternalNodeCount(); i++)
- {
- Node inode = getInternalNode(i);
- parameter[i] = inode.getNodeHeight()-NodeUtils.findLargestChild(inode);
- }
- }
-
- private void getDates()
- {
-
- double maxTime = 0.0;
- if (tocd != null) {
- for (int i = 0; i < date.length; i++) {
- if (tocd.getTime(i) > maxTime) {
- maxTime = tocd.getTime(i);
- }
- }
- }
-
- for (int i = 0; i < getExternalNodeCount(); i++)
- {
- if (tocd == null) {
- // extract dates from sequence identifiers
- date[i] = extractDate(getExternalNode(i).getIdentifier().getName());
- } else {
-
- if (tocd.hasTimes()) {
- String name = getExternalNode(i).getIdentifier().getName();
-
- int index = tocd.getIdGroup().whichIdNumber(name);
-
- //times are measured backwards from zero at most recent tip.
- // this needs to be converted to forward-time dates starting
- // from time zero at oldest tip.
-
- date[i] = maxTime - tocd.getTime(index);
- } else {
- //no times available
- throw new IllegalArgumentException("TimeOrderCharacterData does not have any times!");
- }
- }
- }
-
- // find maximum and minimum date
- minDate = maxDate = date[0];
- for (int i = 1; i < getExternalNodeCount(); i++)
- {
- if (date[i] > maxDate) maxDate = date[i];
- if (date[i] < minDate) minDate = date[i];
- }
-
- // check for equality of dates
- if (minDate == maxDate)
- {
- throw new IllegalArgumentException("Tip dates must not be the same for all tips");
- }
- }
-
- private double extractDate(String string)
- {
- StringBuffer buffer = new StringBuffer();
-
- int len = string.length();
-
- boolean readDot = false;
- for (int i = len-1; i > -1; i--)
- {
- char c = string.charAt(i);
-
- if ( !Character.isDigit(c) && !(c == '.' && !readDot) ) break;
- buffer.append(c);
- if (c == '.') readDot = true;
-
- }
- buffer.reverse();
-
- String date = buffer.toString();
-
- if (date.length() == 0)
- {
- return 0.0;
- }
- else
- {
- return (Double.valueOf(buffer.toString())).doubleValue();
- }
- }
-
- private double[] parameter;
- private ParameterizedDouble rate;
- private boolean includeRateAsParameter_; /** If true than the rate is included as a parameter of this object */
- private double minDate, maxDate;
- private double[] date;
- private TimeOrderCharacterData tocd;
-}
-
diff --git a/LibrarySource/pal/tree/LogParameterizedTree.java b/LibrarySource/pal/tree/LogParameterizedTree.java
deleted file mode 100644
index d6d9023..0000000
--- a/LibrarySource/pal/tree/LogParameterizedTree.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// LogParameterizedTree.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.tree;
-
-import pal.misc.*;
-
-
-/**
- * This class logarithmically transforms tree parameters.
- * Hopefully this makes the function look more like a quadratic
- * for the optimizer!
- *
- * @version $Id: LogParameterizedTree.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class LogParameterizedTree
- extends ParameterizedTree
-{
- //
- // Public stuff
- //
-
- ParameterizedTree params;
-
- private double[] logMins;
- private double[] logMaxs;
- private double[] logDefaults;
-
-
- /**
- * Takes a parameterized object and transforms
- * the parameters logarithmically.
- */
- public LogParameterizedTree(ParameterizedTree params)
- {
- setBaseTree(params);
-
- this.params = params;
-
- setUnits(params.getUnits());
-
- logMins = new double[params.getNumParameters()];
- logMaxs = new double[params.getNumParameters()];
- logDefaults = new double[params.getNumParameters()];
-
- for (int i = 0; i < logMins.length; i++) {
- logMins[i] = Math.log(params.getLowerLimit(i));
- logMaxs[i] = Math.log(params.getUpperLimit(i));
- logDefaults[i] = Math.log(params.getDefaultValue(i));
- }
- }
-
- // interface Parameterized
-
- public int getNumParameters()
- {
- return params.getNumParameters();
- }
-
- public void setParameter(double logParam, int n)
- {
- // - logMins scales the value to lower bound of 0
- double realParam = Math.exp(logParam + logMins[n]);
-
- params.setParameter(realParam, n);
- }
-
- public double getParameter(int n)
- {
- return Math.log(params.getParameter(n)) - logMins[n];
- }
-
- public void setParameterSE(double paramSE, int n)
- {
- return; // DEBUG - not yet done
- }
-
- public double getLowerLimit(int n)
- {
- return 0;
- }
-
- public double getUpperLimit(int n)
- {
- return logMaxs[n] - logMins[n];
- }
-
- public double getDefaultValue(int n)
- {
- return logDefaults[n] - logMins[n];
- }
-}
-
diff --git a/LibrarySource/pal/tree/MutationRateModelTree.java b/LibrarySource/pal/tree/MutationRateModelTree.java
deleted file mode 100644
index dee9c10..0000000
--- a/LibrarySource/pal/tree/MutationRateModelTree.java
+++ /dev/null
@@ -1,175 +0,0 @@
-// MutationRateModelTree.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-//
-
-package pal.tree;
-
-import pal.misc.*;
-import pal.mep.*;
-
-
-import pal.util.*;
-
-/**
- * Provides parameter interface to any clock-like tree with
- * serially sampled tips (parameters are the minimal node height differences
- * at each internal node). Any mutation rate model can be used. <P>
- * @see pal.mep.MutationRateModel
- *
- * @version $Id: MutationRateModelTree.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class MutationRateModelTree extends ParameterizedTree {
-
- //
- // Public stuff
- //
-
- TimeOrderCharacterData tocd = null;
- MutationRateModel model = null;
- int numParameters;
-
- //private
-
- private double MIN_MU = 1e-12;
- private double MIN_DELTA = 1e-12;
- private double lnL = 0.0;
-
- /**
- * take any tree and afford it with an interface
- * suitable for a clock-like tree (parameters
- * are the minimal node height differences at each internal node).
- * <p>
- * <em>This parameterisation of a clock-tree, ensuring that
- * all parameters are independent of each other is due to
- * Andrew Rambaut (personal communication).</em>
- */
- public MutationRateModelTree(Tree t, TimeOrderCharacterData tocd, MutationRateModel model) throws RuntimeException {
-
- setBaseTree(t);
-
- this.tocd = tocd;
- this.model = model;
-
- if (t.getRoot().getChildCount() < 2) {
- throw new RuntimeException(
- "The root node must have at least two childs!");
- }
-
- NodeUtils.heights2Lengths(getRoot());
-
- numParameters = getInternalNodeCount() + model.getNumParameters();
-
-
- if (!tocd.hasTimes()) {
- throw new RuntimeException("Must have times!");
- }
-
- parameter = new double[numParameters - model.getNumParameters()];
- heights2parameters();
- }
-
- // interface Parameterized
-
- public int getNumParameters() {
- return numParameters;
- }
-
- public void setParameter(double param, int n) {
-
- if (n < getInternalNodeCount()) {
- parameter[n] = param;
- } else model.setParameter(param, n - getInternalNodeCount());
-
- // call this parameter2Heights
- parameters2Heights();
- NodeUtils.heights2Lengths(getRoot());
- }
-
- public double getParameter(int n) {
- if (n < getInternalNodeCount()) {
- return parameter[n];
- } else {
- return model.getParameter(n - getInternalNodeCount());
- }
- }
-
- /**
- * Returns lower limit of parameter estimate.
- */
- public double getLowerLimit(int n) {
- if (n < getInternalNodeCount()) {
- return BranchLimits.MINARC;
- } else {
- return MIN_MU;
- }
- }
-
- //
- // Private stuff
- //
-
- private double[] parameter;
-
- public double getDefaultValue(int n) {
- return BranchLimits.DEFAULT_LENGTH;
- }
-
- public void setParameterSE(double paramSE, int n) {
- return; // DEBUG - not yet done
- }
-
- public double getUpperLimit(int n) {
- return BranchLimits.MAXARC;
- }
-
- /**
- * returns mu
- */
- public MutationRateModel getMutationRateModel() {
- return model;
- }
-
- protected void parameters2Heights() {
- // nodes have been stored by a post-order traversal
-
- int index;
-
- for (int i = 0; i < getExternalNodeCount(); i++) {
-
- index = tocd.getIdGroup().whichIdNumber(getExternalNode(i).getIdentifier().getName());
- //System.err.println(index + ":" + i);
-
- getExternalNode(i).setNodeHeight(model.getExpectedSubstitutions(tocd.getTime(index)));
- }
-
- // this could be more efficient
- for (int i = 0; i < getInternalNodeCount(); i++) {
- Node node = getInternalNode(i);
- node.setNodeHeight(parameter[i] + NodeUtils.findLargestChild(node));
- }
- }
-
- protected void heights2parameters() {
- for (int i = 0; i < getInternalNodeCount(); i++) {
- Node node = getInternalNode(i);
- parameter[i] = node.getNodeHeight()-NodeUtils.findLargestChild(node);
- }
-
- // need to convert heights to model parameters somehow!
- }
-
- public void setLnL(double lnL) {
- this.lnL = lnL;
- }
-
- public double getLnL() {
- return lnL;
- }
-}
-
diff --git a/LibrarySource/pal/tree/NeighborJoiningTree.java b/LibrarySource/pal/tree/NeighborJoiningTree.java
deleted file mode 100644
index 164e1d1..0000000
--- a/LibrarySource/pal/tree/NeighborJoiningTree.java
+++ /dev/null
@@ -1,209 +0,0 @@
-// NeighborJoiningTree.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-// computational complexity O(numSeqs^3)
-
-
-package pal.tree;
-
-import pal.distance.*;
-
-
-/**
- * constructs a neighbor-joining tree from pairwise distances
- *
- * @version $Id: NeighborJoiningTree.java,v 1.9 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class NeighborJoiningTree extends SimpleTree
-{
- //
- // Public stuff
- //
-
- /**
- * construct NJ tree
- *
- * @param m distance matrix
- */
- public NeighborJoiningTree(DistanceMatrix m)
- {
- if (m.numSeqs < 3)
- {
- new IllegalArgumentException("LESS THAN 3 TAXA IN DISTANCE MATRIX");
- }
- if (!m.isSymmetric())
- {
- new IllegalArgumentException("UNSYMMETRIC DISTANCE MATRIX");
- }
-
- init(m);
-
- //while (numClusters > 3)
- while (true)
- {
- findNextPair();
- newBranchLengths();
- if (numClusters == 3)
- {
- break;
- }
- newCluster();
- }
-
- finish();
- }
-
-
- //
- // Private stuff
- //
-
- private int numClusters;
- private Node newCluster;
- private int besti, abi;
- private int bestj, abj;
- private int[] alias;
- private double[][] distance;
- private double[] r;
- private double scale;
-
- private double getDist(int a, int b)
- {
- return distance[alias[a]][alias[b]];
- }
-
- private void init(DistanceMatrix m)
- {
- numClusters = m.numSeqs;
-
- distance = new double[numClusters][numClusters];
- for (int i = 0; i < numClusters; i++)
- {
- for (int j = 0; j < numClusters; j++)
- {
- distance[i][j] = m.distance[i][j];
- }
- }
-
- for (int i = 0; i < numClusters; i++)
- {
- Node tmp = NodeFactory.createNode();
- tmp.setIdentifier(m.getIdentifier(i));
- getRoot().addChild(tmp);
- }
-
- alias = new int[numClusters];
- for (int i = 0; i < numClusters; i++)
- {
- alias[i] = i;
- }
-
- r = new double[numClusters];
- }
-
- private void finish()
- {
- if (besti != 0 && bestj != 0)
- {
- getRoot().getChild(0).setBranchLength(updatedDistance(besti, bestj, 0));
- }
- else if (besti != 1 && bestj != 1)
- {
- getRoot().getChild(1).setBranchLength(updatedDistance(besti, bestj, 1));
- }
- else
- {
- getRoot().getChild(2).setBranchLength(updatedDistance(besti, bestj, 2));
- }
- distance = null;
-
- // make node heights available also
- NodeUtils.lengths2Heights(getRoot());
- }
-
- private void findNextPair()
- {
- for (int i = 0; i < numClusters; i++)
- {
- r[i] = 0;
- for (int j = 0; j < numClusters; j++)
- {
- r[i] += getDist(i,j);
- }
- }
-
- besti = 0;
- bestj = 1;
- double smax = -1.0;
- scale = 1.0/(numClusters-2);
- for (int i = 0; i < numClusters-1; i++)
- {
- for (int j = i+1; j < numClusters; j++)
- {
- double sij = (r[i] + r[j] ) * scale - getDist(i, j);
-
- if (sij > smax)
- {
- smax = sij;
- besti = i;
- bestj = j;
- }
- }
- }
- abi = alias[besti];
- abj = alias[bestj];
- }
-
- private void newBranchLengths()
- {
- double dij = getDist(besti, bestj);
- double li = (dij + (r[besti]-r[bestj])*scale)*0.5;
- double lj = dij - li; // = (dij + (r[bestj]-r[besti])*scale)*0.5
-
- getRoot().getChild(besti).setBranchLength(li);
- getRoot().getChild(bestj).setBranchLength(lj);
- }
-
- private void newCluster()
- {
- // Update distances
- for (int k = 0; k < numClusters; k++)
- {
- if (k != besti && k != bestj)
- {
- int ak = alias[k];
- distance[ak][abi] = distance[abi][ak] = updatedDistance(besti, bestj, k);
- }
- }
- distance[abi][abi] = 0.0;
-
- // Replace besti with new cluster
- NodeUtils.joinChilds(getRoot(), besti, bestj);
-
- // Update alias
- for (int i = bestj; i < numClusters-1; i++)
- {
- alias[i] = alias[i+1];
- }
-
- numClusters--;
- }
-
- /**
- * compute updated distance between the new cluster (i,j)
- * to any other cluster k
- */
- private double updatedDistance(int i, int j, int k)
- {
- return (getDist(k, i) + getDist(k, j) - getDist(i, j))*0.5;
- }
-}
-
diff --git a/LibrarySource/pal/tree/Node.java b/LibrarySource/pal/tree/Node.java
deleted file mode 100644
index c965100..0000000
--- a/LibrarySource/pal/tree/Node.java
+++ /dev/null
@@ -1,138 +0,0 @@
-// Node.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.tree;
-
-import pal.misc.*;
-import java.io.*;
-import pal.io.*;
-
-
-/**
- * interface for a node (includes branch) in a binary/non-binary
- * rooted/unrooted tree
- *
- * @version $Id: Node.java,v 1.17 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- * @author Korbinian Strimmer
- *
- */
-
-public interface Node extends Serializable {
-
-
- /** Returns the parent node of this node. */
- Node getParent();
-
- /** Set the parent node of this node. */
- void setParent(Node node);
-
- /** Returns the sequence at this node, in the form an array of bytes. */
- byte[] getSequence();
-
- /** Sets the sequence using an array of bytes. */
- void setSequence(byte[] array);
-
- /** return the index of this node */
- int getNumber();
-
- /** set the number of this node */
- void setNumber(int number);
-
- /** Get the length of the branch attaching this node to its parent. */
- double getBranchLength();
-
- /** Set the length of the branch attaching this node to its parent. */
- void setBranchLength(double value);
-
- /** Get the length SE of the branch attaching this node to its parent. */
- double getBranchLengthSE();
-
- /** Set the length SE of the branch attaching this node to its parent. */
- void setBranchLengthSE(double value);
-
- /** Get the height of this node relative to the most recent node. */
- double getNodeHeight();
-
- /** Set the height of this node relative to the most recent node. */
- void setNodeHeight(double value);
-
- /** Set the height SE of this node relative to the most recent node. */
- void setNodeHeightSE(double value);
-
- /** Get the height SE of this node relative to the most recent node. */
- double getNodeHeightSE();
-
-
- /** Returns the identifier for this node. */
- Identifier getIdentifier();
-
- /** Set identifier for this node. */
- Identifier setIdentifier(Identifier id);
-
- /**
- * Returns the number of children this node has.
- */
- int getChildCount();
-
- /**
- * check whether this node is an external node
- *
- * @return result (true or false)
- */
- boolean isLeaf();
-
- /**
- * check whether this node is a root node
- *
- * @return result (true or false)
- */
- boolean isRoot();
-
- /**
- * get child node
- *
- * @param n number of child
- *
- * @return child node
- */
- Node getChild(int n);
-
- /**
- * set child node
- *
- * @param n number
- * @node node new child node
- */
- void setChild(int n, Node node);
-
- /**
- * add new child node
- *
- * @param c new child node
- */
- void addChild(Node c);
-
- /**
- * add new child node (insertion at a specific position)
- *
- * @param c new child node
- + @param pos position
- */
- void insertChild(Node c, int pos);
-
-
- /**
- * remove child
- *
- * @param n number of child to be removed
- */
- void removeChild(int n);
-}
-
diff --git a/LibrarySource/pal/tree/NodeFactory.java b/LibrarySource/pal/tree/NodeFactory.java
deleted file mode 100644
index 0aab313..0000000
--- a/LibrarySource/pal/tree/NodeFactory.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// NodeFactory.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.tree;
-
-
-/**
- * Creates nodes
- * <b>
- * The purpose of this class is to decouple the creation of
- * a class of type "Node" from its actual implementation. This
- * class should be used instead of calling the constructor
- * of an implementation of "Node"
- * (at the moment "SimpleNode") as it may change in the future.</b><p>
- *
- * Other plans: add features here to recyle old nodes rather than
- * leaving them to the Java garbage collector
- *
- * @author Korbinian Strimmer
- */
-public class NodeFactory
-{
- /** create a node */
- public static Node createNode()
- {
- return new SimpleNode();
- }
-
- /** constructor used to clone a node and all children */
- public static Node createNode(Node node)
- {
- return new SimpleNode(node);
- }
-}
-
diff --git a/LibrarySource/pal/tree/NodeUtils.java b/LibrarySource/pal/tree/NodeUtils.java
deleted file mode 100644
index e37f233..0000000
--- a/LibrarySource/pal/tree/NodeUtils.java
+++ /dev/null
@@ -1,629 +0,0 @@
-// NodeUtils.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.tree;
-
-import pal.misc.*;
-import java.io.*;
-import pal.io.*;
-import pal.util.*;
-
-/**
- * Helper routines for dealing with nodes.
- *
- * @version $Id: NodeUtils.java,v 1.14 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- * @author Korbinian Strimmer
- */
-public class NodeUtils {
-
- /**
- * Converts lengths to heights, *without* assuming contemporaneous
- * tips.
- */
- public static void lengths2Heights(Node root) {
-
- lengths2Heights(root, getGreatestDistance(root));
- }
-
- /**
- * Converts lengths to heights, but maintains tip heights.
- */
- public static void lengths2HeightsKeepTips(Node node, boolean useMax) {
-
- if (!node.isLeaf()) {
- for (int i = 0; i < node.getChildCount(); i++) {
- lengths2HeightsKeepTips(node.getChild(i), useMax);
- }
-
- double totalHL = 0.0;
- double maxHL = 0.0;
- double hl = 0.0;
- double maxH = 0.0;
- double h = 0.0;
- for (int i = 0; i < node.getChildCount(); i++) {
- h = node.getChild(i).getNodeHeight();
- hl = node.getChild(i).getBranchLength() + h;
- if (hl > maxHL) maxHL = hl;
- if (h > maxH) maxH = h;
- totalHL += hl;
- }
- if (useMax) {
- hl = maxHL; // set parent height to maximum parent height implied by children
- } else {
- hl = totalHL / node.getChildCount(); // get mean parent height
- if (hl < maxH) hl = maxHL; // if mean parent height is not greater than all children height, fall back on max parent height.
- }
- node.setNodeHeight(hl); // set new parent height
-
- // change lengths in children to reflect changes.
- for (int i = 0; i < node.getChildCount(); i++) {
- h = node.getChild(i).getNodeHeight();
- node.getChild(i).setBranchLength(hl - h);
- }
- }
- }
-
-
- /**
- * sets this nodes height value to newHeight and all children's
- * height values based on length of branches.
- */
- private static void lengths2Heights(Node node, double newHeight) {
-
- if (!node.isRoot()) {
- newHeight -= node.getBranchLength();
- node.setNodeHeight(newHeight);
- } else {
- node.setNodeHeight(newHeight);
- }
-
- for (int i = 0; i < node.getChildCount(); i++) {
- lengths2Heights(node.getChild(i), newHeight);
- }
- }
-
- /**
- * Exchange field info between two nodes. Specifically
- * identifiers, branch lengths, node heights and branch length
- * SEs.
- */
- public static void exchangeInfo(Node node1, Node node2) {
-
- Identifier swaps;
- double swapd;
-
- swaps = node1.getIdentifier();
- node1.setIdentifier(node2.getIdentifier());
- node2.setIdentifier(swaps);
-
- swapd = node1.getBranchLength();
- node1.setBranchLength(node2.getBranchLength());
- node2.setBranchLength(swapd);
-
- swapd = node1.getNodeHeight();
- node1.setNodeHeight(node2.getNodeHeight());
- node2.setNodeHeight(swapd);
-
- swapd = node1.getBranchLengthSE();
- node1.setBranchLengthSE(node2.getBranchLengthSE());
- node2.setBranchLengthSE(swapd);
- }
-
- /**
- * determines branch lengths of this and all descendent nodes
- * from heights
- */
- public static void heights2Lengths(Node node) {
- heights2Lengths(node, true); //respect minimum
- }
-
- /**
- * determines branch lengths of this and all descendent nodes
- * from heights
- */
- public static void heights2Lengths(Node node, boolean respectMinimum) {
-
- for (int i = 0; i < node.getChildCount(); i++) {
- heights2Lengths(node.getChild(i));
- }
-
- if (node.isRoot()) {
- node.setBranchLength(0.0);
- }
- else {
- node.setBranchLength(node.getParent().getNodeHeight() - node.getNodeHeight());
- if (respectMinimum && (node.getBranchLength() < BranchLimits.MINARC))
- {
- node.setBranchLength(BranchLimits.MINARC);
- }
- }
- }
-
- /**
- * determines branch lengths of this node and its immediate descendent nodes
- * from heights.
- */
- public static void localHeights2Lengths(Node node, boolean respectMinimum) {
-
- for (int i = 0; i < node.getChildCount(); i++) {
- Node child = node.getChild(i);
-
- child.setBranchLength(node.getNodeHeight() - child.getNodeHeight());
- }
-
- if (node.isRoot()) {
- node.setBranchLength(0.0);
- }
- else {
- node.setBranchLength(node.getParent().getNodeHeight() - node.getNodeHeight());
- if (respectMinimum && (node.getBranchLength() < BranchLimits.MINARC))
- {
- node.setBranchLength(BranchLimits.MINARC);
- }
- }
- }
-
-
- /**
- * Get the distance to furthest leaf from this nodes parent.
- */
- private static double getGreatestDistance(Node node) {
-
- double distance = 0.0;
- if (!node.isLeaf()) {
- if (!node.isRoot()) {
- distance = node.getBranchLength();
- }
- double max = getGreatestDistance(node.getChild(0));
- double posmax = 0.0;
- for (int i = 1; i < node.getChildCount(); i++) {
- posmax = getGreatestDistance(node.getChild(i));
- if (posmax > max) max = posmax;
- }
- distance += max;
-
- return distance;
- } else {
- return node.getBranchLength();
- }
- }
-
- /**
- * Finds the largest child (in terms of node height).
- */
- public static double findLargestChild(Node node) {
- // find child with largest height
- double max = node.getChild(0).getNodeHeight();
- for (int j = 1; j < node.getChildCount(); j++)
- {
- if (node.getChild(j).getNodeHeight() > max)
- {
- max = node.getChild(j).getNodeHeight();
- }
- }
- return max;
- }
-
- /**
- * remove child
- *
- * @param node child node to be removed
- */
- public static void removeChild(Node parent, Node child)
- {
- int rm = -1;
- for (int i = 0; i < parent.getChildCount(); i++)
- {
- if (child == parent.getChild(i))
- {
- rm = i;
- break;
- }
- }
-
- parent.removeChild(rm);
- }
-
- /**
- * remove internal branch (collapse node with its parent)
- *
- * @param node node associated with internal branch
- */
- public static void removeBranch(Node node)
- {
- if (node.isRoot() || node.isLeaf())
- {
- throw new IllegalArgumentException("INTERNAL NODE REQUIRED (NOT ROOT)");
- }
-
- Node parent = node.getParent();
-
- // add childs of node to parent
- // (node still contains the link to childs
- // to allow later restoration)
- int numChilds = node.getChildCount();
- for (int i = 0; i < numChilds; i++)
- {
- parent.addChild(node.getChild(i));
- }
-
- // remove node from parent
- // (link to parent is restored and the
- // position is stored)
- int rm = -1;
- for (int i = 0; i < parent.getChildCount(); i++)
- {
- if (node == parent.getChild(i))
- {
- rm = i;
- break;
- }
- }
- parent.removeChild(rm);
- node.setParent(parent);
- node.setNumber(rm);
- }
-
- /**
- * restore internal branch
- *
- * @param node node associated with internal branch
- */
- public static void restoreBranch(Node node)
- {
- if (node.isRoot() || node.isLeaf())
- {
- throw new IllegalArgumentException("INTERNAL NODE REQUIRED (NOT ROOT)");
- }
-
- Node parent = node.getParent();
-
- // remove childs of node from parent and make node their parent
- int numChilds = node.getChildCount();
- for (int i = 0; i < numChilds; i++)
- {
- Node c = node.getChild(i);
- removeChild(parent, c);
- c.setParent(node);
- }
-
- // insert node into parent
- parent.insertChild(node, node.getNumber());
- }
-
-
-
- /**
- * join two childs, introducing a new node/branch in the tree
- * that replaces the first child
- *
- * @param n1 number of first child
- * @param n2 number of second child
- */
- public static void joinChilds(Node node, int n1, int n2) {
-
- if (n1 == n2) {
- throw new IllegalArgumentException("CHILDREN MUST BE DIFFERENT");
- }
-
- int c1, c2;
- if (n2 < n1)
- {
- c1 = n2;
- c2 = n1;
- }
- else
- {
- c1 = n1;
- c2 = n2;
- }
-
- Node newNode = NodeFactory.createNode();
-
- Node child1 = node.getChild(c1);
- Node child2 = node.getChild(c2);
-
- node.setChild(c1, newNode);
- newNode.setParent(node);
- node.removeChild(c2); // now parent of child2 = null
-
- newNode.addChild(child1);
- newNode.addChild(child2);
- }
-
- /**
- * determine preorder successor of this node
- *
- * @return next node
- */
- public static Node preorderSuccessor(Node node) {
-
- Node next = null;
-
- if (node.isLeaf()) {
- Node cn = node, ln = null; // Current and last node
-
- // Go up
- do
- {
- if (cn.isRoot())
- {
- next = cn;
- break;
- }
- ln = cn;
- cn = cn.getParent();
- }
- while (cn.getChild(cn.getChildCount()-1) == ln);
-
- // Determine next node
- if (next == null)
- {
- // Go down one node
- for (int i = 0; i < cn.getChildCount()-1; i++)
- {
- if (cn.getChild(i) == ln)
- {
- next = cn.getChild(i+1);
- break;
- }
- }
- }
- }
- else
- {
- next = node.getChild(0);
- }
-
- return next;
- }
-
- /**
- * determine postorder successor of a node
- *
- * @return next node
- */
- public static Node postorderSuccessor(Node node) {
-
- Node cn = null;
- Node parent = node.getParent();
-
- if (node.isRoot())
- {
- cn = node;
- }
- else
- {
-
- // Go up one node
- if (parent.getChild(parent.getChildCount()-1) == node) {
- return parent;
- }
- // Go down one node
- for (int i = 0; i < parent.getChildCount()-1; i++)
- {
- if (parent.getChild(i) == node)
- {
- cn = parent.getChild(i+1);
- break;
- }
- }
- }
-
- // Go down until leaf
- while (cn.getChildCount() > 0)
- {
-
- cn = cn.getChild(0);
- }
-
- return cn;
- }
-
- /**
- * prints node in New Hamshire format.
- */
- static void printNH(PrintWriter out, Node node,
- boolean printLengths, boolean printInternalLabels) {
-
- printNH(out, node, printLengths, printInternalLabels, 0);
- }
-
-
- private static int printNH(PrintWriter out, Node node,
- boolean printLengths, boolean printInternalLabels, int column) {
-
- column = breakLine(out, column);
-
- if (!node.isLeaf())
- {
- out.print("(");
- column++;
-
- for (int i = 0; i < node.getChildCount(); i++)
- {
- if (i != 0)
- {
- out.print(",");
- column++;
- }
-
- column = printNH(out, node.getChild(i), printLengths, printInternalLabels, column);
- }
-
- out.print(")");
- column++;
- }
-
- if (!node.isRoot())
- {
- if (node.isLeaf() || printInternalLabels)
- {
- column = breakLine(out, column);
-
- String id = node.getIdentifier().toString();
- out.print(id);
- column += id.length();
- }
-
- if (printLengths)
- {
- out.print(":");
- column++;
-
- column = breakLine(out, column);
-
- column += FormattedOutput.getInstance().displayDecimal(out, node.getBranchLength(), 7);
- }
- }
-
- return column;
- }
-
- private static int breakLine(PrintWriter out, int column)
- {
- if (column > 70)
- {
- out.println();
- column = 0;
- }
-
- return column;
- }
-
- /**
- * Returns the first node in this tree that has the
- * required identifier.
- */
- public static Node findByIdentifier(Node node, Identifier identifier) {
-
- Log.getDefaultLogger().debug("node identifier = " + node.getIdentifier());
- Log.getDefaultLogger().debug("target identifier = " + identifier);
-
- if (node.getIdentifier().getName().equals(identifier.getName())) {
- return node;
- } else {
- Node pos = null;
- for (int i = 0; i < node.getChildCount(); i++) {
- pos = findByIdentifier(node.getChild(i), identifier);
- if (pos != null) return pos;
- }
- //if (pos == null && !node.isRoot()) {
- // pos = findByIdentifier(node.getParent(), identifier);
- //}
- if (pos != null) return pos;
- return null;
- }
- }
-
- /**
- * Root tree at this node.
- */
- public static Node root(Node node) {
-
- if (!node.isRoot()) {
-
- Node myParent = node.getParent();
- removeChild(myParent, node);
-
- root(myParent);
-
- while (myParent.getChildCount() == 1) {
- myParent = myParent.getChild(0);
- }
-
- node.addChild(myParent);
- lengths2Heights(node);
- }
- return node;
- }
-
- /**
- * Root the tree above the node with this identifier.
- */
- public static Node rootAbove(Identifier id, Node root) {
- return rootAbove(findByIdentifier(root, id));
- }
-
- /**
- * Root tree above this node;
- */
- public static Node rootAbove(Node node) {
-
- if (!node.isRoot()) {
-
- Node root = NodeFactory.createNode();
-
- Node myParent = node.getParent();
- removeChild(myParent, node);
-
- Log.getDefaultLogger().debug("Before root() call");
- root(myParent);
- Log.getDefaultLogger().debug("After root() call");
-
- while (myParent.getChildCount() == 1) {
- myParent = myParent.getChild(0);
- }
-
- root.addChild(myParent);
- root.addChild(node);
-
- lengths2Heights(root);
-
- return root;
-
- } else return node;
- }
-
- /**
- * determine distance to root
- *
- * @return distance to root
- */
- public static double getDistanceToRoot(Node node)
- {
- if (node.isRoot())
- {
- return 0.0;
- }
- else
- {
- return node.getBranchLength() + getDistanceToRoot(node.getParent());
- }
- }
-
- /**
- * Return the number of terminal leaves below this node or 1 if this is
- * a terminal leaf.
- */
- public static int getLeafCount(Node node) {
-
- int count = 0;
- if (!node.isLeaf()) {
- for (int i = 0; i < node.getChildCount(); i++) {
- count += getLeafCount(node.getChild(i));
- }
- } else {
- count = 1;
- }
- return count;
- }
-
- /** returns number of branches centered around an internal node in an unrooted tree */
- public static final int getUnrootedBranchCount(Node center) {
- if (center.isRoot()) {
- return center.getChildCount();
- }
- else {
- return center.getChildCount()+1;
- }
- }
-}
-
diff --git a/LibrarySource/pal/tree/ParameterizedTree.java b/LibrarySource/pal/tree/ParameterizedTree.java
deleted file mode 100644
index b3db0c2..0000000
--- a/LibrarySource/pal/tree/ParameterizedTree.java
+++ /dev/null
@@ -1,112 +0,0 @@
-// ParameterizedTree.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.tree;
-
-import pal.misc.*;
-import java.io.*;
-
-
-/**
- * abstract base class for a tree with an Parameterized interface
- *
- * @version $Id: ParameterizedTree.java,v 1.6 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- * @author Korbinian Strimmer
- */
-public abstract class ParameterizedTree implements Parameterized, Tree
-{
- //
- // Public stuff
- //
-
- public void setBaseTree(Tree tree)
- {
- this.tree = tree;
-
- // make consistent
- createNodeList();
- }
-
- public Tree getBaseTree() {
- return tree;
- }
-
- // interface tree
-
- /**
- * Returns the root node of this tree.
- */
- public final Node getRoot() {
- return tree.getRoot();
- }
-
- /**
- * returns a count of the number of external nodes (tips) in this
- * tree.
- */
- public final int getExternalNodeCount() {
- return tree.getExternalNodeCount();
- }
-
- /**
- * returns a count of the number of internal nodes (and hence clades)
- * in this tree.
- */
- public final int getInternalNodeCount() {
- return tree.getInternalNodeCount();
- }
-
- /**
- * returns the ith external node in the tree.
- */
- public final Node getExternalNode(int i) {
- return tree.getExternalNode(i);
- }
-
- /**
- * returns the ith internal node in the tree.
- */
- public final Node getInternalNode(int i) {
- return tree.getInternalNode(i);
- }
-
- /**
- * This method is called to ensure that the calls to other methods
- * in this interface are valid.
- */
- public final void createNodeList() {
- tree.createNodeList();
- }
-
- public final int getUnits() {
- return tree.getUnits();
- }
-
- public final void setUnits(int units) {
- tree.setUnits(units);
- }
-
- public String toString() {
- StringWriter sw = new StringWriter();
- TreeUtils.printNH(this, new PrintWriter(sw), true, false);
-
- return sw.toString();
- }
-
- // interface parameterized (remains abstract)
-
- /**
- * The non-parameterized tree that this parameterized tree is
- * based on.
- */
- private Tree tree;
-
-}
-
diff --git a/LibrarySource/pal/tree/ReadTree.java b/LibrarySource/pal/tree/ReadTree.java
deleted file mode 100644
index 032561d..0000000
--- a/LibrarySource/pal/tree/ReadTree.java
+++ /dev/null
@@ -1,157 +0,0 @@
-// ReadTree.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.tree;
-
-import pal.io.*;
-import pal.misc.*;
-
-import java.io.*;
-
-
-/**
- * constructs a tree reading in a New Hampshire treefile, taking care
- * for internal labels and branch lengths and binary/nonbinary and
- * rooted/unrooted trees
- *
- * @version $Id: ReadTree.java,v 1.8 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class ReadTree extends SimpleTree
-{
- //
- // Public stuff
- //
-
- /**
- * read tree from input stream
- *
- * @param input input stream
- */
- public ReadTree(PushbackReader input) throws TreeParseException
- {
- super();
-
- readNH(input);
-
- // node heights should be populated as well - AD
- NodeUtils.lengths2Heights(getRoot());
- }
-
- /**
- * read tree from file
- *
- * @param file name of file
- */
- public ReadTree(String file) throws TreeParseException, IOException
- {
- super();
-
- PushbackReader input = InputSource.openFile(file);
- readNH(input);
- input.close();
-
- // node heights should be populated as well - AD
- NodeUtils.lengths2Heights(getRoot());
- }
-
-
- //
- // Private stuff
- //
-
- private FormattedInput fi = FormattedInput.getInstance();
-
- // Construct tree by reading a New Hampshire tree
- private void readNH(PushbackReader input, Node currentNode)
- throws TreeParseException
- {
- try
- {
- int c = fi.readNextChar(input);
- if (c == '(')
- {
- int count = 0;
- do
- {
- Node newNode = NodeFactory.createNode();
- currentNode.addChild(newNode);
- readNH(input, newNode);
- count++;
-
- c = fi.readNextChar(input);
- }
- while (c == ',');
-
- if (c != ')')
- {
- throw new TreeParseException("Missing closing bracket");
- }
-
- if (count < 2)
- {
- throw new TreeParseException("Node with single parent enountered");
- }
-
- }
- else
- {
- input.unread(c);
- }
-
- // Read label (any length)
- currentNode.setIdentifier(new Identifier(fi.readLabel(input, -1)));
-
- // Read distance
- c = fi.readNextChar(input);
-
- if (c == ':')
- {
- currentNode.setBranchLength(fi.readDouble(input,true));
- }
- else
- {
- input.unread(c);
- }
- }
-
- catch (IOException e)
- {
- throw new TreeParseException("IO error");
- }
-
- catch (NumberFormatException e)
- {
- throw new TreeParseException("Error while parsing number");
- }
- }
-
- // Construct tree by reading a New Hampshire tree
- private void readNH(PushbackReader input) throws TreeParseException
- {
- try
- {
- readNH(input, getRoot());
-
- // Drop terminating semicolon
- int c = fi.readNextChar(input);
- if (c != ';')
- {
- throw new TreeParseException("Missing terminating semicolon");
- }
- }
-
- catch (IOException e)
- {
- throw new TreeParseException();
- }
- }
-}
-
diff --git a/LibrarySource/pal/tree/SUPGMATree.java b/LibrarySource/pal/tree/SUPGMATree.java
deleted file mode 100644
index 5e65333..0000000
--- a/LibrarySource/pal/tree/SUPGMATree.java
+++ /dev/null
@@ -1,102 +0,0 @@
-// SUPGMATree.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-// Known bugs and limitations:
-// - computational complexity O(numSeqs^3)
-// (this could be brought down to O(numSeqs^2)
-// but this needs more clever programming ...)
-
-
-package pal.tree;
-
-import pal.distance.*;
-import pal.misc.*;
-
-/**
- * constructs an SUPGMA tree from pairwise distances. <BR>
- * Reference: <BR>
- * Alexei Drummond and Allen G. Rodrigo (2000). Reconstructing Genealogies of Serial Samples Under the Assumption of a Molecular Clock Using Serial-Sample UPGMA. Molecular Biology and Evolution 17:1807-1815
- *
- * @version $Id: SUPGMATree.java,v 1.6 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class SUPGMATree extends UPGMATree
-{
- //
- // Public stuff
- //
-
- /**
- * constructor SUPGMA tree
- *
- * @param m *uncorrected* distance matrix
- */
- public SUPGMATree(DistanceMatrix m, TimeOrderCharacterData tocd, double rate) {
-
- this(m, tocd, rate, true);
- }
-
-
- /**
- * constructor SUPGMA tree
- *
- * @param m *uncorrected* distance matrix
- */
- public SUPGMATree(DistanceMatrix m, TimeOrderCharacterData tocd, double rate, boolean allowNegatives) {
-
- super(new SUPGMADistanceMatrix(m, tocd, rate));
-
- this.tocd = tocd;
-
- IdGroup idgroup = tocd.getIdGroup();
-
- createNodeList();
-
-
- /*//go through and check for maximum allowed rate
- if (!allowNegatives) {
- for (int i = 0; i < getExternalNodeCount(); i++) {
- int index = idgroup.whichIdNumber(getExternalNode(i).getIdentifier().getName());
- double time = tocd.getTime(index);
-
- double maxRateThisTip = getExternalNode(i).getParent().getNodeHeight() / time;
-
- if (maxRateThisTip < rate) {
- rate = maxRateThisTip;
- }
- }
- }*/
-
- // go through and set heights.
- for (int i = 0; i < getExternalNodeCount(); i++) {
- int index = idgroup.whichIdNumber(getExternalNode(i).getIdentifier().getName());
- getExternalNode(i).setNodeHeight(tocd.getHeight(index, rate));
- if (!allowNegatives) {
- if (getExternalNode(i).getParent().getNodeHeight() < getExternalNode(i).getNodeHeight()) {
- fixHeight(getExternalNode(i).getParent(), getExternalNode(i).getNodeHeight());
- }
- }
- }
- }
-
- public DatedTipsClockTree getDatedTipsClockTree() {
- return new DatedTipsClockTree(this, tocd, false);
- }
-
- private void fixHeight(Node node, double height) {
- node.setNodeHeight(height);
- if (!node.isRoot()) {
- if (node.getParent().getNodeHeight() < height) {
- fixHeight(node.getParent(), height);
- }
- }
- }
-
- private TimeOrderCharacterData tocd;
-}
-
diff --git a/LibrarySource/pal/tree/SimpleNode.java b/LibrarySource/pal/tree/SimpleNode.java
deleted file mode 100644
index fb77c64..0000000
--- a/LibrarySource/pal/tree/SimpleNode.java
+++ /dev/null
@@ -1,448 +0,0 @@
-// SimpleNode.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.tree;
-
-import pal.misc.*;
-import java.io.*;
-import pal.io.*;
-
-
-/**
- * data structure for a node (includes branch) in a binary/non-binary
- * rooted/unrooted tree
- *
- * @version $Id: SimpleNode.java,v 1.9 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class SimpleNode implements Node
-{
- /** parent node */
- private Node parent;
-
- /** number of child nodes */
- private int numChilds;
-
- /** number of node as displayed */
- private int number;
-
- /** sequences associated with node */
- private byte[] sequence;
-
- /** partial likelihood associated with node */
- private double[][][] partial;
-
- /** length of branch to parent node */
- private double length;
-
- /** standard error of length of branch to parent node */
- private double lengthSE;
-
- /** height of this node */
- private double height;
-
- /** height SE of this node */
- private double heightSE;
-
-
- /** identifier of node/associated branch */
- private Identifier identifier;
-
-
-
- // the following constructors should eventually become
- // "friendly" to prevent anyone calling them directly.
- // Instead, the NodeFactory should be used!
-
- /** constructor default node */
- public SimpleNode()
- {
- parent = null;
- child = null;
- numChilds = 0;
- length = 0.0;
- lengthSE = 0.0;
- height = 0.0;
- identifier = Identifier.ANONYMOUS;
-
- number = 0;
- sequence = null;
- partial = null;
- }
-
- /** constructor used to clone a node and all children */
- public SimpleNode(Node n)
- {
- this(n, true);
- }
-
-
-
- public void reset()
- {
- parent = null;
- child = null;
- numChilds = 0;
- length = 0.0;
- lengthSE = 0.0;
- height = 0.0;
- identifier = Identifier.ANONYMOUS;
-
- number = 0;
- sequence = null;
- partial = null;
- }
-
- public SimpleNode(Node n, boolean keepIds) {
- init(n, keepIds);
- for (int i = 0; i < n.getChildCount(); i++) {
- addChild(new SimpleNode(n.getChild(i)));
- }
- }
-
-
- protected void init(Node n) {
- init(n, true);
- }
-
- /**
- * Initialized node instance variables based on given Node.
- * children are ignored.
- */
- protected void init(Node n, boolean keepId) {
- parent = null;
- length = n.getBranchLength();
- lengthSE = n.getBranchLengthSE();
- height = n.getNodeHeight();
- if (keepId) {
- identifier = n.getIdentifier();
- } else { identifier = Identifier.ANONYMOUS; }
-
- number = n.getNumber();
- sequence = n.getSequence();
-
- child = null;
- numChilds = 0;
- }
-
- /**
- * Returns the parent node of this node.
- */
- public final Node getParent() {
- return parent;
- }
-
- /** Set the parent node of this node. */
- public void setParent(Node node)
- {
- parent = node;
- }
-
- /**
- * removes parent.
- */
- public final void removeParent() {
- parent = null;
- }
-
- /**
- * Returns the sequence at this node, in the form of a String.
- */
- public String getSequenceString() {
- return new String(sequence);
- }
-
- /**
- * Returns the sequence at this node, in the form of an array of bytes.
- */
- public byte[] getSequence() {
- return sequence;
- }
-
- /**
- * Sets the sequence at this node, in the form of an array of bytes.
- */
- public void setSequence(byte[] s) {
- sequence = s;
- }
-
- /**
- * Get the length of the branch attaching this node to its parent.
- */
- public final double getBranchLength() {
- return length;
- }
-
- /**
- * Set the length of the branch attaching this node to its parent.
- */
- public final void setBranchLength(double value) {
- length = value;
- }
-
- /**
- * Get the length SE of the branch attaching this node to its parent.
- */
- public final double getBranchLengthSE() {
- return lengthSE;
- }
-
- /**
- * Set the length SE of the branch attaching this node to its parent.
- */
- public final void setBranchLengthSE(double value) {
- lengthSE = value;
- }
-
-
- /**
- * Get the height of this node relative to the most recent node.
- */
- public final double getNodeHeight() {
- return height;
- }
-
- /**
- * Set the height of this node relative to the most recent node.
- */
- public final void setNodeHeight(double value) {
- height = Math.abs(value);
- }
-
- /**
- * Set the height SE of this node relative to the most recent node.
- */
- public final void setNodeHeightSE(double value) {
- heightSE = value;
- }
-
- /**
- * Set the height SE of this node relative to the most recent node.
- */
- public final double getNodeHeightSE() {
- return heightSE;
- }
-
- /**
- * Returns the identifier for this node.
- */
- public final Identifier getIdentifier() {
- return identifier;
- }
-
- /**
- * Set identifier for this node.
- */
- public final Identifier setIdentifier(Identifier id) {
- identifier = id;
- return identifier;
- }
-
- public void setNumber(int n) {
- number = n;
- }
-
- public int getNumber() {
- return number;
- }
-
-
-
- /**
- * get child node
- *
- * @param n number of child
- *
- * @return child node
- */
- public Node getChild(int n)
- {
- return child[n];
- }
-
- /**
- * set child node
- *
- * @param n number
- * @node node new child node
- */
- public void setChild(int n, Node node)
- {
- child[n] = node;
- child[n].setParent(this);
- }
-
- /**
- * check whether this node is an internal node
- *
- * @return result (true or false)
- */
- public boolean hasChildren()
- {
- return !isLeaf();
- }
-
- /**
- * check whether this node is an external node
- *
- * @return result (true or false)
- */
- public boolean isLeaf()
- {
- if (numChilds == 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
- /**
- * check whether this node is a root node
- *
- * @return result (true or false)
- */
- public boolean isRoot()
- {
- if (parent == null)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
-
- /**
- * add new child node
- *
- * @param n new child node
- */
- public void addChild(Node n)
- {
- insertChild(n, numChilds);
- }
-
- /**
- * add new child node (insertion at a specific position)
- *
- * @param n new child node
- + @param pos position
- */
- public void insertChild(Node n, int pos)
- {
- SimpleNode c = (SimpleNode) n;
-
- Node[] newChild = new Node[numChilds + 1];
-
- for (int i = 0; i < pos; i++)
- {
- newChild[i] = child[i];
- }
- newChild[pos] = c;
- for (int i = pos; i < numChilds; i++)
- {
- newChild[i+1] = child[i];
- }
-
- child = newChild;
-
- numChilds++;
-
- c.setParent(this);
- }
-
-
- /**
- * remove child
- *
- * @param n number of child to be removed
- */
- public void removeChild(int n)
- {
- if (n >= numChilds)
- {
- throw new IllegalArgumentException("Nonexistent child");
- }
- Node[] newChild = new Node[numChilds-1];
-
- for (int i = 0; i < n; i++)
- {
- newChild[i] = child[i];
- }
-
- for (int i = n; i < numChilds-1; i++)
- {
- newChild[i] = child[i+1];
- }
-
- //remove parent link from removed child!
- ((Node)child[n]).setParent(null);
-
- child = newChild;
- numChilds--;
- }
-
- /**
- * determines the height of this node and its descendants
- * from branch lengths, assuming contemporaneous tips.
- */
- public void lengths2HeightsContemp()
- {
- double largestHeight = 0.0;
-
- if (!isLeaf())
- {
- for (int i = 0; i < numChilds; i++)
- {
- NodeUtils.lengths2Heights(getChild(i));
-
- double newHeight =
- getChild(i).getNodeHeight() + getChild(i).getBranchLength();
-
- if (newHeight > largestHeight)
- {
- largestHeight = newHeight;
- }
- }
- }
-
- setNodeHeight(largestHeight);
- }
-
- /**
- * Returns the number of children this node has.
- */
- public int getChildCount() {
- return numChilds;
- }
-
-
-
-
- public String toString() {
-
- StringWriter sw = new StringWriter();
- NodeUtils.printNH(new PrintWriter(sw), this, true, false);
- return sw.toString();
- }
-
-
- //
- // Private stuff
- //
-
- private Node[] child;
-}
-
diff --git a/LibrarySource/pal/tree/SimpleTree.java b/LibrarySource/pal/tree/SimpleTree.java
deleted file mode 100644
index 44da6b9..0000000
--- a/LibrarySource/pal/tree/SimpleTree.java
+++ /dev/null
@@ -1,274 +0,0 @@
-// SimpleTree.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.tree;
-
-import pal.misc.*;
-import pal.io.*;
-import pal.alignment.*;
-
-import java.io.*;
-import java.util.*;
-
-
-/**
- * data structure for a binary/non-binary rooted/unrooted trees
- *
- * @version $Id: SimpleTree.java,v 1.11 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- * @author Korbinian Strimmer
- *
- */
-public class SimpleTree implements Tree, Report, Units, Serializable
-{
- //
- // Public stuff
- //
-
- /** root node */
- private Node root;
-
- /** list of internal nodes (including root) */
- private Node[] internalNode;
-
- /** number of internal nodes (including root) */
- private int numInternalNodes;
-
- /** list of external nodes */
- private Node[] externalNode;
-
- /** number of external nodes */
- private int numExternalNodes;
-
-
- /** holds the units of the trees branches. */
- private int units = EXPECTED_SUBSTITUTIONS;
-
- /** constructor tree consisting solely of root node */
- public SimpleTree() {
-
- // Default configuration
- root = new SimpleNode();
- root.setIdentifier(new Identifier("ROOT"));
- root.setBranchLength(0.0);
- root.setBranchLengthSE(0.0);
- }
-
- /** constructor taking a root node */
- public SimpleTree(Node r) {
-
- root = r;
- createNodeList();
- }
-
- /** clone constructor */
- public SimpleTree(Tree tree)
- {
- root = new SimpleNode(tree.getRoot());
- setUnits(tree.getUnits());
- createNodeList();
- }
-
- /** clone constructor */
- public SimpleTree(Tree tree, boolean keepIdentifiers)
- {
- root = new SimpleNode(tree.getRoot(), keepIdentifiers);
- setUnits(tree.getUnits());
- createNodeList();
- }
-
- /**
- * Return the units that this tree is expressed in.
- */
- public final int getUnits() {
- return units;
- }
-
- /**
- * Sets the units that this tree is expressed in.
- */
- public final void setUnits(int units) {
- this.units = units;
- }
-
-
- /**
- * Returns the number of external nodes.
- */
- public final int getExternalNodeCount() {
- return numExternalNodes;
- }
-
- /**
- * Returns the ith external node.
- */
- public final Node getExternalNode(int i) {
- return externalNode[i];
- }
-
- /**
- * Returns the number of internal nodes.
- */
- public final int getInternalNodeCount() {
- return numInternalNodes;
- }
-
- /**
- * Returns the ith internal node.
- */
- public final Node getInternalNode(int i) {
- return internalNode[i];
- }
-
- /**
- * Returns the root node of this tree.
- */
- public final Node getRoot() {
- return root;
- }
-
- /**
- * Set a new node as root node.
- */
- public final void setRoot(Node r) {
- root = r;
- createNodeList();
- }
-
- /** count and list external and internal nodes and
- compute heights of each node */
- public void createNodeList()
- {
- numInternalNodes = 0;
- numExternalNodes = 0;
- Node node = root;
- do
- {
- node = NodeUtils.postorderSuccessor(node);
- if (node.isLeaf())
- {
- node.setNumber(numExternalNodes);
- numExternalNodes++;
- }
- else
- {
- node.setNumber(numInternalNodes);
- numInternalNodes++;
- }
- }
- while(node != root);
-
- internalNode = new Node[numInternalNodes];
- externalNode = new Node[numExternalNodes];
- node = root;
- do
- {
- node = NodeUtils.postorderSuccessor(node);
- if (node.isLeaf())
- {
- externalNode[node.getNumber()] = node;
- }
- else
- {
- internalNode[node.getNumber()] = node;
- }
- }
- while(node != root);
-
- // compute heights if it seems necessary
- if (root.getNodeHeight() == 0.0) {
- NodeUtils.lengths2Heights(root);
- }
- }
-
- public String toString() {
- StringWriter sw = new StringWriter();
- TreeUtils.printNH(this, new PrintWriter(sw), true, false);
-
- return sw.toString();
- }
-
-
- /**
- * return node with number num (as displayed in ASCII tree)
- *
- * @param num number of node
- *
- * @return node
- */
- public Node findNode(int num)
- {
- createNodeList();
-
- if (num <= numExternalNodes)
- {
- return externalNode[num-1];
- }
- else
- {
- return internalNode[num-1-numExternalNodes];
- }
- }
-
- /**
- * make node with number num to root node
- *
- * @param num number of node
- */
- public void reroot(int num)
- {
- reroot(findNode(num));
- }
-
- /**
- * make given node to root node
- *
- * @param node new root node
- */
- public void reroot(Node node)
- {
- if (node.isRoot() || node.isLeaf())
- {
- return;
- }
-
- if (!node.getParent().isRoot())
- {
- reroot(node.getParent());
- }
-
- // Now the parent of node is root
-
- if (node.getParent().getChildCount() < 3)
- {
- // Rerooting not possible
- return;
- }
-
- // Exchange branch label, length et cetera
- NodeUtils.exchangeInfo(node.getParent(), node);
-
- // Rearange topology
- Node parent = node.getParent();
- NodeUtils.removeChild(parent, node);
- node.addChild(parent);
- root = node;
- }
-
- // interface Report
-
- public void report(PrintWriter out)
- {
- TreeUtils.report(this, out);
- }
-
-
-
-}
-
diff --git a/LibrarySource/pal/tree/SimulatedAlignment.java b/LibrarySource/pal/tree/SimulatedAlignment.java
deleted file mode 100644
index f92fe74..0000000
--- a/LibrarySource/pal/tree/SimulatedAlignment.java
+++ /dev/null
@@ -1,211 +0,0 @@
-// SimulatedAlignment.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.tree;
-
-import pal.datatype.*;
-import pal.substmodel.*;
-import pal.alignment.*;
-import pal.math.*;
-import pal.misc.*;
-
-
-/**
- * generates an artificial data set
- *
- * @version $Id: SimulatedAlignment.java,v 1.9 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class SimulatedAlignment extends AbstractAlignment
-{
- //
- // Public stuff
- //
-
- /**
- * Inititalisation
- *
- * @param sites number of sites
- * @param t tree relating the sequences
- * @param m model of evolution
- */
- public SimulatedAlignment(int sites, Tree t, SubstitutionModel m)
- {
- dataType = m.rateMatrix.getDataType();
- numStates = dataType.getNumStates();
- model = m;
-
- rng = new MersenneTwisterFast();
-
- tree = t;
- tree.createNodeList();
-
- numSeqs = tree.getExternalNodeCount();
- numSites = sites;
- idGroup = new SimpleIdGroup(numSeqs);
-
- for (int i = 0; i < numSeqs; i++)
- {
- idGroup.setIdentifier(i, tree.getExternalNode(i).getIdentifier());
- }
-
- stateData = new byte[numSeqs][numSites];
-
- for (int i = 0; i < tree.getExternalNodeCount(); i++)
- {
- tree.getExternalNode(i).setSequence(stateData[i]);
- }
- for (int i = 0; i < tree.getInternalNodeCount()-1; i++)
- {
- tree.getInternalNode(i).setSequence(new byte[numSites]);
- }
-
- rootSequence = new byte[numSites];
-
- rateAtSite = new int[numSites];
- cumFreqs = new double[numStates];
- cumRateProbs = new double[m.rateDistribution.numRates];
- }
-
-
- // Implementation of abstract Alignment method
-
- /** sequence alignment at (sequence, site) */
- public char getData(int seq, int site)
- {
- return dataType.getChar(stateData[seq][site]);
- }
-
-
- /** generate new artificial data set (random root sequence) */
- public void simulate()
- {
- makeRandomRootSequence();
- simulate(rootSequence);
- }
-
- /** generate new artificial data set (specified root sequence) */
- public void simulate(byte[] rootSeq)
- {
- // Check root sequence
- for (int i = 0; i < numSites; i++)
- {
- if (rootSeq[i] >= numStates || rootSeq[i] < 0)
- {
- throw new IllegalArgumentException("Root sequence contains illegal state (?,-, etc.)");
- }
- }
-
- tree.getInternalNode(tree.getInternalNodeCount()-1).setSequence(rootSeq);
-
- // Assign new rate categories
- assignRates();
-
- // Visit all nodes except root
- Node node = NodeUtils.preorderSuccessor(tree.getRoot());
- do
- {
- determineMutatedSequence(node);
- node = NodeUtils.preorderSuccessor(node);
- }
- while (node != tree.getRoot());
- }
-
-
- //
- // Private stuff
- //
-
- private Tree tree;
- private SubstitutionModel model;
- private byte[] rootSequence;
- private double[] cumFreqs;
- private int[] rateAtSite;
- private double[] cumRateProbs;
- private int numStates;
- private byte[][] stateData;
- private MersenneTwisterFast rng;
-
- private void determineMutatedSequence(Node node)
- {
- if (node.isRoot()) throw new IllegalArgumentException("Root node not allowed");
-
- model.setDistance(node.getBranchLength());
-
- byte[] oldS = node.getParent().getSequence();
- byte[] newS = node.getSequence();
-
- for (int i = 0; i < numSites; i++)
- {
- cumFreqs[0] = model.transProb(rateAtSite[i], oldS[i], 0);
- for (int j = 1; j < numStates; j++)
- {
- cumFreqs[j] = cumFreqs[j-1] + model.transProb(rateAtSite[i], oldS[i], j);
- }
-
- newS[i] = (byte) randomChoice(cumFreqs);
- }
- }
-
- private void makeRandomRootSequence()
- {
- double[] frequencies = model.rateMatrix.getEqulibriumFrequencies();
- cumFreqs[0] = frequencies[0];
- for (int i = 1; i < numStates; i++) {
- cumFreqs[i] = cumFreqs[i-1] + frequencies[i];
- }
-
- for (int i = 0; i < numSites; i++)
- {
- rootSequence[i] = (byte) randomChoice(cumFreqs);
- }
- }
-
- private void assignRates()
- {
- cumRateProbs[0] = model.rateDistribution.probability[0];
- for (int i = 1; i < model.rateDistribution.numRates; i++)
- {
- cumRateProbs[i] = cumRateProbs[i-1] + model.rateDistribution.probability[i];
- }
-
- for (int i = 0; i < numSites; i++)
- {
- rateAtSite[i] = randomChoice(cumRateProbs);
- }
-
-
- }
-
- // Chooses one category if a cumulative probability distribution is given
- private int randomChoice(double[] cf)
- {
- double rnd = rng.nextDouble();
-
- int s;
- if (rnd <= cf[0])
- {
- s = 0;
- }
- else
- {
- for (s = 1; s < cf.length; s++)
- {
- if (rnd <= cf[s] && rnd > cf[s-1])
- {
- break;
- }
- }
- }
-
- return s;
- }
-}
-
diff --git a/LibrarySource/pal/tree/SplitSystem.java b/LibrarySource/pal/tree/SplitSystem.java
deleted file mode 100644
index 2ccfdff..0000000
--- a/LibrarySource/pal/tree/SplitSystem.java
+++ /dev/null
@@ -1,127 +0,0 @@
-// SplitSystem.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.tree;
-
-import java.io.*;
-
-import pal.misc.*;
-
-/**
- * data structure for a set of splits
- *
- * @version $Id: SplitSystem.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class SplitSystem
-{
- //
- // Public stuff
- //
-
- /**
- * @param idGroup sequence labels
- * @param size number of splits
- */
- public SplitSystem(IdGroup idGroup, int size)
- {
- this.idGroup = idGroup;
-
- labelCount = idGroup.getIdCount();
- splitCount = size;
-
- splits = new boolean[splitCount][labelCount];
- }
-
- /** get number of splits */
- public int getSplitCount()
- {
- return splitCount;
- }
-
- /** get number of labels */
- public int getLabelCount()
- {
- return labelCount;
- }
-
- /** get split vector */
- public boolean[][] getSplitVector()
- {
- return splits;
- }
-
- /** get split */
- public boolean[] getSplit(int i)
- {
- return splits[i];
- }
-
-
- /** get idGroup */
- public IdGroup getIdGroup()
- {
- return idGroup;
- }
-
- /**
- + test whether a split is contained in this split system
- * (assuming the same leaf order)
- *
- * @param split split
- */
- public boolean hasSplit(boolean[] split)
- {
- for (int i = 0; i < splitCount; i++)
- {
- if (SplitUtils.isSame(split, splits[i])) return true;
- }
-
- return false;
- }
-
-
- /** print split system */
- public String toString()
- {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
-
- for (int i = 0; i < labelCount; i++)
- {
- pw.println(idGroup.getIdentifier(i));
- }
- pw.println();
-
-
- for (int i = 0; i < splitCount; i++)
- {
- for (int j = 0; j < labelCount; j++)
- {
- if (splits[i][j] == true)
- pw.print('*');
- else
- pw.print('.');
- }
-
- pw.println();
- }
-
- return sw.toString();
- }
-
-
- //
- // Private stuff
- //
-
- private int labelCount, splitCount;
- private IdGroup idGroup;
- private boolean[][] splits;
-}
-
diff --git a/LibrarySource/pal/tree/SplitUtils.java b/LibrarySource/pal/tree/SplitUtils.java
deleted file mode 100644
index e4e2dd7..0000000
--- a/LibrarySource/pal/tree/SplitUtils.java
+++ /dev/null
@@ -1,169 +0,0 @@
-// SplitUtils.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.tree;
-
-import pal.misc.*;
-
-/**
- * utilities for split systems
- *
- * @version $Id: SplitUtils.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class SplitUtils
-{
- //
- // Public stuff
- //
-
- /**
- * creates a split system from a tree
- * (using a pre-specified order of sequences)
- *
- * @param idGroup sequence order for the matrix
- * @param tree
- */
- public static SplitSystem getSplits(IdGroup idGroup, Tree tree)
- {
- tree.createNodeList();
-
- int size = tree.getInternalNodeCount()-1;
- SplitSystem splitSystem = new SplitSystem(idGroup, size);
-
- boolean[][] splits = splitSystem.getSplitVector();
-
- for (int i = 0; i < size; i++)
- {
- getSplit(idGroup, tree.getInternalNode(i), splits[i]);
- }
-
-
- return splitSystem;
- }
-
-
-
- /**
- * creates a split system from a tree
- * (using tree-induced order of sequences)
- *
- * @param tree
- */
- public static SplitSystem getSplits(Tree tree)
- {
- IdGroup idGroup = TreeUtils.getLeafIdGroup(tree);
-
- return getSplits(idGroup, tree);
- }
-
-
-
- /**
- * get split for branch associated with internal node
- *
- * @param idGroup order of labels
- * @param internalNode Node
- * @param boolean[] split
- */
- public static void getSplit(IdGroup idGroup, Node internalNode, boolean[] split)
- {
- if (internalNode.isLeaf() || internalNode.isRoot())
- {
- throw new IllegalArgumentException("Only internal nodes (and no root) nodes allowed");
- }
-
- // make sure split is reset
- for (int i = 0; i < split.length; i++)
- {
- split[i] = false;
- }
-
- // mark all leafs downstream of the node
-
- for (int i = 0; i < internalNode.getChildCount(); i++)
- {
- markNode(idGroup, internalNode, split);
- }
-
- // standardize split (i.e. first index is alway true)
- if (split[0] == false)
- {
- for (int i = 0; i < split.length; i++)
- {
- if (split[i] == false)
- split[i] = true;
- else
- split[i] = false;
- }
- }
- }
-
- /**
- * checks whether two splits are identical
- * (assuming they are of the same length
- * and use the same leaf order)
- *
- * @param s1 split 1
- * @param s2 split 2
- */
- public static boolean isSame(boolean[] s1, boolean[] s2)
- {
- boolean reverse;
- if (s1[0] == s2[0]) reverse = false;
- else reverse = true;
-
- if (s1.length != s2.length)
- throw new IllegalArgumentException("Splits must be of the same length!");
-
- for (int i = 0; i < s1.length; i++)
- {
- if (reverse)
- {
- // splits not identical
- if (s1[i] == s2[i]) return false;
- }
- else
- {
- // splits not identical
- if (s1[i] != s2[i]) return false;
- }
- }
-
- return true;
- }
-
- //
- // Private stuff
- //
-
- private static void markNode(IdGroup idGroup, Node node, boolean[] split)
- {
- if (node.isLeaf())
- {
- String name = node.getIdentifier().getName();
- int index = idGroup.whichIdNumber(name);
-
- if (index < 0)
- {
- throw new IllegalArgumentException("INCOMPATIBLE IDENTIFIER (" + name + ")");
- }
-
- split[index] = true;
- }
- else
- {
- for (int i = 0; i < node.getChildCount(); i++)
- {
- markNode(idGroup, node.getChild(i), split);
- }
- }
- }
-
-}
-
diff --git a/LibrarySource/pal/tree/Tree.java b/LibrarySource/pal/tree/Tree.java
deleted file mode 100644
index de9d368..0000000
--- a/LibrarySource/pal/tree/Tree.java
+++ /dev/null
@@ -1,72 +0,0 @@
-// Tree.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.tree;
-
-import pal.misc.*;
-import pal.io.*;
-
-import java.io.*;
-import java.util.*;
-
-
-/**
- * Interface for a phylogenetic or genealogical tree.
- *
- * @version $Id: Tree.java,v 1.15 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public interface Tree extends Units, Serializable {
-
- /**
- * Returns the root node of this tree.
- */
- Node getRoot();
-
- /**
- * returns a count of the number of external nodes (tips) in this
- * tree.
- */
- int getExternalNodeCount();
-
- /**
- * returns a count of the number of internal nodes (and hence clades)
- * in this tree.
- */
- int getInternalNodeCount();
-
- /**
- * returns the ith external node in the tree.
- */
- Node getExternalNode(int i);
-
- /**
- * returns the ith internal node in the tree.
- */
- Node getInternalNode(int i);
-
- /**
- * This method is called to ensure that the calls to other methods
- * in this interface are valid.
- */
- void createNodeList();
-
- /**
- * Gets the units that this tree's branch lengths and node
- * heights are expressed in.
- */
- int getUnits();
-
- /**
- * Sets the units that this tree's branch lengths and node
- * heights are expressed in.
- */
- void setUnits(int units);
-}
-
diff --git a/LibrarySource/pal/tree/TreeDistanceMatrix.java b/LibrarySource/pal/tree/TreeDistanceMatrix.java
deleted file mode 100644
index c2a5e3d..0000000
--- a/LibrarySource/pal/tree/TreeDistanceMatrix.java
+++ /dev/null
@@ -1,135 +0,0 @@
-// TreeDistanceMatrix.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.tree;
-
-import pal.distance.*;
-import pal.misc.*;
-
-
-/**
- * computes distance matrix induced by a tree
- * (needs only O(n^2) time, following algorithm DistanceInTree by
- * D.Bryant and P. Wadell. 1998. MBE 15:1346-1359)
- *
- *
- * @version $Id: TreeDistanceMatrix.java,v 1.8 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class TreeDistanceMatrix extends DistanceMatrix
-{
- //
- // Public stuff
- //
-
- /**
- * compute induced distance matrix
- *
- * @param idGroup sequence order for the matrix
- * @param t tree
- * @param countEdges boolean variable deciding whether the actual
- * branch lengths are used in computing the distance
- * or whether simply all edges larger or equal a certain
- * threshold length are counted (each with weight 1.0)
- * @param epsilon minimum branch length for a which an edge is counted
- */
- public TreeDistanceMatrix(IdGroup idGroup, Tree t, boolean countEdges, double epsilon)
- {
- numSeqs = idGroup.getIdCount();
- this.idGroup = idGroup;
- tree = t;
-
- distance = new double[numSeqs][numSeqs];
-
- alias = TreeUtils.mapExternalIdentifiers(idGroup, tree);
-
- dist = new double[tree.getExternalNodeCount()];
- idist = new double[tree.getInternalNodeCount()];
-
- computeDistances(countEdges, epsilon);
- }
-
- /**
- * compute induced distance matrix using actual branch lengths
- *
- * @param idGroup sequence order for the matrix
- * @param t tree
- */
- public TreeDistanceMatrix(IdGroup idGroup, Tree t)
- {
- this(idGroup, t, false, 0.0);
- }
-
- /**
- * compute induced distance matrix
- * (using tree-induced order of sequences)
- *
- * @param t tree
- * @param countEdges boolean variable deciding whether the actual
- * branch lengths are used in computing the distance
- * or whether simply all edges larger or equal a certain
- * threshold length are counted (each with weight 1.0)
- * @param epsilon minimum branch length for a which an edge is counted
- */
- public TreeDistanceMatrix(Tree t, boolean countEdges, double epsilon)
- {
- this(TreeUtils.getLeafIdGroup(t), t, countEdges, epsilon);
- }
-
- /**
- * compute induced distance matrix using actual branch lengths
- * (using tree-induced order of sequences)
- *
- * @param t tree
- */
- public TreeDistanceMatrix(Tree t)
- {
- this(t, false, 0.0);
- }
-
-
-
- /** recompute distances (actual branch lengths) */
- public void computeDistances()
- {
- computeDistances(false, 0.0);
- }
-
- /** recompute distances
- * @param countEdges boolean variable deciding whether the actual
- * branch lengths are used in computing the distance
- * or whether simply all edges larger or equal a certain
- * threshold length are counted (each with weight 1.0)
- * @param epsilon minimum branch length for a which an edge is counted
- */
- public void computeDistances(boolean countEdges, double epsilon)
- {
- // fast O(n^2) computation of induced distance matrix
- for (int i = 0; i < tree.getExternalNodeCount(); i++)
- {
- TreeUtils.computeAllDistances(tree, i, dist, idist, countEdges, epsilon);
- int ai = alias[i];
-
- for (int j = 0; j < tree.getExternalNodeCount(); j++)
- {
- distance[ai][alias[j]] = dist[j];
- }
- }
-
- }
-
- //
- // Private stuff
- //
-
- private int[] alias;
- private Tree tree;
- private double[] dist, idist;
-}
-
diff --git a/LibrarySource/pal/tree/TreeParseException.java b/LibrarySource/pal/tree/TreeParseException.java
deleted file mode 100644
index 4d0dd0f..0000000
--- a/LibrarySource/pal/tree/TreeParseException.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// TreeParseException.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.tree;
-
-
-/**
- * exception thrown by ReadTree
- *
- * @author Korbinian Strimmer
- */
-public class TreeParseException extends Exception
-{
- public TreeParseException() {}
-
- public TreeParseException(String msg)
- {
- super(msg);
- }
-}
-
diff --git a/LibrarySource/pal/tree/TreeUtils.java b/LibrarySource/pal/tree/TreeUtils.java
deleted file mode 100644
index 0df0d0f..0000000
--- a/LibrarySource/pal/tree/TreeUtils.java
+++ /dev/null
@@ -1,1042 +0,0 @@
-// TreeUtils.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.tree;
-
-import pal.misc.*;
-import pal.io.*;
-import pal.alignment.*;
-import pal.util.*;
-import pal.math.*;
-import pal.mep.*;
-import java.io.*;
-import java.util.*;
-
-
-/**
- * various utility functions on trees.
- *
- * @version $Id: TreeUtils.java,v 1.29 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- * @author Korbinian Strimmer
- */
-public class TreeUtils
-{
-
- /**
- * computes Robinson-Foulds (1981) distance between two trees
- *
- * @param t1 tree 1
- * @param t2 tree 2
- *
- * Definition: Assuming that t1 is the reference tree, let fn be the
- * false negatives, i.e. the number of edges in t1 missing in t2,
- * and fp the number of false positives, i.e. the number of edges
- * in t2 missing in t1. The RF distance is then (fn + fp)/2
- */
- public static double getRobinsonFouldsDistance(Tree t1, Tree t2)
- {
- SplitSystem s1 = SplitUtils.getSplits(t1);
-
- return getRobinsonFouldsDistance(s1, t2);
- }
-
-
- /**
- * computes Robinson-Foulds (1981) distance between two trees
- *
- * @param s1 tree 1 (as represented by a SplitSystem)
- * @param t2 tree 2
- */
- public static double getRobinsonFouldsDistance(SplitSystem s1, Tree t2)
- {
- IdGroup idGroup = s1.getIdGroup();
- SplitSystem s2 = SplitUtils.getSplits(idGroup, t2);
-
- if (s1.getLabelCount() != s2.getLabelCount())
- throw new IllegalArgumentException("Number of labels must be the same!");
-
- int ns1 = s1.getSplitCount();
- int ns2 = s1.getSplitCount();
-
- // number of splits in t1 missing in t2
- int fn = 0;
- for (int i = 0; i < ns1; i++)
- {
- if (!s2.hasSplit(s1.getSplit(i))) fn++;
- }
-
- // number of splits in t2 missing in t1
- int fp = 0;
- for (int i = 0; i < ns2; i++)
- {
- if (!s1.hasSplit(s2.getSplit(i))) fp++;
- }
-
-
- return 0.5*((double) fp + (double) fn);
- }
-
- /**
- * computes Robinson-Foulds (1981) distance between two trees
- * rescaled to a number between 0 and 1
- *
- * @param t1 tree 1
- * @param t2 tree 2
- */
- public static double getRobinsonFouldsRescaledDistance(Tree t1, Tree t2)
- {
- SplitSystem s1 = SplitUtils.getSplits(t1);
-
- return getRobinsonFouldsRescaledDistance(s1, t2);
- }
-
-
- /**
- * computes Robinson-Foulds (1981) distance between two trees
- * rescaled to a number between 0 and 1
- *
- * @param s1 tree 1 (as represented by a SplitSystem)
- * @param t2 tree 2
- */
- public static double getRobinsonFouldsRescaledDistance(SplitSystem s1, Tree t2)
- {
- return getRobinsonFouldsRescaledDistance(s1, t2)/(double) s1.getSplitCount();
- }
-
- private static MersenneTwisterFast random = new MersenneTwisterFast();
-
- /**
- * Returns a uniformly distributed random node from the tree, including
- * both internal and external nodes.
- */
- public static Node getRandomNode(Tree tree) {
- int index = random.nextInt(tree.getExternalNodeCount() + tree.getInternalNodeCount());
- if (index >= tree.getExternalNodeCount()) {
- return tree.getInternalNode(index - tree.getExternalNodeCount());
- } else {
- return tree.getExternalNode(index);
- }
- }
-
- /**
- * Returns the first found node that has a certain name (as determind by the nodes Identifier)
- * in the tree defined by a root node
- * @param tree The Tree supposidly containing such a named node
- * @param name The name of the node to find.
- * @return The node with the name, or null if no such node exists
- * @see Identifier, Node
- */
- public static final Node getNodeByName(Tree tree, String name) {
- return getNodeByName(tree.getRoot(),name);
- }
- /**
- * Returns the first found node that has a certain name (as determind by the nodes Identifier)
- * in the tree defined by a root node
- * @param root The root node of a tree
- * @param name The name of the node to find.
- * @return The node with the name, or null if no such node exists
- * @see Identifier, Node
- */
- public static final Node getNodeByName(Node root, String name) {
- if(root.getIdentifier().getName().equals(name)) {
- return root;
- }
- for(int i = 0 ; i < root.getChildCount() ; i++) {
- Node result = getNodeByName(root.getChild(i), name);
- if(result!=null) {
- return result;
- }
- }
- return null;
- }
-
-
- /**
- * Takes a tree (in mutation units) and returns a scaled version of it (in generation units).
- * @param mutationRateModel the mutation rate model used for scaling
- * and the desired units are expected substitutions then this scale
- * factor should be equal to the mutation rate.
- * @param newUnits the new units of the tree.
- */
- public static Tree mutationsToGenerations(Tree mutationTree, MutationRateModel muModel) {
-
- Tree tree = new SimpleTree(mutationTree);
-
- for (int i = 0; i < tree.getExternalNodeCount(); i++) {
- double oldHeight = tree.getExternalNode(i).getNodeHeight();
- tree.getExternalNode(i).setNodeHeight(muModel.getTime(oldHeight));
- }
- for (int i = 0; i < tree.getInternalNodeCount(); i++) {
- double oldHeight = tree.getInternalNode(i).getNodeHeight();
- tree.getInternalNode(i).setNodeHeight(muModel.getTime(oldHeight));
- }
- NodeUtils.heights2Lengths(tree.getRoot());
- tree.setUnits(Units.GENERATIONS);
-
- return tree;
- }
-
- /**
- * Takes a tree (in generation units) and returns a scaled version of it (in mutation units).
- * @param mutationRateModel the mutation rate model used for scaling
- * and the desired units are expected substitutions then this scale
- * factor should be equal to the mutation rate.
- * @param newUnits the new units of the tree.
- */
- public static Tree generationsToMutations(Tree generationTree, MutationRateModel muModel) {
-
- Tree tree = new SimpleTree(generationTree);
-
- for (int i = 0; i < tree.getExternalNodeCount(); i++) {
- double oldHeight = tree.getExternalNode(i).getNodeHeight();
- tree.getExternalNode(i).setNodeHeight(muModel.getExpectedSubstitutions(oldHeight));
- }
- for (int i = 0; i < tree.getInternalNodeCount(); i++) {
- double oldHeight = tree.getInternalNode(i).getNodeHeight();
- tree.getInternalNode(i).setNodeHeight(muModel.getExpectedSubstitutions(oldHeight));
- }
- //Don't respect minimum branch lengths
- NodeUtils.heights2Lengths(tree.getRoot(), false);
- tree.setUnits(Units.EXPECTED_SUBSTITUTIONS);
-
- return tree;
- }
-
- /**
- * Takes a tree and returns a scaled version of it.
- * @param rate scale factor. If the original tree is in generations
- * and the desired units are expected substitutions then this scale
- * factor should be equal to the mutation rate.
- * @param newUnits the new units of the tree.
- */
- public static Tree scale(Tree oldTree, double rate, int newUnits) {
-
- Tree tree = new SimpleTree(oldTree);
-
- for (int i = 0; i < tree.getExternalNodeCount(); i++) {
- double oldHeight = tree.getExternalNode(i).getNodeHeight();
- tree.getExternalNode(i).setNodeHeight(oldHeight * rate);
- }
- for (int i = 0; i < tree.getInternalNodeCount(); i++) {
- double oldHeight = tree.getInternalNode(i).getNodeHeight();
- tree.getInternalNode(i).setNodeHeight(oldHeight * rate);
- }
- NodeUtils.heights2Lengths(tree.getRoot());
- tree.setUnits(newUnits);
-
- return tree;
- }
-
- /**
- * Given a translation table where the keys are the current
- * identifier names and the values are the new identifier names,
- * this method replaces the current identifiers in the tree with new
- * identifiers.
- */
- public static void renameNodes(Tree tree, Hashtable table) {
-
- tree.createNodeList();
-
- for (int i = 0; i < tree.getExternalNodeCount(); i++) {
- String newName =
- (String)table.get(tree.getExternalNode(i).getIdentifier().getName());
-
- if (newName != null) {
- tree.getExternalNode(i).setIdentifier(new Identifier(newName));
- }
- }
- for (int i = 0; i < tree.getInternalNodeCount(); i++) {
-
-
-
- String newName =
- (String)table.get(tree.getInternalNode(i).getIdentifier().getName());
-
- if (newName != null) {
- tree.getInternalNode(i).setIdentifier(new Identifier(newName));
- }
- }
- }
-
- /**
- * Rotates branches by leaf count.
- * WARNING: assumes binary tree!
- */
- public static void rotateByLeafCount(Tree tree) {
-
- rotateByLeafCount(tree.getRoot());
- }
-
- /**
- * get list of the identifiers of the external nodes
- *
- * @return leaf identifier group
- */
- public static final IdGroup getLeafIdGroup(Tree tree)
- {
- tree.createNodeList();
-
- IdGroup labelList =
- new SimpleIdGroup(tree.getExternalNodeCount());
-
- for (int i = 0; i < tree.getExternalNodeCount(); i++)
- {
- labelList.setIdentifier(i, tree.getExternalNode(i).getIdentifier());
- }
-
- return labelList;
- }
-
- /**
- * map external identifiers in the tree to a set of given identifiers
- * (which can be larger than the set of external identifiers but
- * must contain all of them)
- *
- * @param idGroup an ordered group of identifiers
- *
- * @return list of links
- */
- public static final int[] mapExternalIdentifiers(IdGroup idGroup, Tree tree)
- throws IllegalArgumentException {
-
- tree.createNodeList();
-
- int[] alias = new int[tree.getExternalNodeCount()];
-
- // Check whether for each label in tree there is
- // a correspondence in the given set of labels
- for (int i = 0; i < tree.getExternalNodeCount(); i++)
- {
- alias[i] = idGroup.whichIdNumber(tree.getExternalNode(i).getIdentifier() .getName());
-
- if (alias[i] == -1)
- {
- throw new IllegalArgumentException("Tree label "
- + tree.getExternalNode(i).getIdentifier() +
- " not present in given set of labels");
- }
- }
-
- return alias;
- }
-
- /**
- * Makes a copy of this tree for every possible rooting
- * and fills a vector with all possible rootings of the given tree.
- */
- public static void getEveryRoot(Tree tree, Vector roots) {
-
- NodeUtils.heights2Lengths(tree.getRoot());
-
- // must be able to reference every node in tree uniquely
- labelInternalNodes(tree);
-
- Vector identifierList =
- new Vector(tree.getInternalNodeCount() + tree.getExternalNodeCount() - 2);
-
- // add all nodes except root node and root node's first child
- for (int i = 0; i < tree.getInternalNodeCount(); i++) {
- if ((tree.getInternalNode(i) != tree.getRoot()) &&
- (tree.getInternalNode(i) != tree.getRoot().getChild(0))) {
-
- identifierList.addElement(tree.getInternalNode(i).getIdentifier());
- }
- }
- for (int i = 0; i < tree.getExternalNodeCount(); i++) {
- if (tree.getExternalNode(i) != tree.getRoot().getChild(0)) {
- identifierList.addElement(tree.getExternalNode(i).getIdentifier());
- }
- }
-
- //WHATS GOING ON?
- for (int i = 0; i < identifierList.size(); i++) {
- Log.getDefaultLogger().log("identifier " + i + " = " +
- ((Identifier)identifierList.elementAt(i)));
- }
-
- for (int i = 0; i < identifierList.size(); i++) {
- roots.addElement(NodeFactory.createNode(tree.getRoot()));
- }
-
- for (int i = 0; i < roots.size(); i++) {
- Identifier id = (Identifier)identifierList.elementAt(i);
- Log.getDefaultLogger().log("Rooting above " + id);
-
- Node node = NodeUtils.rootAbove(id, ((Node)roots.elementAt(i)));
-
- roots.setElementAt(new SimpleTree(node), i);
- }
- }
-
- /**
- * Labels the internal nodes of the tree using numbers starting from 0.
- * Skips numbers already used by external leaves.
- */
- public static final void labelInternalNodes(Tree tree) {
-
- int counter = 0;
- String pos = "0";
-
- IdGroup ids = getLeafIdGroup(tree);
-
- for (int i = 0; i < tree.getInternalNodeCount(); i++) {
-
- //if label already used find a better one
- while (ids.whichIdNumber(pos) >= 0) {
- counter += 1;
- pos = "" + counter;
- }
- tree.getInternalNode(i).setIdentifier(new Identifier(pos));
- counter += 1;
- pos = "" + counter;
- }
- }
-
- /**
- * Extracts a time order character data from a tree.
- */
- public static TimeOrderCharacterData extractTimeOrderCharacterData(Tree tree, int units) {
-
- tree.createNodeList();
-
- IdGroup identifiers = getLeafIdGroup(tree);
-
- TimeOrderCharacterData tocd = new TimeOrderCharacterData(identifiers, units);
-
- double[] times = new double[tree.getExternalNodeCount()];
-
- // WARNING: following code assumes that getLeafIdGroup
- //has same order as external node list.
- for (int i = 0; i < times.length; i++) {
- times[i] = tree.getExternalNode(i).getNodeHeight();
- }
-
- // this sets the ordinals as well
- tocd.setTimes(times, units);
-
- return tocd;
- }
-
- /**
- * Extracts an alignment from a tree.
- */
- public static Alignment extractAlignment(Tree tree, boolean leaveSeqsInTree) {
-
- tree.createNodeList();
- String[] sequences = new String[tree.getExternalNodeCount()];
- Identifier[] ids = new Identifier[sequences.length];
-
- for (int i = 0; i < sequences.length; i++) {
- sequences[i] = new String(tree.getExternalNode(i).getSequence());
- ids[i] = tree.getExternalNode(i).getIdentifier();
- if (!leaveSeqsInTree) {
- tree.getExternalNode(i).setSequence(null);
- }
- }
-
- return new SimpleAlignment(ids, sequences, "-");
- }
-
- /**
- * Extracts an alignment from a tree.
- */
- public static Alignment extractAlignment(Tree tree) {
- return extractAlignment(tree, true);
- }
-
-
- /**
- * print a this tree in New Hampshire format
- * (including distances and internal labels)
- *
- * @param out output stream
- */
- public static void printNH(Tree tree, PrintWriter out) {
- printNH(tree, out, true, true);
- }
-
- /**
- * print this tree in New Hampshire format
- *
- * @param out output stream
- * @param printLengths boolean variable determining whether
- * branch lengths should be included in output
- * @param printInternalLabels boolean variable determining whether
- * internal labels should be included in output
- */
- public static void printNH(Tree tree, PrintWriter out,
- boolean printLengths, boolean printInternalLabels) {
-
- NodeUtils.printNH(out, tree.getRoot(),
- printLengths, printInternalLabels);
- out.println(";");
- }
-
- /*
- * compute distance of external node a to all other leaves
- * (computational complexity of this method is only O(n), following
- * D.Bryant and P. Wadell. 1998. MBE 15:1346-1359)
- *
- * @param tree tree
- * @param a node
- * @param dist array for the node-to-node distance distances
- * @param idist array for the distance between a and all internal nodes
- * @param countEdges boolean variable deciding whether the actual
- * branch lengths are used in computing the distance
- * or whether simply all edges larger or equal a certain
- * threshold length are counted (each with weight 1.0)
- * @param epsilon minimum branch length for a which an edge is counted
- */
- public static void computeAllDistances(Tree tree,
- int a, double[] dist, double[] idist,
- boolean countEdges, double epsilon)
- {
- tree.createNodeList();
-
- dist[a] = 0.0;
-
- Node node = tree.getExternalNode(a);
-
- computeNodeDist(node, node.getParent(), dist, idist, countEdges, epsilon);
- }
-
- private static void computeNodeDist(Node origin, Node center,
- double[] dist, double[] idist,
- boolean countEdges, double epsilon)
- {
- int indexCenter = center.getNumber();
- int indexOrigin = origin.getNumber();
- double[] distCenter;
- double[] distOrigin;
- if (center.isLeaf()) distCenter = dist;
- else distCenter = idist;
- if (origin.isLeaf()) distOrigin = dist;
- else distOrigin = idist;
-
- double len;
- double tmp;
- if (origin.getParent() == center)
- {
- // center is parent of origin
- tmp = origin.getBranchLength();
- }
- else
- {
- // center is child of origin
- tmp = center.getBranchLength();
- }
-
-
- if (countEdges) // count all edges >= epsilon
- {
- if (tmp < epsilon)
- {
- len = 0.0;
- }
- else
- {
- len = 1.0;
- }
- }
- else // use branch lengths
- {
- len = tmp;
- }
-
-
- distCenter[indexCenter] = distOrigin[indexOrigin] + len;
-
- if (!center.isLeaf())
- {
- for (int i = 0; i < center.getChildCount(); i++)
- {
- Node c = center.getChild(i);
-
- if (c != origin) computeNodeDist(center, c, dist, idist, countEdges, epsilon);
- }
-
- if (!center.isRoot())
- {
- Node p = center.getParent();
-
- if (p != origin) computeNodeDist(center,p, dist, idist, countEdges, epsilon);
- }
- }
- }
-
-
- private static Node[] path;
-
- /**
- * compute distance between two external nodes
- *
- * @param tree tree
- * @param a external node 1
- * @param b external node 2
- *
- * @return distance between node a and b
- */
- public static final double computeDistance(Tree tree, int a, int b)
- {
- tree.createNodeList();
- int maxLen = tree.getInternalNodeCount()+1;
- if (path == null || path.length < maxLen)
- {
- path = new Node[maxLen];
- }
-
- // len might be different from path.length
- int len = findPath(tree, a, b);
-
- double dist = 0.0;
- for (int i = 0; i < len; i++)
- {
- dist += path[i].getBranchLength();
- }
-
- return dist;
- }
-
- // Find path between external nodes a and b
- // After calling this method path contains all nodes
- // with edges lying between a and b (including a and b)
- // (note that the node lying on the intersection of a-root
- // and b-root is NOT contained because this node does
- // not contain a branch of the path)
- // The length of the path is also returned
- private static final int findPath(Tree tree, int a, int b)
- {
- // clean path
- for (int i = 0; i < path.length; i++)
- {
- path[i] = null;
- }
- // path from node a to root
- Node node = tree.getExternalNode(a);
- int len = 0;
- path[len] = node;
- len++;
- while (!node.isRoot())
- {
- node = node.getParent();
- path[len] = node;
- len++;
- }
-
- // find intersection with path from node b to root
- Node stopNode = null;
- node = tree.getExternalNode(b);
- while (!node.isRoot())
- {
- node = node.getParent();
- int pos = findInPath(node);
-
- if (pos != -1)
- {
- len = pos;
- stopNode = node;
- break;
- }
- }
-
- // fill rest of path
- node = tree.getExternalNode(b);
- path[len] = node;
- len++;
- node = node.getParent();
- while (node != stopNode)
- {
- path[len] = node;
- len++;
- node = node.getParent();
- }
-
- // clean rest
- for (int i = len; i < path.length; i++)
- {
- path[i] = null;
- }
-
- return len;
- }
-
- private static final int findInPath(Node node)
- {
- for (int i = 0; i < path.length; i++)
- {
- if (path[i] == node)
- {
- return i;
- }
- else if (path[i] == null)
- {
- return -1;
- }
- }
-
- return -1;
- }
-
- /**
- * Rotates branches by leaf count.
- * WARNING: assumes binary tree!
- */
- private static void rotateByLeafCount(Node node) {
- if (!node.isLeaf()) {
-
- if (NodeUtils.getLeafCount(node.getChild(0)) >
- NodeUtils.getLeafCount(node.getChild(1))) {
-
- Node temp = node.getChild(0);
- node.removeChild(0);
- node.addChild(temp);
- }
-
- //List childList = Arrays.asList(children);
- //Collections.sort(childList, leafCountComparator);
- //children = (Coalescent[])childList.toArray(children);
-
- for (int i = 0; i < node.getChildCount(); i++) {
- rotateByLeafCount(node.getChild(i));
- }
- }
- }
-
-
-
- public static void report(Tree tree, PrintWriter out)
- {
- printASCII(tree, out);
- out.println();
- branchInfo(tree, out);
- out.println();
- heightInfo(tree, out);
- }
-
-
- private static FormattedOutput format;
-
- private static double proportion;
- private static int minLength;
- private static boolean[] umbrella;
- private static int[] position;
-
- private static int numExternalNodes;
- private static int numInternalNodes;
- private static int numBranches;
-
-
- // Print picture of current tree in ASCII
- private static void printASCII(Tree tree, PrintWriter out)
- {
- format = FormattedOutput.getInstance();
-
- tree.createNodeList();
-
- numExternalNodes = tree.getExternalNodeCount();
- numInternalNodes = tree.getInternalNodeCount();
- numBranches = numInternalNodes+numExternalNodes-1;
-
- umbrella = new boolean[numExternalNodes];
- position = new int[numExternalNodes];
-
- minLength = (Integer.toString(numBranches)).length() + 1;
-
- int MAXCOLUMN = 40;
- Node root = tree.getRoot();
- if (root.getNodeHeight() == 0.0) {
- NodeUtils.lengths2Heights(root);
- }
- proportion = (double) MAXCOLUMN/root.getNodeHeight();
-
- for (int n = 0; n < numExternalNodes; n++)
- {
- umbrella[n] = false;
- }
-
- position[0] = 1;
- for (int i = root.getChildCount()-1; i > -1; i--)
- {
- printNodeInASCII(out, root.getChild(i), 1, i, root.getChildCount());
- if (i != 0)
- {
- putCharAtLevel(out, 0, '|');
- out.println();
- }
- }
- }
-
- // Print branch information
- private static void branchInfo(Tree tree, PrintWriter out)
- {
-
- //
- // CALL PRINTASCII FIRST !!!
- //
-
- // check if some SE values differ from the default zero
- boolean showSE = false;
- for (int i = 0; i < numExternalNodes && showSE == false; i++)
- {
- if (tree.getExternalNode(i).getBranchLengthSE() != 0.0)
- {
- showSE = true;
- }
- if (i < numInternalNodes-1)
- {
- if (tree.getInternalNode(i).getBranchLengthSE() != 0.0)
- {
- showSE = true;
- }
- }
- }
-
- format.displayIntegerWhite(out, numExternalNodes);
- out.print(" Length ");
- if (showSE) out.print("S.E. ");
- out.print("Label ");
- if (numInternalNodes > 1)
- {
- format.displayIntegerWhite(out, numBranches);
- out.print(" Length ");
- if (showSE) out.print("S.E. ");
- out.print("Label");
- }
- out.println();
-
- for (int i = 0; i < numExternalNodes; i++)
- {
- format.displayInteger(out, i+1, numExternalNodes);
- out.print(" ");
- format.displayDecimal(out, tree.getExternalNode(i).getBranchLength(), 5);
- out.print(" ");
- if (showSE)
- {
- format.displayDecimal(out, tree.getExternalNode(i).getBranchLengthSE(), 5);
- out.print(" ");
- }
- format.displayLabel(out, tree.getExternalNode(i).getIdentifier().getName(), 10);
-
- if (i < numInternalNodes-1)
- {
- format.multiplePrint(out, ' ', 5);
- format.displayInteger(out, i+1+numExternalNodes, numBranches);
- out.print(" ");
- format.displayDecimal(out, tree.getInternalNode(i).getBranchLength(), 5);
- out.print(" ");
- if (showSE)
- {
- format.displayDecimal(out, tree.getInternalNode(i).getBranchLengthSE(), 5);
- out.print(" ");
- }
- format.displayLabel(out, tree.getInternalNode(i).getIdentifier().getName(), 10);
- }
-
- out.println();
- }
- }
-
-
- // Print height information
- private static void heightInfo(Tree tree, PrintWriter out)
- {
- //
- // CALL PRINTASCII FIRST
- //
-
- if (tree.getRoot().getNodeHeight() == 0.0) {
- NodeUtils.lengths2Heights(tree.getRoot());
- }
-
- // check if some SE values differ from the default zero
- boolean showSE = false;
- for (int i = 0; i < numInternalNodes && showSE == false; i++)
- {
- if (tree.getInternalNode(i).getNodeHeightSE() != 0.0)
- {
- showSE = true;
- }
- }
-
- format.displayIntegerWhite(out, numExternalNodes);
- out.print(" Height ");
- format.displayIntegerWhite(out, numBranches);
- out.print(" Height ");
- if (showSE) out.print("S.E.");
-
- out.println();
-
- for (int i = 0; i < numExternalNodes; i++)
- {
- format.displayInteger(out, i+1, numExternalNodes);
- out.print(" ");
- format.displayDecimal(out, tree.getExternalNode(i).getNodeHeight(), 7);
- out.print(" ");
-
- if (i < numInternalNodes)
- {
- format.multiplePrint(out, ' ', 5);
-
- if (i == numInternalNodes-1)
- {
- out.print("R");
- format.multiplePrint(out, ' ', Integer.toString(numBranches).length()-1);
- }
- else
- {
- format.displayInteger(out, i+1+numExternalNodes, numBranches);
- }
-
- out.print(" ");
- format.displayDecimal(out, tree.getInternalNode(i).getNodeHeight(), 7);
- out.print(" ");
- if (showSE)
- {
- format.displayDecimal(out, tree.getInternalNode(i).getNodeHeightSE(), 7);
- }
- }
-
- out.println();
- }
- }
-
-
-
- private static void printNodeInASCII(PrintWriter out, Node node, int level, int m, int maxm)
- {
- position[level] = (int) (node.getBranchLength()*proportion);
-
- if (position[level] < minLength)
- {
- position[level] = minLength;
- }
-
- if (node.isLeaf()) // external branch
- {
- if (m == maxm-1)
- {
- umbrella[level-1] = true;
- }
-
- printlnNodeWithNumberAndLabel(out, node, level);
-
- if (m == 0)
- {
- umbrella[level-1] = false;
- }
- }
- else // internal branch
- {
- for (int n = node.getChildCount()-1; n > -1; n--)
- {
- printNodeInASCII(out, node.getChild(n), level+1, n, node.getChildCount());
-
- if (m == maxm-1 && n == node.getChildCount()/2)
- {
- umbrella[level-1] = true;
- }
-
- if (n != 0)
- {
- if (n == node.getChildCount()/2)
- {
- printlnNodeWithNumberAndLabel(out, node, level);
- }
- else
- {
- for (int i = 0; i < level+1; i++)
- {
- if (umbrella[i])
- {
- putCharAtLevel(out, i, '|');
- }
- else
- {
- putCharAtLevel(out, i, ' ');
- }
- }
- out.println();
- }
- }
-
- if (m == 0 && n == node.getChildCount()/2)
- {
- umbrella[level-1] = false;
- }
- }
- }
- }
-
-
-
- private static void printlnNodeWithNumberAndLabel(PrintWriter out, Node node, int level)
- {
- for (int i = 0; i < level-1; i++)
- {
- if (umbrella[i])
- {
- putCharAtLevel(out, i, '|');
- }
- else
- {
- putCharAtLevel(out, i, ' ');
- }
- }
-
- putCharAtLevel(out, level-1, '+');
-
- int branchNumber;
- if (node.isLeaf())
- {
- branchNumber = node.getNumber()+1;
- }
- else
- {
- branchNumber = node.getNumber()+1+numExternalNodes;
- }
-
- String numberAsString = Integer.toString(branchNumber);
-
- int numDashs = position[level]-numberAsString.length();
- for (int i = 0; i < numDashs; i++)
- {
- out.print('-');
- }
- out.print(numberAsString);
-
- if (node.isLeaf())
- {
- out.println(" " + node.getIdentifier());
- }
- else
- {
- if (!node.getIdentifier().equals(Identifier.ANONYMOUS))
- {
- out.print("(" + node.getIdentifier() + ")");
- }
- out.println();
- }
- }
-
-
-
- private static void putCharAtLevel(PrintWriter out, int level, char c)
- {
- int n = position[level]-1;
- for (int i = 0; i < n; i++)
- {
- out.print(' ');
- }
- out.print(c);
- }
-
-
-}
-
diff --git a/LibrarySource/pal/tree/UPGMATree.java b/LibrarySource/pal/tree/UPGMATree.java
deleted file mode 100644
index dd32f91..0000000
--- a/LibrarySource/pal/tree/UPGMATree.java
+++ /dev/null
@@ -1,201 +0,0 @@
-// UPGMATree.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-// Known bugs and limitations:
-// - computational complexity O(numSeqs^3)
-// (this could be brought down to O(numSeqs^2)
-// but this needs more clever programming ...)
-
-
-package pal.tree;
-
-import pal.distance.*;
-
-/**
- * constructs a UPGMA tree from pairwise distances
- *
- * @version $Id: UPGMATree.java,v 1.9 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class UPGMATree extends SimpleTree
-{
- //
- // Public stuff
- //
-
- /**
- * constructor UPGMA tree
- *
- * @param m distance matrix
- */
- public UPGMATree(DistanceMatrix m)
- {
- if (m.numSeqs < 2)
- {
- new IllegalArgumentException("LESS THAN 2 TAXA IN DISTANCE MATRIX");
- }
- if (!m.isSymmetric())
- {
- new IllegalArgumentException("UNSYMMETRIC DISTANCE MATRIX");
- }
-
- init(m);
-
- while (true)
- {
- findNextPair();
- newBranchLengths();
-
- if (numClusters == 2)
- {
- break;
- }
-
- newCluster();
- }
-
- finish();
- createNodeList();
- }
-
-
- //
- // Private stuff
- //
-
- private int numClusters;
- private Node newCluster;
- private int besti, abi;
- private int bestj, abj;
- private int[] alias;
- private double[][] distance;
-
- private double[] height;
- private int[] oc;
-
- private double getDist(int a, int b)
- {
- return distance[alias[a]][alias[b]];
- }
-
- private void init(DistanceMatrix m)
- {
- numClusters = m.numSeqs;
-
- distance = new double[numClusters][numClusters];
- for (int i = 0; i < numClusters; i++)
- {
- for (int j = 0; j < numClusters; j++)
- {
- distance[i][j] = m.distance[i][j];
- }
- }
-
- for (int i = 0; i < numClusters; i++)
- {
- Node tmp = NodeFactory.createNode();
- tmp.setIdentifier(m.getIdentifier(i));
- getRoot().addChild(tmp);
- }
-
- alias = new int[numClusters];
- for (int i = 0; i < numClusters; i++)
- {
- alias[i] = i;
- }
-
- height = new double[numClusters];
- oc = new int[numClusters];
- for (int i = 0; i < numClusters; i++)
- {
- height[i] = 0.0;
- oc[i] = 1;
- }
- }
-
- private void finish()
- {
- distance = null;
- }
-
- private void findNextPair()
- {
- besti = 0;
- bestj = 1;
- double dmin = getDist(0, 1);
- for (int i = 0; i < numClusters-1; i++)
- {
- for (int j = i+1; j < numClusters; j++)
- {
- if (getDist(i, j) < dmin)
- {
- dmin = getDist(i, j);
- besti = i;
- bestj = j;
- }
- }
- }
- abi = alias[besti];
- abj = alias[bestj];
- }
-
- private void newBranchLengths()
- {
- double dij = getDist(besti, bestj);
-
- getRoot().getChild(besti).setBranchLength(dij/2.0-height[abi]);
- getRoot().getChild(bestj).setBranchLength(dij/2.0-height[abj]);
- }
-
- private void newCluster()
- {
- // Update distances
- for (int k = 0; k < numClusters; k++)
- {
- if (k != besti && k != bestj)
- {
- int ak = alias[k];
- distance[ak][abi] = distance[abi][ak] = updatedDistance(besti, bestj, k);
- }
- }
- distance[abi][abi] = 0.0;
-
- // Update UPGMA variables
- height[abi] = getDist(besti, bestj)/2.0;
- oc[abi] += oc[abj];
-
- // Index besti now represent the new cluster
- NodeUtils.joinChilds(getRoot(), besti, bestj);
-
- // Update alias
- for (int i = bestj; i < numClusters-1; i++)
- {
- alias[i] = alias[i+1];
- }
-
- numClusters--;
- }
-
-
- /**
- * compute updated distance between the new cluster (i,j)
- * to any other cluster k
- */
- private double updatedDistance(int i, int j, int k)
- {
- int ai = alias[i];
- int aj = alias[j];
-
- double ocsum = (double) (oc[ai]+oc[aj]);
-
- return (oc[ai]/ocsum)*getDist(k, i) +
- (oc[aj]/ocsum)*getDist(k, j);
- }
-}
-
diff --git a/LibrarySource/pal/tree/UnconstrainedTree.java b/LibrarySource/pal/tree/UnconstrainedTree.java
deleted file mode 100644
index a509822..0000000
--- a/LibrarySource/pal/tree/UnconstrainedTree.java
+++ /dev/null
@@ -1,110 +0,0 @@
-// UnconstrainedTree.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.tree;
-
-import pal.misc.*;
-
-
-/**
- * provides parameter interface to an unconstrained tree
- * (parameters are all available branch lengths)
- *
- * @version $Id: UnconstrainedTree.java,v 1.5 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- * @author Alexei Drummond
- */
-public class UnconstrainedTree extends ParameterizedTree
-{
- //
- // Public stuff
- //
-
- /**
- * take any tree and afford it with an interface
- * suitable for an unconstrained tree (parameters
- * are all available branch lengths)
- */
- public UnconstrainedTree(Tree t)
- {
- setBaseTree(t);
-
- if (getRoot().getChildCount() < 3)
- {
- throw new IllegalArgumentException(
- "The root node must have at least three childs!");
- }
-
- // set default values
- for (int i = 0; i < getNumParameters(); i++)
- {
- setParameter(getDefaultValue(i), i);
- }
- }
-
-
- // interface Parameterized
-
- public int getNumParameters()
- {
- return getInternalNodeCount()+getExternalNodeCount()-1;
- }
-
- public void setParameter(double param, int n)
- {
- if (n < getExternalNodeCount())
- {
- getExternalNode(n).setBranchLength(param);
- }
- else
- {
- getInternalNode(n-getExternalNodeCount()).setBranchLength(param);
- }
- }
-
- public double getParameter(int n)
- {
- if (n < getExternalNodeCount())
- {
- return getExternalNode(n).getBranchLength();
- }
- else
- {
- return getInternalNode(n-getExternalNodeCount()).getBranchLength();
- }
- }
-
- public void setParameterSE(double paramSE, int n)
- {
- if (n < getExternalNodeCount())
- {
- getExternalNode(n).setBranchLengthSE(paramSE);
- }
- else
- {
- getInternalNode(n-getExternalNodeCount()).setBranchLengthSE(paramSE);
- }
- }
-
- public double getLowerLimit(int n)
- {
- return BranchLimits.MINARC;
- }
-
- public double getUpperLimit(int n)
- {
- return BranchLimits.MAXARC;
- }
-
- public double getDefaultValue(int n)
- {
- return BranchLimits.DEFAULT_LENGTH;
- }
-}
-
diff --git a/LibrarySource/pal/tree/makefile b/LibrarySource/pal/tree/makefile
deleted file mode 100644
index dca8f11..0000000
--- a/LibrarySource/pal/tree/makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-### VARIABLES ###
-
-JIKESOPTS := +P
-GCJOPTS :=
-
-# Always check dependencies
-JIKESOPTS += +M
-
-SRC := $(wildcard *.java)
-CLS := $(patsubst %.java, %.class, $(SRC))
-OBJ := $(patsubst %.class, %.o, $(wildcard *.class))
-
-
-### RULES ###
-
-# Compile Java sources into class files
-%.class: %.java
- jikes $(JIKESOPTS) $<
-
-# Alternative to using jikes: gcj -C
-
-# Compile class files into native code
-%.o: %.class
- gcj -c $(GCJOPTS) $<
-
-
-### TARGETS ###
-
-.PHONY: classes native clean
-
-classes: $(CLS)
-
-ifneq ($(OBJ),)
-native: $(OBJ)
- (ar -rv package.a *.o; ranlib package.a)
-else
-native: $(OBJ)
-endif
-
-clean:
- rm -f *.class *.o *.u *.a *~
-
diff --git a/LibrarySource/pal/tree/package.html b/LibrarySource/pal/tree/package.html
deleted file mode 100644
index fe66302..0000000
--- a/LibrarySource/pal/tree/package.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
-<body>
-Classes for providing the data structure of
-trees, for constructing and modifying trees, and for parameterizing
-trees (e.g., clock constraint).
-</body>
-</html>
-
diff --git a/LibrarySource/pal/util/Comparable.java b/LibrarySource/pal/util/Comparable.java
deleted file mode 100644
index b102e7b..0000000
--- a/LibrarySource/pal/util/Comparable.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// Comparable.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.util;
-
-/**
- * interface for an object that is comparable.
- * This interface is analogous to the Comparable interface in
- * Java 1.2, and it should be superceded by the JDK 1.2 collections
- * framework when PAL is moved to 1.2.
- *
- * @version $Id: Comparable.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public interface Comparable
-{
- /**
- * Returns a number representing the ordering relationship that
- * the object has with the given object.
- * A negative number indicates that the object is "smaller" than
- * the parameter, a positive number means it is "larger" and zero
- * indicates that the objects are equal.
- */
- int compareTo(Object o);
-
- /**
- * Returns true if this object is equal to the given object.
- */
- boolean equals(Object o);
-}
-
diff --git a/LibrarySource/pal/util/ComparableDouble.java b/LibrarySource/pal/util/ComparableDouble.java
deleted file mode 100644
index 2c6feae..0000000
--- a/LibrarySource/pal/util/ComparableDouble.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// ComparableDouble.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.util;
-
-/**
- * This class is unfortunate but necessary to conform to JDK 1.1
- *
- * @version $Id: ComparableDouble.java,v 1.3 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public class ComparableDouble implements Comparable {
-
- private double value;
-
- public ComparableDouble(double d) {
- value = d;
- }
-
- public int compareTo(Object o) {
-
- ComparableDouble cd = (ComparableDouble)o;
-
- if (value < cd.value) {
- return -1;
- } else if (value > cd.value) {
- return 1;
- } else return 0;
- }
-
- public boolean equals(Object o) {
-
- ComparableDouble cd = (ComparableDouble)o;
- return cd.value == value;
- }
-
- public double doubleValue() {
- return value;
- }
-
- public String toString() {
- return value + "";
- }
-}
-
diff --git a/LibrarySource/pal/util/Comparator.java b/LibrarySource/pal/util/Comparator.java
deleted file mode 100644
index 0dd4d84..0000000
--- a/LibrarySource/pal/util/Comparator.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// Comparator.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.util;
-
-/**
- * interface for an object that can compare other objects for the
- * purposes of ordering them.
- * This interface is analogous to the Comparator interface in
- * Java 1.2 and higher, and it should be superceded by the collections
- * framework when PAL is moved to 1.2 or higher.
- *
- * @version $Id: Comparator.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- */
-public interface Comparator
-{
- /**
- * Returns a number representing the ordering relationship that
- * the two objects have.
- * A negative number indicates that the first object is "smaller" than
- * the second object, a positive number means it is "larger" and zero
- * indicates that the objects are equal.
- */
- int compare(Object o1, Object o2);
-
- /**
- * Returns true if the two objects are equal.
- */
- boolean equals(Object o1, Object o2);
-}
-
diff --git a/LibrarySource/pal/util/HeapSort.java b/LibrarySource/pal/util/HeapSort.java
deleted file mode 100644
index 5cdd146..0000000
--- a/LibrarySource/pal/util/HeapSort.java
+++ /dev/null
@@ -1,411 +0,0 @@
-// HeapSort.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.util;
-
-import pal.math.*;
-
-import java.util.*;
-
-/**
- * sorts numbers and comparable objects by treating contents of array as a binary tree.
- * KNOWN BUGS: There is a horrible amount of code duplication here!
- *
- * @version $Id: HeapSort.java,v 1.9 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Alexei Drummond
- * @author Korbinian Strimmer
- */
-public class HeapSort {
-
- //
- // Public stuff
- //
-
- /**
- * Sorts an array of indices to vector of comparable objects
- * into increasing order.
- */
- public static void sort(Vector array, int[] indices) {
-
- // ensures we are starting with valid indices
- for (int i = 0; i < indices.length; i++) {
- indices[i] = i;
- }
-
- int temp;
- int j, n = array.size();
-
- // turn input array into a heap
- for (j = n/2; j > 0; j--) {
- adjust(array, indices, j, n);
- }
-
- // remove largest elements and put them at the end
- // of the unsorted region until you are finished
- for (j = n-1; j > 0; j--) {
- temp = indices[0];
- indices[0] = indices[j];
- indices[j] = temp;
- adjust(array, indices, 1, j);
- }
- }
-
- /**
- * Sorts a vector of comparable objects into increasing order.
- */
- public static void sort(Vector array) {
-
- Object temp;
- int j, n = array.size();
-
- // turn input array into a heap
- for (j = n/2; j > 0; j--) {
- adjust(array, j, n);
- }
-
- // remove largest elements and put them at the end
- // of the unsorted region until you are finished
- for (j = n-1; j > 0; j--) {
- temp = array.elementAt(0);
- array.setElementAt(array.elementAt(j), 0);
- array.setElementAt(temp, j);
- adjust(array, 1, j);
- }
- }
-
- /**
- * Sorts an array of comparable objects into increasing order.
- */
- public static void sort(pal.util.Comparable[] array) {
-
- pal.util.Comparable temp;
- int j, n = array.length;
-
- // turn input array into a heap
- for (j = n/2; j > 0; j--) {
- adjust(array, j, n);
- }
-
- // remove largest elements and put them at the end
- // of the unsorted region until you are finished
- for (j = n-1; j > 0; j--) {
- temp = array[0];
- array[0] = array[j];
- array[j] = temp;
- adjust(array, 1, j);
- }
- }
-
- /**
- * Sorts an array of objects into increasing order given a comparator.
- */
- public static void sort(Object[] array, Comparator c) {
-
- Object temp;
- int j, n = array.length;
-
- // turn input array into a heap
- for (j = n/2; j > 0; j--) {
- adjust(array, c, j, n);
- }
-
- // remove largest elements and put them at the end
- // of the unsorted region until you are finished
- for (j = n-1; j > 0; j--) {
- temp = array[0];
- array[0] = array[j];
- array[j] = temp;
- adjust(array, c, 1, j);
- }
- }
-
- /**
- * Sorts an array of doubles into increasing order.
- */
- public static void sort(double[] array) {
-
- double temp;
- int j, n = array.length;
-
- // turn input array into a heap
- for (j = n/2; j > 0; j--) {
- adjust(array, j, n);
- }
-
- // remove largest elements and put them at the end
- // of the unsorted region until you are finished
- for (j = n-1; j > 0; j--) {
- temp = array[0];
- array[0] = array[j];
- array[j] = temp;
- adjust(array, 1, j);
- }
- }
-
- /**
- * Sorts an array of indices into an array of doubles
- * into increasing order.
- */
- public static void sort(double[] array, int[] indices)
- {
-
- // ensures we are starting with valid indices
- for (int i = 0; i < indices.length; i++)
- {
- indices[i] = i;
- }
-
- int temp;
- int j, n = array.length;
-
- // turn input array into a heap
- for (j = n/2; j > 0; j--) {
- adjust(array, indices, j, n);
- }
-
- // remove largest elements and put them at the end
- // of the unsorted region until you are finished
- for (j = n-1; j > 0; j--) {
- temp = indices[0];
- indices[0] = indices[j];
- indices[j] = temp;
- adjust(array, indices, 1, j);
- }
- }
-
-
- /** test harness for heapsort algorithm */
- public static void main(String[] args) {
-
- MersenneTwisterFast m = new MersenneTwisterFast();
-
- int testSize = 100;
-
- // test array of Comparable objects
-
- pal.util.ComparableDouble[] test = new pal.util.ComparableDouble[testSize];
-
- for (int i = 0; i < test.length; i++) {
- test[i] = new pal.util.ComparableDouble(m.nextInt(testSize * 10));
- }
-
- sort(test);
- for (int i = 0; i < test.length; i++) {
- System.out.print(test[i] + " ");
- }
- System.out.println();
-
- // test index to Vector of Comparable objects
-
- Vector testv = new Vector();
- int[] indices = new int[testSize];
-
- for (int i = 0; i < testSize; i++) {
- testv.addElement(new pal.util.ComparableDouble(m.nextInt(testSize * 10)));
- }
-
- sort(testv, indices);
- for (int i = 0; i < test.length; i++) {
- System.out.print(testv.elementAt(indices[i]) + " ");
- }
- System.out.println();
-
-
- // test index to array of doubles
-
- double[] testd = new double[testSize];
- //int[] indices = new int[testSize];
-
- for (int i = 0; i < testSize; i++)
- {
- testd[i] = m.nextInt(testSize * 10);
- }
-
- sort(testd, indices);
- for (int i = 0; i < test.length; i++)
- {
- System.out.print(testd[indices[i]] + " ");
- }
- System.out.println();
-
- }
-
- // PRIVATE STUFF
-
- /**
- * helps sort an array of indices into a vector of comparable objects.
- * Assumes that array[lower+1] through to array[upper] is
- * already in heap form and then puts array[lower] to
- * array[upper] in heap form.
- */
- private static void adjust(Vector array, int[] indices, int lower, int upper) {
-
- int j, k;
- int temp;
-
- j = lower;
- k = lower * 2;
-
- while (k <= upper) {
- if ((k < upper) && (((pal.util.Comparable)array.elementAt(indices[k-1])).compareTo(array.elementAt(indices[k])) < 0)) {
- k += 1;
- }
- if (((pal.util.Comparable)array.elementAt(indices[j-1])).compareTo(array.elementAt(indices[k-1])) < 0) {
- temp = indices[j-1];
- indices[j-1] = indices[k-1];
- indices[k-1] = temp;
- }
- j = k;
- k *= 2;
- }
- }
-
- /**
- * helps sort an vector of comparable objects.
- * Assumes that array[lower+1] through to array[upper] is
- * already in heap form and then puts array[lower] to
- * array[upper] in heap form.
- */
- private static void adjust(Vector array, int lower, int upper) {
-
- int j, k;
- Object temp;
-
- j = lower;
- k = lower * 2;
-
- while (k <= upper) {
- if ((k < upper) && (((pal.util.Comparable)array.elementAt(k-1)).compareTo(array.elementAt(k)) < 0)) {
- k += 1;
- }
- if (((pal.util.Comparable)array.elementAt(j-1)).compareTo(array.elementAt(k-1)) < 0) {
- temp = array.elementAt(j-1);
- array.setElementAt(array.elementAt(k-1), j-1);
- array.setElementAt(temp, k-1);
- }
- j = k;
- k *= 2;
- }
- }
-
- /**
- * Assumes that array[lower+1] through to array[upper] is
- * already in heap form and then puts array[lower] to
- * array[upper] in heap form.
- */
- private static void adjust(pal.util.Comparable[] array, int lower, int upper) {
-
- int j, k;
- pal.util.Comparable temp;
-
- j = lower;
- k = lower * 2;
-
- while (k <= upper) {
- if ((k < upper) && (array[k-1].compareTo(array[k]) < 0)) {
- k += 1;
- }
- if (array[j-1].compareTo(array[k-1]) < 0) {
- temp = array[j-1];
- array[j-1] = array[k-1];
- array[k-1] = temp;
- }
- j = k;
- k *= 2;
- }
- }
-
- /**
- * Assumes that array[lower+1] through to array[upper] is
- * already in heap form and then puts array[lower] to
- * array[upper] in heap form.
- */
- private static void adjust(Object[] array, Comparator c, int lower, int upper) {
-
- int j, k;
- Object temp;
-
- j = lower;
- k = lower * 2;
-
- while (k <= upper) {
- if ((k < upper) && (c.compare(array[k-1], array[k]) < 0)) {
- k += 1;
- }
- if (c.compare(array[j-1], array[k-1]) < 0) {
- temp = array[j-1];
- array[j-1] = array[k-1];
- array[k-1] = temp;
- }
- j = k;
- k *= 2;
- }
- }
-
- /**
- * helps sort an array of doubles.
- * Assumes that array[lower+1] through to array[upper] is
- * already in heap form and then puts array[lower] to
- * array[upper] in heap form.
- */
- private static void adjust(double[] array, int lower, int upper) {
-
- int j, k;
- double temp;
-
- j = lower;
- k = lower * 2;
-
- while (k <= upper) {
- if ((k < upper) && (array[k-1] < array[k])) {
- k += 1;
- }
- if (array[j-1] < array[k-1]) {
- temp = array[j-1];
- array[j-1] = array[k-1];
- array[k-1] = temp;
- }
- j = k;
- k *= 2;
- }
- }
-
- /**
- * helps sort an array of indices into an array of doubles.
- * Assumes that array[lower+1] through to array[upper] is
- * already in heap form and then puts array[lower] to
- * array[upper] in heap form.
- */
- private static void adjust(double[] array, int[] indices, int lower, int upper) {
-
- int j, k;
- int temp;
-
- j = lower;
- k = lower * 2;
-
- while (k <= upper)
- {
- if ((k < upper) && (array[indices[k-1]] < array[indices[k]]))
- {
- k += 1;
- }
- if (array[indices[j-1]] < array[indices[k-1]])
- {
- temp = indices[j-1];
- indices[j-1] = indices[k-1];
- indices[k-1] = temp;
- }
- j = k;
- k *= 2;
- }
- }
-}
-
-
diff --git a/LibrarySource/pal/util/Log.java b/LibrarySource/pal/util/Log.java
deleted file mode 100644
index 198a106..0000000
--- a/LibrarySource/pal/util/Log.java
+++ /dev/null
@@ -1,55 +0,0 @@
-// Log.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.util;
-
-/**
- * Log provides a mechanism for logging and debugging to the
- * standard output stream.
- *
- * @author Alexei Drummond
- * @version $Revision: 1.2 $
- */
-public class Log implements Logger {
-
- static Logger defaultLogger = new Log();
-
- private boolean isDebugOn = false;
-
- public void setDebug(boolean on) {
-
- isDebugOn = on;
- }
-
- public boolean isDebugging() {
- return isDebugOn;
- }
-
- public void log(Object s) {
- System.out.println(s);
- }
-
- public void debug(Object s) {
-
- if (isDebugOn) {
- log(s);
- }
- }
-
- public static Logger getDefaultLogger() {
- return defaultLogger;
- }
-
- public static void setDefaultLogger(Logger logger) {
- defaultLogger = logger;
- }
-
-}
-
-
-
-
diff --git a/LibrarySource/pal/util/Logger.java b/LibrarySource/pal/util/Logger.java
deleted file mode 100644
index dceaa7e..0000000
--- a/LibrarySource/pal/util/Logger.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// Logger.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-package pal.util;
-
-/**
- * Interface for all objects that provide a logging facility.
- *
- * @author Alexei Drummond
- * @version $Revision: 1.3 $
- */
-
-
-public interface Logger {
- void log(Object obj);
-
- void debug(Object obj);
-
- // boolean isDebugging();
-}
-
diff --git a/LibrarySource/pal/util/ThreeNumberSort.java b/LibrarySource/pal/util/ThreeNumberSort.java
deleted file mode 100644
index a599081..0000000
--- a/LibrarySource/pal/util/ThreeNumberSort.java
+++ /dev/null
@@ -1,237 +0,0 @@
-// ThreeNumberSort.java
-//
-// (c) 1999-2001 PAL Development Core Team
-//
-// This package may be distributed under the
-// terms of the Lesser GNU General Public License (LGPL)
-
-
-package pal.util;
-
-import pal.math.*;
-
-/**
- * sorts three numbers (doubles) and choose randomly among the
- * minimum/maximum values
- *
- * @version $Id: ThreeNumberSort.java,v 1.4 2001/07/13 14:39:13 korbinian Exp $
- *
- * @author Korbinian Strimmer
- */
-public class ThreeNumberSort
-{
- //
- // Public stuff
- //
-
- /** the three numbers */
- public double[] numbers;
-
- /** order of the numbers (0-2) */
- public int first, second, third;
-
- /** constructor */
- public ThreeNumberSort()
- {
- numbers = new double[3];
- rng = new MersenneTwisterFast();
- }
-
- /**
- * get input index of largest number
- *
- * @return index (if two or even all three numbers are
- * of equally large value the index is drawn at
- * random from that subset
- */
- public int getIndexOfLargestNumber()
- {
- int numBest = 1;
- double valBest = numbers[first];
-
- if (numbers[second] == valBest)
- {
- numBest++;
- if (numbers[third] == valBest)
- {
- numBest++;
- }
- }
-
- if (numBest == 1)
- {
- return first;
- }
- else if (numBest == 2)
- {
- double rand = 2.0*rng.nextDouble();
-
- if (rand < 1.0)
- {
- return first;
- }
- else
- {
- return second;
- }
- }
- else
- {
- double rand = 3.0*rng.nextDouble();
-
- if (rand < 1.0)
- {
- return first;
- }
- else if (rand < 2.0)
- {
- return second;
- }
- else
- {
- return third;
- }
- }
- }
-
- /**
- * get input index of smallest number
- *
- * @return index (if two or even all three numbers are
- * of equally small value the index is drawn at
- * random from that subset
- */
- public int getIndexOfSmallestNumber()
- {
- int numBest = 1;
- double valBest = numbers[third];
-
- if (numbers[second] == valBest)
- {
- numBest++;
- if (numbers[first] == valBest)
- {
- numBest++;
- }
- }
-
- if (numBest == 1)
- {
- return third;
- }
- else if (numBest == 2)
- {
- double rand = 2.0*rng.nextDouble();
-
- if (rand < 1.0)
- {
- return third;
- }
- else
- {
- return second;
- }
- }
- else
- {
- double rand = 3.0*rng.nextDouble();
-
- if (rand < 1.0)
- {
- return third;
- }
- else if (rand < 2.0)
- {
- return second;
- }
- else
- {
- return first;
- }
- }
- }
-
- /**
- * get smallest number
- *
- * @return number
- */
- public double getSmallestNumber()
- {
- return numbers[getIndexOfSmallestNumber()];
- }
-
- /**
- * get largest number
- *
- * @return number
- */
- public double getLargestNumber()
- {
- return numbers[getIndexOfLargestNumber()];
- }
-
- /**
- * sort three doubles
- *
- * @param n0 first double
- * @param n1 second double
- * @param n2 third double
- */
- public void sort(double n0, double n1, double n2)
- {
- numbers[0] = n0;
- numbers[1] = n1;
- numbers[2] = n2;
-
- if (n0 > n1)
- {
- if(n2 > n0)
- {
- first = 2;
- second = 0;
- third = 1;
- }
- else if (n2 < n1)
- {
- first = 0;
- second = 1;
- third = 2;
- }
- else
- {
- first = 0;
- second = 2;
- third = 1;
- }
- }
- else
- {
- if(n2 > n1)
- {
- first = 2;
- second = 1;
- third = 0;
- }
- else if (n2 < n0)
- {
- first = 1;
- second = 0;
- third = 2;
- }
- else
- {
- first = 1;
- second = 2;
- third = 0;
- }
- }
- }
-
- //
- // Private stuff
- //
-
- MersenneTwisterFast rng;
-}
-
diff --git a/LibrarySource/pal/util/makefile b/LibrarySource/pal/util/makefile
deleted file mode 100644
index dca8f11..0000000
--- a/LibrarySource/pal/util/makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-### VARIABLES ###
-
-JIKESOPTS := +P
-GCJOPTS :=
-
-# Always check dependencies
-JIKESOPTS += +M
-
-SRC := $(wildcard *.java)
-CLS := $(patsubst %.java, %.class, $(SRC))
-OBJ := $(patsubst %.class, %.o, $(wildcard *.class))
-
-
-### RULES ###
-
-# Compile Java sources into class files
-%.class: %.java
- jikes $(JIKESOPTS) $<
-
-# Alternative to using jikes: gcj -C
-
-# Compile class files into native code
-%.o: %.class
- gcj -c $(GCJOPTS) $<
-
-
-### TARGETS ###
-
-.PHONY: classes native clean
-
-classes: $(CLS)
-
-ifneq ($(OBJ),)
-native: $(OBJ)
- (ar -rv package.a *.o; ranlib package.a)
-else
-native: $(OBJ)
-endif
-
-clean:
- rm -f *.class *.o *.u *.a *~
-
diff --git a/LibrarySource/pal/util/package.html b/LibrarySource/pal/util/package.html
deleted file mode 100644
index d6827e5..0000000
--- a/LibrarySource/pal/util/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body>
-Utility classes for sorting etc.
-</body>
-</html>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/mesquite.git
More information about the debian-med-commit
mailing list