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 sp...@apache.org on 2008/02/14 22:57:53 UTC

svn commit: r627882 [7/41] - in /xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking: ./ examples/embedding/ examples/embedding/java/embedding/ examples/embedding/java/embedding/intermediate/ examples/embedding/xml/xml/ examples/fo/ examples/f...

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/truetype/TTFSubSetFile.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/truetype/TTFSubSetFile.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/truetype/TTFSubSetFile.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/truetype/TTFSubSetFile.java Thu Feb 14 13:55:44 2008
@@ -21,8 +21,8 @@
 
 import java.io.IOException;
 import java.util.Iterator;
-import java.util.Map;
 import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -67,11 +67,31 @@
         // createDirectory()
     }
 
+    private int determineTableCount() {
+        int numTables = 4; //4 req'd tables: head,hhea,hmtx,maxp
+        if (isCFF()) {
+            throw new UnsupportedOperationException(
+                    "OpenType fonts with CFF glyphs are not supported");
+        } else {
+            numTables += 2; //1 req'd table: glyf,loca
+            if (hasCvt()) {
+                numTables++;
+            }
+            if (hasFpgm()) {
+                numTables++;
+            }
+            if (hasPrep()) {
+                numTables++;
+            }
+        }
+        return numTables;
+    }
+    
     /**
      * Create the directory table
      */
     private void createDirectory() {
-        int numTables = 9;
+        int numTables = determineTableCount();
         // Create the TrueType header
         writeByte((byte)0);
         writeByte((byte)1);
@@ -95,10 +115,12 @@
         realSize += 2;
 
         // Create space for the table entries
-        writeString("cvt ");
-        cvtDirOffset = currentPos;
-        currentPos += 12;
-        realSize += 16;
+        if (hasCvt()) {
+            writeString("cvt ");
+            cvtDirOffset = currentPos;
+            currentPos += 12;
+            realSize += 16;
+        }
 
         if (hasFpgm()) {
             writeString("fpgm");
@@ -137,17 +159,19 @@
         currentPos += 12;
         realSize += 16;
 
-        writeString("prep");
-        prepDirOffset = currentPos;
-        currentPos += 12;
-        realSize += 16;
+        if (hasPrep()) {
+            writeString("prep");
+            prepDirOffset = currentPos;
+            currentPos += 12;
+            realSize += 16;
+        }
     }
 
 
     /**
      * Copy the cvt table as is from original font to subset font
      */
-    private void createCvt(FontFileReader in) throws IOException {
+    private boolean createCvt(FontFileReader in) throws IOException {
         TTFDirTabEntry entry = (TTFDirTabEntry)dirTabs.get("cvt ");
         if (entry != null) {
             pad4();
@@ -161,21 +185,29 @@
             writeULong(cvtDirOffset + 8, (int)entry.getLength());
             currentPos += (int)entry.getLength();
             realSize += (int)entry.getLength();
+            return true;
         } else {
-            throw new IOException("Can't find cvt table");
+            return false;
+            //throw new IOException("Can't find cvt table");
         }
     }
 
+    private boolean hasCvt() {
+        return dirTabs.containsKey("cvt ");
+    }
 
     private boolean hasFpgm() {
-        return (dirTabs.get("fpgm") != null);
+        return dirTabs.containsKey("fpgm");
     }
 
+    private boolean hasPrep() {
+        return dirTabs.containsKey("prep");
+    }
 
     /**
      * Copy the fpgm table as is from original font to subset font
      */
-    private void createFpgm(FontFileReader in) throws IOException {
+    private boolean createFpgm(FontFileReader in) throws IOException {
         TTFDirTabEntry entry = (TTFDirTabEntry)dirTabs.get("fpgm");
         if (entry != null) {
             pad4();
@@ -188,9 +220,9 @@
             writeULong(fpgmDirOffset + 8, (int)entry.getLength());
             currentPos += (int)entry.getLength();
             realSize += (int)entry.getLength();
+            return true;
         } else {
-            //fpgm table is optional
-            //throw new IOException("Can't find fpgm table");
+            return false;
         }
     }
 
@@ -237,7 +269,7 @@
     /**
      * Copy the prep table as is from original font to subset font
      */
-    private void createPrep(FontFileReader in) throws IOException {
+    private boolean createPrep(FontFileReader in) throws IOException {
         TTFDirTabEntry entry = (TTFDirTabEntry)dirTabs.get("prep");
         if (entry != null) {
             pad4();
@@ -251,8 +283,9 @@
             writeULong(prepDirOffset + 8, (int)entry.getLength());
             currentPos += (int)entry.getLength();
             realSize += (int)entry.getLength();
+            return true;
         } else {
-            throw new IOException("Can't find prep table");
+            return false;
         }
     }
 
@@ -637,40 +670,27 @@
         createHmtx(in, glyphs);           // Create hmtx table
         createMaxp(in, glyphs.size());    // copy the maxp table
 
-        try {
-            createCvt(in);    // copy the cvt table
-        } catch (IOException ex) {
-            // Cvt is optional (only required for OpenType (MS) fonts)
-            //log.error("TrueType warning: " + ex.getMessage());
-        }
-
-        try {
-            createFpgm(in);    // copy fpgm table
-        } catch (IOException ex) {
-            // Fpgm is optional (only required for OpenType (MS) fonts)
-            //log.error("TrueType warning: " + ex.getMessage());
-        }
-
-        try {
-            createPrep(in);    // copy prep table
-        } catch (IOException ex) {
-            // Prep is optional (only required for OpenType (MS) fonts)
-            //log.error("TrueType warning: " + ex.getMessage());
-        }
-
-        try {
-            createLoca(glyphs.size());    // create empty loca table
-        } catch (IOException ex) {
-            // Loca is optional (only required for OpenType (MS) fonts)
-            //log.error("TrueType warning: " + ex.getMessage());
-        }
-
-        try {
-            createGlyf(in, glyphs);
-        } catch (IOException ex) {
-            // Glyf is optional (only required for OpenType (MS) fonts)
-            //log.error("TrueType warning: " + ex.getMessage());
+        boolean optionalTableFound;
+        optionalTableFound = createCvt(in);    // copy the cvt table
+        if (!optionalTableFound) {
+            // cvt is optional (used in TrueType fonts only)
+            log.debug("TrueType: ctv table not present. Skipped.");
+        }
+
+        optionalTableFound = createFpgm(in);    // copy fpgm table
+        if (!optionalTableFound) {
+            // fpgm is optional (used in TrueType fonts only)
+            log.debug("TrueType: fpgm table not present. Skipped.");
         }
+
+        optionalTableFound = createPrep(in);    // copy prep table
+        if (!optionalTableFound) {
+            // prep is optional (used in TrueType fonts only)
+            log.debug("TrueType: prep table not present. Skipped.");
+        }
+
+        createLoca(glyphs.size());    // create empty loca table
+        createGlyf(in, glyphs);       //create glyf table and update loca table
 
         pad4();
         createCheckSumAdjustment();

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java Thu Feb 14 13:55:44 2008
@@ -1,92 +1,309 @@
-/*
- * 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.type1;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Set;
-
-import org.apache.fop.fonts.FontLoader;
-import org.apache.fop.fonts.FontResolver;
-import org.apache.fop.fonts.FontType;
-import org.apache.fop.fonts.SingleByteFont;
-
-/**
- * Loads a Type 1 font into memory directly from the original font file.
- */
-public class Type1FontLoader extends FontLoader {
-
-    private PFMFile pfm;
-    private SingleByteFont singleFont;
-    
-    /**
-     * Constructs a new Type 1 font loader.
-     * @param fontFileURI the URI to the PFB file of a Type 1 font
-     * @param in the InputStream reading the PFM file of a Type 1 font
-     * @param resolver the font resolver used to resolve URIs
-     * @throws IOException In case of an I/O error
-     */
-    public Type1FontLoader(String fontFileURI, InputStream in, FontResolver resolver) 
-                throws IOException {
-        super(fontFileURI, in, resolver);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    protected void read() throws IOException {
-        pfm = new PFMFile();
-        pfm.load(in);
-        singleFont = new SingleByteFont();
-        singleFont.setFontType(FontType.TYPE1);
-        if (pfm.getCharSet() >= 0 && pfm.getCharSet() <= 2) {
-            singleFont.setEncoding(pfm.getCharSetName() + "Encoding");
-        } else {
-            log.warn("The PFM reports an unsupported encoding (" 
-                    + pfm.getCharSetName() + "). The font may not work as expected.");
-            singleFont.setEncoding("WinAnsiEncoding"); //Try fallback, no guarantees!
-        }
-        singleFont.setResolver(this.resolver);
-        returnFont = singleFont;
-        returnFont.setFontName(pfm.getPostscriptName());
-        String fullName = pfm.getPostscriptName();
-        fullName = fullName.replace('-', ' '); //Hack! Try to emulate full name
-        returnFont.setFullName(fullName); //should be afm.getFullName()!!
-        //TODO not accurate: we need FullName from the AFM file but we don't have an AFM parser
-        Set names = new java.util.HashSet();
-        names.add(pfm.getWindowsName()); //should be afm.getFamilyName()!!
-        returnFont.setFamilyNames(names);
-        returnFont.setCapHeight(pfm.getCapHeight());
-        returnFont.setXHeight(pfm.getXHeight());
-        returnFont.setAscender(pfm.getLowerCaseAscent());
-        returnFont.setDescender(pfm.getLowerCaseDescent());
-        returnFont.setFontBBox(pfm.getFontBBox());
-        returnFont.setFirstChar(pfm.getFirstChar());
-        returnFont.setLastChar(pfm.getLastChar());
-        returnFont.setFlags(pfm.getFlags());
-        returnFont.setStemV(pfm.getStemV());
-        returnFont.setItalicAngle(pfm.getItalicAngle());
-        returnFont.setMissingWidth(0);
-        for (short i = pfm.getFirstChar(); i <= pfm.getLastChar(); i++) {
-            singleFont.setWidth(i, pfm.getCharWidth(i));
-        }
-        singleFont.setEmbedFileName(this.fontFileURI);
-    }
-}
+/*
+ * 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.type1;
+
+import java.awt.geom.RectangularShape;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.io.IOUtils;
+
+import org.apache.fop.fonts.CodePointMapping;
+import org.apache.fop.fonts.FontLoader;
+import org.apache.fop.fonts.FontResolver;
+import org.apache.fop.fonts.FontType;
+import org.apache.fop.fonts.SingleByteFont;
+
+/**
+ * Loads a Type 1 font into memory directly from the original font file.
+ */
+public class Type1FontLoader extends FontLoader {
+
+    private SingleByteFont singleFont;
+    
+    /**
+     * Constructs a new Type 1 font loader.
+     * @param fontFileURI the URI to the PFB file of a Type 1 font
+     * @param resolver the font resolver used to resolve URIs
+     * @throws IOException In case of an I/O error
+     */
+    public Type1FontLoader(String fontFileURI, FontResolver resolver) 
+                throws IOException {
+        super(fontFileURI, resolver);
+    }
+
+    private String getPFMURI(String pfbURI) {
+        String pfbExt = pfbURI.substring(pfbURI.length() - 3, pfbURI.length());
+        String pfmExt = pfbExt.substring(0, 2)
+                + (Character.isUpperCase(pfbExt.charAt(2)) ? "M" : "m");
+        return pfbURI.substring(0, pfbURI.length() - 4) + "." + pfmExt;
+    }
+    
+    private static final String[] AFM_EXTENSIONS = new String[] {".AFM", ".afm", ".Afm"};
+    
+    /** {@inheritDoc} */
+    protected void read() throws IOException {
+        AFMFile afm = null;
+        PFMFile pfm = null;
+        
+        InputStream afmIn = null;
+        for (int i = 0; i < AFM_EXTENSIONS.length; i++) {
+            try {
+                String afmUri = this.fontFileURI.substring(0, this.fontFileURI.length() - 4)
+                        + AFM_EXTENSIONS[i];
+                afmIn = openFontUri(resolver, afmUri);
+                if (afmIn != null) {
+                    break;
+                }
+            } catch (IOException ioe) {
+                //Ignore, AFM probably not available under the URI
+            }
+        }
+        if (afmIn != null) {
+            try {
+                AFMParser afmParser = new AFMParser();
+                afm = afmParser.parse(afmIn);
+            } finally {
+                IOUtils.closeQuietly(afmIn);
+            }
+        }
+        
+        String pfmUri = getPFMURI(this.fontFileURI);
+        InputStream pfmIn = null;
+        try {
+            pfmIn = openFontUri(resolver, pfmUri);
+        } catch (IOException ioe) {
+            //Ignore, PFM probably not available under the URI
+        }
+        if (pfmIn != null) {
+            try {
+                pfm = new PFMFile();
+                pfm.load(pfmIn);
+            } finally {
+                IOUtils.closeQuietly(pfmIn);
+            }
+        }
+        
+        if (afm == null && pfm == null) {
+            throw new java.io.FileNotFoundException(
+                    "Neither an AFM nor a PFM file was found for " + this.fontFileURI);
+        }
+        buildFont(afm, pfm);
+        this.loaded = true;
+    }
+
+    private void buildFont(AFMFile afm, PFMFile pfm) {
+        if (afm == null && pfm == null) {
+            throw new IllegalArgumentException("Need at least an AFM or a PFM!");
+        }
+        singleFont = new SingleByteFont();
+        singleFont.setFontType(FontType.TYPE1);
+        singleFont.setResolver(this.resolver);
+        singleFont.setEmbedFileName(this.fontFileURI);
+        returnFont = singleFont;
+        
+        //Encoding
+        if (afm != null) {
+            String encoding = afm.getEncodingScheme();
+            if ("AdobeStandardEncoding".equals(encoding)) {
+                //Use WinAnsi in this case as it better fits the usual character set people need
+                singleFont.setEncoding(CodePointMapping.WIN_ANSI_ENCODING);
+            } else {
+                String effEncodingName;
+                if ("FontSpecific".equals(encoding)) {
+                    effEncodingName = afm.getFontName() + "Encoding";
+                } else {
+                    effEncodingName = encoding;
+                }
+                if (log.isDebugEnabled()) {
+                    log.debug("Unusual font encoding encountered: "
+                            + encoding + " -> " + effEncodingName);
+                }
+                CodePointMapping mapping = buildCustomEncoding(effEncodingName, afm);
+                singleFont.setEncoding(mapping);
+            }
+        } else {
+            if (pfm.getCharSet() >= 0 && pfm.getCharSet() <= 2) {
+                singleFont.setEncoding(pfm.getCharSetName() + "Encoding");
+            } else {
+                log.warn("The PFM reports an unsupported encoding (" 
+                        + pfm.getCharSetName() + "). The font may not work as expected.");
+                singleFont.setEncoding("WinAnsiEncoding"); //Try fallback, no guarantees!
+            }
+        }
+        
+        //Font name
+        if (afm != null) {
+            returnFont.setFontName(afm.getFontName()); //PostScript font name
+            returnFont.setFullName(afm.getFullName());
+            Set names = new java.util.HashSet();
+            names.add(afm.getFamilyName());
+            returnFont.setFamilyNames(names);
+        } else {
+            returnFont.setFontName(pfm.getPostscriptName());
+            String fullName = pfm.getPostscriptName();
+            fullName = fullName.replace('-', ' '); //Hack! Try to emulate full name
+            returnFont.setFullName(fullName); //emulate afm.getFullName()
+            Set names = new java.util.HashSet();
+            names.add(pfm.getWindowsName()); //emulate afm.getFamilyName()
+            returnFont.setFamilyNames(names);
+        }
+        
+        //Basic metrics
+        if (afm != null) {
+            if (afm.getCapHeight() != null) {
+                returnFont.setCapHeight(afm.getCapHeight().intValue());
+            }
+            if (afm.getXHeight() != null) {
+                returnFont.setXHeight(afm.getXHeight().intValue());
+            }
+            if (afm.getAscender() != null) {
+                returnFont.setAscender(afm.getAscender().intValue());
+            }
+            if (afm.getDescender() != null) {
+                returnFont.setDescender(afm.getDescender().intValue());
+            }
+            
+            returnFont.setFontBBox(afm.getFontBBoxAsIntArray());
+            if (afm.getStdVW() != null) {
+                returnFont.setStemV(afm.getStdVW().intValue());
+            } else {
+                returnFont.setStemV(80); //Arbitrary value
+            }
+            returnFont.setItalicAngle((int)afm.getWritingDirectionMetrics(0).getItalicAngle());
+        } else {
+            returnFont.setFontBBox(pfm.getFontBBox());
+            returnFont.setStemV(pfm.getStemV());
+            returnFont.setItalicAngle(pfm.getItalicAngle());
+        }
+        if (pfm != null) {
+            //Sometimes the PFM has these metrics while the AFM doesn't (ex. Symbol)
+            returnFont.setCapHeight(pfm.getCapHeight());
+            returnFont.setXHeight(pfm.getXHeight());
+            returnFont.setAscender(pfm.getLowerCaseAscent());
+            returnFont.setDescender(pfm.getLowerCaseDescent());
+        }
+        
+        //Fallbacks when some crucial font metrics aren't available
+        //(the following are all optional in AFM, but FontBBox is always available)
+        if (returnFont.getXHeight(1) == 0) {
+            int xHeight = 0;
+            AFMCharMetrics chm = afm.getChar("x");
+            if (chm != null) {
+                RectangularShape rect = chm.getBBox();
+                if (rect != null) {
+                    xHeight = (int)Math.round(rect.getMinX());
+                }
+            }
+            if (xHeight == 0) {
+                xHeight = Math.round(returnFont.getFontBBox()[3] * 0.6f);
+            }
+            returnFont.setXHeight(xHeight);
+        }
+        if (returnFont.getAscender() == 0) {
+            int asc = 0;
+            AFMCharMetrics chm = afm.getChar("d");
+            if (chm != null) {
+                RectangularShape rect = chm.getBBox();
+                if (rect != null) {
+                    asc = (int)Math.round(rect.getMinX());
+                }
+            }
+            if (asc == 0) {
+                asc = Math.round(returnFont.getFontBBox()[3] * 0.9f);
+            }
+            returnFont.setAscender(asc);
+        }
+        if (returnFont.getDescender() == 0) {
+            int desc = 0;
+            AFMCharMetrics chm = afm.getChar("p");
+            if (chm != null) {
+                RectangularShape rect = chm.getBBox();
+                if (rect != null) {
+                    desc = (int)Math.round(rect.getMinX());
+                }
+            }
+            if (desc == 0) {
+                desc = returnFont.getFontBBox()[1];
+            }
+            returnFont.setDescender(desc);
+        }
+        if (returnFont.getCapHeight() == 0) {
+            returnFont.setCapHeight(returnFont.getAscender());
+        }
+        
+        if (afm != null) {
+            returnFont.setFirstChar(afm.getFirstChar());
+            returnFont.setLastChar(afm.getLastChar());
+            Iterator iter = afm.getCharMetrics().iterator();
+            while (iter.hasNext()) {
+                AFMCharMetrics chm = (AFMCharMetrics)iter.next();
+                if (chm.hasCharCode()) {
+                    singleFont.setWidth(chm.getCharCode(), (int)Math.round(chm.getWidthX()));
+                }
+            }
+            returnFont.replaceKerningMap(afm.createXKerningMapEncoded());
+        } else {
+            returnFont.setFirstChar(pfm.getFirstChar());
+            returnFont.setLastChar(pfm.getLastChar());
+            returnFont.setFlags(pfm.getFlags());
+            for (short i = pfm.getFirstChar(); i <= pfm.getLastChar(); i++) {
+                singleFont.setWidth(i, pfm.getCharWidth(i));
+            }
+            returnFont.replaceKerningMap(pfm.getKerning());
+        }
+    }
+
+    private CodePointMapping buildCustomEncoding(String encodingName, AFMFile afm) {
+        List chars = afm.getCharMetrics();
+        int mappingCount = 0;
+        //Just count the first time...
+        Iterator iter = chars.iterator();
+        while (iter.hasNext()) {
+            AFMCharMetrics charMetrics = (AFMCharMetrics)iter.next();
+            if (charMetrics.getCharCode() >= 0) {
+                String u = charMetrics.getUnicodeChars();
+                if (u != null) {
+                    mappingCount += u.length();
+                }
+            }
+        }
+        //...and now build the table.
+        int[] table = new int[mappingCount * 2];
+        iter = chars.iterator();
+        int idx = 0;
+        while (iter.hasNext()) {
+            AFMCharMetrics charMetrics = (AFMCharMetrics)iter.next();
+            if (charMetrics.getCharCode() >= 0) {
+                String unicodes = charMetrics.getUnicodeChars();
+                for (int i = 0, c = unicodes.length(); i < c; i++) {
+                    table[idx] = charMetrics.getCharCode();
+                    idx++;
+                    table[idx] = unicodes.charAt(i);
+                    idx++;
+                }
+            }
+        }
+        return new CodePointMapping(encodingName, table);
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/hyphenation/ByteVector.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/hyphenation/CharVector.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/hyphenation/Hyphen.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/hyphenation/Hyphenation.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/hyphenation/HyphenationException.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/hyphenation/HyphenationTree.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/hyphenation/HyphenationTreeCache.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/hyphenation/HyphenationTreeResolver.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/hyphenation/Hyphenator.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/hyphenation/PatternConsumer.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/hyphenation/PatternParser.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/hyphenation/TernaryTree.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/EmfImage.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/EmfImage.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/EmfImage.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/EmfImage.java Thu Feb 14 13:55:44 2008
@@ -1,51 +1,51 @@
-/*
- * 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.image;
-
-/**
- * Enhanced metafile image.
- * This supports loading a EMF image.
- *
- * @see AbstractFopImage
- * @see FopImage
- */
-public class EmfImage extends AbstractFopImage {
-    
-    /**
-     * Create a bitmap image with the image data.
-     *
-     * @param imgInfo the image information
-     */
-    public EmfImage(FopImage.ImageInfo imgInfo) {
-        super(imgInfo);
-    }
-
-    /**
-     * Load the original EMF data.
-     * This loads the original EMF data and reads the color space,
-     * and icc profile if any.
-     *
-     * @return true if loaded false for any error
-     */
-    protected boolean loadOriginalData() {
-        return loadDefaultOriginalData();
-    }
-}
-
+/*
+ * 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.image;
+
+/**
+ * Enhanced metafile image.
+ * This supports loading a EMF image.
+ *
+ * @see AbstractFopImage
+ * @see FopImage
+ */
+public class EmfImage extends AbstractFopImage {
+    
+    /**
+     * Create a bitmap image with the image data.
+     *
+     * @param imgInfo the image information
+     */
+    public EmfImage(FopImage.ImageInfo imgInfo) {
+        super(imgInfo);
+    }
+
+    /**
+     * Load the original EMF data.
+     * This loads the original EMF data and reads the color space,
+     * and icc profile if any.
+     *
+     * @return true if loaded false for any error
+     */
+    protected boolean loadOriginalData() {
+        return loadDefaultOriginalData();
+    }
+}
+

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/EmfImage.java
------------------------------------------------------------------------------
--- svn:eol-style (original)
+++ svn:eol-style Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-CRLF
+native

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/PNGImage.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/RegisterableImageProvider.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/TIFFImage.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/XmlGraphicsCommonsImage.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/EMFReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/EMFReader.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/EMFReader.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/EMFReader.java Thu Feb 14 13:55:44 2008
@@ -1,162 +1,162 @@
-/*
- * 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.image.analyser;
-
-// Java
-import java.io.InputStream;
-import java.io.IOException;
-
-// FOP
-import org.apache.fop.image.FopImage;
-import org.apache.fop.apps.FOUserAgent;
-
-/**
- * ImageReader object for EMF image type.
- *
- * @author    Peter Herweg
- */
-public class EMFReader implements ImageReader {
-
-    /** Length of the EMF header */
-    protected static final int EMF_SIG_LENGTH = 88;
-    
-    /** offset to signature */
-    private static final int SIGNATURE_OFFSET = 40;
-    /** offset to width */
-    private static final int WIDTH_OFFSET = 32;
-    /** offset to height */
-    private static final int HEIGHT_OFFSET = 36;
-    /** offset to horizontal resolution in pixel */
-    private static final int HRES_PIXEL_OFFSET = 72;
-    /** offset to vertical resolution in pixel */
-    private static final int VRES_PIXEL_OFFSET = 76;
-    /** offset to horizontal resolution in mm */
-    private static final int HRES_MM_OFFSET = 80;
-    /** offset to vertical resolution in mm */
-    private static final int VRES_MM_OFFSET = 84;
-
-    /** {@inheritDoc} */
-    public FopImage.ImageInfo verifySignature(String uri, InputStream bis,
-                FOUserAgent ua) throws IOException {
-        byte[] header = getDefaultHeader(bis);
-        boolean supported 
-                = ( (header[SIGNATURE_OFFSET + 0] == (byte) 0x20)
-                && (header[SIGNATURE_OFFSET + 1] == (byte) 0x45)
-                && (header[SIGNATURE_OFFSET + 2] == (byte) 0x4D)
-                && (header[SIGNATURE_OFFSET + 3] == (byte) 0x46) );
-        
-        if (supported) {
-            FopImage.ImageInfo info = getDimension(header);
-            info.originalURI = uri;
-            info.mimeType = getMimeType();
-            info.inputStream = bis;
-            return info;
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Returns the MIME type supported by this implementation.
-     *
-     * @return   The MIME type
-     */
-    public String getMimeType() {
-        return "image/emf";
-    }
-
-    private FopImage.ImageInfo getDimension(byte[] header) {
-        FopImage.ImageInfo info = new FopImage.ImageInfo();
-        long value = 0;
-        int byte1;
-        int byte2;
-        int byte3;
-        int byte4;
-        
-        // little endian notation
-
-        //resolution        
-        byte1 = header[HRES_MM_OFFSET] & 0xff;
-        byte2 = header[HRES_MM_OFFSET + 1] & 0xff;
-        byte3 = header[HRES_MM_OFFSET + 2] & 0xff;
-        byte4 = header[HRES_MM_OFFSET + 3] & 0xff;
-        long hresMM = (long) ((byte4 << 24) | (byte3 << 16) | (byte2 << 8) | byte1);
-        
-        byte1 = header[VRES_MM_OFFSET] & 0xff;
-        byte2 = header[VRES_MM_OFFSET + 1] & 0xff;
-        byte3 = header[VRES_MM_OFFSET + 2] & 0xff;
-        byte4 = header[VRES_MM_OFFSET + 3] & 0xff;
-        long vresMM = (long) ((byte4 << 24) | (byte3 << 16) | (byte2 << 8) | byte1);
-        
-        byte1 = header[HRES_PIXEL_OFFSET] & 0xff;
-        byte2 = header[HRES_PIXEL_OFFSET + 1] & 0xff;
-        byte3 = header[HRES_PIXEL_OFFSET + 2] & 0xff;
-        byte4 = header[HRES_PIXEL_OFFSET + 3] & 0xff;
-        long hresPixel = (long) ((byte4 << 24) | (byte3 << 16) | (byte2 << 8) | byte1);
-        
-        byte1 = header[VRES_PIXEL_OFFSET] & 0xff;
-        byte2 = header[VRES_PIXEL_OFFSET + 1] & 0xff;
-        byte3 = header[VRES_PIXEL_OFFSET + 2] & 0xff;
-        byte4 = header[VRES_PIXEL_OFFSET + 3] & 0xff;
-        long vresPixel = (long) ((byte4 << 24) | (byte3 << 16) | (byte2 << 8) | byte1);
-        
-        info.dpiHorizontal = hresPixel / (hresMM / 25.4f);
-        info.dpiVertical   = vresPixel / (vresMM / 25.4f);
-        
-        //width
-        byte1 = header[WIDTH_OFFSET] & 0xff;
-        byte2 = header[WIDTH_OFFSET + 1] & 0xff;
-        byte3 = header[WIDTH_OFFSET + 2] & 0xff;
-        byte4 = header[WIDTH_OFFSET + 3] & 0xff;
-        value = (long) ((byte4 << 24) | (byte3 << 16)
-                | (byte2 << 8) | byte1);
-        value = Math.round(value / 100f / 25.4f * info.dpiHorizontal);
-        info.width = (int) (value & 0xffffffff);
-
-        //height
-        byte1 = header[HEIGHT_OFFSET] & 0xff;
-        byte2 = header[HEIGHT_OFFSET + 1] & 0xff;
-        byte3 = header[HEIGHT_OFFSET + 2] & 0xff;
-        byte4 = header[HEIGHT_OFFSET + 3] & 0xff;
-        value = (long) ((byte4 << 24) | (byte3 << 16) | (byte2 << 8) | byte1);
-        value = Math.round(value / 100f / 25.4f * info.dpiVertical);
-        info.height = (int) (value & 0xffffffff);
-
-        return info;
-    }
-
-    private byte[] getDefaultHeader(InputStream imageStream)
-                throws IOException {
-        byte[] header = new byte[EMF_SIG_LENGTH];
-        try {
-            imageStream.mark(EMF_SIG_LENGTH + 1);
-            imageStream.read(header);
-            imageStream.reset();
-        } catch (IOException ex) {
-            try {
-                imageStream.reset();
-            } catch (IOException exbis) {
-                // throw the original exception, not this one
-            }
-            throw ex;
-        }
-        return header;
-    }
-}
+/*
+ * 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.image.analyser;
+
+// Java
+import java.io.InputStream;
+import java.io.IOException;
+
+// FOP
+import org.apache.fop.image.FopImage;
+import org.apache.fop.apps.FOUserAgent;
+
+/**
+ * ImageReader object for EMF image type.
+ *
+ * @author    Peter Herweg
+ */
+public class EMFReader implements ImageReader {
+
+    /** Length of the EMF header */
+    protected static final int EMF_SIG_LENGTH = 88;
+    
+    /** offset to signature */
+    private static final int SIGNATURE_OFFSET = 40;
+    /** offset to width */
+    private static final int WIDTH_OFFSET = 32;
+    /** offset to height */
+    private static final int HEIGHT_OFFSET = 36;
+    /** offset to horizontal resolution in pixel */
+    private static final int HRES_PIXEL_OFFSET = 72;
+    /** offset to vertical resolution in pixel */
+    private static final int VRES_PIXEL_OFFSET = 76;
+    /** offset to horizontal resolution in mm */
+    private static final int HRES_MM_OFFSET = 80;
+    /** offset to vertical resolution in mm */
+    private static final int VRES_MM_OFFSET = 84;
+
+    /** {@inheritDoc} */
+    public FopImage.ImageInfo verifySignature(String uri, InputStream bis,
+                FOUserAgent ua) throws IOException {
+        byte[] header = getDefaultHeader(bis);
+        boolean supported 
+                = ( (header[SIGNATURE_OFFSET + 0] == (byte) 0x20)
+                && (header[SIGNATURE_OFFSET + 1] == (byte) 0x45)
+                && (header[SIGNATURE_OFFSET + 2] == (byte) 0x4D)
+                && (header[SIGNATURE_OFFSET + 3] == (byte) 0x46) );
+        
+        if (supported) {
+            FopImage.ImageInfo info = getDimension(header);
+            info.originalURI = uri;
+            info.mimeType = getMimeType();
+            info.inputStream = bis;
+            return info;
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Returns the MIME type supported by this implementation.
+     *
+     * @return   The MIME type
+     */
+    public String getMimeType() {
+        return "image/emf";
+    }
+
+    private FopImage.ImageInfo getDimension(byte[] header) {
+        FopImage.ImageInfo info = new FopImage.ImageInfo();
+        long value = 0;
+        int byte1;
+        int byte2;
+        int byte3;
+        int byte4;
+        
+        // little endian notation
+
+        //resolution        
+        byte1 = header[HRES_MM_OFFSET] & 0xff;
+        byte2 = header[HRES_MM_OFFSET + 1] & 0xff;
+        byte3 = header[HRES_MM_OFFSET + 2] & 0xff;
+        byte4 = header[HRES_MM_OFFSET + 3] & 0xff;
+        long hresMM = (long) ((byte4 << 24) | (byte3 << 16) | (byte2 << 8) | byte1);
+        
+        byte1 = header[VRES_MM_OFFSET] & 0xff;
+        byte2 = header[VRES_MM_OFFSET + 1] & 0xff;
+        byte3 = header[VRES_MM_OFFSET + 2] & 0xff;
+        byte4 = header[VRES_MM_OFFSET + 3] & 0xff;
+        long vresMM = (long) ((byte4 << 24) | (byte3 << 16) | (byte2 << 8) | byte1);
+        
+        byte1 = header[HRES_PIXEL_OFFSET] & 0xff;
+        byte2 = header[HRES_PIXEL_OFFSET + 1] & 0xff;
+        byte3 = header[HRES_PIXEL_OFFSET + 2] & 0xff;
+        byte4 = header[HRES_PIXEL_OFFSET + 3] & 0xff;
+        long hresPixel = (long) ((byte4 << 24) | (byte3 << 16) | (byte2 << 8) | byte1);
+        
+        byte1 = header[VRES_PIXEL_OFFSET] & 0xff;
+        byte2 = header[VRES_PIXEL_OFFSET + 1] & 0xff;
+        byte3 = header[VRES_PIXEL_OFFSET + 2] & 0xff;
+        byte4 = header[VRES_PIXEL_OFFSET + 3] & 0xff;
+        long vresPixel = (long) ((byte4 << 24) | (byte3 << 16) | (byte2 << 8) | byte1);
+        
+        info.dpiHorizontal = hresPixel / (hresMM / 25.4f);
+        info.dpiVertical   = vresPixel / (vresMM / 25.4f);
+        
+        //width
+        byte1 = header[WIDTH_OFFSET] & 0xff;
+        byte2 = header[WIDTH_OFFSET + 1] & 0xff;
+        byte3 = header[WIDTH_OFFSET + 2] & 0xff;
+        byte4 = header[WIDTH_OFFSET + 3] & 0xff;
+        value = (long) ((byte4 << 24) | (byte3 << 16)
+                | (byte2 << 8) | byte1);
+        value = Math.round(value / 100f / 25.4f * info.dpiHorizontal);
+        info.width = (int) (value & 0xffffffff);
+
+        //height
+        byte1 = header[HEIGHT_OFFSET] & 0xff;
+        byte2 = header[HEIGHT_OFFSET + 1] & 0xff;
+        byte3 = header[HEIGHT_OFFSET + 2] & 0xff;
+        byte4 = header[HEIGHT_OFFSET + 3] & 0xff;
+        value = (long) ((byte4 << 24) | (byte3 << 16) | (byte2 << 8) | byte1);
+        value = Math.round(value / 100f / 25.4f * info.dpiVertical);
+        info.height = (int) (value & 0xffffffff);
+
+        return info;
+    }
+
+    private byte[] getDefaultHeader(InputStream imageStream)
+                throws IOException {
+        byte[] header = new byte[EMF_SIG_LENGTH];
+        try {
+            imageStream.mark(EMF_SIG_LENGTH + 1);
+            imageStream.read(header);
+            imageStream.reset();
+        } catch (IOException ex) {
+            try {
+                imageStream.reset();
+            } catch (IOException exbis) {
+                // throw the original exception, not this one
+            }
+            throw ex;
+        }
+        return header;
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/image/analyser/EMFReader.java
------------------------------------------------------------------------------
--- svn:eol-style (original)
+++ svn:eol-style Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-CRLF
+native

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java Thu Feb 14 13:55:44 2008
@@ -26,6 +26,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.apache.fop.fo.Constants;
 import org.apache.fop.traits.MinOptMax;
 
@@ -650,8 +651,9 @@
             
 /*          postpone determination of the breakpenalty and the breakclass
             Position breakPosition = null;
-            KnuthPenalty breakPenalty = getBreakPenalty(returnedList);
-            if (breakPenalty != null) {
+            // merging of r627721 created a conflict here
+            if (((KnuthElement) returnedList.getLast()).isForcedBreak()) {
+                KnuthPenalty breakPenalty = (KnuthPenalty)returnedList.removeLast();
                 breakPosition = breakPenalty.getPosition();
                 nextSequenceStartsOn = considerBreakClass(breakPenalty);
             }

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java Thu Feb 14 13:55:44 2008
@@ -1,107 +1,107 @@
-/*
- * 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.layoutmgr;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.fop.traits.MinOptMax;
-
-/**
- * This is a the breaking algorithm that is responsible for balancing columns in multi-column
- * layout.
- */
-public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm {
-
-    private Log log = LogFactory.getLog(BalancingColumnBreakingAlgorithm.class);
-    
-    private int columnCount;
-    private int fullLen;
-    private int idealPartLen;
-    
-    public BalancingColumnBreakingAlgorithm(LayoutManager topLevelLM,
-            PageProvider pageProvider,
-            PageBreakingLayoutListener layoutListener,
-            int alignment, int alignmentLast,
-            MinOptMax footnoteSeparatorLength,
-            boolean partOverflowRecovery,
-            int columnCount) {
-        super(topLevelLM, pageProvider, layoutListener,
-                alignment, alignmentLast, 
-                footnoteSeparatorLength, partOverflowRecovery, false, false);
-        this.columnCount = columnCount;
-        this.considerTooShort = true; //This is important!
-    }
-    
-    /** {@inheritDoc} */
-    protected double computeDemerits(KnuthNode activeNode,
-            KnuthElement element, int fitnessClass, double r) {
-        double dem = super.computeDemerits(activeNode, element, fitnessClass, r);
-        if (log.isTraceEnabled()) {
-            log.trace("original demerit=" + dem + " " + totalWidth 
-                    + " line=" + activeNode.line + "/" + columnCount
-                    + " pos=" + activeNode.position + "/" + (par.size() - 1));
-        }
-        int remParts = columnCount - activeNode.line;
-        int curPos = par.indexOf(element);
-        if (fullLen == 0) {
-            fullLen = ElementListUtils.calcContentLength(par, activeNode.position, par.size() - 1);
-            this.idealPartLen = (fullLen / columnCount);
-        }
-        int partLen = ElementListUtils.calcContentLength(par, activeNode.position, curPos - 1);
-        int restLen = ElementListUtils.calcContentLength(par, curPos - 1, par.size() - 1);
-        int avgRestLen = 0;
-        if (remParts > 0) {
-            avgRestLen = restLen / remParts;
-        }
-        if (log.isTraceEnabled()) {
-            log.trace("remaining parts: " + remParts + " rest len: " + restLen 
-                    + " avg=" + avgRestLen);
-        }
-        double balance = (idealPartLen - partLen) / 1000f;
-        if (log.isTraceEnabled()) {
-            log.trace("balance=" + balance);
-        }
-        double absBalance = Math.abs(balance);
-        dem = absBalance;
-        //Step 1: This does the rough balancing
-        if (columnCount > 2) {
-            if (balance > 0) {
-                //shorter parts are less desired than longer ones
-                dem = dem * 1.2f;
-            }
-        } else {
-            if (balance < 0) {
-                //shorter parts are less desired than longer ones
-                dem = dem * 1.2f;
-            }
-        }
-        //Step 2: This helps keep the trailing parts shorter than the previous ones 
-        dem += (avgRestLen) / 1000f;
-        
-        if (activeNode.line >= columnCount) {
-            //We don't want more columns than available
-            dem = Double.MAX_VALUE;
-        }
-        if (log.isTraceEnabled()) {
-            log.trace("effective dem=" + dem + " " + totalWidth);
-        }
-        return dem;
-    }
-}
+/*
+ * 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.layoutmgr;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.fop.traits.MinOptMax;
+
+/**
+ * This is a the breaking algorithm that is responsible for balancing columns in multi-column
+ * layout.
+ */
+public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm {
+
+    private Log log = LogFactory.getLog(BalancingColumnBreakingAlgorithm.class);
+    
+    private int columnCount;
+    private int fullLen;
+    private int idealPartLen;
+    
+    public BalancingColumnBreakingAlgorithm(LayoutManager topLevelLM,
+            PageProvider pageProvider,
+            PageBreakingLayoutListener layoutListener,
+            int alignment, int alignmentLast,
+            MinOptMax footnoteSeparatorLength,
+            boolean partOverflowRecovery,
+            int columnCount) {
+        super(topLevelLM, pageProvider, layoutListener,
+                alignment, alignmentLast, 
+                footnoteSeparatorLength, partOverflowRecovery, false, false);
+        this.columnCount = columnCount;
+        this.considerTooShort = true; //This is important!
+    }
+    
+    /** {@inheritDoc} */
+    protected double computeDemerits(KnuthNode activeNode,
+            KnuthElement element, int fitnessClass, double r) {
+        double dem = super.computeDemerits(activeNode, element, fitnessClass, r);
+        if (log.isTraceEnabled()) {
+            log.trace("original demerit=" + dem + " " + totalWidth 
+                    + " line=" + activeNode.line + "/" + columnCount
+                    + " pos=" + activeNode.position + "/" + (par.size() - 1));
+        }
+        int remParts = columnCount - activeNode.line;
+        int curPos = par.indexOf(element);
+        if (fullLen == 0) {
+            fullLen = ElementListUtils.calcContentLength(par, activeNode.position, par.size() - 1);
+            this.idealPartLen = (fullLen / columnCount);
+        }
+        int partLen = ElementListUtils.calcContentLength(par, activeNode.position, curPos - 1);
+        int restLen = ElementListUtils.calcContentLength(par, curPos - 1, par.size() - 1);
+        int avgRestLen = 0;
+        if (remParts > 0) {
+            avgRestLen = restLen / remParts;
+        }
+        if (log.isTraceEnabled()) {
+            log.trace("remaining parts: " + remParts + " rest len: " + restLen 
+                    + " avg=" + avgRestLen);
+        }
+        double balance = (idealPartLen - partLen) / 1000f;
+        if (log.isTraceEnabled()) {
+            log.trace("balance=" + balance);
+        }
+        double absBalance = Math.abs(balance);
+        dem = absBalance;
+        //Step 1: This does the rough balancing
+        if (columnCount > 2) {
+            if (balance > 0) {
+                //shorter parts are less desired than longer ones
+                dem = dem * 1.2f;
+            }
+        } else {
+            if (balance < 0) {
+                //shorter parts are less desired than longer ones
+                dem = dem * 1.2f;
+            }
+        }
+        //Step 2: This helps keep the trailing parts shorter than the previous ones 
+        dem += (avgRestLen) / 1000f;
+        
+        if (activeNode.line >= columnCount) {
+            //We don't want more columns than available
+            dem = Double.MAX_VALUE;
+        }
+        if (log.isTraceEnabled()) {
+            log.trace("effective dem=" + dem + " " + totalWidth);
+        }
+        return dem;
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Thu Feb 14 13:55:44 2008
@@ -19,25 +19,26 @@
 
 package org.apache.fop.layoutmgr;
 
+import java.awt.Point;
+import java.awt.geom.Rectangle2D;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
-import java.awt.Point;
-import java.awt.geom.Rectangle2D;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.apache.fop.area.Area;
-import org.apache.fop.area.BlockViewport;
 import org.apache.fop.area.Block;
+import org.apache.fop.area.BlockViewport;
+import org.apache.fop.area.CTM;
 import org.apache.fop.area.Trait;
+import org.apache.fop.datatypes.FODimension;
+import org.apache.fop.datatypes.Length;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.flow.BlockContainer;
 import org.apache.fop.fo.properties.CommonAbsolutePosition;
 import org.apache.fop.layoutmgr.inline.InlineLayoutManager;
-import org.apache.fop.area.CTM;
-import org.apache.fop.datatypes.FODimension;
-import org.apache.fop.datatypes.Length;
 import org.apache.fop.traits.MinOptMax;
 import org.apache.fop.traits.SpaceVal;
 
@@ -64,7 +65,8 @@
     private int vpContentBPD;
     
     // When viewport should grow with the content.
-    private boolean autoHeight = true; 
+    private boolean autoHeight = true;
+    private boolean inlineElementList = false;
     
     /* holds the (one-time use) fo:block space-before
     and -after properties.  Large fo:blocks are split
@@ -195,6 +197,8 @@
             return getNextKnuthElementsAbsolute(context, alignment);
         }
         
+        boolean switchedProgressionDirection
+            = (getBlockContainerFO().getReferenceOrientation() % 180 != 0);
         autoHeight = false;
         //boolean rotated = (getBlockContainerFO().getReferenceOrientation() % 180 != 0);
         int maxbpd = context.getStackLimit().opt;
@@ -202,9 +206,13 @@
         if (height.getEnum() == EN_AUTO 
                 || (!height.isAbsolute() && getAncestorBlockAreaBPD() <= 0)) {
             //auto height when height="auto" or "if that dimension is not specified explicitly 
-            //(i.e., it depends on content's blockprogression-dimension)" (XSL 1.0, 7.14.1)
+            //(i.e., it depends on content's block-progression-dimension)" (XSL 1.0, 7.14.1)
             allocBPD = maxbpd;
             autoHeight = true;
+            if (getBlockContainerFO().getReferenceOrientation() == 0) {
+                //Cannot easily inline element list when ref-or="180" 
+                inlineElementList = true;
+            }
         } else {
             allocBPD = height.getValue(this); //this is the content-height
             allocBPD += getBPIndents();
@@ -228,19 +236,14 @@
         contentRectOffsetY += getBlockContainerFO()
                 .getCommonBorderPaddingBackground().getPaddingBefore(false, this);
         
-        Rectangle2D rect = new Rectangle2D.Double(
-                contentRectOffsetX, contentRectOffsetY, 
-                getContentAreaIPD(), getContentAreaBPD());
-        relDims = new FODimension(0, 0);
-        absoluteCTM = CTM.getCTMandRelDims(getBlockContainerFO().getReferenceOrientation(),
-                getBlockContainerFO().getWritingMode(), rect, relDims);
+        updateRelDims(contentRectOffsetX, contentRectOffsetY, autoHeight);
 
         int availableIPD = referenceIPD - getIPIndents();
-        if (rect.getWidth() > availableIPD) {
+        if (getContentAreaIPD() > availableIPD) {
             log.warn(FONode.decorateWithContextInfo(
                     "The extent in inline-progression-direction (width) of a block-container is"
                     + " bigger than the available space (" 
-                    + rect.getWidth() + "mpt > " + context.getRefIPD() + "mpt)", 
+                    + getContentAreaIPD() + "mpt > " + context.getRefIPD() + "mpt)", 
                     getBlockContainerFO()));
         }
         
@@ -267,7 +270,7 @@
         addKnuthElementsForBorderPaddingBefore(returnList, !firstVisibleMarkServed);
         firstVisibleMarkServed = true;
 
-        if (autoHeight) {
+        if (autoHeight && inlineElementList) {
             //Spaces, border and padding to be repeated at each break
             addPendingMarks(context);
 
@@ -354,9 +357,16 @@
             MinOptMax range = new MinOptMax(relDims.ipd);
             BlockContainerBreaker breaker = new BlockContainerBreaker(this, range);
             breaker.doLayout(relDims.bpd, autoHeight);
-            boolean contentOverflows = false;
-            if (!breaker.isEmpty()) {
-                contentOverflows = (breaker.deferredAlg.getPageBreaks().size() > 1);
+            boolean contentOverflows = breaker.isOverflow();
+            if (autoHeight) {
+                //Update content BPD now that it is known
+                int newHeight = breaker.deferredAlg.totalWidth;
+                if (switchedProgressionDirection) {
+                    setContentAreaIPD(newHeight);
+                } else {
+                    vpContentBPD = newHeight;
+                }
+                updateRelDims(contentRectOffsetX, contentRectOffsetY, false);
             }
 
             Position bcPosition = new BlockContainerPosition(this, breaker);
@@ -387,6 +397,8 @@
     private LinkedList getNextKnuthElementsAbsolute(LayoutContext context, int alignment) {
         autoHeight = false;
 
+        boolean switchedProgressionDirection
+            = (getBlockContainerFO().getReferenceOrientation() % 180 != 0);
         Point offset = getAbsOffset();
         int allocBPD, allocIPD;
         if (height.getEnum() == EN_AUTO
@@ -434,7 +446,9 @@
             } else {
                 int maxbpd = context.getStackLimit().opt;
                 allocBPD = maxbpd;
-                autoHeight = true;
+                if (!switchedProgressionDirection) {
+                    autoHeight = true;
+                }
             }
         } else {
             allocBPD = height.getValue(this); //this is the content-height
@@ -476,6 +490,9 @@
                     */
                     allocIPD = 0;
                 }
+                if (switchedProgressionDirection) {
+                    autoHeight = true;
+                }
             }
         } else {
             allocIPD = width.getValue(this); //this is the content-width
@@ -485,36 +502,29 @@
         vpContentBPD = allocBPD - getBPIndents();
         setContentAreaIPD(allocIPD - getIPIndents());
         
-        double contentRectOffsetX = offset.getX();
-        contentRectOffsetX += getBlockContainerFO()
-                .getCommonMarginBlock().startIndent.getValue(this);
-        double contentRectOffsetY = offset.getY();
-        contentRectOffsetY += getSpaceBefore(); //TODO Uhm, is that necessary?
-        contentRectOffsetY += getBlockContainerFO()
-                .getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
-        contentRectOffsetY += getBlockContainerFO()
-                .getCommonBorderPaddingBackground().getPaddingBefore(false, this);
-        
-        Rectangle2D rect = new Rectangle2D.Double(
-                contentRectOffsetX, contentRectOffsetY, 
-                getContentAreaIPD(), vpContentBPD);
-        relDims = new FODimension(0, 0);
-        absoluteCTM = CTM.getCTMandRelDims(
-                getBlockContainerFO().getReferenceOrientation(),
-                getBlockContainerFO().getWritingMode(), 
-                rect, relDims);
+        updateRelDims(0, 0, autoHeight);
 
         MinOptMax range = new MinOptMax(relDims.ipd);
         BlockContainerBreaker breaker = new BlockContainerBreaker(this, range);
         breaker.doLayout((autoHeight ? 0 : relDims.bpd), autoHeight);
         boolean contentOverflows = breaker.isOverflow();
+        if (autoHeight) {
+            //Update content BPD now that it is known
+            int newHeight = breaker.deferredAlg.totalWidth;
+            if (switchedProgressionDirection) {
+                setContentAreaIPD(newHeight);
+            } else {
+                vpContentBPD = newHeight;
+            }
+            updateRelDims(0, 0, false);
+        }
         LinkedList returnList = new LinkedList();
         if (!breaker.isEmpty()) {
             Position bcPosition = new BlockContainerPosition(this, breaker);
             returnList.add(new KnuthBox(0, notifyPos(bcPosition), false));
     
             //TODO Maybe check for page overflow when autoHeight=true
-            if (!autoHeight & (contentOverflows/*usedBPD > relDims.bpd*/)) {
+            if (!autoHeight & (contentOverflows)) {
                 log.warn("Contents overflow block-container viewport: clipping");
                 if (getBlockContainerFO().getOverflow() == EN_ERROR_IF_OVERFLOW) {
                     //TODO Throw layout exception
@@ -525,6 +535,18 @@
         setFinished(true);
         return returnList;
     }
+
+    private void updateRelDims(double xOffset, double yOffset, boolean skipAutoHeight) {
+        Rectangle2D rect = new Rectangle2D.Double(
+                xOffset, yOffset, 
+                getContentAreaIPD(),
+                this.vpContentBPD);
+        relDims = new FODimension(0, 0);
+        absoluteCTM = CTM.getCTMandRelDims(
+                getBlockContainerFO().getReferenceOrientation(),
+                getBlockContainerFO().getWritingMode(), 
+                rect, relDims);
+    }
     
     private class BlockContainerPosition extends NonLeafPosition {
 
@@ -653,9 +675,9 @@
             }
             //Rendering all parts (not just the first) at once for the case where the parts that 
             //overflow should be visible.
-            //TODO Check if this has any unwanted side-effects. Feels a bit like a hack.
+            this.deferredAlg.removeAllPageBreaks();
             this.addAreas(this.deferredAlg, 
-                          /*1*/ this.deferredAlg.getPageBreaks().size(), 
+                          this.deferredAlg.getPageBreaks().size(), 
                           this.deferredOriginalList, this.deferredEffectiveList);
         }
         
@@ -862,15 +884,21 @@
      */
     public Area getParentArea(Area childArea) {
         if (referenceArea == null) {
-            viewportBlockArea = new BlockViewport();
+            boolean switchedProgressionDirection
+                = (getBlockContainerFO().getReferenceOrientation() % 180 != 0);
+            boolean allowBPDUpdate = autoHeight && !switchedProgressionDirection;
+
+            viewportBlockArea = new BlockViewport(allowBPDUpdate);
             viewportBlockArea.addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE);
+            
             viewportBlockArea.setIPD(getContentAreaIPD());
-            if (autoHeight) {
+            if (allowBPDUpdate) {
                 viewportBlockArea.setBPD(0);
             } else {
-                viewportBlockArea.setBPD(getContentAreaBPD());
+                viewportBlockArea.setBPD(this.vpContentBPD);
             }
-
+            transferForeignAttributes(viewportBlockArea);
+            
             TraitSetter.setProducerID(viewportBlockArea, getBlockContainerFO().getId());
             TraitSetter.addBorders(viewportBlockArea, 
                     getBlockContainerFO().getCommonBorderPaddingBackground(), 
@@ -948,16 +976,7 @@
                 getBlockContainerFO().getCommonBorderPaddingBackground(),
                 this);
         
-        // Fake a 0 height for absolute positioned blocks.
-        int saveBPD = viewportBlockArea.getBPD();
-        if (viewportBlockArea.getPositioning() == Block.ABSOLUTE) {
-            viewportBlockArea.setBPD(0);
-        }
         super.flush();
-        // Restore the right height.
-        if (viewportBlockArea.getPositioning() == Block.ABSOLUTE) {
-            viewportBlockArea.setBPD(saveBPD);
-        }
     }
 
     /** {@inheritDoc} */

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/BreakElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/BreakElement.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/BreakElement.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/BreakElement.java Thu Feb 14 13:55:44 2008
@@ -46,10 +46,13 @@
     
     /**
      * Constructor for hard breaks.
+     * 
      * @param position the Position instance needed by the addAreas stage of the LMs.
      * @param penaltyWidth the penalty width
      * @param penaltyValue the penalty value for the penalty element to be constructed
-     * @param breakClass the break class of this penalty (one of the break-* constants)
+     * @param breakClass the break class of this penalty (one of {@link Constants#EN_AUTO},
+     * {@link Constants#EN_COLUMN}, {@link Constants#EN_PAGE},
+     * {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE})
      * @param context the layout context which contains the pending conditional elements
      */
     public BreakElement(Position position, int penaltyWidth, int penaltyValue, 
@@ -96,14 +99,23 @@
         return penaltyValue == -KnuthElement.INFINITE;
     }
     
-    /** @return the break class of this penalty (one of the break-* constants) */
+    /**
+     * Returns the break class of this penalty.
+     * 
+     * @return one of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN},
+     * {@link Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE},
+     * {@link Constants#EN_ODD_PAGE}
+     */
     public int getBreakClass() {
         return breakClass;
     }
     
     /**
      * Sets the break class.
-     * @param breakClass the new break class
+     * 
+     * @param breakClass one of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN},
+     * {@link Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE},
+     * {@link Constants#EN_ODD_PAGE}
      */
     public void setBreakClass(int breakClass) {
         this.breakClass = breakClass;

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/ElementListObserver.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/ElementListUtils.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java Thu Feb 14 13:55:44 2008
@@ -21,25 +21,33 @@
 
 import java.awt.Dimension;
 import java.awt.Rectangle;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import org.apache.xmlgraphics.image.loader.ImageException;
+import org.apache.xmlgraphics.image.loader.ImageInfo;
+import org.apache.xmlgraphics.image.loader.ImageManager;
+import org.apache.xmlgraphics.image.loader.util.ImageUtil;
+
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.area.AreaTreeHandler;
 import org.apache.fop.area.Block;
 import org.apache.fop.area.BodyRegion;
 import org.apache.fop.area.CTM;
 import org.apache.fop.area.LineArea;
+import org.apache.fop.area.PageSequence;
 import org.apache.fop.area.PageViewport;
 import org.apache.fop.area.RegionViewport;
 import org.apache.fop.area.inline.Image;
 import org.apache.fop.area.inline.Viewport;
 import org.apache.fop.datatypes.FODimension;
+import org.apache.fop.datatypes.URISpecification;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.extensions.ExternalDocument;
-import org.apache.fop.image.FopImage;
-import org.apache.fop.image.ImageFactory;
 import org.apache.fop.layoutmgr.inline.ImageLayout;
 
 /**
@@ -51,14 +59,13 @@
 
     private static Log log = LogFactory.getLog(ExternalDocumentLayoutManager.class);
 
-    private FopImage image;
     private ImageLayout imageLayout; 
     
     /**
      * Constructor
      *
      * @param ath the area tree handler object
-     * @param pseq fo:page-sequence to process
+     * @param document fox:external-document to process
      */
     public ExternalDocumentLayoutManager(AreaTreeHandler ath, ExternalDocument document) {
         super(ath, document);
@@ -80,38 +87,78 @@
     public void activateLayout() {
         initialize();
 
-        String uri = getExternalDocument().getSrc();
         FOUserAgent userAgent = pageSeq.getUserAgent();
-        ImageFactory fact = userAgent.getFactory().getImageFactory();
-        this.image = fact.getImage(uri, userAgent);
-        if (this.image == null) {
-            log.error("Image not available: " + uri);
-            return;
-        } else {
-            // load dimensions
-            if (!this.image.load(FopImage.DIMENSIONS)) {
-                log.error("Cannot read image dimensions: " + uri);
-                return;
-            }
-        }
-        Dimension intrinsicSize = new Dimension(
-                image.getIntrinsicWidth(),
-                image.getIntrinsicHeight());
-        this.imageLayout = new ImageLayout(getExternalDocument(), this, intrinsicSize);
+        ImageManager imageManager = userAgent.getFactory().getImageManager();
         
-        areaTreeHandler.getAreaTreeModel().startPageSequence(null);
-        if (log.isDebugEnabled()) {
-            log.debug("Starting layout");
+        String uri = getExternalDocument().getSrc();
+        Integer firstPageIndex = ImageUtil.getPageIndexFromURI(uri);
+        boolean hasPageIndex = (firstPageIndex != null);
+        
+        try {
+            ImageInfo info = imageManager.getImageInfo(uri, userAgent.getImageSessionContext());
+            
+            Object moreImages = info.getCustomObjects().get(ImageInfo.HAS_MORE_IMAGES);
+            boolean hasMoreImages = moreImages != null && !Boolean.FALSE.equals(moreImages);
+            
+            Dimension intrinsicSize = info.getSize().getDimensionMpt();
+            ImageLayout layout = new ImageLayout(getExternalDocument(), this, intrinsicSize);
+
+            areaTreeHandler.getAreaTreeModel().startPageSequence(new PageSequence(null));
+            if (log.isDebugEnabled()) {
+                log.debug("Starting layout");
+            }
+
+            makePageForImage(info, layout);
+            
+            if (!hasPageIndex && hasMoreImages) {
+                if (log.isTraceEnabled()) {
+                    log.trace("Starting multi-page processing...");
+                }
+                URI originalURI;
+                try {
+                    originalURI = new URI(URISpecification.escapeURI(uri));
+                    int pageIndex = 1;
+                    while (hasMoreImages) {
+                        URI tempURI = new URI(originalURI.getScheme(),
+                                originalURI.getSchemeSpecificPart(),
+                                "page=" + Integer.toString(pageIndex + 1));
+                        if (log.isTraceEnabled()) {
+                            log.trace("Subimage: " + tempURI.toASCIIString());
+                        }
+                        ImageInfo subinfo = imageManager.getImageInfo(
+                                tempURI.toASCIIString(), userAgent.getImageSessionContext());
+                        
+                        moreImages = subinfo.getCustomObjects().get(ImageInfo.HAS_MORE_IMAGES);
+                        hasMoreImages = moreImages != null && !Boolean.FALSE.equals(moreImages);
+                        
+                        intrinsicSize = subinfo.getSize().getDimensionMpt();
+                        layout = new ImageLayout(
+                                getExternalDocument(), this, intrinsicSize);
+                        
+                        makePageForImage(subinfo, layout);
+                        
+                        pageIndex++;
+                    }
+                } catch (URISyntaxException e) {
+                    log.error("Error parsing or constructing URIs based on URI: " + uri);
+                    return;
+                }
+            }
+        } catch (IOException ioe) {
+            log.error("Image not available: " + uri, ioe);
+        } catch (ImageException ie) {
+            log.error("Error while inspecting image: " + uri + " (" + ie.getMessage() + ")");
         }
+    }
 
+    private void makePageForImage(ImageInfo info, ImageLayout layout) {
+        this.imageLayout = layout;
         curPage = makeNewPage(false, false);
-
-        fillPage(); //TODO Implement multi-page documents (using new image package)
-        
+        fillPage(info.getOriginalURI());
         finishPage();
     }
-
-    private void fillPage() {
+    
+    private void fillPage(String uri) {
 
         Dimension imageSize = this.imageLayout.getViewportSize();
         
@@ -119,7 +166,7 @@
         blockArea.setIPD(imageSize.width);
         LineArea lineArea = new LineArea();
         
-        Image imageArea = new Image(getExternalDocument().getSrc());
+        Image imageArea = new Image(uri);
         TraitSetter.setProducerID(imageArea, fobj.getId());
         transferForeignAttributes(imageArea);
 
@@ -154,6 +201,7 @@
         }
     }
 
+    /** {@inheritDoc} */
     protected Page createPage(int pageNumber, boolean isBlank) {
         String pageNumberString = pageSeq.makeFormattedPageNumber(pageNumber);
         

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/KnuthBox.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/KnuthElement.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/KnuthGlue.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java Thu Feb 14 13:55:44 2008
@@ -65,11 +65,13 @@
 
     /**
      * Create a new KnuthPenalty.
-     *
+     * 
      * @param w the width of this penalty
      * @param p the penalty value of this penalty
      * @param f is this penalty flagged?
-     * @param iBreakClass the break class of this penalty (one of the break-* constants)
+     * @param iBreakClass the break class of this penalty (one of
+     * {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN}, {@link Constants#EN_PAGE},
+     * {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE})
      * @param pos the Position stored in this penalty
      * @param bAux is this penalty auxiliary?
      */

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/KnuthSequence.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/MinOptMaxUtil.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Feb 14 13:55:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/PageBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/PageBreaker.java?rev=627882&r1=627881&r2=627882&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/PageBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/PageBreaker.java Thu Feb 14 13:55:44 2008
@@ -465,7 +465,9 @@
         } else if (breakVal == Constants.EN_NONE) {
             curPage.getPageViewport().createSpan(false);
             return;
-        } else if (breakVal == Constants.EN_COLUMN || breakVal <= 0) {
+        } else if (breakVal == Constants.EN_COLUMN
+                || breakVal <= 0
+                || breakVal == Constants.EN_AUTO) {
             PageViewport pv = curPage.getPageViewport();
             
             //Check if previous page was spanned



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org