You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ga...@apache.org on 2012/06/23 21:31:39 UTC
svn commit: r1353186 [1/5] - in /xmlgraphics/fop/branches/fop-1_1rc1: ./
src/documentation/content/xdocs/trunk/ src/java/META-INF/services/
src/java/org/apache/fop/complexscripts/fonts/
src/java/org/apache/fop/fo/properties/ src/java/org/apache/fop/fon...
Author: gadams
Date: Sat Jun 23 19:31:33 2012
New Revision: 1353186
URL: http://svn.apache.org/viewvc?rev=1353186&view=rev
Log:
Merge from origin/trunk.
Added:
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CMapSegment.java
- copied, changed from r1345841, xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/BFEntry.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/EmbeddingMode.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/TTFGlyphOutputStream.java
- copied, changed from r1345841, xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/fonts/DejaVuLGCSerifTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/TTFOutputStream.java
- copied, changed from r1345841, xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/fonts/EncodingModeTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/TTFTableName.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/TTFTableOutputStream.java
- copied, changed from r1345841, xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/fonts/EncodingModeTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/pdf/ImageRawPNGAdapter.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawPNG.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/ImageEncoderPNG.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/PSFontResource.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/PSImageHandlerRawPNG.java
- copied, changed from r1345841, xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/PSImageHandlerRenderedImage.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/fonts/
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/fonts/PSTTFGenerator.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/fonts/PSTTFGlyphOutputStream.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/fonts/PSTTFOutputStream.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/fonts/PSTTFTableOutputStream.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/util/HexEncoder.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/fonts/FOPFontsTestSuite.java
- copied, changed from r1345841, xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/fonts/EncodingModeTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/fonts/truetype/FontFileReaderTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/fonts/truetype/TTFFileTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/fonts/truetype/TTFSubSetFileTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/fonts/truetype/TTFTableNameTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/render/RawPNGTestUtil.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/render/pdf/ImageRawPNGAdapterTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/render/ps/ImageEncoderPNGTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/render/ps/RenderPSTestSuite.java
- copied, changed from r1345841, xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/fonts/EncodingModeTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/render/ps/fonts/
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/render/ps/fonts/PSTTFGeneratorTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/render/ps/fonts/PSTTFGlyphOutputStreamTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/render/ps/fonts/PSTTFOutputStreamTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/render/ps/fonts/PSTTFTableOutputStreamTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/util/HexEncoderTestCase.java
- copied, changed from r1345841, xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/fonts/DejaVuLGCSerifTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/test/resources/fonts/ttf/DroidSansMono.LICENSE
xmlgraphics/fop/branches/fop-1_1rc1/test/resources/fonts/ttf/DroidSansMono.ttf
Removed:
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/BFEntry.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/TTFCmapEntry.java
Modified:
xmlgraphics/fop/branches/fop-1_1rc1/build.xml
xmlgraphics/fop/branches/fop-1_1rc1/findbugs-exclude.xml
xmlgraphics/fop/branches/fop-1_1rc1/src/documentation/content/xdocs/trunk/configuration.xml
xmlgraphics/fop/branches/fop-1_1rc1/src/documentation/content/xdocs/trunk/fonts.xml
xmlgraphics/fop/branches/fop-1_1rc1/src/documentation/content/xdocs/trunk/graphics.xml
xmlgraphics/fop/branches/fop-1_1rc1/src/java/META-INF/services/org.apache.fop.render.ImageHandler
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fo/properties/CondLengthProperty.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CIDFontType.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CustomFont.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CustomFontCollection.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/EmbedFontInfo.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/EncodingMode.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontInfoConfigurator.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontLoader.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontReader.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontType.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/LazyFont.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/MultiByteFont.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/MutableFont.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/SingleByteFont.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/apps/TTFReader.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/FontFileReader.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/TTFFile.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/TTFSubSetFile.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/pdf/BitmapImage.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/pdf/PDFFactory.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/FontResourceCache.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/PSDocumentHandler.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/PSEventProducer.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/PSEventProducer.xml
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/PSFontUtils.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/PSImageHandlerRenderedImage.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/PSPainter.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/PSTextPainter.java
xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/render/ps/ResourceHandler.java
xmlgraphics/fop/branches/fop-1_1rc1/status.xml
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/UtilityCodeTestSuite.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/fonts/DejaVuLGCSerifTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/fonts/EncodingModeTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java
xmlgraphics/fop/branches/fop-1_1rc1/test/java/org/apache/fop/fonts/truetype/TTFFontLoaderTestCase.java
Modified: xmlgraphics/fop/branches/fop-1_1rc1/build.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/build.xml?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/build.xml (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/build.xml Sat Jun 23 19:31:33 2012
@@ -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! *
Modified: xmlgraphics/fop/branches/fop-1_1rc1/findbugs-exclude.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/findbugs-exclude.xml?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/findbugs-exclude.xml (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/findbugs-exclude.xml Sat Jun 23 19:31:33 2012
@@ -1,6 +1,15 @@
<?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"/>
</Match>
@@ -5162,4 +5171,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>
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/documentation/content/xdocs/trunk/configuration.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/documentation/content/xdocs/trunk/configuration.xml?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/documentation/content/xdocs/trunk/configuration.xml (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/documentation/content/xdocs/trunk/configuration.xml Sat Jun 23 19:31:33 2012
@@ -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>
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/documentation/content/xdocs/trunk/fonts.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/documentation/content/xdocs/trunk/fonts.xml?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/documentation/content/xdocs/trunk/fonts.xml (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/documentation/content/xdocs/trunk/fonts.xml Sat Jun 23 19:31:33 2012
@@ -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>
\ No newline at end of file
+</document>
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/documentation/content/xdocs/trunk/graphics.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/documentation/content/xdocs/trunk/graphics.xml?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/documentation/content/xdocs/trunk/graphics.xml (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/documentation/content/xdocs/trunk/graphics.xml Sat Jun 23 19:31:33 2012
@@ -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&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">
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/META-INF/services/org.apache.fop.render.ImageHandler
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/META-INF/services/org.apache.fop.render.ImageHandler?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/META-INF/services/org.apache.fop.render.ImageHandler (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/META-INF/services/org.apache.fop.render.ImageHandler Sat Jun 23 19:31:33 2012
@@ -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.PSImageHandlerR
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
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java Sat Jun 23 19:31:33 2012
@@ -31,6 +31,7 @@ import org.apache.commons.logging.LogFac
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 OTFAdvancedTypographi
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 OTFAdvancedTypographi
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 OTFAdvancedTypographi
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 OTFAdvancedTypographi
}
}
- 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 OTFAdvancedTypographi
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 OTFAdvancedTypographi
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 OTFAdvancedTypographi
}
}
- 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 OTFAdvancedTypographi
* @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 OTFAdvancedTypographi
}
}
- 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 OTFAdvancedTypographi
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 OTFAdvancedTypographi
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 OTFAdvancedTypographi
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 OTFAdvancedTypographi
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 OTFAdvancedTypographi
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 OTFAdvancedTypographi
* @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 OTFAdvancedTypographi
* @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 OTFAdvancedTypographi
* @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
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fo/properties/CondLengthProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fo/properties/CondLengthProperty.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fo/properties/CondLengthProperty.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fo/properties/CondLengthProperty.java Sat Jun 23 19:31:33 2012
@@ -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
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;
}
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CIDFontType.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CIDFontType.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CIDFontType.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CIDFontType.java Sat Jun 23 19:31:33 2012
@@ -34,7 +34,7 @@ public class CIDFontType extends ValuedE
/**
* 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);
/**
Copied: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CMapSegment.java (from r1345841, xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/BFEntry.java)
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CMapSegment.java?p2=xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CMapSegment.java&p1=xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/BFEntry.java&r1=1345841&r2=1353186&rev=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/BFEntry.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CMapSegment.java Sat Jun 23 19:31:33 2012
@@ -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 ( ',' );
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CustomFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CustomFont.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CustomFont.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CustomFont.java Sat Jun 23 19:31:33 2012
@@ -42,6 +42,7 @@ public abstract class CustomFont extends
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
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;
@@ -112,6 +116,14 @@ public abstract class CustomFont extends
}
/**
+ * 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
* @throws IOException if embedFileName is not null but Source is not found
@@ -337,6 +349,13 @@ public abstract class CustomFont extends
/**
* {@inheritDoc}
*/
+ public void setEmbeddingMode(EmbeddingMode embeddingMode) {
+ this.embeddingMode = embeddingMode;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public void setCapHeight(int capHeight) {
this.capHeight = capHeight;
}
@@ -473,4 +492,25 @@ public abstract class CustomFont extends
}
}
+ /**
+ * 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;
+ }
+
}
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CustomFontCollection.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CustomFontCollection.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CustomFontCollection.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/CustomFontCollection.java Sat Jun 23 19:31:33 2012
@@ -72,7 +72,7 @@ public class CustomFontCollection implem
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);
}
}
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/EmbedFontInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/EmbedFontInfo.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/EmbedFontInfo.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/EmbedFontInfo.java Sat Jun 23 19:31:33 2012
@@ -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 Se
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;
@@ -149,6 +153,14 @@ public class EmbedFontInfo implements Se
}
/**
+ * 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 Se
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();
Added: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/EmbeddingMode.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/EmbeddingMode.java?rev=1353186&view=auto
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/EmbeddingMode.java (added)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/EmbeddingMode.java Sat Jun 23 19:31:33 2012
@@ -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);
+ }
+}
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/EncodingMode.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/EncodingMode.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/EncodingMode.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/EncodingMode.java Sat Jun 23 19:31:33 2012
@@ -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;
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontInfoConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontInfoConfigurator.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontInfoConfigurator.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontInfoConfigurator.java Sat Jun 23 19:31:33 2012
@@ -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)) {
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontLoader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontLoader.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontLoader.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontLoader.java Sat Jun 23 19:31:33 2012
@@ -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();
}
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontReader.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontReader.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontReader.java Sat Jun 23 19:31:33 2012
@@ -64,7 +64,7 @@ public class FontReader extends DefaultH
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 DefaultH
/**
* {@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 DefaultH
/**
* {@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 DefaultH
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 DefaultH
/**
* {@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 DefaultH
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 DefaultH
/**
* {@inheritDoc}
*/
+ @Override
public void characters(char[] ch, int start, int length) {
text.append(ch, start, length);
}
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontType.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontType.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontType.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/FontType.java Sat Jun 23 19:31:33 2012
@@ -130,4 +130,9 @@ public class FontType {
return value;
}
+ @Override
+ public String toString() {
+ return name;
+ }
+
}
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/LazyFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/LazyFont.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/LazyFont.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/LazyFont.java Sat Jun 23 19:31:33 2012
@@ -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 i
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 i
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 i
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;
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/MultiByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/MultiByteFont.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/MultiByteFont.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/MultiByteFont.java Sat Jun 23 19:31:33 2012
@@ -51,14 +51,6 @@ public class MultiByteFont extends CIDFo
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 CIDFo
}
/** {@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 CIDFo
}
/** {@inheritDoc} */
+ @Override
public String getEmbedFontName() {
if (isEmbeddable()) {
return FontUtil.stripWhiteSpace(super.getFontName());
@@ -128,17 +126,18 @@ public class MultiByteFont extends CIDFo
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 CIDFo
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 CIDFo
// [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 CIDFo
/** {@inheritDoc} */
+ @Override
public char mapChar(char c) {
notifyMapOperation();
int glyphIndex = findGlyphIndex(c);
@@ -287,20 +287,12 @@ public class MultiByteFont extends CIDFo
}
/** {@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
*/
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/MutableFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/MutableFont.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/MutableFont.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/MutableFont.java Sat Jun 23 19:31:33 2012
@@ -61,6 +61,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
*/
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/SingleByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/SingleByteFont.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/SingleByteFont.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/SingleByteFont.java Sat Jun 23 19:31:33 2012
@@ -31,6 +31,8 @@ import org.apache.commons.logging.LogFac
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 Cust
private List<SimpleSingleByteEncoding> additionalEncodings;
private Map<Character, Character> alternativeCodes;
+ private PostScriptVersion ttPostScriptVersion;
/**
* Main constructor.
@@ -397,5 +400,26 @@ public class SingleByteFont extends Cust
}
}
+ /**
+ * 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;
+ }
+
}
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/apps/TTFReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/apps/TTFReader.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/apps/TTFReader.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/apps/TTFReader.java Sat Jun 23 19:31:33 2012
@@ -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 AbstractF
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 AbstractF
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 AbstractF
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());
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java Sat Jun 23 19:31:33 2012
@@ -32,6 +32,7 @@ import org.apache.commons.logging.LogFac
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);
}
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/FontFileReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/FontFileReader.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/FontFileReader.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/FontFileReader.java Sat Jun 23 19:31:33 2012
@@ -90,23 +90,13 @@ public class FontFileReader {
}
/**
- * 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.
*
* @param add The number of bytes to advance
* @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;
+ }
}
Modified: xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java?rev=1353186&r1=1353185&r2=1353186&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java (original)
+++ xmlgraphics/fop/branches/fop-1_1rc1/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java Sat Jun 23 19:31:33 2012
@@ -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
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org