Browse Source

Merge from trunk@1354651.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-1_1@1357883 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-1_1rc1^2
Glenn Adams 12 years ago
parent
commit
e2ef36f857
100 changed files with 1877 additions and 1339 deletions
  1. 14
    2
      build.xml
  2. 1
    1
      examples/fo/advanced/cid-fonts.fo
  3. 7
    7
      examples/fo/advanced/giro.fo
  4. 0
    2
      examples/fo/basic/images.fo
  5. 20
    20
      examples/fo/basic/tableunits.fo
  6. 5
    0
      examples/fo/build.xml
  7. 2
    2
      examples/fo/svg/embedding.fo
  8. 11
    11
      examples/fo/tables/background.fo
  9. 19
    20
      examples/fo/tables/borders.fo
  10. 5
    5
      examples/fo/tables/break.fo
  11. 7
    7
      examples/fo/tables/headfoot.fo
  12. 6
    6
      examples/fo/tables/keep.fo
  13. 5
    5
      examples/fo/tables/omit.fo
  14. 9
    9
      examples/fo/tables/space.fo
  15. 46
    5
      findbugs-exclude.xml
  16. BIN
      lib/xmlgraphics-commons-1.5svn.jar
  17. 5
    5
      src/documentation/content/xdocs/examples.xml
  18. 12
    13
      src/documentation/content/xdocs/fo/align.fo
  19. BIN
      src/documentation/content/xdocs/fo/align.fo.pdf
  20. BIN
      src/documentation/content/xdocs/fo/align.pdf
  21. 13
    14
      src/documentation/content/xdocs/fo/align2.fo
  22. BIN
      src/documentation/content/xdocs/fo/align2.fo.pdf
  23. BIN
      src/documentation/content/xdocs/fo/align2.pdf
  24. 70
    0
      src/documentation/content/xdocs/fo/build.xml
  25. 12
    13
      src/documentation/content/xdocs/fo/embed.fo
  26. 0
    87
      src/documentation/content/xdocs/fo/embed.fo.pdf
  27. BIN
      src/documentation/content/xdocs/fo/embed.pdf
  28. 24
    24
      src/documentation/content/xdocs/fo/fonts.fo
  29. 0
    160
      src/documentation/content/xdocs/fo/fonts.fo.pdf
  30. BIN
      src/documentation/content/xdocs/fo/fonts.pdf
  31. 12
    13
      src/documentation/content/xdocs/fo/size.fo
  32. BIN
      src/documentation/content/xdocs/fo/size.fo.pdf
  33. BIN
      src/documentation/content/xdocs/fo/size.pdf
  34. 18
    0
      src/documentation/content/xdocs/trunk/configuration.xml
  35. 5
    5
      src/documentation/content/xdocs/trunk/fonts.xml
  36. 8
    5
      src/documentation/content/xdocs/trunk/graphics.xml
  37. 1
    0
      src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd
  38. 2
    0
      src/java/META-INF/services/org.apache.fop.render.ImageHandler
  39. 6
    0
      src/java/org/apache/fop/accessibility/Accessibility.java
  40. 25
    0
      src/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java
  41. 2
    2
      src/java/org/apache/fop/afp/AFPGraphics2D.java
  42. 4
    2
      src/java/org/apache/fop/afp/modca/ImageObject.java
  43. 1
    1
      src/java/org/apache/fop/afp/modca/PresentationTextData.java
  44. 2
    1
      src/java/org/apache/fop/afp/util/DefaultFOPResourceAccessor.java
  45. 3
    2
      src/java/org/apache/fop/apps/FOUserAgent.java
  46. 1
    1
      src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java
  47. 21
    20
      src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java
  48. 1
    1
      src/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java
  49. 10
    4
      src/java/org/apache/fop/fo/FOEventHandler.java
  50. 16
    3
      src/java/org/apache/fop/fo/flow/Wrapper.java
  51. 3
    2
      src/java/org/apache/fop/fo/properties/CondLengthProperty.java
  52. 1
    1
      src/java/org/apache/fop/fonts/CIDFontType.java
  53. 31
    8
      src/java/org/apache/fop/fonts/CMapSegment.java
  54. 40
    0
      src/java/org/apache/fop/fonts/CustomFont.java
  55. 1
    1
      src/java/org/apache/fop/fonts/CustomFontCollection.java
  56. 23
    0
      src/java/org/apache/fop/fonts/EmbedFontInfo.java
  57. 58
    0
      src/java/org/apache/fop/fonts/EmbeddingMode.java
  58. 1
    1
      src/java/org/apache/fop/fonts/EncodingMode.java
  59. 5
    1
      src/java/org/apache/fop/fonts/FontInfoConfigurator.java
  60. 15
    7
      src/java/org/apache/fop/fonts/FontLoader.java
  61. 9
    4
      src/java/org/apache/fop/fonts/FontReader.java
  62. 5
    0
      src/java/org/apache/fop/fonts/FontType.java
  63. 6
    4
      src/java/org/apache/fop/fonts/LazyFont.java
  64. 27
    35
      src/java/org/apache/fop/fonts/MultiByteFont.java
  65. 6
    0
      src/java/org/apache/fop/fonts/MutableFont.java
  66. 24
    0
      src/java/org/apache/fop/fonts/SingleByteFont.java
  67. 12
    18
      src/java/org/apache/fop/fonts/apps/TTFReader.java
  68. 4
    2
      src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java
  69. 12
    17
      src/java/org/apache/fop/fonts/truetype/FontFileReader.java
  70. 0
    118
      src/java/org/apache/fop/fonts/truetype/TTFCmapEntry.java
  71. 8
    0
      src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java
  72. 452
    257
      src/java/org/apache/fop/fonts/truetype/TTFFile.java
  73. 33
    32
      src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java
  74. 48
    0
      src/java/org/apache/fop/fonts/truetype/TTFGlyphOutputStream.java
  75. 49
    0
      src/java/org/apache/fop/fonts/truetype/TTFOutputStream.java
  76. 246
    279
      src/java/org/apache/fop/fonts/truetype/TTFSubSetFile.java
  77. 163
    0
      src/java/org/apache/fop/fonts/truetype/TTFTableName.java
  78. 37
    0
      src/java/org/apache/fop/fonts/truetype/TTFTableOutputStream.java
  79. 3
    3
      src/java/org/apache/fop/hyphenation/HyphenationTreeCache.java
  80. 10
    6
      src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java
  81. 23
    11
      src/java/org/apache/fop/layoutmgr/BreakElement.java
  82. 5
    2
      src/java/org/apache/fop/layoutmgr/KnuthPenalty.java
  83. 8
    1
      src/java/org/apache/fop/pdf/AbstractPDFStream.java
  84. 4
    0
      src/java/org/apache/fop/pdf/AlphaRasterImage.java
  85. 18
    2
      src/java/org/apache/fop/pdf/BitmapImage.java
  86. 1
    1
      src/java/org/apache/fop/pdf/PDFColor.java
  87. 4
    1
      src/java/org/apache/fop/pdf/PDFEmbeddedFile.java
  88. 3
    2
      src/java/org/apache/fop/pdf/PDFFactory.java
  89. 8
    0
      src/java/org/apache/fop/pdf/PDFImage.java
  90. 5
    0
      src/java/org/apache/fop/pdf/PDFImageXObject.java
  91. 0
    6
      src/java/org/apache/fop/pdf/PDFObject.java
  92. 23
    31
      src/java/org/apache/fop/pdf/PDFResources.java
  93. 2
    1
      src/java/org/apache/fop/render/ImageHandler.java
  94. 2
    1
      src/java/org/apache/fop/render/afp/AFPDocumentHandler.java
  95. 1
    1
      src/java/org/apache/fop/render/afp/extensions/AFPIncludeFormMap.java
  96. 2
    2
      src/java/org/apache/fop/render/afp/extensions/AFPIncludeFormMapElement.java
  97. 1
    1
      src/java/org/apache/fop/render/afp/extensions/AFPPageOverlay.java
  98. 2
    1
      src/java/org/apache/fop/render/bitmap/AbstractBitmapDocumentHandler.java
  99. 2
    1
      src/java/org/apache/fop/render/bitmap/PNGDocumentHandler.java
  100. 0
    0
      src/java/org/apache/fop/render/bitmap/TIFFDocumentHandler.java

+ 14
- 2
build.xml View File

@@ -864,16 +864,28 @@ list of possible build targets.
<target name="junit-text-linebreak" depends="junit-compile" description="Runs FOP's JUnit unicode linebreak tests" if="junit.present">
<junit-run title="Unicode UAX#14 support" testsuite="org.apache.fop.text.linebreak.LineBreakStatusTestCase" outfile="TEST-linebreak"/>
</target>
<target name="junit-fonts" depends="junit-compile">
<echo message="Running tests for the fonts package"/>
<junit-run title="fonts" testsuite="org.apache.fop.fonts.FOPFontsTestSuite" outfile="TEST-fonts"/>
</target>
<target name="junit-render-ps" depends="junit-compile">
<echo message="Running tests for the render ps package"/>
<junit-run title="render-ps" testsuite="org.apache.fop.render.ps.RenderPSTestSuite" outfile="TEST-render-ps"/>
</target>
<target name="junit-render-pdf" depends="junit-compile">
<junit-run title="render-pdf" testsuite="org.apache.fop.render.pdf.RenderPDFTestSuite" outfile="TEST-render-pdf"/>
</target>
<target name="junit-complexscripts" depends="junit-compile">
<junit-run title="complexscripts" testsuite="org.apache.fop.complexscripts.ComplexScriptsTestSuite" outfile="TEST-complexscripts"/>
</target>
<target name="junit-reduced" depends="junit-userconfig, junit-basic, junit-transcoder, junit-text-linebreak, junit-fotree, junit-render-pdf, junit-complexscripts"/>
<target name="junit-reduced" depends="junit-userconfig, junit-basic, junit-transcoder,
junit-text-linebreak, junit-fotree, junit-fonts, junit-render-pdf, junit-render-ps,
junit-complexscripts"/>
<target name="junit" depends="junit-all" description="Runs all of FOP's JUnit tests"
if="junit.present">
<fail><condition><or><isset property="fop.junit.error"/><isset property="fop.junit.failure"/><not><isset property="hyphenation.present"/></not></or></condition>
<fail><condition><or><isset property="fop.junit.error"/><isset
property="fop.junit.failure"/><not><isset
property="hyphenation.present"/></not></or></condition>
NOTE:
**************************************************************************
* One or more of the Junit tests had Failures or Errors or were skipped! *

+ 1
- 1
examples/fo/advanced/cid-fonts.fo View File

@@ -369,7 +369,7 @@ This font contains no embedding license restrictions
</fo:block>

</fo:wrapper>
<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="50mm"/>
<fo:table-column column-width="50mm"/>
<fo:table-column column-width="50mm"/>

+ 7
- 7
examples/fo/advanced/giro.fo View File

@@ -32,7 +32,7 @@
<fo:block-container absolute-position="absolute" width="100%" height="100%" border-top-color="silver" border-top-style="dotted" border-top-width="0.13mm">
<fo:block/>
</fo:block-container>
<fo:table space-before.optimum="1in div 12" margin-left="2in div 12" margin-top="1in div 10" font-family="sans-serif" font-size="7pt" color="green">
<fo:table space-before.optimum="1in div 12" margin-left="2in div 12" margin-top="1in div 10" font-family="sans-serif" font-size="7pt" color="green" table-layout="fixed" width="100%">
<fo:table-column column-width="8in div 10 - 2in div 12"/>
<fo:table-column border-right-style="solid" border-right-width="0.5mm" column-width="36in div 10"/>
<fo:table-column column-width="5in div 10"/>
@@ -107,7 +107,7 @@
<fo:block>Från konto nr</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom-style="solid" border-bottom-width="0.13mm" padding-top="6mm" display-align="after">
<fo:table height="3mm">
<fo:table height="3mm" table-layout="fixed" width="100%">
<fo:table-column border-right-style="solid" border-right-width="0.13mm" column-width="0.2in"/>
<fo:table-column border-right-style="solid" border-right-width="0.13mm" column-width="0.2in"/>
<fo:table-column border-right-style="solid" border-right-width="0.13mm" column-width="0.2in"/>
@@ -182,7 +182,7 @@
<fo:block color="black">16.6.2006</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom-style="solid" border-bottom-width="0.5mm" padding-left="2mm" padding-top="4mm" font-size="10pt">
<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="0.5cm"/>
<fo:table-column column-width="2cm"/>
<fo:table-body>
@@ -201,7 +201,7 @@
<fo:table-row height="13in div 12 - 5mm">
<fo:table-cell number-columns-spanned="4" padding-left="40mm" display-align="after">
<fo:block>
<fo:table height="5in div 12" margin-left="2.5mm" margin-right="2.5mm"><!--105-->
<fo:table height="5in div 12" margin-left="2.5mm" margin-right="2.5mm" table-layout="fixed" width="100%"><!--105-->
<fo:table-column column-width="0.5mm"/>
<fo:table-column column-width="0.25mm"/>
<fo:table-column column-width="0.25mm"/>
@@ -950,7 +950,7 @@
</fo:page-sequence>
<fo:page-sequence master-reference="A4">
<fo:static-content flow-name="xsl-region-after">
<fo:table space-before.optimum="1in div 12" margin-left="2in div 12" margin-top="1in div 10" font-family="sans-serif" font-size="7pt" color="green">
<fo:table space-before.optimum="1in div 12" margin-left="2in div 12" margin-top="1in div 10" font-family="sans-serif" font-size="7pt" color="green" table-layout="fixed" width="100%">
<fo:table-column column-width="8in div 10 - 2in div 12"/>
<fo:table-column border-right-style="solid" border-right-width="0.5mm" column-width="36in div 10"/>
<fo:table-column column-width="5in div 10"/>
@@ -1025,7 +1025,7 @@
<fo:block>Från konto nr</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom-style="solid" border-bottom-width="0.13mm" padding-top="6mm" display-align="after">
<fo:table height="3mm">
<fo:table height="3mm" table-layout="fixed" width="100%">
<fo:table-column border-right-style="solid" border-right-width="0.13mm" column-width="0.2in"/>
<fo:table-column border-right-style="solid" border-right-width="0.13mm" column-width="0.2in"/>
<fo:table-column border-right-style="solid" border-right-width="0.13mm" column-width="0.2in"/>
@@ -1100,7 +1100,7 @@
<fo:block color="black">16.6.2006</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom-style="solid" border-bottom-width="0.5mm" padding-left="2mm" padding-top="4mm" font-size="10pt">
<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="0.5cm"/>
<fo:table-column column-width="2cm"/>
<fo:table-body>

+ 0
- 2
examples/fo/basic/images.fo View File

@@ -31,8 +31,6 @@
odd-or-even="even" />
<fo:conditional-page-master-reference master-reference="right"
odd-or-even="odd" />
<!-- recommended fallback procedure -->
<fo:conditional-page-master-reference master-reference="rest" />
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>

+ 20
- 20
examples/fo/basic/tableunits.fo View File

@@ -67,9 +67,9 @@
<fo:block space-before="12pt" space-after="6pt">The next table has width=100% on the table no column widths specified on the table-column element.</fo:block>
<!-- table start -->
<fo:table border-collapse="separate" table-layout="fixed" width="100%">
<fo:table-column background-color="yellow"/>
<fo:table-column background-color="blue"/>
<fo:table-column background-color="green"/>
<fo:table-column column-width="proportional-column-width(1)" background-color="yellow"/>
<fo:table-column column-width="proportional-column-width(1)" background-color="blue"/>
<fo:table-column column-width="proportional-column-width(1)" background-color="green"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell display-align="before"><fo:block>Some text to make this cell
@@ -83,7 +83,7 @@
<fo:block space-before="12pt" space-after="6pt">The next table has fixed column widths=13cm, ipd.optimum=12cm and ipd.max = 100%.</fo:block>
<!-- table start -->
<fo:table border-collapse="separate"
table-layout="fixed"
table-layout="fixed" width="100%"
inline-progression-dimension="12cm"
inline-progression-dimension.maximum="100%"
>
@@ -122,8 +122,8 @@
<!-- table start -->
<fo:table border-collapse="separate" table-layout="fixed" width="70% + 1cm">
<fo:table-column column-width="from-parent('width') div 3" background-color="yellow"/>
<fo:table-column background-color="blue"/>
<fo:table-column background-color="green"/>
<fo:table-column column-width="proportional-column-width(1)" background-color="blue"/>
<fo:table-column column-width="proportional-column-width(1)" background-color="green"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell display-align="before"><fo:block>Some text to make this cell
@@ -140,11 +140,11 @@
</fo:block>
<!-- table start -->
<fo:table border-collapse="separate"
table-layout="fixed"
table-layout="fixed" width="100%"
inline-progression-dimension="15cm">
<fo:table-column background-color="yellow"/>
<fo:table-column column-width="proportional-column-width(1)" background-color="yellow"/>
<fo:table-column column-width="3cm" background-color="blue"/>
<fo:table-column background-color="green"/>
<fo:table-column column-width="proportional-column-width(1)" background-color="green"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell display-align="before"><fo:block>Some text to make this cell
@@ -159,10 +159,10 @@
The next table specifies neither width nor inline-progression-dimension.
</fo:block>
<!-- table start -->
<fo:table table-layout="fixed" border-collapse="separate">
<fo:table-column background-color="yellow"/>
<fo:table table-layout="fixed" width="100%" border-collapse="separate">
<fo:table-column column-width="proportional-column-width(1)" background-color="yellow"/>
<fo:table-column column-width="3cm" background-color="blue"/>
<fo:table-column background-color="green"/>
<fo:table-column column-width="proportional-column-width(1)" background-color="green"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell display-align="before"><fo:block>Some text to make this cell
@@ -178,11 +178,11 @@
specifies a column width of 5cm on the middle column only.
</fo:block>
<!-- table start -->
<fo:table table-layout="fixed" border-collapse="separate"
<fo:table table-layout="fixed" width="100%" border-collapse="separate"
inline-progression-dimension.minimum="10cm">
<fo:table-column background-color="yellow"/>
<fo:table-column column-width="proportional-column-width(1)" background-color="yellow"/>
<fo:table-column column-width="5cm" background-color="blue"/>
<fo:table-column background-color="green"/>
<fo:table-column column-width="proportional-column-width(1)" background-color="green"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell display-align="before"><fo:block>Some text to make this cell
@@ -194,17 +194,17 @@
</fo:table>

<fo:block space-before="12pt" space-after="6pt">
The next table specifies inline-progression-dimension.minimum="10cm",
inline-progression-dimension.maximum="17cm and
The next table specifies inline-progression-dimension.minimum=&quot;10cm&quot;,
inline-progression-dimension.maximum=&quot;17cm and
specifies a column width of 5cm on the middle column only.
</fo:block>
<!-- table start -->
<fo:table table-layout="fixed" border-collapse="separate"
<fo:table table-layout="fixed" width="100%" border-collapse="separate"
inline-progression-dimension.minimum="10cm"
inline-progression-dimension.maximum="17cm">
<fo:table-column background-color="yellow"/>
<fo:table-column column-width="proportional-column-width(1)" background-color="yellow"/>
<fo:table-column column-width="5cm" background-color="blue"/>
<fo:table-column background-color="green"/>
<fo:table-column column-width="proportional-column-width(1)" background-color="green"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell display-align="before"><fo:block>Some text to make this cell

+ 5
- 0
examples/fo/build.xml View File

@@ -127,6 +127,7 @@
</target>
<!-- =================================================================== -->
<!-- Compares new test pdf files to reference pdf files -->
<!-- N.B. All comparisons fail due to differences in /CreationDate -->
<!-- =================================================================== -->
<target name="comparePDF" depends="newPDF">
<compare referenceDirectory="${referenceDir}" testDirectory="${testDir}" filenames="normal.pdf,table.pdf,list.pdf,link.pdf,border.pdf,images.pdf,extensive.pdf,readme.pdf,fonts.pdf,bordershorthand.pdf,character.pdf,corresprop.pdf,hyphen.pdf,inhprop.pdf,instream.pdf,leader.pdf,newlinktest.pdf,normalex.pdf,pdfoutline.pdf,simple.pdf,textdeko.pdf,tableunits.pdf"/>
@@ -144,6 +145,7 @@

<!-- =================================================================== -->
<!-- Starts the test -->
<!-- N.B. All tests fail due to differences in /CreationDate -->
<!-- =================================================================== -->
<target name="runtest" depends="comparePDF">
<echo message="Running Fop tests"/>
@@ -154,6 +156,9 @@
<target name="clean" depends="init">
<delete dir="${testDir}"/>
</target>
<target name="cleantest" depends="init">
<delete dir="${referenceDir}"/>
</target>

</project>
<!-- End of file -->

+ 2
- 2
examples/fo/svg/embedding.fo View File

@@ -794,7 +794,7 @@ XML Syntax
<fo:block>
Here we have some examples of how the XML can be specified in the fo document.
<fo:block>
<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="350pt"/>
<fo:table-column column-width="150pt"/>
<fo:table-body>
@@ -932,7 +932,7 @@ Sizing
The size of the instream-foreign-object is obtained in a number of ways.

<fo:block>
<fo:table xmlns:svg="http://www.w3.org/2000/svg">
<fo:table xmlns:svg="http://www.w3.org/2000/svg" table-layout="fixed" width="100%">
<fo:table-column column-width="350pt"/>
<fo:table-column column-width="150pt"/>
<fo:table-body>

+ 11
- 11
examples/fo/tables/background.fo View File

@@ -30,7 +30,7 @@
Table 1: cell background
</fo:block>

<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -72,7 +72,7 @@
Table 1: row background
</fo:block>

<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -152,7 +152,7 @@
Table 1: column background
</fo:block>

<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="3cm" background-color="green"/>
<fo:table-column column-width="3cm" background-color="red"/>
<fo:table-column column-width="3cm" background-color="blue"/>
@@ -219,7 +219,7 @@
Table 1: column backgrounds over page
</fo:block>

<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="3cm" background-color="green"/>
<fo:table-column column-width="3cm" background-color="red"/>
<fo:table-column column-width="3cm" background-color="blue"/>
@@ -286,7 +286,7 @@
Table 1: body background
</fo:block>

<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -323,7 +323,7 @@
</fo:table-body>
</fo:table>

<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -360,7 +360,7 @@
</fo:table-body>
</fo:table>

<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -397,7 +397,7 @@
</fo:table-body>
</fo:table>

<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -438,7 +438,7 @@
Table 1: table background
</fo:block>

<fo:table background-color="green">
<fo:table background-color="green" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -475,7 +475,7 @@
</fo:table-body>
</fo:table>

<fo:table background-color="red">
<fo:table background-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -516,7 +516,7 @@
Table 1: combinations
</fo:block>

<fo:table background-color="green">
<fo:table background-color="green" table-layout="fixed" width="100%">
<fo:table-column column-width="2.5cm"/>
<fo:table-column column-width="2.5cm" background-color="green"/>
<fo:table-column column-width="2.5cm" background-color="red"/>

+ 19
- 20
examples/fo/tables/borders.fo View File

@@ -30,7 +30,7 @@
Table 1: cell borders
</fo:block>

<fo:table border-collapse="separate">
<fo:table border-collapse="separate" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -186,7 +186,7 @@
Table 2: row borders
</fo:block>

<fo:table border-collapse="collapse">
<fo:table border-collapse="collapse" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -310,7 +310,7 @@
Table 3: column borders
</fo:block>

<fo:table border-collapse="collapse">
<fo:table border-collapse="collapse" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm" border-left-color="green" border-left-width="0.5pt" border-left-style="solid"/>
<fo:table-column column-width="3cm" border-top-color="red" border-top-width="0.5pt" border-top-style="solid"/>
<fo:table-column column-width="3cm" border-right-color="blue" border-right-width="0.5pt" border-right-style="solid"/>
@@ -377,7 +377,7 @@
Table 4: column borders over page
</fo:block>

<fo:table border-collapse="collapse">
<fo:table border-collapse="collapse" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm" border-left-color="green" border-left-width="0.5pt" border-left-style="solid"/>
<fo:table-column column-width="3cm" border-top-color="red" border-top-width="0.5pt" border-top-style="solid"/>
<fo:table-column column-width="3cm" border-right-color="blue" border-right-width="0.5pt" border-right-style="solid"/>
@@ -444,7 +444,7 @@
Table 5: body borders
</fo:block>

<fo:table border-collapse="separate">
<fo:table border-collapse="separate" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -480,7 +480,7 @@
</fo:table-body>
</fo:table>

<fo:table border-collapse="separate">
<fo:table border-collapse="separate" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -516,7 +516,7 @@
</fo:table-body>
</fo:table>

<fo:table border-collapse="separate">
<fo:table border-collapse="separate" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -552,7 +552,7 @@
</fo:table-body>
</fo:table>

<fo:table border-collapse="separate">
<fo:table border-collapse="separate" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -588,7 +588,7 @@
</fo:table-body>
</fo:table>

<fo:table border-collapse="separate">
<fo:table border-collapse="separate" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -628,8 +628,7 @@
Table 6: table borders
</fo:block>

<fo:table border-left-color="green" border-left-width="0.5pt" border-left-style="solid"
border-collapse="separate">
<fo:table border-left-color="green" border-left-width="0.5pt" border-left-style="solid" border-collapse="separate" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -665,7 +664,7 @@
</fo:table-body>
</fo:table>

<fo:table border-top-color="red" border-top-width="0.5pt" border-top-style="solid" border-collapse="separate">
<fo:table border-top-color="red" border-top-width="0.5pt" border-top-style="solid" border-collapse="separate" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -701,7 +700,7 @@
</fo:table-body>
</fo:table>

<fo:table border-right-color="blue" border-right-width="0.5pt" border-right-style="solid" border-collapse="separate">
<fo:table border-right-color="blue" border-right-width="0.5pt" border-right-style="solid" border-collapse="separate" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -737,7 +736,7 @@
</fo:table-body>
</fo:table>

<fo:table border-bottom-color="yellow" border-bottom-width="0.5pt" border-bottom-style="solid" border-collapse="separate">
<fo:table border-bottom-color="yellow" border-bottom-width="0.5pt" border-bottom-style="solid" border-collapse="separate" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -773,7 +772,7 @@
</fo:table-body>
</fo:table>

<fo:table border-color="orange" border-width="0.5pt" border-style="solid" border-collapse="separate">
<fo:table border-color="orange" border-width="0.5pt" border-style="solid" border-collapse="separate" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -813,7 +812,7 @@
Table 7: combinations
</fo:block>

<fo:table border-left-color="green" border-left-width="0.5pt" border-left-style="solid" border-collapse="collapse">
<fo:table border-left-color="green" border-left-width="0.5pt" border-left-style="solid" border-collapse="collapse" table-layout="fixed" width="100%">
<fo:table-column column-width="2.5cm"/>
<fo:table-column column-width="2.5cm" border-left-color="green" border-left-width="0.5pt" border-left-style="solid"/>
<fo:table-column column-width="2.5cm" border-top-color="red" border-top-width="0.5pt" border-top-style="solid"/>
@@ -1025,7 +1024,7 @@
implementation status.
</fo:block>

<fo:table border-collapse="collapse" table-layout="fixed">
<fo:table border-collapse="collapse" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm" border-color="blue" border-width="0.5pt" border-style="solid"/>
<fo:table-column column-width="3cm" border-color="blue" border-width="0.5pt" border-style="solid"/>
<fo:table-column column-width="3cm" border-color="blue" border-width="0.5pt" border-style="solid"/>
@@ -1090,7 +1089,7 @@
fo:table-cell level.
</fo:block>

<fo:table border-collapse="collapse" table-layout="fixed">
<fo:table border-collapse="collapse" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -1159,7 +1158,7 @@
Check the FOP compliance page for current implementation status.
</fo:block>

<fo:table border-collapse="collapse" table-layout="fixed"
<fo:table border-collapse="collapse" table-layout="fixed" width="100%"
border-style="solid" border-width="5pt" border-color="yellow">
<fo:table-column column-width="3cm"
border-style="solid" border-width="3pt" border-color="black"/>
@@ -1264,7 +1263,7 @@
the border properties differ only on color.
</fo:block>

<fo:table border-collapse="collapse" table-layout="fixed">
<fo:table border-collapse="collapse" table-layout="fixed" width="100%">

<fo:table-column column-width="3cm"
border-style="solid" border-width="3pt" border-color="black"/>

+ 5
- 5
examples/fo/tables/break.fo View File

@@ -34,7 +34,7 @@
Table 1: basic break after with next
</fo:block>

<fo:table border-width="0.5pt" border-color="red">
<fo:table border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -81,7 +81,7 @@
Table 2: basic break before with next
</fo:block>

<fo:table border-width="0.5pt" border-color="red">
<fo:table border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -128,7 +128,7 @@
Table 3: basic break before a keep with next
</fo:block>

<fo:table border-width="0.5pt" border-color="red">
<fo:table border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -175,7 +175,7 @@
Table 4: basic break after a keep with previous
</fo:block>

<fo:table border-width="0.5pt" border-color="red">
<fo:table border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -222,7 +222,7 @@
Table 5: basic break after a keep with previous
</fo:block>

<fo:table border-width="0.5pt" border-color="red">
<fo:table border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>

+ 7
- 7
examples/fo/tables/headfoot.fo View File

@@ -30,7 +30,7 @@
Table 1: with header
</fo:block>

<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
@@ -311,7 +311,7 @@
Table 2: with footer
</fo:block>

<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
@@ -592,7 +592,7 @@
Table 3: with header and footer and keeps
</fo:block>

<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
@@ -888,7 +888,7 @@
Table 4: cells spanning columns
</fo:block>

<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
@@ -940,7 +940,7 @@
Table 5: cells spanning rows
</fo:block>

<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="48pt"/>
<fo:table-column column-width="48pt"/>
<fo:table-column column-width="48pt"/>
@@ -1054,7 +1054,7 @@
Table 6: table with header and multiple body's
</fo:block>

<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
@@ -1242,7 +1242,7 @@
Table 6: table with footer and multiple body's
</fo:block>

<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>

+ 6
- 6
examples/fo/tables/keep.fo View File

@@ -34,7 +34,7 @@
Table 1: basic keep with next
</fo:block>

<fo:table border-width="0.5pt" border-color="red">
<fo:table border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -81,7 +81,7 @@
Table 1: basic keep with previous
</fo:block>

<fo:table border-width="0.5pt" border-color="red">
<fo:table border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -128,7 +128,7 @@
Table 1: basic keep with next and keep with previous
</fo:block>

<fo:table border-width="0.5pt" border-color="red">
<fo:table border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -192,7 +192,7 @@
Table 1: basic multiple keep with next after normal row
</fo:block>

<fo:table border-width="0.5pt" border-color="red">
<fo:table border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -324,7 +324,7 @@
Table 1: basic multiple keep (next and previous) after normal row
</fo:block>

<fo:table border-width="0.5pt" border-color="red">
<fo:table border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="6cm"/>
@@ -456,7 +456,7 @@
Table 1: basic multiple keep with next after normal row with normal row in middle
</fo:block>

<fo:table border-width="0.5pt" border-color="red">
<fo:table border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="6cm"/>

+ 5
- 5
examples/fo/tables/omit.fo View File

@@ -30,7 +30,7 @@
Table 1: with header
</fo:block>

<fo:table table-omit-header-at-break="true">
<fo:table table-omit-header-at-break="true" table-layout="fixed" width="100%">
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
@@ -311,7 +311,7 @@
Table 2: with footer
</fo:block>

<fo:table table-omit-footer-at-break="true">
<fo:table table-omit-footer-at-break="true" table-layout="fixed" width="100%">
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
@@ -592,7 +592,7 @@
Table 3: with header and footer and keeps
</fo:block>

<fo:table table-omit-header-at-break="true" table-omit-footer-at-break="true">
<fo:table table-omit-header-at-break="true" table-omit-footer-at-break="true" table-layout="fixed" width="100%">
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
@@ -888,7 +888,7 @@
Table 6: table with multiple body's
</fo:block>

<fo:table table-omit-header-at-break="true">
<fo:table table-omit-header-at-break="true" table-layout="fixed" width="100%">
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
@@ -1076,7 +1076,7 @@
Table 6: table with multiple body's
</fo:block>

<fo:table table-omit-footer-at-break="true">
<fo:table table-omit-footer-at-break="true" table-layout="fixed" width="100%">
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>
<fo:table-column column-width="2cm"/>

+ 9
- 9
examples/fo/tables/space.fo View File

@@ -30,7 +30,7 @@
Table 1: spaces around cells
</fo:block>

<fo:table border-style="solid" border-width="0.5pt" border-color="red">
<fo:table border-style="solid" border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -109,7 +109,7 @@
Table 2: spaces around rows
</fo:block>

<fo:table border-style="solid" border-width="0.5pt" border-color="red">
<fo:table border-style="solid" border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -190,7 +190,7 @@
Table 3: spaces around body
</fo:block>

<fo:table border-style="solid" border-width="0.5pt" border-color="red">
<fo:table border-style="solid" border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -281,7 +281,7 @@
</fo:block>

<fo:block border-style="solid" border-width="0.5pt">
<fo:table space-before.optimum="5pt" border-style="solid" border-width="0.5pt" border-color="red">
<fo:table space-before.optimum="5pt" border-style="solid" border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -309,7 +309,7 @@
</fo:block>

<fo:block border-style="solid" border-width="0.5pt">
<fo:table padding-left="5pt" border-style="solid" border-width="0.5pt" border-color="red">
<fo:table padding-left="5pt" border-style="solid" border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -337,7 +337,7 @@
</fo:block>

<fo:block border-style="solid" border-width="0.5pt">
<fo:table padding-right="5pt" border-style="solid" border-width="0.5pt" border-color="red">
<fo:table padding-right="5pt" border-style="solid" border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -365,7 +365,7 @@
</fo:block>

<fo:block border-style="solid" border-width="0.5pt">
<fo:table space-after.optimum="5pt" border-style="solid" border-width="0.5pt" border-color="red">
<fo:table space-after.optimum="5pt" border-style="solid" border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -397,7 +397,7 @@
</fo:block>

<fo:block border-style="solid" border-width="0.5pt">
<fo:table space-after.optimum="20pt" border-style="solid" border-width="0.5pt" border-color="red">
<fo:table space-after.optimum="20pt" border-style="solid" border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
@@ -462,7 +462,7 @@
</fo:block>

<fo:block border-style="solid" border-width="0.5pt">
<fo:table space-after.optimum="5pt" border-style="solid" border-width="0.5pt" border-color="red">
<fo:table space-after.optimum="5pt" border-style="solid" border-width="0.5pt" border-color="red" table-layout="fixed" width="100%">
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>
<fo:table-column column-width="3cm"/>

+ 46
- 5
findbugs-exclude.xml View File

@@ -1,5 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<FindBugsFilter>
<Match>
<Class name="org.apache.fop.fonts.truetype.TTFFile$1"/>
<Bug pattern="SIC_INNER_SHOULD_BE_STATIC_ANON"/>
</Match>
<Match>
<Class name="org.apache.fop.fonts.truetype.FontFileReader"/>
<Method name="getAllBytes"/>
<Bug pattern="EI_EXPOSE_REP"/>
</Match>
<Match>
<Class name="org.apache.fop.fo.properties.FontFamilyProperty"/>
<Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
@@ -949,11 +958,6 @@
<Method name="getInputStreamOnFont"/>
<Bug pattern="RV_EXCEPTION_NOT_THROWN"/>
</Match>
<Match>
<Class name="org.apache.fop.hyphenation.HyphenationTreeCache"/>
<Method name="constructUserKey"/>
<Bug pattern="RV_RETURN_VALUE_IGNORED"/>
</Match>
<Match>
<Class name="org.apache.fop.afp.AFPResourceLevel"/>
<Method name="equals"/>
@@ -5162,4 +5166,41 @@
<Method name="getNonEmptyLevels"/>
<Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
</Match>
<Match>
<Class name="org.apache.fop.render.pdf.AbstractImageAdapter"/>
<Method name="populateXObjectDictionaryForIndexColorModel"/>
<Bug pattern="OS_OPEN_STREAM"/>
</Match>
<Match>
<Class name="org.apache.fop.render.pdf.ImageRawPNGAdapter"/>
<Or>
<Method name="outputContents"/>
<Method name="setup"/>
</Or>
<Or>
<Bug pattern="OS_OPEN_STREAM"/>
<Bug pattern="OS_OPEN_STREAM_EXCEPTION_PATH"/>
</Or>
</Match>
<Match>
<Class name="org.apache.fop.render.ps.ImageEncoderPNG"/>
<Method name="writeTo"/>
<Bug pattern="OS_OPEN_STREAM"/>
</Match>
<Match>
<Or>
<Class name="org.apache.fop.render.pdf.PDFImageHandlerRawPNG"/>
<Class name="org.apache.fop.render.ps.PSImageHandlerRawPNG"/>
</Or>
<Method name="getSupportedImageFlavors"/>
<Bug pattern="EI_EXPOSE_REP"/>
</Match>
<Match>
<Class name="org.apache.fop.render.ps.PSImageHandlerRawPNG"/>
<Or>
<Method name="handleImage"/>
<Method name="generateForm"/>
</Or>
<Bug pattern="BC_UNCONFIRMED_CAST"/>
</Match>
</FindBugsFilter>

BIN
lib/xmlgraphics-commons-1.5svn.jar View File


+ 5
- 5
src/documentation/content/xdocs/examples.xml View File

@@ -39,7 +39,7 @@
<tr>
<td>default font characters</td>
<td><link href="fo/fonts.fo">fonts.fo</link></td>
<td><link href="fo/fonts.fo.pdf">fonts.fo.pdf</link></td>
<td><link href="fo/fonts.pdf">fonts.pdf</link></td>
</tr>
</table>
<p>Other basic examples on the use of XSL-FO can be found in the FOP distribution in
@@ -100,17 +100,17 @@ Embedding images in FO:
<tr>
<td>align in larger viewport</td>
<td><link href="fo/align.fo">align.fo</link></td>
<td><link href="fo/align.fo.pdf">align.fo.pdf</link></td>
<td><link href="fo/align.pdf">align.pdf</link></td>
</tr>
<tr>
<td>align in smaller viewport</td>
<td><link href="fo/align2.fo">align2.fo</link></td>
<td><link href="fo/align2.fo.pdf">align2.fo.pdf</link></td>
<td><link href="fo/align2.pdf">align2.pdf</link></td>
</tr>
<tr>
<td>scaling image</td>
<td><link href="fo/size.fo">size.fo</link></td>
<td><link href="fo/size.fo.pdf">size.fo.pdf</link></td>
<td><link href="fo/size.pdf">size.pdf</link></td>
</tr>
</table>
<p>Look also into the directory examples/fo/svg. There you find some very extensive SVG examples.
@@ -132,7 +132,7 @@ Instream Foreign Object images in FO, there are more on the
<tr>
<td>embedding svg in viewport</td>
<td><link href="fo/embed.fo">embed.fo</link></td>
<td><link href="fo/embed.fo.pdf">embed.fo.pdf</link></td>
<td><link href="fo/embed.pdf">embed.pdf</link></td>
</tr>
</table>
</section>

+ 12
- 13
src/documentation/content/xdocs/fo/align.fo View File

@@ -19,19 +19,18 @@
<fo:root font-family="Times Roman" font-size="12pt" text-align="center" xmlns:fo="http://www.w3.org/1999/XSL/Format">

<fo:layout-master-set>
<fo:simple-page-master
margin-right="1.5cm"
margin-left="1.5cm"
margin-bottom="2cm"
margin-top="1cm"
page-width="21cm"
page-height="29.7cm"
master-name="left">
<fo:region-before extent="1cm"/>
<fo:region-body margin-top="1cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>

<fo:simple-page-master
margin-right="1.5cm"
margin-left="1.5cm"
margin-bottom="2cm"
margin-top="1cm"
page-width="21cm"
page-height="29.7cm"
master-name="left">
<fo:region-body margin-top="1cm"/>
<fo:region-before extent="1cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>

<fo:page-sequence id="N2528" master-reference="left">

BIN
src/documentation/content/xdocs/fo/align.fo.pdf View File


BIN
src/documentation/content/xdocs/fo/align.pdf View File


+ 13
- 14
src/documentation/content/xdocs/fo/align2.fo View File

@@ -19,19 +19,18 @@
<fo:root font-family="Times Roman" font-size="12pt" text-align="center" xmlns:fo="http://www.w3.org/1999/XSL/Format">

<fo:layout-master-set>
<fo:simple-page-master
margin-right="1.5cm"
margin-left="1.5cm"
margin-bottom="2cm"
margin-top="1cm"
page-width="21cm"
page-height="29.7cm"
master-name="left">
<fo:region-before extent="1cm"/>
<fo:region-body margin-top="1cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>

<fo:simple-page-master
margin-right="1.5cm"
margin-left="1.5cm"
margin-bottom="2cm"
margin-top="1cm"
page-width="21cm"
page-height="29.7cm"
master-name="left">
<fo:region-body margin-top="1cm"/>
<fo:region-before extent="1cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>

<fo:page-sequence id="N2528" master-reference="left">
@@ -59,7 +58,7 @@ Default align:
<fo:block>
Default align:
(<fo:external-graphic width="50pt" height="50pt" overflow="hidden" src="images/fop.jpg"/>), start-before
(<fo:external-graphic width="50pt" height="50pt" overflow="hidden" text-align="start" display-align="start" src="images/fop.jpg"/>), start-center
(<fo:external-graphic width="50pt" height="50pt" overflow="hidden" text-align="start" display-align="before" src="images/fop.jpg"/>), start-center
(<fo:external-graphic width="50pt" height="50pt" overflow="hidden" text-align="start" display-align="center" src="images/fop.jpg"/>), start-after
(<fo:external-graphic width="50pt" height="50pt" overflow="hidden" text-align="start" display-align="after" src="images/fop.jpg"/>), center-before
(<fo:external-graphic width="50pt" height="50pt" overflow="hidden" text-align="center" display-align="before" src="images/fop.jpg"/>), center-after

BIN
src/documentation/content/xdocs/fo/align2.fo.pdf View File


BIN
src/documentation/content/xdocs/fo/align2.pdf View File


+ 70
- 0
src/documentation/content/xdocs/fo/build.xml View File

@@ -0,0 +1,70 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<!-- =========================================================================== -->
<project default="newPDF" basedir=".">
<!-- =================================================================== -->
<!-- Initialization target -->
<!-- =================================================================== -->
<target name="init">
<tstamp/>
<mkdir dir="tests"/>
<property name="testDir" value="tests"/>
<property name="foDir" value="."/>
<path id="run-classpath">
<fileset dir="../../../../../lib">
<include name="*.jar"/>
</fileset>
<pathelement location="../../../../../build/fop.jar"/>
</path>
<taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop" classpathref="run-classpath"/>
</target>
<!-- =================================================================== -->
<!-- Help on usage -->
<!-- =================================================================== -->
<target name="usage">
<echo message="Use '-projecthelp' instead"/>
</target>
<!-- =================================================================== -->
<!-- Produces new test files (function) -->
<!-- =================================================================== -->
<target name="newTestFiles">
<fop format="${mimetype}" outdir="${outDir}" messagelevel="${msglevel}" relativebase="true" throwexceptions="false">
<fileset dir=".">
<include name="**/*.fo"/>
</fileset>
</fop>
</target>
<!-- =================================================================== -->
<!-- Produces new test PDF files -->
<!-- =================================================================== -->
<target name="newPDF" depends="init" description="Creates a new set of PDF test files">
<antcall target="newTestFiles">
<param name="mimetype" value="application/pdf"/>
<param name="msglevel" value="warn"/>
<param name="outDir" value="${testDir}"/>
</antcall>
</target>
<!-- =================================================================== -->
<!-- Clean targets -->
<!-- =================================================================== -->
<target name="clean" depends="init">
<delete dir="${testDir}"/>
</target>

</project>
<!-- End of file -->

+ 12
- 13
src/documentation/content/xdocs/fo/embed.fo View File

@@ -23,19 +23,18 @@
<fo:root font-family="Times Roman" font-size="12pt" xmlns:fo="http://www.w3.org/1999/XSL/Format">

<fo:layout-master-set>
<fo:simple-page-master
margin-right="1.5cm"
margin-left="1.5cm"
margin-bottom="2cm"
margin-top="1cm"
page-width="21cm"
page-height="29.7cm"
master-name="left">
<fo:region-before extent="1cm"/>
<fo:region-body margin-top="1cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>

<fo:simple-page-master
margin-right="1.5cm"
margin-left="1.5cm"
margin-bottom="2cm"
margin-top="1cm"
page-width="21cm"
page-height="29.7cm"
master-name="left">
<fo:region-body margin-top="1cm"/>
<fo:region-before extent="1cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>

<fo:page-sequence id="N2528" master-reference="left">

+ 0
- 87
src/documentation/content/xdocs/fo/embed.fo.pdf View File

@@ -1,87 +0,0 @@
%PDF-1.3
%ª«¬­
4 0 obj
<< /Type /Info
/Producer (FOP 0.20.5) >>
endobj
5 0 obj
<< /Length 1556 /Filter [ /ASCII85Decode /FlateDecode ]
>>
stream
Gb"0W9p=9h(^KQB5D>011Kd^2(:&!s-8.0G?92NC6am<+$Zp"a8L^3ZrE?Z%8B:u_OFn)DOGr-/INIQ=q\oZh2p:3YpSJW^j5k;[E4:*BGe#CoakN"mYH!sFZ8>$).@Y@g/-!,+\,3geIX]sgn&ks8h-P:I5CJ>(?M<peVjI(+?b[S@pZ8%/ns@)HU2Lio<0CtCPX[Q)8_(<FftM:sit[&L*Ob:OKat[.EkI%ON)unFn92KJrG.J!cH<PB*A9Y6q24X,`S^&S[!UEIh+u"#V93'eZc#bITL93O^P^p,I3BHrmbEFVPF$aP[Jemg]0^JG[GBF4ZUN[?=KSW(*k#W!J+1'Bh;+g]["$p!rMJIh;uH?[:#+dG<U]5@$Jf'eIGN8iGJ0k>3srEp%+j`GFC2lVAW?-k]'A%*A+X0,Y&n>gXrgJRd8etuL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< /Type /Page
/Parent 1 0 R
/MediaBox [ 0 0 595 842 ]
/Resources 3 0 R
/Contents 7 0 R
>>
endobj
9 0 obj
<< /Type /Font
/Subtype /Type1
/Name /F5
/BaseFont /Times-Roman
/Encoding /WinAnsiEncoding >>
endobj
10 0 obj
<< /Type /Font
/Subtype /Type1
/Name /F7
/BaseFont /Times-Bold
/Encoding /WinAnsiEncoding >>
endobj
1 0 obj
<< /Type /Pages
/Count 2
/Kids [6 0 R 8 0 R ] >>
endobj
2 0 obj
<< /Type /Catalog
/Pages 1 0 R
>>
endobj
3 0 obj
<<
/Font << /F5 9 0 R /F7 10 0 R >>
/ProcSet [ /PDF /ImageC /Text ] >>
endobj
xref
0 11
0000000000 65535 f
0000004058 00000 n
0000004122 00000 n
0000004172 00000 n
0000000015 00000 n
0000000071 00000 n
0000001719 00000 n
0000001825 00000 n
0000003734 00000 n
0000003840 00000 n
0000003949 00000 n
trailer
<<
/Size 11
/Root 2 0 R
/Info 4 0 R
>>
startxref
4261
%%EOF

BIN
src/documentation/content/xdocs/fo/embed.pdf View File


+ 24
- 24
src/documentation/content/xdocs/fo/fonts.fo View File

@@ -18,32 +18,32 @@
<!-- $Id$ -->
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

<!-- defines the layout master -->
<fo:layout-master-set>
<fo:simple-page-master master-name="first"
page-height="29.7cm"
page-width="21cm"
margin-top="1cm"
margin-bottom="2cm"
margin-left="2.5cm"
margin-right="2.5cm">
<fo:region-body margin-top="1cm"/>
<fo:region-before extent="1cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>

<!-- starts actual layout -->
<fo:page-sequence master-reference="first">
<!-- defines the layout master -->
<fo:layout-master-set>
<fo:simple-page-master
master-name="first"
page-height="29.7cm"
page-width="21cm"
margin-top="1cm"
margin-bottom="2cm"
margin-left="2.5cm"
margin-right="2.5cm">
<fo:region-body margin-top="1cm"/>
<fo:region-before extent="1cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>

<!-- starts actual layout -->
<fo:page-sequence master-reference="first">

<fo:flow flow-name="xsl-region-body">

<fo:block font-family="Helvetica" font-size="14pt">
<fo:block font-family="Helvetica" font-size="14pt">
Helvetica
</fo:block>
<fo:block space-after.optimum="10pt" font-family="Helvetica" font-size="10pt">
<fo:table>
<fo:block space-after.optimum="10pt" font-family="Helvetica" font-size="10pt">
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="65pt"/>
<fo:table-column column-width="30pt"/>
<fo:table-column column-width="65pt"/>
@@ -303,7 +303,7 @@ Helvetica
Times Roman
</fo:block>
<fo:block space-after.optimum="10pt" font-family="Times Roman" font-size="10pt">
<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="65pt"/>
<fo:table-column column-width="30pt"/>
<fo:table-column column-width="65pt"/>
@@ -563,7 +563,7 @@ Times Roman
Courier
</fo:block>
<fo:block space-after.optimum="10pt" font-family="Courier" font-size="10pt">
<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="65pt"/>
<fo:table-column column-width="30pt"/>
<fo:table-column column-width="65pt"/>
@@ -823,7 +823,7 @@ Courier
ZapfDingbats:
</fo:block>
<fo:block space-after.optimum="10pt" font-family="ZapfDingbats" font-size="10pt">
<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="65pt"/>
<fo:table-column column-width="30pt"/>
<fo:table-column column-width="65pt"/>
@@ -1071,7 +1071,7 @@ Courier
Symbol:
</fo:block>
<fo:block space-after.optimum="10pt" font-family="Symbol" font-size="10pt">
<fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="65pt"/>
<fo:table-column column-width="30pt"/>
<fo:table-column column-width="65pt"/>

+ 0
- 160
src/documentation/content/xdocs/fo/fonts.fo.pdf View File

@@ -1,160 +0,0 @@
%PDF-1.4
%ª«¬­
4 0 obj
<< /Type /Info
/Producer (FOP 0.20.5) >>
endobj
5 0 obj
<< /Length 2756 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type1
/Name /F5
/BaseFont /Times-Roman
/Encoding /WinAnsiEncoding >>
endobj
17 0 obj
<< /Type /Font
/Subtype /Type1
/Name /F13
/BaseFont /Symbol >>
endobj
18 0 obj
<< /Type /Font
/Subtype /Type1
/Name /F1
/BaseFont /Helvetica
/Encoding /WinAnsiEncoding >>
endobj
19 0 obj
<< /Type /Font
/Subtype /Type1
/Name /F9
/BaseFont /Courier
/Encoding /WinAnsiEncoding >>
endobj
1 0 obj
<< /Type /Pages
/Count 5
/Kids [6 0 R 8 0 R 10 0 R 12 0 R 14 0 R ] >>
endobj
2 0 obj
<< /Type /Catalog
/Pages 1 0 R
>>
endobj
3 0 obj
<<
/Font << /F5 16 0 R /F14 15 0 R /F13 17 0 R /F1 18 0 R /F9 19 0 R >>
/ProcSet [ /PDF /ImageB /ImageC /Text ] >>
endobj
xref
0 20
0000000000 65535 f
0000016170 00000 n
0000016255 00000 n
0000016305 00000 n
0000000015 00000 n
0000000071 00000 n
0000002919 00000 n
0000003025 00000 n
0000006052 00000 n
0000006158 00000 n
0000010053 00000 n
0000010160 00000 n
0000013878 00000 n
0000013986 00000 n
0000015574 00000 n
0000015682 00000 n
0000015767 00000 n
0000015877 00000 n
0000015956 00000 n
0000016064 00000 n
trailer
<<
/Size 20
/Root 2 0 R
/Info 4 0 R
>>
startxref
16438
%%EOF

BIN
src/documentation/content/xdocs/fo/fonts.pdf View File


+ 12
- 13
src/documentation/content/xdocs/fo/size.fo View File

@@ -19,19 +19,18 @@
<fo:root font-family="Times Roman" font-size="12pt" xmlns:fo="http://www.w3.org/1999/XSL/Format">

<fo:layout-master-set>
<fo:simple-page-master
margin-right="1.5cm"
margin-left="1.5cm"
margin-bottom="2cm"
margin-top="1cm"
page-width="21cm"
page-height="29.7cm"
master-name="left">
<fo:region-before extent="0.5cm"/>
<fo:region-body margin-top="0.5cm" margin-bottom="1.7cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>

<fo:simple-page-master
margin-right="1.5cm"
margin-left="1.5cm"
margin-bottom="2cm"
margin-top="1cm"
page-width="21cm"
page-height="29.7cm"
master-name="left">
<fo:region-body margin-top="0.5cm" margin-bottom="1.7cm"/>
<fo:region-before extent="0.5cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>

<fo:page-sequence id="N2528" master-reference="left">

BIN
src/documentation/content/xdocs/fo/size.fo.pdf View File


BIN
src/documentation/content/xdocs/fo/size.pdf View File


+ 18
- 0
src/documentation/content/xdocs/trunk/configuration.xml View File

@@ -281,6 +281,24 @@
treated as zero penalty in most cases. For more details on the image loading framework,
please consult the documentation there.
</p>
<p>
The ImageLoaderPNG and ImageLoaderRawPNG have a hard-coded penalty of 1000 and as such the
ImageLoaderImageIO image loader will be selected by default when loading PNGs unless
the latter is disabled by awarding a INFINITE penalty to it, or one of the former two is
promoted by awarding a strong negative penalty (say, -10000) to it.
</p>
<source><![CDATA[<fop version="1.0">
[..]
<image-loading>
<penalty value="-10000"
class="org.apache.xmlgraphics.image.loader.impl.ImageLoaderRawPNG"/>
<penalty value="INFINITE"
class="org.apache.xmlgraphics.image.loader.impl.ImageLoaderPNG"/>
<penalty value="INFINITE"
class="org.apache.xmlgraphics.image.loader.impl.imageio.ImageLoaderImageIO"/>
</image-loading>
<renderers....
</fop>]]></source>
</section>
<section id="renderers">
<title>Renderer configuration</title>

+ 5
- 5
src/documentation/content/xdocs/trunk/fonts.xml View File

@@ -493,10 +493,10 @@
Various notes related to embedded fonts:
</p>
<ul>
<li>The PostScript renderer does not yet support TrueType fonts, but can embed Type 1 fonts.</li>
<li>The font is simply embedded into the PDF file, it is not converted.</li>
<li>When FOP embeds a font, it adds a prefix to the fontname to ensure that the name will not match the fontname of an installed font.
This is helpful with older versions of Acrobat Reader that preferred installed fonts over embedded fonts.</li>
<li>The font is simply embedded into the output file, it is not converted.</li>
<li>When FOP embeds a font in a PDF file, it adds a prefix to the fontname to ensure that
the name will not match the fontname of an installed font. This is helpful with older
versions of Acrobat Reader that preferred installed fonts over embedded fonts.</li>
<li>When embedding PostScript fonts, the entire font is always embedded.</li>
<li>When embedding TrueType fonts (ttf) or TrueType Collections (ttc), a subset of the
original font, containing only the glyphs used, is embedded in the output document.
@@ -576,4 +576,4 @@
</p>
</section>
</body>
</document>
</document>

+ 8
- 5
src/documentation/content/xdocs/trunk/graphics.xml View File

@@ -108,7 +108,7 @@
<tr>
<td><a href="#png">PNG</a> (Portable Network Graphic)</td>
<td>bitmap</td>
<td/>
<td>(X)</td>
<td/>
<td>X</td>
</tr>
@@ -217,8 +217,8 @@
</tr>
<tr>
<td><a href="#png">PNG</a> (Portable Network Graphic)</td>
<td>X</td>
<td>X</td>
<td>X [2]</td>
<td>X [2]</td>
<td>X</td>
<td>X</td>
<td>X</td>
@@ -383,8 +383,11 @@
<section id="png">
<title>PNG</title>
<p>
PNG images are supported through an Image&amp;nbsp;I/O codec. Transparency is supported but
not guaranteed to work with every output format.
FOP native support of PNG only includes the variants with 8 bits per channel and without
interlacing. Native support requires using the ImageLoaderRawPNG image loader.
Support through a Image I/O codec can use either the internal XGC PNG codec or the JRE PNG
codec. The associated image loaders are, respectively, ImageLoaderPNG and ImageLoaderImageIO.
Transparency is supported but not guaranteed to work with every output format.
</p>
</section>
<section id="svg">

+ 1
- 0
src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd View File

@@ -34,6 +34,7 @@
<xs:element ref="mf:page-sequence" minOccurs="1" maxOccurs="unbounded"/>
<xs:element ref="mf:trailer"/>
</xs:sequence>
<xs:attribute name="version" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="header">

+ 2
- 0
src/java/META-INF/services/org.apache.fop.render.ImageHandler View File

@@ -1,6 +1,7 @@
org.apache.fop.render.pdf.PDFImageHandlerGraphics2D
org.apache.fop.render.pdf.PDFImageHandlerRenderedImage
org.apache.fop.render.pdf.PDFImageHandlerRawJPEG
org.apache.fop.render.pdf.PDFImageHandlerRawPNG
org.apache.fop.render.pdf.PDFImageHandlerRawCCITTFax
org.apache.fop.render.pdf.PDFImageHandlerSVG
org.apache.fop.render.java2d.Java2DImageHandlerRenderedImage
@@ -11,6 +12,7 @@ org.apache.fop.render.ps.PSImageHandlerRenderedImage
org.apache.fop.render.ps.PSImageHandlerEPS
org.apache.fop.render.ps.PSImageHandlerRawCCITTFax
org.apache.fop.render.ps.PSImageHandlerRawJPEG
org.apache.fop.render.ps.PSImageHandlerRawPNG
org.apache.fop.render.ps.PSImageHandlerGraphics2D
org.apache.fop.render.ps.PSImageHandlerSVG
org.apache.fop.render.afp.AFPImageHandlerRenderedImage

+ 6
- 0
src/java/org/apache/fop/accessibility/Accessibility.java View File

@@ -28,6 +28,12 @@ public final class Accessibility {
/** Constant string for the rendering options key to enable accessibility features. */
public static final String ACCESSIBILITY = "accessibility";

/**
* The value to be set on the 'role' property for the element and its descendants to
* be considered as artifacts.
*/
public static final String ROLE_ARTIFACT = "artifact";

private Accessibility() { }

}

+ 25
- 0
src/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java View File

@@ -23,6 +23,7 @@ import java.util.Stack;

import org.xml.sax.SAXException;

import org.apache.fop.accessibility.Accessibility;
import org.apache.fop.accessibility.StructureTreeEventHandler;
import org.apache.fop.fo.DelegatingFOEventHandler;
import org.apache.fop.fo.FOEventHandler;
@@ -57,6 +58,8 @@ import org.apache.fop.fo.pagination.Flow;
import org.apache.fop.fo.pagination.PageSequence;
import org.apache.fop.fo.pagination.Root;
import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAccessibilityHolder;

/**
* Allows to create the structure tree of an FO document, by converting FO
@@ -355,6 +358,7 @@ public class FO2StructureTreeConverter extends DelegatingFOEventHandler {

@Override
public void startStatic(StaticContent staticContent) {
handleStartArtifact(staticContent);
converter.startStatic(staticContent);
super.startStatic(staticContent);
}
@@ -362,6 +366,7 @@ public class FO2StructureTreeConverter extends DelegatingFOEventHandler {
@Override
public void endStatic(StaticContent statisContent) {
converter.endStatic(statisContent);
handleEndArtifact(statisContent);
super.endStatic(statisContent);
}

@@ -454,6 +459,7 @@ public class FO2StructureTreeConverter extends DelegatingFOEventHandler {

@Override
public void startWrapper(Wrapper wrapper) {
handleStartArtifact(wrapper);
converter.startWrapper(wrapper);
super.startWrapper(wrapper);
}
@@ -461,6 +467,7 @@ public class FO2StructureTreeConverter extends DelegatingFOEventHandler {
@Override
public void endWrapper(Wrapper wrapper) {
converter.endWrapper(wrapper);
handleEndArtifact(wrapper);
super.endWrapper(wrapper);
}

@@ -488,4 +495,22 @@ public class FO2StructureTreeConverter extends DelegatingFOEventHandler {
super.endExternalDocument(document);
}

private void handleStartArtifact(CommonAccessibilityHolder fobj) {
if (isArtifact(fobj)) {
converters.push(converter);
converter = eventSwallower;
}
}

private void handleEndArtifact(CommonAccessibilityHolder fobj) {
if (isArtifact(fobj)) {
converter = converters.pop();
}
}

private boolean isArtifact(CommonAccessibilityHolder fobj) {
CommonAccessibility accessibility = fobj.getCommonAccessibility();
return Accessibility.ROLE_ARTIFACT.equalsIgnoreCase(accessibility.getRole());
}

}

+ 2
- 2
src/java/org/apache/fop/afp/AFPGraphics2D.java View File

@@ -67,7 +67,7 @@ import org.apache.fop.svg.NativeImageHandler;

/**
* This is a concrete implementation of {@link AbstractGraphics2D} (and
* therefore of {@link Graphics2D}) which is able to generate GOCA byte
* therefore of {@link java.awt.Graphics2D}) which is able to generate GOCA byte
* codes.
*
* @see org.apache.xmlgraphics.java2d.AbstractGraphics2D
@@ -165,7 +165,7 @@ public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHand
}

/**
* Returns the AFP resource manager associated with this {@link Graphics2D} instance.
* Returns the AFP resource manager associated with this {@link java.awt.Graphics2D} instance.
* @return the resource manager
*/
public AFPResourceManager getResourceManager() {

+ 4
- 2
src/java/org/apache/fop/afp/modca/ImageObject.java View File

@@ -119,7 +119,8 @@ public class ImageObject extends AbstractDataObject {
* Sets the image IDE color model.
*
* @param colorModel the IDE color model.
* @deprecated Use {@link IDEStructureParameter#setColorModel(byte)} instead.
* @deprecated Use {@link org.apache.fop.afp.ioca.IDEStructureParameter#setColorModel(byte)}
* instead.
*/
public void setIDEColorModel(byte colorModel) {
getImageSegment().setIDEColorModel(colorModel);
@@ -128,7 +129,8 @@ public class ImageObject extends AbstractDataObject {
/**
* Set either additive or subtractive mode (used for ASFLAG).
* @param subtractive true for subtractive mode, false for additive mode
* @deprecated Use {@link IDEStructureParameter#setSubtractive(boolean)} instead.
* @deprecated Use {@link org.apache.fop.afp.ioca.IDEStructureParameter#setSubtractive(boolean)}
* instead.
*/
public void setSubtractive(boolean subtractive) {
getImageSegment().setSubtractive(subtractive);

+ 1
- 1
src/java/org/apache/fop/afp/modca/PresentationTextData.java View File

@@ -46,7 +46,7 @@ import org.apache.fop.afp.util.BinaryUtils;
* which signal an alternate mode of processing for the content of the current
* Presentation Text data.
* <p>
* The content for this object can be created using {@link PtocaBuilder}.
* The content for this object can be created using {@link org.apache.fop.afp.ptoca.PtocaBuilder}.
*/
public class PresentationTextData extends AbstractAFPObject implements PtocaConstants {


+ 2
- 1
src/java/org/apache/fop/afp/util/DefaultFOPResourceAccessor.java View File

@@ -44,7 +44,8 @@ public class DefaultFOPResourceAccessor extends SimpleResourceAccessor {
* Constructor for resource to be accessed via the {@link FOUserAgent}. This contructor
* can take two base URIs: the category base URI is the one to use when differentiating between
* normal resources (ex. images) and font resources. So, if fonts need to be accessed, you can
* set the {@link FontManager}'s base URI instead of the one on the {@link FopFactory}.
* set the {@link org.apache.fop.fonts.FontManager}'s base URI instead of the one on the
* {@link org.apache.fop.apps.FopFactory}.
* @param userAgent the FO user agent
* @param categoryBaseURI the category base URI (may be null)
* @param baseURI the custom base URI to resolve relative URIs against (may be null)

+ 3
- 2
src/java/org/apache/fop/apps/FOUserAgent.java View File

@@ -355,7 +355,7 @@ public class FOUserAgent {
/**
* Sets font base URL.
* @param fontBaseUrl font base URL
* @deprecated Use {@link FontManager#setFontBaseURL(String)} instead.
* @deprecated Use {@link org.apache.fop.fonts.FontManager#setFontBaseURL(String)} instead.
*/
public void setFontBaseURL(String fontBaseUrl) {
try {
@@ -500,7 +500,8 @@ public class FOUserAgent {
/**
* Returns the font base URL.
* @return the font base URL
* @deprecated Use {@link FontManager#getFontBaseURL()} instead. This method is not used by FOP.
* @deprecated Use {@link org.apache.fop.fonts.FontManager#getFontBaseURL()} instead.
* This method is not used by FOP.
*/
public String getFontBaseURL() {
String fontBase = getFactory().getFontManager().getFontBaseURL();

+ 1
- 1
src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java View File

@@ -1783,9 +1783,9 @@ public class GlyphPositioningTable extends GlyphTable {
* Find device adjustment.
* @param fontSize the font size to search for
* @return an adjustment if font size matches an entry
* @asf.todo at present, assumes that 1 device unit equals one point
*/
public int findAdjustment ( int fontSize ) {
// [TODO] at present, assumes that 1 device unit equals one point
int fs = fontSize / 1000;
if ( fs < startSize ) {
return 0;

+ 21
- 20
src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java View File

@@ -31,6 +31,7 @@ import org.apache.commons.logging.LogFactory;
import org.apache.fop.fonts.truetype.FontFileReader;
import org.apache.fop.fonts.truetype.TTFDirTabEntry;
import org.apache.fop.fonts.truetype.TTFFile;
import org.apache.fop.fonts.truetype.TTFTableName;

// CSOFF: AvoidNestedBlocksCheck
// CSOFF: NoWhitespaceAfterCheck
@@ -126,7 +127,7 @@ public final class OTFAdvancedTypographicTableReader {
return gpos;
}

private void readLangSysTable(String tableTag, long langSysTable, String langSysTag) throws IOException {
private void readLangSysTable(TTFTableName tableTag, long langSysTable, String langSysTag) throws IOException {
in.seekSet(langSysTable);
if (log.isDebugEnabled()) {
log.debug(tableTag + " lang sys table: " + langSysTag );
@@ -168,7 +169,7 @@ public final class OTFAdvancedTypographicTableReader {

private static String defaultTag = "dflt";

private void readScriptTable(String tableTag, long scriptTable, String scriptTag) throws IOException {
private void readScriptTable(TTFTableName tableTag, long scriptTable, String scriptTag) throws IOException {
in.seekSet(scriptTable);
if (log.isDebugEnabled()) {
log.debug(tableTag + " script table: " + scriptTag );
@@ -221,7 +222,7 @@ public final class OTFAdvancedTypographicTableReader {
seLanguages = null;
}

private void readScriptList(String tableTag, long scriptList) throws IOException {
private void readScriptList(TTFTableName tableTag, long scriptList) throws IOException {
in.seekSet(scriptList);
// read script record count
int ns = in.readTTFUShort();
@@ -250,7 +251,7 @@ public final class OTFAdvancedTypographicTableReader {
}
}

private void readFeatureTable(String tableTag, long featureTable, String featureTag, int featureIndex) throws IOException {
private void readFeatureTable(TTFTableName tableTag, long featureTable, String featureTag, int featureIndex) throws IOException {
in.seekSet(featureTable);
if (log.isDebugEnabled()) {
log.debug(tableTag + " feature table: " + featureTag );
@@ -278,7 +279,7 @@ public final class OTFAdvancedTypographicTableReader {
seFeatures.put ( "f" + featureIndex, new Object[] { featureTag, lul } );
}

private void readFeatureList(String tableTag, long featureList) throws IOException {
private void readFeatureList(TTFTableName tableTag, long featureList) throws IOException {
in.seekSet(featureList);
// read feature record count
int nf = in.readTTFUShort();
@@ -3144,9 +3145,9 @@ public final class OTFAdvancedTypographicTableReader {
resetATSubState();
}

private void readLookupTable(String tableTag, int lookupSequence, long lookupTable) throws IOException {
boolean isGSUB = tableTag.equals ( "GSUB" );
boolean isGPOS = tableTag.equals ( "GPOS" );
private void readLookupTable(TTFTableName tableTag, int lookupSequence, long lookupTable) throws IOException {
boolean isGSUB = tableTag.equals ( TTFTableName.GSUB );
boolean isGPOS = tableTag.equals ( TTFTableName.GPOS );
in.seekSet(lookupTable);
// read lookup type
int lt = in.readTTFUShort();
@@ -3197,7 +3198,7 @@ public final class OTFAdvancedTypographicTableReader {
}
}

private void readLookupList(String tableTag, long lookupList) throws IOException {
private void readLookupList(TTFTableName tableTag, long lookupList) throws IOException {
in.seekSet(lookupList);
// read lookup record count
int nl = in.readTTFUShort();
@@ -3232,7 +3233,7 @@ public final class OTFAdvancedTypographicTableReader {
* @param lookupList offset to lookup list from beginning of font file
* @throws IOException In case of a I/O problem
*/
private void readCommonLayoutTables(String tableTag, long scriptList, long featureList, long lookupList) throws IOException {
private void readCommonLayoutTables(TTFTableName tableTag, long scriptList, long featureList, long lookupList) throws IOException {
if ( scriptList > 0 ) {
readScriptList ( tableTag, scriptList );
}
@@ -3244,7 +3245,7 @@ public final class OTFAdvancedTypographicTableReader {
}
}

private void readGDEFClassDefTable(String tableTag, int lookupSequence, long subtableOffset) throws IOException {
private void readGDEFClassDefTable(TTFTableName tableTag, int lookupSequence, long subtableOffset) throws IOException {
initATSubState();
in.seekSet(subtableOffset);
// subtable is a bare class definition table
@@ -3256,7 +3257,7 @@ public final class OTFAdvancedTypographicTableReader {
resetATSubState();
}

private void readGDEFAttachmentTable(String tableTag, int lookupSequence, long subtableOffset) throws IOException {
private void readGDEFAttachmentTable(TTFTableName tableTag, int lookupSequence, long subtableOffset) throws IOException {
initATSubState();
in.seekSet(subtableOffset);
// read coverage offset
@@ -3274,7 +3275,7 @@ public final class OTFAdvancedTypographicTableReader {
resetATSubState();
}

private void readGDEFLigatureCaretTable(String tableTag, int lookupSequence, long subtableOffset) throws IOException {
private void readGDEFLigatureCaretTable(TTFTableName tableTag, int lookupSequence, long subtableOffset) throws IOException {
initATSubState();
in.seekSet(subtableOffset);
// read coverage offset
@@ -3304,7 +3305,7 @@ public final class OTFAdvancedTypographicTableReader {
resetATSubState();
}

private void readGDEFMarkAttachmentTable(String tableTag, int lookupSequence, long subtableOffset) throws IOException {
private void readGDEFMarkAttachmentTable(TTFTableName tableTag, int lookupSequence, long subtableOffset) throws IOException {
initATSubState();
in.seekSet(subtableOffset);
// subtable is a bare class definition table
@@ -3316,7 +3317,7 @@ public final class OTFAdvancedTypographicTableReader {
resetATSubState();
}

private void readGDEFMarkGlyphsTableFormat1(String tableTag, int lookupSequence, long subtableOffset, int subtableFormat) throws IOException {
private void readGDEFMarkGlyphsTableFormat1(TTFTableName tableTag, int lookupSequence, long subtableOffset, int subtableFormat) throws IOException {
initATSubState();
in.seekSet(subtableOffset);
// skip over format (already known)
@@ -3350,7 +3351,7 @@ public final class OTFAdvancedTypographicTableReader {
resetATSubState();
}

private void readGDEFMarkGlyphsTable(String tableTag, int lookupSequence, long subtableOffset) throws IOException {
private void readGDEFMarkGlyphsTable(TTFTableName tableTag, int lookupSequence, long subtableOffset) throws IOException {
in.seekSet(subtableOffset);
// read mark set subtable format
int sf = in.readTTFUShort();
@@ -3366,11 +3367,11 @@ public final class OTFAdvancedTypographicTableReader {
* @throws IOException In case of a I/O problem
*/
private void readGDEF() throws IOException {
String tableTag = "GDEF";
TTFTableName tableTag = TTFTableName.GDEF;
// Initialize temporary state
initATState();
// Read glyph definition (GDEF) table
TTFDirTabEntry dirTab = ttf.getDirectoryEntry ( tableTag );
TTFDirTabEntry dirTab = ttf.getDirectoryEntry( tableTag );
if ( gdef != null ) {
if (log.isDebugEnabled()) {
log.debug(tableTag + ": ignoring duplicate table");
@@ -3439,7 +3440,7 @@ public final class OTFAdvancedTypographicTableReader {
* @throws IOException In case of a I/O problem
*/
private void readGSUB() throws IOException {
String tableTag = "GSUB";
TTFTableName tableTag = TTFTableName.GSUB;
// Initialize temporary state
initATState();
// Read glyph substitution (GSUB) table
@@ -3476,7 +3477,7 @@ public final class OTFAdvancedTypographicTableReader {
* @throws IOException In case of a I/O problem
*/
private void readGPOS() throws IOException {
String tableTag = "GPOS";
TTFTableName tableTag = TTFTableName.GPOS;
// Initialize temporary state
initATState();
// Read glyph positioning (GPOS) table

+ 1
- 1
src/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java View File

@@ -360,7 +360,7 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
}

/** Abstract syllabizer. */
protected abstract static class Syllabizer {
protected abstract static class Syllabizer implements Comparable {
private String script;
private String language;
Syllabizer ( String script, String language ) {

+ 10
- 4
src/java/org/apache/fop/fo/FOEventHandler.java View File

@@ -123,11 +123,17 @@ public abstract class FOEventHandler {
public void endDocument() throws SAXException {
}

/** {@inheritDoc} */
/**
* Called upon start of root element.
* @param root element
*/
public void startRoot(Root root) {
}

/** {@inheritDoc} */
/**
* Called upon end of root element.
* @param root element
*/
public void endRoot(Root root) {
}

@@ -413,9 +419,9 @@ public abstract class FOEventHandler {

/**
* Process end of a Static.
* @param statisContent StaticContent that is ending
* @param staticContent StaticContent that is ending
*/
public void endStatic(StaticContent statisContent) {
public void endStatic(StaticContent staticContent) {
}



+ 16
- 3
src/java/org/apache/fop/fo/flow/Wrapper.java View File

@@ -26,7 +26,10 @@ import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FOText;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAccessibilityHolder;

/**
* Class modelling the <a href=http://www.w3.org/TR/xsl/#fo_wrapper">
@@ -34,13 +37,13 @@ import org.apache.fop.fo.ValidationException;
* The <code>fo:wrapper</code> object serves as a property holder for
* its child node objects.
*/
public class Wrapper extends FObjMixed {
// The value of properties relevant for fo:wrapper.
// End of property values
public class Wrapper extends FObjMixed implements CommonAccessibilityHolder {

// used for FO validation
private boolean blockOrInlineItemFound = false;

private CommonAccessibility commonAccessibility;

/**
* Create a Wrapper instance that is a child of the
* given {@link FONode}
@@ -51,6 +54,12 @@ public class Wrapper extends FObjMixed {
super(parent);
}

@Override
public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
commonAccessibility = CommonAccessibility.getInstance(pList);
}

@Override
protected void startOfNode() throws FOPException {
super.startOfNode();
@@ -136,6 +145,10 @@ public class Wrapper extends FObjMixed {
return FO_WRAPPER;
}

public CommonAccessibility getCommonAccessibility() {
return commonAccessibility;
}

@Override
public boolean isDelimitedTextRangeBoundary ( int boundary ) {
return false;

+ 3
- 2
src/java/org/apache/fop/fo/properties/CondLengthProperty.java View File

@@ -26,6 +26,7 @@ import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.util.CompareUtil;

/**
* Superclass for properties that have conditional lengths
@@ -192,8 +193,8 @@ public class CondLengthProperty extends Property implements CompoundDatatype {

if (obj instanceof CondLengthProperty) {
CondLengthProperty clp = (CondLengthProperty)obj;
return (this.length == clp.length
&& this.conditionality == clp.conditionality);
return (CompareUtil.equal(this.length, clp.length)
&& CompareUtil.equal(this.conditionality, clp.conditionality));
}
return false;
}

+ 1
- 1
src/java/org/apache/fop/fonts/CIDFontType.java View File

@@ -34,7 +34,7 @@ public class CIDFontType extends ValuedEnum {
/**
* CID Font Type 2 (based on TrueType format)
*/
public static final CIDFontType CIDTYPE2 = new CIDFontType("CIDFontType2", 1);
public static final CIDFontType CIDTYPE2 = new CIDFontType("CIDFontType2", 2);


/**

src/java/org/apache/fop/fonts/BFEntry.java → src/java/org/apache/fop/fonts/CMapSegment.java View File

@@ -20,26 +20,49 @@
package org.apache.fop.fonts;

/**
* This is just a holder class for bfentries, groups of characters of a base font (bf).
* A segment in a cmap table of format 4. Unicode code points between
* {@link #getUnicodeStart()} and {@link #getUnicodeEnd()} map to contiguous glyph indices
* starting from {@link #getGlyphStartIndex()}.
*/
public class BFEntry {
public final class CMapSegment {

private int unicodeStart;
private int unicodeEnd;
private int glyphStartIndex;
private final int unicodeStart;
private final int unicodeEnd;
private final int glyphStartIndex;

/**
* Main constructor.
* Creates a new segment.
*
* @param unicodeStart Unicode start index
* @param unicodeEnd Unicode end index
* @param glyphStartIndex glyph start index
*/
public BFEntry(int unicodeStart, int unicodeEnd, int glyphStartIndex) {
public CMapSegment(int unicodeStart, int unicodeEnd, int glyphStartIndex) {
this.unicodeStart = unicodeStart;
this.unicodeEnd = unicodeEnd;
this.glyphStartIndex = glyphStartIndex;
}

@Override
public int hashCode() {
int hc = 17;
hc = 31 * hc + unicodeStart;
hc = 31 * hc + unicodeEnd;
hc = 31 * hc + glyphStartIndex;
return hc;
}

@Override
public boolean equals(Object o) {
if (o instanceof CMapSegment) {
CMapSegment ce = (CMapSegment) o;
return ce.unicodeStart == this.unicodeStart
&& ce.unicodeEnd == this.unicodeEnd
&& ce.glyphStartIndex == this.glyphStartIndex;
}
return false;
}

/**
* Returns the unicodeStart.
* @return the Unicode start index
@@ -67,7 +90,7 @@ public class BFEntry {
/** {@inheritDoc} */
@Override
public String toString() {
StringBuilder sb = new StringBuilder("BFEntry: ");
StringBuilder sb = new StringBuilder("CMapSegment: ");
sb.append ( "{ UC[" );
sb.append ( unicodeStart );
sb.append ( ',' );

+ 40
- 0
src/java/org/apache/fop/fonts/CustomFont.java View File

@@ -42,6 +42,7 @@ public abstract class CustomFont extends Typeface
private String embedFileName = null;
private String embedResourceName = null;
private FontResolver resolver = null;
private EmbeddingMode embeddingMode = EmbeddingMode.AUTO;

private int capHeight = 0;
private int xHeight = 0;
@@ -62,6 +63,9 @@ public abstract class CustomFont extends Typeface
private boolean useKerning = true;
private boolean useAdvanced = true;

/** the character map, mapping Unicode ranges to glyph indices. */
protected CMapSegment[] cmap;

/** {@inheritDoc} */
public String getFontName() {
return fontName;
@@ -111,6 +115,14 @@ public abstract class CustomFont extends Typeface
return embedFileName;
}

/**
* Returns the embedding mode for this font.
* @return embedding mode
*/
public EmbeddingMode getEmbeddingMode() {
return embeddingMode;
}

/**
* Returns a Source representing an embeddable font file.
* @return Source for an embeddable font file
@@ -334,6 +346,13 @@ public abstract class CustomFont extends Typeface
this.embedResourceName = name;
}

/**
* {@inheritDoc}
*/
public void setEmbeddingMode(EmbeddingMode embeddingMode) {
this.embeddingMode = embeddingMode;
}

/**
* {@inheritDoc}
*/
@@ -473,4 +492,25 @@ public abstract class CustomFont extends Typeface
}
}

/**
* Sets the character map for this font. It maps all available Unicode characters
* to their glyph indices inside the font.
* @param cmap the character map
*/
public void setCMap(CMapSegment[] cmap) {
this.cmap = new CMapSegment[cmap.length];
System.arraycopy(cmap, 0, this.cmap, 0, cmap.length);
}

/**
* Returns the character map for this font. It maps all available Unicode characters
* to their glyph indices inside the font.
* @return the character map
*/
public CMapSegment[] getCMap() {
CMapSegment[] copy = new CMapSegment[cmap.length];
System.arraycopy(this.cmap, 0, copy, 0, this.cmap.length);
return copy;
}

}

+ 1
- 1
src/java/org/apache/fop/fonts/CustomFontCollection.java View File

@@ -72,7 +72,7 @@ public class CustomFontCollection implements FontCollection {

List<FontTriplet> triplets = embedFontInfo.getFontTriplets();
for (int tripletIndex = 0; tripletIndex < triplets.size(); tripletIndex++) {
FontTriplet triplet = (FontTriplet) triplets.get(tripletIndex);
FontTriplet triplet = triplets.get(tripletIndex);
fontInfo.addFontProperties(internalName, triplet);
}
}

+ 23
- 0
src/java/org/apache/fop/fonts/EmbedFontInfo.java View File

@@ -25,6 +25,8 @@ import java.util.List;

/**
* FontInfo contains meta information on fonts (where is the metrics file etc.)
* TODO: We need to remove this class and think about more intelligent design patterns
* (Data classes => Procedural code)
*/
public class EmbedFontInfo implements Serializable {

@@ -41,6 +43,8 @@ public class EmbedFontInfo implements Serializable {
protected boolean advanced;
/** the requested encoding mode for the font */
protected EncodingMode encodingMode = EncodingMode.AUTO;
/** the requested embedding mode for this font */
protected EmbeddingMode embeddingMode = EmbeddingMode.AUTO;

/** the PostScript name of the font */
protected String postScriptName = null;
@@ -148,6 +152,14 @@ public class EmbedFontInfo implements Serializable {
}
}

/**
* Returns the embedding mode for this font.
* @return the embedding mode.
*/
public EmbeddingMode getEmbeddingMode() {
return embeddingMode;
}

/**
* Defines whether the font is embedded or not.
* @param value true to embed the font, false to reference it
@@ -175,6 +187,17 @@ public class EmbedFontInfo implements Serializable {
this.encodingMode = mode;
}

/**
* Sets the embedding mode for this font, currently not supported for Type 1 fonts.
* @param embeddingMode the new embedding mode.
*/
public void setEmbeddingMode(EmbeddingMode embeddingMode) {
if (embeddingMode == null) {
throw new NullPointerException("embeddingMode must not be null");
}
this.embeddingMode = embeddingMode;
}

private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException {
in.defaultReadObject();

+ 58
- 0
src/java/org/apache/fop/fonts/EmbeddingMode.java View File

@@ -0,0 +1,58 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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$ */

package org.apache.fop.fonts;

import java.util.Locale;

/**
* This enumerates the embedding mode of fonts; full; subset; auto (auto defaults to full for
* Type 1 fonts and subset for TrueType fonts.
*/
public enum EmbeddingMode {
/** Default option: assumes FULL for Type 1 fonts and SUBSET for TrueType fonts. */
AUTO,
/** Full font embedding: This means the whole of the font is written to file. */
FULL,
/** Subset font embedding: Only the mandatory tables and a subset of glyphs are written
* to file.*/
SUBSET;

/**
* Returns the name of this embedding mode.
* @return the name of this embedding mode in lower case.
*/
public String getName() {
return this.toString().toLowerCase(Locale.ENGLISH);
}

/**
* Returns the embedding mode corresponding to the given name.
* @param value the name of an embedding mode (not case sensitive)
* @return the corresponding embedding mode
*/
public static EmbeddingMode getValue(String value) {
for (EmbeddingMode mode : EmbeddingMode.values()) {
if (mode.toString().equalsIgnoreCase(value)) {
return mode;
}
}
throw new IllegalArgumentException("Invalid embedding-mode: " + value);
}
}

+ 1
- 1
src/java/org/apache/fop/fonts/EncodingMode.java View File

@@ -52,7 +52,7 @@ public enum EncodingMode {
* @param name the name of the encoding mode to look up
* @return the encoding mode constant
*/
public static EncodingMode getEncodingMode(String name) {
public static EncodingMode getValue(String name) {
for (EncodingMode em : EncodingMode.values()) {
if (name.equalsIgnoreCase(em.getName())) {
return em;

+ 5
- 1
src/java/org/apache/fop/fonts/FontInfoConfigurator.java View File

@@ -254,12 +254,16 @@ public class FontInfoConfigurator {

boolean useKerning = fontCfg.getAttributeAsBoolean("kerning", true);
boolean useAdvanced = fontCfg.getAttributeAsBoolean("advanced", true);
EncodingMode encodingMode = EncodingMode.getEncodingMode(
EncodingMode encodingMode = EncodingMode.getValue(
fontCfg.getAttribute("encoding-mode", EncodingMode.AUTO.getName()));
EmbeddingMode embeddingMode = EmbeddingMode.getValue(
fontCfg.getAttribute("embedding-mode", EmbeddingMode.AUTO.toString()));
EmbedFontInfo embedFontInfo
= new EmbedFontInfo(metricsUrl, useKerning, useAdvanced, tripletList, embedUrl,
subFont);
embedFontInfo.setEncodingMode(encodingMode);
embedFontInfo.setEmbeddingMode(embeddingMode);

boolean skipCachedFont = false;
if (fontCache != null) {
if (!fontCache.containsFont(embedFontInfo)) {

+ 15
- 7
src/java/org/apache/fop/fonts/FontLoader.java View File

@@ -85,15 +85,17 @@ public abstract class FontLoader {
* @param fontFile the File representation of the font
* @param subFontName the sub-fontname of a font (for TrueType Collections, null otherwise)
* @param embedded indicates whether the font is embedded or referenced
* @param embeddingMode the embedding mode
* @param encodingMode the requested encoding mode
* @param resolver the font resolver to use when resolving URIs
* @return the newly loaded font
* @throws IOException In case of an I/O error
*/
public static CustomFont loadFont(File fontFile, String subFontName,
boolean embedded, EncodingMode encodingMode, FontResolver resolver) throws IOException {
boolean embedded, EmbeddingMode embeddingMode, EncodingMode encodingMode,
FontResolver resolver) throws IOException {
return loadFont(fontFile.toURI().toURL(), subFontName,
embedded, encodingMode, resolver);
embedded, embeddingMode, encodingMode, resolver);
}

/**
@@ -101,16 +103,17 @@ public abstract class FontLoader {
* @param fontUrl the URL representation of the font
* @param subFontName the sub-fontname of a font (for TrueType Collections, null otherwise)
* @param embedded indicates whether the font is embedded or referenced
* @param embeddingMode the embedding mode of the font
* @param encodingMode the requested encoding mode
* @param resolver the font resolver to use when resolving URIs
* @return the newly loaded font
* @throws IOException In case of an I/O error
*/
public static CustomFont loadFont(URL fontUrl, String subFontName,
boolean embedded, EncodingMode encodingMode,
boolean embedded, EmbeddingMode embeddingMode, EncodingMode encodingMode,
FontResolver resolver) throws IOException {
return loadFont(fontUrl.toExternalForm(), subFontName,
embedded, encodingMode, true, true,
embedded, embeddingMode, encodingMode, true, true,
resolver);
}

@@ -119,6 +122,7 @@ public abstract class FontLoader {
* @param fontFileURI the URI to the font
* @param subFontName the sub-fontname of a font (for TrueType Collections, null otherwise)
* @param embedded indicates whether the font is embedded or referenced
* @param embeddingMode the embedding mode of the font
* @param encodingMode the requested encoding mode
* @param useKerning indicates whether kerning information should be loaded if available
* @param useAdvanced indicates whether advanced typographic information shall be loaded if
@@ -128,8 +132,8 @@ public abstract class FontLoader {
* @throws IOException In case of an I/O error
*/
public static CustomFont loadFont(String fontFileURI, String subFontName,
boolean embedded, EncodingMode encodingMode, boolean useKerning,
boolean useAdvanced, FontResolver resolver) throws IOException {
boolean embedded, EmbeddingMode embeddingMode, EncodingMode encodingMode,
boolean useKerning, boolean useAdvanced, FontResolver resolver) throws IOException {
fontFileURI = fontFileURI.trim();
boolean type1 = isType1(fontFileURI);
FontLoader loader;
@@ -138,10 +142,14 @@ public abstract class FontLoader {
throw new IllegalArgumentException(
"CID encoding mode not supported for Type 1 fonts");
}
if (embeddingMode == EmbeddingMode.SUBSET) {
throw new IllegalArgumentException(
"Subset embedding for Type 1 fonts is not supported");
}
loader = new Type1FontLoader(fontFileURI, embedded, useKerning, resolver);
} else {
loader = new TTFFontLoader(fontFileURI, subFontName,
embedded, encodingMode, useKerning, useAdvanced, resolver);
embedded, embeddingMode, encodingMode, useKerning, useAdvanced, resolver);
}
return loader.getFont();
}

+ 9
- 4
src/java/org/apache/fop/fonts/FontReader.java View File

@@ -64,7 +64,7 @@ public class FontReader extends DefaultHandler {

private Map<Integer, Integer> currentKerning = null;

private List<BFEntry> bfranges = null;
private List<CMapSegment> bfranges = null;

private void createFont(InputSource source) throws FOPException {
XMLReader parser = null;
@@ -154,12 +154,14 @@ public class FontReader extends DefaultHandler {
/**
* {@inheritDoc}
*/
@Override
public void startDocument() {
}

/**
* {@inheritDoc}
*/
@Override
public void setDocumentLocator(Locator locator) {
// this.locator = locator; // not used at present
}
@@ -167,6 +169,7 @@ public class FontReader extends DefaultHandler {
/**
* {@inheritDoc}
*/
@Override
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
if (localName.equals("font-metrics")) {
@@ -198,9 +201,9 @@ public class FontReader extends DefaultHandler {
returnFont.putKerningEntry(new Integer(attributes.getValue("kpx1")),
currentKerning);
} else if ("bfranges".equals(localName)) {
bfranges = new ArrayList<BFEntry>();
bfranges = new ArrayList<CMapSegment>();
} else if ("bf".equals(localName)) {
BFEntry entry = new BFEntry(getInt(attributes.getValue("us")),
CMapSegment entry = new CMapSegment(getInt(attributes.getValue("us")),
getInt(attributes.getValue("ue")),
getInt(attributes.getValue("gi")));
bfranges.add(entry);
@@ -236,6 +239,7 @@ public class FontReader extends DefaultHandler {
/**
* {@inheritDoc}
*/
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
String content = text.toString().trim();
if ("font-name".equals(localName)) {
@@ -303,7 +307,7 @@ public class FontReader extends DefaultHandler {
multiFont.setWidthArray(wds);

} else if ("bfranges".equals(localName)) {
multiFont.setBFEntries(bfranges.toArray(new BFEntry[0]));
multiFont.setCMap(bfranges.toArray(new CMapSegment[0]));
}
text.setLength(0); //Reset text buffer (see characters())
}
@@ -311,6 +315,7 @@ public class FontReader extends DefaultHandler {
/**
* {@inheritDoc}
*/
@Override
public void characters(char[] ch, int start, int length) {
text.append(ch, start, length);
}

+ 5
- 0
src/java/org/apache/fop/fonts/FontType.java View File

@@ -130,4 +130,9 @@ public class FontType {
return value;
}

@Override
public String toString() {
return name;
}

}

+ 6
- 4
src/java/org/apache/fop/fonts/LazyFont.java View File

@@ -36,7 +36,6 @@ import org.apache.fop.apps.FOPException;
import org.apache.fop.complexscripts.fonts.Positionable;
import org.apache.fop.complexscripts.fonts.Substitutable;


/**
* This class is used to defer the loading of a font until it is really used.
*/
@@ -49,7 +48,8 @@ public class LazyFont extends Typeface implements FontDescriptor, Substitutable,
private boolean useKerning;
private boolean useAdvanced;
private EncodingMode encodingMode = EncodingMode.AUTO;
private boolean embedded;
private EmbeddingMode embeddingMode = EmbeddingMode.AUTO;
private boolean embedded = true;
private String subFontName;

private boolean isMetricsLoaded;
@@ -74,6 +74,7 @@ public class LazyFont extends Typeface implements FontDescriptor, Substitutable,
this.useAdvanced = fontInfo.getAdvanced();
}
this.encodingMode = fontInfo.getEncodingMode();
this.embeddingMode = fontInfo.getEmbeddingMode();
this.subFontName = fontInfo.getSubFontName();
this.embedded = fontInfo.isEmbedded();
this.resolver = resolver;
@@ -147,8 +148,9 @@ public class LazyFont extends Typeface implements FontDescriptor, Substitutable,
if (fontEmbedPath == null) {
throw new RuntimeException("Cannot load font. No font URIs available.");
}
realFont = FontLoader.loadFont(fontEmbedPath, this.subFontName,
this.embedded, this.encodingMode, useKerning, useAdvanced, resolver);
realFont = FontLoader.loadFont(fontEmbedPath, subFontName,
embedded, embeddingMode, encodingMode,
useKerning, useAdvanced, resolver);
}
if (realFont instanceof FontDescriptor) {
realFontDescriptor = (FontDescriptor) realFont;

+ 27
- 35
src/java/org/apache/fop/fonts/MultiByteFont.java View File

@@ -51,14 +51,6 @@ public class MultiByteFont extends CIDFont implements Substitutable, Positionabl

private CIDSubset subset = new CIDSubset();

/**
* A map from Unicode indices to glyph indices. No assumption
* about ordering is made below. If lookup is changed to a binary
* search (from the current linear search), then addPrivateUseMapping()
* needs to be changed to perform ordered inserts.
*/
private BFEntry[] bfentries = null;

/* advanced typographic support */
private GlyphDefinitionTable gdef;
private GlyphSubstitutionTable gsub;
@@ -82,26 +74,31 @@ public class MultiByteFont extends CIDFont implements Substitutable, Positionabl
}

/** {@inheritDoc} */
@Override
public int getDefaultWidth() {
return defaultWidth;
}

/** {@inheritDoc} */
@Override
public String getRegistry() {
return "Adobe";
}

/** {@inheritDoc} */
@Override
public String getOrdering() {
return "UCS";
}

/** {@inheritDoc} */
@Override
public int getSupplement() {
return 0;
}

/** {@inheritDoc} */
@Override
public CIDFontType getCIDType() {
return cidType;
}
@@ -115,6 +112,7 @@ public class MultiByteFont extends CIDFont implements Substitutable, Positionabl
}

/** {@inheritDoc} */
@Override
public String getEmbedFontName() {
if (isEmbeddable()) {
return FontUtil.stripWhiteSpace(super.getFontName());
@@ -128,17 +126,18 @@ public class MultiByteFont extends CIDFont implements Substitutable, Positionabl
return !(getEmbedFileName() == null && getEmbedResourceName() == null);
}

/** {@inheritDoc} */
public boolean isSubsetEmbedded() {
return true;
}

/** {@inheritDoc} */
@Override
public CIDSubset getCIDSubset() {
return this.subset;
}

/** {@inheritDoc} */
@Override
public String getEncodingName() {
return encoding;
}
@@ -171,30 +170,30 @@ public class MultiByteFont extends CIDFont implements Substitutable, Positionabl
int idx = c;
int retIdx = SingleByteEncoding.NOT_FOUND_CODE_POINT;

for (int i = 0; (i < bfentries.length) && retIdx == 0; i++) {
if (bfentries[i].getUnicodeStart() <= idx
&& bfentries[i].getUnicodeEnd() >= idx) {
for (int i = 0; (i < cmap.length) && retIdx == 0; i++) {
if (cmap[i].getUnicodeStart() <= idx
&& cmap[i].getUnicodeEnd() >= idx) {

retIdx = bfentries[i].getGlyphStartIndex()
retIdx = cmap[i].getGlyphStartIndex()
+ idx
- bfentries[i].getUnicodeStart();
- cmap[i].getUnicodeStart();
}
}
return retIdx;
}

/**
* Add a private use mapping {PU,GI} to the existing BFENTRIES map.
* Add a private use mapping {PU,GI} to the existing character map.
* N.B. Does not insert in order, merely appends to end of existing map.
*/
private synchronized void addPrivateUseMapping ( int pu, int gi ) {
assert findGlyphIndex ( pu ) == SingleByteEncoding.NOT_FOUND_CODE_POINT;
BFEntry[] bfeOld = bfentries;
int bfeCnt = bfeOld.length;
BFEntry[] bfeNew = new BFEntry [ bfeCnt + 1 ];
System.arraycopy ( bfeOld, 0, bfeNew, 0, bfeCnt );
bfeNew [ bfeCnt ] = new BFEntry ( pu, pu, gi );
bfentries = bfeNew;
CMapSegment[] oldCmap = cmap;
int cmapLength = oldCmap.length;
CMapSegment[] newCmap = new CMapSegment [ cmapLength + 1 ];
System.arraycopy ( oldCmap, 0, newCmap, 0, cmapLength );
newCmap [ cmapLength ] = new CMapSegment ( pu, pu, gi );
cmap = newCmap;
}

/**
@@ -252,12 +251,12 @@ public class MultiByteFont extends CIDFont implements Substitutable, Positionabl
// [TBD] - needs optimization, i.e., change from linear search to binary search
private int findCharacterFromGlyphIndex ( int gi, boolean augment ) {
int cc = 0;
for ( int i = 0, n = bfentries.length; i < n; i++ ) {
BFEntry be = bfentries [ i ];
int s = be.getGlyphStartIndex();
int e = s + ( be.getUnicodeEnd() - be.getUnicodeStart() );
for ( int i = 0, n = cmap.length; i < n; i++ ) {
CMapSegment segment = cmap [ i ];
int s = segment.getGlyphStartIndex();
int e = s + ( segment.getUnicodeEnd() - segment.getUnicodeStart() );
if ( ( gi >= s ) && ( gi <= e ) ) {
cc = be.getUnicodeStart() + ( gi - s );
cc = segment.getUnicodeStart() + ( gi - s );
break;
}
}
@@ -273,6 +272,7 @@ public class MultiByteFont extends CIDFont implements Substitutable, Positionabl


/** {@inheritDoc} */
@Override
public char mapChar(char c) {
notifyMapOperation();
int glyphIndex = findGlyphIndex(c);
@@ -287,19 +287,11 @@ public class MultiByteFont extends CIDFont implements Substitutable, Positionabl
}

/** {@inheritDoc} */
@Override
public boolean hasChar(char c) {
return (findGlyphIndex(c) != SingleByteEncoding.NOT_FOUND_CODE_POINT);
}

/**
* Sets the array of BFEntry instances which constitutes the Unicode to glyph index map for
* a font. ("BF" means "base font")
* @param entries the Unicode to glyph index map
*/
public void setBFEntries(BFEntry[] entries) {
this.bfentries = entries;
}

/**
* Sets the defaultWidth.
* @param defaultWidth The defaultWidth to set

+ 6
- 0
src/java/org/apache/fop/fonts/MutableFont.java View File

@@ -60,6 +60,12 @@ public interface MutableFont {
*/
void setEmbedResourceName(String name);

/**
* Sets the embedding mode.
* @param embeddingMode the embedding mode
*/
void setEmbeddingMode(EmbeddingMode embeddingMode);

/**
* Sets the capital height value.
* @param capHeight capital height

+ 24
- 0
src/java/org/apache/fop/fonts/SingleByteFont.java View File

@@ -31,6 +31,8 @@ import org.apache.commons.logging.LogFactory;

import org.apache.xmlgraphics.fonts.Glyphs;

import org.apache.fop.fonts.truetype.TTFFile.PostScriptVersion;

/**
* Generic SingleByte font
*/
@@ -48,6 +50,7 @@ public class SingleByteFont extends CustomFont {
private List<SimpleSingleByteEncoding> additionalEncodings;
private Map<Character, Character> alternativeCodes;

private PostScriptVersion ttPostScriptVersion;

/**
* Main constructor.
@@ -397,5 +400,26 @@ public class SingleByteFont extends CustomFont {
}
}

/**
* Sets the version of the PostScript table stored in the TrueType font represented by
* this instance.
*
* @param version version of the <q>post</q> table
*/
public void setTrueTypePostScriptVersion(PostScriptVersion version) {
ttPostScriptVersion = version;
}

/**
* Returns the version of the PostScript table stored in the TrueType font represented by
* this instance.
*
* @return the version of the <q>post</q> table
*/
public PostScriptVersion getTrueTypePostScriptVersion() {
assert getFontType() == FontType.TRUETYPE;
return ttPostScriptVersion;
}

}


+ 12
- 18
src/java/org/apache/fop/fonts/apps/TTFReader.java View File

@@ -20,7 +20,6 @@
package org.apache.fop.fonts.apps;

import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

@@ -34,9 +33,9 @@ import org.xml.sax.SAXException;
import org.apache.commons.logging.LogFactory;

import org.apache.fop.Version;
import org.apache.fop.fonts.CMapSegment;
import org.apache.fop.fonts.FontUtil;
import org.apache.fop.fonts.truetype.FontFileReader;
import org.apache.fop.fonts.truetype.TTFCmapEntry;
import org.apache.fop.fonts.truetype.TTFFile;
import org.apache.fop.util.CommandLineLogger;

@@ -288,9 +287,9 @@ public class TTFReader extends AbstractFontReader {
root.appendChild(el);
el.appendChild(doc.createTextNode(ttf.getFullName()));
}
Set familyNames = ttf.getFamilyNames();
Set<String> familyNames = ttf.getFamilyNames();
if (familyNames.size() > 0) {
String familyName = (String)familyNames.iterator().next();
String familyName = familyNames.iterator().next();
el = doc.createElement("family-name");
root.appendChild(el);
el.appendChild(doc.createTextNode(familyName));
@@ -386,9 +385,7 @@ public class TTFReader extends AbstractFontReader {

el = doc.createElement("bfranges");
mel.appendChild(el);
Iterator iter = ttf.getCMaps().listIterator();
while (iter.hasNext()) {
TTFCmapEntry ce = (TTFCmapEntry)iter.next();
for (CMapSegment ce : ttf.getCMaps()) {
Element el2 = doc.createElement("bf");
el.appendChild(el2);
el2.setAttribute("us", String.valueOf(ce.getUnicodeStart()));
@@ -443,31 +440,28 @@ public class TTFReader extends AbstractFontReader {
Document doc = parent.getOwnerDocument();

// Get kerning
Iterator iter;
Set<Integer> kerningKeys;
if (isCid) {
iter = ttf.getKerning().keySet().iterator();
kerningKeys = ttf.getKerning().keySet();
} else {
iter = ttf.getAnsiKerning().keySet().iterator();
kerningKeys = ttf.getAnsiKerning().keySet();
}

while (iter.hasNext()) {
Integer kpx1 = (Integer)iter.next();
for (Integer kpx1 : kerningKeys) {

el = doc.createElement("kerning");
el.setAttribute("kpx1", kpx1.toString());
parent.appendChild(el);
Element el2 = null;

Map h2;
Map<Integer, Integer> h2;
if (isCid) {
h2 = (Map)ttf.getKerning().get(kpx1);
h2 = ttf.getKerning().get(kpx1);
} else {
h2 = (Map)ttf.getAnsiKerning().get(kpx1);
h2 = ttf.getAnsiKerning().get(kpx1);
}

Iterator iter2 = h2.keySet().iterator();
while (iter2.hasNext()) {
Integer kpx2 = (Integer)iter2.next();
for (Integer kpx2 : h2.keySet()) {
if (isCid || kpx2.intValue() < 256) {
el2 = doc.createElement("pair");
el2.setAttribute("kpx2", kpx2.toString());

+ 4
- 2
src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java View File

@@ -32,6 +32,7 @@ import org.apache.commons.logging.LogFactory;

import org.apache.fop.fonts.CustomFont;
import org.apache.fop.fonts.EmbedFontInfo;
import org.apache.fop.fonts.EmbeddingMode;
import org.apache.fop.fonts.EncodingMode;
import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.FontCache;
@@ -222,7 +223,7 @@ public class FontInfoFinder {
}
try {
TTFFontLoader ttfLoader = new TTFFontLoader(
fontFileURL, fontName, true, EncodingMode.AUTO,
fontFileURL, fontName, true, EmbeddingMode.AUTO, EncodingMode.AUTO,
useKerning, useAdvanced, resolver);
customFont = ttfLoader.getFont();
if (this.eventListener != null) {
@@ -247,7 +248,8 @@ public class FontInfoFinder {
} else {
// The normal case
try {
customFont = FontLoader.loadFont(fontURL, null, true, EncodingMode.AUTO, resolver);
customFont = FontLoader.loadFont(fontURL, null, true, EmbeddingMode.AUTO,
EncodingMode.AUTO, resolver);
if (this.eventListener != null) {
customFont.setEventListener(this.eventListener);
}

+ 12
- 17
src/java/org/apache/fop/fonts/truetype/FontFileReader.java View File

@@ -89,16 +89,6 @@ public class FontFileReader {
current = (int)offset;
}

/**
* Set current file position to offset
*
* @param add The number of bytes to advance
* @throws IOException In case of an I/O problem
*/
public void seekAdd(long add) throws IOException {
seekSet(current + add);
}

/**
* Skip a given number of bytes.
*
@@ -106,7 +96,7 @@ public class FontFileReader {
* @throws IOException In case of an I/O problem
*/
public void skip(long add) throws IOException {
seekAdd(add);
seekSet(current + add);
}

/**
@@ -133,7 +123,7 @@ public class FontFileReader {
* @return One byte
* @throws IOException If EOF is reached
*/
public byte read() throws IOException {
private byte read() throws IOException {
if (current >= fsize) {
throw new java.io.EOFException("Reached EOF, file size=" + fsize);
}
@@ -278,14 +268,14 @@ public class FontFileReader {
public final String readTTFString() throws IOException {
int i = current;
while (file[i++] != 0) {
if (i > fsize) {
if (i >= fsize) {
throw new java.io.EOFException("Reached EOF, file size="
+ fsize);
}
}

byte[] tmp = new byte[i - current];
System.arraycopy(file, current, tmp, 0, i - current);
byte[] tmp = new byte[i - current - 1];
System.arraycopy(file, current, tmp, 0, i - current - 1);
return new String(tmp, "ISO-8859-1");
}

@@ -353,6 +343,11 @@ public class FontFileReader {
System.arraycopy(file, offset, ret, 0, length);
return ret;
}


/**
* Returns the full byte array representation of the file.
* @return byte array.
*/
public byte[] getAllBytes() {
return file;
}
}

+ 0
- 118
src/java/org/apache/fop/fonts/truetype/TTFCmapEntry.java View File

@@ -1,118 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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$ */

package org.apache.fop.fonts.truetype;

/**
* The CMap entry contains information of a Unicode range and the
* the glyph indexes related to the range
*/
public class TTFCmapEntry {

private int unicodeStart;
private int unicodeEnd;
private int glyphStartIndex;

TTFCmapEntry() {
unicodeStart = 0;
unicodeEnd = 0;
glyphStartIndex = 0;
}

TTFCmapEntry(int unicodeStart, int unicodeEnd, int glyphStartIndex) {
this.unicodeStart = unicodeStart;
this.unicodeEnd = unicodeEnd;
this.glyphStartIndex = glyphStartIndex;
}

/**
* {@inheritDoc}
*/
public int hashCode() {
int hc = super.hashCode();
hc ^= ( hc * 11 ) + unicodeStart;
hc ^= ( hc * 19 ) + unicodeEnd;
hc ^= ( hc * 23 ) + glyphStartIndex;
return hc;
}

/**
* {@inheritDoc}
*/
public boolean equals(Object o) {
if (o instanceof TTFCmapEntry) {
TTFCmapEntry ce = (TTFCmapEntry)o;
if (ce.unicodeStart == this.unicodeStart
&& ce.unicodeEnd == this.unicodeEnd
&& ce.glyphStartIndex == this.glyphStartIndex) {
return true;
}
}
return false;
}

/**
* Returns the glyphStartIndex.
* @return int
*/
public int getGlyphStartIndex() {
return glyphStartIndex;
}

/**
* Returns the unicodeEnd.
* @return int
*/
public int getUnicodeEnd() {
return unicodeEnd;
}

/**
* Returns the unicodeStart.
* @return int
*/
public int getUnicodeStart() {
return unicodeStart;
}

/**
* Sets the glyphStartIndex.
* @param glyphStartIndex The glyphStartIndex to set
*/
public void setGlyphStartIndex(int glyphStartIndex) {
this.glyphStartIndex = glyphStartIndex;
}

/**
* Sets the unicodeEnd.
* @param unicodeEnd The unicodeEnd to set
*/
public void setUnicodeEnd(int unicodeEnd) {
this.unicodeEnd = unicodeEnd;
}

/**
* Sets the unicodeStart.
* @param unicodeStart The unicodeStart to set
*/
public void setUnicodeStart(int unicodeStart) {
this.unicodeStart = unicodeStart;
}

}

+ 8
- 0
src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java View File

@@ -33,6 +33,14 @@ public class TTFDirTabEntry {
private long offset;
private long length;

public TTFDirTabEntry() {
}

public TTFDirTabEntry(long offset, long length) {
this.offset = offset;
this.length = length;
}

/**
* Read Dir Tab.
* @param in font file reader

+ 452
- 257
src/java/org/apache/fop/fonts/truetype/TTFFile.java
File diff suppressed because it is too large
View File


+ 33
- 32
src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java View File

@@ -21,17 +21,14 @@ package org.apache.fop.fonts.truetype;

import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.io.IOUtils;

import org.apache.xmlgraphics.fonts.Glyphs;

import org.apache.fop.fonts.BFEntry;
import org.apache.fop.fonts.CIDFontType;
import org.apache.fop.fonts.CMapSegment;
import org.apache.fop.fonts.EmbeddingMode;
import org.apache.fop.fonts.EncodingMode;
import org.apache.fop.fonts.FontLoader;
import org.apache.fop.fonts.FontResolver;
@@ -39,6 +36,8 @@ import org.apache.fop.fonts.FontType;
import org.apache.fop.fonts.MultiByteFont;
import org.apache.fop.fonts.NamedCharacter;
import org.apache.fop.fonts.SingleByteFont;
import org.apache.fop.fonts.truetype.TTFFile.PostScriptVersion;
import org.apache.fop.util.HexEncoder;

/**
* Loads a TrueType font into memory directly from the original font file.
@@ -49,6 +48,7 @@ public class TTFFontLoader extends FontLoader {
private SingleByteFont singleFont;
private final String subFontName;
private EncodingMode encodingMode;
private EmbeddingMode embeddingMode;

/**
* Default constructor
@@ -56,7 +56,7 @@ public class TTFFontLoader extends FontLoader {
* @param resolver the FontResolver for font URI resolution
*/
public TTFFontLoader(String fontFileURI, FontResolver resolver) {
this(fontFileURI, null, true, EncodingMode.AUTO, true, true, resolver);
this(fontFileURI, null, true, EmbeddingMode.AUTO, EncodingMode.AUTO, true, true, resolver);
}

/**
@@ -65,24 +65,28 @@ public class TTFFontLoader extends FontLoader {
* @param subFontName the sub-fontname of a font in a TrueType Collection (or null for normal
* TrueType fonts)
* @param embedded indicates whether the font is embedded or referenced
* @param embeddingMode the embedding mode of the font
* @param encodingMode the requested encoding mode
* @param useKerning true to enable loading kerning info if available, false to disable
* @param useAdvanced true to enable loading advanced info if available, false to disable
* @param resolver the FontResolver for font URI resolution
*/
public TTFFontLoader(String fontFileURI, String subFontName,
boolean embedded, EncodingMode encodingMode, boolean useKerning,
boolean useAdvanced, FontResolver resolver) {
boolean embedded, EmbeddingMode embeddingMode, EncodingMode encodingMode,
boolean useKerning, boolean useAdvanced, FontResolver resolver) {
super(fontFileURI, embedded, useKerning, useAdvanced, resolver);
this.subFontName = subFontName;
this.encodingMode = encodingMode;
this.embeddingMode = embeddingMode;
if (this.encodingMode == EncodingMode.AUTO) {
this.encodingMode = EncodingMode.CID; //Default to CID mode for TrueType
}
if (this.embeddingMode == EmbeddingMode.AUTO) {
this.embeddingMode = EmbeddingMode.SUBSET;
}
}

/** {@inheritDoc} */
@Override
protected void read() throws IOException {
read(this.subFontName);
}
@@ -145,29 +149,20 @@ public class TTFFontLoader extends FontLoader {
returnFont.setItalicAngle(Integer.parseInt(ttf.getItalicAngle()));
returnFont.setMissingWidth(0);
returnFont.setWeight(ttf.getWeightClass());
returnFont.setEmbeddingMode(this.embeddingMode);
if (isCid) {
multiFont.setCIDType(CIDFontType.CIDTYPE2);
int[] wx = ttf.getWidths();
multiFont.setWidthArray(wx);
List entries = ttf.getCMaps();
BFEntry[] bfentries = new BFEntry[entries.size()];
int pos = 0;
Iterator iter = ttf.getCMaps().listIterator();
while (iter.hasNext()) {
TTFCmapEntry ce = (TTFCmapEntry)iter.next();
bfentries[pos] = new BFEntry(ce.getUnicodeStart(), ce.getUnicodeEnd(),
ce.getGlyphStartIndex());
pos++;
}
multiFont.setBFEntries(bfentries);
} else {
singleFont.setFontType(FontType.TRUETYPE);
singleFont.setEncoding(ttf.getCharSetName());
returnFont.setFirstChar(ttf.getFirstChar());
returnFont.setLastChar(ttf.getLastChar());
singleFont.setTrueTypePostScriptVersion(ttf.getPostScriptVersion());
copyWidthsSingleByte(ttf);
}
returnFont.setCMap(getCMap(ttf));

if (useKerning) {
copyKerning(ttf, isCid);
@@ -186,23 +181,30 @@ public class TTFFontLoader extends FontLoader {
}
}

private CMapSegment[] getCMap(TTFFile ttf) {
CMapSegment[] array = new CMapSegment[ttf.getCMaps().size()];
return ttf.getCMaps().toArray(array);
}

private void copyWidthsSingleByte(TTFFile ttf) {
int[] wx = ttf.getWidths();
for (int i = singleFont.getFirstChar(); i <= singleFont.getLastChar(); i++) {
singleFont.setWidth(i, ttf.getCharWidth(i));
}
Iterator iter = ttf.getCMaps().listIterator();
while (iter.hasNext()) {
TTFCmapEntry ce = (TTFCmapEntry)iter.next();
if (ce.getUnicodeStart() < 0xFFFE) {
for (char u = (char)ce.getUnicodeStart(); u <= ce.getUnicodeEnd(); u++) {

for (CMapSegment segment : ttf.getCMaps()) {
if (segment.getUnicodeStart() < 0xFFFE) {
for (char u = (char)segment.getUnicodeStart(); u <= segment.getUnicodeEnd(); u++) {
int codePoint = singleFont.getEncoding().mapChar(u);
if (codePoint <= 0) {
String unicode = Character.toString(u);
String charName = Glyphs.stringToGlyph(unicode);
if (charName.length() > 0) {
NamedCharacter nc = new NamedCharacter(charName, unicode);
int glyphIndex = ce.getGlyphStartIndex() + u - ce.getUnicodeStart();
int glyphIndex = segment.getGlyphStartIndex() + u - segment.getUnicodeStart();
String glyphName = ttf.getGlyphName(glyphIndex);
if (glyphName.length() == 0 && ttf.getPostScriptVersion() != PostScriptVersion.V2) {
glyphName = "u" + HexEncoder.encode(u);
}
if (glyphName.length() > 0) {
String unicode = Character.toString(u);
NamedCharacter nc = new NamedCharacter(glyphName, unicode);
singleFont.addUnencodedCharacter(nc, wx[glyphIndex]);
}
}
@@ -225,7 +227,6 @@ public class TTFFontLoader extends FontLoader {
}

for (Integer kpx1 : kerningSet) {

Map<Integer, Integer> h2;
if (isCid) {
h2 = ttf.getKerning().get(kpx1);

+ 48
- 0
src/java/org/apache/fop/fonts/truetype/TTFGlyphOutputStream.java View File

@@ -0,0 +1,48 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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$ */

package org.apache.fop.fonts.truetype;

import java.io.IOException;

/**
* An interface for writing individual glyphs from the glyf table of a TrueType font to an output stream.
*/
public interface TTFGlyphOutputStream {

/**
* Begins the streaming of glyphs.
*/
void startGlyphStream() throws IOException;

/**
* Streams an individual glyph from the given byte array.
*
* @param glyphData the source of the glyph data to stream from
* @param offset the position in the glyph data where the glyph starts
* @param size the size of the glyph data in bytes
*/
void streamGlyph(byte[] glyphData, int offset, int size) throws IOException;

/**
* Ends the streaming of glyphs.
*/
void endGlyphStream() throws IOException;

}

+ 49
- 0
src/java/org/apache/fop/fonts/truetype/TTFOutputStream.java View File

@@ -0,0 +1,49 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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$ */

package org.apache.fop.fonts.truetype;

import java.io.IOException;

/**
* An interface for writing a TrueType font to an output stream.
*/
public interface TTFOutputStream {

/**
* Starts writing the font.
*/
void startFontStream() throws IOException;

/**
* Returns an object for streaming TrueType tables.
*/
TTFTableOutputStream getTableOutputStream();

/**
* Returns an object for streaming TrueType glyphs in the glyf table.
*/
TTFGlyphOutputStream getGlyphOutputStream();

/**
* Ends writing the font.
*/
void endFontStream() throws IOException;

}

+ 246
- 279
src/java/org/apache/fop/fonts/truetype/TTFSubSetFile.java View File

@@ -20,8 +20,9 @@
package org.apache.fop.fonts.truetype;

import java.io.IOException;
import java.util.Iterator;
import java.util.HashMap;
import java.util.Map;
import java.util.SortedSet;


/**
@@ -42,24 +43,18 @@ public class TTFSubSetFile extends TTFFile {
* Offsets in name table to be filled out by table.
* The offsets are to the checkSum field
*/
private int cvtDirOffset = 0;
private int fpgmDirOffset = 0;
private int glyfDirOffset = 0;
private int headDirOffset = 0;
private int hheaDirOffset = 0;
private int hmtxDirOffset = 0;
private int locaDirOffset = 0;
private int maxpDirOffset = 0;
private int prepDirOffset = 0;
private Map<TTFTableName, Integer> offsets = new HashMap<TTFTableName, Integer>();

private int checkSumAdjustmentOffset = 0;
private int locaOffset = 0;

/** Stores the glyph offsets so that we can end strings at glyph boundaries */
private int[] glyphOffsets;

/**
* Default Constructor
*/
public TTFSubSetFile() {
this(false, false);
}

/**
@@ -71,16 +66,9 @@ public class TTFSubSetFile extends TTFFile {
super(useKerning, useAdvanced);
}

/**
* Initalize the output array
*/
private void init(int size) {
output = new byte[size];
realSize = 0;
currentPos = 0;

// createDirectory()
}
/** The dir tab entries in the new subset font. */
private Map<TTFTableName, TTFDirTabEntry> newDirTabs
= new HashMap<TTFTableName, TTFDirTabEntry>();

private int determineTableCount() {
int numTables = 4; //4 req'd tables: head,hhea,hmtx,maxp
@@ -88,7 +76,7 @@ public class TTFSubSetFile extends TTFFile {
throw new UnsupportedOperationException(
"OpenType fonts with CFF glyphs are not supported");
} else {
numTables += 2; //1 req'd table: glyf,loca
numTables += 5; //5 req'd tables: glyf,loca,post,name,OS/2
if (hasCvt()) {
numTables++;
}
@@ -119,7 +107,7 @@ public class TTFSubSetFile extends TTFFile {

// Create searchRange, entrySelector and rangeShift
int maxPow = maxPow2(numTables);
int searchRange = maxPow * 16;
int searchRange = (int) Math.pow(2, maxPow) * 16;
writeUShort(searchRange);
realSize += 2;

@@ -128,151 +116,122 @@ public class TTFSubSetFile extends TTFFile {

writeUShort((numTables * 16) - searchRange);
realSize += 2;
// Create space for the table entries (these must be in ASCII alphabetical order[A-Z] then[a-z])
writeTableName(TTFTableName.OS2);

// Create space for the table entries
if (hasCvt()) {
writeString("cvt ");
cvtDirOffset = currentPos;
currentPos += 12;
realSize += 16;
writeTableName(TTFTableName.CVT);
}

if (hasFpgm()) {
writeString("fpgm");
fpgmDirOffset = currentPos;
currentPos += 12;
realSize += 16;
writeTableName(TTFTableName.FPGM);
}
writeTableName(TTFTableName.GLYF);
writeTableName(TTFTableName.HEAD);
writeTableName(TTFTableName.HHEA);
writeTableName(TTFTableName.HMTX);
writeTableName(TTFTableName.LOCA);
writeTableName(TTFTableName.MAXP);
writeTableName(TTFTableName.NAME);
writeTableName(TTFTableName.POST);
if (hasPrep()) {
writeTableName(TTFTableName.PREP);
}
newDirTabs.put(TTFTableName.TABLE_DIRECTORY, new TTFDirTabEntry(0, currentPos));
}

writeString("glyf");
glyfDirOffset = currentPos;
currentPos += 12;
realSize += 16;

writeString("head");
headDirOffset = currentPos;
currentPos += 12;
realSize += 16;

writeString("hhea");
hheaDirOffset = currentPos;
private void writeTableName(TTFTableName tableName) {
writeString(tableName.getName());
offsets.put(tableName, currentPos);
currentPos += 12;
realSize += 16;
}

writeString("hmtx");
hmtxDirOffset = currentPos;
currentPos += 12;
realSize += 16;

writeString("loca");
locaDirOffset = currentPos;
currentPos += 12;
realSize += 16;

writeString("maxp");
maxpDirOffset = currentPos;
currentPos += 12;
realSize += 16;
private boolean hasCvt() {
return dirTabs.containsKey(TTFTableName.CVT);
}

if (hasPrep()) {
writeString("prep");
prepDirOffset = currentPos;
currentPos += 12;
realSize += 16;
}
private boolean hasFpgm() {
return dirTabs.containsKey(TTFTableName.FPGM);
}

private boolean hasPrep() {
return dirTabs.containsKey(TTFTableName.PREP);
}

/**
* Copy the cvt table as is from original font to subset font
* Create an empty loca table without updating checksum
*/
private boolean createCvt(FontFileReader in) throws IOException {
TTFDirTabEntry entry = (TTFDirTabEntry)dirTabs.get("cvt ");
private void createLoca(int size) throws IOException {
pad4();
locaOffset = currentPos;
int dirTableOffset = offsets.get(TTFTableName.LOCA);
writeULong(dirTableOffset + 4, currentPos);
writeULong(dirTableOffset + 8, size * 4 + 4);
currentPos += size * 4 + 4;
realSize += size * 4 + 4;
}

private boolean copyTable(FontFileReader in, TTFTableName tableName) throws IOException {
TTFDirTabEntry entry = dirTabs.get(tableName);
if (entry != null) {
pad4();
seekTab(in, "cvt ", 0);
seekTab(in, tableName, 0);
System.arraycopy(in.getBytes((int)entry.getOffset(), (int)entry.getLength()),
0, output, currentPos, (int)entry.getLength());

int checksum = getCheckSum(currentPos, (int)entry.getLength());
writeULong(cvtDirOffset, checksum);
writeULong(cvtDirOffset + 4, currentPos);
writeULong(cvtDirOffset + 8, (int)entry.getLength());
currentPos += (int)entry.getLength();
realSize += (int)entry.getLength();
updateCheckSum(currentPos, (int) entry.getLength(), tableName);
currentPos += (int) entry.getLength();
realSize += (int) entry.getLength();
return true;
} else {
return false;
//throw new IOException("Can't find cvt table");
}
}

private boolean hasCvt() {
return dirTabs.containsKey("cvt ");
}

private boolean hasFpgm() {
return dirTabs.containsKey("fpgm");
}

private boolean hasPrep() {
return dirTabs.containsKey("prep");
/**
* Copy the cvt table as is from original font to subset font
*/
private boolean createCvt(FontFileReader in) throws IOException {
return copyTable(in, TTFTableName.CVT);
}

/**
* Copy the fpgm table as is from original font to subset font
*/
private boolean createFpgm(FontFileReader in) throws IOException {
TTFDirTabEntry entry = (TTFDirTabEntry)dirTabs.get("fpgm");
if (entry != null) {
pad4();
seekTab(in, "fpgm", 0);
System.arraycopy(in.getBytes((int)entry.getOffset(), (int)entry.getLength()),
0, output, currentPos, (int)entry.getLength());
int checksum = getCheckSum(currentPos, (int)entry.getLength());
writeULong(fpgmDirOffset, checksum);
writeULong(fpgmDirOffset + 4, currentPos);
writeULong(fpgmDirOffset + 8, (int)entry.getLength());
currentPos += (int)entry.getLength();
realSize += (int)entry.getLength();
return true;
} else {
return false;
}
return copyTable(in, TTFTableName.FPGM);
}



/**
* Create an empty loca table without updating checksum
* Copy the name table as is from the original.
*/
private void createLoca(int size) throws IOException {
pad4();
locaOffset = currentPos;
writeULong(locaDirOffset + 4, currentPos);
writeULong(locaDirOffset + 8, size * 4 + 4);
currentPos += size * 4 + 4;
realSize += size * 4 + 4;
private boolean createName(FontFileReader in) throws IOException {
return copyTable(in, TTFTableName.NAME);
}

/**
* Copy the OS/2 table as is from the original.
*/
private boolean createOS2(FontFileReader in) throws IOException {
return copyTable(in, TTFTableName.OS2);
}

/**
* Copy the maxp table as is from original font to subset font
* and set num glyphs to size
*/
private void createMaxp(FontFileReader in, int size) throws IOException {
TTFDirTabEntry entry = (TTFDirTabEntry)dirTabs.get("maxp");
TTFTableName maxp = TTFTableName.MAXP;
TTFDirTabEntry entry = dirTabs.get(maxp);
if (entry != null) {
pad4();
seekTab(in, "maxp", 0);
seekTab(in, maxp, 0);
System.arraycopy(in.getBytes((int)entry.getOffset(), (int)entry.getLength()),
0, output, currentPos, (int)entry.getLength());
writeUShort(currentPos + 4, size);

int checksum = getCheckSum(currentPos, (int)entry.getLength());
writeULong(maxpDirOffset, checksum);
writeULong(maxpDirOffset + 4, currentPos);
writeULong(maxpDirOffset + 8, (int)entry.getLength());
updateCheckSum(currentPos, (int)entry.getLength(), maxp);
currentPos += (int)entry.getLength();
realSize += (int)entry.getLength();
} else {
@@ -280,28 +239,34 @@ public class TTFSubSetFile extends TTFFile {
}
}

private void createPost(FontFileReader in) throws IOException {
TTFTableName post = TTFTableName.POST;
TTFDirTabEntry entry = dirTabs.get(post);
if (entry != null) {
pad4();
seekTab(in, post, 0);
int newTableSize = 32; // This is the post table size with glyphs truncated
byte[] newPostTable = new byte[newTableSize];
// We only want the first 28 bytes (truncate the glyph names);
System.arraycopy(in.getBytes((int) entry.getOffset(), newTableSize),
0, newPostTable, 0, newTableSize);
// set the post table to Format 3.0
newPostTable[1] = 0x03;
System.arraycopy(newPostTable, 0, output, currentPos, newTableSize);
updateCheckSum(currentPos, newTableSize, post);
currentPos += newTableSize;
realSize += newTableSize;
} else {
throw new IOException("Can't find post table");
}
}


/**
* Copy the prep table as is from original font to subset font
*/
private boolean createPrep(FontFileReader in) throws IOException {
TTFDirTabEntry entry = (TTFDirTabEntry)dirTabs.get("prep");
if (entry != null) {
pad4();
seekTab(in, "prep", 0);
System.arraycopy(in.getBytes((int)entry.getOffset(), (int)entry.getLength()),
0, output, currentPos, (int)entry.getLength());

int checksum = getCheckSum(currentPos, (int)entry.getLength());
writeULong(prepDirOffset, checksum);
writeULong(prepDirOffset + 4, currentPos);
writeULong(prepDirOffset + 8, (int)entry.getLength());
currentPos += (int)entry.getLength();
realSize += (int)entry.getLength();
return true;
} else {
return false;
}
return copyTable(in, TTFTableName.PREP);
}


@@ -310,20 +275,17 @@ public class TTFSubSetFile extends TTFFile {
* and fill in size of hmtx table
*/
private void createHhea(FontFileReader in, int size) throws IOException {
TTFDirTabEntry entry = (TTFDirTabEntry)dirTabs.get("hhea");
TTFDirTabEntry entry = dirTabs.get(TTFTableName.HHEA);
if (entry != null) {
pad4();
seekTab(in, "hhea", 0);
System.arraycopy(in.getBytes((int)entry.getOffset(), (int)entry.getLength()),
0, output, currentPos, (int)entry.getLength());
writeUShort((int)entry.getLength() + currentPos - 2, size);

int checksum = getCheckSum(currentPos, (int)entry.getLength());
writeULong(hheaDirOffset, checksum);
writeULong(hheaDirOffset + 4, currentPos);
writeULong(hheaDirOffset + 8, (int)entry.getLength());
currentPos += (int)entry.getLength();
realSize += (int)entry.getLength();
seekTab(in, TTFTableName.HHEA, 0);
System.arraycopy(in.getBytes((int) entry.getOffset(), (int) entry.getLength()), 0,
output, currentPos, (int) entry.getLength());
writeUShort((int) entry.getLength() + currentPos - 2, size);

updateCheckSum(currentPos, (int) entry.getLength(), TTFTableName.HHEA);
currentPos += (int) entry.getLength();
realSize += (int) entry.getLength();
} else {
throw new IOException("Can't find hhea table");
}
@@ -337,10 +299,11 @@ public class TTFSubSetFile extends TTFFile {
* in checkSumAdjustmentOffset
*/
private void createHead(FontFileReader in) throws IOException {
TTFDirTabEntry entry = (TTFDirTabEntry)dirTabs.get("head");
TTFTableName head = TTFTableName.HEAD;
TTFDirTabEntry entry = dirTabs.get(head);
if (entry != null) {
pad4();
seekTab(in, "head", 0);
seekTab(in, head, 0);
System.arraycopy(in.getBytes((int)entry.getOffset(), (int)entry.getLength()),
0, output, currentPos, (int)entry.getLength());

@@ -352,11 +315,7 @@ public class TTFSubSetFile extends TTFFile {
output[currentPos + 50] = 0; // long locaformat
output[currentPos + 51] = 1; // long locaformat

int checksum = getCheckSum(currentPos, (int)entry.getLength());
writeULong(headDirOffset, checksum);
writeULong(headDirOffset + 4, currentPos);
writeULong(headDirOffset + 8, (int)entry.getLength());

updateCheckSum(currentPos, (int)entry.getLength(), head);
currentPos += (int)entry.getLength();
realSize += (int)entry.getLength();
} else {
@@ -369,30 +328,24 @@ public class TTFSubSetFile extends TTFFile {
* Create the glyf table and fill in loca table
*/
private void createGlyf(FontFileReader in,
Map glyphs) throws IOException {
TTFDirTabEntry entry = (TTFDirTabEntry)dirTabs.get("glyf");
Map<Integer, Integer> glyphs) throws IOException {
TTFTableName glyf = TTFTableName.GLYF;
TTFDirTabEntry entry = dirTabs.get(glyf);
int size = 0;
int start = 0;
int startPos = 0;
int endOffset = 0; // Store this as the last loca
if (entry != null) {
pad4();
start = currentPos;
startPos = currentPos;

/* Loca table must be in order by glyph index, so build
* an array first and then write the glyph info and
* location offset.
*/
int[] origIndexes = new int[glyphs.size()];

Iterator e = glyphs.keySet().iterator();
while (e.hasNext()) {
Integer origIndex = (Integer)e.next();
Integer subsetIndex = (Integer)glyphs.get(origIndex);
origIndexes[subsetIndex.intValue()] = origIndex.intValue();
}
int[] origIndexes = buildSubsetIndexToOrigIndexMap(glyphs);
glyphOffsets = new int[origIndexes.length];

for (int i = 0; i < origIndexes.length; i++) {
int glyphLength = 0;
int nextOffset = 0;
int origGlyphIndex = origIndexes[i];
if (origGlyphIndex >= (mtxTab.length - 1)) {
@@ -400,46 +353,64 @@ public class TTFSubSetFile extends TTFFile {
} else {
nextOffset = (int)mtxTab[origGlyphIndex + 1].getOffset();
}
glyphLength = nextOffset - (int)mtxTab[origGlyphIndex].getOffset();
int glyphOffset = (int)mtxTab[origGlyphIndex].getOffset();
int glyphLength = nextOffset - glyphOffset;

byte[] glyphData = in.getBytes(
(int)entry.getOffset() + glyphOffset,
glyphLength);
int endOffset1 = endOffset;
// Copy glyph
System.arraycopy(
in.getBytes((int)entry.getOffset() + (int)mtxTab[origGlyphIndex].getOffset(),
glyphLength), 0,
glyphData, 0,
output, currentPos,
glyphLength);


// Update loca table
writeULong(locaOffset + i * 4, currentPos - start);
if ((currentPos - start + glyphLength) > endOffset) {
endOffset = (currentPos - start + glyphLength);
writeULong(locaOffset + i * 4, currentPos - startPos);
if ((currentPos - startPos + glyphLength) > endOffset1) {
endOffset1 = (currentPos - startPos + glyphLength);
}

// Store the glyph boundary positions relative to the start of the font
glyphOffsets[i] = currentPos;
currentPos += glyphLength;
realSize += glyphLength;


endOffset = endOffset1;
}

size = currentPos - start;

int checksum = getCheckSum(start, size);
writeULong(glyfDirOffset, checksum);
writeULong(glyfDirOffset + 4, start);
writeULong(glyfDirOffset + 8, size);
size = currentPos - startPos;

currentPos += 12;
realSize += 12;
updateCheckSum(startPos, size + 12, glyf);

// Update loca checksum and last loca index
writeULong(locaOffset + glyphs.size() * 4, endOffset);

checksum = getCheckSum(locaOffset, glyphs.size() * 4 + 4);
writeULong(locaDirOffset, checksum);
int locaSize = glyphs.size() * 4 + 4;
int checksum = getCheckSum(output, locaOffset, locaSize);
writeULong(offsets.get(TTFTableName.LOCA), checksum);
int padSize = (locaOffset + locaSize) % 4;
newDirTabs.put(TTFTableName.LOCA,
new TTFDirTabEntry(locaOffset, locaSize + padSize));
} else {
throw new IOException("Can't find glyf table");
}
}

private int[] buildSubsetIndexToOrigIndexMap(Map<Integer, Integer> glyphs) {
int[] origIndexes = new int[glyphs.size()];
for (Map.Entry<Integer, Integer> glyph : glyphs.entrySet()) {
int origIndex = glyph.getKey();
int subsetIndex = glyph.getValue();
origIndexes[subsetIndex] = origIndex;
}
return origIndexes;
}

/**
* Create the hmtx table by copying metrics from original
@@ -448,8 +419,9 @@ public class TTFSubSetFile extends TTFFile {
* metric (key) to the subset metric (value)
*/
private void createHmtx(FontFileReader in,
Map glyphs) throws IOException {
TTFDirTabEntry entry = (TTFDirTabEntry)dirTabs.get("hmtx");
Map<Integer, Integer> glyphs) throws IOException {
TTFTableName hmtx = TTFTableName.HMTX;
TTFDirTabEntry entry = dirTabs.get(hmtx);

int longHorMetricSize = glyphs.size() * 2;
int leftSideBearingSize = glyphs.size() * 2;
@@ -458,10 +430,9 @@ public class TTFSubSetFile extends TTFFile {
if (entry != null) {
pad4();
//int offset = (int)entry.offset;
Iterator e = glyphs.keySet().iterator();
while (e.hasNext()) {
Integer origIndex = (Integer)e.next();
Integer subsetIndex = (Integer)glyphs.get(origIndex);
for (Map.Entry<Integer, Integer> glyph : glyphs.entrySet()) {
Integer origIndex = glyph.getKey();
Integer subsetIndex = glyph.getValue();

writeUShort(currentPos + subsetIndex.intValue() * 4,
mtxTab[origIndex.intValue()].getWx());
@@ -469,10 +440,7 @@ public class TTFSubSetFile extends TTFFile {
mtxTab[origIndex.intValue()].getLsb());
}

int checksum = getCheckSum(currentPos, hmtxSize);
writeULong(hmtxDirOffset, checksum);
writeULong(hmtxDirOffset + 4, currentPos);
writeULong(hmtxDirOffset + 8, hmtxSize);
updateCheckSum(currentPos, hmtxSize, hmtx);
currentPos += hmtxSize;
realSize += hmtxSize;
} else {
@@ -481,43 +449,37 @@ public class TTFSubSetFile extends TTFFile {
}

/**
* Returns a subset of the original font.
* Reads a font and creates a subset of the font.
*
* @param in FontFileReader to read from
* @param name Name to be checked for in the font file
* @param glyphs Map of glyphs (glyphs has old index as (Integer) key and
* new index as (Integer) value)
* @return A subset of the original font
* @throws IOException in case of an I/O problem
*/
public byte[] readFont(FontFileReader in, String name,
public void readFont(FontFileReader in, String name,
Map<Integer, Integer> glyphs) throws IOException {
fontFile = in;
//Check if TrueType collection, and that the name exists in the collection
if (!checkTTC(in, name)) {
if (!checkTTC(name)) {
throw new IOException("Failed to read font");
}

//Copy the Map as we're going to modify it
Map<Integer, Integer> subsetGlyphs = new java.util.HashMap<Integer, Integer>(glyphs);
Map<Integer, Integer> subsetGlyphs = new HashMap<Integer, Integer>(glyphs);

output = new byte[in.getFileSize()];

readDirTabs(in);
readFontHeader(in);
getNumGlyphs(in);
readHorizontalHeader(in);
readHorizontalMetrics(in);
readIndexToLocation(in);
readDirTabs();
readFontHeader();
getNumGlyphs();
readHorizontalHeader();
readHorizontalMetrics();
readIndexToLocation();

scanGlyphs(in, subsetGlyphs);

createDirectory(); // Create the TrueType header and directory

createHead(in);
createHhea(in, subsetGlyphs.size()); // Create the hhea table
createHmtx(in, subsetGlyphs); // Create hmtx table
createMaxp(in, subsetGlyphs.size()); // copy the maxp table
createDirectory(); // Create the TrueType header and directory

boolean optionalTableFound;
optionalTableFound = createCvt(in); // copy the cvt table
@@ -531,6 +493,16 @@ public class TTFSubSetFile extends TTFFile {
// fpgm is optional (used in TrueType fonts only)
log.debug("TrueType: fpgm table not present. Skipped.");
}
createLoca(subsetGlyphs.size()); // create empty loca table
createGlyf(in, subsetGlyphs); //create glyf table and update loca table

createOS2(in); // copy the OS/2 table
createHead(in);
createHhea(in, subsetGlyphs.size()); // Create the hhea table
createHmtx(in, subsetGlyphs); // Create hmtx table
createMaxp(in, subsetGlyphs.size()); // copy the maxp table
createName(in); // copy the name table
createPost(in); // copy the post table

optionalTableFound = createPrep(in); // copy prep table
if (!optionalTableFound) {
@@ -538,21 +510,59 @@ public class TTFSubSetFile extends TTFFile {
log.debug("TrueType: prep table not present. Skipped.");
}

createLoca(subsetGlyphs.size()); // create empty loca table
createGlyf(in, subsetGlyphs); //create glyf table and update loca table

pad4();
createCheckSumAdjustment();
}

/**
* Returns a subset of the fonts (readFont() MUST be called first in order to create the
* subset).
* @return byte array
*/
public byte[] getFontSubset() {
byte[] ret = new byte[realSize];
System.arraycopy(output, 0, ret, 0, realSize);

return ret;
}

private void handleGlyphSubset(TTFGlyphOutputStream glyphOut) throws IOException {
glyphOut.startGlyphStream();
// Stream all but the last glyph
for (int i = 0; i < glyphOffsets.length - 1; i++) {
glyphOut.streamGlyph(output, glyphOffsets[i],
glyphOffsets[i + 1] - glyphOffsets[i]);
}
// Stream the last glyph
TTFDirTabEntry glyf = newDirTabs.get(TTFTableName.GLYF);
long lastGlyphLength = glyf.getLength()
- (glyphOffsets[glyphOffsets.length - 1] - glyf.getOffset());
glyphOut.streamGlyph(output, glyphOffsets[glyphOffsets.length - 1],
(int) lastGlyphLength);
glyphOut.endGlyphStream();
}

@Override
public void stream(TTFOutputStream ttfOut) throws IOException {
SortedSet<Map.Entry<TTFTableName, TTFDirTabEntry>> sortedDirTabs
= sortDirTabMap(newDirTabs);
TTFTableOutputStream tableOut = ttfOut.getTableOutputStream();
TTFGlyphOutputStream glyphOut = ttfOut.getGlyphOutputStream();

ttfOut.startFontStream();
for (Map.Entry<TTFTableName, TTFDirTabEntry> entry : sortedDirTabs) {
if (entry.getKey().equals(TTFTableName.GLYF)) {
handleGlyphSubset(glyphOut);
} else {
tableOut.streamTable(output, (int) entry.getValue().getOffset(),
(int) entry.getValue().getLength());
}
}
ttfOut.endFontStream();
}

private void scanGlyphs(FontFileReader in, Map<Integer, Integer> subsetGlyphs)
throws IOException {
TTFDirTabEntry glyfTableInfo = (TTFDirTabEntry) dirTabs.get("glyf");
TTFDirTabEntry glyfTableInfo = dirTabs.get(TTFTableName.GLYF);
if (glyfTableInfo == null) {
throw new IOException("Glyf table could not be found");
}
@@ -610,20 +620,6 @@ public class TTFSubSetFile extends TTFFile {
output[pos + 1] = b2;
}

/**
* Appends a ULONG to the output array,
* updates currentPos but not realSize
*/
private void writeULong(int s) {
byte b1 = (byte)((s >> 24) & 0xff);
byte b2 = (byte)((s >> 16) & 0xff);
byte b3 = (byte)((s >> 8) & 0xff);
byte b4 = (byte)(s & 0xff);
writeByte(b1);
writeByte(b2);
writeByte(b3);
writeByte(b4);
}

/**
* Appends a ULONG to the output array,
@@ -640,41 +636,17 @@ public class TTFSubSetFile extends TTFFile {
output[pos + 3] = b4;
}

/**
* Read a signed short value at given position
*/
private short readShort(int pos) {
int ret = readUShort(pos);
return (short)ret;
}

/**
* Read a unsigned short value at given position
*/
private int readUShort(int pos) {
int ret = output[pos];
if (ret < 0) {
ret += 256;
}
ret = ret << 8;
if (output[pos + 1] < 0) {
ret |= output[pos + 1] + 256;
} else {
ret |= output[pos + 1];
}

return ret;
}

/**
* Create a padding in the fontfile to align
* on a 4-byte boundary
*/
private void pad4() {
int padSize = currentPos % 4;
for (int i = 0; i < padSize; i++) {
output[currentPos++] = 0;
realSize++;
int padSize = getPadSize(currentPos);
if (padSize < 4) {
for (int i = 0; i < padSize; i++) {
output[currentPos++] = 0;
realSize++;
}
}
}

@@ -683,23 +655,25 @@ public class TTFSubSetFile extends TTFFile {
*/
private int maxPow2(int max) {
int i = 0;
while (Math.pow(2, i) < max) {
while (Math.pow(2, i) <= max) {
i++;
}

return (i - 1);
}

private int log2(int num) {
return (int)(Math.log(num) / Math.log(2));
}


private int getCheckSum(int start, int size) {
return (int)getLongCheckSum(start, size);
private void updateCheckSum(int tableStart, int tableSize, TTFTableName tableName) {
int checksum = getCheckSum(output, tableStart, tableSize);
int offset = offsets.get(tableName);
int padSize = getPadSize(tableStart + tableSize);
newDirTabs.put(tableName, new TTFDirTabEntry(tableStart, tableSize + padSize));
writeULong(offset, checksum);
writeULong(offset + 4, tableStart);
writeULong(offset + 8, tableSize);
}

private long getLongCheckSum(int start, int size) {
private static int getCheckSum(byte[] data, int start, int size) {
// All the tables here are aligned on four byte boundaries
// Add remainder to size if it's not a multiple of 4
int remainder = size % 4;
@@ -710,26 +684,19 @@ public class TTFSubSetFile extends TTFFile {
long sum = 0;

for (int i = 0; i < size; i += 4) {
int l = (output[start + i] << 24);
l += (output[start + i + 1] << 16);
l += (output[start + i + 2] << 16);
l += (output[start + i + 3] << 16);
sum += l;
if (sum > 0xffffffff) {
sum = sum - 0xffffffff;
long l = 0;
for (int j = 0; j < 4; j++) {
l <<= 8;
l |= data[start + i + j] & 0xff;
}
sum += l;
}

return sum;
return (int) sum;
}

private void createCheckSumAdjustment() {
long sum = getLongCheckSum(0, realSize);
long sum = getCheckSum(output, 0, realSize);
int checksum = (int)(0xb1b0afba - sum);
writeULong(checkSumAdjustmentOffset, checksum);
}

}




+ 163
- 0
src/java/org/apache/fop/fonts/truetype/TTFTableName.java View File

@@ -0,0 +1,163 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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$ */

package org.apache.fop.fonts.truetype;


/**
* Represents table names as found in a TrueType font's Table Directory.
* TrueType fonts may have custom tables so we cannot use an enum.
*/
public final class TTFTableName {

/** The first table in a TrueType font file containing metadata about other tables. */
public static final TTFTableName TABLE_DIRECTORY = new TTFTableName("tableDirectory");

/** Embedded bitmap data. */
public static final TTFTableName EBDT = new TTFTableName("EBDT");

/** Embedded bitmap location data. */
public static final TTFTableName EBLC = new TTFTableName("EBLC");

/** Embedded bitmap scaling data. */
public static final TTFTableName EBSC = new TTFTableName("EBSC");

/** A FontForge specific table. */
public static final TTFTableName FFTM = new TTFTableName("FFTM");

/** Divides glyphs into various classes that make using the GPOS/GSUB tables easier. */
public static final TTFTableName GDEF = new TTFTableName("GDEF");

/** Provides kerning information, mark-to-base, etc. for opentype fonts. */
public static final TTFTableName GPOS = new TTFTableName("GPOS");

/** Provides ligature information, swash, etc. for opentype fonts. */
public static final TTFTableName GSUB = new TTFTableName("GSUB");

/** Linear threshold table. */
public static final TTFTableName LTSH = new TTFTableName("LTSH");

/** OS/2 and Windows specific metrics. */
public static final TTFTableName OS2 = new TTFTableName("OS/2");

/** PCL 5 data. */
public static final TTFTableName PCLT = new TTFTableName("PCLT");

/** Vertical Device Metrics table. */
public static final TTFTableName VDMX = new TTFTableName("VDMX");

/** Character to glyph mapping. */
public static final TTFTableName CMAP = new TTFTableName("cmap");

/** Control Value Table. */
public static final TTFTableName CVT = new TTFTableName("cvt ");

/** Font program. */
public static final TTFTableName FPGM = new TTFTableName("fpgm");

/** Grid-fitting and scan conversion procedure (grayscale). */
public static final TTFTableName GASP = new TTFTableName("gasp");

/** Glyph data. */
public static final TTFTableName GLYF = new TTFTableName("glyf");

/** Horizontal device metrics. */
public static final TTFTableName HDMX = new TTFTableName("hdmx");

/** Font header. */
public static final TTFTableName HEAD = new TTFTableName("head");

/** Horizontal header. */
public static final TTFTableName HHEA = new TTFTableName("hhea");

/** Horizontal metrics. */
public static final TTFTableName HMTX = new TTFTableName("hmtx");

/** Kerning. */
public static final TTFTableName KERN = new TTFTableName("kern");

/** Index to location. */
public static final TTFTableName LOCA = new TTFTableName("loca");

/** Maximum profile. */
public static final TTFTableName MAXP = new TTFTableName("maxp");

/** Naming table. */
public static final TTFTableName NAME = new TTFTableName("name");

/** PostScript information. */
public static final TTFTableName POST = new TTFTableName("post");

/** CVT Program. */
public static final TTFTableName PREP = new TTFTableName("prep");

/** Vertical Metrics header. */
public static final TTFTableName VHEA = new TTFTableName("vhea");

/** Vertical Metrics. */
public static final TTFTableName VMTX = new TTFTableName("vmtx");

private final String name;

private TTFTableName(String name) {
this.name = name;
}

/**
* Returns the name of the table as it should be in the Directory Table.
*/
public String getName() {
return name;
}

/**
* Returns an instance of this class corresponding to the given string representation.
* @param tableName table name as in the Table Directory
* @return TTFTableName
*/
public static TTFTableName getValue(String tableName) {
if (tableName != null) {
return new TTFTableName(tableName);
}
throw new IllegalArgumentException("A TrueType font table name must not be null");
}

@Override
public int hashCode() {
return name.hashCode();
}

@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof TTFTableName)) {
return false;
}
TTFTableName to = (TTFTableName) o;
return this.name.equals(to.getName());
}

@Override
public String toString() {
return name;
}

}

+ 37
- 0
src/java/org/apache/fop/fonts/truetype/TTFTableOutputStream.java View File

@@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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$ */

package org.apache.fop.fonts.truetype;

import java.io.IOException;

/**
* An interface for writing a TrueType table to an output stream.
*/
public interface TTFTableOutputStream {

/**
* Streams a table from the given byte array.
*
* @param ttfData the source of the table to stream from
* @param offset the position in the byte array where the table starts
* @param size the size of the table in bytes
*/
void streamTable(byte[] ttfData, int offset, int size) throws IOException;
}

+ 3
- 3
src/java/org/apache/fop/hyphenation/HyphenationTreeCache.java View File

@@ -79,7 +79,7 @@ public class HyphenationTreeCache {
String userKey = null;
if (hyphPatNames != null) {
String key = constructLlccKey(lang, country);
key.replace('_', '-');
key = key.replace('_', '-');
userKey = (String) hyphPatNames.get(key);
}
return userKey;
@@ -96,7 +96,7 @@ public class HyphenationTreeCache {

/**
* Notes a key to a hyphenation tree as missing.
* This is to avoid searching a second time for a hyphneation pattern file which is not
* This is to avoid searching a second time for a hyphenation pattern file which is not
* available.
* @param key the key (ex. "de_CH" or "en")
*/
@@ -109,7 +109,7 @@ public class HyphenationTreeCache {

/**
* Indicates whether a hyphenation file has been requested before but it wasn't available.
* This is to avoid searching a second time for a hyphneation pattern file which is not
* This is to avoid searching a second time for a hyphenation pattern file which is not
* available.
* @param key the key (ex. "de_CH" or "en")
* @return true if the hyphenation tree is unavailable

+ 10
- 6
src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java View File

@@ -41,12 +41,16 @@ public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm {
* @param topLevelLM the top level layout manager
* @param pageProvider the page provider
* @param layoutListener the layout listener
* @param alignment alignment of the paragraph/page. One of {@link Constants#EN_START},
* {@link Constants#EN_JUSTIFY}, {@link Constants#EN_CENTER},
* {@link Constants#EN_END}.
* For pages, {@link Constants#EN_BEFORE} and {@link Constants#EN_AFTER}
* are mapped to the corresponding inline properties,
* {@link Constants#EN_START} and {@link Constants#EN_END}.
* @param alignment alignment of the paragraph/page. One of
* {@link org.apache.fop.fo.Constants#EN_START},
* {@link org.apache.fop.fo.Constants#EN_JUSTIFY},
* {@link org.apache.fop.fo.Constants#EN_CENTER},
* {@link org.apache.fop.fo.Constants#EN_END}.
* For pages, {@link org.apache.fop.fo.Constants#EN_BEFORE} and
* {@link org.apache.fop.fo.Constants#EN_AFTER}
* are mapped to the corresponding inline properties,
* {@link org.apache.fop.fo.Constants#EN_START} and
* {@link org.apache.fop.fo.Constants#EN_END}.
* @param alignmentLast alignment of the paragraph's last line
* @param footnoteSeparatorLength length of footnote separator
* @param partOverflowRecovery {@code true} if too long elements should be moved to

+ 23
- 11
src/java/org/apache/fop/layoutmgr/BreakElement.java View File

@@ -46,8 +46,11 @@ public class BreakElement extends UnresolvedListElement {
* Create a new BreakElement for the given {@code position}, {@code penaltyValue}
* and {@code breakClass}. (Used principally to generate break-possibilities in
* ranges of content that must be kept together within the context corresponding
* to the {@code breakClass}; expected to be one of {@link Constants#EN_AUTO},
* {@link Constants#EN_LINE}, {@link Constants#EN_COLUMN} or {@link Constants#EN_PAGE})
* to the {@code breakClass}; expected to be one of
* {@link org.apache.fop.fo.Constants#EN_AUTO},
* {@link org.apache.fop.fo.Constants#EN_LINE},
* {@link org.apache.fop.fo.Constants#EN_COLUMN} or
* {@link org.apache.fop.fo.Constants#EN_PAGE})
* @param position the corresponding {@link Position}
* @param penaltyValue the penalty value
* @param breakClass the break class
@@ -64,9 +67,12 @@ public class BreakElement extends UnresolvedListElement {
* @param position the Position instance needed by the addAreas stage of the LMs.
* @param penaltyWidth the penalty width
* @param penaltyValue the penalty value for the penalty element to be constructed
* @param breakClass the break class of this penalty (one of {@link Constants#EN_AUTO},
* {@link Constants#EN_COLUMN}, {@link Constants#EN_PAGE},
* {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE})
* @param breakClass the break class of this penalty (one of
* {@link org.apache.fop.fo.Constants#EN_AUTO},
* {@link org.apache.fop.fo.Constants#EN_COLUMN},
* {@link org.apache.fop.fo.Constants#EN_PAGE},
* {@link org.apache.fop.fo.Constants#EN_EVEN_PAGE},
* {@link org.apache.fop.fo.Constants#EN_ODD_PAGE})
* @param context the layout context which contains the pending conditional elements
*/
public BreakElement(Position position, int penaltyWidth, int penaltyValue,
@@ -120,9 +126,12 @@ public class BreakElement extends UnresolvedListElement {
/**
* Returns the break class of this penalty.
*
* @return one of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN},
* {@link Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE},
* {@link Constants#EN_ODD_PAGE}
* @return one of
* {@link org.apache.fop.fo.Constants#EN_AUTO},
* {@link org.apache.fop.fo.Constants#EN_COLUMN},
* {@link org.apache.fop.fo.Constants#EN_PAGE},
* {@link org.apache.fop.fo.Constants#EN_EVEN_PAGE},
* {@link org.apache.fop.fo.Constants#EN_ODD_PAGE}.
*/
public int getBreakClass() {
return breakClass;
@@ -131,9 +140,12 @@ public class BreakElement extends UnresolvedListElement {
/**
* Sets the break class.
*
* @param breakClass one of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN},
* {@link Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE},
* {@link Constants#EN_ODD_PAGE}
* @param breakClass one of
* {@link org.apache.fop.fo.Constants#EN_AUTO},
* {@link org.apache.fop.fo.Constants#EN_COLUMN},
* {@link org.apache.fop.fo.Constants#EN_PAGE},
* {@link org.apache.fop.fo.Constants#EN_EVEN_PAGE},
* {@link org.apache.fop.fo.Constants#EN_ODD_PAGE}.
*/
public void setBreakClass(int breakClass) {
this.breakClass = breakClass;

+ 5
- 2
src/java/org/apache/fop/layoutmgr/KnuthPenalty.java View File

@@ -72,8 +72,11 @@ public class KnuthPenalty extends KnuthElement {
* @param penalty the penalty value of this penalty
* @param penaltyFlagged is this penalty flagged?
* @param breakClass the break class of this penalty (one of
* {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN}, {@link Constants#EN_PAGE},
* {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE})
* {@link org.apache.fop.fo.Constants#EN_AUTO},
* {@link org.apache.fop.fo.Constants#EN_COLUMN},
* {@link org.apache.fop.fo.Constants#EN_PAGE},
* {@link org.apache.fop.fo.Constants#EN_EVEN_PAGE},
* {@link org.apache.fop.fo.Constants#EN_ODD_PAGE}).
* @param pos the Position stored in this penalty
* @param isAuxiliary is this penalty auxiliary?
*/

+ 8
- 1
src/java/org/apache/fop/pdf/AbstractPDFStream.java View File

@@ -78,7 +78,7 @@ public abstract class AbstractPDFStream extends PDFObject {
* from outside.
*/
protected void setupFilterList() {
if (!getFilterList().isInitialized()) {
if (multipleFiltersAllowed() && !getFilterList().isInitialized()) {
getFilterList().addDefaultFilters(
getDocumentSafely().getFilterMap(),
getDefaultFilterName());
@@ -273,4 +273,11 @@ public abstract class AbstractPDFStream extends PDFObject {
//nop: No default implicit filters
}

/**
* Whether multiple filters can be applied.
* @return true if multiple filters allowed
*/
protected boolean multipleFiltersAllowed() {
return true;
}
}

+ 4
- 0
src/java/org/apache/fop/pdf/AlphaRasterImage.java View File

@@ -212,6 +212,10 @@ public class AlphaRasterImage implements PDFImage {
return null;
}

/** {@inheritDoc} */
public boolean multipleFiltersAllowed() {
return true;
}
}



+ 18
- 2
src/java/org/apache/fop/pdf/BitmapImage.java View File

@@ -37,6 +37,8 @@ public class BitmapImage implements PDFImage {
private PDFColor transparent = null;
private String key;
private PDFDocument pdfDoc;
private PDFFilter pdfFilter;
private boolean multipleFiltersAllowed = true;

/**
* Create a bitmap image.
@@ -208,9 +210,23 @@ public class BitmapImage implements PDFImage {
* {@inheritDoc}
*/
public PDFFilter getPDFFilter() {
return null;
return pdfFilter;
}

}
public void setPDFFilter(PDFFilter pdfFilter) {
this.pdfFilter = pdfFilter;
}

/** {@inheritDoc} */
public boolean multipleFiltersAllowed() {
return multipleFiltersAllowed;
}

/**
* Disallows multiple filters.
*/
public void disallowMultipleFilters() {
multipleFiltersAllowed = false;
}

}

+ 1
- 1
src/java/org/apache/fop/pdf/PDFColor.java View File

@@ -30,7 +30,7 @@ import org.apache.xmlgraphics.java2d.color.DeviceCMYKColorSpace;
* image. And in this context, only RGB and Gray values are used.
* <p>
* Use of this class is discouraged. {@link PDFColorHandler} is now used for in-content color
* selection. For masked bitmaps, it may be wiser to switch to {@link Color} in the long run.
* selection. For masked bitmaps, it may be wiser to switch to {@link java.awt.Color} in the long run.
*/
public class PDFColor extends PDFPathPaint {
// could be 3.0 as well.

+ 4
- 1
src/java/org/apache/fop/pdf/PDFEmbeddedFile.java View File

@@ -38,7 +38,10 @@ public class PDFEmbeddedFile extends PDFStream {
put("Params", params);
}

/** {@inheritDoc} */
/**
* Determine if should encode on the fly.
* @return true if should encode on the fly
*/
protected boolean isEncodingOnTheFly() {
//Acrobat doesn't like an indirect /Length object in this case,
//but only when the embedded file is a PDF file.

+ 3
- 2
src/java/org/apache/fop/pdf/PDFFactory.java View File

@@ -45,6 +45,7 @@ import org.apache.commons.logging.LogFactory;

import org.apache.xmlgraphics.java2d.color.ColorUtil;
import org.apache.xmlgraphics.java2d.color.NamedColorSpace;

import org.apache.xmlgraphics.xmp.Metadata;

import org.apache.fop.fonts.CIDFont;
@@ -1674,8 +1675,8 @@ public class PDFFactory {
FontFileReader reader = new FontFileReader(in);

TTFSubSetFile subset = new TTFSubSetFile();
byte[] subsetFont = subset.readFont(reader,
mbfont.getTTCName(), mbfont.getUsedGlyphs());
subset.readFont(reader, mbfont.getTTCName(), mbfont.getUsedGlyphs());
byte[] subsetFont = subset.getFontSubset();
// Only TrueType CID fonts are supported now

embeddedFont = new PDFTTFStream(subsetFont.length);

+ 8
- 0
src/java/org/apache/fop/pdf/PDFImage.java View File

@@ -151,5 +151,13 @@ public interface PDFImage {
*/
String getFilterHint();

/**
* Indicates whether multiple image filters are allowed; this is implemented because Adobe
* Reader does not like multiple FlateDecode filters applied to an image even though that
* allowed by the PDF spec; this is probable due to security concerns since many PDF malware
* exploits, like zip bombs, make use of a chain of FlateDecode filters.
*/
boolean multipleFiltersAllowed();

}


+ 5
- 0
src/java/org/apache/fop/pdf/PDFImageXObject.java View File

@@ -166,4 +166,9 @@ public class PDFImageXObject extends PDFXObject {
return pdfimage.getFilterHint();
}

/** {@inheritDoc} */
protected boolean multipleFiltersAllowed() {
return pdfimage.multipleFiltersAllowed();
}

}

+ 0
- 6
src/java/org/apache/fop/pdf/PDFObject.java View File

@@ -22,7 +22,6 @@ package org.apache.fop.pdf;
// Java
import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -210,11 +209,6 @@ public abstract class PDFObject implements PDFWritable {
return pdf.length;
}

/** {@inheritDoc} */
public void outputInline(OutputStream out, Writer writer) throws IOException {
throw new UnsupportedOperationException("Don't use anymore: " + getClass().getName());
}

/** {@inheritDoc} */
public void outputInline(OutputStream out, StringBuilder textBuffer) throws IOException {
if (hasObjectNumber()) {

+ 23
- 31
src/java/org/apache/fop/pdf/PDFResources.java View File

@@ -21,9 +21,8 @@ package org.apache.fop.pdf;

import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;

@@ -46,33 +45,33 @@ public class PDFResources extends PDFDictionary {
/**
* /Font objects keyed by their internal name
*/
protected Map fonts = new HashMap();
protected Map<String, PDFFont> fonts = new LinkedHashMap<String, PDFFont>();

/**
* Set of XObjects
*/
protected Set xObjects = new HashSet();
protected Set<PDFXObject> xObjects = new LinkedHashSet<PDFXObject>();

/**
* Set of patterns
*/
protected Set patterns = new HashSet();
protected Set<PDFPattern> patterns = new LinkedHashSet<PDFPattern>();

/**
* Set of shadings
*/
protected Set shadings = new HashSet();
protected Set<PDFShading> shadings = new LinkedHashSet<PDFShading>();

/**
* Set of ExtGStates
*/
protected Set gstates = new HashSet();
protected Set<PDFGState> gstates = new LinkedHashSet<PDFGState>();

/** Map of color spaces (key: color space name) */
protected Map colorSpaces = new HashMap();
protected Map<PDFName, PDFColorSpace> colorSpaces = new LinkedHashMap<PDFName, PDFColorSpace>();

/** Map of ICC color spaces (key: ICC profile description) */
protected Map iccColorSpaces = new HashMap();
protected Map<String, PDFICCBasedColorSpace> iccColorSpaces = new LinkedHashMap<String, PDFICCBasedColorSpace>();

/**
* create a /Resources object.
@@ -168,7 +167,7 @@ public class PDFResources extends PDFDictionary {
PDFICCBasedColorSpace icc = (PDFICCBasedColorSpace)colorSpace;
String desc = ColorProfileUtil.getICCProfileDescription(
icc.getICCStream().getICCProfile());
this.iccColorSpaces.put(desc, colorSpace);
this.iccColorSpaces.put(desc, icc);
}
}

@@ -178,7 +177,7 @@ public class PDFResources extends PDFDictionary {
* @return the requested color space or null if it wasn't found
*/
public PDFICCBasedColorSpace getICCColorSpaceByProfileName(String desc) {
PDFICCBasedColorSpace cs = (PDFICCBasedColorSpace)this.iccColorSpaces.get(desc);
PDFICCBasedColorSpace cs = this.iccColorSpaces.get(desc);
return cs;
}

@@ -188,7 +187,7 @@ public class PDFResources extends PDFDictionary {
* @return the requested color space or null if it wasn't found
*/
public PDFColorSpace getColorSpace(PDFName name) {
PDFColorSpace cs = (PDFColorSpace)this.colorSpaces.get(name);
PDFColorSpace cs = this.colorSpaces.get(name);
return cs;
}

@@ -202,28 +201,24 @@ public class PDFResources extends PDFDictionary {
if (!this.fonts.isEmpty()) {
PDFDictionary dict = new PDFDictionary(this);
/* construct PDF dictionary of font object references */
Iterator fontIterator = this.fonts.keySet().iterator();
while (fontIterator.hasNext()) {
String fontName = (String)fontIterator.next();
dict.put(fontName, (PDFFont)this.fonts.get(fontName));
for (Map.Entry<String, PDFFont> entry : fonts.entrySet()) {
dict.put(entry.getKey(), entry.getValue());
}
put("Font", dict);
}

if (!this.shadings.isEmpty()) {
PDFDictionary dict = new PDFDictionary(this);
for (Iterator iter = shadings.iterator(); iter.hasNext();) {
PDFShading currentShading = (PDFShading)iter.next();
dict.put(currentShading.getName(), currentShading);
for (PDFShading shading : shadings) {
dict.put(shading.getName(), shading);
}
put("Shading", dict);
}

if (!this.patterns.isEmpty()) {
PDFDictionary dict = new PDFDictionary(this);
for (Iterator iter = patterns.iterator(); iter.hasNext();) {
PDFPattern currentPattern = (PDFPattern)iter.next();
dict.put(currentPattern.getName(), currentPattern);
for (PDFPattern pattern : patterns) {
dict.put(pattern.getName(), pattern);
}
put("Pattern", dict);
}
@@ -237,26 +232,23 @@ public class PDFResources extends PDFDictionary {

if (this.xObjects != null && !this.xObjects.isEmpty()) {
PDFDictionary dict = new PDFDictionary(this);
for (Iterator iter = xObjects.iterator(); iter.hasNext();) {
PDFXObject xobj = (PDFXObject)iter.next();
dict.put(xobj.getName().toString(), xobj);
for (PDFXObject xObject : xObjects) {
dict.put(xObject.getName().toString(), xObject);
}
put("XObject", dict);
}

if (!this.gstates.isEmpty()) {
PDFDictionary dict = new PDFDictionary(this);
for (Iterator iter = gstates.iterator(); iter.hasNext();) {
PDFGState gs = (PDFGState)iter.next();
dict.put(gs.getName(), gs);
for (PDFGState gstate : gstates) {
dict.put(gstate.getName(), gstate);
}
put("ExtGState", dict);
}

if (!this.colorSpaces.isEmpty()) {
PDFDictionary dict = new PDFDictionary(this);
for (Iterator iter = colorSpaces.values().iterator(); iter.hasNext();) {
PDFColorSpace colorSpace = (PDFColorSpace)iter.next();
for (PDFColorSpace colorSpace : colorSpaces.values()) {
dict.put(colorSpace.getName(), colorSpace);
}
put("ColorSpace", dict);

+ 2
- 1
src/java/org/apache/fop/render/ImageHandler.java View File

@@ -33,7 +33,8 @@ public interface ImageHandler extends ImageHandlerBase {
* Indicates whether the image handler is compatible with the indicated target represented
* by the rendering context object and with the image to be processed. The image is also
* passed as a parameter because a handler might not support every subtype of image that is
* presented. For example: in the case of {@link ImageXMLDOM}, the image might carry an SVG
* presented. For example: in the case of
* {@link org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM}, the image might carry an SVG
* or some other XML format. One handler might only handle SVG but no other XML format.
* @param targetContext the target rendering context
* @param image the image to be processed (or null if only to check based on the rendering

+ 2
- 1
src/java/org/apache/fop/render/afp/AFPDocumentHandler.java View File

@@ -58,7 +58,8 @@ import org.apache.fop.render.intermediate.IFException;
import org.apache.fop.render.intermediate.IFPainter;

/**
* {@link IFDocumentHandler} implementation that produces AFP (MO:DCA).
* {@link org.apache.fop.render.intermediate.IFDocumentHandler} implementation that
* produces AFP (MO:DCA).
*/
public class AFPDocumentHandler extends AbstractBinaryWritingIFDocumentHandler
implements AFPCustomizable {

+ 1
- 1
src/java/org/apache/fop/render/afp/extensions/AFPIncludeFormMap.java View File

@@ -27,7 +27,7 @@ import org.xml.sax.helpers.AttributesImpl;

/**
* This extension allows to include an AFP form map resource. It is implemented as an extension
* attachment ({@link ExtensionAttachment}).
* attachment ({@link org.apache.fop.fo.extensions.ExtensionAttachment}).
*/
public class AFPIncludeFormMap extends AFPExtensionAttachment {


+ 2
- 2
src/java/org/apache/fop/render/afp/extensions/AFPIncludeFormMapElement.java View File

@@ -32,8 +32,8 @@ import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.extensions.ExtensionAttachment;

/**
* This class extends the {@link ExtensionObj} class. It represents the "include-form-map"
* extension in the FO tree.
* This class extends the {@link org.apache.fop.fo.extensions.ExtensionObj} class.
* It represents the "include-form-map" extension in the FO tree.
*/
public class AFPIncludeFormMapElement extends AbstractAFPExtensionObject {


+ 1
- 1
src/java/org/apache/fop/render/afp/extensions/AFPPageOverlay.java View File

@@ -25,7 +25,7 @@ import org.xml.sax.helpers.AttributesImpl;

/**
* This extension allows to include an AFP Page Overlay resource. It is implemented as an extension
* attachment ({@link ExtensionAttachment}).
* attachment ({@link org.apache.fop.fo.extensions.ExtensionAttachment}).
*/
public class AFPPageOverlay extends AFPExtensionAttachment {


+ 2
- 1
src/java/org/apache/fop/render/bitmap/AbstractBitmapDocumentHandler.java View File

@@ -47,7 +47,8 @@ import org.apache.fop.render.java2d.Java2DPainter;
import org.apache.fop.render.java2d.Java2DUtil;

/**
* Abstract {@link IFDocumentHandler} implementation for producing bitmap images.
* Abstract {@link org.apache.fop.render.intermediate.IFDocumentHandler} implementation
* for producing bitmap images.
*/
public abstract class AbstractBitmapDocumentHandler extends AbstractBinaryWritingIFDocumentHandler {


+ 2
- 1
src/java/org/apache/fop/render/bitmap/PNGDocumentHandler.java View File

@@ -23,7 +23,8 @@ import org.apache.fop.apps.MimeConstants;
import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator;

/**
* {@link IFDocumentHandler} implementation that produces PNG files.
* {@link org.apache.fop.render.intermediate.IFDocumentHandler} implementation
* that produces PNG files.
*/
public class PNGDocumentHandler extends AbstractBitmapDocumentHandler {


+ 0
- 0
src/java/org/apache/fop/render/bitmap/TIFFDocumentHandler.java View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save