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 me...@apache.org on 2012/06/26 11:14:34 UTC
svn commit: r1353883 [1/4] - in
/xmlgraphics/fop/branches/Temp_URI_Unification: ./ lib/
src/documentation/content/xdocs/trunk/
src/java/org/apache/fop/complexscripts/fonts/
src/java/org/apache/fop/fonts/ src/java/org/apache/fop/fonts/apps/
src/java/org...
Author: mehdi
Date: Tue Jun 26 09:14:25 2012
New Revision: 1353883
URL: http://svn.apache.org/viewvc?rev=1353883&view=rev
Log:
Merged in trunk@1353397
Added:
xmlgraphics/fop/branches/Temp_URI_Unification/lib/xmlgraphics-commons-1.5svn.jar
- copied unchanged from r1353397, xmlgraphics/fop/trunk/lib/xmlgraphics-commons-1.5svn.jar
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/CMapSegment.java
- copied unchanged from r1353397, xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/CMapSegment.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/EmbeddingMode.java
- copied unchanged from r1353397, xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/EmbeddingMode.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/TTFGlyphOutputStream.java
- copied unchanged from r1353397, xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFGlyphOutputStream.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/TTFOutputStream.java
- copied unchanged from r1353397, xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFOutputStream.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/TTFTableName.java
- copied unchanged from r1353397, xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFTableName.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/TTFTableOutputStream.java
- copied unchanged from r1353397, xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFTableOutputStream.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/render/ps/PSFontResource.java
- copied unchanged from r1353397, xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSFontResource.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/util/HexEncoder.java
- copied unchanged from r1353397, xmlgraphics/fop/trunk/src/java/org/apache/fop/util/HexEncoder.java
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/fonts/FOPFontsTestSuite.java
- copied unchanged from r1353397, xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/FOPFontsTestSuite.java
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/fonts/truetype/
- copied from r1353397, xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/truetype/
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/fonts/truetype/FontFileReaderTestCase.java
- copied unchanged from r1353397, xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/truetype/FontFileReaderTestCase.java
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java
- copied, changed from r1353397, xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/fonts/truetype/TTFFileTestCase.java
- copied, changed from r1353397, xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/truetype/TTFFileTestCase.java
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/fonts/truetype/TTFFontLoaderTestCase.java
- copied, changed from r1353397, xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/truetype/TTFFontLoaderTestCase.java
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/fonts/truetype/TTFSubSetFileTestCase.java
- copied unchanged from r1353397, xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/truetype/TTFSubSetFileTestCase.java
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/fonts/truetype/TTFTableNameTestCase.java
- copied unchanged from r1353397, xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/truetype/TTFTableNameTestCase.java
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/ps/RenderPSTestSuite.java
- copied unchanged from r1353397, xmlgraphics/fop/trunk/test/java/org/apache/fop/render/ps/RenderPSTestSuite.java
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/ps/fonts/
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/ps/fonts/PSTTFGeneratorTestCase.java (with props)
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/ps/fonts/PSTTFGlyphOutputStreamTestCase.java (with props)
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/ps/fonts/PSTTFOutputStreamTestCase.java (with props)
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/render/ps/fonts/PSTTFTableOutputStreamTestCase.java (with props)
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/util/HexEncoderTestCase.java
- copied unchanged from r1353397, xmlgraphics/fop/trunk/test/java/org/apache/fop/util/HexEncoderTestCase.java
xmlgraphics/fop/branches/Temp_URI_Unification/test/resources/fonts/ttf/DroidSansMono.LICENSE
- copied unchanged from r1353397, xmlgraphics/fop/trunk/test/resources/fonts/ttf/DroidSansMono.LICENSE
xmlgraphics/fop/branches/Temp_URI_Unification/test/resources/fonts/ttf/DroidSansMono.ttf
- copied unchanged from r1353397, xmlgraphics/fop/trunk/test/resources/fonts/ttf/DroidSansMono.ttf
Removed:
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/BFEntry.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/TTFCmapEntry.java
Modified:
xmlgraphics/fop/branches/Temp_URI_Unification/ (props changed)
xmlgraphics/fop/branches/Temp_URI_Unification/build.xml
xmlgraphics/fop/branches/Temp_URI_Unification/findbugs-exclude.xml
xmlgraphics/fop/branches/Temp_URI_Unification/src/documentation/content/xdocs/trunk/fonts.xml
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/CIDFontType.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/CustomFont.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/DefaultFontConfig.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/DefaultFontConfigurator.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/EmbedFontInfo.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/EncodingMode.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/FontLoader.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/FontReader.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/FontType.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/LazyFont.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/MultiByteFont.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/MutableFont.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/SingleByteFont.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/apps/TTFReader.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/FontFileReader.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/TTFFile.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/TTFSubSetFile.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/hyphenation/HyphenationTreeCache.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/pdf/AbstractPDFStream.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/pdf/AlphaRasterImage.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/pdf/BitmapImage.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/pdf/PDFFactory.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/pdf/PDFImage.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/pdf/PDFImageXObject.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/render/pdf/ImageRawPNGAdapter.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/render/ps/FontResourceCache.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/render/ps/PSDocumentHandler.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/render/ps/PSEventProducer.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/render/ps/PSEventProducer.xml
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/render/ps/PSFontUtils.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/render/ps/PSPainter.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/render/ps/PSTextPainter.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/render/ps/ResourceHandler.java
xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/svg/PDFGraphics2D.java
xmlgraphics/fop/branches/Temp_URI_Unification/status.xml
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/UtilityCodeTestSuite.java
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/fonts/DejaVuLGCSerifTestCase.java
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/fonts/EmbedFontInfoTestCase.java
xmlgraphics/fop/branches/Temp_URI_Unification/test/java/org/apache/fop/fonts/EncodingModeTestCase.java
Propchange: xmlgraphics/fop/branches/Temp_URI_Unification/
------------------------------------------------------------------------------
Merged /xmlgraphics/fop/trunk:r1351541-1353397
Merged /xmlgraphics/fop/branches/Temp_TrueTypeInPostScript:r949179-1352964
Modified: xmlgraphics/fop/branches/Temp_URI_Unification/build.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/build.xml?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/build.xml (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/build.xml Tue Jun 26 09:14:25 2012
@@ -865,16 +865,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/Temp_URI_Unification/findbugs-exclude.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/findbugs-exclude.xml?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/findbugs-exclude.xml (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/findbugs-exclude.xml Tue Jun 26 09:14:25 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>
@@ -950,11 +959,6 @@
<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"/>
<Bug pattern="SA_FIELD_SELF_COMPARISON"/>
Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/documentation/content/xdocs/trunk/fonts.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/documentation/content/xdocs/trunk/fonts.xml?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/documentation/content/xdocs/trunk/fonts.xml (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/documentation/content/xdocs/trunk/fonts.xml Tue Jun 26 09:14:25 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/Temp_URI_Unification/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java Tue Jun 26 09:14:25 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/Temp_URI_Unification/src/java/org/apache/fop/fonts/CIDFontType.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/CIDFontType.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/CIDFontType.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/CIDFontType.java Tue Jun 26 09:14:25 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);
/**
Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/CustomFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/CustomFont.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/CustomFont.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/CustomFont.java Tue Jun 26 09:14:25 2012
@@ -44,6 +44,7 @@ public abstract class CustomFont extends
private URI embedFileURI;
private String embedResourceName;
private final InternalResourceResolver resourceResolver;
+ private EmbeddingMode embeddingMode = EmbeddingMode.AUTO;
private int capHeight;
private int xHeight;
@@ -63,6 +64,8 @@ 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;
/**
* @param resourceResolver the URI resource resolver for controlling file access
@@ -121,6 +124,14 @@ public abstract class CustomFont extends
}
/**
+ * Returns the embedding mode for this font.
+ * @return embedding mode
+ */
+ public EmbeddingMode getEmbeddingMode() {
+ return embeddingMode;
+ }
+
+ /**
* Returns an {@link InputStream} representing an embeddable font file.
*
* @return {@link InputStream} for an embeddable font file
@@ -339,6 +350,13 @@ public abstract class CustomFont extends
/**
* {@inheritDoc}
*/
+ public void setEmbeddingMode(EmbeddingMode embeddingMode) {
+ this.embeddingMode = embeddingMode;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public void setCapHeight(int capHeight) {
this.capHeight = capHeight;
}
@@ -467,4 +485,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/Temp_URI_Unification/src/java/org/apache/fop/fonts/DefaultFontConfig.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/DefaultFontConfig.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/DefaultFontConfig.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/DefaultFontConfig.java Tue Jun 26 09:14:25 2012
@@ -111,7 +111,8 @@ public final class DefaultFontConfig imp
Font font = new Font(fontCfg.getAttribute("metrics-url", null), embed,
fontCfg.getAttribute("sub-font", null), fontCfg.getAttributeAsBoolean(
"kerning", true), fontCfg.getAttributeAsBoolean("advanced", true),
- fontCfg.getAttribute("encoding-mode", EncodingMode.AUTO.getName()));
+ fontCfg.getAttribute("encoding-mode", EncodingMode.AUTO.getName()),
+ fontCfg.getAttribute("embedding-mode", EmbeddingMode.AUTO.getName()));
instance.fonts.add(font);
boolean hasTriplets = false;
for (Configuration tripletCfg : fontCfg.getChildren("font-triplet")) {
@@ -276,9 +277,7 @@ public final class DefaultFontConfig imp
private final String encodingMode;
- public String getEncodingMode() {
- return encodingMode;
- }
+ private final String embeddingMode;
private final List<FontTriplet> tripletList = new ArrayList<FontTriplet>();
@@ -287,13 +286,14 @@ public final class DefaultFontConfig imp
}
private Font(String metrics, String embed, String subFont, boolean kerning,
- boolean advanced, String encodingMode) {
+ boolean advanced, String encodingMode, String embeddingMode) {
this.metrics = metrics;
this.embedUri = embed;
this.subFont = subFont;
this.kerning = kerning;
this.advanced = advanced;
this.encodingMode = encodingMode;
+ this.embeddingMode = embeddingMode;
}
/**
@@ -303,7 +303,7 @@ public final class DefaultFontConfig imp
public boolean isKerning() {
return kerning;
}
-
+
public boolean isAdvanced() {
return advanced;
}
@@ -331,5 +331,13 @@ public final class DefaultFontConfig imp
public String getSubFont() {
return subFont;
}
+
+ public String getEncodingMode() {
+ return encodingMode;
+ }
+
+ public String getEmbeddingMode() {
+ return embeddingMode;
+ }
}
}
Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/DefaultFontConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/DefaultFontConfigurator.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/DefaultFontConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/DefaultFontConfigurator.java Tue Jun 26 09:14:25 2012
@@ -163,9 +163,10 @@ public class DefaultFontConfigurator imp
return null;
}
}
- EncodingMode encodingMode = EncodingMode.getEncodingMode(font.getEncodingMode());
+ EncodingMode encodingMode = EncodingMode.getValue(font.getEncodingMode());
+ EmbeddingMode embeddingMode = EmbeddingMode.getValue(font.getEmbeddingMode());
EmbedFontInfo embedFontInfo = new EmbedFontInfo(metricsUri, font.isKerning(),
- font.isAdvanced(), tripletList, embedUri, subFont, encodingMode);
+ font.isAdvanced(), tripletList, embedUri, subFont, encodingMode, embeddingMode);
if (fontCache != null) {
if (!fontCache.containsFont(embedFontInfo)) {
fontCache.addFont(embedFontInfo, resourceResolver);
Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/EmbedFontInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/EmbedFontInfo.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/EmbedFontInfo.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/EmbedFontInfo.java Tue Jun 26 09:14:25 2012
@@ -26,6 +26,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 {
@@ -40,6 +42,7 @@ public class EmbedFontInfo implements Se
protected final boolean advanced;
/** the requested encoding mode for the font */
private final EncodingMode encodingMode;
+ private final EmbeddingMode embeddingMode;
/** the PostScript name of the font */
protected String postScriptName;
@@ -60,21 +63,11 @@ public class EmbedFontInfo implements Se
* @param embedURI Path to the embeddable font file (may be null)
* @param subFontName the sub-fontname used for TrueType Collections (null otherwise)
* @param encodingMode the encoding mode to use for this font
+ * @param embeddingMode the embedding mode for this font
*/
public EmbedFontInfo(URI metricsURI, boolean kerning, boolean advanced,
- List<FontTriplet> fontTriplets, URI embedURI, String subFontName) {
- this.metricsURI = metricsURI;
- this.embedURI = embedURI;
- this.kerning = kerning;
- this.advanced = advanced;
- this.fontTriplets = fontTriplets;
- this.subFontName = subFontName;
- this.encodingMode = EncodingMode.AUTO;
- }
-
- public EmbedFontInfo(URI metricsURI, boolean kerning, boolean advanced,
List<FontTriplet> fontTriplets, URI embedURI, String subFontName,
- EncodingMode encodingMode) {
+ EncodingMode encodingMode, EmbeddingMode embeddingMode) {
this.metricsURI = metricsURI;
this.embedURI = embedURI;
this.kerning = kerning;
@@ -82,6 +75,7 @@ public class EmbedFontInfo implements Se
this.fontTriplets = fontTriplets;
this.subFontName = subFontName;
this.encodingMode = encodingMode;
+ this.embeddingMode = embeddingMode;
}
/**
@@ -164,6 +158,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
*/
Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/EncodingMode.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/EncodingMode.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/EncodingMode.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/EncodingMode.java Tue Jun 26 09:14:25 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/Temp_URI_Unification/src/java/org/apache/fop/fonts/FontLoader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/FontLoader.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/FontLoader.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/FontLoader.java Tue Jun 26 09:14:25 2012
@@ -80,6 +80,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
@@ -89,8 +90,8 @@ public abstract class FontLoader {
* @throws IOException In case of an I/O error
*/
public static CustomFont loadFont(URI fontFileURI, String subFontName,
- boolean embedded, EncodingMode encodingMode, boolean useKerning,
- boolean useAdvanced, InternalResourceResolver resourceResolver) throws IOException {
+ boolean embedded, EmbeddingMode embeddingMode, EncodingMode encodingMode,
+ boolean useKerning, boolean useAdvanced, InternalResourceResolver resourceResolver) throws IOException {
boolean type1 = isType1(fontFileURI);
FontLoader loader;
if (type1) {
@@ -98,10 +99,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, resourceResolver);
} else {
loader = new TTFFontLoader(fontFileURI, subFontName,
- embedded, encodingMode, useKerning, useAdvanced, resourceResolver);
+ embedded, embeddingMode, encodingMode, useKerning, useAdvanced, resourceResolver);
}
return loader.getFont();
}
Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/FontReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/FontReader.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/FontReader.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/FontReader.java Tue Jun 26 09:14:25 2012
@@ -66,7 +66,7 @@ public class FontReader extends DefaultH
private Map<Integer, Integer> currentKerning;
- private List<BFEntry> bfranges;
+ private List<CMapSegment> bfranges;
/**
* Construct a FontReader object from a path to a metric.xml file
@@ -146,12 +146,14 @@ public class FontReader extends DefaultH
/**
* {@inheritDoc}
*/
+ @Override
public void startDocument() {
}
/**
* {@inheritDoc}
*/
+ @Override
public void startElement(String uri, String localName, String qName, Attributes attributes)
throws SAXException {
if (localName.equals("font-metrics")) {
@@ -188,11 +190,11 @@ public class FontReader extends DefaultH
returnFont.putKerningEntry(getInt(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")),
- getInt(attributes.getValue("ue")),
- getInt(attributes.getValue("gi")));
+ CMapSegment entry = new CMapSegment(getInt(attributes.getValue("us")),
+ getInt(attributes.getValue("ue")),
+ getInt(attributes.getValue("gi")));
bfranges.add(entry);
} else if ("wx".equals(localName)) {
cidWidths.add(getInt(attributes.getValue("w")));
@@ -225,6 +227,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)) {
@@ -292,7 +295,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())
}
@@ -300,6 +303,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/Temp_URI_Unification/src/java/org/apache/fop/fonts/FontType.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/FontType.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/FontType.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/FontType.java Tue Jun 26 09:14:25 2012
@@ -130,4 +130,9 @@ public class FontType {
return value;
}
+ @Override
+ public String toString() {
+ return name;
+ }
+
}
Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/LazyFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/LazyFont.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/LazyFont.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/LazyFont.java Tue Jun 26 09:14:25 2012
@@ -46,6 +46,7 @@ public class LazyFont extends Typeface i
private final boolean useKerning;
private final boolean useAdvanced;
private final EncodingMode encodingMode;
+ private final EmbeddingMode embeddingMode;
private final boolean embedded;
private final String subFontName;
private final InternalResourceResolver resourceResolver;
@@ -69,8 +70,8 @@ public class LazyFont extends Typeface i
} else {
this.useAdvanced = fontInfo.getAdvanced();
}
- this.encodingMode = fontInfo.getEncodingMode() != null ? fontInfo.getEncodingMode()
- : EncodingMode.AUTO;
+ this.encodingMode = fontInfo.getEncodingMode();
+ this.embeddingMode = fontInfo.getEmbeddingMode();
this.subFontName = fontInfo.getSubFontName();
this.embedded = fontInfo.isEmbedded();
this.resourceResolver = resourceResolver;
@@ -108,8 +109,8 @@ public class LazyFont extends Typeface i
if (fontEmbedURI == null) {
throw new RuntimeException("Cannot load font. No font URIs available.");
}
- realFont = FontLoader.loadFont(fontEmbedURI, this.subFontName, embedded,
- this.encodingMode, useKerning, useAdvanced, resourceResolver);
+ realFont = FontLoader.loadFont(fontEmbedURI, subFontName, embedded,
+ embeddingMode, encodingMode, useKerning, useAdvanced, resourceResolver);
}
if (realFont instanceof FontDescriptor) {
realFontDescriptor = (FontDescriptor) realFont;
Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/MultiByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/MultiByteFont.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/MultiByteFont.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/MultiByteFont.java Tue Jun 26 09:14:25 2012
@@ -52,14 +52,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;
@@ -84,26 +76,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;
}
@@ -117,6 +114,7 @@ public class MultiByteFont extends CIDFo
}
/** {@inheritDoc} */
+ @Override
public String getEmbedFontName() {
if (isEmbeddable()) {
return FontUtil.stripWhiteSpace(super.getFontName());
@@ -130,17 +128,18 @@ public class MultiByteFont extends CIDFo
return !(getEmbedFileURI() == null && getEmbedResourceName() == null);
}
- /** {@inheritDoc} */
public boolean isSubsetEmbedded() {
return true;
}
/** {@inheritDoc} */
+ @Override
public CIDSubset getCIDSubset() {
return this.subset;
}
/** {@inheritDoc} */
+ @Override
public String getEncodingName() {
return encoding;
}
@@ -173,30 +172,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;
}
/**
@@ -254,12 +253,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;
}
}
@@ -275,6 +274,7 @@ public class MultiByteFont extends CIDFo
/** {@inheritDoc} */
+ @Override
public char mapChar(char c) {
notifyMapOperation();
int glyphIndex = findGlyphIndex(c);
@@ -289,20 +289,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/Temp_URI_Unification/src/java/org/apache/fop/fonts/MutableFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/MutableFont.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/MutableFont.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/MutableFont.java Tue Jun 26 09:14:25 2012
@@ -62,6 +62,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/Temp_URI_Unification/src/java/org/apache/fop/fonts/SingleByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/SingleByteFont.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/SingleByteFont.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/SingleByteFont.java Tue Jun 26 09:14:25 2012
@@ -32,6 +32,7 @@ import org.apache.commons.logging.LogFac
import org.apache.xmlgraphics.fonts.Glyphs;
import org.apache.fop.apps.io.InternalResourceResolver;
+import org.apache.fop.fonts.truetype.TTFFile.PostScriptVersion;
/**
* Generic SingleByte font
@@ -50,6 +51,7 @@ public class SingleByteFont extends Cust
private List<SimpleSingleByteEncoding> additionalEncodings;
private Map<Character, Character> alternativeCodes;
+ private PostScriptVersion ttPostScriptVersion;
/**
* @param resourceResolver the URI resolver for controlling file access
@@ -400,5 +402,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/Temp_URI_Unification/src/java/org/apache/fop/fonts/apps/TTFReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/apps/TTFReader.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/apps/TTFReader.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/apps/TTFReader.java Tue Jun 26 09:14:25 2012
@@ -22,7 +22,6 @@ package org.apache.fop.fonts.apps;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -36,9 +35,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;
@@ -295,9 +294,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));
@@ -393,9 +392,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()));
@@ -450,35 +447,32 @@ 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 = ttf.getKerning().get(kpx1);
} else {
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());
- Integer val = (Integer)h2.get(kpx2);
+ Integer val = h2.get(kpx2);
el2.setAttribute("kern", val.toString());
el.appendChild(el2);
}
Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java Tue Jun 26 09:14:25 2012
@@ -33,6 +33,7 @@ import org.apache.commons.logging.LogFac
import org.apache.fop.apps.io.InternalResourceResolver;
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;
@@ -147,7 +148,8 @@ public class FontInfoFinder {
subFontName = ((MultiByteFont) customFont).getTTCName();
}
EmbedFontInfo fontInfo = new EmbedFontInfo(null, customFont.isKerningEnabled(),
- customFont.isAdvancedEnabled(), fontTripletList, fontUri, subFontName);
+ customFont.isAdvancedEnabled(), fontTripletList, fontUri, subFontName,
+ EncodingMode.AUTO, EmbeddingMode.AUTO);
fontInfo.setPostScriptName(customFont.getFontName());
if (fontCache != null) {
fontCache.addFont(fontInfo, resourceResolver);
@@ -219,7 +221,7 @@ public class FontInfoFinder {
}
try {
TTFFontLoader ttfLoader = new TTFFontLoader(fontURI, fontName, true,
- EncodingMode.AUTO, useKerning, useAdvanced, resourceResolver);
+ EmbeddingMode.AUTO, EncodingMode.AUTO, useKerning, useAdvanced, resourceResolver);
customFont = ttfLoader.getFont();
if (this.eventListener != null) {
customFont.setEventListener(this.eventListener);
@@ -245,8 +247,8 @@ public class FontInfoFinder {
} else {
// The normal case
try {
- customFont = FontLoader.loadFont(fontURI, null, true, EncodingMode.AUTO,
- useKerning, useAdvanced, resourceResolver);
+ customFont = FontLoader.loadFont(fontURI, null, true, EmbeddingMode.AUTO,
+ EncodingMode.AUTO, useKerning, useAdvanced, resourceResolver);
if (this.eventListener != null) {
customFont.setEventListener(this.eventListener);
}
Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/FontFileReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/FontFileReader.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/FontFileReader.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/FontFileReader.java Tue Jun 26 09:14:25 2012
@@ -62,23 +62,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);
}
/**
@@ -105,7 +95,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);
}
@@ -250,14 +240,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");
}
@@ -325,6 +315,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/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java?rev=1353883&r1=1353882&r2=1353883&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fonts/truetype/TTFDirTabEntry.java Tue Jun 26 09:14:25 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