Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/SingleByteFont.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/SingleByteFont.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/SingleByteFont.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/SingleByteFont.java Mon Mar 17 09:31:13 2014 @@ -19,6 +19,7 @@ package org.apache.fop.fonts; +import java.awt.Rectangle; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -47,6 +48,8 @@ public class SingleByteFont extends Cust private int[] width = null; + private Rectangle[] boundingBoxes; + private Map<Character, UnencodedCharacter> unencodedCharacters; private List<SimpleSingleByteEncoding> additionalEncodings; private Map<Character, Character> alternativeCodes; @@ -111,6 +114,24 @@ public class SingleByteFont extends Cust return arr; } + public Rectangle getBoundingBox(int glyphIndex, int size) { + Rectangle bbox = null; + if (glyphIndex < 256) { + int idx = glyphIndex - getFirstChar(); + if (idx >= 0 && idx < boundingBoxes.length) { + bbox = boundingBoxes[idx]; + } + } else if (this.additionalEncodings != null) { + int encodingIndex = (glyphIndex / 256) - 1; + SimpleSingleByteEncoding encoding = getAdditionalEncoding(encodingIndex); + int codePoint = glyphIndex % 256; + NamedCharacter nc = encoding.getCharacterForIndex(codePoint); + UnencodedCharacter uc = this.unencodedCharacters.get(Character.valueOf(nc.getSingleUnicodeValue())); + bbox = uc.getBBox(); + } + return bbox == null ? null : new Rectangle(bbox.x * size, bbox.y * size, bbox.width * size, bbox.height * size); + } + /** * Lookup a character using its alternative names. If found, cache it so we * can speed up lookups. @@ -292,17 +313,24 @@ public class SingleByteFont extends Cust this.width[index - getFirstChar()] = w; } + public void setBoundingBox(int index, Rectangle bbox) { + if (this.boundingBoxes == null) { + this.boundingBoxes = new Rectangle[getLastChar() - getFirstChar() + 1]; + } + this.boundingBoxes[index - getFirstChar()] = bbox; + } + /** * Adds an unencoded character (one that is not supported by the primary encoding). * @param ch the named character * @param width the width of the character */ - public void addUnencodedCharacter(NamedCharacter ch, int width) { + public void addUnencodedCharacter(NamedCharacter ch, int width, Rectangle bbox) { if (this.unencodedCharacters == null) { this.unencodedCharacters = new HashMap<Character, UnencodedCharacter>(); } if (ch.hasSingleUnicodeValue()) { - UnencodedCharacter uc = new UnencodedCharacter(ch, width); + UnencodedCharacter uc = new UnencodedCharacter(ch, width, bbox); this.unencodedCharacters.put(Character.valueOf(ch.getSingleUnicodeValue()), uc); } else { //Cannot deal with unicode sequences, so ignore this character @@ -381,10 +409,12 @@ public class SingleByteFont extends Cust private final NamedCharacter character; private final int width; + private final Rectangle bbox; - public UnencodedCharacter(NamedCharacter character, int width) { + public UnencodedCharacter(NamedCharacter character, int width, Rectangle bbox) { this.character = character; this.width = width; + this.bbox = bbox; } public NamedCharacter getCharacter() { @@ -395,6 +425,10 @@ public class SingleByteFont extends Cust return this.width; } + public Rectangle getBBox() { + return bbox; + } + /** {@inheritDoc} */ @Override public String toString() {
Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/truetype/OFFontLoader.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/truetype/OFFontLoader.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/truetype/OFFontLoader.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/truetype/OFFontLoader.java Mon Mar 17 09:31:13 2014 @@ -19,6 +19,7 @@ package org.apache.fop.fonts.truetype; +import java.awt.Rectangle; import java.io.IOException; import java.io.InputStream; import java.net.URI; @@ -149,6 +150,10 @@ public class OFFontLoader extends FontLo returnFont.setAscender(otf.getLowerCaseAscent()); returnFont.setDescender(otf.getLowerCaseDescent()); returnFont.setFontBBox(otf.getFontBBox()); + returnFont.setUnderlinePosition(otf.getUnderlinePosition() - otf.getUnderlineThickness() / 2); + returnFont.setUnderlineThickness(otf.getUnderlineThickness()); + returnFont.setStrikeoutPosition(otf.getStrikeoutPosition() - otf.getStrikeoutThickness() / 2); + returnFont.setStrikeoutThickness(otf.getStrikeoutThickness()); returnFont.setFlags(otf.getFlags()); returnFont.setStemV(Integer.parseInt(otf.getStemV())); //not used for TTF returnFont.setItalicAngle(Integer.parseInt(otf.getItalicAngle())); @@ -161,15 +166,15 @@ public class OFFontLoader extends FontLo } else { multiFont.setCIDType(CIDFontType.CIDTYPE2); } - int[] wx = otf.getWidths(); - multiFont.setWidthArray(wx); + multiFont.setWidthArray(otf.getWidths()); + multiFont.setBBoxArray(otf.getBoundingBoxes()); } else { singleFont.setFontType(FontType.TRUETYPE); singleFont.setEncoding(otf.getCharSetName()); returnFont.setFirstChar(otf.getFirstChar()); returnFont.setLastChar(otf.getLastChar()); singleFont.setTrueTypePostScriptVersion(otf.getPostScriptVersion()); - copyWidthsSingleByte(otf); + copyGlyphMetricsSingleByte(otf); } returnFont.setCMap(getCMap(otf)); @@ -195,10 +200,14 @@ public class OFFontLoader extends FontLo return otf.getCMaps().toArray(array); } - private void copyWidthsSingleByte(OpenFont otf) { + private void copyGlyphMetricsSingleByte(OpenFont otf) { int[] wx = otf.getWidths(); + Rectangle[] bboxes = otf.getBoundingBoxes(); for (int i = singleFont.getFirstChar(); i <= singleFont.getLastChar(); i++) { singleFont.setWidth(i, otf.getCharWidth(i)); + int[] bbox = otf.getBBox(i); + singleFont.setBoundingBox(i, + new Rectangle(bbox[0], bbox[1], bbox[2] - bbox[0], bbox[3] - bbox[1])); } for (CMapSegment segment : otf.getCMaps()) { @@ -214,7 +223,7 @@ public class OFFontLoader extends FontLo if (glyphName.length() > 0) { String unicode = Character.toString(u); NamedCharacter nc = new NamedCharacter(glyphName, unicode); - singleFont.addUnencodedCharacter(nc, wx[glyphIndex]); + singleFont.addUnencodedCharacter(nc, wx[glyphIndex], bboxes[glyphIndex]); } } } Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/truetype/OTFFile.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/truetype/OTFFile.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/truetype/OTFFile.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/truetype/OTFFile.java Mon Mar 17 09:31:13 2014 @@ -20,11 +20,17 @@ package org.apache.fop.fonts.truetype; import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import org.apache.fontbox.cff.CFFDataInput; import org.apache.fontbox.cff.CFFFont; -import org.apache.fontbox.cff.CFFFont.Mapping; import org.apache.fontbox.cff.CFFParser; +import org.apache.fontbox.cff.charset.CFFCharset; public class OTFFile extends OpenFont { @@ -45,17 +51,77 @@ public class OTFFile extends OpenFont { @Override protected void updateBBoxAndOffset() throws IOException { + List<Mapping> gidMappings = getGIDMappings(fileFont); + Map<Integer, String> sidNames = constructNameMap(gidMappings); UnicodeMapping[] mappings = unicodeMappings.toArray(new UnicodeMapping[0]); for (int i = 0; i < mappings.length; i++) { int glyphIdx = mappings[i].getGlyphIndex(); - Mapping m = fileFont.getGIDMappings().get(glyphIdx); - int[] bbox = fileFont.getBoundingBox(m.getSID()); - String name = fileFont.getNameOfCharFromCode(m.getSID()); - mtxTab[glyphIdx].setBoundingBox(bbox); + Mapping m = gidMappings.get(glyphIdx); + String name = sidNames.get(m.getSID()); mtxTab[glyphIdx].setName(name); } } + private List<Mapping> getGIDMappings(CFFFont font) { + List<Mapping> gidMappings = new ArrayList<Mapping>(); + Mapping notdef = new Mapping(); + gidMappings.add(notdef); + for (CFFCharset.Entry entry : font.getCharset().getEntries()) { + String name = entry.getName(); + byte[] bytes = font.getCharStringsDict().get(name); + if (bytes == null) { + continue; + } + Mapping mapping = new Mapping(); + mapping.setSID(entry.getSID()); + mapping.setName(name); + mapping.setBytes(bytes); + gidMappings.add(mapping); + } + return gidMappings; + } + + private Map<Integer, String> constructNameMap(Collection<Mapping> mappings) { + Map<Integer, String> sidNames = new HashMap<Integer, String>(); + Iterator<Mapping> it = mappings.iterator(); + while (it.hasNext()) { + Mapping mapping = it.next(); + sidNames.put(mapping.getSID(), mapping.getName()); + } + return sidNames; + } + + private static class Mapping { + private int sid; + private String name; + private byte[] bytes; + + public void setSID(int sid) { + this.sid = sid; + } + + public int getSID() { + return sid; + } + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setBytes(byte[] bytes) { + this.bytes = bytes; + } + + public byte[] getBytes() { + return bytes; + } + } + + @Override protected void initializeFont(FontFileReader in) throws IOException { fontFile = in; Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java Mon Mar 17 09:31:13 2014 @@ -861,7 +861,6 @@ public class OTFSubSetFile extends OTFFi return hdrTotal + total; } - private BytesNumber readNumber(int b0, byte[] input, int curPos) throws IOException { if (b0 == 28) { int b1 = input[curPos + 1] & 0xff; @@ -887,7 +886,7 @@ public class OTFSubSetFile extends OTFFi /** * A class used to store the last number operand and also it's size in bytes */ - private static final class BytesNumber { + static class BytesNumber { private int number; private int numBytes; @@ -908,6 +907,26 @@ public class OTFSubSetFile extends OTFFi this.number = -1; this.numBytes = -1; } + + public String toString() { + return Integer.toString(number); + } + + @Override + public boolean equals(Object entry) { + assert entry instanceof BytesNumber; + BytesNumber bnEntry = (BytesNumber)entry; + return this.number == bnEntry.getNumber() + && this.numBytes == bnEntry.getNumBytes(); + } + + @Override + public int hashCode() { + int hash = 1; + hash = hash * 17 + number; + hash = hash * 31 + numBytes; + return hash; + } } private void writeCharsetTable(boolean cidFont) throws IOException { @@ -1094,4 +1113,12 @@ public class OTFSubSetFile extends OTFFi System.arraycopy(output, 0, ret, 0, realSize); return ret; } + + /** + * Returns the parsed CFF data for the original font. + * @return The CFFDataReader contaiing the parsed data + */ + public CFFDataReader getCFFReader() { + return cffReader; + } } Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/truetype/OpenFont.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/truetype/OpenFont.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/truetype/OpenFont.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/truetype/OpenFont.java Mon Mar 17 09:31:13 2014 @@ -19,6 +19,7 @@ package org.apache.fop.fonts.truetype; +import java.awt.Rectangle; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -195,6 +196,10 @@ public abstract class OpenFont { private int fontBBox4 = 0; private int capHeight = 0; private int os2CapHeight = 0; + private int underlinePosition; + private int underlineThickness; + private int strikeoutPosition; + private int strikeoutThickness; private int xHeight = 0; private int os2xHeight = 0; //Effective ascender/descender @@ -995,10 +1000,22 @@ public abstract class OpenFont { for (int i = 0; i < wx.length; i++) { wx[i] = convertTTFUnit2PDFUnit(mtxTab[i].getWx()); } - return wx; } + public Rectangle[] getBoundingBoxes() { + Rectangle[] boundingBoxes = new Rectangle[mtxTab.length]; + for (int i = 0; i < boundingBoxes.length; i++) { + int[] boundingBox = mtxTab[i].getBoundingBox(); + boundingBoxes[i] = new Rectangle( + convertTTFUnit2PDFUnit(boundingBox[0]), + convertTTFUnit2PDFUnit(boundingBox[1]), + convertTTFUnit2PDFUnit(boundingBox[2] - boundingBox[0]), + convertTTFUnit2PDFUnit(boundingBox[3] - boundingBox[1])); + } + return boundingBoxes; + } + /** * Returns an array (xMin, yMin, xMax, yMax) for a glyph. * @@ -1039,6 +1056,22 @@ public abstract class OpenFont { return ansiKerningTab; } + public int getUnderlinePosition() { + return convertTTFUnit2PDFUnit(underlinePosition); + } + + public int getUnderlineThickness() { + return convertTTFUnit2PDFUnit(underlineThickness); + } + + public int getStrikeoutPosition() { + return convertTTFUnit2PDFUnit(strikeoutPosition); + } + + public int getStrikeoutThickness() { + return convertTTFUnit2PDFUnit(strikeoutThickness); + } + /** * Indicates if the font may be embedded. * @return boolean True if it may be embedded @@ -1215,10 +1248,8 @@ public abstract class OpenFont { seekTab(fontFile, OFTableName.POST, 0); int postFormat = fontFile.readTTFLong(); italicAngle = fontFile.readTTFULong(); - //underlinePosition - fontFile.readTTFShort(); - //underlineThickness - fontFile.readTTFShort(); + underlinePosition = fontFile.readTTFShort(); + underlineThickness = fontFile.readTTFShort(); isFixedPitch = fontFile.readTTFULong(); //Skip memory usage values @@ -1322,7 +1353,10 @@ public abstract class OpenFont { } else { isEmbeddable = true; } - fontFile.skip(11 * 2); + fontFile.skip(8 * 2); + strikeoutThickness = fontFile.readTTFShort(); + strikeoutPosition = fontFile.readTTFShort(); + fontFile.skip(2); fontFile.skip(10); //panose array fontFile.skip(4 * 4); //unicode ranges fontFile.skip(4); Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/type1/AFMCharMetrics.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/type1/AFMCharMetrics.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/type1/AFMCharMetrics.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/type1/AFMCharMetrics.java Mon Mar 17 09:31:13 2014 @@ -19,7 +19,7 @@ package org.apache.fop.fonts.type1; -import java.awt.geom.RectangularShape; +import java.awt.Rectangle; import org.apache.fop.fonts.NamedCharacter; @@ -33,7 +33,7 @@ public class AFMCharMetrics { private NamedCharacter character; private double widthX; private double widthY; - private RectangularShape bBox; + private Rectangle bBox; /** * Returns the character code. @@ -137,7 +137,7 @@ public class AFMCharMetrics { * Returns the character's bounding box. * @return the bounding box (or null if it isn't available) */ - public RectangularShape getBBox() { + public Rectangle getBBox() { return bBox; } @@ -145,7 +145,7 @@ public class AFMCharMetrics { * Sets the character's bounding box. * @param box the bounding box */ - public void setBBox(RectangularShape box) { + public void setBBox(Rectangle box) { bBox = box; } Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java Mon Mar 17 09:31:13 2014 @@ -217,12 +217,16 @@ public class Type1FontLoader extends Fon for (AFMCharMetrics metrics : charMetrics) { String charName = metrics.getCharName(); if (charName != null && !glyphNames.contains(charName)) { - singleFont.addUnencodedCharacter(metrics.getCharacter(), - (int)Math.round(metrics.getWidthX())); + addUnencodedCharacter(singleFont, metrics); } } } + private static void addUnencodedCharacter(SingleByteFont font, AFMCharMetrics metrics) { + font.addUnencodedCharacter(metrics.getCharacter(), + (int) Math.round(metrics.getWidthX()), metrics.getBBox()); + } + /** * Adds characters not encoded in the font's primary encoding. This method is used when * the primary encoding is built based on the character codes in the AFM rather than @@ -234,8 +238,7 @@ public class Type1FontLoader extends Fon for (int i = 0, c = afm.getCharCount(); i < c; i++) { AFMCharMetrics metrics = (AFMCharMetrics)charMetrics.get(i); if (!metrics.hasCharCode() && metrics.getCharacter() != null) { - singleFont.addUnencodedCharacter(metrics.getCharacter(), - (int)Math.round(metrics.getWidthX())); + addUnencodedCharacter(singleFont, metrics); } } } @@ -281,7 +284,10 @@ public class Type1FontLoader extends Fon } else { returnFont.setStemV(80); // Arbitrary value } - returnFont.setItalicAngle((int) afm.getWritingDirectionMetrics(0).getItalicAngle()); + AFMWritingDirectionMetrics metrics = afm.getWritingDirectionMetrics(0); + returnFont.setItalicAngle((int) metrics.getItalicAngle()); + returnFont.setUnderlinePosition(metrics.getUnderlinePosition().intValue()); + returnFont.setUnderlineThickness(metrics.getUnderlineThickness().intValue()); } else { returnFont.setFontBBox(pfm.getFontBBox()); returnFont.setStemV(pfm.getStemV()); @@ -383,6 +389,7 @@ public class Type1FontLoader extends Fon for (AFMCharMetrics chm : afm.getCharMetrics()) { if (chm.hasCharCode()) { singleFont.setWidth(chm.getCharCode(), (int) Math.round(chm.getWidthX())); + singleFont.setBoundingBox(chm.getCharCode(), chm.getBBox()); } } if (useKerning) { Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java Mon Mar 17 09:31:13 2014 @@ -33,6 +33,7 @@ import org.apache.batik.bridge.GVTBuilde import org.apache.batik.bridge.UserAgent; import org.apache.batik.dom.svg.SVGDOMImplementation; import org.apache.batik.gvt.GraphicsNode; +import org.apache.batik.gvt.font.DefaultFontFamilyResolver; import org.apache.xmlgraphics.image.GraphicsConstants; import org.apache.xmlgraphics.image.loader.Image; @@ -123,10 +124,8 @@ public class ImageConverterSVG2G2D exten * @return the newly created user agent */ protected SimpleSVGUserAgent createBatikUserAgent(float pxToMillimeter) { - return new SimpleSVGUserAgent( - pxToMillimeter, - new AffineTransform()) { - + return new SimpleSVGUserAgent(pxToMillimeter, new AffineTransform(), + DefaultFontFamilyResolver.SINGLETON) { /** {@inheritDoc} */ public void displayMessage(String message) { //TODO Refine and pipe through to caller Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/image/loader/batik/PreloaderSVG.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/image/loader/batik/PreloaderSVG.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/image/loader/batik/PreloaderSVG.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/image/loader/batik/PreloaderSVG.java Mon Mar 17 09:31:13 2014 @@ -38,6 +38,7 @@ import org.apache.batik.bridge.UnitProce import org.apache.batik.bridge.UserAgent; import org.apache.batik.dom.svg.SAXSVGDocumentFactory; import org.apache.batik.dom.svg.SVGOMDocument; +import org.apache.batik.gvt.font.DefaultFontFamilyResolver; import org.apache.xmlgraphics.image.loader.ImageContext; import org.apache.xmlgraphics.image.loader.ImageInfo; @@ -162,7 +163,7 @@ public class PreloaderSVG extends Abstra Element e = doc.getRootElement(); float pxUnitToMillimeter = UnitConv.IN2MM / context.getSourceResolution(); UserAgent userAg = new SimpleSVGUserAgent(pxUnitToMillimeter, - new AffineTransform()) { + new AffineTransform(), DefaultFontFamilyResolver.SINGLETON) { /** {@inheritDoc} */ public void displayMessage(String message) { Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java Mon Mar 17 09:31:13 2014 @@ -65,9 +65,6 @@ public abstract class AbstractBaseLayout public AbstractBaseLayoutManager(FObj fo) { this.fobj = fo; setGeneratesReferenceArea(fo.generatesReferenceAreas()); - if (getGeneratesReferenceArea()) { - setGeneratesBlockArea(true); - } } // --------- Property Resolution related functions --------- // Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java Mon Mar 17 09:31:13 2014 @@ -342,6 +342,34 @@ public abstract class AbstractLayoutMana && isFinished()); } + public boolean hasLineAreaDescendant() { + if (childLMs == null || childLMs.isEmpty()) { + return false; + } else { + for (LayoutManager childLM : childLMs) { + if (childLM.hasLineAreaDescendant()) { + return true; + } + } + } + return false; + } + + public int getBaselineOffset() { + if (childLMs != null) { + for (LayoutManager childLM : childLMs) { + if (childLM.hasLineAreaDescendant()) { + return childLM.getBaselineOffset(); + } + } + } + throw newNoLineAreaDescendantException(); + } + + protected IllegalStateException newNoLineAreaDescendantException() { + return new IllegalStateException("getBaselineOffset called on an object that has no line-area descendant"); + } + /** * Transfers foreign attributes from the formatting object to the area. * @param targetArea the area to set the attributes on Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java Mon Mar 17 09:31:13 2014 @@ -33,11 +33,11 @@ public final class AreaAdditionUtil { /** * Creates the child areas for the given layout manager. - * @param bslm the BlockStackingLayoutManager instance for which "addAreas" is performed. + * @param parentLM the parent layout manager * @param parentIter the position iterator * @param layoutContext the layout context */ - public static void addAreas(BlockStackingLayoutManager bslm, + public static void addAreas(AbstractLayoutManager parentLM, PositionIterator parentIter, LayoutContext layoutContext) { LayoutManager childLM; LayoutContext lc = LayoutContext.offspringOf(layoutContext); @@ -46,8 +46,8 @@ public final class AreaAdditionUtil { Position firstPos = null; Position lastPos = null; - if (bslm != null) { - bslm.addId(); + if (parentLM != null) { + parentLM.addId(); } // "unwrap" the NonLeafPositions stored in parentIter @@ -86,11 +86,11 @@ public final class AreaAdditionUtil { //doesn't give us that info. } - if (bslm != null) { - bslm.registerMarkers( + if (parentLM != null) { + parentLM.registerMarkers( true, - bslm.isFirst(firstPos), - bslm.isLast(lastPos)); + parentLM.isFirst(firstPos), + parentLM.isLast(lastPos)); } PositionIterator childPosIter = new PositionIterator(positionList.listIterator()); @@ -113,11 +113,11 @@ public final class AreaAdditionUtil { childLM.addAreas(childPosIter, lc); } - if (bslm != null) { - bslm.registerMarkers( + if (parentLM != null) { + parentLM.registerMarkers( false, - bslm.isFirst(firstPos), - bslm.isLast(lastPos)); + parentLM.isFirst(firstPos), + parentLM.isLast(lastPos)); } Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/BestFitLayoutUtils.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/BestFitLayoutUtils.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/BestFitLayoutUtils.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/BestFitLayoutUtils.java Mon Mar 17 09:31:13 2014 @@ -20,12 +20,11 @@ package org.apache.fop.layoutmgr; import java.util.LinkedList; import java.util.List; -import org.apache.fop.fo.flow.MultiSwitch; import org.apache.fop.layoutmgr.BestFitPenalty.Variant; /** * Utility class used in {@link MultiSwitchLayoutManager} - * to handle the <i>best-fit</i> property value if specified in {@link MultiSwitch} + * to handle the <i>best-fit</i> property value if specified in {@link org.apache.fop.fo.flow.MultiSwitch} */ public final class BestFitLayoutUtils { Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Mon Mar 17 09:31:13 2014 @@ -37,6 +37,7 @@ import org.apache.fop.datatypes.FODimens import org.apache.fop.datatypes.Length; import org.apache.fop.fo.flow.BlockContainer; import org.apache.fop.fo.properties.CommonAbsolutePosition; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; import org.apache.fop.fo.properties.KeepProperty; import org.apache.fop.traits.MinOptMax; import org.apache.fop.traits.SpaceVal; @@ -44,8 +45,8 @@ import org.apache.fop.traits.SpaceVal; /** * LayoutManager for a block-container FO. */ -public class BlockContainerLayoutManager extends BlockStackingLayoutManager implements - ConditionalElementListener, BreakOpportunity { +public class BlockContainerLayoutManager extends SpacedBorderedPaddedBlockLayoutManager + implements BreakOpportunity { /** * logging instance @@ -79,13 +80,6 @@ public class BlockContainerLayoutManager private MinOptMax foBlockSpaceBefore; private MinOptMax foBlockSpaceAfter; - private boolean discardBorderBefore; - private boolean discardBorderAfter; - private boolean discardPaddingBefore; - private boolean discardPaddingAfter; - private MinOptMax effSpaceBefore; - private MinOptMax effSpaceAfter; - private int horizontalOverflow; private double contentRectOffsetX = 0; private double contentRectOffsetY = 0; @@ -96,6 +90,7 @@ public class BlockContainerLayoutManager */ public BlockContainerLayoutManager(BlockContainer node) { super(node); + setGeneratesBlockArea(true); } /** {@inheritDoc} */ @@ -128,6 +123,11 @@ public class BlockContainerLayoutManager .spaceAfter.getSpace().getOptimum(this).getLength().getValue(this); } + @Override + protected CommonBorderPaddingBackground getCommonBorderPaddingBackground() { + return getBlockContainerFO().getCommonBorderPaddingBackground(); + } + private void resetSpaces() { this.discardBorderBefore = false; this.discardBorderAfter = false; @@ -995,51 +995,6 @@ public class BlockContainerLayoutManager } /** {@inheritDoc} */ - public void notifySpace(RelSide side, MinOptMax effectiveLength) { - if (RelSide.BEFORE == side) { - if (log.isDebugEnabled()) { - log.debug(this + ": Space " + side + ", " - + this.effSpaceBefore + "-> " + effectiveLength); - } - this.effSpaceBefore = effectiveLength; - } else { - if (log.isDebugEnabled()) { - log.debug(this + ": Space " + side + ", " - + this.effSpaceAfter + "-> " + effectiveLength); - } - this.effSpaceAfter = effectiveLength; - } - } - - /** {@inheritDoc} */ - public void notifyBorder(RelSide side, MinOptMax effectiveLength) { - if (effectiveLength == null) { - if (RelSide.BEFORE == side) { - this.discardBorderBefore = true; - } else { - this.discardBorderAfter = true; - } - } - if (log.isDebugEnabled()) { - log.debug(this + ": Border " + side + " -> " + effectiveLength); - } - } - - /** {@inheritDoc} */ - public void notifyPadding(RelSide side, MinOptMax effectiveLength) { - if (effectiveLength == null) { - if (RelSide.BEFORE == side) { - this.discardPaddingBefore = true; - } else { - this.discardPaddingAfter = true; - } - } - if (log.isDebugEnabled()) { - log.debug(this + ": Padding " + side + " -> " + effectiveLength); - } - } - - /** {@inheritDoc} */ public boolean handleOverflow(int milliPoints) { if (milliPoints > this.horizontalOverflow) { this.horizontalOverflow = milliPoints; Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Mon Mar 17 09:31:13 2014 @@ -32,6 +32,7 @@ import org.apache.fop.area.Block; import org.apache.fop.area.LineArea; import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; import org.apache.fop.fo.properties.KeepProperty; import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontInfo; @@ -44,8 +45,8 @@ import org.apache.fop.traits.SpaceVal; /** * LayoutManager for a block FO. */ -public class BlockLayoutManager extends BlockStackingLayoutManager implements ConditionalElementListener, - BreakOpportunity { +public class BlockLayoutManager extends SpacedBorderedPaddedBlockLayoutManager + implements BreakOpportunity { /** logging instance */ private static Log log = LogFactory.getLog(BlockLayoutManager.class); @@ -60,13 +61,6 @@ public class BlockLayoutManager extends private int follow = 2000; //private int middleShift = 0; - private boolean discardBorderBefore; - private boolean discardBorderAfter; - private boolean discardPaddingBefore; - private boolean discardPaddingAfter; - private MinOptMax effSpaceBefore; - private MinOptMax effSpaceAfter; - /** * Creates a new BlockLayoutManager. * @param inBlock the block FO object to create the layout manager for. @@ -100,6 +94,11 @@ public class BlockLayoutManager extends .getOptimum(this).getLength().getValue(this); } + @Override + protected CommonBorderPaddingBackground getCommonBorderPaddingBackground() { + return getBlockFO().getCommonBorderPaddingBackground(); + } + /** {@inheritDoc} */ @Override public List getNextKnuthElements(LayoutContext context, int alignment) { @@ -458,51 +457,6 @@ public class BlockLayoutManager extends } /** {@inheritDoc} */ - public void notifySpace(RelSide side, MinOptMax effectiveLength) { - if (RelSide.BEFORE == side) { - if (log.isDebugEnabled()) { - log.debug(this + ": Space " + side + ", " - + this.effSpaceBefore + "-> " + effectiveLength); - } - this.effSpaceBefore = effectiveLength; - } else { - if (log.isDebugEnabled()) { - log.debug(this + ": Space " + side + ", " - + this.effSpaceAfter + "-> " + effectiveLength); - } - this.effSpaceAfter = effectiveLength; - } - } - - /** {@inheritDoc} */ - public void notifyBorder(RelSide side, MinOptMax effectiveLength) { - if (effectiveLength == null) { - if (RelSide.BEFORE == side) { - this.discardBorderBefore = true; - } else { - this.discardBorderAfter = true; - } - } - if (log.isDebugEnabled()) { - log.debug(this + ": Border " + side + " -> " + effectiveLength); - } - } - - /** {@inheritDoc} */ - public void notifyPadding(RelSide side, MinOptMax effectiveLength) { - if (effectiveLength == null) { - if (RelSide.BEFORE == side) { - this.discardPaddingBefore = true; - } else { - this.discardPaddingAfter = true; - } - } - if (log.isDebugEnabled()) { - log.debug(this + ": Padding " + side + " -> " + effectiveLength); - } - } - - /** {@inheritDoc} */ @Override public boolean isRestartable() { return true; Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Mon Mar 17 09:31:13 2014 @@ -36,6 +36,7 @@ import org.apache.fop.fo.properties.Brea import org.apache.fop.fo.properties.CommonBorderPaddingBackground; import org.apache.fop.fo.properties.KeepProperty; import org.apache.fop.fo.properties.SpaceProperty; +import org.apache.fop.layoutmgr.inline.InlineContainerLayoutManager; import org.apache.fop.layoutmgr.inline.InlineLayoutManager; import org.apache.fop.traits.MinOptMax; import org.apache.fop.util.ListUtil; @@ -1246,6 +1247,8 @@ public abstract class BlockStackingLayou public boolean handleOverflow(int milliPoints) { if (getParent() instanceof BlockStackingLayoutManager) { return ((BlockStackingLayoutManager) getParent()).handleOverflow(milliPoints); + } else if (getParent() instanceof InlineContainerLayoutManager) { + return ((InlineContainerLayoutManager) getParent()).handleOverflow(milliPoints); } return false; } Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java Mon Mar 17 09:31:13 2014 @@ -58,6 +58,7 @@ public class FlowLayoutManager extends B */ public FlowLayoutManager(PageSequenceLayoutManager pslm, Flow node) { super(node); + setGeneratesBlockArea(true); setParent(pslm); } Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/LayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/LayoutManager.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/LayoutManager.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/LayoutManager.java Mon Mar 17 09:31:13 2014 @@ -178,6 +178,25 @@ public interface LayoutManager extends P List getChangedKnuthElements(List oldList, int alignment); /** + * Whether the FO handled by this layout manager has a descendant (including itself) + * that will generate a line-area. + * + * @return {@code true} if a descendant line-area will be generated, {@code false} otherwise + */ + boolean hasLineAreaDescendant(); + + /** + * Returns the position of the dominant-baseline of this FO's first descendant + * line-area. <p>The behavior of this method is undefined if this FO has no descendant + * line-area, and an exception may be thrown. See {@link #hasLineAreaDescendant()}</p> + * + * @return this FO's space-before plus the distance from the before-edge of its + * allocation-rectangle to the dominant-baseline of the first line-area descendant + * @see #hasLineAreaDescendant() + */ + int getBaselineOffset(); + + /** * Returns the IPD of the content area * @return the IPD of the content area */ Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java Mon Mar 17 09:31:13 2014 @@ -75,7 +75,7 @@ import org.apache.fop.layoutmgr.inline.C import org.apache.fop.layoutmgr.inline.ContentLayoutManager; import org.apache.fop.layoutmgr.inline.ExternalGraphicLayoutManager; import org.apache.fop.layoutmgr.inline.FootnoteLayoutManager; -import org.apache.fop.layoutmgr.inline.ICLayoutManager; +import org.apache.fop.layoutmgr.inline.InlineContainerLayoutManager; import org.apache.fop.layoutmgr.inline.InlineLayoutManager; import org.apache.fop.layoutmgr.inline.InstreamForeignObjectLM; import org.apache.fop.layoutmgr.inline.LeaderLayoutManager; @@ -261,9 +261,9 @@ public class LayoutManagerMapping implem /** a layout manager maker */ public static class InlineLayoutManagerMaker extends Maker { /** {@inheritDoc} */ - public void make(FONode node, List lms) { - lms.add(new InlineLayoutManager((InlineLevel) node)); - } + public void make(FONode node, List lms) { + lms.add(new InlineLayoutManager((InlineLevel) node)); + } } /** a layout manager maker */ @@ -278,9 +278,7 @@ public class LayoutManagerMapping implem public static class InlineContainerLayoutManagerMaker extends Maker { /** {@inheritDoc} */ public void make(FONode node, List lms) { - ArrayList childList = new ArrayList(); - super.make(node, childList); - lms.add(new ICLayoutManager((InlineContainer) node, childList)); + lms.add(new InlineContainerLayoutManager((InlineContainer) node)); } } Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java Mon Mar 17 09:31:13 2014 @@ -295,7 +295,7 @@ public class AlignmentContext implements * Return the dominant baseline identifier. * @return the dominant baseline identifier */ - private int getDominantBaselineIdentifier() { + public int getDominantBaselineIdentifier() { return actualBaselineTable.getDominantBaselineIdentifier(); } Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java Mon Mar 17 09:31:13 2014 @@ -332,6 +332,15 @@ public class ContentLayoutManager extend return parentLM.getPSLM(); } + + public boolean hasLineAreaDescendant() { + return true; + } + + public int getBaselineOffset() { + return childLM.getBaselineOffset(); + } + // --------- Property Resolution related functions --------- // /** Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java Mon Mar 17 09:31:13 2014 @@ -67,4 +67,13 @@ public interface InlineLevelEventProduce */ void lineOverflows(Object source, String elementName, int line, int overflowLength, Locator loc); + /** + * Auto IPD on inline-container is not supported. + * + * @param source the event source + * @param fallback the value in points that will be used as a fallback + * @event.severity WARN + */ + void inlineContainerAutoIPDNotSupported(Object source, float fallback); + } Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.xml?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.xml (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.xml Mon Mar 17 09:31:13 2014 @@ -20,4 +20,5 @@ <message key="locator">[ (See position {loc})| (See {#gatherContextInfo})| (No context info available)]</message> <message key="leaderWithoutContent">fo:leader is set to "use-content" but has no content.{{locator}}</message> <message key="lineOverflows">The contents of {elementName} line {line} exceed the available area in the inline-progression direction by {overflowLength,choice,50000#{overflowLength} millipoints|50000<more than 50 points}.{{locator}}</message> + <message key="inlineContainerAutoIPDNotSupported">A value of "auto" for the inline-progression-dimension property on fo:inline-container is not supported. Falling back to {fallback}pt.{{locator}}</message> </catalogue> Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=1578276&r1=1578275&r2=1578276&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (original) +++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Mon Mar 17 09:31:13 2014 @@ -160,6 +160,8 @@ public class LineLayoutManager extends I private final int follow; private AlignmentContext alignmentContext; + private int baselineOffset = -1; + private List<KnuthSequence> knuthParagraphs; private LineLayoutPossibilities lineLayouts; @@ -556,7 +558,6 @@ public class LineLayoutManager extends I private int constantLineHeight = 12000; - /** * Create a new Line Layout Manager. * This is used by the block layout manager to create @@ -939,7 +940,11 @@ public class LineLayoutManager extends I while (listIter.hasNext()) { ListElement tempElement; tempElement = (ListElement) listIter.next(); - if (tempElement.getLayoutManager() != this) { + LayoutManager lm = tempElement.getLayoutManager(); + if (baselineOffset < 0 && lm != null && lm.hasLineAreaDescendant()) { + baselineOffset = lm.getBaselineOffset(); + } + if (lm != this) { tempElement.setPosition(notifyPos(new NonLeafPosition(this, tempElement.getPosition()))); } @@ -987,6 +992,9 @@ public class LineLayoutManager extends I } startIndex = endIndex + 1; LineBreakPosition lbp = (LineBreakPosition) llPoss.getChosenPosition(i); + if (baselineOffset < 0) { + baselineOffset = lbp.spaceBefore + lbp.baseline; + } returnList.add(new KnuthBlockBox( lbp.lineHeight + lbp.spaceBefore + lbp.spaceAfter, footnoteList, lbp, false)); @@ -1424,6 +1432,16 @@ public class LineLayoutManager extends I } } + @Override + public boolean hasLineAreaDescendant() { + return true; + } + + @Override + public int getBaselineOffset() { + return baselineOffset; + } + /** * Add the areas with the break points. * --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
